Is it possible to use a value defined in a header in a PIO program?
I've been playing around with the TM1637 7-segment display and wrote a PIO program that can drive 1-4 displays.
To make it happen, I use the OUT, SET, and IN instructions (out pindirs #). If I understood correctly, the number of bits to shift depends on the number of pins. So, for example, if I have just one display, then I should write but if I have 4, then it'sI can add a define to the pio program and then use the defined value elsewhereBut can I do the inverse and define the value somewhere else?
Or should it be done in some other way? Such as having 4 identical programs for 4 different numbers of displays?
I've been playing around with the TM1637 7-segment display and wrote a PIO program that can drive 1-4 displays.
To make it happen, I use the OUT, SET, and IN instructions (out pindirs #). If I understood correctly, the number of bits to shift depends on the number of pins. So, for example, if I have just one display, then I should write
Code:
out pindirs 1Code:
out pindirs 4Code:
.define (PUBLIC) SEGMENTS 4Or should it be done in some other way? Such as having 4 identical programs for 4 different numbers of displays?
Statistics: Posted by SREG_SFR — Thu Aug 07, 2025 11:07 am