Control Surface pin-t-adl
MIDI Control Surface library for Arduino
Arduino-Hardware-Types.hpp
Go to the documentation of this file.
1#pragma once
2
4AH_DIAGNOSTIC_WERROR() // Enable errors on warnings
5
6#include <AH/Hardware/Hardware-Types.hpp>
8
10#include <AH/Arduino-Wrapper.h> // pin functions and constants
12
13#if defined(ARDUINO_API_VERSION)
14
15using ArduinoPin_t = pin_size_t;
16using PinStatus_t = PinStatus;
17using PinMode_t = PinMode;
18using BitOrder_t = BitOrder;
19
20#else // ARDUINO_API_VERSION
21
23 AH::function_traits<decltype(::digitalWrite)>::argument_t<0>;
25 AH::function_traits<decltype(::digitalWrite)>::argument_t<1>;
26using PinMode_t = AH::function_traits<decltype(::pinMode)>::argument_t<1>;
27
28#if defined(ARDUINO_ARCH_SAM) || defined(ARDUINO_ARCH_SAMD)
29using BitOrder_t = BitOrder;
30#else
31using BitOrder_t = uint8_t;
32#endif
33
34namespace AH_pin_detail {
35constexpr static auto tmp_HIGH = HIGH;
36constexpr static auto tmp_LOW = LOW;
37constexpr static auto tmp_INPUT = INPUT;
38constexpr static auto tmp_OUTPUT = OUTPUT;
39constexpr static auto tmp_INPUT_PULLUP = INPUT_PULLUP;
40} // namespace AH_pin_detail
41#ifdef HIGH
42#undef HIGH
43#define HIGH HIGH
44#endif
45#ifdef LOW
46#undef LOW
47#define LOW LOW
48#endif
49#ifdef INPUT
50#undef INPUT
51#define INPUT INPUT
52#endif
53#ifdef OUTPUT
54#undef OUTPUT
55#define OUTPUT OUTPUT
56#endif
57#ifdef INPUT_PULLUP
58#undef INPUT_PULLUP
59#define INPUT_PULLUP INPUT_PULLUP
60#endif
66
67#endif // ARDUINO_API_VERSION
68
70template <class T>
72 return static_cast<ArduinoPin_t>(t);
73}
74inline ArduinoPin_t arduino_pin_cast(pin_t t) { return t.pin; }
76
#define END_AH_NAMESPACE
#define BEGIN_AH_NAMESPACE
constexpr PinStatus_t LOW
AH::function_traits< decltype(::digitalWrite)>::argument_t< 0 > ArduinoPin_t
constexpr PinMode_t INPUT
uint8_t BitOrder_t
constexpr PinStatus_t HIGH
AH::function_traits< decltype(::pinMode)>::argument_t< 1 > PinMode_t
AH::function_traits< decltype(::digitalWrite)>::argument_t< 1 > PinStatus_t
constexpr PinMode_t INPUT_PULLUP
constexpr PinMode_t OUTPUT
#define AH_DIAGNOSTIC_EXTERNAL_HEADER()
Definition: Warnings.hpp:37
#define AH_DIAGNOSTIC_POP()
Definition: Warnings.hpp:36
#define AH_DIAGNOSTIC_WERROR()
Definition: Warnings.hpp:35
void pinMode(pin_t pin, PinMode_t mode)
An ExtIO version of the Arduino function.
void digitalWrite(pin_t pin, PinStatus_t val)
An ExtIO version of the Arduino function.
static constexpr auto tmp_INPUT
static constexpr auto tmp_HIGH
static constexpr auto tmp_OUTPUT
static constexpr auto tmp_LOW
static constexpr auto tmp_INPUT_PULLUP
ArduinoPin_t arduino_pin_cast(pin_t t)
Type for storing pin numbers of Extended Input/Output elements.
uint16_t pin
The actual underlying pin number.