ESPHome  2024.12.2
gpio.h
Go to the documentation of this file.
1 #pragma once
2 
3 #ifdef USE_HOST
4 
5 #include "esphome/core/hal.h"
6 
7 namespace esphome {
8 namespace host {
9 
10 class HostGPIOPin : public InternalGPIOPin {
11  public:
12  void set_pin(uint8_t pin) { pin_ = pin; }
13  void set_inverted(bool inverted) { inverted_ = inverted; }
15 
16  void setup() override { pin_mode(flags_); }
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 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  uint8_t pin_;
30  bool inverted_;
32 };
33 
34 } // namespace host
35 } // namespace esphome
36 
37 #endif // USE_HOST
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:39
void set_pin(uint8_t pin)
Definition: gpio.h:12
uint8_t get_pin() const override
Definition: gpio.h:23
std::string dump_summary() const override
Definition: gpio.cpp:28
void digital_write(bool value) override
Definition: gpio.cpp:35
bool digital_read() override
Definition: gpio.cpp:34
uint8_t type
void pin_mode(gpio::Flags flags) override
Definition: gpio.cpp:26
const uint32_t flags
Definition: stm32flash.h:85
void attach_interrupt(void(*func)(void *), void *arg, gpio::InterruptType type) const override
Definition: gpio.cpp:23
void set_inverted(bool inverted)
Definition: gpio.h:13
InterruptType
Definition: gpio.h:40
void set_flags(gpio::Flags flags)
Definition: gpio.h:14
void setup() override
Definition: gpio.h:16
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
ISRInternalGPIOPin to_isr() const override
Definition: gpio.cpp:16
bool is_inverted() const override
Definition: gpio.h:24
gpio::Flags flags_
Definition: gpio.h:31