forked from codemakeshare/Menu
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparameters.cpp
More file actions
40 lines (30 loc) · 891 Bytes
/
parameters.cpp
File metadata and controls
40 lines (30 loc) · 891 Bytes
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
#include "parameters.h"
void Parameter::increment() {
};
void Parameter::decrement() {
};
void Parameter::setScaledValue(float value) {
};
void Parameter::getValueAsString(char* valueBuffer) {valueBuffer="?";};
void ParameterInt16::getValueAsString(char* valueBuffer) {
itoa(value, valueBuffer, 10);
};
void ParameterInt16::increment() {
value += stepsize;
if (value>maxval) value=maxval;
if (callback!=NULL) callback(this);
};
void ParameterInt16::decrement() {
value -= stepsize;
if (value<minval) value=minval;
if (callback!=NULL) callback(this);
};
void ParameterInt16::setScaledValue(float newValue) {
setValue(int16_t(newValue*(maxval-minval)+minval));
};
void ParameterInt16::setValue(int16_t newValue) {
value = newValue;
if (value<minval) value=minval;
if (value>maxval) value=maxval;
if (callback!=NULL) callback(this);
};