Skip to content

Commit e85c372

Browse files
committed
picoRTOS: added macro for quick timeout management
1 parent 8e03991 commit e85c372

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

picoRTOS.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,15 @@ picoRTOS_pid_t picoRTOS_self(void); /* gets the
8484
*/
8585
#define PICORTOS_DELAY_USEC(x) (picoRTOS_tick_t)(((x) * CONFIG_TICK_HZ) / 1000000)
8686

87+
/* Macro: PICORTOS_DELAY_ELAPSED(ref, x)
88+
* Checks if a specific delay has passed since ref
89+
*
90+
* Parameters:
91+
* ref - the reference time/tick
92+
* x - a delay in ticks
93+
*/
94+
#define PICORTOS_DELAY_ELAPSED(ref, x) !((picoRTOS_get_tick() - (ref)) < (x))
95+
8796
/* INTERRUPT MANAGEMENT */
8897

8998
typedef void (*picoRTOS_isr_fn)(/*@null@*/ void*);

0 commit comments

Comments
 (0)