mirror of
https://github.com/esphome/esphome.git
synced 2025-11-05 09:31:54 +00:00
cleanup
This commit is contained in:
@@ -70,7 +70,7 @@ bool MAX6956::digital_read_hw(uint8_t pin) {
|
|||||||
// Store in cache with proper alignment
|
// Store in cache with proper alignment
|
||||||
if (bank_index == 0) {
|
if (bank_index == 0) {
|
||||||
// Special case for bank 0: pins 4-7 are in bits D0-D3, shift them to bits 4-7
|
// 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 {
|
} else {
|
||||||
// Banks 1-3 map directly
|
// Banks 1-3 map directly
|
||||||
this->input_banks_[bank_index] = value;
|
this->input_banks_[bank_index] = value;
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ enum MAX6956GPIORange : uint8_t {
|
|||||||
|
|
||||||
/// Bank configuration for MAX6956
|
/// Bank configuration for MAX6956
|
||||||
static constexpr uint8_t MAX6956_BANK_SIZE = 8;
|
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 {
|
enum MAX6956GPIORegisters {
|
||||||
MAX6956_GLOBAL_CURRENT = 0x02,
|
MAX6956_GLOBAL_CURRENT = 0x02,
|
||||||
@@ -44,7 +46,9 @@ enum MAX6956GPIOFlag { FLAG_LED = 0x20 };
|
|||||||
|
|
||||||
enum MAX6956CURRENTMODE { GLOBAL = 0x00, SEGMENT = 0x01 };
|
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:
|
public:
|
||||||
MAX6956() = default;
|
MAX6956() = default;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user