Functions | |
void | setup_default_uart (void) |
Set up the default UART and assign it to the default GPIOs. More... | |
void | set_sys_clock_48mhz (void) |
Initialise the system clock to 48MHz. More... | |
void | set_sys_clock_pll (uint32_t vco_freq, uint post_div1, uint post_div2) |
Initialise the system clock. More... | |
bool | check_sys_clock_khz (uint32_t freq_khz, uint *vco_freq_out, uint *post_div1_out, uint *post_div2_out) |
Check if a given system clock frequency is valid/attainable. More... | |
static bool | set_sys_clock_khz (uint32_t freq_khz, bool required) |
Attempt to set a system clock frequency in khz. More... | |
Aggregation of a core subset of Raspberry Pi Pico SDK libraries used by most executables along with some additional utility methods. Including pico_stdlib gives you everything you need to get a basic program running which prints to stdout or flashes a LED
This library aggregates:
There are some basic default values used by these functions that will default to usable values, however, they can be customised in a board definition header via config.h or similar
bool check_sys_clock_khz | ( | uint32_t | freq_khz, |
uint * | vco_freq_out, | ||
uint * | post_div1_out, | ||
uint * | post_div2_out | ||
) |
Check if a given system clock frequency is valid/attainable.
freq_khz | Requested frequency |
vco_freq_out | On success, the voltage controlled oscillator frequency to be used by the SYS PLL |
post_div1_out | On success, The first post divider for the SYS PLL |
post_div2_out | On success, The second post divider for the SYS PLL. |
void set_sys_clock_48mhz | ( | void | ) |
Initialise the system clock to 48MHz.
Set the system clock to 48MHz, and set the peripheral clock to match.
|
inlinestatic |
Attempt to set a system clock frequency in khz.
Note that not all clock frequencies are possible; it is preferred that you use src/rp2_common/hardware_clocks/scripts/vcocalc.py to calculate the parameters for use with set_sys_clock_pll
freq_khz | Requested frequency |
required | if true then this function will assert if the frequency is not attainable. |
void set_sys_clock_pll | ( | uint32_t | vco_freq, |
uint | post_div1, | ||
uint | post_div2 | ||
) |
Initialise the system clock.
vco_freq | The voltage controller oscillator frequency to be used by the SYS PLL |
post_div1 | The first post divider for the SYS PLL |
post_div2 | The second post divider for the SYS PLL. |
See the PLL documentation in the datasheet for details of driving the PLLs.
void setup_default_uart | ( | void | ) |
Set up the default UART and assign it to the default GPIOs.
By default this will use UART 0, with TX to pin GPIO 0, RX to pin GPIO 1, and the baudrate to 115200
Calling this method also initializes stdin/stdout over UART if the pico_stdio_uart library is linked.
Defaults can be changed using configuration defines, PICO_DEFAULT_UART_INSTANCE, PICO_DEFAULT_UART_BAUD_RATE PICO_DEFAULT_UART_TX_PIN PICO_DEFAULT_UART_RX_PIN