1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-31 23:21:54 +00:00
This commit is contained in:
J. Nick Koston
2025-09-04 16:07:50 -05:00
parent 3f6a490cf4
commit 2b2fb5958d
2 changed files with 6 additions and 2 deletions

View File

@@ -70,7 +70,7 @@ bool MAX6956::digital_read_hw(uint8_t pin) {
// Store in cache with proper alignment
if (bank_index == 0) {
// Special case for bank 0: pins 4-7 are in bits D0-D3, shift them to bits 4-7
this->input_banks_[0] = value << 4;
this->input_banks_[0] = value << MAX6956_BANK0_SHIFT;
} else {
// Banks 1-3 map directly
this->input_banks_[bank_index] = value;

View File

@@ -24,6 +24,8 @@ enum MAX6956GPIORange : uint8_t {
/// Bank configuration for MAX6956
static constexpr uint8_t MAX6956_BANK_SIZE = 8;
static constexpr uint8_t MAX6956_TOTAL_PINS = 32; // Includes pins 0-3 (unused) for cache alignment
static constexpr uint8_t MAX6956_BANK0_SHIFT = 4;
enum MAX6956GPIORegisters {
MAX6956_GLOBAL_CURRENT = 0x02,
@@ -44,7 +46,9 @@ enum MAX6956GPIOFlag { FLAG_LED = 0x20 };
enum MAX6956CURRENTMODE { GLOBAL = 0x00, SEGMENT = 0x01 };
class MAX6956 : public Component, public i2c::I2CDevice, public gpio_expander::CachedGpioExpander<uint8_t, 28> {
class MAX6956 : public Component,
public i2c::I2CDevice,
public gpio_expander::CachedGpioExpander<uint8_t, MAX6956_TOTAL_PINS> {
public:
MAX6956() = default;