mirror of
https://github.com/raspberrypi/pico-sdk.git
synced 2025-12-10 07:14:36 +01:00
fix bug in sm_config_set_in_pin_count (#1880)
* fix bug in sm_config_set_in_pin_count * comment updates
This commit is contained in:
parent
2d60604b6e
commit
91864a0d6e
1 changed files with 15 additions and 2 deletions
|
|
@ -382,6 +382,19 @@ static inline void sm_config_set_in_pins(pio_sm_config *c, uint in_base) {
|
||||||
sm_config_set_in_pin_base(c, in_base);
|
sm_config_set_in_pin_base(c, in_base);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! \brief Set the count of 'in' pins in a state machine configuration
|
||||||
|
* \ingroup sm_config
|
||||||
|
*
|
||||||
|
* When reading pins using the IN pin mapping, this many (low) bits will be read, with the rest taking
|
||||||
|
* the value zero.
|
||||||
|
*
|
||||||
|
* \if rp2040_specific
|
||||||
|
* RP2040 does not have the ability to mask unused input pins, so the in_count must be 32
|
||||||
|
* \endif
|
||||||
|
*
|
||||||
|
* \param c Pointer to the configuration structure to modify
|
||||||
|
* \param in_count 1-32 The number of pins to include when reading via the IN pin mapping
|
||||||
|
*/
|
||||||
static inline void sm_config_set_in_pin_count(pio_sm_config *c, uint in_count) {
|
static inline void sm_config_set_in_pin_count(pio_sm_config *c, uint in_count) {
|
||||||
#if PICO_PIO_VERSION == 0
|
#if PICO_PIO_VERSION == 0
|
||||||
// can't be changed from 32 on PIO v0
|
// can't be changed from 32 on PIO v0
|
||||||
|
|
@ -390,7 +403,7 @@ static inline void sm_config_set_in_pin_count(pio_sm_config *c, uint in_count) {
|
||||||
#else
|
#else
|
||||||
valid_params_if(HARDWARE_PIO, in_count && in_count <= 32);
|
valid_params_if(HARDWARE_PIO, in_count && in_count <= 32);
|
||||||
c->shiftctrl = (c->shiftctrl & ~PIO_SM0_SHIFTCTRL_IN_COUNT_BITS) |
|
c->shiftctrl = (c->shiftctrl & ~PIO_SM0_SHIFTCTRL_IN_COUNT_BITS) |
|
||||||
((in_count - 1) << PIO_SM0_SHIFTCTRL_IN_COUNT_LSB);
|
((in_count & 0x1fu) << PIO_SM0_SHIFTCTRL_IN_COUNT_LSB);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -634,7 +647,7 @@ static inline void sm_config_set_mov_status(pio_sm_config *c, enum pio_mov_statu
|
||||||
* --------|--------
|
* --------|--------
|
||||||
* Out Pins | 32 starting at 0
|
* Out Pins | 32 starting at 0
|
||||||
* Set Pins | 0 starting at 0
|
* Set Pins | 0 starting at 0
|
||||||
* In Pins (base) | 0
|
* In Pins | 32 starting at 0
|
||||||
* Side Set Pins (base) | 0
|
* Side Set Pins (base) | 0
|
||||||
* Side Set | disabled
|
* Side Set | disabled
|
||||||
* Wrap | wrap=31, wrap_to=0
|
* Wrap | wrap=31, wrap_to=0
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue