28template<
typename T, u
int16_t N,
typename P =
typename std::conditional<(N > 256), u
int16_t, u
int8_t>
::type>
36 const T pin_mask = (1 << (pin %
BANK_SIZE));
A class to cache the read state of a GPIO expander.
void reset_pin_cache_()
Invalidate cache. This function should be called in component loop().
void digital_write(P pin, bool value)
static constexpr uint16_t BANK_SIZE
static constexpr uint16_t BITS_PER_BYTE
virtual void digital_write_hw(P pin, bool value)=0
Write GPIO state to hardware.
virtual bool digital_read_cache(P pin)=0
Get cached pin value from internal state.
T read_cache_valid_[BANKS]
bool digital_read(P pin)
Read the state of the given pin.
virtual bool digital_read_hw(P pin)=0
Read GPIO bank from hardware into internal state.
static constexpr size_t BANKS
static constexpr size_t CACHE_SIZE_BYTES