Arduino Helpers
pin-t-adl
Utility library for Arduino
src
AH
Hardware
Arduino-Hardware-Types.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <
AH/Settings/Warnings.hpp
>
4
AH_DIAGNOSTIC_WERROR
()
// Enable errors on warnings
5
6
#include <AH/Hardware/Hardware-Types.hpp>
7
#include <
AH/Types/FunctionTraits.hpp
>
8
9
AH_DIAGNOSTIC_EXTERNAL_HEADER
()
10
#include <AH/Arduino-Wrapper.h>
// pin functions and constants
11
AH_DIAGNOSTIC_POP
()
12
13
#if defined(ARDUINO_API_VERSION)
14
15
using
ArduinoPin_t
= pin_size_t;
16
using
PinStatus_t
= PinStatus;
17
using
PinMode_t
= PinMode;
18
using
BitOrder_t
= BitOrder;
19
20
#else
// ARDUINO_API_VERSION
21
22
using
ArduinoPin_t
=
23
AH::function_traits<
decltype
(
::digitalWrite
)>::argument_t<0>;
24
using
PinStatus_t
=
25
AH::function_traits<
decltype
(
::digitalWrite
)>::argument_t<1>;
26
using
PinMode_t
= AH::function_traits<
decltype
(
::pinMode
)>::argument_t<1>;
27
28
#if defined(ARDUINO_ARCH_SAM) || defined(ARDUINO_ARCH_SAMD)
29
using
BitOrder_t
= BitOrder;
30
#else
31
using
BitOrder_t
= uint8_t;
32
#endif
33
34
namespace
AH_pin_detail
{
35
constexpr
static
auto
tmp_HIGH
=
HIGH
;
36
constexpr
static
auto
tmp_LOW
=
LOW
;
37
constexpr
static
auto
tmp_INPUT
=
INPUT
;
38
constexpr
static
auto
tmp_OUTPUT
=
OUTPUT
;
39
constexpr
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
61
constexpr
PinStatus_t
HIGH
=
AH_pin_detail::tmp_HIGH
;
62
constexpr
PinStatus_t
LOW
=
AH_pin_detail::tmp_LOW
;
63
constexpr
PinMode_t
INPUT
=
AH_pin_detail::tmp_INPUT
;
64
constexpr
PinMode_t
OUTPUT
=
AH_pin_detail::tmp_OUTPUT
;
65
constexpr
PinMode_t
INPUT_PULLUP
=
AH_pin_detail::tmp_INPUT_PULLUP
;
66
67
#endif
// ARDUINO_API_VERSION
68
69
BEGIN_AH_NAMESPACE
70
template
<
class
T>
71
inline
ArduinoPin_t
arduino_pin_cast
(T t) {
72
return
static_cast<
ArduinoPin_t
>
(t);
73
}
74
inline
ArduinoPin_t
arduino_pin_cast
(
pin_t
t) {
return
t.
pin
; }
75
END_AH_NAMESPACE
76
77
AH_DIAGNOSTIC_POP
()
LOW
constexpr PinStatus_t LOW
Definition:
Arduino-Hardware-Types.hpp:62
ArduinoPin_t
AH::function_traits< decltype(::digitalWrite)>::argument_t< 0 > ArduinoPin_t
Definition:
Arduino-Hardware-Types.hpp:23
INPUT
constexpr PinMode_t INPUT
Definition:
Arduino-Hardware-Types.hpp:63
BitOrder_t
uint8_t BitOrder_t
Definition:
Arduino-Hardware-Types.hpp:31
HIGH
constexpr PinStatus_t HIGH
Definition:
Arduino-Hardware-Types.hpp:61
PinMode_t
AH::function_traits< decltype(::pinMode)>::argument_t< 1 > PinMode_t
Definition:
Arduino-Hardware-Types.hpp:26
PinStatus_t
AH::function_traits< decltype(::digitalWrite)>::argument_t< 1 > PinStatus_t
Definition:
Arduino-Hardware-Types.hpp:25
INPUT_PULLUP
constexpr PinMode_t INPUT_PULLUP
Definition:
Arduino-Hardware-Types.hpp:65
OUTPUT
constexpr PinMode_t OUTPUT
Definition:
Arduino-Hardware-Types.hpp:64
arduino_pin_cast
ArduinoPin_t arduino_pin_cast(T t)
Definition:
Arduino-Hardware-Types.hpp:71
FunctionTraits.hpp
END_AH_NAMESPACE
#define END_AH_NAMESPACE
Definition:
NamespaceSettings.hpp:10
BEGIN_AH_NAMESPACE
#define BEGIN_AH_NAMESPACE
Definition:
NamespaceSettings.hpp:9
Warnings.hpp
AH_DIAGNOSTIC_EXTERNAL_HEADER
#define AH_DIAGNOSTIC_EXTERNAL_HEADER()
Definition:
Warnings.hpp:37
AH_DIAGNOSTIC_POP
#define AH_DIAGNOSTIC_POP()
Definition:
Warnings.hpp:36
AH_DIAGNOSTIC_WERROR
#define AH_DIAGNOSTIC_WERROR()
Definition:
Warnings.hpp:35
ExtIO::pinMode
void pinMode(pin_t pin, PinMode_t mode)
An ExtIO version of the Arduino function.
Definition:
ExtendedInputOutput.cpp:35
ExtIO::digitalWrite
void digitalWrite(pin_t pin, PinStatus_t val)
An ExtIO version of the Arduino function.
Definition:
ExtendedInputOutput.cpp:46
AH_pin_detail
Definition:
Arduino-Hardware-Types.hpp:34
AH_pin_detail::tmp_INPUT
static constexpr auto tmp_INPUT
Definition:
Arduino-Hardware-Types.hpp:37
AH_pin_detail::tmp_HIGH
static constexpr auto tmp_HIGH
Definition:
Arduino-Hardware-Types.hpp:35
AH_pin_detail::tmp_OUTPUT
static constexpr auto tmp_OUTPUT
Definition:
Arduino-Hardware-Types.hpp:38
AH_pin_detail::tmp_LOW
static constexpr auto tmp_LOW
Definition:
Arduino-Hardware-Types.hpp:36
AH_pin_detail::tmp_INPUT_PULLUP
static constexpr auto tmp_INPUT_PULLUP
Definition:
Arduino-Hardware-Types.hpp:39
ExtIO::pin_t
Type for storing pin numbers of Extended Input/Output elements.
Definition:
Hardware-Types.hpp:21
ExtIO::pin_t::pin
uint16_t pin
The actual underlying pin number.
Definition:
Hardware-Types.hpp:28
Generated by
1.9.4