mirror of
https://github.com/esphome/esphome.git
synced 2024-12-02 03:34:18 +01:00
a9630ac847
Co-authored-by: Kuba Szczodrzyński <kuba@szczodrzynski.pl> Co-authored-by: Sam Neirinck <git@samneirinck.com> Co-authored-by: David Buezas <dbuezas@users.noreply.github.com> Co-authored-by: Stroe Andrei Catalin <catalin2402@gmail.com> Co-authored-by: Sam Neirinck <github@samneirinck.be> Co-authored-by: Péter Sárközi <xmisterhu@gmail.com> Co-authored-by: Hajo Noerenberg <hn@users.noreply.github.com>
36 lines
994 B
C++
36 lines
994 B
C++
#pragma once
|
|
|
|
#ifdef USE_LIBRETINY
|
|
#include "esphome/core/hal.h"
|
|
|
|
namespace esphome {
|
|
namespace libretiny {
|
|
|
|
class ArduinoInternalGPIOPin : 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;
|
|
std::string dump_summary() const override;
|
|
void detach_interrupt() const override;
|
|
ISRInternalGPIOPin to_isr() const override;
|
|
uint8_t get_pin() const override { return pin_; }
|
|
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 libretiny
|
|
} // namespace esphome
|
|
|
|
#endif // USE_LIBRETINY
|