diff options
| author | Steve Work <[email protected]> | 2025-02-07 09:26:34 -0800 |
|---|---|---|
| committer | Steve Work <[email protected]> | 2025-02-07 09:26:34 -0800 |
| commit | 3b74732f40c8fa65e3bdfc1d3ee65c59e9b01a71 (patch) | |
| tree | 3e59a98491c8682d033d31770ee0656bd8e21c28 | |
| parent | 9acbfc9c226bc56d4c135a4b3845765043c3429a (diff) | |
Rename readers with get_, per CBJamo review. Tweak use_program docstring.
The tweak arranges that "grep sideset" finds use_program() when grokking source - this spelling is used
elsewhere, as in PinConfig for example, and I managed to miss use_program.
| -rw-r--r-- | embassy-rp/src/pio/mod.rs | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/embassy-rp/src/pio/mod.rs b/embassy-rp/src/pio/mod.rs index 51b526400..2776f9e3c 100644 --- a/embassy-rp/src/pio/mod.rs +++ b/embassy-rp/src/pio/mod.rs | |||
| @@ -651,7 +651,7 @@ impl<'d, PIO: Instance> Config<'d, PIO> { | |||
| 651 | /// of the program. The state machine is not started. | 651 | /// of the program. The state machine is not started. |
| 652 | /// | 652 | /// |
| 653 | /// `side_set` sets the range of pins affected by side-sets. The range must be consecutive. | 653 | /// `side_set` sets the range of pins affected by side-sets. The range must be consecutive. |
| 654 | /// Side-set pins must configured as outputs using [`StateMachine::set_pin_dirs`] to be | 654 | /// Sideset pins must configured as outputs using [`StateMachine::set_pin_dirs`] to be |
| 655 | /// effective. | 655 | /// effective. |
| 656 | pub fn use_program(&mut self, prog: &LoadedProgram<'d, PIO>, side_set: &[&Pin<'d, PIO>]) { | 656 | pub fn use_program(&mut self, prog: &LoadedProgram<'d, PIO>, side_set: &[&Pin<'d, PIO>]) { |
| 657 | assert!((prog.side_set.bits() - prog.side_set.optional() as u8) as usize == side_set.len()); | 657 | assert!((prog.side_set.bits() - prog.side_set.optional() as u8) as usize == side_set.len()); |
| @@ -670,16 +670,6 @@ impl<'d, PIO: Instance> Config<'d, PIO> { | |||
| 670 | self.exec.jmp_pin = pin.pin(); | 670 | self.exec.jmp_pin = pin.pin(); |
| 671 | } | 671 | } |
| 672 | 672 | ||
| 673 | /// Sets the range of pins affected by SIDE instructions. The range must be consecutive. | ||
| 674 | /// Set pins must configured as outputs using [`StateMachine::set_pin_dirs`] to be | ||
| 675 | /// effective. | ||
| 676 | pub fn set_sideset_pins(&mut self, pins: &[&Pin<'d, PIO>]) { | ||
| 677 | assert!(pins.len() <= 5); | ||
| 678 | assert_consecutive(pins); | ||
| 679 | self.pins.sideset_base = pins.first().map_or(0, |p| p.pin()); | ||
| 680 | self.pins.sideset_count = pins.len() as u8; | ||
| 681 | } | ||
| 682 | |||
| 683 | /// Sets the range of pins affected by SET instructions. The range must be consecutive. | 673 | /// Sets the range of pins affected by SET instructions. The range must be consecutive. |
| 684 | /// Set pins must configured as outputs using [`StateMachine::set_pin_dirs`] to be | 674 | /// Set pins must configured as outputs using [`StateMachine::set_pin_dirs`] to be |
| 685 | /// effective. | 675 | /// effective. |
| @@ -827,13 +817,13 @@ impl<'d, PIO: Instance + 'd, const SM: usize> StateMachine<'d, PIO, SM> { | |||
| 827 | } | 817 | } |
| 828 | 818 | ||
| 829 | /// Read current instruction address for this state machine | 819 | /// Read current instruction address for this state machine |
| 830 | pub fn addr(&self) -> u8 { | 820 | pub fn get_addr(&self) -> u8 { |
| 831 | let addr = Self::this_sm().addr(); | 821 | let addr = Self::this_sm().addr(); |
| 832 | addr.read().addr() | 822 | addr.read().addr() |
| 833 | } | 823 | } |
| 834 | 824 | ||
| 835 | /// Read TX FIFO threshold for this state machine. | 825 | /// Read TX FIFO threshold for this state machine. |
| 836 | pub fn tx_threshold(&self) -> u8 { | 826 | pub fn get_tx_threshold(&self) -> u8 { |
| 837 | let shiftctrl = Self::this_sm().shiftctrl(); | 827 | let shiftctrl = Self::this_sm().shiftctrl(); |
| 838 | shiftctrl.read().pull_thresh() | 828 | shiftctrl.read().pull_thresh() |
| 839 | } | 829 | } |
| @@ -848,7 +838,7 @@ impl<'d, PIO: Instance + 'd, const SM: usize> StateMachine<'d, PIO, SM> { | |||
| 848 | } | 838 | } |
| 849 | 839 | ||
| 850 | /// Read TX FIFO threshold for this state machine. | 840 | /// Read TX FIFO threshold for this state machine. |
| 851 | pub fn rx_threshold(&self) -> u8 { | 841 | pub fn get_rx_threshold(&self) -> u8 { |
| 852 | Self::this_sm().shiftctrl().read().push_thresh() | 842 | Self::this_sm().shiftctrl().read().push_thresh() |
| 853 | } | 843 | } |
| 854 | 844 | ||
