6#include "ExtendedInputOutput.hpp"
18template <
class WireType>
48 void begin()
override;
86 void writeI2C(
const uint8_t (&values)[N]);
96 template <
class... Args>
97 void writeI2C(uint8_t addr, Args... values);
AH::function_traits< decltype(::pinMode)>::argument_t< 1 > PinMode_t
AH::function_traits< decltype(::digitalWrite)>::argument_t< 1 > PinStatus_t
uint16_t analog_t
The type returned from analogRead and similar functions.
constexpr pin_t NO_PIN
A special pin number that indicates an unused or invalid pin.
uint16_t pin_t
The type for Arduino pins (and ExtendedIOElement pins).
#define BEGIN_AH_NAMESPACE
#define AH_DIAGNOSTIC_POP()
#define AH_DIAGNOSTIC_WERROR()
pin_t pin(pin_t pin) const
Get the extended IO pin number of a given physical pin of this extended IO element.
Class for MCP23017 I²C I/O expanders.
MCP23017(WireType &wire, uint8_t addressOffset=0, pin_t interruptPin=NO_PIN)
Constructor.
void updateBufferedPinModes()
Send the new pin modes to the chip after calling pinModeBuffered.
void updateBufferedOutputs() override
Write the internal state to the physical outputs.
BitArray< 16 > bufferedPullups
pin_t pinA(pin_t p)
Get the identifier of the given pin in register A.
void analogWriteBuffered(pin_t, analog_t) override
Write an analog (or PWM) value to the software buffer given pin.
PinStatus_t digitalReadBuffered(pin_t pin) override
Read the state of the given pin from the software buffer.
void pinModeBuffered(pin_t pin, PinMode_t mode) override
Set the mode of a given pin in the software buffer.
BitArray< 16 > bufferedInputs
void updateBufferedInputs() override
Read the physical state into the input buffers.
void begin() override
Initialize the extended IO element.
static constexpr uint8_t I2C_BASE_ADDRESS
analog_t analogReadBuffered(pin_t pin) override
Read the analog value of the given pin from the software buffer.
BitArray< 16 > bufferedOutputs
bool hasInputs() const
Check if any of the pins are configured as inputs.
pin_t pinB(pin_t p)
Get the identifier of the given pin in register B.
void digitalWriteBuffered(pin_t pin, PinStatus_t status) override
Set the output of a given pin in the software buffer.
BitArray< 16 > bufferedPinModes
void writeI2C(const uint8_t(&values)[N])
Write any data to the MCP23017.
A class for ExtendedIOElements with a fixed size.