aboutsummaryrefslogtreecommitdiff
path: root/embassy-rp/src/pio_programs/spi.rs
diff options
context:
space:
mode:
authorAdrian Wowk <[email protected]>2025-07-02 21:18:44 -0500
committerDario Nieuwenhuis <[email protected]>2025-09-05 20:35:48 +0200
commit83b42e0db620b7fc2364763b452b346b711e8d9f (patch)
tree16c7f4097eb7aa3ea9a16d164c5d251aab1c0d0a /embassy-rp/src/pio_programs/spi.rs
parent236662c748eab43a701bf4f43570b191ec2c1158 (diff)
style: cleanup with rustfmt
Diffstat (limited to 'embassy-rp/src/pio_programs/spi.rs')
-rw-r--r--embassy-rp/src/pio_programs/spi.rs21
1 files changed, 10 insertions, 11 deletions
diff --git a/embassy-rp/src/pio_programs/spi.rs b/embassy-rp/src/pio_programs/spi.rs
index 27d401fc9..a1b36c1c8 100644
--- a/embassy-rp/src/pio_programs/spi.rs
+++ b/embassy-rp/src/pio_programs/spi.rs
@@ -5,24 +5,23 @@ use core::marker::PhantomData;
5use embassy_futures::join::join; 5use embassy_futures::join::join;
6use embassy_hal_internal::Peri; 6use embassy_hal_internal::Peri;
7use embedded_hal_02::spi::{Phase, Polarity}; 7use embedded_hal_02::spi::{Phase, Polarity};
8use fixed::{traits::ToFixed, types::extra::U8}; 8use fixed::traits::ToFixed;
9use fixed::types::extra::U8;
9 10
10use crate::{ 11use crate::clocks::clk_sys_freq;
11 clocks::clk_sys_freq, 12use crate::dma::{AnyChannel, Channel};
12 dma::{AnyChannel, Channel}, 13use crate::gpio::Level;
13 gpio::Level, 14use crate::pio::{Common, Direction, Instance, LoadedProgram, PioPin, ShiftDirection, StateMachine};
14 pio::{Common, Direction, Instance, LoadedProgram, PioPin, ShiftDirection, StateMachine}, 15use crate::spi::{Async, Blocking, Mode};
15 spi::{Async, Blocking, Mode},
16};
17 16
18/// This struct represents a uart tx program loaded into pio instruction memory. 17/// This struct represents a uart tx program loaded into pio instruction memory.
19pub struct PioSpiProgram<'d, PIO: crate::pio::Instance> { 18pub struct PioSpiProgram<'d, PIO: Instance> {
20 prg: LoadedProgram<'d, PIO>, 19 prg: LoadedProgram<'d, PIO>,
21} 20}
22 21
23impl<'d, PIO: crate::pio::Instance> PioSpiProgram<'d, PIO> { 22impl<'d, PIO: Instance> PioSpiProgram<'d, PIO> {
24 /// Load the spi program into the given pio 23 /// Load the spi program into the given pio
25 pub fn new(common: &mut crate::pio::Common<'d, PIO>, phase: Phase) -> Self { 24 pub fn new(common: &mut Common<'d, PIO>, phase: Phase) -> Self {
26 // These PIO programs are taken straight from the datasheet (3.6.1 in 25 // These PIO programs are taken straight from the datasheet (3.6.1 in
27 // RP2040 datasheet, 11.6.1 in RP2350 datasheet) 26 // RP2040 datasheet, 11.6.1 in RP2350 datasheet)
28 27