Arduino Filters master
Filter 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
14#if defined(ARDUINO_API_VERSION)
15
16using ArduinoPin_t = pin_size_t;
17using PinStatus_t = PinStatus;
18using PinMode_t = PinMode;
19using BitOrder_t = BitOrder;
20
21#else // ARDUINO_API_VERSION
22
24 AH::function_traits<decltype(::digitalWrite)>::argument_t<0>;
26 AH::function_traits<decltype(::digitalWrite)>::argument_t<1>;
27using PinMode_t = AH::function_traits<decltype(::pinMode)>::argument_t<1>;
28
29#if defined(ARDUINO_ARCH_SAM) || defined(ARDUINO_ARCH_SAMD)
30using BitOrder_t = BitOrder;
31#else
32using BitOrder_t = uint8_t;
33#endif
34
35namespace AH_pin_detail {
36constexpr static auto tmp_HIGH = HIGH;
37constexpr static auto tmp_LOW = LOW;
38constexpr static auto tmp_INPUT = INPUT;
39constexpr static auto tmp_OUTPUT = OUTPUT;
40constexpr static auto tmp_INPUT_PULLUP = INPUT_PULLUP;
41} // namespace AH_pin_detail
42#ifdef HIGH
43#undef HIGH
44#define HIGH HIGH
45#endif
46#ifdef LOW
47#undef LOW
48#define LOW LOW
49#endif
50#ifdef INPUT
51#undef INPUT
52#define INPUT INPUT
53#endif
54#ifdef OUTPUT
55#undef OUTPUT
56#define OUTPUT OUTPUT
57#endif
58#ifdef INPUT_PULLUP
59#undef INPUT_PULLUP
60#define INPUT_PULLUP INPUT_PULLUP
61#endif
67
68#endif // ARDUINO_API_VERSION
69
71template <class T>
73 return static_cast<ArduinoPin_t>(t);
74}
76
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
#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