mirror of
https://github.com/esphome/esphome.git
synced 2026-06-24 11:25:35 +00:00
Add the C++ `final` specifier to leaf, user-configurable component classes and automation action/trigger/condition primitives so that classes meant to be terminal cannot be subclassed by external components. Only classes never used as a base anywhere in the tree are marked. Part 14 of 21, split alphabetically by component (rc522_i2c .. scd4x).
38 lines
1.0 KiB
C++
38 lines
1.0 KiB
C++
#pragma once
|
|
|
|
#ifdef USE_RP2040
|
|
|
|
#include <Arduino.h>
|
|
#include "esphome/core/hal.h"
|
|
|
|
namespace esphome::rp2040 {
|
|
|
|
class RP2040GPIOPin final : public InternalGPIOPin {
|
|
public:
|
|
void set_pin(uint8_t pin) { pin_ = pin; }
|
|
void set_inverted(bool inverted) { inverted_ = inverted; }
|
|
void set_flags(gpio::Flags flags) { flags_ = flags; }
|
|
|
|
void setup() override { pin_mode(flags_); }
|
|
void pin_mode(gpio::Flags flags) override;
|
|
bool digital_read() override;
|
|
void digital_write(bool value) override;
|
|
size_t dump_summary(char *buffer, size_t len) const override;
|
|
void detach_interrupt() const override;
|
|
ISRInternalGPIOPin to_isr() const override;
|
|
uint8_t get_pin() const override { return pin_; }
|
|
gpio::Flags get_flags() const override { return flags_; }
|
|
bool is_inverted() const override { return inverted_; }
|
|
|
|
protected:
|
|
void attach_interrupt(void (*func)(void *), void *arg, gpio::InterruptType type) const override;
|
|
|
|
uint8_t pin_;
|
|
bool inverted_{};
|
|
gpio::Flags flags_{};
|
|
};
|
|
|
|
} // namespace esphome::rp2040
|
|
|
|
#endif // USE_RP2040
|