v1.5.0
Go to the documentation of this file.
7 #ifndef _HARDWARE_TIMER_H
8 #define _HARDWARE_TIMER_H
11 #include "hardware/structs/timer.h"
49 #ifndef PARAM_ASSERTIONS_ENABLED_TIMER
50 #define PARAM_ASSERTIONS_ENABLED_TIMER 0
53 static inline void check_hardware_alarm_num_param(__unused uint alarm_num) {
54 invalid_params_if(TIMER, alarm_num >= NUM_TIMERS);
66 return timer_hw->timerawl;
116 uint32_t hi_target = (uint32_t)(target >> 32u);
117 uint32_t hi = timer_hw->timerawh;
118 return (hi >= hi_target && (timer_hw->timerawl >= (uint32_t) target || hi != hi_target));
void hardware_alarm_force_irq(uint alarm_num)
Force and IRQ for a specific hardware alarm.
Definition: timer.c:234
static uint32_t time_us_32(void)
Return a 32 bit timestamp value in microseconds.
Definition: timer.h:65
void busy_wait_until(absolute_time_t t)
Busy wait wasting cycles until after the specified timestamp.
Definition: timer.c:94
void hardware_alarm_unclaim(uint alarm_num)
cooperatively release the claim on use of this hardware alarm_num
Definition: timer.c:26
bool hardware_alarm_set_target(uint alarm_num, absolute_time_t t)
Set the current target for the specified hardware alarm.
Definition: timer.c:175
static uint64_t to_us_since_boot(absolute_time_t t)
convert an absolute_time_t into a number of microseconds since boot.
Definition: types.h:44
void busy_wait_ms(uint32_t delay_ms)
Busy wait wasting cycles for the given number of milliseconds.
Definition: timer.c:85
void hardware_alarm_cancel(uint alarm_num)
Cancel an existing target (if any) for a given hardware_alarm.
Definition: timer.c:224
bool hardware_alarm_is_claimed(uint alarm_num)
Determine if a hardware alarm has been claimed.
Definition: timer.c:31
void hardware_alarm_claim(uint alarm_num)
cooperatively claim the use of this hardware alarm_num
Definition: timer.c:21
void busy_wait_us(uint64_t delay_us)
Busy wait wasting cycles for the given (64 bit) number of microseconds.
Definition: timer.c:74
void(* hardware_alarm_callback_t)(uint alarm_num)
Definition: timer.h:127
uint64_t time_us_64(void)
Return the current 64 bit timestamp value in microseconds.
Definition: timer.c:41
int hardware_alarm_claim_unused(bool required)
cooperatively claim the use of this hardware alarm_num
Definition: timer.c:36
void busy_wait_us_32(uint32_t delay_us)
Busy wait wasting cycles for the given (32 bit) number of microseconds.
Definition: timer.c:61
void hardware_alarm_set_callback(uint alarm_num, hardware_alarm_callback_t callback)
Enable/Disable a callback for a hardware timer on this core.
Definition: timer.c:148
static bool time_reached(absolute_time_t t)
Check if the specified timestamp has been reached.
Definition: timer.h:114