forked from M-Labs/artiq
1
0
Fork 0

kasli: implement virtual LEDs

This commit is contained in:
Sebastien Bourdeauducq 2020-05-07 19:07:43 +08:00
parent b83afedf43
commit 35f1814235
1 changed files with 5 additions and 2 deletions

View File

@ -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 {