39 typedef int64_t os_time_t;
42 #error "TICK_FREQ has not been defined for the current MCU !" 43 #elif ((TICK_FREQ % 64) != 0) 44 #error "TICK_FREQ must be a multiple of 64 !" 45 #elif (TICK_FREQ < 8192) 46 #error "TICK_FREQ too low (should be >= 8192) !" 49 #define s2ostime(s) ((os_time_t) ((int64_t) s * TICK_FREQ)) 50 #define ms2ostime(ms) ((os_time_t) (((int64_t) ms * TICK_FREQ) / 1000)) 51 #define us2ostime(us) ((os_time_t) (((int64_t) us * (TICK_FREQ / 64)) / 15625)) 53 #define ostime2s(t) ((int64_t) (t / TICK_FREQ)) 54 #define ostime2ms(t) ((int64_t) ((t * (int64_t) 1000) / TICK_FREQ)) 55 #define ostime2us(t) ((int64_t) ((t * (int64_t) 15625) / (TICK_FREQ / 64))) 58 void (*callback)(
struct os_job *);
63 typedef struct os_job os_job_t;
130 void os_post_job(os_job_t *job,
void (*cb)(os_job_t *));
void os_post_job(os_job_t *job, void(*cb)(os_job_t *))
Posts a job to be executed as soon as possible.
Definition: os.c:102
void os_delay(os_time_t time)
Waits for a given time.
Definition: os.c:61
void os_unblock_powersave(void)
Allows the system to go to sleep mode.
Definition: os.c:148
void os_post_delayed_job(os_job_t *job, os_time_t time, void(*cb)(os_job_t *))
Posts a job to be executed at a given time.
Definition: os.c:122
uint8_t os_cancel_job(os_job_t *job)
Cancels a scheduled job.
Definition: os.c:89
void os_block_powersave(void)
Prevents the system from going to sleep mode.
Definition: os.c:161
os_time_t os_get_elapsed_time(os_time_t time)
Returns how much time passed since a given timestamp.
Definition: os.c:66
void os_mainloop(void)
The Operating System mainloop.
Definition: os.c:174
void os_init(void)
Initializes the Operating System.
Definition: os.c:45
os_time_t os_get_time(void)
Gets the current time.
Definition: os.c:51
void os_wait_until(os_time_t time)
Waits until a given time.
Definition: os.c:56