沁恒板子主机,CC2541板从机。
两个板子连上了,可是无法收发数据。
uint16 Central_ProcessEvent( uint8 task_id, uint16 events )
在上面这个函数里,
if ( events & START_READ_OR_WRITE_EVT )
{
PRINT( "012\r\n" );
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( "111\r\n" );
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( "000\r\n" );
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板子发数据,什么也打印不出来。
请问高手,什么原因?谢谢!