rust format
This commit is contained in:
parent
cee22f43aa
commit
f917c62948
@ -109,7 +109,7 @@ static mut LAST_VIRTUAL_LED_STATUS: u8 = 0;
|
|||||||
fn wait_for_virtual_leds_change() -> nb::Result<(), Void> {
|
fn wait_for_virtual_leds_change() -> nb::Result<(), Void> {
|
||||||
unsafe {
|
unsafe {
|
||||||
if pl::csr::virtual_leds::status_read() != LAST_VIRTUAL_LED_STATUS {
|
if pl::csr::virtual_leds::status_read() != LAST_VIRTUAL_LED_STATUS {
|
||||||
LAST_VIRTUAL_LED_STATUS = pl::csr::virtual_leds::status_read();
|
LAST_VIRTUAL_LED_STATUS = pl::csr::virtual_leds::status_read();
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(nb::Error::WouldBlock)
|
Err(nb::Error::WouldBlock)
|
||||||
@ -122,7 +122,7 @@ async fn async_rtio_led() {
|
|||||||
let i2c1 = unsafe { (&mut i2c::I2C_BUS).as_mut().unwrap() };
|
let i2c1 = unsafe { (&mut i2c::I2C_BUS).as_mut().unwrap() };
|
||||||
let mut io_expander0 = io_expander::IoExpander::new(i2c0, 0).unwrap();
|
let mut io_expander0 = io_expander::IoExpander::new(i2c0, 0).unwrap();
|
||||||
let mut io_expander1 = io_expander::IoExpander::new(i2c1, 1).unwrap();
|
let mut io_expander1 = io_expander::IoExpander::new(i2c1, 1).unwrap();
|
||||||
loop{
|
loop {
|
||||||
let _ = block_async!(wait_for_virtual_leds_change()).await;
|
let _ = block_async!(wait_for_virtual_leds_change()).await;
|
||||||
info!("switching");
|
info!("switching");
|
||||||
io_expander0.service().expect("I2C I/O expander #0 service failed");
|
io_expander0.service().expect("I2C I/O expander #0 service failed");
|
||||||
|
@ -660,7 +660,7 @@ pub extern "C" fn main_core0() -> i32 {
|
|||||||
let mut i2c0 = I2c::i2c0();
|
let mut i2c0 = I2c::i2c0();
|
||||||
let mut i2c1 = I2c::i2c0();
|
let mut i2c1 = I2c::i2c0();
|
||||||
i2c0.init().expect("I2C0 initialization failed");
|
i2c0.init().expect("I2C0 initialization failed");
|
||||||
i2c1.init().expect("I2C1 initialization failed");
|
i2c1.init().expect("I2C1 initialization failed");
|
||||||
let mut io_expander0 = io_expander::IoExpander::new(&mut i2c0, 0).unwrap();
|
let mut io_expander0 = io_expander::IoExpander::new(&mut i2c0, 0).unwrap();
|
||||||
let mut io_expander1 = io_expander::IoExpander::new(&mut i2c1, 1).unwrap();
|
let mut io_expander1 = io_expander::IoExpander::new(&mut i2c1, 1).unwrap();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user