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:
Uri Shaked 2021-06-10 00:14:42 +03:00 committed by Graham Sanderson
parent cf2cd5a5f1
commit 34c3ade43e

View File

@ -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);
}