ESPHome 2026.11.0b6
Loading...
Searching...
No Matches
esphome::InterruptLock Class Reference

Helper class to disable interrupts. More...

#include <helpers.h>

Public Member Functions

ESPHOME_ALWAYS_INLINE InterruptLock ()
 
ESPHOME_ALWAYS_INLINE ~InterruptLock ()
 
 InterruptLock ()
 
 ~InterruptLock ()
 

Protected Attributes

uint32_t 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
Helper class to disable interrupts.
Definition helpers.h:2251
SemaphoreHandle_t lock

Definition at line 2251 of file helpers.h.

Constructor & Destructor Documentation

◆ InterruptLock() [1/2]

IRAM_ATTR esphome::InterruptLock::InterruptLock ( )
inline

Definition at line 2255 of file helpers.h.

◆ ~InterruptLock() [1/2]

IRAM_ATTR esphome::InterruptLock::~InterruptLock ( )
inline

Definition at line 2256 of file helpers.h.

◆ InterruptLock() [2/2]

esphome::InterruptLock::InterruptLock ( )

◆ ~InterruptLock() [2/2]

esphome::InterruptLock::~InterruptLock ( )

Field Documentation

◆ state_

uint32_t esphome::InterruptLock::state_
protected

Definition at line 2264 of file helpers.h.


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