LCOV - code coverage report
Current view: top level - src/AH/Hardware - Arduino-Hardware-Types.hpp (source / functions) Hit Total Coverage
Test: ae75e8c9903d852740cfd410b15b056541c13218 Lines: 2 2 100.0 %
Date: 2022-05-28 15:38:22 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : 
      14             : #if defined(ARDUINO_API_VERSION)
      15             : 
      16             : using ArduinoPin_t = pin_size_t;
      17             : using PinStatus_t = PinStatus;
      18             : using PinMode_t = PinMode;
      19             : using BitOrder_t = BitOrder;
      20             : 
      21             : #else // ARDUINO_API_VERSION
      22             : 
      23             : using ArduinoPin_t =
      24             :     AH::function_traits<decltype(::digitalWrite)>::argument_t<0>;
      25             : using PinStatus_t =
      26             :     AH::function_traits<decltype(::digitalWrite)>::argument_t<1>;
      27             : using PinMode_t = AH::function_traits<decltype(::pinMode)>::argument_t<1>;
      28             : 
      29             : #if defined(ARDUINO_ARCH_SAM) || defined(ARDUINO_ARCH_SAMD)
      30             : using BitOrder_t = BitOrder;
      31             : #else
      32             : using BitOrder_t = uint8_t;
      33             : #endif
      34             : 
      35             : namespace AH_pin_detail {
      36             : constexpr static auto tmp_HIGH = HIGH;
      37             : constexpr static auto tmp_LOW = LOW;
      38             : constexpr static auto tmp_INPUT = INPUT;
      39             : constexpr static auto tmp_OUTPUT = OUTPUT;
      40             : constexpr 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
      62             : constexpr PinStatus_t HIGH = AH_pin_detail::tmp_HIGH;
      63             : constexpr PinStatus_t LOW = AH_pin_detail::tmp_LOW;
      64             : constexpr PinMode_t INPUT = AH_pin_detail::tmp_INPUT;
      65             : constexpr PinMode_t OUTPUT = AH_pin_detail::tmp_OUTPUT;
      66             : constexpr PinMode_t INPUT_PULLUP = AH_pin_detail::tmp_INPUT_PULLUP;
      67             : 
      68             : #endif // ARDUINO_API_VERSION
      69             : 
      70             : BEGIN_AH_NAMESPACE
      71             : template <class T>
      72          34 : inline ArduinoPin_t arduino_pin_cast(T t) {
      73          34 :     return static_cast<ArduinoPin_t>(t);
      74             : }
      75             : END_AH_NAMESPACE
      76             : 
      77             : AH_DIAGNOSTIC_POP()

Generated by: LCOV version 1.15