• 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

Some code descriptions

Q&A Forum › Category: ESP32 › Some code descriptions
0 Vote Up Vote Down
x3mvz5pl5g5k asked 6 years ago

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.

Question Tags: sleep callback bitmask
3 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 6 years ago

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

0 Vote Up Vote Down
x3mvz5pl5g5k answered 6 years ago

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.

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

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

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.