|
hal
Hardware Abstraction Layer
|
Provides common calculations for UART channels. More...
#include "stm32f4_uart_util.h"
Functions | |
| uint16_t | stm32f4_hal_compute_uart_bd (uint32_t periph_clk, uint32_t baud_rate) |
| Calculate the 16 bit register value for a desired baud rate. More... | |
Provides common calculations for UART channels.
Copyright (c) 2025 Cory McKiel. Licensed under the MIT License. See LICENSE file in the project root.
| uint16_t stm32f4_hal_compute_uart_bd | ( | uint32_t | periph_clk, |
| uint32_t | baud_rate | ||
| ) |
Calculate the 16 bit register value for a desired baud rate.
The UART channels each have a baud rate register that determines the rate. (USARTX->BRR). This function calculates the correct value given the clock to the peripheral and the desired baud rate.
| periph_clk | The frequency the peripheral is clocked at in Hz. |
| baud_rate | The desired baud rate. Some common values: 9600, 19200, 38400, 57600, 115200. |