![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Bluetooth Connected TOF Sensor
Dependencies: BLE_API X_NUCLEO_6180XA1 X_NUCLEO_IDB0XA1 mbed
Fork of BLE_HeartRate_IDB0XA1 by
bricks/blinker.h@28:def5e0f0fb06, 2017-02-01 (annotated)
- Committer:
- hux
- Date:
- Wed Feb 01 22:08:56 2017 +0000
- Revision:
- 28:def5e0f0fb06
First S16_Blue_ToF application which runs nicely!; Digital display can be switched on/off with red slider
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hux | 28:def5e0f0fb06 | 1 | // blinker.h - blinking sequences for LED1 |
hux | 28:def5e0f0fb06 | 2 | #ifndef _BLINKER_H_ |
hux | 28:def5e0f0fb06 | 3 | #define _BLINKER_H_ |
hux | 28:def5e0f0fb06 | 4 | |
hux | 28:def5e0f0fb06 | 5 | #include <mbed.h> |
hux | 28:def5e0f0fb06 | 6 | |
hux | 28:def5e0f0fb06 | 7 | # define BLINKER_SEQUENCE_IDLE "x " |
hux | 28:def5e0f0fb06 | 8 | # define BLINKER_SEQUENCE_ADVERTISE "x xxx " |
hux | 28:def5e0f0fb06 | 9 | # define BLINKER_SEQUENCE_CONNECTED " xxx " |
hux | 28:def5e0f0fb06 | 10 | # define BLINKER_SEQUENCE_ACTION "x x x x x " |
hux | 28:def5e0f0fb06 | 11 | # define BLINKER_SEQUENCE_ERROR "x x x x xxx " |
hux | 28:def5e0f0fb06 | 12 | # define BLINKER_SEQUENCE_TRANSITION "x x x " |
hux | 28:def5e0f0fb06 | 13 | |
hux | 28:def5e0f0fb06 | 14 | class Blinker |
hux | 28:def5e0f0fb06 | 15 | { |
hux | 28:def5e0f0fb06 | 16 | public: // construction |
hux | 28:def5e0f0fb06 | 17 | Blinker() {} // nothing to do |
hux | 28:def5e0f0fb06 | 18 | |
hux | 28:def5e0f0fb06 | 19 | public: |
hux | 28:def5e0f0fb06 | 20 | void setled(bool state); |
hux | 28:def5e0f0fb06 | 21 | void stop(); |
hux | 28:def5e0f0fb06 | 22 | void morse(const char *pattern, double periode = 0.2); |
hux | 28:def5e0f0fb06 | 23 | void blink(const char *pattern, const char* next, double interval = 0.2); |
hux | 28:def5e0f0fb06 | 24 | void blink(const char *pattern, double periode = 0.2); |
hux | 28:def5e0f0fb06 | 25 | |
hux | 28:def5e0f0fb06 | 26 | void idle(const char *action = BLINKER_SEQUENCE_IDLE) |
hux | 28:def5e0f0fb06 | 27 | { |
hux | 28:def5e0f0fb06 | 28 | blink(action,BLINKER_SEQUENCE_IDLE); |
hux | 28:def5e0f0fb06 | 29 | } |
hux | 28:def5e0f0fb06 | 30 | |
hux | 28:def5e0f0fb06 | 31 | void advertise(const char *action = BLINKER_SEQUENCE_ADVERTISE) |
hux | 28:def5e0f0fb06 | 32 | { |
hux | 28:def5e0f0fb06 | 33 | blink(action,BLINKER_SEQUENCE_ADVERTISE); |
hux | 28:def5e0f0fb06 | 34 | } |
hux | 28:def5e0f0fb06 | 35 | |
hux | 28:def5e0f0fb06 | 36 | void connected(const char *action = BLINKER_SEQUENCE_ACTION) |
hux | 28:def5e0f0fb06 | 37 | { |
hux | 28:def5e0f0fb06 | 38 | blink(action, BLINKER_SEQUENCE_CONNECTED); |
hux | 28:def5e0f0fb06 | 39 | } |
hux | 28:def5e0f0fb06 | 40 | |
hux | 28:def5e0f0fb06 | 41 | void action() // 'action' blink sequence |
hux | 28:def5e0f0fb06 | 42 | { |
hux | 28:def5e0f0fb06 | 43 | blink(BLINKER_SEQUENCE_ACTION, BLINKER_SEQUENCE_IDLE); |
hux | 28:def5e0f0fb06 | 44 | } |
hux | 28:def5e0f0fb06 | 45 | |
hux | 28:def5e0f0fb06 | 46 | void error(const char *action = BLINKER_SEQUENCE_ERROR) |
hux | 28:def5e0f0fb06 | 47 | { |
hux | 28:def5e0f0fb06 | 48 | blink(action,BLINKER_SEQUENCE_ERROR); |
hux | 28:def5e0f0fb06 | 49 | } |
hux | 28:def5e0f0fb06 | 50 | |
hux | 28:def5e0f0fb06 | 51 | void on() // switch LED on |
hux | 28:def5e0f0fb06 | 52 | { |
hux | 28:def5e0f0fb06 | 53 | stop(); |
hux | 28:def5e0f0fb06 | 54 | setled(true); |
hux | 28:def5e0f0fb06 | 55 | } |
hux | 28:def5e0f0fb06 | 56 | |
hux | 28:def5e0f0fb06 | 57 | void off() // switch LED off |
hux | 28:def5e0f0fb06 | 58 | { |
hux | 28:def5e0f0fb06 | 59 | stop(); |
hux | 28:def5e0f0fb06 | 60 | setled(false); |
hux | 28:def5e0f0fb06 | 61 | } |
hux | 28:def5e0f0fb06 | 62 | }; |
hux | 28:def5e0f0fb06 | 63 | |
hux | 28:def5e0f0fb06 | 64 | #endif // _BLINKER_H_ |