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

上一篇:老曹骑士(bfs)


下一篇:etcd学习(9)-etcd中的存储实现