From c0e1b4cdf20c55f2cbbdf3a5889f447974135fd8 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Mon, 16 Nov 2020 21:02:48 -0700 Subject: Got the DMA to send a simple message through UART2. --- 02-usart/src/usart.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to '02-usart/src/usart.c') diff --git a/02-usart/src/usart.c b/02-usart/src/usart.c index 42297a8..d4073d0 100644 --- a/02-usart/src/usart.c +++ b/02-usart/src/usart.c @@ -78,3 +78,21 @@ void usart_transmit_str_sync(__IO usart_t* usart, const char* str) usart_transmit_byte_sync(usart, *(str ++)); } } + +void usart_enable_dma(__IO usart_t* usart, usart_enable_t enabled) +{ + switch(enabled) { + case USART_ENABLE_DISABLED: + usart->c3_bf.dmar = 0; + usart->c3_bf.dmat = 0; + break; + + case USART_ENABLE_TX: + usart->c3_bf.dmat = 1; + break; + + case USART_ENABLE_RX: + usart->c3_bf.dmar = 1; + break; + }; +} -- cgit