Control Surface main
MIDI Control Surface library for Arduino
Loading...
Searching...
No Matches
Arduino-Hardware-Types.hpp
Go to the documentation of this file.
1#pragma once
2
5
6#include <AH/Arduino-Wrapper.h> // pin functions and constants
7#include <AH/STL/type_traits>
8
9#if defined(ARDUINO_API_VERSION)
10
11using ArduinoPin_t = pin_size_t;
12using PinStatus_t = PinStatus;
13using PinMode_t = PinMode;
14using BitOrder_t = BitOrder;
15
16#else // ARDUINO_API_VERSION
17
19 AH::function_traits<decltype(::digitalWrite)>::argument_t<0>;
21 AH::function_traits<decltype(::digitalWrite)>::argument_t<1>;
22using PinMode_t = AH::function_traits<decltype(::pinMode)>::argument_t<1>;
23
24#if defined(ARDUINO_ARCH_SAM) || defined(ARDUINO_ARCH_SAMD)
25using BitOrder_t = BitOrder;
26#else
27using BitOrder_t = uint8_t;
28#endif
29
30namespace AH_pin_detail {
31constexpr static auto tmp_HIGH = HIGH;
32constexpr static auto tmp_LOW = LOW;
33constexpr static auto tmp_INPUT = INPUT;
34constexpr static auto tmp_OUTPUT = OUTPUT;
35constexpr static auto tmp_INPUT_PULLUP = INPUT_PULLUP;
36} // namespace AH_pin_detail
37#ifdef HIGH
38#undef HIGH
39#define HIGH HIGH
40#endif
41#ifdef LOW
42#undef LOW
43#define LOW LOW
44#endif
45#ifdef INPUT
46#undef INPUT
47#define INPUT INPUT
48#endif
49#ifdef OUTPUT
50#undef OUTPUT
51#define OUTPUT OUTPUT
52#endif
53#ifdef INPUT_PULLUP
54#undef INPUT_PULLUP
55#define INPUT_PULLUP INPUT_PULLUP
56#endif
62
63#endif // ARDUINO_API_VERSION
64
66
67template <class T>
69 return static_cast<ArduinoPin_t>(t);
70}
71constexpr ArduinoPin_t arduino_pin_cast(pin_t t) { return t.pin; }
72#if (defined(NOT_AN_INTERRUPT) || defined(ARDUINO_API_VERSION)) && \
73 !defined(ARDUINO_ARCH_RENESAS)
74using not_an_interrupt_t = decltype(NOT_AN_INTERRUPT);
76using interrupt_t =
77 std::conditional<std::is_enum<not_an_interrupt_t>::value,
78 std::underlying_type<not_an_interrupt_t>,
79 type_identity<not_an_interrupt_t>>::type::type;
80#endif
81
#define END_AH_NAMESPACE
#define BEGIN_AH_NAMESPACE
constexpr PinStatus_t LOW
constexpr PinMode_t INPUT
AH::function_traits< decltype(::digitalWrite)>::argument_t< 1 > PinStatus_t
uint8_t BitOrder_t
constexpr PinStatus_t HIGH
AH::function_traits< decltype(::pinMode)>::argument_t< 1 > PinMode_t
constexpr PinMode_t INPUT_PULLUP
constexpr PinMode_t OUTPUT
AH::function_traits< decltype(::digitalWrite)>::argument_t< 0 > ArduinoPin_t
pin_t pin(pin_int_t pin) const
Get the extended IO pin number of a given physical pin of this extended IO element.
A class for serial-in/parallel-out shift registers, like the 74HC595 that are connected to the SPI bu...
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
constexpr ArduinoPin_t arduino_pin_cast(T t)
Type for storing pin numbers of Extended Input/Output elements.