Fix pio_blink frequency calculation
Added missing parenthesis around the divisor. Verified using a logic analyzer and also in simulation: https://wokwi.com/arduino/projects/300911723685085709
This commit is contained in:
parent
cf2cd5a5f1
commit
34c3ade43e
@ -31,5 +31,5 @@ void blink_pin_forever(PIO pio, uint sm, uint offset, uint pin, uint freq) {
|
||||
pio_sm_set_enabled(pio, sm, true);
|
||||
|
||||
printf("Blinking pin %d at %d Hz\n", pin, freq);
|
||||
pio->txf[sm] = clock_get_hz(clk_sys) / 2 * freq;
|
||||
pio->txf[sm] = clock_get_hz(clk_sys) / (2 * freq);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user