$ show ToyKeeper/anduril
Anduril is an open-source firmware project for e-switch flashlights, primarily targeting AVR microcontrollers (attiny85, attiny1634, attiny1616, avr32dd20). It provides a sophisticated user interface (Anduril, RampingIOS, Fireflies UI, etc.) built on the SpaghettiMonster event-driven state machine framework. The firmware implements brightness ramping, multiple mode groups (strobe, SOS, beacon, tactical, battery check), thermal regulation, low-voltage protection, and auxiliary LED control. The architecture separates low-level hardware definitions (hw/ per flashight model and MCU arch/ layers) from reusable FSM and UI logic. Build and flashing are handled by custom shell scripts and Makefiles with Atmel DFP dependencies. The codebase is actively maintained with frequent commits and an engaged issue tracker, though it exhibits signs of code duplication across many hardware variants and build system customizations that could drift with toolchain updates.
The LLM identified 4 files worth highlighting for reuse:
Core event-driven finite state machine framework for embedded firmware. Provides event queue, state stack, EEPROM wear-levelling, ADC, WDT, and PCINT handling. Self-contained and could be extracted for other event-driven embedded projects.
Abstracts LED output channels (main, aux, RGB) with set_level and gradual_tick interface. Enables multiple channels to be controlled uniformly. Reusable for any multi-channel LED control.
I2C driver for AW2016 RGB LED driver chip. Implements PWM mode, LED enable, and pattern control. Clean interface that can be reused for other I2C LED drivers with similar chips.
Shell script for compiling firmware for multiple AVR MCUs. Handles MCU detection, DFP includes, compilation, and output. Reusable for any AVR cross-compilation project.