This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

cc2540作为透传使用,数据接收的疑问

Other Parts Discussed in Thread: CC2540

用cc2540做透传使用,#define SIMPLEPROFILE_CHAR1_LEN   20 ,然后使用

在 simpleProfileChangeCB( uint8 paramID )中处理接收数据

uint8 newValueBuf[20]={0};

SimpleProfile_GetParameter( SIMPLEPROFILE_CHAR1, newValueBuf );

SerialWrite (newValueBuf, 20);

目前这样做会出现接收1个字节数据后,串口助手实际是接收20个,那是因为SerialWrite (newValueBuf, 20)

中写了20个,而实际上我要如何去获取正真接收到,也就是说20这个值怎么替换成实际接收长度?

另外再进入SimpleProfile_GetParameter函数

case SIMPLEPROFILE_CHAR1:

VOID osal_memcpy( value, simpleProfileChar1, strlen(simpleProfileChar1) );

下面是simpleProfileChar1的申明

static uint8 simpleProfileChar1[20] = {0};

而这样处理就不能接收0x00了