ESP32 implementation of GPIO input with interrupt support.
More...
#include <EspGpioInput.h>
ESP32 implementation of GPIO input with interrupt support.
Features:
- Internal pull-up resistor enabled
- Interrupt on both edges (rising and falling)
- IRAM-safe interrupt handler
- Software debouncing for buttons
◆ EspGpioInput() [1/2]
| EspGpioInput::EspGpioInput |
( |
gpio_num_t |
pin, |
|
|
uint32_t |
debounceMs = 0 |
|
) |
| |
|
explicit |
Construct ESP32 GPIO input.
- Parameters
-
| pin | GPIO pin number |
| debounceMs | Debounce time in milliseconds (0 = no debouncing) |
◆ ~EspGpioInput()
| EspGpioInput::~EspGpioInput |
( |
| ) |
|
|
override |
◆ EspGpioInput() [2/2]
◆ disableInterrupt()
| void EspGpioInput::disableInterrupt |
( |
| ) |
|
|
overridevirtual |
Disable interrupt for this GPIO.
Implements IGpioInput.
◆ enableInterrupt()
| void EspGpioInput::enableInterrupt |
( |
| ) |
|
|
overridevirtual |
Enable interrupt for this GPIO.
Implements IGpioInput.
◆ getLevel()
| bool EspGpioInput::getLevel |
( |
| ) |
const |
|
overridevirtual |
Get current logic level of GPIO input.
- Returns
- true if HIGH, false if LOW
Implements IGpioInput.
◆ operator=()
◆ setInterruptHandler()
| void EspGpioInput::setInterruptHandler |
( |
std::function< void(bool level)> |
handler | ) |
|
|
overridevirtual |
Set interrupt handler callback.
- Parameters
-
| handler | Function called when interrupt triggers (parameter: current level) |
Implements IGpioInput.
◆ simulateInterrupt()
| void EspGpioInput::simulateInterrupt |
( |
bool |
level | ) |
|
Simulate an interrupt for testing purposes.
Directly calls the interrupt handler with the given level, bypassing actual GPIO hardware. Useful for Wokwi tests where direct GPIO manipulation doesn't trigger ISR.
- Parameters
-
| level | The level to report (true=HIGH, false=LOW) |
The documentation for this class was generated from the following files: