7namespace type_detection_detail {
11 template <
typename R,
typename... Args> R return_type_of(R(*)(Args...));
15 static inline auto detectPortRegisterType(
void) {
return portOutputRegister(digitalPinToPort(0)); };
16 static inline auto detectDigitalPinToBitMask(
void) {
return digitalPinToBitMask(0); };
31 return _port!=NULL_PORT;
61 using port_register_t =
decltype(type_detection_detail::return_type_of(&type_detection_detail::detectPortRegisterType));
64 using pin_mask_t =
decltype(type_detection_detail::return_type_of(&type_detection_detail::detectDigitalPinToBitMask));
66 static constexpr port_register_t NULL_PORT = {
nullptr};
68 port_register_t _port = NULL_PORT;
69 pin_mask_t _mask = {0};
A structure to support direct port manipulation.
Definition port_pin.h:23
bool isValid(void) const
Is the port register initialised?
Definition port_pin.h:30
void setPinHigh(void) noexcept
Set the pin high.
Definition port_pin.cpp:17
bool isPinHigh(void) const noexcept
Check if the pin is set high.
Definition port_pin.h:36
bool isPinLow(void) const noexcept
Check if the pin is set low.
Definition port_pin.h:48
void setPinLow(void) noexcept
Set the pin low.
Definition port_pin.cpp:29