use csr::virtual_leds for SFP0..3 LED indication #244
@ -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 {
|
||||||
morgan marked this conversation as resolved
Outdated
sb10q
commented
Just inline it.
Just inline it.
```
block_async!(|| {
let current = unsafe { pl::csr::virtual_leds::status_read() };
...
```
|
|||||||
let _ = block_async!(wait_for_virtual_leds_change()).await;
|
let _ = block_async!(wait_for_virtual_leds_change()).await;
|
||||||
info!("switching");
|
info!("switching");
|
||||||
morgan marked this conversation as resolved
Outdated
mwojcik
commented
Debug leftover? Remove pls Debug leftover? Remove pls
|
|||||||
io_expander0.service().expect("I2C I/O expander #0 service failed");
|
io_expander0.service().expect("I2C I/O expander #0 service failed");
|
||||||
|
Loading…
Reference in New Issue
Block a user
It's confusing to create IO expander objects, which also should be singletons and do more than controlling LEDs, into a function whose name indicates it is about LEDs.
As I told you before, those I/O expander objects should be created only once in the entire firmware.
Additionally, you create them once with
i2c::I2C_BUS
and once with&mut *i2c_ptr
, which is inconsistent.