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
init.h
00001 // init.h - initialize BLE system 00002 // 00003 // Synopsis: 00004 // 00005 // void init(Blob &o, void (*scb)(Blob&),void (*ecb)(Blob&)) // init BLE 00006 // void init(Blob &o, void (*scb)(Blob&)) // init BLE 00007 // 00008 // Arguments: 00009 // 00010 // o: Blob object (to avoid name clashes) 00011 // scb: setup callback 00012 // ecb: error callback 00013 // 00014 // Description: 00015 // 00016 // Initialize BLE system, providing a setup callback and optionally an error 00017 // callback. The actual initializing happens in the setup callback. If an 00018 // error occurs during initializin, the error callback will be consulted. If 00019 // no error callback is provided an implicit error callback will be called. 00020 // 00021 // Example 1: simple BLE system setup 00022 // 00023 // void cbSetup(Blob &o) 00024 // { 00025 // device(o,"IoT node"); // setup device name 00026 // name(o,"Node #1"); // setup advertising name 00027 // advertise("C:ng"); // start advertising 00028 // } 00029 // 00030 // main(void) 00031 // { 00032 // Blob o; // our Blob object 00033 // init(o,cbSetup); // init BLE base layer, always do first 00034 // while (true) // Infinite loop waiting for BLE events 00035 // sleep(o); // low energy waiting 00036 // } 00037 // 00038 // Example 2: Provide also error handler 00039 // 00040 // void cbError(Blob &o) 00041 // { 00042 // trace(0,"init error!"); 00043 // } 00044 // 00045 // void cbSetup(Blob &o) 00046 // { 00047 // device(o,"IoT node"); // setup device name 00048 // name(o,"Node #1"); // setup advertising name 00049 // advertise("C:ng"); // start advertising 00050 // } 00051 // 00052 // main(void) 00053 // { 00054 // Blob o; // our Blob object 00055 // init(o,cbSetup,cbError); // init BLE base layer, always do first 00056 // while (true) // Infinite loop waiting for BLE events 00057 // sleep(o); // low energy waiting 00058 // } 00059 // 00060 // Example 3: Without Callbacks (busy waiting until initialized) 00061 // 00062 // main(void) 00063 // { 00064 // Blob o; // our Blob object 00065 // init(o); // init BLE base layer, always do first 00066 // 00067 // device(o,"IoT node"); // setup device name 00068 // name(o,"Node #1"); // setup advertising name 00069 // advertise("C:ng"); // start advertising 00070 // 00071 // while (true) // Infinite loop waiting for BLE events 00072 // sleep(o); // low energy waiting 00073 // } 00074 // 00075 // See also: BLOB, INIT 00076 // 00077 #ifndef _INIT_H_ 00078 #define _INIT_H_ 00079 00080 #include "bricks/o.h" 00081 00082 //============================================================================== 00083 // Initializing 00084 //============================================================================== 00085 00086 void init(O&o, void (*scb)(O&o),void (*ecb)(O&o)); // init BLE system 00087 void init(O&o, void (*scb)(O&o)); // init BLE system 00088 void init(O&o); // init BLE system 00089 00090 #endif // _INIT_H_
Generated on Sat Jul 16 2022 07:45:39 by
1.7.2
