Rename the set_directions method on LedRing

This hopefully prevens confusion between "compass directions" and
LED ring cycle direction.
This commit is contained in:
Paul van Tilburg 2019-04-06 12:01:49 +02:00
parent 6aab250e73
commit 7fef19d2fb
Signed by: paul
GPG Key ID: C6DE073EDA9EEC4D
2 changed files with 3 additions and 3 deletions

View File

@ -135,11 +135,11 @@ impl LedRing {
} }
} }
/// Turns on specific LEDs based on the direction array. /// Turns on specific LEDs based on the "direction" array.
/// ///
/// When looking with the mini-USB port of the board held down (south), the directions of /// When looking with the mini-USB port of the board held down (south), the directions of
/// the array can be interpreted as: `[east, south, west, north]`. /// the array can be interpreted as: `[east, south, west, north]`.
pub fn set_directions(&mut self, directions: [bool; 4]) { pub fn specific_on(&mut self, directions: [bool; 4]) {
for (led, on_off) in self.leds.iter_mut().zip(directions.iter()) { for (led, on_off) in self.leds.iter_mut().zip(directions.iter()) {
if *on_off { if *on_off {
led.set_high(); led.set_high();

View File

@ -151,7 +151,7 @@ const APP: () = {
resources.led_ring.lock(|led_ring| { resources.led_ring.lock(|led_ring| {
if led_ring.is_mode_accel() { if led_ring.is_mode_accel() {
let directions = [acc_y < 0, acc_x < 0, acc_y > 0, acc_x > 0]; let directions = [acc_y < 0, acc_x < 0, acc_y > 0, acc_x > 0];
led_ring.set_directions(directions); led_ring.specific_on(directions);
schedule schedule
.accel_leds(scheduled + LedRing::PERIOD.cycles()) .accel_leds(scheduled + LedRing::PERIOD.cycles())
.unwrap(); .unwrap();