LCOV - code coverage report
Current view: top level - src/AH/Hardware/ExtendedInputOutput - ExtendedInputOutput.hpp (source / functions) Hit Total Coverage
Test: bf14c9fae556d77e8c4ecd719832b25959f10ebc Lines: 2 2 100.0 %
Date: 2022-05-29 00:36:34 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* ✔ */
       2             : 
       3             : #pragma once
       4             : 
       5             : #include <AH/Hardware/Arduino-Hardware-Types.hpp>
       6             : #include <AH/STL/climits>
       7             : #include <AH/Settings/NamespaceSettings.hpp>
       8             : #include <AH/Settings/Warnings.hpp>
       9             : 
      10             : AH_DIAGNOSTIC_WERROR() // Enable errors on warnings
      11             : 
      12             : BEGIN_AH_NAMESPACE
      13             : 
      14             : class ExtendedIOElement;
      15             : 
      16             : /**
      17             :  * @brief   A namespace with alternatives to the standard Arduino IO functions
      18             :  *          that can be used with extended IO pin numbers.
      19             :  */
      20             : namespace ExtIO {
      21             : 
      22             : /// @addtogroup AH_ExtIO
      23             : /// @{
      24             : 
      25             : /// Check if the given pin number is a real Arduino pin number, and not an ExtIO
      26             : /// pin number.
      27         408 : inline bool isNativePin(pin_t pin) {
      28         408 :     return pin.pin < NUM_DIGITAL_PINS + NUM_ANALOG_INPUTS;
      29             : }
      30             : 
      31             : /**
      32             :  * @brief   Find the IO element of a given extended IO pin number. 
      33             :  * 
      34             :  * @param   pin
      35             :  *          The extended IO pin number to find the IO element of.
      36             :  * @return  A pointer to the extended IO element that the given pin belongs to.
      37             :  */
      38             : ExtendedIOElement *getIOElementOfPinOrNull(pin_t pin);
      39             : /// @copydoc getIOElementOfPinOrNull
      40             : /// Throws an error if the element was not found.
      41             : ExtendedIOElement *getIOElementOfPin(pin_t pin);
      42             : 
      43             : /// An ExtIO version of the Arduino function
      44             : /// @see    ExtendedIOElement::pinMode
      45             : void pinMode(pin_t pin, PinMode_t mode);
      46             : /// An ExtIO version of the Arduino function
      47             : /// @see    ExtendedIOElement::digitalWrite
      48             : void digitalWrite(pin_t pin, PinStatus_t val);
      49             : /// An ExtIO version of the Arduino function
      50             : /// @see    ExtendedIOElement::digitalRead
      51             : PinStatus_t digitalRead(pin_t pin);
      52             : 
      53             : /// An ExtIO version of the Arduino function
      54             : /// @see    ExtendedIOElement::analogRead
      55             : analog_t analogRead(pin_t pin);
      56             : /// An ExtIO version of the Arduino function
      57             : /// @see    ExtendedIOElement::analogWrite
      58             : void analogWrite(pin_t pin, analog_t val);
      59             : /// An ExtIO version of the Arduino function
      60             : /// @see    ExtendedIOElement::analogWrite
      61             : void analogWrite(pin_t pin, int val);
      62             : 
      63             : /// An ExtIO version of the Arduino function
      64             : void shiftOut(pin_t dataPin, pin_t clockPin, BitOrder_t bitOrder, uint8_t val);
      65             : 
      66             : /// A buffered ExtIO version of the Arduino function
      67             : /// @see   ExtendedIOElement::pinModeBuffered
      68             : void pinModeBuffered(pin_t pin, PinMode_t mode);
      69             : /// A buffered ExtIO version of the Arduino function
      70             : /// @see   ExtendedIOElement::digitalWriteBuffered
      71             : void digitalWriteBuffered(pin_t pin, PinStatus_t val);
      72             : /// A buffered ExtIO version of the Arduino function
      73             : /// @see   ExtendedIOElement::digitalReadBuffered
      74             : PinStatus_t digitalReadBuffered(pin_t pin);
      75             : 
      76             : /// A buffered ExtIO version of the Arduino function
      77             : /// @see   ExtendedIOElement::analogReadBuffered
      78             : analog_t analogReadBuffered(pin_t pin);
      79             : /// A buffered ExtIO version of the Arduino function
      80             : /// @see   ExtendedIOElement::analogWriteBuffered
      81             : void analogWriteBuffered(pin_t pin, analog_t val);
      82             : /// A buffered ExtIO version of the Arduino function
      83             : /// @see   ExtendedIOElement::analogWriteBuffered
      84             : void analogWriteBuffered(pin_t pin, int val);
      85             : 
      86             : /// @}
      87             : 
      88             : } // namespace ExtIO
      89             : 
      90             : END_AH_NAMESPACE
      91             : 
      92             : AH_DIAGNOSTIC_POP()

Generated by: LCOV version 1.15