35 #if (SYS_TIME_NB_TIMER >= SCHAR_MAX)
36 WARNING(
"Too many sys timers (SYS_TIME_NB_TIMER >= SCHAR_MAX). Consider increasing the size of tid_d type (currently int8_t")
97 static void cmd_sys_time(
shell_stream_t *sh,
int argc,
const char *
const argv[])
101 chprintf(sh,
"Usage: sys_time\r\n");
105 chprintf(sh,
"Current sys_time\r\n");
109 chprintf(sh,
"Registered timers\r\n");
112 chprintf(sh,
"id: %d, duration: %lu, end_time: %lu, cb: 0x%lx\r\n", i,
void sys_time_arch_init(void)
static const float offset[]
void chprintf(BaseSequentialStream *lchp, const char *fmt,...)
Arch independent mcu ( Micro Controller Unit ) utilities.
PRINT_CONFIG_VAR(ONELOOP_ANDI_FILT_CUTOFF)
Mini printf-like functionality.
void shell_add_entry(char *cmd_name, shell_cmd_t *cmd)
Add dynamic entry.
BaseSequentialStream shell_stream_t
void sys_time_update_timer(tid_t id, float duration)
Update the duration until a timer elapses.
tid_t sys_time_register_timer(float duration, sys_time_cb cb)
Register a new system timer.
tid_t sys_time_register_timer_offset(tid_t timer, float offset, sys_time_cb cb)
Register a new system timer with an fixed offset from another one.
void sys_time_cancel_timer(tid_t id)
Cancel a system timer by id.
Architecture independent timing functions.
volatile uint32_t nb_tick
SYS_TIME_TICKS since startup.
uint32_t ticks_per_sec
sys_time ticks per second (SYS_TIME_FREQUENCY)
#define SYS_TIME_FREQUENCY
(Default) sys_time timer frequency in Hz.
static uint32_t sys_time_ticks_of_sec(float seconds)
volatile uint32_t nb_sec
full seconds since startup
void(* sys_time_cb)(uint8_t id)
uint32_t duration
in SYS_TIME_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
struct sys_time_timer timer[SYS_TIME_NB_TIMER]
int8_t tid_t
sys_time timer id type
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.