); DEBUG(
"Restarting the advertising process\n\r"); ble
.startAdvertising();}
void style="color: #000000; box-sizing: border-box;">*
params){
if ((uartServicePtr
!= NULL)
&& (
params->handle == uartServicePtr
->getTXCharacteristicHandle())) { uint16_t bytesRead
= params->len; DEBUG(
"received %u bytes\n\r", bytesRead); ble
.updateCharacteristicValue(uartServicePtr
->getRXCharacteristicHandle(),
params->data, bytesRead); }}
void periodicCallback(
void){ led1
= !led1;}int main(
void){ led1
= 1; Ticker ticker; ticker
.attach(periodicCallback,
1); DEBUG(
"Initialising the nRF51822\n\r"); ble
.init(); ble
.onDisconnection(disconnectionCallback); ble
.onDataWritten(onDataWritten); ble
.accumulateAdvertisingPayload(GapAdvertisingData
::BREDR_NOT_SUPPORTED); ble
.setAdvertisingType(GapAdvertisingParams
::ADV_CONNECTABLE_UNDIRECTED); ble
.accumulateAdvertisingPayload(GapAdvertisingData
::SHORTENED_LOCAL_NAME, (const uint8_t
*)
"BLE UART", sizeof(
"BLE UART")
- 8/9 首页 上一页 6 7 8 9 下一页 尾页