Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: photointerruptRoutines.h
- Revision:
- 63:7921a3b553e9
- Parent:
- 60:f171b7006c73
--- a/photointerruptRoutines.h Fri Mar 24 19:10:41 2017 +0000
+++ b/photointerruptRoutines.h Fri Mar 24 19:57:24 2017 +0000
@@ -7,15 +7,11 @@
volatile int CH_state_prev = 0x00;
volatile float diskPosition = 0.0; //in degrees
-
-volatile float velocityDuty = 0.0;
Timer dt_I3;
-Mutex mutex;
+
-int8_t updateState() { //Convert photointerrupter inputs to a
- return stateMap[4*I3 + 2*I2 + I1]; // rotor state. Reports 1/6 positions
-}
+
void updateDiskPosition() {
if (CH_state != CH_state_prev) {
@@ -76,10 +72,11 @@
}
void i_edge(){
- mutex.lock();
- state = updateState();
- mutex.unlock();
- motorOut((state-orState+lead+6)%6, velocityDuty);
+ callMotorThread();
+ //mutex.lock();
+// state = updateState();
+// mutex.unlock();
+// motorOut((state-orState+lead+6)%6, velocityDuty);
}
void i3rise(){
@@ -94,10 +91,11 @@
count_i3++; // rotor spins forward
mutex.unlock();
}
- mutex.lock();
- state = updateState();
- mutex.unlock();
- motorOut((state-orState+lead+6)%6, velocityDuty);
+ callMotorThread();
+// mutex.lock();
+// state = updateState();
+// mutex.unlock();
+// motorOut((state-orState+lead+6)%6, velocityDuty);
}
void startInterrupts() {
