set uart baud to 1Mbaud and also make it a top-level constant

This commit is contained in:
bunnie 2025-08-20 02:24:54 +08:00
parent 4cd5f2d2c8
commit 43de6d67ec
3 changed files with 5 additions and 3 deletions

View file

@ -4,3 +4,5 @@ pub use cramium::*;
pub mod bio;
pub mod debug;
pub mod irq;
pub const UART_BAUD: u32 = 1_000_000;

View file

@ -682,7 +682,7 @@ pub fn clockset_wrapper(freq: u32) -> u32 {
// new.
udma::Uart::get_handle(utra::udma_uart_2::HW_UDMA_UART_2_BASE, uart_buf_addr, uart_buf_addr)
};
let baudrate: u32 = 115200;
let baudrate: u32 = crate::UART_BAUD;
let freq: u32 = perclk / 2;
udma_uart.set_baud(baudrate, freq);
@ -790,7 +790,7 @@ pub unsafe fn low_power() -> u32 {
// new.
udma::Uart::get_handle(utra::udma_uart_2::HW_UDMA_UART_2_BASE, uart_buf_addr, uart_buf_addr)
};
let baudrate: u32 = 115200;
let baudrate: u32 = crate::UART_BAUD;
let freq: u32 = perclk / 2;
udma_uart.set_baud(baudrate, freq);

View file

@ -183,7 +183,7 @@ pub fn setup_rx(perclk: u32) -> cramium_hal::udma::Uart {
);
}
let baudrate: u32 = 115200;
let baudrate: u32 = crate::UART_BAUD;
let freq: u32 = perclk / 2;
// the address of the UART buffer is "hard-allocated" at an offset one page from the top of