v1.5.0
Go to the documentation of this file.
7 #ifndef _HARDWARE_CLOCKS_H
8 #define _HARDWARE_CLOCKS_H
11 #include "hardware/structs/clocks.h"
93 #ifndef PARAM_ASSERTIONS_ENABLED_CLOCKS
94 #define PARAM_ASSERTIONS_ENABLED_CLOCKS 0
148 static inline float frequency_count_mhz(uint src) {
189 uint div_int = (uint)div;
190 uint8_t frac = (uint8_t)((div - (
float)div_int) * (1u << CLOCKS_CLK_GPOUT0_DIV_INT_LSB));
bool clock_configure_gpin(enum clock_index clk_index, uint gpio, uint32_t src_freq, uint32_t freq)
Configure a clock to come from a gpio input.
Definition: clocks.c:364
uint32_t clock_get_hz(enum clock_index clk_index)
Get the current frequency of the specified clock.
Definition: clocks.c:208
static void clock_gpio_init(uint gpio, uint src, float div)
Output an optionally divided clock to the specified gpio pin.
Definition: clocks.h:187
clock_index
Enumeration identifying a hardware clock.
Definition: clocks.h:27
bool clock_configure(enum clock_index clk_index, uint32_t src, uint32_t auxsrc, uint32_t src_freq, uint32_t freq)
Configure the specified clock.
Definition: clocks.c:42
uint32_t frequency_count_khz(uint src)
Measure a clocks frequency using the Frequency counter.
Definition: clocks.c:218
void(* resus_callback_t)(void)
Resus callback function type.
Definition: clocks.h:158
void clocks_enable_resus(resus_callback_t resus_callback)
Enable the resus function. Restarts clk_sys if it is accidentally stopped.
Definition: clocks.c:293
void clocks_init(void)
Initialise the clock hardware.
Definition: clocks.c:121
void clock_set_reported_hz(enum clock_index clk_index, uint hz)
Set the "current frequency" of the clock as reported by clock_get_hz without actually changing the cl...
Definition: clocks.c:213
void clock_stop(enum clock_index clk_index)
Stop the specified clock.
Definition: clocks.c:35
void clock_gpio_init_int_frac(uint gpio, uint src, uint32_t div_int, uint8_t div_frac)
Output an optionally divided clock to the specified gpio pin.
Definition: clocks.c:317