LCOV - code coverage report
Current view: top level - src/AH/Hardware - Arduino-Hardware-Types.hpp (source / functions) Hit Total Coverage
Test: 00f463b534fbea22f0b596e091a60715679e3064 Lines: 2 2 100.0 %
Date: 2024-11-03 16:33:35 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include <AH/Hardware/Hardware-Types.hpp>
       4             : #include <AH/Types/FunctionTraits.hpp>
       5             : 
       6             : #include <AH/Arduino-Wrapper.h> // pin functions and constants
       7             : 
       8             : #if defined(ARDUINO_API_VERSION)
       9             : 
      10             : using ArduinoPin_t = pin_size_t;
      11             : using PinStatus_t = PinStatus;
      12             : using PinMode_t = PinMode;
      13             : using BitOrder_t = BitOrder;
      14             : 
      15             : #else // ARDUINO_API_VERSION
      16             : 
      17             : using ArduinoPin_t =
      18             :     AH::function_traits<decltype(::digitalWrite)>::argument_t<0>;
      19             : using PinStatus_t =
      20             :     AH::function_traits<decltype(::digitalWrite)>::argument_t<1>;
      21             : using PinMode_t = AH::function_traits<decltype(::pinMode)>::argument_t<1>;
      22             : 
      23             : #if defined(ARDUINO_ARCH_SAM) || defined(ARDUINO_ARCH_SAMD)
      24             : using BitOrder_t = BitOrder;
      25             : #else
      26             : using BitOrder_t = uint8_t;
      27             : #endif
      28             : 
      29             : namespace AH_pin_detail {
      30             : constexpr static auto tmp_HIGH = HIGH;
      31             : constexpr static auto tmp_LOW = LOW;
      32             : constexpr static auto tmp_INPUT = INPUT;
      33             : constexpr static auto tmp_OUTPUT = OUTPUT;
      34             : constexpr 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
      56             : constexpr PinStatus_t HIGH = AH_pin_detail::tmp_HIGH;
      57             : constexpr PinStatus_t LOW = AH_pin_detail::tmp_LOW;
      58             : constexpr PinMode_t INPUT = AH_pin_detail::tmp_INPUT;
      59             : constexpr PinMode_t OUTPUT = AH_pin_detail::tmp_OUTPUT;
      60             : constexpr PinMode_t INPUT_PULLUP = AH_pin_detail::tmp_INPUT_PULLUP;
      61             : 
      62             : #endif // ARDUINO_API_VERSION
      63             : 
      64             : BEGIN_AH_NAMESPACE
      65             : template <class T>
      66          34 : inline ArduinoPin_t arduino_pin_cast(T t) {
      67          34 :     return static_cast<ArduinoPin_t>(t);
      68             : }
      69             : END_AH_NAMESPACE

Generated by: LCOV version 1.15