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.
Dependencies: DS1620_improved TextLCD_improved mbed-rtos mbed
tsk_led.cpp@18:be0130c42925, 2015-12-18 (annotated)
- Committer:
- Jan Tetour
- Date:
- Fri Dec 18 20:00:56 2015 +0100
- Revision:
- 18:be0130c42925
- Parent:
- 17:94c385ff2641
Minor formatting changes.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Jan Tetour | 18:be0130c42925 | 1 | /* |
| Jan Tetour | 18:be0130c42925 | 2 | * TSK_LED.CPP |
| Jan Tetour | 18:be0130c42925 | 3 | */ |
| dzoni | 9:645f0e517017 | 4 | #include "mbed.h" |
| dzoni | 9:645f0e517017 | 5 | #include "rtos.h" |
| dzoni | 9:645f0e517017 | 6 | |
| dzoni | 9:645f0e517017 | 7 | #include "tsk_led.h" |
| dzoni | 9:645f0e517017 | 8 | |
| dzoni | 9:645f0e517017 | 9 | |
| dzoni | 17:94c385ff2641 | 10 | struct led_flash_times_struct led_flash_times; |
| dzoni | 9:645f0e517017 | 11 | |
| dzoni | 9:645f0e517017 | 12 | |
| dzoni | 9:645f0e517017 | 13 | static DigitalOut led2(LED2); |
| dzoni | 9:645f0e517017 | 14 | |
| dzoni | 17:94c385ff2641 | 15 | uint32_t initLed(void const *args) { |
| dzoni | 17:94c385ff2641 | 16 | |
| dzoni | 17:94c385ff2641 | 17 | led_flash_times.on_time = 100; |
| dzoni | 17:94c385ff2641 | 18 | led_flash_times.off_time = 2500; |
| dzoni | 17:94c385ff2641 | 19 | |
| dzoni | 17:94c385ff2641 | 20 | return 1; |
| dzoni | 17:94c385ff2641 | 21 | } |
| dzoni | 9:645f0e517017 | 22 | |
| dzoni | 11:e89f89c0920b | 23 | void led_thread(void const *args) { |
| dzoni | 9:645f0e517017 | 24 | |
| dzoni | 9:645f0e517017 | 25 | while (true) { |
| dzoni | 9:645f0e517017 | 26 | led2 = 1; |
| dzoni | 9:645f0e517017 | 27 | Thread::wait(led_flash_times.on_time); |
| dzoni | 9:645f0e517017 | 28 | |
| dzoni | 9:645f0e517017 | 29 | led2 = 0; |
| dzoni | 9:645f0e517017 | 30 | Thread::wait(led_flash_times.off_time); |
| dzoni | 9:645f0e517017 | 31 | } |
| dzoni | 9:645f0e517017 | 32 | } |