move globals to class members
This commit is contained in:
@ -13,7 +13,8 @@
|
|||||||
|
|
||||||
const int MAX_INPUT = (1 << 10) - 1; // Max 10 bit analog read resolution.
|
const int MAX_INPUT = (1 << 10) - 1; // Max 10 bit analog read resolution.
|
||||||
|
|
||||||
// estimated default calibration value
|
// Estimated default calibration value
|
||||||
|
// TODO: This should be set by metadata via calibration.
|
||||||
const int CALIBRATED_LOW = -566;
|
const int CALIBRATED_LOW = -566;
|
||||||
const int CALIBRATED_HIGH = 512;
|
const int CALIBRATED_HIGH = 512;
|
||||||
|
|
||||||
|
|||||||
10
src/button.h
10
src/button.h
@ -4,7 +4,7 @@
|
|||||||
* @brief Wrapper class for interacting with trigger / gate inputs.
|
* @brief Wrapper class for interacting with trigger / gate inputs.
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* @date 2025-04-20
|
* @date 2025-04-20
|
||||||
*
|
*
|
||||||
* @copyright MIT - (c) 2025 - Adam Wonak - adam.wonak@gmail.com
|
* @copyright MIT - (c) 2025 - Adam Wonak - adam.wonak@gmail.com
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -13,14 +13,14 @@
|
|||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
const uint8_t DEBOUNCE_MS = 10;
|
|
||||||
const uint16_t LONG_PRESS_DURATION_MS = 750;
|
|
||||||
|
|
||||||
class Button {
|
class Button {
|
||||||
protected:
|
protected:
|
||||||
typedef void (*CallbackFunction)(void);
|
typedef void (*CallbackFunction)(void);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
static const uint8_t DEBOUNCE_MS = 10;
|
||||||
|
static const uint16_t LONG_PRESS_DURATION_MS = 750;
|
||||||
|
|
||||||
// Enum constants for active change in button state.
|
// Enum constants for active change in button state.
|
||||||
enum ButtonChange {
|
enum ButtonChange {
|
||||||
CHANGE_UNCHANGED,
|
CHANGE_UNCHANGED,
|
||||||
@ -84,7 +84,7 @@ class Button {
|
|||||||
if (on_long_press_ != NULL) on_long_press_();
|
if (on_long_press_ != NULL) on_long_press_();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update variables for next loop
|
// Update variables for next loop
|
||||||
last_press_ = (pressed || released) ? millis() : last_press_;
|
last_press_ = (pressed || released) ? millis() : last_press_;
|
||||||
old_read_ = read;
|
old_read_ = read;
|
||||||
|
|||||||
@ -13,10 +13,10 @@
|
|||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
const byte DEFAULT_TRIGGER_DURATION_MS = 5;
|
|
||||||
|
|
||||||
class DigitalOutput {
|
class DigitalOutput {
|
||||||
public:
|
public:
|
||||||
|
static const byte DEFAULT_TRIGGER_DURATION_MS = 5;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes an CV Output paired object.
|
* Initializes an CV Output paired object.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user