diff options
| author | Valentin Trophime <[email protected]> | 2025-11-12 13:19:42 +0100 |
|---|---|---|
| committer | Valentin Trophime <[email protected]> | 2025-11-12 13:38:00 +0100 |
| commit | d4e2caab31c1e9802120141cebc0a00b04471c16 (patch) | |
| tree | 21e119bd714004ee07065ac7a56c3899f257e69a /embassy-rp/src | |
| parent | 7201c6deb9d8c2b1fb380a58b9e879e394ed5f24 (diff) | |
Add docs for embassy-rp::pio::get_x assumption about autopush.
Diffstat (limited to 'embassy-rp/src')
| -rw-r--r-- | embassy-rp/src/pio/instr.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/embassy-rp/src/pio/instr.rs b/embassy-rp/src/pio/instr.rs index b15d507de..304ddb20a 100644 --- a/embassy-rp/src/pio/instr.rs +++ b/embassy-rp/src/pio/instr.rs | |||
| @@ -5,6 +5,10 @@ use crate::pio::{Instance, StateMachine}; | |||
| 5 | 5 | ||
| 6 | impl<'d, PIO: Instance, const SM: usize> StateMachine<'d, PIO, SM> { | 6 | impl<'d, PIO: Instance, const SM: usize> StateMachine<'d, PIO, SM> { |
| 7 | /// Set value of scratch register X. | 7 | /// Set value of scratch register X. |
| 8 | /// | ||
| 9 | /// SAFETY: autopull enabled else it will write undefined data. | ||
| 10 | /// Make sure to have setup the according configuration see | ||
| 11 | /// [shift_out](crate::pio::Config::shift_out) and [auto_fill](crate::pio::ShiftConfig::auto_fill). | ||
| 8 | pub unsafe fn set_x(&mut self, value: u32) { | 12 | pub unsafe fn set_x(&mut self, value: u32) { |
| 9 | const OUT: u16 = InstructionOperands::OUT { | 13 | const OUT: u16 = InstructionOperands::OUT { |
| 10 | destination: OutDestination::X, | 14 | destination: OutDestination::X, |
| @@ -16,6 +20,10 @@ impl<'d, PIO: Instance, const SM: usize> StateMachine<'d, PIO, SM> { | |||
| 16 | } | 20 | } |
| 17 | 21 | ||
| 18 | /// Get value of scratch register X. | 22 | /// Get value of scratch register X. |
| 23 | /// | ||
| 24 | /// SAFETY: autopush enabled else it will read undefined data. | ||
| 25 | /// Make sure to have setup the according configurations see | ||
| 26 | /// [shift_in](crate::pio::Config::shift_in) and [auto_fill](crate::pio::ShiftConfig::auto_fill). | ||
| 19 | pub unsafe fn get_x(&mut self) -> u32 { | 27 | pub unsafe fn get_x(&mut self) -> u32 { |
| 20 | const IN: u16 = InstructionOperands::IN { | 28 | const IN: u16 = InstructionOperands::IN { |
| 21 | source: InSource::X, | 29 | source: InSource::X, |
| @@ -27,6 +35,10 @@ impl<'d, PIO: Instance, const SM: usize> StateMachine<'d, PIO, SM> { | |||
| 27 | } | 35 | } |
| 28 | 36 | ||
| 29 | /// Set value of scratch register Y. | 37 | /// Set value of scratch register Y. |
| 38 | /// | ||
| 39 | /// SAFETY: autopull enabled else it will write undefined data. | ||
| 40 | /// Make sure to have setup the according configuration see | ||
| 41 | /// [shift_out](crate::pio::Config::shift_out) and [auto_fill](crate::pio::ShiftConfig::auto_fill). | ||
| 30 | pub unsafe fn set_y(&mut self, value: u32) { | 42 | pub unsafe fn set_y(&mut self, value: u32) { |
| 31 | const OUT: u16 = InstructionOperands::OUT { | 43 | const OUT: u16 = InstructionOperands::OUT { |
| 32 | destination: OutDestination::Y, | 44 | destination: OutDestination::Y, |
| @@ -38,6 +50,10 @@ impl<'d, PIO: Instance, const SM: usize> StateMachine<'d, PIO, SM> { | |||
| 38 | } | 50 | } |
| 39 | 51 | ||
| 40 | /// Get value of scratch register Y. | 52 | /// Get value of scratch register Y. |
| 53 | /// | ||
| 54 | /// SAFETY: autopush enabled else it will read undefined data. | ||
| 55 | /// Make sure to have setup the according configurations see | ||
| 56 | /// [shift_in](crate::pio::Config::shift_in) and [auto_fill](crate::pio::ShiftConfig::auto_fill). | ||
| 41 | pub unsafe fn get_y(&mut self) -> u32 { | 57 | pub unsafe fn get_y(&mut self) -> u32 { |
| 42 | const IN: u16 = InstructionOperands::IN { | 58 | const IN: u16 = InstructionOperands::IN { |
| 43 | source: InSource::Y, | 59 | source: InSource::Y, |
