diff options
author | Stefan Kerkmann <karlk90@pm.me> | 2021-07-02 00:24:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-02 08:24:08 +1000 |
commit | 117bff17ba89a70dd85163b499c262b879f52afd (patch) | |
tree | 055d7704c28711bd3c30ba8f55a2b3524395578b /drivers/chibios/serial_usart.h | |
parent | 47b12470e762732638a79e6752069564d6fb9649 (diff) |
[Core] Unite half-duplex and full-duplex serial drivers (#13081)
* Unite half-duplex and full-duplex serial driver.
* Add full duplex operation mode to the interrupt based driver
* Delete DMA UART based full duplex driver
* The new driver targets #11930
* Fix freezes with failing transactions in half-duplex
* Increase default serial TX/RX buffer size to 128 bytes
* Correctly use bool instead of size_t
Co-authored-by: Nick Brassel <nick@tzarc.org>
Diffstat (limited to 'drivers/chibios/serial_usart.h')
-rw-r--r-- | drivers/chibios/serial_usart.h | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/drivers/chibios/serial_usart.h b/drivers/chibios/serial_usart.h index fee7b4d159..c64e15566f 100644 --- a/drivers/chibios/serial_usart.h +++ b/drivers/chibios/serial_usart.h @@ -23,19 +23,45 @@ #include <ch.h> #include <hal.h> -#ifndef USART_CR1_M0 +#if !defined(SERIAL_USART_DRIVER) +# define SERIAL_USART_DRIVER SD1 +#endif + +#if !defined(USE_GPIOV1) +/* The default PAL alternate modes are used to signal that the pins are used for USART. */ +# if !defined(SERIAL_USART_TX_PAL_MODE) +# define SERIAL_USART_TX_PAL_MODE 7 +# endif +# if !defined(SERIAL_USART_RX_PAL_MODE) +# define SERIAL_USART_RX_PAL_MODE 7 +# endif +#endif + +#if defined(SOFT_SERIAL_PIN) +# define SERIAL_USART_TX_PIN SOFT_SERIAL_PIN +#endif + +#if !defined(SERIAL_USART_TX_PIN) +# define SERIAL_USART_TX_PIN A9 +#endif + +#if !defined(SERIAL_USART_RX_PIN) +# define SERIAL_USART_RX_PIN A10 +#endif + +#if !defined(USART_CR1_M0) # define USART_CR1_M0 USART_CR1_M // some platforms (f1xx) dont have this so #endif -#ifndef SERIAL_USART_CR1 +#if !defined(SERIAL_USART_CR1) # define SERIAL_USART_CR1 (USART_CR1_PCE | USART_CR1_PS | USART_CR1_M0) // parity enable, odd parity, 9 bit length #endif -#ifndef SERIAL_USART_CR2 +#if !defined(SERIAL_USART_CR2) # define SERIAL_USART_CR2 (USART_CR2_STOP_1) // 2 stop bits #endif -#ifndef SERIAL_USART_CR3 +#if !defined(SERIAL_USART_CR3) # define SERIAL_USART_CR3 0 #endif @@ -61,11 +87,11 @@ } while (0) #endif -#ifndef SELECT_SOFT_SERIAL_SPEED +#if !defined(SELECT_SOFT_SERIAL_SPEED) # define SELECT_SOFT_SERIAL_SPEED 1 #endif -#ifdef SERIAL_USART_SPEED +#if defined(SERIAL_USART_SPEED) // Allow advanced users to directly set SERIAL_USART_SPEED #elif SELECT_SOFT_SERIAL_SPEED == 0 # define SERIAL_USART_SPEED 460800 @@ -83,7 +109,7 @@ # error invalid SELECT_SOFT_SERIAL_SPEED value #endif -#ifndef SERIAL_USART_TIMEOUT +#if !defined(SERIAL_USART_TIMEOUT) # define SERIAL_USART_TIMEOUT 100 #endif |