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: BLE_API mbed nRF51822
Fork of BLE_HeartRate_IDB0XA1 by
bricks/blink.h@24:359e85e758c3, 2017-01-08 (annotated)
- Committer:
- hux
- Date:
- Sun Jan 08 23:16:12 2017 +0000
- Revision:
- 24:359e85e758c3
A cute tiny piece of code implementing an Iot NAND device, demonstrating how to setup and advertise a cute GATT (NAND) service.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| hux | 24:359e85e758c3 | 1 | // blink.h - blinking sequences for LED1 |
| hux | 24:359e85e758c3 | 2 | #ifndef _BLINK_H_ |
| hux | 24:359e85e758c3 | 3 | #define _BLINK_H_ |
| hux | 24:359e85e758c3 | 4 | |
| hux | 24:359e85e758c3 | 5 | #include <mbed.h> |
| hux | 24:359e85e758c3 | 6 | #include "bricks/o.h" |
| hux | 24:359e85e758c3 | 7 | |
| hux | 24:359e85e758c3 | 8 | # define BLINK_SEQUENCE_IDLE "x " |
| hux | 24:359e85e758c3 | 9 | # define BLINK_SEQUENCE_ADVERTISE "x xxx " |
| hux | 24:359e85e758c3 | 10 | # define BLINK_SEQUENCE_CONNECTED " xxx " |
| hux | 24:359e85e758c3 | 11 | # define BLINK_SEQUENCE_ACTION "x x x x x " |
| hux | 24:359e85e758c3 | 12 | # define BLINK_SEQUENCE_ERROR "x x x x xxx " |
| hux | 24:359e85e758c3 | 13 | # define BLINK_SEQUENCE_TRANSITION "x x x " |
| hux | 24:359e85e758c3 | 14 | |
| hux | 24:359e85e758c3 | 15 | void morse(const char *pattern, double periode = 0.2); |
| hux | 24:359e85e758c3 | 16 | void blink(const char *pattern, const char* next, double interval = 0.2); |
| hux | 24:359e85e758c3 | 17 | void blink(const char *pattern, double periode = 0.2); |
| hux | 24:359e85e758c3 | 18 | |
| hux | 24:359e85e758c3 | 19 | inline void blinkIdle(O&o) // 'idle' blink sequence |
| hux | 24:359e85e758c3 | 20 | { |
| hux | 24:359e85e758c3 | 21 | blink(BLINK_SEQUENCE_IDLE); |
| hux | 24:359e85e758c3 | 22 | } |
| hux | 24:359e85e758c3 | 23 | |
| hux | 24:359e85e758c3 | 24 | inline void blinkAdvertise(O&o) // 'advertise' blink sequence |
| hux | 24:359e85e758c3 | 25 | { |
| hux | 24:359e85e758c3 | 26 | blink(BLINK_SEQUENCE_ADVERTISE); |
| hux | 24:359e85e758c3 | 27 | } |
| hux | 24:359e85e758c3 | 28 | |
| hux | 24:359e85e758c3 | 29 | inline void blinkConnected(O&o) // 'connected' blink sequence |
| hux | 24:359e85e758c3 | 30 | { |
| hux | 24:359e85e758c3 | 31 | blink(BLINK_SEQUENCE_TRANSITION, BLINK_SEQUENCE_CONNECTED); |
| hux | 24:359e85e758c3 | 32 | } |
| hux | 24:359e85e758c3 | 33 | |
| hux | 24:359e85e758c3 | 34 | inline void blinkAction(O&o) // 'action' blink sequence |
| hux | 24:359e85e758c3 | 35 | { |
| hux | 24:359e85e758c3 | 36 | blink(BLINK_SEQUENCE_ACTION, BLINK_SEQUENCE_IDLE); |
| hux | 24:359e85e758c3 | 37 | } |
| hux | 24:359e85e758c3 | 38 | |
| hux | 24:359e85e758c3 | 39 | inline void blinkError(O&o) // 'error' blink sequence |
| hux | 24:359e85e758c3 | 40 | { |
| hux | 24:359e85e758c3 | 41 | blink(BLINK_SEQUENCE_ERROR); |
| hux | 24:359e85e758c3 | 42 | } |
| hux | 24:359e85e758c3 | 43 | |
| hux | 24:359e85e758c3 | 44 | #endif // _BLINK_H_ |
