Jens Frank Jensen / Mbed 2 deprecated foc-ed_in_the_bot_compact

Dependencies:   mbed FastPWM3

Revision:
83:eb3704d4943f
Parent:
82:5e741c5ffd9f
--- a/interrupts.cpp	Fri Mar 10 08:29:13 2017 +0000
+++ b/interrupts.cpp	Sat Mar 11 08:51:04 2017 +0000
@@ -1,4 +1,5 @@
 #include "globals.h"
+#include "main.h"
 #include "CommandProcessor.h"
 
 char linebuf[128];
@@ -24,4 +25,19 @@
             io.pc->putc('>');
         }
     }
+}
+
+extern "C" void TIM1_UP_TIM10_IRQHandler(void) {
+    int start_state = io.throttle_in->state();
+    if (TIM1->SR & TIM_SR_UIF ) {
+        ADC1->CR2  |= 0x40000000; 
+        volatile int delay;
+        for (delay = 0; delay < 35; delay++);
+        read.adval1 = ADC1->DR;
+        read.adval2 = ADC2->DR;
+        commutate();
+    }
+    TIM1->SR = 0x00;
+    int end_state = io.throttle_in->state();
+    if (start_state != end_state) io.throttle_in->block();
 }
\ No newline at end of file