Fixup comments from James

This commit is contained in:
Caleb Jamison 2024-02-22 06:34:58 -05:00
parent 89986fe967
commit 25bff1d0b9
2 changed files with 4 additions and 6 deletions

View file

@ -414,7 +414,6 @@ impl<'d, T: Instance + 'd, M: Mode> I2c<'d, T, M> {
let lcnt = period * 3 / 5; // spend 3/5 (60%) of the period low let lcnt = period * 3 / 5; // spend 3/5 (60%) of the period low
let hcnt = period - lcnt; // and 2/5 (40%) of the period high let hcnt = period - lcnt; // and 2/5 (40%) of the period high
warn!("cb:{} h:{:x} l:{:x}", clk_base, hcnt, lcnt);
// Check for out-of-range divisors: // Check for out-of-range divisors:
if hcnt > 0xffff || lcnt > 0xffff { if hcnt > 0xffff || lcnt > 0xffff {
return Err(ConfigError::ClockTooFast); return Err(ConfigError::ClockTooFast);
@ -443,11 +442,10 @@ impl<'d, T: Instance + 'd, M: Mode> I2c<'d, T, M> {
// fit in uint. Add 1 to avoid division truncation. // fit in uint. Add 1 to avoid division truncation.
((clk_base * 3) / 25_000_000) + 1 ((clk_base * 3) / 25_000_000) + 1
}; };
/*
if sda_tx_hold_count <= lcnt - 2 { if sda_tx_hold_count > lcnt - 2 {
return Err(ConfigError::HoldCountOutOfRange); return Err(ConfigError::ClockTooSlow);
} }
*/
p.ic_fs_scl_hcnt().write(|w| w.set_ic_fs_scl_hcnt(hcnt as u16)); p.ic_fs_scl_hcnt().write(|w| w.set_ic_fs_scl_hcnt(hcnt as u16));
p.ic_fs_scl_lcnt().write(|w| w.set_ic_fs_scl_lcnt(lcnt as u16)); p.ic_fs_scl_lcnt().write(|w| w.set_ic_fs_scl_lcnt(lcnt as u16));

View file

@ -331,9 +331,9 @@ impl<'d, T: Instance> I2cSlave<'d, T> {
}, },
|_me| { |_me| {
p.ic_intr_mask().write(|w| { p.ic_intr_mask().write(|w| {
w.set_m_rx_done(true);
w.set_m_tx_empty(true); w.set_m_tx_empty(true);
w.set_m_tx_abrt(true); w.set_m_tx_abrt(true);
w.set_m_rx_done(true);
}) })
}, },
) )