-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFootController.h
More file actions
43 lines (39 loc) · 1.16 KB
/
FootController.h
File metadata and controls
43 lines (39 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#pragma once
#include "config.h"
#include "FcDisplay.h"
#include "FcLeds.h"
#include "FastMux.h"
#include "ProtocolType.h"
#include <Bounce2.h>
#include "SwitchHoldManager.h"
/// Base class for all controllers that this firmware will be able to handle
class FootController
{
public:
FootController(ProtocolType protocolType);
void begin(); // implements the Template Method design pattern
ProtocolType getProtocolType() const { return _protocolType; }
virtual void init() = 0;
virtual void update() = 0;
int sceneFromSwitchValue(int sw) {
switch (sw) {
case SWITCH_S1: return 1;
case SWITCH_S2: return 2;
case SWITCH_S3: return 3;
case SWITCH_S4: return 4;
case SWITCH_S5: return 5;
case SWITCH_S6: return 6;
case SWITCH_S7: return 7;
case SWITCH_S8: return 8;
}
// should never happen, but if it bugs ; then use 1 instead of crashing
return 1;
}
protected:
ProtocolType _protocolType;
static FcLeds& _leds;
static FastMux& _mux;
static FcDisplay& _display;
static Bounce* _buttons;
static SwitchHoldManager HoldMgr;
};