Skip to content
Snippets Groups Projects
Verified Commit 0a1baaf9 authored by Jonathan Brouwer's avatar Jonathan Brouwer
Browse files

Next try at debugging

parent 82494519
No related branches found
No related tags found
1 merge request!11Resolve "Reading MPU over I2C hangs"
Pipeline #822519 failed
...@@ -126,8 +126,10 @@ impl embedded_hal::blocking::i2c::WriteRead for TwiWrapper { ...@@ -126,8 +126,10 @@ impl embedded_hal::blocking::i2c::WriteRead for TwiWrapper {
// If we want to read multiple bytes we need to use the suspend mode. // If we want to read multiple bytes we need to use the suspend mode.
if !before.is_empty() { if !before.is_empty() {
self.twi.shorts.write(|w| w.bb_suspend().enabled()); self.twi.shorts.write(|w| w.bb_suspend().enabled());
let _ = unsafe { nrf51_hal::gpio::p0::Parts::new(nrf51_pac::Peripherals::steal().GPIO).p0_08.into_push_pull_output(Level::Low) };
} else { } else {
self.twi.shorts.write(|w| w.bb_stop().enabled()); self.twi.shorts.write(|w| w.bb_stop().enabled());
let _ = unsafe { nrf51_hal::gpio::p0::Parts::new(nrf51_pac::Peripherals::steal().GPIO).p0_08.into_push_pull_output(Level::High) };
} }
// Start data reception. // Start data reception.
...@@ -139,11 +141,13 @@ impl embedded_hal::blocking::i2c::WriteRead for TwiWrapper { ...@@ -139,11 +141,13 @@ impl embedded_hal::blocking::i2c::WriteRead for TwiWrapper {
} }
self.twi.shorts.write(|w| w.bb_stop().enabled()); self.twi.shorts.write(|w| w.bb_stop().enabled());
let _ = unsafe { nrf51_hal::gpio::p0::Parts::new(nrf51_pac::Peripherals::steal().GPIO).p0_08.into_push_pull_output(Level::High) };
self.twi.tasks_resume.write(|w| unsafe { w.bits(1) }); self.twi.tasks_resume.write(|w| unsafe { w.bits(1) });
*last = self.recv_byte()?; *last = self.recv_byte()?;
} else { } else {
self.send_stop()?; self.send_stop()?;
} }
let _ = unsafe { nrf51_hal::gpio::p0::Parts::new(nrf51_pac::Peripherals::steal().GPIO).p0_08.into_push_pull_output(Level::Low) };
Ok(()) Ok(())
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment