@web-font-path: "roboto-debian.css";
Loading...
Searching...
No Matches
timer.h File Reference
#include "pico.h"
#include "hardware/structs/timer.h"
#include "hardware/regs/intctrl.h"
Include dependency graph for timer.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define PARAM_ASSERTIONS_ENABLED_HARDWARE_TIMER   0
#define TIMER_ALARM_IRQ_NUM(timer, alarm_num)
 Returns the irq_num_t for the alarm interrupt from the given alarm on the given timer instance.
#define TIMER_ALARM_NUM_FROM_IRQ(irq_num)
 Returns the alarm number from an irq_num_t. See TIMER_INSTANCE_NUM_FROM_IRQ to get the timer instance number.
#define TIMER_NUM_FROM_IRQ(irq_num)
 Returns the alarm number from an irq_num_t. See TIMER_INSTANCE_NUM_FROM_IRQ to get the alarm number.
#define PICO_DEFAULT_TIMER   0
 The default timer instance number of the timer instance used for APIs that don't take an explicit timer instance On RP2040 this must be 0 as there is only one timer instance .
#define PICO_DEFAULT_TIMER_INSTANCE()
 Returns the default timer instance on the platform based on the setting of PICO_DEFAULT_TIMER.
#define timer_hw   PICO_DEFAULT_TIMER_INSTANCE()

Typedefs

typedef void(* hardware_alarm_callback_t) (uint alarm_num)

Functions

static void check_hardware_alarm_num_param (__unused uint alarm_num)
static uint32_t timer_time_us_32 (timer_hw_t *timer)
 Return a 32 bit timestamp value in microseconds for a given timer instance.
static uint32_t time_us_32 (void)
 Return a 32 bit timestamp value in microseconds for the default timer instance.
uint64_t timer_time_us_64 (timer_hw_t *timer)
 Return the current 64 bit timestamp value in microseconds for a given timer instance.
uint64_t time_us_64 (void)
 Return the current 64 bit timestamp value in microseconds for the default timer instance.
void timer_busy_wait_us_32 (timer_hw_t *timer, uint32_t delay_us)
 Busy wait wasting cycles for the given (32 bit) number of microseconds using the given timer instance.
void busy_wait_us_32 (uint32_t delay_us)
 Busy wait wasting cycles for the given (32 bit) number of microseconds using the default timer instance.
void timer_busy_wait_us (timer_hw_t *timer, uint64_t delay_us)
 Busy wait wasting cycles for the given (64 bit) number of microseconds using the given timer instance.
void busy_wait_us (uint64_t delay_us)
 Busy wait wasting cycles for the given (64 bit) number of microseconds using the default timer instance.
void timer_busy_wait_ms (timer_hw_t *timer, uint32_t delay_ms)
 Busy wait wasting cycles for the given number of milliseconds using the given timer instance.
void busy_wait_ms (uint32_t delay_ms)
 Busy wait wasting cycles for the given number of milliseconds using the default timer instance.
void timer_busy_wait_until (timer_hw_t *timer, absolute_time_t t)
 Busy wait wasting cycles until after the specified timestamp using the given timer instance.
void busy_wait_until (absolute_time_t t)
 Busy wait wasting cycles until after the specified timestamp using the default timer instance.
static bool timer_time_reached (timer_hw_t *timer, absolute_time_t t)
 Check if the specified timestamp has been reached on the given timer instance.
static bool time_reached (absolute_time_t t)
 Check if the specified timestamp has been reached on the default timer instance.
void timer_hardware_alarm_claim (timer_hw_t *timer, uint alarm_num)
 cooperatively claim the use of this hardware alarm_num on the given timer instance
void hardware_alarm_claim (uint alarm_num)
 cooperatively claim the use of this hardware alarm_num on the default timer instance
int timer_hardware_alarm_claim_unused (timer_hw_t *timer, bool required)
 cooperatively claim the use of a hardware alarm_num on the given timer instance
int hardware_alarm_claim_unused (bool required)
 cooperatively claim the use of a hardware alarm_num on the default timer instance
void timer_hardware_alarm_unclaim (timer_hw_t *timer, uint alarm_num)
 cooperatively release the claim on use of this hardware alarm_num on the given timer instance
void hardware_alarm_unclaim (uint alarm_num)
 cooperatively release the claim on use of this hardware alarm_num on the default timer instance
bool timer_hardware_alarm_is_claimed (timer_hw_t *timer, uint alarm_num)
 Determine if a hardware alarm has been claimed on the given timer instance.
bool hardware_alarm_is_claimed (uint alarm_num)
 Determine if a hardware alarm has been claimed on the default timer instance.
void timer_hardware_alarm_set_callback (timer_hw_t *timer, uint alarm_num, hardware_alarm_callback_t callback)
 Enable/Disable a callback for a hardware alarm for a given timer instance on this core.
void hardware_alarm_set_callback (uint alarm_num, hardware_alarm_callback_t callback)
 Enable/Disable a callback for a hardware alarm on the default timer instance on this core.
bool timer_hardware_alarm_set_target (timer_hw_t *timer, uint alarm_num, absolute_time_t t)
 Set the current target for a specific hardware alarm on the given timer instance.
bool hardware_alarm_set_target (uint alarm_num, absolute_time_t t)
 Set the current target for the specified hardware alarm on the default timer instance.
void timer_hardware_alarm_cancel (timer_hw_t *timer, uint alarm_num)
 Cancel an existing target (if any) for a specific hardware_alarm on the given timer instance.
void hardware_alarm_cancel (uint alarm_num)
 Cancel an existing target (if any) for the specified hardware_alarm on the default timer instance.
void timer_hardware_alarm_force_irq (timer_hw_t *timer, uint alarm_num)
 Force and IRQ for a specific hardware alarm on the given timer instance.
void hardware_alarm_force_irq (uint alarm_num)
 Force and IRQ for a specific hardware alarm on the default timer instance.
static uint timer_hardware_alarm_get_irq_num (timer_hw_t *timer, uint alarm_num)
 Returns the irq_num_t for the alarm interrupt from the given alarm on the given timer instance.
static uint hardware_alarm_get_irq_num (uint alarm_num)
 Returns the irq_num_t for the alarm interrupt from the given alarm on the default timer instance.
static uint timer_get_index (timer_hw_t *timer)
 Returns the timer number for a timer instance.
static timer_hw_ttimer_get_instance (uint timer_num)
 Returns the timer instance with the given timer number.