7 static const char *
const TAG =
"max6956";
23 ESP_LOGCONFIG(TAG,
"Setting up MAX6956...");
24 uint8_t configuration;
40 ESP_LOGCONFIG(TAG,
"Enabling normal operation");
48 return (value & MASK_1PORT_VALUE);
59 uint8_t shift = 2 * (pin % 4);
71 config &= ~(MASK_PORT_CONFIG << shift);
72 config |= (mode << shift);
79 uint8_t shift = 2 * (pin % 4);
87 config &= ~(MASK_PORT_CONFIG << shift);
88 config |= (mode << shift);
94 ESP_LOGE(TAG,
"Global brightness out off range (%u)", current);
109 config &= ~MASK_CONFIG_CURRENT;
117 uint8_t shift = 4 * (pin % 2);
118 uint8_t bright = roundf(brightness * 15);
126 config &= ~(MASK_CURRENT_PIN << shift);
127 config |= (bright << shift);
146 ESP_LOGCONFIG(TAG,
"MAX6956");
149 ESP_LOGCONFIG(TAG,
"current mode: global");
152 ESP_LOGCONFIG(TAG,
"current mode: segment");
165 snprintf(buffer,
sizeof(buffer),
"%u via Max6956", pin_);
bool read_byte(uint8_t a_register, uint8_t *data, bool stop=true)
I2CRegister reg(uint8_t a_register)
calls the I2CRegister constructor
max6956::MAX6956CURRENTMODE brightness_mode_
void pin_mode(uint8_t pin, gpio::Flags flags)
void dump_config() override
const uint8_t MASK_CONFIG_CURRENT
const uint32_t MASK_TRANSITION_DETECTION
Masks for MAX6956 Configuration register.
bool digital_read() override
MAX6956GPIOMode
Modes for MAX6956 pins.
void set_brightness_mode(max6956::MAX6956CURRENTMODE brightness_mode)
const uint32_t MASK_NORMAL_OPERATION
bool digital_read(uint8_t pin)
void digital_write(uint8_t pin, bool value)
bool write_reg_(uint8_t reg, uint8_t value)
void write_brightness_mode()
BedjetMode mode
BedJet operating mode.
const uint8_t MASK_CURRENT_PIN
void write_brightness_global()
std::string dump_summary() const override
void pin_mode(gpio::Flags flags) override
void set_brightness_global(uint8_t current)
const uint32_t MASK_INDIVIDUAL_CURRENT
bool read_reg_(uint8_t reg, uint8_t *value)
void digital_write(bool value) override
bool write_byte(uint8_t a_register, uint8_t data, bool stop=true)
virtual void mark_failed()
Mark this component as failed.
Implementation of SPI Controller mode.
uint8_t global_brightness_
const uint32_t MASK_PORT_CONFIG
void set_pin_brightness(uint8_t pin, float brightness)
const uint32_t MASK_1PORT_VALUE