diff options
author | adelyser <12093019+adelyser@users.noreply.github.com> | 2021-11-19 08:27:56 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-19 10:27:56 -0500 |
commit | a5ec751406c12f063eb464bc4f577279452181ad (patch) | |
tree | 5339ba39feca41dbf4fd7c40f25b3c7a44ef0ffb | |
parent | 08dab6f825043a616e6eec7efb8828840fda3b61 (diff) | |
download | kutter-a5ec751406c12f063eb464bc4f577279452181ad.tar.gz kutter-a5ec751406c12f063eb464bc4f577279452181ad.tar.xz kutter-a5ec751406c12f063eb464bc4f577279452181ad.zip |
stm32: Add UART4 to stm32h7 (#4848)
Signed-off-by: Aaron DeLyser <bluwolf@gmail.com>
-rw-r--r-- | src/stm32/stm32h7_serial.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/stm32/stm32h7_serial.c b/src/stm32/stm32h7_serial.c index 58e42da5..1cb93e9b 100644 --- a/src/stm32/stm32h7_serial.c +++ b/src/stm32/stm32h7_serial.c @@ -48,6 +48,17 @@ #define GPIO_Tx GPIO('D', 8) #define USARTx USART3 #define USARTx_IRQn USART3_IRQn +#elif CONFIG_STM32_SERIAL_UART4 + DECL_CONSTANT_STR("RESERVE_PINS_serial", "PA1,PA0"); + #define GPIO_Rx GPIO('A', 1) + #define GPIO_Tx GPIO('A', 0) + #define USARTx UART4 + #define USARTx_IRQn UART4_IRQn + #define USARTx_FUNCTION GPIO_FUNCTION(8) +#endif + +#ifndef USARTx_FUNCTION + #define USARTx_FUNCTION GPIO_FUNCTION(7) #endif #define CR1_FLAGS (USART_CR1_UE | USART_CR1_RE | USART_CR1_TE \ @@ -88,7 +99,7 @@ serial_init(void) USARTx->CR1 = CR1_FLAGS; armcm_enable_irq(USARTx_IRQHandler, USARTx_IRQn, 0); - gpio_peripheral(GPIO_Rx, GPIO_FUNCTION(7), 1); - gpio_peripheral(GPIO_Tx, GPIO_FUNCTION(7), 0); + gpio_peripheral(GPIO_Rx, USARTx_FUNCTION, 1); + gpio_peripheral(GPIO_Tx, USARTx_FUNCTION, 0); } DECL_INIT(serial_init); |