@web-font-path: "roboto-debian.css";
Loading...
Searching...
No Matches
clocks.h File Reference
#include "pico.h"
#include "hardware/structs/clocks.h"
Include dependency graph for clocks.h:

Go to the source code of this file.

Macros

#define KHZ   1000
#define MHZ   1000000
#define PLL_COMMON_REFDIV   1
#define PLL_SYS_REFDIV   PLL_COMMON_REFDIV
#define SYS_CLK_VREG_VOLTAGE_AUTO_ADJUST   0
#define SYS_CLK_VREG_VOLTAGE_AUTO_ADJUST_DELAY_US   1000
#define PLL_USB_REFDIV   PLL_COMMON_REFDIV
#define PARAM_ASSERTIONS_ENABLED_HARDWARE_CLOCKS   0
#define PICO_CLOCK_GPIO_CLKDIV_ROUND_NEAREST   PICO_CLKDIV_ROUND_NEAREST
#define GPIO_TO_GPOUT_CLOCK_HANDLE_RP2040(gpio, default_clk_handle)
#define GPIO_TO_GPOUT_CLOCK_HANDLE_RP2350(gpio, default_clk_handle)
#define GPIO_TO_GPOUT_CLOCK_HANDLE
 Returns the GPOUT clock number associated with a particular GPIO if there is one, or default_clk_handle otherwise.

Typedefs

typedef clock_num_t clock_handle_t
typedef void(* resus_callback_t) (void)
 Resus callback function type.

Functions

bool clock_configure (clock_handle_t clock, uint32_t src, uint32_t auxsrc, uint32_t src_freq, uint32_t freq)
 Configure the specified clock with automatic clock divisor setup.
void clock_configure_undivided (clock_handle_t clock, uint32_t src, uint32_t auxsrc, uint32_t src_freq)
 Configure the specified clock to use the undivided input source.
void clock_configure_int_divider (clock_handle_t clock, uint32_t src, uint32_t auxsrc, uint32_t src_freq, uint32_t int_divider)
 Configure the specified clock to use the undivided input source.
void clock_stop (clock_handle_t clock)
 Stop the specified clock.
uint32_t clock_get_hz (clock_handle_t clock)
 Get the current frequency of the specified clock.
uint32_t frequency_count_khz (uint src)
 Measure a clocks frequency using the Frequency counter.
void clock_set_reported_hz (clock_handle_t clock, uint hz)
 Set the "current frequency" of the clock as reported by clock_get_hz without actually changing the clock.
static float frequency_count_mhz (uint src)
void clocks_enable_resus (resus_callback_t resus_callback)
 Enable the resus function. Restarts clk_sys if it is accidentally stopped.
void clock_gpio_init_int_frac16 (uint gpio, uint src, uint32_t div_int, uint16_t div_frac16)
 Output an optionally divided clock to the specified gpio pin.
static void clock_gpio_init_int_frac8 (uint gpio, uint src, uint32_t div_int, uint8_t div_frac8)
 Output an optionally divided clock to the specified gpio pin.
static void clock_gpio_init_int_frac (uint gpio, uint src, uint32_t div_int, uint8_t div_frac8)
static void clock_gpio_init (uint gpio, uint src, float div)
 Output an optionally divided clock to the specified gpio pin.
bool clock_configure_gpin (clock_handle_t clock, uint gpio, uint32_t src_freq, uint32_t freq)
 Configure a clock to come from a gpio input.
void set_sys_clock_48mhz (void)
 Initialise the system clock to 48MHz.
void set_sys_clock_pll (uint32_t vco_freq, uint post_div1, uint post_div2)
 Initialise the system clock.
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.
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.
static bool set_sys_clock_hz (uint32_t freq_hz, bool required)
 Attempt to set a system clock frequency in hz.
static bool set_sys_clock_khz (uint32_t freq_khz, bool required)
 Attempt to set a system clock frequency in khz.
static clock_handle_t gpio_to_gpout_clock_handle (uint gpio, clock_handle_t default_clk_handle)
 return the associated GPOUT clock for a given GPIO if any

Macro Definition Documentation

◆ GPIO_TO_GPOUT_CLOCK_HANDLE_RP2040

#define GPIO_TO_GPOUT_CLOCK_HANDLE_RP2040 ( gpio,
default_clk_handle )
Value:
((gpio) == 21 ? clk_gpout0 : \
((gpio) == 23 ? clk_gpout1 : \
((gpio) == 24 ? clk_gpout2 : \
((gpio) == 25 ? clk_gpout3 : \
(default_clk_handle)))))
@ clk_gpout0
Select CLK_GPOUT0 as clock source.
Definition clocks.h:31
@ clk_gpout2
Select CLK_GPOUT2 as clock source.
Definition clocks.h:33
@ clk_gpout1
Select CLK_GPOUT1 as clock source.
Definition clocks.h:32
@ clk_gpout3
Select CLK_GPOUT3 as clock source.
Definition clocks.h:34

◆ GPIO_TO_GPOUT_CLOCK_HANDLE_RP2350

#define GPIO_TO_GPOUT_CLOCK_HANDLE_RP2350 ( gpio,
default_clk_handle )
Value:
((gpio) == 13 ? clk_gpout0 : \
((gpio) == 15 ? clk_gpout1 : \
(GPIO_TO_GPOUT_CLOCK_HANDLE_RP2040(gpio, default_clk_handle))))