![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
TOF based Presence Detector
Dependencies: BLE_API X_NUCLEO_6180XA1 X_NUCLEO_IDB0XA1 mbed
Fork of BLE_HeartRate_IDB0XA1 by
Diff: bricks/sleep.h
- Revision:
- 27:32267cee7cb8
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bricks/sleep.h Sat Jan 14 08:43:14 2017 +0000 @@ -0,0 +1,50 @@ +// sleep.h - sleep for some time +// +// Synopsis: +// +// void sleep(Blob &o) // low energy sleep for some mili seconds +// void sleep(Blob &o, int ms) // low enery sleep, handle BLE events +// +// Arguments: +// +// o: Blob object (to avoid name clashes) +// msec: sleeping interval in miliseconds +// +// Description: +// +// +// Example 1: main function body to setup BLE functionality +// +// main(void) +// { +// Blob o; // our Blob object +// init(o,onSetup,onError); // init BLE base layer, always do first +// +// while (true) // Infinite loop waiting for BLE events +// sleep(o); // low power waiting for BLE events +// } +// +// Example 2: Turn LED on for 2 seconds miliseconds +// +// led = 1; // turn LED on +// sleep(o,2000); // wait 2000 miliseconds (in LE mode) +// led = 0; // turn LED off +// +// See also: BLOB, INIT +// +#ifndef _SLEEP_H_ +#define _SLEEP_H_ + +#include "bricks/blob.h" + + inline void sleep(Blob &o) // low power waiting for BLE events + { + o.waitForEvent(); // low power waiting for BLE events + } + + inline void sleep(Blob &o, int ms) // low power waiting for BLE events + { + wait_ms(ms); // low power waiting for some miliseconds + } + +#endif // _SLEEP_H_ \ No newline at end of file