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串口输入和特性通知问题



1、我的串口输入只能输入一次

(void)port;
uint8 numBytes = 0;
uint8 buf[128];

if (events & HAL_UART_RX_TIMEOUT) //串口有数据
{
numBytes = NPI_RxBufLen(); //读出串口缓冲区有多少字节
if(numBytes)
{
if ( numBytes >= SIMPLEPROFILE_CHAR1_LEN ) buf[0] = SIMPLEPROFILE_CHAR1_LEN-1;
else buf[0] = numBytes;
NPI_ReadTransport(&buf[1],buf[0]);
//从串口缓冲区读出numBytes字节数据

webeesensorProfile_SetParameter( WEBEESENSORPROFILE_TEMP, SIMPLEPROFILE_CHAR1_LEN, buf );
NPI_ReadTransport(buf,numBytes);
}
}

2、读取串口输入的数据,通知手机,打开的数据跟输入的不一样