Andrew Reed
/
city1082-rtos-telemetry
City1082 telemetry application
Revision 8:254f53c47a2b, committed 2021-12-01
- Comitter:
- reedas
- Date:
- Wed Dec 01 10:15:16 2021 +0000
- Parent:
- 7:bb1bb2a54033
- Commit message:
- Added status led display thread
Changed in this revision
diff -r bb1bb2a54033 -r 254f53c47a2b src/main.cpp --- a/src/main.cpp Wed Dec 01 00:12:30 2021 +0000 +++ b/src/main.cpp Wed Dec 01 10:15:16 2021 +0000 @@ -3,18 +3,19 @@ * SPDX-License-Identifier: Apache-2.0 */ #include "mbed.h" -#include <ios> -#include <iostream> -#include <iomanip> + #include "display.h" #include "sensors.h" +#include "statusled.h" +Thread statusledThreadHandle; Thread sendingThreadHandle; Thread displayThreadHandle; int main(void) { + statusledThreadHandle.start(callback(statusledThread)); sendingThreadHandle.start(callback(sendThread)); displayThreadHandle.start(callback(displayThread)); }
diff -r bb1bb2a54033 -r 254f53c47a2b src/statusled.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/statusled.cpp Wed Dec 01 10:15:16 2021 +0000 @@ -0,0 +1,23 @@ +/* mbed Microcontroller Library + * Copyright (c) 2019 ARM Limited + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "mbed.h" +#include "statusled.h" + + +// Blinking rate in milliseconds +#define BLINKING_RATE 500ms + + +void statusledThread() +{ + // Initialise the digital pin LED1 as an output + DigitalOut led(LED1); + + while (true) { + led = !led; + ThisThread::sleep_for(BLINKING_RATE); + } +}
diff -r bb1bb2a54033 -r 254f53c47a2b src/statusled.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/statusled.h Wed Dec 01 10:15:16 2021 +0000 @@ -0,0 +1,5 @@ +#ifndef STATUSLED_H +#define STATUSLED_H + +void statusledThread(); +#endif \ No newline at end of file