ESPHome  2024.11.0
gpio.h
Go to the documentation of this file.
1 #pragma once
2 
3 #ifdef USE_ESP8266
4 
5 #include "esphome/core/hal.h"
6 #include <Arduino.h>
7 
8 namespace esphome {
9 namespace esp8266 {
10 
12  public:
13  void set_pin(uint8_t pin) { pin_ = pin; }
14  void set_inverted(bool inverted) { inverted_ = inverted; }
16 
17  void setup() override { pin_mode(flags_); }
18  void pin_mode(gpio::Flags flags) override;
19  bool digital_read() override;
20  void digital_write(bool value) override;
21  std::string dump_summary() const override;
22  void detach_interrupt() const override;
23  ISRInternalGPIOPin to_isr() const override;
24  uint8_t get_pin() const override { return pin_; }
25  bool is_inverted() const override { return inverted_; }
26 
27  protected:
28  void attach_interrupt(void (*func)(void *), void *arg, gpio::InterruptType type) const override;
29 
30  uint8_t pin_;
31  bool inverted_;
33 };
34 
35 } // namespace esp8266
36 } // namespace esphome
37 
38 #endif // USE_ESP8266
void set_flags(gpio::Flags flags)
Definition: gpio.h:15
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.cpp:84
void pin_mode(gpio::Flags flags) override
Definition: gpio.cpp:68
bool digital_read() override
Definition: gpio.cpp:78
void setup() override
Definition: gpio.h:17
uint8_t type
uint8_t get_pin() const override
Definition: gpio.h:24
ISRInternalGPIOPin to_isr() const override
Definition: gpio.cpp:39
const uint32_t flags
Definition: stm32flash.h:85
InterruptType
Definition: gpio.h:40
void digital_write(bool value) override
Definition: gpio.cpp:81
std::string dump_summary() const override
Definition: gpio.cpp:72
bool is_inverted() const override
Definition: gpio.h:25
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
void set_pin(uint8_t pin)
Definition: gpio.h:13
void set_inverted(bool inverted)
Definition: gpio.h:14
void attach_interrupt(void(*func)(void *), void *arg, gpio::InterruptType type) const override
Definition: gpio.cpp:46