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.cpp
00001 // init.cpp - initialize BLE system 00002 00003 #include "bricks/init.h" 00004 #include "bricks/blink.h" 00005 #include "bricks/trace.h" 00006 00007 static void (*cbSetup)(O&o) = 0; // setup callback 00008 static void (*cbError)(O&o) = 0; // error callback 00009 00010 static void cbDefaultError(O&o) // default error handler 00011 { 00012 blinkError(o); // 'error' blink sequence 00013 } 00014 00015 static void initComplete(BLE::InitializationCompleteCallbackContext *params) 00016 { 00017 Blob o; // setup a blob 00018 o.pComplete = params; // store to provide access 00019 00020 // params->error = (ble_error_t)((int)BLE_ERROR_NONE+1); // uncomment for debug 00021 00022 trace(o,2,"<initialized>\n"); 00023 00024 if (params->error != BLE_ERROR_NONE) 00025 { 00026 trace(o,0,"error\n"); 00027 if (cbError) 00028 (*cbError)(o); // handle error in follow-up 00029 00030 return; 00031 } 00032 00033 // Ensure that it is the default instance of BLE 00034 00035 if(o.getInstanceID() != BLE::DEFAULT_INSTANCE) 00036 { 00037 return; 00038 } 00039 00040 (*cbSetup)(o); // followup with setup 00041 } 00042 00043 00044 void init(O&o, void (*scb)(O&o),void (*ecb)(O&o)) // init BLE system 00045 { 00046 cbSetup = scb; // store setup callback 00047 cbError = ecb; // store error callback 00048 o.init(initComplete); 00049 } 00050 00051 00052 void init(O&o, void (*scb)(O&o)) // initialize BLE system 00053 { 00054 init(o,scb,cbDefaultError); // continue with default error callback 00055 }
Generated on Tue Jul 12 2022 21:31:05 by
1.7.2
