Skip to content

Commit

Permalink
rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
lzrd committed Nov 18, 2024
1 parent bc39aa8 commit 6dd78e5
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 20 deletions.
7 changes: 3 additions & 4 deletions drv/lpc55-gpio/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ struct ServerImpl<'a> {
inputmux: &'a device::inputmux::RegisterBlock,
}

impl ServerImpl <'_> {
impl ServerImpl<'_> {
fn set_pin_direction(&self, port: usize, pin: usize, dir: Direction) {
match dir {
Direction::Input => self.gpio.dirclr[port]
Expand All @@ -64,7 +64,6 @@ impl ServerImpl <'_> {
.write(|w| unsafe { w.dirsetp().bits(1 << pin) }),
}
}

}

impl idl::InOrderPinsImpl for ServerImpl<'_> {
Expand Down Expand Up @@ -174,7 +173,8 @@ impl idl::InOrderPinsImpl for ServerImpl<'_> {
syscon.enable_clock(Peripheral::Mux);
syscon.leave_reset(Peripheral::Mux);
unsafe {
self.inputmux.pintsel[pint_slot as usize].write(|w| w.bits(pin as u32));
self.inputmux.pintsel[pint_slot as usize]
.write(|w| w.bits(pin as u32));
}
syscon.disable_clock(Peripheral::Mux);

Expand Down Expand Up @@ -289,7 +289,6 @@ impl idl::InOrderPinsImpl for ServerImpl<'_> {
let status = self.pint.ist.read().bits() & pint_mask;
Ok(status)
}

}

impl NotificationHandler for ServerImpl<'_> {
Expand Down
4 changes: 1 addition & 3 deletions drv/lpc55-sprot-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ use drv_sprot_api::{
};
use lpc55_pac as device;
use ringbuf::{ringbuf, ringbuf_entry};
use userlib::{
sys_irq_control, sys_recv_notification, task_slot, UnwrapLite,
};
use userlib::{sys_irq_control, sys_recv_notification, task_slot, UnwrapLite};

mod handler;

Expand Down
2 changes: 1 addition & 1 deletion task/button-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#![no_std]

use userlib::{sys_send, FromPrimitive};
use derive_idol_err::IdolError;
use userlib::{sys_send, FromPrimitive};

#[derive(Copy, Clone, Debug, FromPrimitive, IdolError, counters::Count)]
pub enum ButtonError {
Expand Down
2 changes: 1 addition & 1 deletion task/button/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

use anyhow::Result;
use idol::{server::ServerStyle, CounterSettings};
use build_lpc55pins::PinConfig;
use idol::{server::ServerStyle, CounterSettings};
use serde::Deserialize;

#[derive(Deserialize)]
Expand Down
13 changes: 3 additions & 10 deletions task/button/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ use idol_runtime::{
// use serde::Deserialize;
// use zerocopy::AsBytes;
use crate::idl::INCOMING_SIZE;
use userlib::{set_timer_relative, sys_set_timer, task_slot, UnwrapLite, sys_irq_control};
use userlib::{
set_timer_relative, sys_irq_control, sys_set_timer, task_slot, UnwrapLite,
};

// Time is in approximate ms
const ON_DELAY: u32 = 1 * 1000;
Expand Down Expand Up @@ -73,12 +75,6 @@ impl ButtonServer {
}

fn timer_expiry(&mut self) {
// then:
// - toggle cycle
// - speed up
// else
// - inrement

if self.on {
// LEDs were on
if self.off_ms > 0 {
Expand Down Expand Up @@ -222,9 +218,6 @@ impl NotificationHandler for ButtonServer {

#[export_name = "main"]
fn main() -> ! {
// XXX Safety, if all else fails, then waiting a minute longer after reset
// may help us get a debugger in there.
// hl::sleep_for(60000);
let mut buffer = [0u8; INCOMING_SIZE];

let gpio_driver = GPIO.get_task_id();
Expand Down
11 changes: 10 additions & 1 deletion task/hiffy/src/lpc55.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,16 @@ fn gpio_configure(
let task = GPIO.get_task_id();
let gpio = drv_lpc55_gpio_api::Pins::from(task);

gpio.iocon_configure(pin, alt, mode, slew, invert, digimode, opendrain, PintSlot::None);
gpio.iocon_configure(
pin,
alt,
mode,
slew,
invert,
digimode,
opendrain,
PintSlot::None,
);

Ok(0)
}
Expand Down

0 comments on commit 6dd78e5

Please sign in to comment.