Control Surface main
MIDI Control Surface library for Arduino
ExtendedInputOutput.hpp
Go to the documentation of this file.
1/* ✔ */
2
3#pragma once
4
6#include <AH/STL/climits>
9
10AH_DIAGNOSTIC_WERROR() // Enable errors on warnings
11
13
14class ExtendedIOElement;
15
20namespace ExtIO {
21
24
27inline bool isNativePin(pin_t pin) {
28 return pin < NUM_DIGITAL_PINS + NUM_ANALOG_INPUTS;
29}
30
42
45void pinMode(pin_t pin, PinMode_t mode);
47void pinMode(int pin, PinMode_t mode);
50void digitalWrite(pin_t pin, PinStatus_t val);
52void digitalWrite(int pin, PinStatus_t val);
58
63analog_t analogRead(int pin);
66void analogWrite(pin_t pin, analog_t val);
69void analogWrite(pin_t pin, int val);
70#ifndef ESP32
72void analogWrite(int pin, analog_t val);
74void analogWrite(int pin, int val);
75#endif
76
78void shiftOut(pin_t dataPin, pin_t clockPin, BitOrder_t bitOrder, uint8_t val);
80void shiftOut(int dataPin, int clockPin, BitOrder_t bitOrder, uint8_t val);
81
84void pinModeBuffered(pin_t pin, PinMode_t mode);
91
100void analogWriteBuffered(pin_t pin, int val);
101
102#if UINT16_MAX != UINT_MAX
104void pinMode(unsigned int pin, PinMode_t mode);
106void digitalWrite(unsigned int pin, PinStatus_t val);
108PinStatus_t digitalRead(unsigned int pin);
109
111analog_t analogRead(unsigned int pin);
112#ifndef ESP32
114void analogWrite(unsigned int pin, analog_t val);
116void analogWrite(unsigned int pin, int val);
117#endif
118
120void shiftOut(unsigned int dataPin, unsigned int clockPin, BitOrder_t bitOrder,
121 uint8_t val);
122#endif
123
125
126} // namespace ExtIO
127
129
#define END_AH_NAMESPACE
#define BEGIN_AH_NAMESPACE
uint8_t BitOrder_t
AH::function_traits< decltype(::pinMode)>::argument_t< 1 > PinMode_t
AH::function_traits< decltype(::digitalWrite)>::argument_t< 1 > PinStatus_t
#define AH_DIAGNOSTIC_POP()
Definition: Warnings.hpp:37
#define AH_DIAGNOSTIC_WERROR()
Definition: Warnings.hpp:36
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.
uint16_t analog_t
The type returned from analogRead and similar functions.
uint16_t pin_t
The type for Arduino pins (and ExtendedIOElement pins).