@@ -708,6 +708,12 @@ static inline uint pio_get_gpio_base(PIO pio) {
708708#endif
709709}
710710
711+ static inline void check_pio_pin_mask64 (__unused PIO pio , __unused uint64_t pinmask ) {
712+ // check no pins are set in the mask which are incompatible with the pio
713+ valid_params_if (HARDWARE_PIO , (pio_get_gpio_base (pio ) == 0 || ((pinmask & ((1ull << pio_get_gpio_base (pio )) - 1 )) == 0 )) &&
714+ (pinmask & ~((1ull << NUM_BANK0_GPIOS ) - 1 )) == 0 );
715+ }
716+
711717/*! \brief Apply a state machine configuration to a state machine
712718 * \ingroup hardware_pio
713719 *
@@ -1717,20 +1723,36 @@ static inline void pio_sm_clear_fifos(PIO pio, uint sm) {
17171723 * before restoring the state machine's pin configuration to what it was.
17181724 *
17191725 * This method is provided as a convenience to set initial pin states, and should not be used against a state machine that is enabled.
1726+ * Note: This method only works for pins < 32. To use with pins >= 32 call pio_sm_set_pins64
17201727 *
17211728 * \param pio The PIO instance; e.g. \ref pio0 or \ref pio1
17221729 * \param sm State machine index (0..3) to use
17231730 * \param pin_values the pin values to set
17241731 */
17251732void pio_sm_set_pins (PIO pio , uint sm , uint32_t pin_values );
17261733
1734+ /*! \brief Use a state machine to set a value on all pins for the PIO instance
1735+ * \ingroup hardware_pio
1736+ *
1737+ * This method repeatedly reconfigures the target state machine's pin configuration and executes 'set' instructions to set values on all 32 pins,
1738+ * before restoring the state machine's pin configuration to what it was.
1739+ *
1740+ * This method is provided as a convenience to set initial pin states, and should not be used against a state machine that is enabled.
1741+ *
1742+ * \param pio The PIO instance; e.g. \ref pio0 or \ref pio1
1743+ * \param sm State machine index (0..3) to use
1744+ * \param pin_values the pin values to set
1745+ */
1746+ void pio_sm_set_pins64 (PIO pio , uint sm , uint64_t pin_values );
1747+
17271748/*! \brief Use a state machine to set a value on multiple pins for the PIO instance
17281749 * \ingroup hardware_pio
17291750 *
17301751 * This method repeatedly reconfigures the target state machine's pin configuration and executes 'set' instructions to set values on up to 32 pins,
17311752 * before restoring the state machine's pin configuration to what it was.
17321753 *
17331754 * This method is provided as a convenience to set initial pin states, and should not be used against a state machine that is enabled.
1755+ * Note: This method only works for pins < 32. To use with pins >= 32 call pio_sm_set_pins_with_mask64
17341756 *
17351757 * \param pio The PIO instance; e.g. \ref pio0 or \ref pio1
17361758 * \param sm State machine index (0..3) to use
@@ -1739,6 +1761,21 @@ void pio_sm_set_pins(PIO pio, uint sm, uint32_t pin_values);
17391761 */
17401762void pio_sm_set_pins_with_mask (PIO pio , uint sm , uint32_t pin_values , uint32_t pin_mask );
17411763
1764+ /*! \brief Use a state machine to set a value on multiple pins for the PIO instance
1765+ * \ingroup hardware_pio
1766+ *
1767+ * This method repeatedly reconfigures the target state machine's pin configuration and executes 'set' instructions to set values on up to 32 pins,
1768+ * before restoring the state machine's pin configuration to what it was.
1769+ *
1770+ * This method is provided as a convenience to set initial pin states, and should not be used against a state machine that is enabled.
1771+ *
1772+ * \param pio The PIO instance; e.g. \ref pio0 or \ref pio1
1773+ * \param sm State machine index (0..3) to use
1774+ * \param pin_values the pin values to set (if the corresponding bit in pin_mask is set)
1775+ * \param pin_mask a bit for each pin to indicate whether the corresponding pin_value for that pin should be applied.
1776+ */
1777+ void pio_sm_set_pins_with_mask64 (PIO pio , uint sm , uint64_t pin_values , uint64_t pin_mask );
1778+
17421779/*! \brief Use a state machine to set the pin directions for multiple pins for the PIO instance
17431780 * \ingroup hardware_pio
17441781 *
@@ -1754,6 +1791,22 @@ void pio_sm_set_pins_with_mask(PIO pio, uint sm, uint32_t pin_values, uint32_t p
17541791 */
17551792void pio_sm_set_pindirs_with_mask (PIO pio , uint sm , uint32_t pin_dirs , uint32_t pin_mask );
17561793
1794+ /*! \brief Use a state machine to set the pin directions for multiple pins for the PIO instance
1795+ * \ingroup hardware_pio
1796+ *
1797+ * This method repeatedly reconfigures the target state machine's pin configuration and executes 'set' instructions to set pin directions on up to 32 pins,
1798+ * before restoring the state machine's pin configuration to what it was.
1799+ *
1800+ * This method is provided as a convenience to set initial pin directions, and should not be used against a state machine that is enabled.
1801+ * Note: This method only works for pins < 32. To use with pins >= 32 call pio_sm_set_pindirs_with_mask64
1802+ *
1803+ * \param pio The PIO instance; e.g. \ref pio0 or \ref pio1
1804+ * \param sm State machine index (0..3) to use
1805+ * \param pin_dirs the pin directions to set - 1 = out, 0 = in (if the corresponding bit in pin_mask is set)
1806+ * \param pin_mask a bit for each pin to indicate whether the corresponding pin_value for that pin should be applied.
1807+ */
1808+ void pio_sm_set_pindirs_with_mask64 (PIO pio , uint sm , uint64_t pin_dirs , uint64_t pin_mask );
1809+
17571810/*! \brief Use a state machine to set the same pin direction for multiple consecutive pins for the PIO instance
17581811 * \ingroup hardware_pio
17591812 *
0 commit comments