|
本帖最后由 拓拔野 于 2018-3-9 20:02 编辑
改过后的main函数
int main(void)
{
LEDS_CONFIGURE(LEDS_MASK);
LEDS_OFF(LEDS_MASK);
uint32_t err_code;
const app_uart_comm_params_t comm_params =
{
RX_PIN_NUMBER,
TX_PIN_NUMBER,
RTS_PIN_NUMBER,
CTS_PIN_NUMBER,
APP_UART_FLOW_CONTROL_DISABLED,
false,
UART_BAUDRATE_BAUDRATE_Baud115200
};
APP_UART_FIFO_INIT(&comm_params,
UART_RX_BUF_SIZE,
UART_TX_BUF_SIZE,
uart_error_handle,
APP_IRQ_PRIORITY_LOW,
err_code);
APP_ERROR_CHECK(err_code);
//#ifndef ENABLE_LOOPBACK_TEST
printf("\r\nStart0000000000000154564646:\r\n");
while (true)
{
uint8_t cr;
while(app_uart_get(&cr) != NRF_SUCCESS);
// printf(cr);
while(app_uart_put(cr) != NRF_SUCCESS);
//LEDS_INVERT(LEDS_MASK);
LEDS_OFF(LEDS_MASK);
if (cr == 'q' || cr == 'Q')
{
nrf_delay_ms(500);
printf("\n\rExit!Start0000000000000154564646\n\r");
LEDS_ON(LEDS_MASK);
nrf_delay_ms(500);
//LEDS_ON(LEDS_MASK);
// printf("Start646\n\r");
}
//#else
/*
// This part of the example is just for testing the loopback .
while (true)
{
uart_loopback_test();
}
*/
//#endif
}
}
|
|