-
Notifications
You must be signed in to change notification settings - Fork 156
Closed
Description
I've got 4 LEDs that I can manipulate individually. My first try looks like this:
fn toggle_led(led: u8) {
match led {
1 =>
gpio_port().not[2].write(|notw| notw.notp1(true)),
2 =>
gpio_port().not[2].write(|notw| notw.notp2(true)),
3 =>
gpio_port().not[2].write(|notw| notw.notp8(true)),
4 =>
gpio_port().not[5].write(|notw| notw.notp26(true)),
_ => (),
}
}
It's hard to parameterize over notp1
, notp2
, etc. In this case I'd like to sacrifice the pretty abstraction and manipulate any bit of self.bits
.
Metadata
Metadata
Assignees
Labels
No labels