add pot. support; L4 trig; eagle schematic draft

pull/3/head
Clyne 3 years ago
parent 1a7d45b913
commit a4f1482a8b

@ -187,7 +187,11 @@ UINCDIR =
ULIBDIR =
# List all user libraries here
ULIBS =
ifeq ($(TARGET_PLATFORM),L4)
ULIBS = -lm
else
ULIBS =
endif
#
# End of user section

File diff suppressed because it is too large Load Diff

@ -122,6 +122,12 @@ asm("vsqrt.f64 d0, d0; bx lr");
return 0;
}
auto readalt() {
adcsample_t s;
asm("svc 3; mov %0, r0" : "=&r"(s));
return s;
}
// End stmdspgui header code
)cpp";
@ -156,7 +162,7 @@ asm("vmov.f32 r1, s0;"
return 0;
}
__attribute__((naked))
auto tan(double x) {
auto tan(float x) {
asm("vmov.f32 r1, s0;"
"mov r0, #2;"
"svc 1;"
@ -170,6 +176,12 @@ asm("vsqrt.f32 s0, s0; bx lr");
return 0;
}
auto readalt() {
adcsample_t s;
asm("push {r4-r6}; svc 3; mov %0, r0; pop {r4-r6}" : "=&r"(s));
return s;
}
// End stmdspgui header code
)cpp";
@ -472,6 +484,11 @@ void MainFrame::prepareEditor()
wxString MainFrame::compileEditorCode()
{
if (m_device == nullptr) {
m_status_bar->SetStatusText("Need device connected to compile.");
return "";
}
if (m_temp_file_name.IsEmpty())
m_temp_file_name = wxFileName::CreateTempFileName("stmdspgui");

@ -1,8 +1,8 @@
#include "cordic.hpp"
#include "hal.h"
namespace cordic {
#if !defined(TARGET_PLATFORM_L4)
namespace cordic {
void init()
{
@ -93,16 +93,21 @@ double tan(double x) {
return tanx;
}
}
#else // L4
#include <cmath>
namespace cordic {
void init() {}
double mod(double, double) { return 0; }
float mod(float a, float b) {
return a - (b * std::floor(a / b));
}
double cos(double) { return 0; }
double sin(double) { return 0; }
double tan(double) { return 0; }
float cos(float x) { return std::cos(x); }
float sin(float x) { return std::sin(x); }
float tan(float x) { return std::tan(x); }
#endif
}
#endif

@ -6,11 +6,19 @@ namespace cordic {
void init();
#if !defined(TARGET_PLATFORM_L4)
double mod(double n, double d);
double cos(double x);
double sin(double x);
double tan(double x);
#else
float mod(float n, float d);
float cos(float x);
float sin(float x);
float tan(float x);
#endif
}
#endif // CORDIC_HPP_

Loading…
Cancel
Save