96 pinModeBuffered(pin, mode);
97 updateBufferedOutputs();
117 digitalWriteBuffered(pin, state);
118 updateBufferedOutputs();
137 updateBufferedInputs();
138 return digitalReadBuffered(pin);
157 analogWriteBuffered(pin,
val);
158 updateBufferedOutputs();
177 updateBufferedInputs();
178 return analogReadBuffered(pin);
196 static void beginAll();
207 static void updateAllBufferedOutputs();
218 static void updateAllBufferedInputs();
250 pin_t getEnd()
const;
256 pin_t getStart()
const;
276 elementPin(element ? pin - element->getStart() : pin.pin) {}
282 if (element !=
nullptr)
283 return (element->*
func)(elementPin,
args...);
284 else if (elementPin != NO_PIN_INT)
287 return static_cast<FRet>(0);
298 &ExtendedIOElement::pinMode,
305 &ExtendedIOElement::digitalWrite,
311 return pin.apply(&ExtendedIOElement::digitalRead,
318 return pin.apply(&ExtendedIOElement::analogRead,
326 &ExtendedIOElement::analogWrite,
330 &ExtendedIOElement::analogWrite,
351 else if (dataPin.
element !=
nullptr && clockPin.
element !=
nullptr) {
378 &ExtendedIOElement::pinModeBuffered,
385 &ExtendedIOElement::digitalWriteBuffered,
391 return pin.apply(&ExtendedIOElement::digitalReadBuffered,
398 return pin.apply(&ExtendedIOElement::analogReadBuffered,
406 &ExtendedIOElement::analogWriteBuffered,
410 &ExtendedIOElement::analogWriteBuffered,
421using ExtIO::CachedExtIOPin;
#define BEGIN_AH_NAMESPACE
constexpr PinStatus_t LOW
AH::function_traits< decltype(::digitalWrite)>::argument_t< 1 > PinStatus_t
constexpr PinStatus_t HIGH
AH::function_traits< decltype(::pinMode)>::argument_t< 1 > PinMode_t
AH::function_traits< decltype(::digitalWrite)>::argument_t< 0 > ArduinoPin_t
An abstract base class for Extended Input/Output elements.
virtual void digitalWriteBuffered(pin_int_t pin, PinStatus_t state)=0
Set the output of a given pin in the software buffer.
ExtendedIOElement(ExtendedIOElement &&)=default
Move constructor.
virtual PinStatus_t digitalReadBuffered(pin_int_t pin)=0
Read the state of the given pin from the software buffer.
virtual void updateBufferedInputs()=0
Read the physical state into the input buffers.
ExtendedIOElement(const ExtendedIOElement &)=delete
Copying not allowed.
virtual void updateBufferedOutputs()=0
Write the internal state to the physical outputs.
virtual void digitalWrite(pin_int_t pin, PinStatus_t state)
Set the output of the given pin to the given state.
virtual void analogWriteBuffered(pin_int_t pin, analog_t val)=0
Write an analog (or PWM) value to the software buffer given pin.
virtual PinStatus_t digitalRead(pin_int_t pin)
Read the state of the given pin.
virtual void pinMode(pin_int_t pin, PinMode_t mode)
Set the mode of a given pin.
virtual void pinModeBuffered(pin_int_t pin, PinMode_t mode)=0
Set the mode of a given pin in the software buffer.
virtual void analogWrite(pin_int_t pin, analog_t val)
Write an analog (or PWM) value to the given pin.
virtual analog_t analogReadBuffered(pin_int_t pin)=0
Read the analog value of the given pin from the software buffer.
ExtendedIOElement & operator=(const ExtendedIOElement &)=delete
Copying not allowed.
virtual void begin()=0
Initialize the extended IO element.
ExtendedIOElement & operator=(ExtendedIOElement &&)=delete
Move assignment.
virtual analog_t analogRead(pin_int_t pin)
Read the analog value of the given pin.
A class for serial-in/parallel-out shift registers, like the 74HC595 that are connected to the SPI bu...
void digitalWrite(pin_int_t pin, PinStatus_t val) override
Set the state of a given output pin.
A super class for object that have to be updated regularly.
Array< decltype(F{}(U{})), N > apply(const Array< U, N > &src, F f)
Apply a function to all elements of the array and return a copy.
void analogWriteBuffered(pin_t pin, analog_t val)
A buffered ExtIO version of the Arduino function.
bool isNativePin(pin_t pin)
Check if the given pin number is a real Arduino pin number, and not an ExtIO pin number.
void pinModeBuffered(pin_t pin, PinMode_t mode)
A buffered ExtIO version of the Arduino function.
ExtendedIOElement * getIOElementOfPin(pin_t pin)
Find the IO element of a given extended IO pin number.
void digitalWriteBuffered(pin_t pin, PinStatus_t val)
A buffered ExtIO version of the Arduino function.
void analogWrite(pin_t pin, analog_t val)
An ExtIO version of the Arduino function.
void pinMode(pin_t pin, PinMode_t mode)
An ExtIO version of the Arduino function.
PinStatus_t digitalReadBuffered(pin_t pin)
A buffered ExtIO version of the Arduino function.
analog_t analogRead(pin_t pin)
An ExtIO version of the Arduino function.
analog_t analogReadBuffered(pin_t pin)
A buffered ExtIO version of the Arduino function.
PinStatus_t digitalRead(pin_t pin)
An ExtIO version of the Arduino function.
void shiftOut(pin_t dataPin, pin_t clockPin, BitOrder_t bitOrder, uint8_t val)
An ExtIO version of the Arduino function.
void digitalWrite(pin_t pin, PinStatus_t val)
An ExtIO version of the Arduino function.
uint16_t analog_t
The type returned from analogRead and similar functions.
constexpr ArduinoPin_t arduino_pin_cast(T t)
uint_fast16_t pin_int_t
Integer type used internally to store the index of (extended) GPIO pins.
ExtendedIOElement * element
CachedExtIOPin(pin_t pin)
Type for storing pin numbers of Extended Input/Output elements.