For examples, see /examples Owake uses TiFSM as its backend
Note
This is the Community Edition of TitaniumFSM, licensed under GPLv3.0. For a commercial/private license, contact markusianito@proton.me
TitaniumFSM is a lightweight, dependency-free Finite State Machine engine written in pure C89, designed for portability, scalability, and architectural clarity.
From 8-bit microcontrollers to large-scale applications, TitaniumFSM provides a structured and maintainable way to organize behavior using hierarchical state management.
-
Written in C89
-
No dependencies
-
Portable across any architecture supporting C
-
Suitable for embedded systems and high-level applications
-
Scalable design
-
Optional C++ wrapper
-
No STL
-
No RTTI
-
No mandatory RAII
-
Clear hierarchical state organization
-
Safe state and subsystem transitions
-
Minimal runtime overhead
TitaniumFSM is built around four core components:
Program -> State -> Subsystem -> FSM
A Program is the atomic behavioral unit.
It is a struct containing three function pointers:
setup, loop, exit
Each state executes its assigned Program through these lifecycle callbacks.
A State contains: A Program A pointer to its owning Subsystem States can request transitions by referencing IDs.
A Subsystem groups multiple states. It acts as a self-contained module and has its own dispatcher that: Calls setup, loop, and exit appropriately Handles transitions between its internal states
Example use cases:
-
Clock / Timer / Alarm module
-
Game menu system
-
Communication protocols
-
Device operating modes
The FSM is the top-level container. It holds multiple Subsystems and:
-
Executes the current active Subsystem
-
Safely manages transitions between Subsystems
-
Delegates execution through internal dispatchers
Call fsm.execute() inside your main loop and the engine handles the rest.
Transitions are performed using 16-bit IDs. This allows up to:
65,535 States, 65,535 Subsystems
States can request state changes within their Subsystem. Subsystems can request transitions to other Subsystems via the FSM. All transitions are handled safely by the dispatching system.
TitaniumFSM provides helper functions to create and configure Programs, States, Subsystems and FSM instances.
The dispatcher handles lifecycle management automatically.
The optional wrapper allows you to:
FSM fsm;
// in loop
fsm.execute();No STL :o No RTTI :O No forced RAII.
Pure control, minimal abstraction, maximum predictability.
AVR projects (clocks, menus, control systems)
Embedded firmware
Communication protocols
UI navigation systems
Game state management
Industrial control logic
Any application that benefits from deterministic behavior control
TitaniumFSM is built on three principles:
- Explicit structure
- Deterministic execution
- Architectural clarity
It encourages modular thinking and clean separation of responsibilities.
No magic. No hidden allocations. No runtime surprises.
Just controlled state flow.
GPL v3.0
- Marcos.
