~toykeeper/flashlight-firmware/fsm

« back to all changes in this revision

Viewing changes to ToyKeeper/spaghetti-monster/anduril/strobe-modes.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
// strobe-modes.h: Strobe modes for Anduril.
 
2
// Copyright (C) 2017-2023 Selene ToyKeeper
 
3
// SPDX-License-Identifier: GPL-3.0-or-later
 
4
 
 
5
#pragma once
 
6
 
 
7
#ifdef USE_STROBE_STATE
 
8
 
 
9
strobe_mode_te current_strobe_type;
 
10
 
 
11
// which strobe mode is active?
 
12
#ifdef USE_CANDLE_MODE
 
13
    #define DEFAULT_STROBE candle_mode_e
 
14
#else
 
15
    #define DEFAULT_STROBE 0
 
16
#endif
 
17
 
 
18
#endif  // ifdef USE_STROBE_STATE
 
19
 
 
20
 
 
21
// full FET strobe can be a bit much...  use max regulated level instead,
 
22
// if there's a bright enough regulated level
 
23
#ifndef STROBE_BRIGHTNESS
 
24
#ifdef MAX_Nx7135
 
25
#define STROBE_BRIGHTNESS MAX_Nx7135
 
26
#else
 
27
#define STROBE_BRIGHTNESS MAX_LEVEL
 
28
#endif
 
29
#endif
 
30
 
 
31
// some drivers need to keep the regulator chip on between pulses,
 
32
// so set this to 1 to keep the light on at moon mode between pulses,
 
33
// and thus keep the regulator powered up for the next flash
 
34
#ifndef STROBE_OFF_LEVEL
 
35
#define STROBE_OFF_LEVEL 0
 
36
#endif
 
37
 
 
38
// party and tactical strobes
 
39
#ifdef USE_STROBE_STATE
 
40
uint8_t strobe_state(Event event, uint16_t arg);
 
41
inline void strobe_state_iter();
 
42
#endif
 
43
 
 
44
#if defined(USE_PARTY_STROBE_MODE) || defined(USE_TACTICAL_STROBE_MODE)
 
45
inline void party_tactical_strobe_mode_iter(uint8_t st);
 
46
#endif
 
47
 
 
48
#ifdef USE_POLICE_COLOR_STROBE_MODE
 
49
inline void police_color_strobe_iter();
 
50
#endif
 
51
 
 
52
#ifdef USE_LIGHTNING_MODE
 
53
inline void lightning_storm_iter();
 
54
#endif
 
55
 
 
56
// bike mode config options
 
57
#ifdef USE_BIKE_FLASHER_MODE
 
58
#define MAX_BIKING_LEVEL 120  // should be 127 or less
 
59
inline void bike_flasher_iter();
 
60
#endif
 
61
 
 
62
#ifdef USE_CANDLE_MODE
 
63
#include "candle-mode.h"
 
64
#endif
 
65
 
 
66
 
 
67
#if defined(USE_POLICE_STROBE_MODE) || defined(USE_SOS_MODE_IN_FF_GROUP)
 
68
#define USE_BORING_STROBE_STATE
 
69
#include "ff-strobe-modes.h"
 
70
#endif
 
71