~toykeeper/flashlight-firmware/fsm

« back to all changes in this revision

Viewing changes to ToyKeeper/spaghetti-monster/anduril/sunset-timer.h

  • Committer: Selene ToyKeeper
  • Date: 2023-11-04 15:09:10 UTC
  • mfrom: (483.1.175 anduril2)
  • Revision ID: bzr@toykeeper.net-20231104150910-ddd3afw4nhfvof2l
merged anduril2 branch -> fsm, with *years* of changes
(this also means this code is now Anduril 2 instead of Anduril 1)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// sunset-timer.h: Sunset / candle auto-shutoff functions for Anduril.
 
2
// Copyright (C) 2017-2023 Selene ToyKeeper
 
3
// SPDX-License-Identifier: GPL-3.0-or-later
 
4
 
 
5
#pragma once
 
6
 
 
7
// how many minutes to add each time the user "bumps" the timer?
 
8
#define SUNSET_TIMER_UNIT 5
 
9
 
 
10
#define TICKS_PER_MINUTE (TICKS_PER_SECOND*60)
 
11
 
 
12
// automatic shutoff timer
 
13
uint8_t sunset_timer = 0;  // minutes remaining in countdown
 
14
uint8_t sunset_timer_peak = 0;  // total minutes in countdown
 
15
uint16_t sunset_ticks = 0;  // counts from 0 to TICKS_PER_MINUTE, then repeats
 
16
uint8_t sunset_timer_state(Event event, uint16_t arg);
 
17