沁恒板子主机,CC2541板从机。
两个板子连上了,可是无法收发数据。
uint16 Central_ProcessEvent( uint8 task_id, uint16 events )
在上面这个函数里,
if ( events & START_READ_OR_WRITE_EVT )
{
PRINT( "012rn" );
if( centralProcedureInProgress == FALSE )
{
if( centralDoWrite )
{
// Do a write
attWriteReq_t req;
req.cmd = FALSE;
req.sig = FALSE;
req.handle = centralCharHdl;
req.len = 1;
req.pValue = GATT_bm_alloc(centralConnHandle,ATT_WRITE_REQ,req.len,NULL,0);
if ( req.pValue != NULL )
{
*req.pValue = centralCharVal;
PRINT( "111rn" );
if( GATT_WriteCharValue(centralConnHandle,&req,centralTaskId) == SUCCESS )
{
centralProcedureInProgress = TRUE;
centralDoWrite = !centralDoWrite;
tmos_start_task( centralTaskId, START_READ_OR_WRITE_EVT, DEFAULT_READ_OR_WRITE_DELAY);
PRINT( "Send a data" );
}
else
{
GATT_bm_free((gattMsg_t *)&req, ATT_WRITE_REQ);
}
}
}
else
{
// Do a read
attReadReq_t req;
PRINT( "000rn" );
req.handle = centralCharHdl;
if( GATT_ReadCharValue( centralConnHandle, &req, centralTaskId ) == SUCCESS )
{
centralProcedureInProgress = TRUE;
PRINT( "Read a data" );
centralDoWrite = !centralDoWrite;
}
}
}
return ( events ^ START_READ_OR_WRITE_EVT );
}
我在这儿加了好几条打印语句,CC2541板子发数据,什么也打印不出来。
请问高手,什么原因?谢谢!
2022-6-14 14:36:35
那就得确认一下是否真的连接上,其次可以通过我们的手机APP测试一下,可以用手机APP做蓝牙设备
那就得确认一下是否真的连接上,其次可以通过我们的手机APP测试一下,可以用手机APP做蓝牙设备
举报