aboutsummaryrefslogtreecommitdiff
path: root/embassy-rp/src/pio_programs
diff options
context:
space:
mode:
authorMarc <[email protected]>2025-04-25 00:55:03 +0200
committerMarc <[email protected]>2025-04-25 01:14:54 +0200
commit5d8b0e0327955039d58542ee2036744e155561e6 (patch)
treeee5c0f0c18f02796625c6d53ef43e15862a6ac18 /embassy-rp/src/pio_programs
parentcd27a8a06b0160d654ebed7b89ca473041710235 (diff)
Some small improvements
Diffstat (limited to 'embassy-rp/src/pio_programs')
-rw-r--r--embassy-rp/src/pio_programs/onewire.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/embassy-rp/src/pio_programs/onewire.rs b/embassy-rp/src/pio_programs/onewire.rs
index 82fd98b96..287ddab41 100644
--- a/embassy-rp/src/pio_programs/onewire.rs
+++ b/embassy-rp/src/pio_programs/onewire.rs
@@ -27,8 +27,9 @@ impl<'a, PIO: Instance> PioOneWireProgram<'a, PIO> {
27 .origin 0 27 .origin 0
28 28
29 ; Tick rate is 1 tick per 6us, so all delays should be calculated back to that 29 ; Tick rate is 1 tick per 6us, so all delays should be calculated back to that
30 ; All the instructions have a calculated delay in [], -1 for the instruction 30 ; All the instructions have a calculated delay XX in us as [(XX / CLK) - 1].
31 ; The delay also be 0 which will take 6us for the instruction itself 31 ; The - 1 is for the instruction which also takes one clock cyle.
32 ; The delay can be 0 which will result in just 6us for the instruction itself
32 .define CLK 6 33 .define CLK 6
33 34
34 ; Write the reset block after trigger 35 ; Write the reset block after trigger
@@ -98,16 +99,13 @@ impl<'d, PIO: Instance, const SM: usize> PioOneWire<'d, PIO, SM> {
98 cfg.use_program(&program.prg, &[&pin]); 99 cfg.use_program(&program.prg, &[&pin]);
99 cfg.set_in_pins(&[&pin]); 100 cfg.set_in_pins(&[&pin]);
100 101
101 cfg.shift_in = ShiftConfig { 102 let shift_cfg = ShiftConfig {
102 auto_fill: true,
103 direction: ShiftDirection::Right,
104 threshold: 8,
105 };
106 cfg.shift_out = ShiftConfig {
107 auto_fill: true, 103 auto_fill: true,
108 direction: ShiftDirection::Right, 104 direction: ShiftDirection::Right,
109 threshold: 8, 105 threshold: 8,
110 }; 106 };
107 cfg.shift_in = shift_cfg;
108 cfg.shift_out = shift_cfg;
111 109
112 let divider = (clk_sys_freq() / 1000000) as u16 * 6; 110 let divider = (clk_sys_freq() / 1000000) as u16 * 6;
113 cfg.clock_divider = divider.into(); 111 cfg.clock_divider = divider.into();