ESPHome  2022.6.2
Public Member Functions | Protected Attributes
esphome::InterruptLock Class Reference

Helper class to disable interrupts. More...

#include <helpers.h>

Public Member Functions

 InterruptLock ()
 ~InterruptLock ()

Protected Attributes

uint32_t xt_state_

Detailed Description

Helper class to disable interrupts.

This behaves like std::lock_guard: as long as the object is alive, all interrupts are disabled.

Please note all functions called when the interrupt lock must be marked IRAM_ATTR (loading code into instruction cache is done via interrupts; disabling interrupts prevents data not already in cache from being pulled from flash).

Example usage:

// interrupts are enabled
// do something
// interrupts are disabled
// interrupts are enabled

Definition at line 533 of file helpers.h.

Constructor & Destructor Documentation

◆ InterruptLock()

IRAM_ATTR esphome::InterruptLock::InterruptLock ( )

Definition at line 347 of file helpers.cpp.

◆ ~InterruptLock()

IRAM_ATTR esphome::InterruptLock::~InterruptLock ( )

Definition at line 348 of file helpers.cpp.

Field Documentation

◆ xt_state_

uint32_t esphome::InterruptLock::xt_state_

Definition at line 540 of file helpers.h.

The documentation for this class was generated from the following files: