Merge pull request #6863 from jepler/rp2pio-erroneous-mask

rp2pio: fix occasional bug when not using OUT pins
This commit is contained in:
Dan Halbert 2022-09-04 09:15:35 -04:00 committed by GitHub
commit 449b43e5a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -369,6 +369,9 @@ bool rp2pio_statemachine_construct(rp2pio_statemachine_obj_t *self,
} }
static uint32_t mask_and_rotate(const mcu_pin_obj_t *first_pin, uint32_t bit_count, uint32_t value) { static uint32_t mask_and_rotate(const mcu_pin_obj_t *first_pin, uint32_t bit_count, uint32_t value) {
if (!first_pin) {
return 0;
}
value = value & ((1 << bit_count) - 1); value = value & ((1 << bit_count) - 1);
uint32_t shift = first_pin->number; uint32_t shift = first_pin->number;
return value << shift | value >> (32 - shift); return value << shift | value >> (32 - shift);