Andrew Reed
/
city1082-rtos-telemetry
City1082 telemetry application
src/statusled.cpp@8:254f53c47a2b, 2021-12-01 (annotated)
- Committer:
- reedas
- Date:
- Wed Dec 01 10:15:16 2021 +0000
- Revision:
- 8:254f53c47a2b
Added status led display thread
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
reedas | 8:254f53c47a2b | 1 | /* mbed Microcontroller Library |
reedas | 8:254f53c47a2b | 2 | * Copyright (c) 2019 ARM Limited |
reedas | 8:254f53c47a2b | 3 | * SPDX-License-Identifier: Apache-2.0 |
reedas | 8:254f53c47a2b | 4 | */ |
reedas | 8:254f53c47a2b | 5 | |
reedas | 8:254f53c47a2b | 6 | #include "mbed.h" |
reedas | 8:254f53c47a2b | 7 | #include "statusled.h" |
reedas | 8:254f53c47a2b | 8 | |
reedas | 8:254f53c47a2b | 9 | |
reedas | 8:254f53c47a2b | 10 | // Blinking rate in milliseconds |
reedas | 8:254f53c47a2b | 11 | #define BLINKING_RATE 500ms |
reedas | 8:254f53c47a2b | 12 | |
reedas | 8:254f53c47a2b | 13 | |
reedas | 8:254f53c47a2b | 14 | void statusledThread() |
reedas | 8:254f53c47a2b | 15 | { |
reedas | 8:254f53c47a2b | 16 | // Initialise the digital pin LED1 as an output |
reedas | 8:254f53c47a2b | 17 | DigitalOut led(LED1); |
reedas | 8:254f53c47a2b | 18 | |
reedas | 8:254f53c47a2b | 19 | while (true) { |
reedas | 8:254f53c47a2b | 20 | led = !led; |
reedas | 8:254f53c47a2b | 21 | ThisThread::sleep_for(BLINKING_RATE); |
reedas | 8:254f53c47a2b | 22 | } |
reedas | 8:254f53c47a2b | 23 | } |