uart write example


static void uart_loopback_test()
{
uint8_t tx_data[8] = {0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00};
uint8_t tx_dataRelease[8] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
// uint8_t *pData = (uint8_t)&tx_data;


// Start sending one byte and see if you get the same
for (uint32_t i = 0; i < 8; i++)
{
uint32_t err_code;
while (app_uart_put(tx_data[i]) != NRF_SUCCESS);
nrf_delay_ms(200);

}

for (uint32_t i = 0; i < 8; i++)
{
uint32_t err_code;
while (app_uart_put(tx_dataRelease[i]) != NRF_SUCCESS);
nrf_delay_ms(10);
}

nrf_delay_ms(10000);
return;
}
#else
/* When UART is used for communication with the host do not use flow control.*/
#define UART_HWFC APP_UART_FLOW_CONTROL_DISABLED
#endif

uart write example

上一篇:超详细带你入门开发一个超实用的浏览器插件


下一篇:Mybatis逆向工程