35 #include "mcu_periph/sys_time_arch.h"
61 chThdCreateStatic(wa_thd_sys_tick,
sizeof(wa_thd_sys_tick),
73 chMtxLock(&sys_time_mtx);
74 uint32_t current = chSysGetRealtimeCounterX();
78 chMtxUnlock(&sys_time_mtx);
89 chMtxLock(&sys_time_mtx);
90 uint32_t current = chSysGetRealtimeCounterX();
94 chMtxUnlock(&sys_time_mtx);
100 chMtxLock(&sys_time_mtx);
101 uint32_t current = chSysGetRealtimeCounterX();
105 chMtxUnlock(&sys_time_mtx);
121 chSysPolledDelayX(US2RTC(STM32_HCLK, us));
124 chThdSleepMicroseconds(us);
130 chThdSleepMilliseconds(ms);
135 chThdSleepSeconds(
s);
145 chRegSetThreadName(
"sys_tick_handler");
148 systime_t t = chVTGetSystemTime();
156 chMtxLock(&sys_time_mtx);
185 chMtxUnlock(&sys_time_mtx);
void sys_time_msleep(uint16_t ms)
static uint32_t cpu_ticks
static void sys_tick_handler(void)
static void thd_sys_tick(void *arg)
void sys_time_usleep(uint32_t us)
sys_time_usleep(uint32_t us)
static uint32_t cpu_counter
uint32_t get_sys_time_usec100(void)
Get the time in microseconds divided by 100 since startup.
uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
static THD_WORKING_AREA(wa_thd_sys_tick, 1024)
void sys_time_arch_init(void)
uint32_t get_sys_time_msec(void)
Get the time in milliseconds since startup.
void sys_time_ssleep(uint8_t s)
static MUTEX_DECL(sys_time_mtx)
#define CH_CFG_ST_FREQUENCY
System tick frequency.
arch independent LED (Light Emitting Diodes) API
volatile uint32_t nb_tick
SYS_TIME_TICKS since startup.
#define SYS_TIME_FREQUENCY
(Default) sys_time timer frequency in Hz.
volatile uint32_t nb_sec
full seconds since startup
uint32_t cpu_ticks_per_sec
cpu ticks per second
uint32_t duration
in SYS_TIME_TICKS
uint32_t resolution_cpu_ticks
sys_time_timer resolution in cpu ticks
volatile uint32_t nb_sec_rem
remainder of seconds since startup in CPU_TICKS
float resolution
sys_time_timer resolution in seconds
#define SYS_TIME_NB_TIMER
uint32_t end_time
in SYS_TIME_TICKS
static uint32_t cpu_ticks_of_sec(float seconds)
struct sys_time_timer timer[SYS_TIME_NB_TIMER]
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.