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: RTOS-Threads/src/Task2_Slave.cpp
- Revision:
- 51:04c6af4319e1
- Parent:
- 50:8a0accb23007
diff -r 8a0accb23007 -r 04c6af4319e1 RTOS-Threads/src/Task2_Slave.cpp
--- a/RTOS-Threads/src/Task2_Slave.cpp Mon May 19 14:16:47 2014 +0000
+++ b/RTOS-Threads/src/Task2_Slave.cpp Mon May 19 15:30:05 2014 +0000
@@ -18,7 +18,6 @@
int16_t gx, gy, gz;
volatile int gyro[3] = {0, 0, 0};
-bool counterESC = false;
@@ -28,8 +27,13 @@
void Task2_Slave(void const *argument)
{
while (1) {
+ //PC.printf("T2S\n");
sem_Task2_Slave.wait();
+ //PC.printf("T2S Sem\n");
+
+ mutex_i2c.lock();
gyroSample();
+ mutex_i2c.unlock();
if (armed) {
yawPIDrate.setSetPoint(inputYPR[0]);
@@ -46,8 +50,7 @@
adjust[0] = yawPIDrate.compute();
adjust[1] = pitchPIDrate.compute();
adjust[2] = rollPIDrate.compute();
-
- counterESC = true;
+
break;
case ATTITUDE:
@@ -63,11 +66,11 @@
adjust[1] = pitchPIDrate.compute();
adjust[2] = rollPIDrate.compute();
- counterESC = true;
break;
}
- //sem_Task4.release();
+ sem_Task4.release();
}
+ Thread::wait(TASK2_SLAVE_PERIOD);
}
}
@@ -79,6 +82,7 @@
// ************************
void Task2_Slave_ISR(void const *argument)
{
+ //PC.printf("T2S ISR\n");
sem_Task2_Slave.release();
}