- remove debug message
- save 1 csr call
This commit is contained in:
parent
f917c62948
commit
097cfd9996
@ -108,8 +108,9 @@ static mut LAST_VIRTUAL_LED_STATUS: u8 = 0;
|
|||||||
#[cfg(all(feature = "target_kasli_soc", has_drtio))]
|
#[cfg(all(feature = "target_kasli_soc", has_drtio))]
|
||||||
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 {
|
let current = pl::csr::virtual_leds::status_read();
|
||||||
LAST_VIRTUAL_LED_STATUS = pl::csr::virtual_leds::status_read();
|
if current != LAST_VIRTUAL_LED_STATUS {
|
||||||
|
LAST_VIRTUAL_LED_STATUS = current;
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(nb::Error::WouldBlock)
|
Err(nb::Error::WouldBlock)
|
||||||
@ -124,7 +125,6 @@ async fn async_rtio_led() {
|
|||||||
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");
|
|
||||||
io_expander0.service().expect("I2C I/O expander #0 service failed");
|
io_expander0.service().expect("I2C I/O expander #0 service failed");
|
||||||
io_expander1.service().expect("I2C I/O expander #1 service failed");
|
io_expander1.service().expect("I2C I/O expander #1 service failed");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user