* Routeur
Dependencies: ConfigFile mbed MMA8452 mbed-rtos
Fork of S05APP3_routeur by
Revision 15:42879340d625, committed 2017-02-14
- Comitter:
- benjaminroy
- Date:
- Tue Feb 14 18:32:24 2017 +0000
- Parent:
- 14:ef95f6bce079
- Commit message:
- Final commit
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r ef95f6bce079 -r 42879340d625 main.cpp --- a/main.cpp Tue Feb 14 06:16:28 2017 +0000 +++ b/main.cpp Tue Feb 14 18:32:24 2017 +0000 @@ -21,7 +21,9 @@ DigitalOut reset(p8); DigitalIn btn(p15); I2C i2c(p28, p27); // SDA, SCL -Mutex mutex; +Mutex mutex; +Mutex mutex2; +Mutex mutex3; Serial xbee(p13, p14); // tx, rx Serial pc(USBTX, USBRX); // tx, rx Ticker ticker1; @@ -34,7 +36,7 @@ uint8_t data[40]; } mail_t; -Mail<mail_t, 100> mail_box; +Mail<mail_t, 50> mail_box; int16_t (*functionPointers[4])(); uint16_t panId = 0; @@ -279,6 +281,7 @@ while(true) { Thread::signal_wait(0x1); + mutex2.lock(); int16_t dryContact = functionPointers[0] (); uint8_t buffer[19] = { 0 }; @@ -305,6 +308,7 @@ mutex.lock(); addDataToMemPool(sizeof(buffer), buffer, buffer[4]); mutex.unlock(); + mutex2.unlock(); } } @@ -312,6 +316,7 @@ while (true) { Thread::signal_wait(0x1); + mutex3.lock(); int16_t accX = std::abs(functionPointers[1]()); int16_t accY = std::abs(functionPointers[2]()); int16_t accZ = std::abs(functionPointers[3]()); @@ -352,6 +357,7 @@ mutex.lock(); addDataToMemPool(sizeof(buffer), buffer, buffer[4]); mutex.unlock(); + mutex3.unlock(); } }