text: #ifndef UART_H
  #define UART_H
  
  #include <stm32f4xx_hal.h>
  
  
  #if 1
  
  #define USARTx                           USART3
  #define USARTx_CLK_ENABLE()              __HAL_RCC_USART3_CLK_ENABLE()
  #define USARTx_RX_GPIO_CLK_ENABLE()      __HAL_RCC_GPIOB_CLK_ENABLE()
  #define USARTx_TX_GPIO_CLK_ENABLE()      __HAL_RCC_GPIOB_CLK_ENABLE()
  
  #define USARTx_FORCE_RESET()             __HAL_RCC_USART3_FORCE_RESET()
  #define USARTx_RELEASE_RESET()           __HAL_RCC_USART3_RELEASE_RESET()
  
  /* Definition for USARTx Pins */
  #define USARTx_TX_PIN                    GPIO_PIN_10
  #define USARTx_TX_GPIO_PORT              GPIOB
  #define USARTx_TX_AF                     GPIO_AF7_USART3
  #define USARTx_RX_PIN                    GPIO_PIN_11
  #define USARTx_RX_GPIO_PORT              GPIOB
  #define USARTx_RX_AF                     GPIO_AF7_USART3
  
  /* Definition for USARTx's NVIC */
  #define USARTx_IRQn                      USART3_IRQn
  #define USARTx_IRQHandler                USART3_IRQHandler
  
  /* Definition for USARTx's DMA: used for transmitting data over Tx pin */
  #define USARTx_TX_DMA_CHANNEL            DMA_CHANNEL_4
  #define USARTx_TX_DMA_STREAM             DMA1_Stream3
  #define USARTx_DMA_TX_IRQHandler         DMA1_Stream3_IRQHandler
  #define USARTx_DMA_TX_IRQn               DMA1_Stream3_IRQn
  
  #else
  
  #define USARTx                           UART4
  #define USARTx_CLK_ENABLE()              __HAL_RCC_UART4_CLK_ENABLE()
  #define USARTx_RX_GPIO_CLK_ENABLE()      __HAL_RCC_GPIOC_CLK_ENABLE()
  #define USARTx_TX_GPIO_CLK_ENABLE()      __HAL_RCC_GPIOC_CLK_ENABLE()
  
  #define USARTx_FORCE_RESET()             __HAL_RCC_UART4_FORCE_RESET()
  #define USARTx_RELEASE_RESET()           __HAL_RCC_UART4_RELEASE_RESET()
  
  /* Definition for UARTx Pins */
  #define USARTx_TX_PIN                    GPIO_PIN_10
  #define USARTx_TX_GPIO_PORT              GPIOC
  #define USARTx_TX_AF                     GPIO_AF8_UART4
  #define USARTx_RX_PIN                    GPIO_PIN_11
  #define USARTx_RX_GPIO_PORT              GPIOC
  #define USARTx_RX_AF                     GPIO_AF8_UART4
  
  /* Definition for UARTx's NVIC */
  #define USARTx_IRQn                      UART4_IRQn
  #define USARTx_IRQHandler                UART4_IRQHandler
  
  #endif
  
  
  void uart_init(void);
  uint8_t uart_read_byte(void);
  void uart_send_byte(uint8_t data);
  void uart_send_buf(uint8_t *data, size_t n);
  
  
  #endif /* UART_H */
  