Sometimes the course includes coding language or concepts that might be better explained.
Perhaps it is beyond the level of the course, but regardless could you please explain in a little more detail what bitmask and callback are and how they are used in the sleep programs?
These were included in the Deep Sleep module, but they might also be found in later chapters.
Hi.
In this context, the bitmask is a way to select the GPIOs you want to use as a wake up source (it is how the esp_sleep_enable_ext1_wakeup() function works).
If you want to learn more about this concept, I recommend taking a look at the following article, for example:
https://www.arduino.cc/en/Tutorial/BitMask
A callback function is a function that will run when some event happens. What example of callback function are you referring to?
Regards,
Sara
It is used in the Touch Wake Up, but I was wondering in general what these terms meant and what was going on “under the hood”. As mentioned in the useful Arduino article, bitmask refers to a type of bitwise manipulation.
Hi.
In the touch wake up example, we have the following:
touchAttachInterrupt(T3, callback, Threshold);
This means that the callback function will run when the touch value will be above the threshold. So, as you can see, callback functions are functions that run when a certain condition is met without compromising the rest of the code. You can also see something like this when we set up interrupts.
As for the bitmask, I don’t know exactly how it works on the background.
Regards,
Sara