Arduino Helpers master
Utility library for Arduino
ExtendedInputOutput.hpp
Go to the documentation of this file.
1/* ✔ */
2
3#pragma once
4
6#include <AH/STL/climits>
8
10
12
17namespace ExtIO {
18
21
24inline bool isNativePin(pin_t pin) {
25 return pin < NUM_DIGITAL_PINS + NUM_ANALOG_INPUTS;
26}
27
39
42void pinMode(pin_t pin, PinMode_t mode);
44void pinMode(int pin, PinMode_t mode);
47void digitalWrite(pin_t pin, PinStatus_t val);
49void digitalWrite(int pin, PinStatus_t val);
55
60analog_t analogRead(int pin);
63void analogWrite(pin_t pin, analog_t val);
66void analogWrite(pin_t pin, int val);
67#ifndef ESP32
69void analogWrite(int pin, analog_t val);
71void analogWrite(int pin, int val);
72#endif
73
75void shiftOut(pin_t dataPin, pin_t clockPin, BitOrder_t bitOrder, uint8_t val);
77void shiftOut(int dataPin, int clockPin, BitOrder_t bitOrder, uint8_t val);
78
81void pinModeBuffered(pin_t pin, PinMode_t mode);
88
97void analogWriteBuffered(pin_t pin, int val);
98
99#if UINT16_MAX != UINT_MAX
101void pinMode(unsigned int pin, PinMode_t mode);
103void digitalWrite(unsigned int pin, PinStatus_t val);
105PinStatus_t digitalRead(unsigned int pin);
106
108analog_t analogRead(unsigned int pin);
109#ifndef ESP32
111void analogWrite(unsigned int pin, analog_t val);
113void analogWrite(unsigned int pin, int val);
114#endif
115
117void shiftOut(unsigned int dataPin, unsigned int clockPin, BitOrder_t bitOrder,
118 uint8_t val);
119#endif
120
122
123} // namespace ExtIO
124
uint8_t BitOrder_t
AH::function_traits< decltype(::pinMode)>::argument_t< 1 > PinMode_t
AH::function_traits< decltype(::digitalWrite)>::argument_t< 1 > PinStatus_t
uint16_t analog_t
The type returned from analogRead and similar functions.
uint16_t pin_t
The type for Arduino pins (and ExtendedIOElement pins).
#define END_AH_NAMESPACE
#define BEGIN_AH_NAMESPACE
An abstract base class for Extended Input/Output elements.
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.
ExtendedIOElement * getIOElementOfPinOrNull(pin_t pin)
Find the IO element of a given extended IO pin number.
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.
A namespace with alternatives to the standard Arduino IO functions that can be used with extended IO ...