v2.0.0
Functions
pico_stdlib
High Level APIs

Aggregation of a core subset of Raspberry Pi Pico SDK libraries used by most executables along with some additional utility methods. More...

## 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_hz (uint32_t freq_hz, uint *vco_freq_out, uint *post_div1_out, uint *post_div2_out)
| Check if a given system clock frequency is valid/attainable. 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_hz (uint32_t freq_hz, bool required)
| Attempt to set a system clock frequency in hz. More...
static bool | set_sys_clock_khz (uint32_t freq_khz, bool required)
| Attempt to set a system clock frequency in khz. More...

## Detailed Description

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:

- hardware_divider
- hardware_gpio
- hardware_uart
- pico_runtime
- pico_platform
- pico_stdio
- pico_time
- pico_util

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

## Function Documentation

## ◆ check_sys_clock_hz()

bool check_sys_clock_hz | ( | uint32_t | freq_hz,
|  | uint * | vco_freq_out,
|  | uint * | post_div1_out,
|  | uint * | post_div2_out
| ) |  |

Check if a given system clock frequency is valid/attainable.

Parameters

  freq_hz | 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.

Returns
  true if the frequency is possible and the output parameters have been written.

## ◆ check_sys_clock_khz()

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.

Parameters

  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.

Returns
  true if the frequency is possible and the output parameters have been written.

## ◆ set_sys_clock_48mhz()

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.

## ◆ set_sys_clock_hz()

static bool set_sys_clock_hz | ( | uint32_t | freq_hz,
|  | bool | required
| ) |  |
| inlinestatic

Attempt to set a system clock frequency in hz.

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

Parameters

  freq_hz | Requested frequency
  required | if true then this function will assert if the frequency is not attainable.

Returns
  true if the clock was configured

## ◆ set_sys_clock_khz()

static bool set_sys_clock_khz | ( | uint32_t | freq_khz,
|  | bool | required
| ) |  |
| 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

Parameters

  freq_khz | Requested frequency
  required | if true then this function will assert if the frequency is not attainable.

Returns
  true if the clock was configured

## ◆ set_sys_clock_pll()

void set_sys_clock_pll | ( | uint32_t | vco_freq,
|  | uint | post_div1,
|  | uint | post_div2
| ) |  |

Initialise the system clock.

Parameters

  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.

## ◆ setup_default_uart()

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