yup

Dependencies:   mbed

Fork of analoghalls by Bayley Wang

Revision:
1:70eed554399b
Parent:
0:9753f3c2e5ca
Child:
2:b5c19d4eddcc
--- a/util.cpp	Mon Feb 16 20:16:01 2015 +0000
+++ b/util.cpp	Sat Feb 21 21:39:33 2015 +0000
@@ -4,7 +4,9 @@
 #include <stdlib.h>
 
 void initTimers() {
-    dtc_upd_ticker.attach_us(&dtc_update, 20);    
+    dtc_upd_ticker.attach_us(&dtc_update, 200);
+    throttle_upd_ticker.attach_us(&throttle_update, 100000);
+      
     pha.period_us(200);
     phb.period_us(200);
     phc.period_us(200);
@@ -14,28 +16,16 @@
 
 }
 
-void initPins() {    
-    halla.mode(PullUp);
-    hallb.mode(PullUp);
-    hallc.mode(PullUp);
-    
+void initPins() {        
     en = 0;
 }
 
 void initData() {
     motor = (Motor*) malloc(sizeof(Motor));
-    motor->hall = (halla.read() << 2) + (hallb.read() << 1) + hallc.read();
-    motor->last_hall = 0;
-    motor->reverses = 0;
-    motor->last_time = 3000.0f;
-    motor->major_pos = 60.0f * ATable[motor->hall];
-    motor->ticks = 0.0f;
     motor->sensor_phase = SENSOR_PHASE;
     motor->halt = 1;
-    motor->whangle =0;
-    motor->analoga = analoga;
-    motor->analogb = analogb;
-    
+    motor->angle =0;
+
     float throttle_raw;
     do {
         throttle_raw = throttle;