35#ifndef _DRIVERS_ARDUINOGPIO_HXX_
36#define _DRIVERS_ARDUINOGPIO_HXX_
42#include <driver/gpio.h>
61 pinMode(PIN_NUM, OUTPUT);
67 pinMode(PIN_NUM, INPUT);
73 digitalWrite(PIN_NUM, HIGH);
79 digitalWrite(PIN_NUM, LOW);
85 digitalWrite(PIN_NUM, HIGH);
91 digitalWrite(PIN_NUM, LOW);
97 return digitalRead(PIN_NUM);
101 static void set(
bool value)
123 if(digitalPinIsValid(PIN_NUM) && digitalPinCanOutput(PIN_NUM))
128 return GPIO.enable_w1ts & ((uint32_t)1 << (PIN_NUM & 31));
132 return GPIO.enable1_w1ts.val & ((uint32_t)1 << (PIN_NUM & 31));
147template <
class Base,
bool SAFE_VALUE,
bool INVERT = false>
154 Base::set(SAFE_VALUE);
156 Base::set(SAFE_VALUE);
161 Base::set(SAFE_VALUE);
165 static void set(
bool value)
225 Base::set_pullup_on();
229 Base::set_pullup_off();
269#define GPIO_PIN(NAME, BaseClass, NUM) \
270 typedef BaseClass<ArduinoStaticGpio<NUM>> NAME##_Pin
Defines a GPIO output pin.
static constexpr const Gpio * instance()
static void set(bool value)
Set output pin level.
static void set_on()
Sets output to HIGH.
static void set_input()
Sets pin to input.
static void set_output()
Sets pin to output.
static void set_off()
Sets output to LOW.
static void set_pullup_off()
Turns off pullup.
static void set_pullup_on()
Turns on pullup.
static void toggle()
Toggles output pin value.
Creates an implementation of an os-independent Gpio object from a hardware-specific static Gpio struc...
OS-independent abstraction for GPIO.
Parametric GPIO output class.
static void hw_init()
Initializes the hardware pin.
static void set(bool value)
Sets the output pinm.
static void hw_set_to_safe()
Sets the hardware pin to a safe value.
Defines a GPIO output pin, initialized to be an output pin with high level.
Defines a GPIO output pin, initialized to be an output pin with high level.
Defines a GPIO output pin, initialized to be an output pin with low level.
Defines a GPIO output pin, initialized to be an output pin with low level.