LCOV - code coverage report
Current view: top level - src/AH/Hardware/ExtendedInputOutput - ExtendedInputOutput.hpp (source / functions) Hit Total Coverage
Test: 169c36a3797bc662d84b5726f34a3f37d3c58247 Lines: 2 2 100.0 %
Date: 2024-11-09 15:32:27 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             : 
       9             : BEGIN_AH_NAMESPACE
      10             : 
      11             : class ExtendedIOElement;
      12             : 
      13             : /**
      14             :  * @brief   A namespace with alternatives to the standard Arduino IO functions
      15             :  *          that can be used with extended IO pin numbers.
      16             :  */
      17             : namespace ExtIO {
      18             : 
      19             : /// @addtogroup AH_ExtIO
      20             : /// @{
      21             : 
      22             : /// Check if the given pin number is a real Arduino pin number, and not an ExtIO
      23             : /// pin number.
      24         849 : inline bool isNativePin(pin_t pin) {
      25         849 :     return pin.pin < NUM_DIGITAL_PINS + NUM_ANALOG_INPUTS;
      26             : }
      27             : 
      28             : /**
      29             :  * @brief   Find the IO element of a given extended IO pin number. 
      30             :  * 
      31             :  * @param   pin
      32             :  *          The extended IO pin number to find the IO element of.
      33             :  * @return  A pointer to the extended IO element that the given pin belongs to.
      34             :  */
      35             : ExtendedIOElement *getIOElementOfPinOrNull(pin_t pin);
      36             : /// @copydoc getIOElementOfPinOrNull
      37             : /// Throws an error if the element was not found.
      38             : ExtendedIOElement *getIOElementOfPin(pin_t pin);
      39             : 
      40             : /// An ExtIO version of the Arduino function
      41             : /// @see    ExtendedIOElement::pinMode
      42             : void pinMode(pin_t pin, PinMode_t mode);
      43             : /// An ExtIO version of the Arduino function
      44             : /// @see    ExtendedIOElement::digitalWrite
      45             : void digitalWrite(pin_t pin, PinStatus_t val);
      46             : /// An ExtIO version of the Arduino function
      47             : /// @see    ExtendedIOElement::digitalRead
      48             : PinStatus_t digitalRead(pin_t pin);
      49             : 
      50             : /// An ExtIO version of the Arduino function
      51             : /// @see    ExtendedIOElement::analogRead
      52             : analog_t analogRead(pin_t pin);
      53             : /// An ExtIO version of the Arduino function
      54             : /// @see    ExtendedIOElement::analogWrite
      55             : void analogWrite(pin_t pin, analog_t val);
      56             : /// An ExtIO version of the Arduino function
      57             : /// @see    ExtendedIOElement::analogWrite
      58             : void analogWrite(pin_t pin, int val);
      59             : 
      60             : /// An ExtIO version of the Arduino function
      61             : void shiftOut(pin_t dataPin, pin_t clockPin, BitOrder_t bitOrder, uint8_t val);
      62             : 
      63             : /// A buffered ExtIO version of the Arduino function
      64             : /// @see   ExtendedIOElement::pinModeBuffered
      65             : void pinModeBuffered(pin_t pin, PinMode_t mode);
      66             : /// A buffered ExtIO version of the Arduino function
      67             : /// @see   ExtendedIOElement::digitalWriteBuffered
      68             : void digitalWriteBuffered(pin_t pin, PinStatus_t val);
      69             : /// A buffered ExtIO version of the Arduino function
      70             : /// @see   ExtendedIOElement::digitalReadBuffered
      71             : PinStatus_t digitalReadBuffered(pin_t pin);
      72             : 
      73             : /// A buffered ExtIO version of the Arduino function
      74             : /// @see   ExtendedIOElement::analogReadBuffered
      75             : analog_t analogReadBuffered(pin_t pin);
      76             : /// A buffered ExtIO version of the Arduino function
      77             : /// @see   ExtendedIOElement::analogWriteBuffered
      78             : void analogWriteBuffered(pin_t pin, analog_t val);
      79             : /// A buffered ExtIO version of the Arduino function
      80             : /// @see   ExtendedIOElement::analogWriteBuffered
      81             : void analogWriteBuffered(pin_t pin, int val);
      82             : 
      83             : /// @}
      84             : 
      85             : } // namespace ExtIO
      86             : 
      87             : END_AH_NAMESPACE

Generated by: LCOV version 1.15