Fixed wrong sizeof in digital_read

This commit is contained in:
Michał Obrembski 2024-12-24 14:35:51 +01:00 committed by Michał Obrembski
parent 4fa1d61965
commit 5f3e4d7c04

View File

@ -19,7 +19,7 @@ namespace gpio_expander {
template<typename T, T N> class CachedGpioExpander {
public:
bool digital_read(T pin) {
uint8_t bank = pin / (sizeof(uint8_t) * BITS_PER_BYTE);
uint8_t bank = pin / (sizeof(T) * BITS_PER_BYTE);
if (this->read_cache_invalidated_[bank]) {
this->read_cache_invalidated_[bank] = false;
if (!this->digital_read_hw(pin))