ESPHome  2022.6.3
gpio_idf.h
Go to the documentation of this file.
1 #pragma once
2 
3 #ifdef USE_ESP32_FRAMEWORK_ESP_IDF
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_FRAMEWORK_ESP_IDF
void set_pin(gpio_num_t pin)
Definition: gpio_idf.h:12
Copy of GPIOPin that is safe to use from ISRs (with no virtual functions)
Definition: gpio.h:66
void detach_interrupt() const override
Definition: gpio_idf.cpp:110
void set_flags(gpio::Flags flags)
Definition: gpio_idf.h:15
uint8_t flags
Definition: bedjet_base.h:134
uint8_t type
void digital_write(bool value) override
Definition: gpio_idf.cpp:109
gpio_drive_cap_t drive_strength_
Definition: gpio_idf.h:31
void pin_mode(gpio::Flags flags) override
Definition: gpio_idf.cpp:94
InterruptType
Definition: gpio.h:40
bool is_inverted() const override
Definition: gpio_idf.h:24
void set_inverted(bool inverted)
Definition: gpio_idf.h:13
void set_drive_strength(gpio_drive_cap_t drive_strength)
Definition: gpio_idf.h:14
Definition: a4988.cpp:4
ISRInternalGPIOPin to_isr() const override
Definition: gpio_idf.cpp:38
uint8_t get_pin() const override
Definition: gpio_idf.h:23
void attach_interrupt(void(*func)(void *), void *arg, gpio::InterruptType type) const override
Definition: gpio_idf.cpp:45
std::string dump_summary() const override
Definition: gpio_idf.cpp:77