LCOV - code coverage report
Current view: top level - src/AH/Hardware - Arduino-Hardware-Types.hpp (source / functions) Hit Total Coverage
Test: ffed98f648fe78e7aa7bdd228474317d40dadbec Lines: 3 3 100.0 %
Date: 2022-05-28 15:22:59 Functions: 3 3 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             : #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          16 : inline ArduinoPin_t arduino_pin_cast(T t) {
      72          16 :     return static_cast<ArduinoPin_t>(t);
      73             : }
      74         790 : inline ArduinoPin_t arduino_pin_cast(pin_t t) { return t.pin; }
      75             : END_AH_NAMESPACE
      76             : 
      77             : AH_DIAGNOSTIC_POP()

Generated by: LCOV version 1.15