Open
Description
OK, there seems to be still some inconsistency. If
.program test
.side_set 0 opt
jmp 0 side 0
is allowed (I'm assuming side 0
with .side_set 0 opt
won't have any effect?) then probably
pio_encode_sideset_opt(0, 0);
should be allowed, too (or neither):
diff --git src/rp2_common/hardware_pio/include/hardware/pio_instructions.h src/rp2_common/hardware_pio/include/hardware/pio_instructions.h
index 6711456..53349fe 100644
--- src/rp2_common/hardware_pio/include/hardware/pio_instructions.h
+++ src/rp2_common/hardware_pio/include/hardware/pio_instructions.h
@@ -145,13 +145,13 @@ static inline uint pio_encode_sideset(uint sideset_bit_count, uint value) {
*
* \param sideset_bit_count number of side set bits as would be specified via `.sideset <n> opt` in pioasm
* \param value the value to sideset on the pins
* \return the side set bits to be ORed with an instruction encoding
*/
static inline uint pio_encode_sideset_opt(uint sideset_bit_count, uint value) {
- valid_params_if(PIO_INSTRUCTIONS, sideset_bit_count >= 1 && sideset_bit_count <= 4);
+ valid_params_if(PIO_INSTRUCTIONS, sideset_bit_count >= 0 && sideset_bit_count <= 4);
valid_params_if(PIO_INSTRUCTIONS, value <= ((1u << sideset_bit_count) - 1));
return 0x1000u | value << (12u - sideset_bit_count);
}
/*! \brief Encode an unconditional JMP instruction
* \ingroup pio_instructions
Maybe clarify that sideset_bit_count
documented above corresponds to <n>
(and not <n>+1
as, for example, in the generated sm_config_set_sideset(&c, 1, true, false);
)?