Small Demo demonstrating BLE Advertising
Dependencies: BLE_API X_NUCLEO_IDB0XA1 mbed
Fork of BLE_HeartRate_IDB0XA1 by
bricks/blink.h@29:8eb46b976f0f, 2018-05-19 (annotated)
- Committer:
- hux
- Date:
- Sat May 19 15:53:19 2018 +0000
- Revision:
- 29:8eb46b976f0f
Published
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hux | 29:8eb46b976f0f | 1 | // blink.h - blinking sequences for LED1 |
hux | 29:8eb46b976f0f | 2 | #ifndef _BLINK_H_ |
hux | 29:8eb46b976f0f | 3 | #define _BLINK_H_ |
hux | 29:8eb46b976f0f | 4 | |
hux | 29:8eb46b976f0f | 5 | #include <mbed.h> |
hux | 29:8eb46b976f0f | 6 | #include "bricks/o.h" |
hux | 29:8eb46b976f0f | 7 | |
hux | 29:8eb46b976f0f | 8 | # define BLINK_SEQUENCE_IDLE "x " |
hux | 29:8eb46b976f0f | 9 | # define BLINK_SEQUENCE_ADVERTISE "x xxx " |
hux | 29:8eb46b976f0f | 10 | # define BLINK_SEQUENCE_CONNECTED " xxx " |
hux | 29:8eb46b976f0f | 11 | # define BLINK_SEQUENCE_ACTION "x x x x x " |
hux | 29:8eb46b976f0f | 12 | # define BLINK_SEQUENCE_ERROR "x x x x xxx " |
hux | 29:8eb46b976f0f | 13 | # define BLINK_SEQUENCE_TRANSITION "x x x " |
hux | 29:8eb46b976f0f | 14 | |
hux | 29:8eb46b976f0f | 15 | void morse(const char *pattern, double periode = 0.2); |
hux | 29:8eb46b976f0f | 16 | void blink(const char *pattern, const char* next, double interval = 0.2); |
hux | 29:8eb46b976f0f | 17 | void blink(const char *pattern, double periode = 0.2); |
hux | 29:8eb46b976f0f | 18 | |
hux | 29:8eb46b976f0f | 19 | inline void blinkIdle(O&o) // 'idle' blink sequence |
hux | 29:8eb46b976f0f | 20 | { |
hux | 29:8eb46b976f0f | 21 | blink(BLINK_SEQUENCE_IDLE); |
hux | 29:8eb46b976f0f | 22 | } |
hux | 29:8eb46b976f0f | 23 | |
hux | 29:8eb46b976f0f | 24 | inline void blinkAdvertise(O&o) // 'advertise' blink sequence |
hux | 29:8eb46b976f0f | 25 | { |
hux | 29:8eb46b976f0f | 26 | blink(BLINK_SEQUENCE_ADVERTISE); |
hux | 29:8eb46b976f0f | 27 | } |
hux | 29:8eb46b976f0f | 28 | |
hux | 29:8eb46b976f0f | 29 | inline void blinkConnected(O&o) // 'connected' blink sequence |
hux | 29:8eb46b976f0f | 30 | { |
hux | 29:8eb46b976f0f | 31 | blink(BLINK_SEQUENCE_TRANSITION, BLINK_SEQUENCE_CONNECTED); |
hux | 29:8eb46b976f0f | 32 | } |
hux | 29:8eb46b976f0f | 33 | |
hux | 29:8eb46b976f0f | 34 | inline void blinkAction(O&o) // 'action' blink sequence |
hux | 29:8eb46b976f0f | 35 | { |
hux | 29:8eb46b976f0f | 36 | blink(BLINK_SEQUENCE_ACTION, BLINK_SEQUENCE_IDLE); |
hux | 29:8eb46b976f0f | 37 | } |
hux | 29:8eb46b976f0f | 38 | |
hux | 29:8eb46b976f0f | 39 | inline void blinkError(O&o) // 'error' blink sequence |
hux | 29:8eb46b976f0f | 40 | { |
hux | 29:8eb46b976f0f | 41 | blink(BLINK_SEQUENCE_ERROR); |
hux | 29:8eb46b976f0f | 42 | } |
hux | 29:8eb46b976f0f | 43 | |
hux | 29:8eb46b976f0f | 44 | #endif // _BLINK_H_ |