stock mbed AnalogReads current loop closed and working

Dependencies:   mbed

Fork of priustroller by Bayley Wang

Revision:
11:dccbaa9274c5
Child:
34:bfe180de813a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/meta/referencesynthesizers.cpp	Sun Mar 08 08:37:38 2015 +0000
@@ -0,0 +1,20 @@
+#include "includes.h"
+#include "meta.h"
+#include "sensors.h"
+#include "lut.h"
+#include "core.h"
+
+void SynchronousReferenceSynthesizer::GetReference(float angle, float throttle, float *ref_d, float *ref_q) {
+    *ref_d = 0.0f;
+    *ref_q = _max_phase_current * throttle;
+}
+
+float ReferenceSynthesizer::LutSin(float theta) {
+    if (theta < 0.0f) theta += 360.0f;
+    if (theta >= 360.0f) theta -= 360.0f;
+    return sinetab[(int) theta] * 2.0f - 1.0f;
+}
+
+float ReferenceSynthesizer::LutCos(float theta) {
+    return LutSin(90.0f - theta);
+}
\ No newline at end of file