Created
July 16, 2020 07:20
-
-
Save devilholk/455ac70f42908edba5c16318255ba9c5 to your computer and use it in GitHub Desktop.
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
void uart_send_data(volatile void* data, int length) { | |
dma_channel_reset(DMA1, DMA_CHANNEL4); | |
dma_set_peripheral_address(DMA1, DMA_CHANNEL4, (uint32_t) &USART1_DR); | |
dma_set_memory_address(DMA1, DMA_CHANNEL4, (uint32_t) data); | |
dma_set_number_of_data(DMA1, DMA_CHANNEL4, length); | |
dma_set_read_from_memory(DMA1, DMA_CHANNEL4); | |
dma_enable_memory_increment_mode(DMA1, DMA_CHANNEL4); | |
dma_set_peripheral_size(DMA1, DMA_CHANNEL4, DMA_CCR_PSIZE_8BIT); | |
dma_set_memory_size(DMA1, DMA_CHANNEL4, DMA_CCR_MSIZE_8BIT); | |
dma_set_priority(DMA1, DMA_CHANNEL4, DMA_CCR_PL_VERY_HIGH); | |
dma_enable_channel(DMA1, DMA_CHANNEL4); | |
usart_enable_tx_dma(USART1); | |
while (!dma_get_interrupt_flag (DMA1, DMA_CHANNEL4, DMA_TCIF)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment