Here you are:
https://github.com/HarleyQuin/Flashlight-Firmware/blob/master/STAR_momentary_BLF_SRK_16.c
Please remember it’s for ATtiny13a and only supports momentary switch.
Changelog to the original STAR Momentary v.1.6, from the top of my head:
- Renamed definitions for Port B
- Included a variable called highest_mode for mode change
- Removed wrap-around at mode change
- Included a 3rd timeframe (very_long_press_dur) for turnoff and straight-to-turbo
- Changed output routine (set_output())
- Each mode has (and needs) its own if…then routine (change the variable highest_mode if you add or remove modes!)
- Pins 5/6/3 can be turned ON or OFF (no PWM-0 or PWM-255 needed)
- Pin_3 set to output
- Added blinking 3 times in Low-Voltage-Protection
- Removed what I deemded not necessary for my build, but don’t remember all of it…
I hope that works for you. If not, give me a note and I will help out the best I can.
HQ