Deluge Firmware
1.3.0
Build date: 2026.08.29
Toggle main menu visibility
Loading...
Searching...
No Matches
ui_timer_manager.h
1
/*
2
* Copyright © 2014-2023 Synthstrom Audible Limited
3
*
4
* This file is part of The Synthstrom Audible Deluge Firmware.
5
*
6
* The Synthstrom Audible Deluge Firmware is free software: you can redistribute it and/or modify it under the
7
* terms of the GNU General Public License as published by the Free Software Foundation,
8
* either version 3 of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
11
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
* See the GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License along with this program.
15
* If not, see <https://www.gnu.org/licenses/>.
16
*/
17
18
#pragma once
19
20
#include "util/misc.h"
21
#include <array>
22
#include <cstdint>
23
enum class
TimerName {
24
DISPLAY,
25
MIDI_LEARN_FLASH,
26
DEFAULT_ROOT_NOTE,
27
TAP_TEMPO_SWITCH_OFF,
28
PLAY_ENABLE_FLASH,
29
LED_BLINK,
30
LED_BLINK_TYPE_1,
31
LEVEL_INDICATOR_BLINK,
32
SHORTCUT_BLINK,
33
MATRIX_DRIVER,
34
UI_SPECIFIC,
35
BACK_MENU_EXIT,
36
DISPLAY_AUTOMATION,
37
READ_INPUTS,
38
BATT_LED_BLINK,
39
GRAPHICS_ROUTINE,
40
OLED_LOW_LEVEL,
41
OLED_CONSOLE,
42
OLED_SCROLLING_AND_BLINKING,
43
SYSEX_DISPLAY,
44
METER_INDICATOR_BLINK,
45
SEND_MIDI_FEEDBACK_FOR_AUTOMATION,
46
INTERPOLATION_SHORTCUT_BLINK,
47
PAD_SELECTION_SHORTCUT_BLINK,
48
NOTE_ROW_BLINK,
49
LOADING_ANIMATION,
50
MOD_ENCODER_POPUP_FLUSH,
51
SELECTED_CLIP_PULSE,
53
SCREENSAVER,
55
NUM_TIMERS
56
};
57
58
struct
Timer
{
59
bool
active;
60
uint32_t triggerTime;
61
};
62
63
class
UITimerManager {
64
public
:
65
UITimerManager();
66
67
void
routine();
68
void
setTimer(TimerName which, int32_t ms);
69
void
setTimerSamples(TimerName which, int32_t samples);
70
void
unsetTimer(TimerName which);
71
72
bool
isTimerSet(TimerName which);
73
void
setTimerByOtherTimer(TimerName which, TimerName fromTimer);
74
75
private
:
76
uint32_t timeNextEvent;
77
std::array<
Timer
, util::to_underlying(TimerName::NUM_TIMERS)> timers_;
78
void
workOutNextEventTime();
79
80
public
:
81
[[gnu::always_inline]]
inline
Timer
& getTimer(TimerName which) {
return
timers_[util::to_underlying(which)]; }
82
};
83
84
extern
UITimerManager
uiTimerManager;
UITimerManager
Definition
ui_timer_manager.h:63
Timer
Definition
ui_timer_manager.h:58