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.

Hi Ray.

That’s right. Thanks for the suggestion.

It is a better way to calculate the bitmask.

Regards,

Sara

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