Skip to content

Commit

Permalink
fix: code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
paripalpp committed Jun 17, 2024
1 parent 7e7cd48 commit 9670ca7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 2 additions & 0 deletions src/buffered_cobs.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#[allow(dead_code)]
pub struct BufferedCobs<const BUFFER_SIZE: usize> {
buffer: [u8; BUFFER_SIZE],
buffer_index: usize,
buffer_full: bool,
data_ready: u16,
}

#[allow(dead_code)]
impl<const BUFFER_SIZE: usize> BufferedCobs<BUFFER_SIZE> {
pub fn new() -> BufferedCobs<BUFFER_SIZE> {
BufferedCobs::<BUFFER_SIZE> {
Expand Down
8 changes: 4 additions & 4 deletions src/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ where
PinA: hal::gpio::ValidFunction<hal::gpio::FunctionSioInput>,
PinB: hal::gpio::ValidFunction<hal::gpio::FunctionSioInput>,
{
pub fn configure<'a, F1A, P1A, F1B, P1B>(
pub fn configure<F1A, P1A, F1B, P1B>(
&self,
pin_a: hal::gpio::Pin<PinA, F1A, P1A>,
pin_b: hal::gpio::Pin<PinB, F1B, P1B>,
Expand Down Expand Up @@ -78,9 +78,9 @@ where
self.last_speed_update_count.borrow(cs).replace(count);
});

return Ok((Into::<i64>::into(count_delta) * 0x100 * 1_000_000 / delta)
Ok((Into::<i64>::into(count_delta) * 0x100 * 1_000_000 / delta)
.try_into()
.unwrap());
.unwrap())
}
pub const fn none() -> Self {
Encoder::<PinA, PinB, P> {
Expand Down Expand Up @@ -112,7 +112,7 @@ where
PinA: hal::gpio::ValidFunction<hal::gpio::FunctionSioInput>,
PinB: hal::gpio::ValidFunction<hal::gpio::FunctionSioInput>,
{
pub fn new<'a, F1A, P1A, F1B, P1B>(
pub fn new<F1A, P1A, F1B, P1B>(
pin_a: hal::gpio::Pin<PinA, F1A, P1A>,
pin_b: hal::gpio::Pin<PinB, F1B, P1B>,
) -> Self
Expand Down
8 changes: 4 additions & 4 deletions src/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ pub struct Scheduler<'a> {
impl<'a> Scheduler<'a> {
pub fn new(wait_tick: u64, timer: &'a hal::Timer) -> Scheduler<'a> {
Scheduler::<'a> {
wait_tick: wait_tick,
wait_tick,
next_update: timer.get_counter().ticks() + wait_tick,
timer: timer,
timer,
}
}
pub fn update(&mut self) -> bool {
let tick = self.timer.get_counter().ticks();
if tick >= self.next_update {
self.next_update += self.wait_tick;
return true;
true
} else {
return false;
false
}
}
}

0 comments on commit 9670ca7

Please sign in to comment.