Change pio::Tx::write to write u32 instead of <T>* (#352)

* Change pio::Tx::write to write u32 instead of <T>*

* Use i2c-pio branch that supports new SIO FIFO API so the PIO FIFO changes don't break CI
This commit is contained in:
9names 2022-06-13 18:24:05 +10:00 committed by GitHub
parent 9bce594db2
commit 9641c0b4a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View file

@ -26,7 +26,7 @@ panic-halt= "0.2.0"
embedded-hal ="0.2.5"
cortex-m-rtic = "0.6.0-rc.4"
nb = "1.0"
i2c-pio = { git = "https://github.com/ithinuel/i2c-pio-rs", rev = "fa155bbae4e8553b448a66cc47236db38b7524dd" }
i2c-pio = { git = "https://github.com/rp-rs/i2c-pio-rs", branch = "pio_write_widths" }
heapless = "0.7.9"
embedded-sdmmc = { git = "https://github.com/rust-embedded-community/embedded-sdmmc-rs.git" }
smart-leds = "0.3.0"

View file

@ -1183,10 +1183,10 @@ impl<SM: ValidStateMachine> Tx<SM> {
}
}
/// Write an element to TX FIFO.
/// Write a u32 value to TX FIFO.
///
/// Returns `true` if the value was written to FIFO, `false` otherwise.
pub fn write<T>(&mut self, value: T) -> bool {
pub fn write(&mut self, value: u32) -> bool {
// Safety: The register is never written by software.
let is_full = self.is_full();
@ -1195,8 +1195,8 @@ impl<SM: ValidStateMachine> Tx<SM> {
}
unsafe {
let reg_ptr = self.register_block().txf[SM::id()].as_ptr() as *mut T;
core::ptr::write_volatile(reg_ptr, value);
let reg_ptr = self.register_block().txf[SM::id()].as_ptr() as *mut u32;
reg_ptr.write_volatile(value);
}
true