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 X_NUCLEO_6180XA1 X_NUCLEO_IDB0XA1 mbed
Fork of BLE_HeartRate_IDB0XA1 by
blinker.h
00001 // blinker.h - blinking sequences for LED1 00002 #ifndef _BLINKER_H_ 00003 #define _BLINKER_H_ 00004 00005 #include <mbed.h> 00006 00007 # define BLINKER_SEQUENCE_IDLE "x " 00008 # define BLINKER_SEQUENCE_ADVERTISE "x xxx " 00009 # define BLINKER_SEQUENCE_CONNECTED " xxx " 00010 # define BLINKER_SEQUENCE_ACTION "x x x x x " 00011 # define BLINKER_SEQUENCE_ERROR "x x x x xxx " 00012 # define BLINKER_SEQUENCE_TRANSITION "x x x " 00013 00014 class Blinker 00015 { 00016 public: // construction 00017 Blinker() {} // nothing to do 00018 00019 public: 00020 void setled(bool state); 00021 void stop(); 00022 void morse(const char *pattern, double periode = 0.2); 00023 void blink(const char *pattern, const char* next, double interval = 0.2); 00024 void blink(const char *pattern, double periode = 0.2); 00025 00026 void idle(const char *action = BLINKER_SEQUENCE_IDLE) 00027 { 00028 blink(action,BLINKER_SEQUENCE_IDLE); 00029 } 00030 00031 void advertise(const char *action = BLINKER_SEQUENCE_ADVERTISE) 00032 { 00033 blink(action,BLINKER_SEQUENCE_ADVERTISE); 00034 } 00035 00036 void connected(const char *action = BLINKER_SEQUENCE_ACTION) 00037 { 00038 blink(action, BLINKER_SEQUENCE_CONNECTED); 00039 } 00040 00041 void action() // 'action' blink sequence 00042 { 00043 blink(BLINKER_SEQUENCE_ACTION, BLINKER_SEQUENCE_IDLE); 00044 } 00045 00046 void error(const char *action = BLINKER_SEQUENCE_ERROR) 00047 { 00048 blink(action,BLINKER_SEQUENCE_ERROR); 00049 } 00050 00051 void on() // switch LED on 00052 { 00053 stop(); 00054 setled(true); 00055 } 00056 00057 void off() // switch LED off 00058 { 00059 stop(); 00060 setled(false); 00061 } 00062 }; 00063 00064 #endif // _BLINKER_H_
Generated on Sat Jul 16 2022 07:45:39 by
1.7.2
