ESPHome  2024.10.2
gpio.h
Go to the documentation of this file.
1 #pragma once
2 
3 #ifdef USE_RP2040
4 
5 #include <Arduino.h>
6 #include "esphome/core/hal.h"
7 
8 namespace esphome {
9 namespace rp2040 {
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 rp2040
36 } // namespace esphome
37 
38 #endif // USE_RP2040
Copy of GPIOPin that is safe to use from ISRs (with no virtual functions)
Definition: gpio.h:66
bool digital_read() override
Definition: gpio.cpp:71
void digital_write(bool value) override
Definition: gpio.cpp:74
void pin_mode(gpio::Flags flags) override
Definition: gpio.cpp:61
void set_inverted(bool inverted)
Definition: gpio.h:14
ISRInternalGPIOPin to_isr() const override
Definition: gpio.cpp:32
bool is_inverted() const override
Definition: gpio.h:25
void set_flags(gpio::Flags flags)
Definition: gpio.h:15
uint8_t type
const uint32_t flags
Definition: stm32flash.h:85
uint8_t get_pin() const override
Definition: gpio.h:24
void attach_interrupt(void(*func)(void *), void *arg, gpio::InterruptType type) const override
Definition: gpio.cpp:39
InterruptType
Definition: gpio.h:40
void set_pin(uint8_t pin)
Definition: gpio.h:13
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
std::string dump_summary() const override
Definition: gpio.cpp:65
void setup() override
Definition: gpio.h:17
void detach_interrupt() const override
Definition: gpio.cpp:77