Fix kasli_soc-demo compilation error with cfg #250

Merged
sb10q merged 2 commits from morgan/artiq-zynq:bugfix into master 2023-08-30 15:33:45 +08:00
2 changed files with 3 additions and 0 deletions
Showing only changes of commit 262304a073 - Show all commits

View File

@ -310,6 +310,7 @@ class GenericMaster(SoCCore):
self.add_csr_group("grabber", self.grabber_csr_group)
self.rustc_cfg["has_virtual_leds"] = None
self.submodules.virtual_leds = virtual_leds.VirtualLeds()
self.csr_devices.append("virtual_leds")
@ -482,6 +483,7 @@ class GenericSatellite(SoCCore):
self.add_csr_group("grabber", self.grabber_csr_group)
# no RTIO CRG here
self.rustc_cfg["has_virtual_leds"] = None
self.submodules.virtual_leds = virtual_leds.VirtualLeds()
self.csr_devices.append("virtual_leds")

View File

@ -152,6 +152,7 @@ impl IoExpander {
}
pub fn service(&mut self, i2c: &mut i2c::I2c) -> Result<(), &'static str> {
#[cfg(has_virtual_leds)]
for (led, port, bit) in self.virtual_led_mapping.iter() {
let level = unsafe { csr::virtual_leds::status_read() >> led & 1 };
self.set(*port, *bit, level != 0);