Created
November 20, 2016 17:52
-
-
Save AlexanderSavochkin/4aa85db819929b2e71fe8374197106ba to your computer and use it in GitHub Desktop.
Пример организации поллинга UART в sam3x8e
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
while (1) | |
{ | |
//Если получили очередной байт из UART - прочитаем его в переменную received_data | |
if ((UART->UART_SR & UART_SR_RXRDY) == UART_SR_RXRDY ) | |
{ | |
uint32_t received_data = UART->UART_RHR; | |
... | |
} | |
//Если готовы отправить очередной байт (зранится в data_to_transmit) через UART - запишем в регистр UART_THR | |
if ((UART->UART_SR & UART_SR_TXRDY) == UART_SR_TXRDY) | |
{ | |
UART->UART_THR = data_to_transmit; | |
} | |
//Делаем что-то ещё | |
... | |
} | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment