mtimer_init(mtimer_t *tm, mtimer_clock_fn clock)Initializes a manager using the caller-visiblesizeof(*tm).mtimer_init_sized(mtimer_t *tm, size_t tm_size, mtimer_clock_fn clock)ReturnsMTIMER_ERR_ABIwhen the caller and library disagree on manager size or resolved configuration.
mtimer_create(...)Returns a non-negative slot index on success or a negativemtimer_err_ton failure.mtimer_destroy(mtimer_t *tm, uint8_t id)Invalidates the slot index immediately. Later creates may reuse the same slot.
name == NULL creates an unnamed timer. Non-NULL names are caller-owned, must remain valid and immutable for the timer lifetime, and must be unique within the manager.
mtimer_start()Fully restarts a timer from the current clock value.mtimer_stop()Stops the timer and clears paused bookkeeping relevance.mtimer_pause()Valid only fromMTIMER_RUNNING. Already-due timers storeremaining_ms == 0.mtimer_resume()Valid only fromMTIMER_PAUSED. Zero remaining time becomes eligible on the next tick.mtimer_set_interval()Rejects zero. Running timers restart from the current clock. Paused timers remain paused and adopt the full new interval as remaining time. Stopped timers keep the new interval and remain stopped.
mtimer_tick(mtimer_t *tm)Returns the number of timers fired on success, or a negativemtimer_err_tsuch asMTIMER_ERR_NULL,MTIMER_ERR_INVALID, orMTIMER_ERR_BUSY.
Each successful tick captures a single now value, processes timers in ascending slot order, and fires each timer at most once.
mtimer_get_count()mtimer_at()mtimer_find()mtimer_get_state()mtimer_get_remaining()mtimer_get_fire_count()mtimer_get_total_fires()mtimer_get_total_ticks()
All query functions report failure explicitly instead of returning values that could be mistaken for valid state.
MTIMER_OKMTIMER_ERR_NULLMTIMER_ERR_FULLMTIMER_ERR_NOT_FOUNDMTIMER_ERR_INVALIDMTIMER_ERR_BUSYMTIMER_ERR_ABI