
Scade One handles the entire application logic:
In addition to the Scade One logic, we must read the BOOTSEL button (with the get_bootsel_button function) to have direct access to QSPI registers.
The Pico SDK allows use to use functions (init_pwm, apply_freq) to initialize and control the PWM device.
Then, we must calculate the WRAP register value based on the frequency: wrap = 125 000 000/ (clkdiv × freq) -1. The wrap refers to the moment when a counter resets to zero after reaching its maximum value. We will detail the calculation later in the document.
Also, we must manage the execution cycle with sleep_ms(10), and the stdio initialization.
Finally, we need the swan_config.h file to map Swan types to stdint/stdbool types (refer to the first tutorial).