Micro-toolkit

microtimer

Main loops need bounded software timers without allocation or a scheduler.

A fixed-capacity manager fires caller callbacks from explicit tick calls.

DevelopmentMITC99
Last verified
Not audited against current README/docs
Platform scope
Portable C99; integration depends on caller-provided adapters

What it solves

Main loops need bounded software timers without allocation or a scheduler.

How it works

1Clock + timer table2tick3due callback

Use it when

Blink an LED periodically
Schedule a one-shot timeout
Drive timers from a uint32 millisecond clock

Quick Start

#include "mtimer.h"
mtimer_t tm; mtimer_init(&tm,app_clock_ms);
int id=mtimer_create(&tm,"blink",500,MTIMER_PERIODIC,blink_cb,&flag);
mtimer_start(&tm,(uint8_t)id); mtimer_tick(&tm);
/* Expected: callback runs when the deadline is due. */

Engineering evidence

  • GCC, Clang, MSVC and ARM compile-only support scope is documented

Known limits

  • No hidden locks or persistence
  • At most one fire per timer per tick; missed intervals are skipped
  • Shared access needs external synchronization