diff options
| author | Dario Nieuwenhuis <[email protected]> | 2025-10-06 22:56:31 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2025-10-06 23:19:53 +0200 |
| commit | 8730a013c395cf0bf4c2fa8eeb7f138288103039 (patch) | |
| tree | 39eca5fbc4570bd0129c9a291f134de5dab98820 /embassy-rp/src/pio_programs | |
| parent | abc8e450f936567ad42cb34b5d2a7941b206aa5d (diff) | |
Rustfmt for edition 2024.
Diffstat (limited to 'embassy-rp/src/pio_programs')
| -rw-r--r-- | embassy-rp/src/pio_programs/hd44780.rs | 2 | ||||
| -rw-r--r-- | embassy-rp/src/pio_programs/i2s.rs | 2 | ||||
| -rw-r--r-- | embassy-rp/src/pio_programs/onewire.rs | 8 | ||||
| -rw-r--r-- | embassy-rp/src/pio_programs/pwm.rs | 2 | ||||
| -rw-r--r-- | embassy-rp/src/pio_programs/rotary_encoder.rs | 2 | ||||
| -rw-r--r-- | embassy-rp/src/pio_programs/stepper.rs | 2 | ||||
| -rw-r--r-- | embassy-rp/src/pio_programs/uart.rs | 2 | ||||
| -rw-r--r-- | embassy-rp/src/pio_programs/ws2812.rs | 2 |
8 files changed, 9 insertions, 13 deletions
diff --git a/embassy-rp/src/pio_programs/hd44780.rs b/embassy-rp/src/pio_programs/hd44780.rs index 546c85a89..78281ddd4 100644 --- a/embassy-rp/src/pio_programs/hd44780.rs +++ b/embassy-rp/src/pio_programs/hd44780.rs | |||
| @@ -1,12 +1,12 @@ | |||
| 1 | //! [HD44780 display driver](https://www.sparkfun.com/datasheets/LCD/HD44780.pdf) | 1 | //! [HD44780 display driver](https://www.sparkfun.com/datasheets/LCD/HD44780.pdf) |
| 2 | 2 | ||
| 3 | use crate::Peri; | ||
| 3 | use crate::dma::{AnyChannel, Channel}; | 4 | use crate::dma::{AnyChannel, Channel}; |
| 4 | use crate::pio::{ | 5 | use crate::pio::{ |
| 5 | Common, Config, Direction, FifoJoin, Instance, Irq, LoadedProgram, PioPin, ShiftConfig, ShiftDirection, | 6 | Common, Config, Direction, FifoJoin, Instance, Irq, LoadedProgram, PioPin, ShiftConfig, ShiftDirection, |
| 6 | StateMachine, | 7 | StateMachine, |
| 7 | }; | 8 | }; |
| 8 | use crate::pio_programs::clock_divider::calculate_pio_clock_divider; | 9 | use crate::pio_programs::clock_divider::calculate_pio_clock_divider; |
| 9 | use crate::Peri; | ||
| 10 | 10 | ||
| 11 | /// This struct represents a HD44780 program that takes command words (<wait:24> <command:4> <0:4>) | 11 | /// This struct represents a HD44780 program that takes command words (<wait:24> <command:4> <0:4>) |
| 12 | pub struct PioHD44780CommandWordProgram<'a, PIO: Instance> { | 12 | pub struct PioHD44780CommandWordProgram<'a, PIO: Instance> { |
diff --git a/embassy-rp/src/pio_programs/i2s.rs b/embassy-rp/src/pio_programs/i2s.rs index 2382a3f9f..7e5f68ad6 100644 --- a/embassy-rp/src/pio_programs/i2s.rs +++ b/embassy-rp/src/pio_programs/i2s.rs | |||
| @@ -2,12 +2,12 @@ | |||
| 2 | 2 | ||
| 3 | use fixed::traits::ToFixed; | 3 | use fixed::traits::ToFixed; |
| 4 | 4 | ||
| 5 | use crate::Peri; | ||
| 5 | use crate::dma::{AnyChannel, Channel, Transfer}; | 6 | use crate::dma::{AnyChannel, Channel, Transfer}; |
| 6 | use crate::gpio::Pull; | 7 | use crate::gpio::Pull; |
| 7 | use crate::pio::{ | 8 | use crate::pio::{ |
| 8 | Common, Config, Direction, FifoJoin, Instance, LoadedProgram, PioPin, ShiftConfig, ShiftDirection, StateMachine, | 9 | Common, Config, Direction, FifoJoin, Instance, LoadedProgram, PioPin, ShiftConfig, ShiftDirection, StateMachine, |
| 9 | }; | 10 | }; |
| 10 | use crate::Peri; | ||
| 11 | 11 | ||
| 12 | /// This struct represents an i2s receiver & controller driver program | 12 | /// This struct represents an i2s receiver & controller driver program |
| 13 | pub struct PioI2sInProgram<'d, PIO: Instance> { | 13 | pub struct PioI2sInProgram<'d, PIO: Instance> { |
diff --git a/embassy-rp/src/pio_programs/onewire.rs b/embassy-rp/src/pio_programs/onewire.rs index 980d0fe5f..09babc229 100644 --- a/embassy-rp/src/pio_programs/onewire.rs +++ b/embassy-rp/src/pio_programs/onewire.rs | |||
| @@ -1,11 +1,11 @@ | |||
| 1 | //! OneWire pio driver | 1 | //! OneWire pio driver |
| 2 | 2 | ||
| 3 | use crate::Peri; | ||
| 3 | use crate::clocks::clk_sys_freq; | 4 | use crate::clocks::clk_sys_freq; |
| 4 | use crate::gpio::Level; | 5 | use crate::gpio::Level; |
| 5 | use crate::pio::{ | 6 | use crate::pio::{ |
| 6 | Common, Config, Direction, Instance, LoadedProgram, PioPin, ShiftConfig, ShiftDirection, StateMachine, | 7 | Common, Config, Direction, Instance, LoadedProgram, PioPin, ShiftConfig, ShiftDirection, StateMachine, |
| 7 | }; | 8 | }; |
| 8 | use crate::Peri; | ||
| 9 | 9 | ||
| 10 | /// This struct represents a onewire driver program | 10 | /// This struct represents a onewire driver program |
| 11 | pub struct PioOneWireProgram<'a, PIO: Instance> { | 11 | pub struct PioOneWireProgram<'a, PIO: Instance> { |
| @@ -321,11 +321,7 @@ impl PioOneWireSearch { | |||
| 321 | 321 | ||
| 322 | /// Search for the next address on the bus | 322 | /// Search for the next address on the bus |
| 323 | pub async fn next<PIO: Instance, const SM: usize>(&mut self, pio: &mut PioOneWire<'_, PIO, SM>) -> Option<u64> { | 323 | pub async fn next<PIO: Instance, const SM: usize>(&mut self, pio: &mut PioOneWire<'_, PIO, SM>) -> Option<u64> { |
| 324 | if self.finished { | 324 | if self.finished { None } else { pio.search(self).await } |
| 325 | None | ||
| 326 | } else { | ||
| 327 | pio.search(self).await | ||
| 328 | } | ||
| 329 | } | 325 | } |
| 330 | 326 | ||
| 331 | /// Is finished when all devices have been found | 327 | /// Is finished when all devices have been found |
diff --git a/embassy-rp/src/pio_programs/pwm.rs b/embassy-rp/src/pio_programs/pwm.rs index f0f837bc5..ba06bb3c1 100644 --- a/embassy-rp/src/pio_programs/pwm.rs +++ b/embassy-rp/src/pio_programs/pwm.rs | |||
| @@ -6,7 +6,7 @@ use pio::InstructionOperands; | |||
| 6 | 6 | ||
| 7 | use crate::gpio::Level; | 7 | use crate::gpio::Level; |
| 8 | use crate::pio::{Common, Config, Direction, Instance, LoadedProgram, Pin, PioPin, StateMachine}; | 8 | use crate::pio::{Common, Config, Direction, Instance, LoadedProgram, Pin, PioPin, StateMachine}; |
| 9 | use crate::{clocks, Peri}; | 9 | use crate::{Peri, clocks}; |
| 10 | 10 | ||
| 11 | /// This converts the duration provided into the number of cycles the PIO needs to run to make it take the same time | 11 | /// This converts the duration provided into the number of cycles the PIO needs to run to make it take the same time |
| 12 | fn to_pio_cycles(duration: Duration) -> u32 { | 12 | fn to_pio_cycles(duration: Duration) -> u32 { |
diff --git a/embassy-rp/src/pio_programs/rotary_encoder.rs b/embassy-rp/src/pio_programs/rotary_encoder.rs index 70b3795e9..6347527e6 100644 --- a/embassy-rp/src/pio_programs/rotary_encoder.rs +++ b/embassy-rp/src/pio_programs/rotary_encoder.rs | |||
| @@ -1,11 +1,11 @@ | |||
| 1 | //! PIO backed quadrature encoder | 1 | //! PIO backed quadrature encoder |
| 2 | 2 | ||
| 3 | use crate::Peri; | ||
| 3 | use crate::gpio::Pull; | 4 | use crate::gpio::Pull; |
| 4 | use crate::pio::{ | 5 | use crate::pio::{ |
| 5 | Common, Config, Direction as PioDirection, FifoJoin, Instance, LoadedProgram, PioPin, ShiftDirection, StateMachine, | 6 | Common, Config, Direction as PioDirection, FifoJoin, Instance, LoadedProgram, PioPin, ShiftDirection, StateMachine, |
| 6 | }; | 7 | }; |
| 7 | use crate::pio_programs::clock_divider::calculate_pio_clock_divider; | 8 | use crate::pio_programs::clock_divider::calculate_pio_clock_divider; |
| 8 | use crate::Peri; | ||
| 9 | 9 | ||
| 10 | /// This struct represents an Encoder program loaded into pio instruction memory. | 10 | /// This struct represents an Encoder program loaded into pio instruction memory. |
| 11 | pub struct PioEncoderProgram<'a, PIO: Instance> { | 11 | pub struct PioEncoderProgram<'a, PIO: Instance> { |
diff --git a/embassy-rp/src/pio_programs/stepper.rs b/embassy-rp/src/pio_programs/stepper.rs index 0e9a8daf9..5762ee189 100644 --- a/embassy-rp/src/pio_programs/stepper.rs +++ b/embassy-rp/src/pio_programs/stepper.rs | |||
| @@ -2,9 +2,9 @@ | |||
| 2 | 2 | ||
| 3 | use core::mem::{self, MaybeUninit}; | 3 | use core::mem::{self, MaybeUninit}; |
| 4 | 4 | ||
| 5 | use crate::Peri; | ||
| 5 | use crate::pio::{Common, Config, Direction, Instance, Irq, LoadedProgram, PioPin, StateMachine}; | 6 | use crate::pio::{Common, Config, Direction, Instance, Irq, LoadedProgram, PioPin, StateMachine}; |
| 6 | use crate::pio_programs::clock_divider::calculate_pio_clock_divider; | 7 | use crate::pio_programs::clock_divider::calculate_pio_clock_divider; |
| 7 | use crate::Peri; | ||
| 8 | 8 | ||
| 9 | /// This struct represents a Stepper driver program loaded into pio instruction memory. | 9 | /// This struct represents a Stepper driver program loaded into pio instruction memory. |
| 10 | pub struct PioStepperProgram<'a, PIO: Instance> { | 10 | pub struct PioStepperProgram<'a, PIO: Instance> { |
diff --git a/embassy-rp/src/pio_programs/uart.rs b/embassy-rp/src/pio_programs/uart.rs index 04e39a571..444efb5db 100644 --- a/embassy-rp/src/pio_programs/uart.rs +++ b/embassy-rp/src/pio_programs/uart.rs | |||
| @@ -5,12 +5,12 @@ use core::convert::Infallible; | |||
| 5 | use embedded_io_async::{ErrorType, Read, Write}; | 5 | use embedded_io_async::{ErrorType, Read, Write}; |
| 6 | use fixed::traits::ToFixed; | 6 | use fixed::traits::ToFixed; |
| 7 | 7 | ||
| 8 | use crate::Peri; | ||
| 8 | use crate::clocks::clk_sys_freq; | 9 | use crate::clocks::clk_sys_freq; |
| 9 | use crate::gpio::Level; | 10 | use crate::gpio::Level; |
| 10 | use crate::pio::{ | 11 | use crate::pio::{ |
| 11 | Common, Config, Direction as PioDirection, FifoJoin, Instance, LoadedProgram, PioPin, ShiftDirection, StateMachine, | 12 | Common, Config, Direction as PioDirection, FifoJoin, Instance, LoadedProgram, PioPin, ShiftDirection, StateMachine, |
| 12 | }; | 13 | }; |
| 13 | use crate::Peri; | ||
| 14 | 14 | ||
| 15 | /// This struct represents a uart tx program loaded into pio instruction memory. | 15 | /// This struct represents a uart tx program loaded into pio instruction memory. |
| 16 | pub struct PioUartTxProgram<'d, PIO: Instance> { | 16 | pub struct PioUartTxProgram<'d, PIO: Instance> { |
diff --git a/embassy-rp/src/pio_programs/ws2812.rs b/embassy-rp/src/pio_programs/ws2812.rs index 37dd1c4e0..e6851b1a6 100644 --- a/embassy-rp/src/pio_programs/ws2812.rs +++ b/embassy-rp/src/pio_programs/ws2812.rs | |||
| @@ -4,12 +4,12 @@ use embassy_time::Timer; | |||
| 4 | use fixed::types::U24F8; | 4 | use fixed::types::U24F8; |
| 5 | use smart_leds::{RGB8, RGBW}; | 5 | use smart_leds::{RGB8, RGBW}; |
| 6 | 6 | ||
| 7 | use crate::Peri; | ||
| 7 | use crate::clocks::clk_sys_freq; | 8 | use crate::clocks::clk_sys_freq; |
| 8 | use crate::dma::{AnyChannel, Channel}; | 9 | use crate::dma::{AnyChannel, Channel}; |
| 9 | use crate::pio::{ | 10 | use crate::pio::{ |
| 10 | Common, Config, FifoJoin, Instance, LoadedProgram, PioPin, ShiftConfig, ShiftDirection, StateMachine, | 11 | Common, Config, FifoJoin, Instance, LoadedProgram, PioPin, ShiftConfig, ShiftDirection, StateMachine, |
| 11 | }; | 12 | }; |
| 12 | use crate::Peri; | ||
| 13 | 13 | ||
| 14 | const T1: u8 = 2; // start bit | 14 | const T1: u8 = 2; // start bit |
| 15 | const T2: u8 = 5; // data bit | 15 | const T2: u8 = 5; // data bit |
