8#include "digital_pin.h"
12#if !defined(USE_ARDUINO) && __has_include(<Arduino.h>)
23#define FASTLED_INTERNAL
33class DigitalPinImpl :
public Referent {
35 DigitalPinImpl(
int DigitalPin) : mDigitalPin(DigitalPin) {}
36 ~DigitalPinImpl() =
default;
38 void setPinMode(DigitalPin::Mode mode) {
40 case DigitalPin::kInput:
41 ::pinMode(mDigitalPin, INPUT);
43 case DigitalPin::kOutput:
44 ::pinMode(mDigitalPin, OUTPUT);
48 bool high() {
return HIGH == ::digitalRead(mDigitalPin); }
49 void write(
bool value) { ::digitalWrite(mDigitalPin, value ? HIGH : LOW); }
61 void setPinMode(DigitalPin::Mode mode) {
63 case DigitalPin::kInput:
66 case DigitalPin::kOutput:
72 bool high() {
return mPin.
hival(); }
73 void write(
bool value) { value ? mPin.
hi(): mPin.
lo(); }
83DigitalPin::~DigitalPin() =
default;
84DigitalPin::DigitalPin(
const DigitalPin &other) =
default;
86DigitalPin& DigitalPin::operator=(
const DigitalPin &other) =
default;
88void DigitalPin::setPinMode(Mode mode) {
89 mImpl->setPinMode(mode);
92bool DigitalPin::high()
const {
96void DigitalPin::write(
bool is_high) {
97 mImpl->write(is_high);
central include file for FastLED, defines the CFastLED class/object
Naive fallback solution for low level pin access.
void setOutput()
Set the pin mode as OUTPUT
void setInput()
Set the pin mode as INPUT
void hi()
Set the pin state to HIGH
void lo()
Set the pin state to LOW
port_t hival()
Gets the state of the port with this pin HIGH
Class base definitions for defining fast pin access.
Implements the FastLED namespace macros.
Implements a simple red square effect for 2D LED grids.