temp repo

Dependencies:   mbed

Fork of priustroller_2 by N K

Revision:
0:54cf32d35f4d
Child:
1:1f58bdcf2956
diff -r 000000000000 -r 54cf32d35f4d motor.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/motor.cpp	Sun Mar 01 06:16:01 2015 +0000
@@ -0,0 +1,37 @@
+#include "includes.h"
+#include "classes.h"
+
+Motor::Motor(CurrentSensor *sense_a, CurrentSensor *sense_b, PositionSensor *sense_p, TempSensor *sense_t) {
+    _sense_a = sense_a;
+    _sense_b = sense_b;
+    _sense_p = sense_p;
+    _sense_t = sense_t;
+    UpdateState();
+}
+
+float Motor::UpdateCurrentA() {
+    return I_a = _sense_a->GetCurrent();
+}
+
+float Motor::UpdateCurrentB() {
+    return I_b = _sense_b->GetCurrent();
+}
+
+float Motor::UpdatePosition() {
+    return angle = _sense_p->GetPosition();
+}
+
+float Motor::GetTemp() {
+    return _sense_t->GetTemp();
+}
+
+void Motor::UpdateState() {
+    UpdateCurrentA();
+    UpdateCurrentB();
+    UpdatePosition();
+}
+
+void Motor::Config(int num_poles, float kv) {
+    _num_poles = num_poles;
+    _kv = kv;
+}
\ No newline at end of file