stm32f1xx_HBL/drv/usart.h
Steins7 ccf36ac400 Simplify dma buffers and adjust usart
The dma buffer should be services that are used on top of peripherals. As such,
the usart driver should'nt directly use them, this is up to the user. The
multi-buffer has also been simplified since I was not satisfied with the
previous implementation
2024-04-03 22:03:15 +02:00

55 lines
1.2 KiB
C

/** @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_