• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Deep Sleep External Wake Up with ext1

Q&A Forum › Category: ESP32 › Deep Sleep External Wake Up with ext1
0 Vote Up Vote Down
Ray Leiter asked 4 years ago

In Learn ESP32, Module 3, Unit 4 it is suggested to construct the BIT_MASK needed by “esp_sleep_enable_ext1_wakeup(bitmask, mode)”, we compute the SUM of 2^GPIO_NUM and then convert it to HEX.
I thought it might be easier to let the complier do the computation by giving it the OR’d value of all bits needed for the mask.
There are 19 pins usable for this function. Construct a “#define” for each possible mask bit and then OR them to create the final mask needed.
The course example for 2 bits uses bits 2 and 15; so we have, among our 19 #define’s these 2:
#define BitMask2 0x00 0000 0004  and #define BitMask15 0x00 0000 8000  [spaces for readability] 
Therefore, the BIT_MASK we need is:  “BitMask2 | BitMask15”, which would yield 0x8004.

Question Tags: Deep Sleep External ext1
3 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

Hi Ray.
That’s right. Thanks for the suggestion.
It is a better way to calculate the bitmask.
Regards,
Sara

0 Vote Up Vote Down
Ray Leiter answered 4 years ago

Sara;
Thanks. When I said there are 19 pins usable with ext1, I was counting 3 of them we’re not supposed to use as they are normally associated with another function (the integrated SPI flash).
The 3 pins are GPIO 9,10,11
Therefore we have 16 pins available for the ext2 use!
Ray

0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

Yes, that’s right.
 

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025
  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.