Skip to content
/ tyrfing Public

Firmware for flashlights using loneoceans attiny1616 drivers

Notifications You must be signed in to change notification settings

simmsb/tyrfing

Repository files navigation

Flashlight firmware, written in rust

torches.mp4

This is flashlight firmware for the lume1-6af (attiny1616), written in Rust. It supports thermal and voltage regulation that prevents LED and battery damage by reducing output as temperature increases, and prevents usage when the battery voltage is too low.

The UI is implemented using async rust, which makes adding new modes of operation fairly trivial.

The UI and features are inspired by the Andúril firmware

Current UI

This might be wrong, the source code is here

stateDiagram-v2
    [*] --> Locked

    state Locked

    Locked --> Unlocked : 3c
    Unlocked --> Locked : 4c
    Unlocked --> Locked : Timeout


    state Unlocked {
        [*] --> Ramping : 1c
        [*] --> Ramping : 1h (low start)
        
        state Ramping {
            [*] --> [*] : 1h (increase brightness)
            [*] --> [*] : 2h (decrease brightness)
        }
        
        Ramping --> [*] : 1c

        [*] --> Fading : 2h
        
        state Fading {
            [*] --> [*] : 1h (increase brightness)
            [*] --> [*] : 2h (decrease brightness)
            [*] --> [*] : 3h (increase timeout)
        }
        
        Fading --> [*] : 1c

        [*] --> Strobing : 3h
        
        state Strobing {
            [*] --> [*] : 1h (increase brightness)
            [*] --> [*] : 2h (decrease brightness)
            [*] --> [*] : 3h (decrease period)
            [*] --> [*] : 4h (increase period)
        }
        
        Strobing --> [*] : 1c

    }

Thanks

This project relies on and makes modifications to:

EMBASSY on an attiny1616

This is some messing around with embassy on AVR (attiny1616)

The time driver ticks at 64hz and I've modified embassy to use a u32 tick counter, which at 64hz won't overflow for just enough time for this to be useful to me