1.使用BLE-CC254x-1.4.0\Projects\ble\SimpleBLEPeripheral 的demo
在SimpleBLEPeripheral_ProcessEvent 事件最后添加自己的发送数据事件定义为0x0004
if( events & SBP_BURST_EVT)
{
if ( SBP_PERIODIC_EVT_PERIOD )
{
osal_start_timerEx( simpleBLEPeripheral_TaskID, SBP_PERIODIC_EVT, SBP_PERIODIC_EVT_PERIOD );
}
sendData();
sendData();
return (events ^ SBP_BURST_EVT);
}
发送数据测试函数:
static void sendData(void )
{
static uint16 counter=0;
uint8 burstData[20] = {0,1,2,3,4,5,6,7,8,9,0,0,0,0,0,0,0,0,0,0};
attHandleValueNoti_t nData;
nData.len = 20;
nData.handle = 20;
//skKeyPressed = *((uint8*)pValue);
osal_memcpy( &nData.value, &burstData, 20 );
// Send the Notification
if (GATT_Notification( 0, &nData, FALSE )==SUCCESS)
{
counter++;
}
if(counter >1000)
{
osal_stop_timerEx(simpleBLEPeripheral_TaskID,SBP_BURST_EVT);
counter = 0;
}
}
在学习GATT_Notification发数据。。请问下使用BTool怎么接收。
2.除了这种从机发数据给主机的方式,还有没有其他数据发送方式,有无demo可以看。
3.烧写自带编译好的CC2541_keyfob_SimpleBLEPeripheral.hex 亮灯都正常,但是自己编译的hex烧录进去灯就不亮。