Arduino Helpers master
Utility library for Arduino
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
8#if defined(ARDUINO_API_VERSION)
9
10using ArduinoPin_t = pin_size_t;
11using PinStatus_t = PinStatus;
12using PinMode_t = PinMode;
13using BitOrder_t = BitOrder;
14
15#else // ARDUINO_API_VERSION
16
18 AH::function_traits<decltype(::digitalWrite)>::argument_t<0>;
20 AH::function_traits<decltype(::digitalWrite)>::argument_t<1>;
21using PinMode_t = AH::function_traits<decltype(::pinMode)>::argument_t<1>;
22
23#if defined(ARDUINO_ARCH_SAM) || defined(ARDUINO_ARCH_SAMD)
24using BitOrder_t = BitOrder;
25#else
26using BitOrder_t = uint8_t;
27#endif
28
29namespace AH_pin_detail {
30constexpr static auto tmp_HIGH = HIGH;
31constexpr static auto tmp_LOW = LOW;
32constexpr static auto tmp_INPUT = INPUT;
33constexpr static auto tmp_OUTPUT = OUTPUT;
34constexpr static auto tmp_INPUT_PULLUP = INPUT_PULLUP;
35} // namespace AH_pin_detail
36#ifdef HIGH
37#undef HIGH
38#define HIGH HIGH
39#endif
40#ifdef LOW
41#undef LOW
42#define LOW LOW
43#endif
44#ifdef INPUT
45#undef INPUT
46#define INPUT INPUT
47#endif
48#ifdef OUTPUT
49#undef OUTPUT
50#define OUTPUT OUTPUT
51#endif
52#ifdef INPUT_PULLUP
53#undef INPUT_PULLUP
54#define INPUT_PULLUP INPUT_PULLUP
55#endif
61
62#endif // ARDUINO_API_VERSION
63
65template <class T>
67 return static_cast<ArduinoPin_t>(t);
68}
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
ArduinoPin_t arduino_pin_cast(T t)
#define END_AH_NAMESPACE
#define BEGIN_AH_NAMESPACE
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