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
sleep.h
00001 // sleep.h - sleep for some time 00002 // 00003 // Synopsis: 00004 // 00005 // void sleep(Blob &o) // low energy sleep for some mili seconds 00006 // void sleep(Blob &o, int ms) // low enery sleep, handle BLE events 00007 // 00008 // Arguments: 00009 // 00010 // o: Blob object (to avoid name clashes) 00011 // msec: sleeping interval in miliseconds 00012 // 00013 // Description: 00014 // 00015 // 00016 // Example 1: main function body to setup BLE functionality 00017 // 00018 // main(void) 00019 // { 00020 // Blob o; // our Blob object 00021 // init(o,onSetup,onError); // init BLE base layer, always do first 00022 // 00023 // while (true) // Infinite loop waiting for BLE events 00024 // sleep(o); // low power waiting for BLE events 00025 // } 00026 // 00027 // Example 2: Turn LED on for 2 seconds miliseconds 00028 // 00029 // led = 1; // turn LED on 00030 // sleep(o,2000); // wait 2000 miliseconds (in LE mode) 00031 // led = 0; // turn LED off 00032 // 00033 // See also: BLOB, INIT 00034 // 00035 #ifndef _SLEEP_H_ 00036 #define _SLEEP_H_ 00037 00038 #include "bricks/blob.h" 00039 00040 inline void sleep(Blob &o) // low power waiting for BLE events 00041 { 00042 o.waitForEvent(); // low power waiting for BLE events 00043 } 00044 00045 inline void sleep(Blob &o, int ms) // low power waiting for BLE events 00046 { 00047 wait_ms(ms); // low power waiting for some miliseconds 00048 } 00049 00050 #endif // _SLEEP_H_
Generated on Sat Jul 16 2022 07:45:39 by
1.7.2
