-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathResetButton.h
52 lines (48 loc) · 1.37 KB
/
ResetButton.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
49
50
51
52
/**************************************************************
* This is a DEMO. You can use it only for development and testing.
*
* If you would like to add these features to your product,
* please contact Blynk for Business:
*
* http://www.blynk.io/
*
**************************************************************/
volatile bool g_buttonPressed = false;
volatile uint32_t g_buttonPressTime = -1;
void button_action(void)
{
BlynkState::set(MODE_RESET_CONFIG);
}
ICACHE_RAM_ATTR
void button_change(void)
{
//#if BOARD_BUTTON_ACTIVE_LOW
//// bool buttonState = !digitalRead(BOARD_BUTTON_PIN);
//#else
//// bool buttonState = digitalRead(BOARD_BUTTON_PIN);
//#endif
//
//// if (buttonState && !g_buttonPressed) {
// g_buttonPressTime = millis();
// g_buttonPressed = true;
// DEBUG_PRINT("Hold the button to reset configuration...");
//// } else if (!buttonState && g_buttonPressed) {
// g_buttonPressed = false;
// uint32_t buttonHoldTime = millis() - g_buttonPressTime;
// if (buttonHoldTime >= BUTTON_HOLD_TIME_ACTION) {
// button_action();
// } else {
// // User action
// }
// g_buttonPressTime = -1;
// }
}
void button_init()
{
#if BOARD_BUTTON_ACTIVE_LOW
// pinMode(BOARD_BUTTON_PIN, INPUT_PULLUP);
#else
// pinMode(BOARD_BUTTON_PIN, INPUT);
#endif
// attachInterrupt(BOARD_BUTTON_PIN, button_change, CHANGE);
}