forked from dancol90/MenuLib
-
Notifications
You must be signed in to change notification settings - Fork 1
/
NumericSelector.h
executable file
·48 lines (30 loc) · 1.07 KB
/
NumericSelector.h
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
44
45
46
47
48
/*
This item set a variable to a integer value in a range.
support for text array by reaper7
*/
#include <Arduino.h>
#include "MenuItem.h"
#ifndef NumericSelector_h
#define NumericSelector_h
class NumericSelector : public MenuItem {
public:
typedef void(*NumberSelectedCallback)(bool);
NumericSelector(MenuItem* parent, const FlashString* text, uint8_t& variable, uint8_t min, uint8_t max, NumberSelectedCallback callback = NULL, const char** arr = NULL);
uint8_t getValue();
uint8_t getMin();
uint8_t getMax();
char getTypeId() { return (arr?'t':'s'); }; //s - numeric selector; t - array selector
const char* getSecondaryText();
bool activate();
void deactivate();
void doNext();
void doPrev();
MenuItem* action();
private:
uint8_t& variable;
uint8_t oldValue, min, max;
const char** arr;
char valueStr[18];
NumberSelectedCallback callback;
};
#endif