mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
add mapping for i2c channels to global clocks; fix typo
This commit is contained in:
parent
d45052b772
commit
7399c4a6da
2 changed files with 12 additions and 1 deletions
|
|
@ -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)]
|
#[repr(u32)]
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
pub enum PeriphEventId {
|
pub enum PeriphEventId {
|
||||||
|
|
|
||||||
|
|
@ -241,7 +241,7 @@ impl Spim {
|
||||||
4096,
|
4096,
|
||||||
xous::MemoryFlags::R | xous::MemoryFlags::W,
|
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 csr = CSR::new(csr_range.as_mut_ptr() as *mut u32);
|
||||||
|
|
||||||
let clk_div = sys_clk_freq / (2 * spi_clk_freq);
|
let clk_div = sys_clk_freq / (2 * spi_clk_freq);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue