Speeduino
Loading...
Searching...
No Matches
port_pin.h
Go to the documentation of this file.
1#pragma once
2
3#include <Arduino.h>
4
5// Automatic type deduction
7 // These are used for automatic type detection *at compile time* and are never executed.
8
9 // Get the return type of a function call
10 template <typename R, typename... Args> R return_type_of(R(*)(Args...));
11
12 // portOutputRegister() and digitalPinToBitMask() on AVR is a GCC return expression, which needs to
13 // be wrapped in a function to be used in this context.
14 static inline auto detectPortRegisterType(void) { return portOutputRegister(digitalPinToPort(0)); };
15 static inline auto detectDigitalPinToBitMask(void) { return digitalPinToBitMask(0); };
16}
17
20
static uint32_t rshift(uint32_t a)
Bitwise right shift - generic, unoptimized, case.
Definition bit_shifts.h:348
Definition port_pin.h:6
static auto detectDigitalPinToBitMask(void)
Definition port_pin.h:15
R return_type_of(R(*)(Args...))
static auto detectPortRegisterType(void)
Definition port_pin.h:14
decltype(type_detection_detail::return_type_of(&type_detection_detail::detectPortRegisterType)) PORT_TYPE
The return type of a "call" to portOutputRegister()
Definition port_pin.h:19
decltype(type_detection_detail::return_type_of(&type_detection_detail::detectDigitalPinToBitMask)) PINMASK_TYPE
The return type of a "call" to digitalPinToBitMask()
Definition port_pin.h:22