forked from M-Labs/artiq
kasli: implement virtual LEDs
This commit is contained in:
parent
b83afedf43
commit
35f1814235
|
@ -1,4 +1,5 @@
|
||||||
use i2c;
|
use i2c;
|
||||||
|
use csr;
|
||||||
|
|
||||||
pub struct IoExpander {
|
pub struct IoExpander {
|
||||||
busno: u8,
|
busno: u8,
|
||||||
|
@ -80,8 +81,10 @@ impl IoExpander {
|
||||||
|
|
||||||
pub fn service(&mut self) -> Result<(), &'static str> {
|
pub fn service(&mut self) -> Result<(), &'static str> {
|
||||||
for (led, port, bit) in self.virtual_led_mapping.iter() {
|
for (led, port, bit) in self.virtual_led_mapping.iter() {
|
||||||
// TODO: get level from gateware
|
let level = unsafe {
|
||||||
self.set(*port, *bit, false);
|
(csr::virtual_leds::status_read() >> led) & 1
|
||||||
|
};
|
||||||
|
self.set(*port, *bit, level != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.out_target != self.out_current {
|
if self.out_target != self.out_current {
|
||||||
|
|
Loading…
Reference in New Issue