wiced_uart_config_t uart_config =
{
.baud_rate = 115200,
.data_width = DATA_WIDTH_8BIT,
.parity = NO_PARITY,
.stop_bits = STOP_BITS_1,
.flow_control = FLOW_CONTROL_DISABLED,
};
#define RX_BUFFER_SIZE 64
wiced_ring_buffer_t rx_buffer;
uint8_t rx_data[RX_BUFFER_SIZE];
#define TEST_STR "\r\nIdealsee:Type something! Keystrokes are echoed to the terminal ...\r\n> "
//////////////////////////////////////
/* Initialise ring buffer */
ring_buffer_init(&rx_buffer, rx_data, RX_BUFFER_SIZE );
/* Initialise UART. A ring buffer is used to hold received characters */
wiced_uart_init( HD_UART1, &uart_config, &rx_buffer );
/* Send a test string to the terminal */
wiced_uart_transmit_bytes( HD_UART1, TEST_STR, sizeof( TEST_STR ) - 1 );
/* Wait for user input. If received, echo it back to the terminal */
while ( wiced_uart_receive_bytes( HD_UART1, &c, &expected_data_size, WICED_NEVER_TIMEOUT ) == WICED_SUCCESS )
{
wiced_uart_transmit_bytes( HD_UART1, &c, 1 );
expected_data_size = 1;
}
43907 UART
最新推荐文章于 2024-03-06 22:45:11 发布