Skip to content

Commit 37ea083

Browse files
authored
Update Inkplate_Wake_Up_On_Touchpads.ino
1 parent fc7e120 commit 37ea083

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

examples/Inkplate6/Advanced_Inkplate_Features/Inkplate_Wake_Up_On_Touchpads/Inkplate_Wake_Up_On_Touchpads.ino

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
Select "Inkplate 6(ESP32)" from Tools -> Board menu.
55
Don't have "Inkplate 6(ESP32)" option? Follow our tutorial and add it:
66
https://e-radionica.com/en/blog/add-inkplate-6-to-arduino-ide/
7-
87
Here is shown how to use MCP and ESP interrupts to wake up the MCU from deepsleep when touchpad is pressed.
9-
108
Want to learn more about Inkplate? Visit www.inkplate.io
119
Looking to get support? Write on our forums: http://forum.e-radionica.com/en/
1210
15 July 2020 by e-radionica.com
@@ -24,12 +22,11 @@
2422
// Time ESP32 will go to sleep (in seconds)
2523
#define TIME_TO_SLEEP 30
2624

27-
// bitmask for GPIO_34 which is connected to MCP INTB
28-
#define TOUCHPAD_WAKE_MASK (int64_t(1) << GPIO_NUM_34)
29-
3025
// Initiate Inkplate object
3126
Inkplate display(INKPLATE_1BIT);
3227

28+
byte touchPadPin = PAD1;
29+
3330
// Store int in rtc data, to remain persistent during deep sleep
3431
RTC_DATA_ATTR int bootCount = 0;
3532

@@ -48,11 +45,12 @@ void setup()
4845
// Our function declared below
4946
displayInfo();
5047

51-
// Go to sleep for TIME_TO_SLEEP seconds
48+
// Go to sleep for TIME_TO_SLEEP seconds, but also enable wake up from gpio 34
49+
// Gpio 34 is where the mcp interrupt is connected, check
50+
// https://github.com/e-radionicacom/Inkplate-6-hardware/blob/master/Schematics%2C%20Gerber%2C%20BOM/Inkplate6%20Schematics.pdf
51+
// for more detail
5252
esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);
53-
54-
// enable wake from MCP port expander on gpio 34
55-
esp_sleep_enable_ext1_wakeup(TOUCHPAD_WAKE_MASK, ESP_EXT1_WAKEUP_ANY_HIGH);
53+
esp_sleep_enable_ext0_wakeup(GPIO_NUM_34, 1);
5654

5755
// Go to sleep
5856
esp_deep_sleep_start();

0 commit comments

Comments
 (0)