Struct stm32f3_discovery::leds::Leds [−][src]
pub struct Leds { pub ld3: Switch<PEx<Output<PushPull>>, ActiveHigh>, pub ld4: Switch<PEx<Output<PushPull>>, ActiveHigh>, pub ld5: Switch<PEx<Output<PushPull>>, ActiveHigh>, pub ld6: Switch<PEx<Output<PushPull>>, ActiveHigh>, pub ld7: Switch<PEx<Output<PushPull>>, ActiveHigh>, pub ld8: Switch<PEx<Output<PushPull>>, ActiveHigh>, pub ld9: Switch<PEx<Output<PushPull>>, ActiveHigh>, pub ld10: Switch<PEx<Output<PushPull>>, ActiveHigh>, }
Fields
ld3: Switch<PEx<Output<PushPull>>, ActiveHigh>
North
ld4: Switch<PEx<Output<PushPull>>, ActiveHigh>
NorthWest
ld5: Switch<PEx<Output<PushPull>>, ActiveHigh>
NorthEast
ld6: Switch<PEx<Output<PushPull>>, ActiveHigh>
West
ld7: Switch<PEx<Output<PushPull>>, ActiveHigh>
East
ld8: Switch<PEx<Output<PushPull>>, ActiveHigh>
SouthWest
ld9: Switch<PEx<Output<PushPull>>, ActiveHigh>
SouthEast
ld10: Switch<PEx<Output<PushPull>>, ActiveHigh>
South
Implementations
pub fn new<PE8Mode, PE9Mode, PE10Mode, PE11Mode, PE12Mode, PE13Mode, PE14Mode, PE15Mode>(
pe8: PE8<PE8Mode>,
pe9: PE9<PE9Mode>,
pe10: PE10<PE10Mode>,
pe11: PE11<PE11Mode>,
pe12: PE12<PE12Mode>,
pe13: PE13<PE13Mode>,
pe14: PE14<PE14Mode>,
pe15: PE15<PE15Mode>,
moder: &mut MODER,
otyper: &mut OTYPER
) -> Self
pub fn new<PE8Mode, PE9Mode, PE10Mode, PE11Mode, PE12Mode, PE13Mode, PE14Mode, PE15Mode>(
pe8: PE8<PE8Mode>,
pe9: PE9<PE9Mode>,
pe10: PE10<PE10Mode>,
pe11: PE11<PE11Mode>,
pe12: PE12<PE12Mode>,
pe13: PE13<PE13Mode>,
pe14: PE14<PE14Mode>,
pe15: PE15<PE15Mode>,
moder: &mut MODER,
otyper: &mut OTYPER
) -> Self
Initializes the user LEDs to OFF
pub fn for_direction(
&mut self,
direction: Direction
) -> &mut Switch<PEx<Output<PushPull>>, ActiveHigh>
pub fn for_direction(
&mut self,
direction: Direction
) -> &mut Switch<PEx<Output<PushPull>>, ActiveHigh>
Mutably borrow a LED by the given direction (as noted on the board)
Example
let southLed = leds.for_direction(Direction::South); southLed.on().ok();
pub fn iter_mut(&mut self) -> LedsMutIterator<'_>ⓘNotable traits for LedsMutIterator<'a>
impl<'a> Iterator for LedsMutIterator<'a> type Item = &'a mut Switch<PEx<Output<PushPull>>, ActiveHigh>;
pub fn iter_mut(&mut self) -> LedsMutIterator<'_>ⓘNotable traits for LedsMutIterator<'a>
impl<'a> Iterator for LedsMutIterator<'a> type Item = &'a mut Switch<PEx<Output<PushPull>>, ActiveHigh>;
Provides a mutable iterator for iterating over the on board leds.
Starts at ld3 (N) and moves clockwise.
Stops once it has iterated through all 8 leds.
Examples
Iterate over the leds clockwise
let ms_delay = 50u16; for led in &mut leds { led.on().ok(); delay.delay_ms(ms_delay); led.off().ok(); delay.delay_ms(ms_delay); }
Iterate over the leds counter clockwise
let ms_delay = 50u16; for led in leds.iter_mut().rev() { led.on().ok(); delay.delay_ms(ms_delay); led.off().ok(); delay.delay_ms(ms_delay); }
Consumes the Leds
struct and returns an array,
where index 0 is N and each incrementing index.
Rotates clockwise around the compass.
Warning
This function is maintained solely for some level of compatibility with the old F3 crate.
Self::iter_mut()
should be prefered.
Testing suggests that using Self::iter_mut()
results in an ~800 byte
reduction in final binary size.