Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick José Pereira <[email protected]>
  • Loading branch information
patrickelectric committed Nov 19, 2024
1 parent 5025d06 commit b7494a0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/leak.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::{error::Error, thread::sleep, time::Duration};

use linux_embedded_hal::sysfs_gpio::{Direction, Pin};

use crate::peripherals::{self, LeakSensor, PeripheralClass, PeripheralInfo, Peripherals};
use crate::peripherals::{LeakSensor, PeripheralClass, PeripheralInfo, Peripherals};

pub struct LeakDetector {
pin: Pin,
Expand Down Expand Up @@ -51,7 +51,7 @@ impl LeakBuilder {
}

pub fn build(self) -> Result<LeakDetector, Box<dyn Error>> {
let mut pin = Pin::new(self.pin_number);
let pin = Pin::new(self.pin_number);
pin.export()?;
sleep(Duration::from_millis(30));
pin.set_direction(Direction::In)?;
Expand Down
6 changes: 3 additions & 3 deletions src/led.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::{thread::sleep, time::Duration};

use linux_embedded_hal::{sysfs_gpio::Direction, Pin};

use crate::peripherals::{self, LedBehaviour, PeripheralClass, PeripheralInfo, Peripherals};
use crate::peripherals::{LedBehaviour, PeripheralClass, PeripheralInfo, Peripherals};

pub struct LedController {
pub leds: Vec<Pin>,
Expand Down Expand Up @@ -51,7 +51,7 @@ impl LedControllerBuilder {
}

/// Configures the GPIO pins for the first Navigator board.
pub fn configure_navigator(mut self) -> Self {
pub fn configure_navigator(self) -> Self {
self.add_led_pin(11).add_led_pin(24).add_led_pin(25)
}

Expand All @@ -65,7 +65,7 @@ impl LedControllerBuilder {
}

for &pin_number in &self.pins {
let mut pin = Pin::new(pin_number);
let pin = Pin::new(pin_number);
pin.export().expect("Failed to export LED pin");
sleep(Duration::from_millis(30));
pin.set_direction(Direction::Out)
Expand Down
4 changes: 2 additions & 2 deletions src/pca9685.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{error::Error, thread::sleep, time::Duration};
use linux_embedded_hal::{sysfs_gpio::Direction, I2cdev, Pin};
use pwm_pca9685::{Address as PwmAddress, Channel, Pca9685};

use crate::peripherals::{self, PeripheralClass, PeripheralInfo, Peripherals, PwmBehaviour};
use crate::peripherals::{PeripheralClass, PeripheralInfo, Peripherals, PwmBehaviour};

pub struct Pca9685Device {
pwm: Pca9685<I2cdev>,
Expand Down Expand Up @@ -81,7 +81,7 @@ impl Pca9685DeviceBuilder {
let pwm = Pca9685::new(device, self.address).expect("Failed to open PWM controller");

let oe_pin = {
let mut pin = Pin::new(self.oe_pin_number);
let pin = Pin::new(self.oe_pin_number);
pin.export()?;
sleep(Duration::from_millis(30));
pin.set_direction(Direction::Low)?;
Expand Down
2 changes: 1 addition & 1 deletion src/rgb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use sk6812_rpi::{
strip::{Bus, Strip},
};

use crate::peripherals::{self, PeripheralClass, PeripheralInfo, Peripherals, RgbBehaviour};
use crate::peripherals::{PeripheralClass, PeripheralInfo, Peripherals, RgbBehaviour};

pub struct RgbController {
strip: Strip,
Expand Down

0 comments on commit b7494a0

Please sign in to comment.