4#include "ExtendedIOElement.hpp"
6#include <AH/STL/type_traits>
10ExtendedIOElement::ExtendedIOElement(
pin_t length)
11 : length(length), start(offset), end(offset + length) {
14 "Dynamically creating new ExtendedIOElements is not "
34 static_assert(!std::is_integral<pin_t>::value ||
35 std::is_unsigned<pin_t>::value,
36 "Error: pin_t should be an unsigned integer type");
37 ERROR(F(
"Error: the pin number (")
39 << F(
") is greater than the number of pins of this "
40 "ExtendedIOElement (")
#define BEGIN_AH_NAMESPACE
#define AH_DIAGNOSTIC_POP()
#define AH_DIAGNOSTIC_WERROR()
pin_t getStart() const
Get the smallest global extended IO pin number that belongs to this extended IO element.
virtual void updateBufferedInputs()=0
Read the physical state into the input buffers.
virtual void updateBufferedOutputs()=0
Write the internal state to the physical outputs.
pin_t pin(pin_t pin) const
Get the extended IO pin number of a given physical pin of this extended IO element.
pin_t getLength() const
Get the number of pins this IO element has.
pin_t operator[](pin_t pin) const
Get the extended IO pin number of a given physical pin of this extended IO element.
virtual void begin()=0
Initialize the extended IO element.
static DoublyLinkedList< ExtendedIOElement > & getAll()
Get the list of all Extended IO elements.
static void updateAllBufferedOutputs()
Write the internal states to the physical outputs for all extended IO elements.
pin_t getEnd() const
Get the largest global extended IO pin number that belongs to this extended IO element.
static void beginAll()
Initialize all extended IO elements.
static void updateAllBufferedInputs()
Read the physical state into the input buffers for all extended IO elements.
static DoublyLinkedList< ExtendedIOElement > updatables
#define FATAL_ERROR(msg, errc)
Print the error message and error code, and stop the execution.
constexpr pin_t NO_PIN
A special pin number that indicates an unused or invalid pin.
Type for storing pin numbers of Extended Input/Output elements.