add mapping for i2c channels to global clocks; fix typo

This commit is contained in:
bunnie 2024-10-06 02:44:16 +08:00
parent d45052b772
commit 7399c4a6da
2 changed files with 12 additions and 1 deletions

View file

@ -71,6 +71,17 @@ impl From<SpimChannel> for PeriphId {
}
}
impl From<I2cChannel> for PeriphId {
fn from(value: I2cChannel) -> Self {
match value {
I2cChannel::Channel0 => PeriphId::I2c0,
I2cChannel::Channel1 => PeriphId::I2c1,
I2cChannel::Channel2 => PeriphId::I2c2,
I2cChannel::Channel3 => PeriphId::I2c3,
}
}
}
#[repr(u32)]
#[derive(Copy, Clone)]
pub enum PeriphEventId {

View file

@ -241,7 +241,7 @@ impl Spim {
4096,
xous::MemoryFlags::R | xous::MemoryFlags::W,
)
.expect("couldn't map serial port");
.expect("couldn't map spim port");
let csr = CSR::new(csr_range.as_mut_ptr() as *mut u32);
let clk_div = sys_clk_freq / (2 * spi_clk_freq);