mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
fix uart divider commit
needs to disable uart before the new values can take
This commit is contained in:
parent
b4ffcfe11a
commit
cd58323541
1 changed files with 4 additions and 0 deletions
|
|
@ -107,6 +107,10 @@ impl Uart {
|
||||||
|
|
||||||
pub fn set_baud(&self, baud: u32, clk_freq: u32) {
|
pub fn set_baud(&self, baud: u32, clk_freq: u32) {
|
||||||
let clk_counter: u32 = (clk_freq + baud / 2) / baud;
|
let clk_counter: u32 = (clk_freq + baud / 2) / baud;
|
||||||
|
// must disable the UART before adjusting any values
|
||||||
|
unsafe {
|
||||||
|
self.csr.base().add(Bank::Custom.into()).add(UartReg::Setup.into()).write_volatile(0x0);
|
||||||
|
}
|
||||||
// setup baud, bits, parity, etc.
|
// setup baud, bits, parity, etc.
|
||||||
// safety: this is safe to call as long as the base address points at a valid UART.
|
// safety: this is safe to call as long as the base address points at a valid UART.
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue