Bluetooth Connected TOF Sensor
Dependencies: BLE_API X_NUCLEO_6180XA1 X_NUCLEO_IDB0XA1 mbed
Fork of BLE_HeartRate_IDB0XA1 by
Diff: bricks/blinker.h
- Revision:
- 28:def5e0f0fb06
diff -r 32267cee7cb8 -r def5e0f0fb06 bricks/blinker.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bricks/blinker.h Wed Feb 01 22:08:56 2017 +0000 @@ -0,0 +1,64 @@ +// blinker.h - blinking sequences for LED1 +#ifndef _BLINKER_H_ +#define _BLINKER_H_ + +#include <mbed.h> + +# define BLINKER_SEQUENCE_IDLE "x " +# define BLINKER_SEQUENCE_ADVERTISE "x xxx " +# define BLINKER_SEQUENCE_CONNECTED " xxx " +# define BLINKER_SEQUENCE_ACTION "x x x x x " +# define BLINKER_SEQUENCE_ERROR "x x x x xxx " +# define BLINKER_SEQUENCE_TRANSITION "x x x " + + class Blinker + { + public: // construction + Blinker() {} // nothing to do + + public: + void setled(bool state); + void stop(); + void morse(const char *pattern, double periode = 0.2); + void blink(const char *pattern, const char* next, double interval = 0.2); + void blink(const char *pattern, double periode = 0.2); + + void idle(const char *action = BLINKER_SEQUENCE_IDLE) + { + blink(action,BLINKER_SEQUENCE_IDLE); + } + + void advertise(const char *action = BLINKER_SEQUENCE_ADVERTISE) + { + blink(action,BLINKER_SEQUENCE_ADVERTISE); + } + + void connected(const char *action = BLINKER_SEQUENCE_ACTION) + { + blink(action, BLINKER_SEQUENCE_CONNECTED); + } + + void action() // 'action' blink sequence + { + blink(BLINKER_SEQUENCE_ACTION, BLINKER_SEQUENCE_IDLE); + } + + void error(const char *action = BLINKER_SEQUENCE_ERROR) + { + blink(action,BLINKER_SEQUENCE_ERROR); + } + + void on() // switch LED on + { + stop(); + setled(true); + } + + void off() // switch LED off + { + stop(); + setled(false); + } + }; + +#endif // _BLINKER_H_ \ No newline at end of file