init
Dependencies: aconno_I2C Lis2dh12 WatchdogTimer
common.cpp@7:e9a19750700d, 2018-12-11 (annotated)
- Committer:
- pathfindr
- Date:
- Tue Dec 11 22:18:24 2018 +0000
- Revision:
- 7:e9a19750700d
- Child:
- 9:b0a1535b8ef2
init
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| pathfindr | 7:e9a19750700d | 1 | #include "common.h" |
| pathfindr | 7:e9a19750700d | 2 | |
| pathfindr | 7:e9a19750700d | 3 | //------------------------------------------------------------------------------ |
| pathfindr | 7:e9a19750700d | 4 | // LED |
| pathfindr | 7:e9a19750700d | 5 | //------------------------------------------------------------------------------ |
| pathfindr | 7:e9a19750700d | 6 | DigitalOut led1(PN_LED); |
| pathfindr | 7:e9a19750700d | 7 | |
| pathfindr | 7:e9a19750700d | 8 | void LED1on(long milliseconds = 0) { |
| pathfindr | 7:e9a19750700d | 9 | led1 = 0; |
| pathfindr | 7:e9a19750700d | 10 | if (milliseconds > 0) { |
| pathfindr | 7:e9a19750700d | 11 | ThisThread::sleep_for(milliseconds); |
| pathfindr | 7:e9a19750700d | 12 | led1 = 1; |
| pathfindr | 7:e9a19750700d | 13 | } |
| pathfindr | 7:e9a19750700d | 14 | } |
| pathfindr | 7:e9a19750700d | 15 | void LED1blink(int count = 2, long milliseconds = 100) { |
| pathfindr | 7:e9a19750700d | 16 | for (int i = 0; i < (count*2); i++) { |
| pathfindr | 7:e9a19750700d | 17 | led1 = !led1; |
| pathfindr | 7:e9a19750700d | 18 | if (milliseconds > 0) { |
| pathfindr | 7:e9a19750700d | 19 | ThisThread::sleep_for(milliseconds); |
| pathfindr | 7:e9a19750700d | 20 | } else { |
| pathfindr | 7:e9a19750700d | 21 | ThisThread::sleep_for(100); //default if 0 provided |
| pathfindr | 7:e9a19750700d | 22 | } |
| pathfindr | 7:e9a19750700d | 23 | } |
| pathfindr | 7:e9a19750700d | 24 | led1 = 1; |
| pathfindr | 7:e9a19750700d | 25 | } |
| pathfindr | 7:e9a19750700d | 26 | void LED1off() { |
| pathfindr | 7:e9a19750700d | 27 | led1 = 1; |
| pathfindr | 7:e9a19750700d | 28 | } |