/** @file usart.h * Module handling Universal Synchronous/Asynchronous Receiver/Transmitter * * The module provides functions to configure the usarts and read/write from/to * it */ #ifndef _USART_H_ #define _USART_H_ //--includes-------------------------------------------------------------------- #include "dma.h" #include "stdint.h" //--type definitions------------------------------------------------------------ enum UsartPeriph { USART_PERIPH_1, USART_PERIPH_2, USART_PERIPH_3, }; enum UsartConfig { USART_CONFIG_7E1, USART_CONFIG_7E2, USART_CONFIG_7O1, USART_CONFIG_7O2, USART_CONFIG_8N1, USART_CONFIG_8N2, USART_CONFIG_8E1, USART_CONFIG_8E2, USART_CONFIG_8O1, USART_CONFIG_8O2, }; //--functions------------------------------------------------------------------- void usart_configure(enum UsartPeriph periph, enum UsartConfig config, uint32_t baudrate); void usart_reset(enum UsartPeriph periph); uint32_t usart_write_byte(enum UsartPeriph periph, uint8_t byte); uint32_t usart_read_byte(enum UsartPeriph periph, uint8_t* byte); const struct DmaParam* usart_configure_rx_dma(enum UsartPeriph periph); const struct DmaParam* usart_configure_tx_dma(enum UsartPeriph periph); #endif //_USART_H_