ESPHome  2024.10.2
gpio.h
Go to the documentation of this file.
1 #pragma once
2 
3 #ifdef USE_ESP32
4 #include "esphome/core/hal.h"
5 #include <driver/gpio.h>
6 
7 namespace esphome {
8 namespace esp32 {
9 
11  public:
12  void set_pin(gpio_num_t pin) { pin_ = pin; }
13  void set_inverted(bool inverted) { inverted_ = inverted; }
14  void set_drive_strength(gpio_drive_cap_t drive_strength) { drive_strength_ = drive_strength; }
16  void setup() override;
17  void pin_mode(gpio::Flags flags) override;
18  bool digital_read() override;
19  void digital_write(bool value) override;
20  std::string dump_summary() const override;
21  void detach_interrupt() const override;
22  ISRInternalGPIOPin to_isr() const override;
23  uint8_t get_pin() const override { return (uint8_t) pin_; }
24  bool is_inverted() const override { return inverted_; }
25 
26  protected:
27  void attach_interrupt(void (*func)(void *), void *arg, gpio::InterruptType type) const override;
28 
29  gpio_num_t pin_;
30  bool inverted_;
31  gpio_drive_cap_t drive_strength_;
33  // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
34  static bool isr_service_installed;
35 };
36 
37 } // namespace esp32
38 } // namespace esphome
39 
40 #endif // USE_ESP32
ISRInternalGPIOPin to_isr() const override
Definition: gpio.cpp:37
Copy of GPIOPin that is safe to use from ISRs (with no virtual functions)
Definition: gpio.h:66
bool is_inverted() const override
Definition: gpio.h:24
void set_pin(gpio_num_t pin)
Definition: gpio.h:12
void detach_interrupt() const override
Definition: gpio.cpp:111
gpio_drive_cap_t drive_strength_
Definition: gpio.h:31
void set_flags(gpio::Flags flags)
Definition: gpio.h:15
void digital_write(bool value) override
Definition: gpio.cpp:110
uint8_t type
void set_drive_strength(gpio_drive_cap_t drive_strength)
Definition: gpio.h:14
void pin_mode(gpio::Flags flags) override
Definition: gpio.cpp:95
uint8_t get_pin() const override
Definition: gpio.h:23
const uint32_t flags
Definition: stm32flash.h:85
InterruptType
Definition: gpio.h:40
void attach_interrupt(void(*func)(void *), void *arg, gpio::InterruptType type) const override
Definition: gpio.cpp:44
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
void set_inverted(bool inverted)
Definition: gpio.h:13
std::string dump_summary() const override
Definition: gpio.cpp:76