7 static const char *
const TAG =
"bp5758d";
9 static const uint8_t BP5758D_MODEL_ID = 0b10000000;
10 static const uint8_t BP5758D_ADDR_STANDBY = 0b00000000;
15 static const uint8_t BP5758D_ADDR_START_3CH = 0b00010000;
16 static const uint8_t BP5758D_ADDR_START_2CH = 0b00100000;
17 static const uint8_t BP5758D_ADDR_START_5CH = 0b00110000;
18 static const uint8_t BP5758D_ALL_DATA_CHANNEL_ENABLEMENT = 0b00011111;
20 static const uint8_t BP5758D_DELAY = 2;
23 ESP_LOGCONFIG(TAG,
"Setting up BP5758D Output Component...");
34 ESP_LOGCONFIG(TAG,
"BP5758D:");
46 for (
int i = 1; i < 17; i++)
50 data[0] = BP5758D_MODEL_ID + BP5758D_ADDR_START_5CH;
53 data[0] = BP5758D_MODEL_ID + BP5758D_ADDR_STANDBY;
58 data[0] = BP5758D_MODEL_ID + BP5758D_ADDR_START_2CH;
59 data[1] = BP5758D_ALL_DATA_CHANNEL_ENABLEMENT;
65 for (
int i = 7, j = 0; i <= 15; i += 2, j++) {
73 data[0] = BP5758D_MODEL_ID + BP5758D_ADDR_START_3CH;
74 data[1] = BP5758D_ALL_DATA_CHANNEL_ENABLEMENT;
80 for (
int i = 7, j = 0; i <= 15; i += 2, j++) {
87 data[0] = BP5758D_MODEL_ID + BP5758D_ADDR_START_5CH;
88 data[1] = BP5758D_ALL_DATA_CHANNEL_ENABLEMENT;
94 for (
int i = 7, j = 0; i <= 15; i += 2, j++) {
139 for (uint8_t mask = 0x80; mask; mask >>= 1) {
158 for (uint32_t i = 0; i < size; i++) {
virtual void digital_write(bool value)=0
void set_channel_current_(uint8_t channel, uint8_t current)
virtual void pin_mode(gpio::Flags flags)=0
void dump_config() override
std::vector< uint16_t > pwm_amounts_
void write_buffer_(uint8_t *buffer, uint8_t size)
void set_channel_value_(uint8_t channel, uint16_t value)
void loop() override
Send new values if they were updated.
std::vector< uint8_t > channel_current_
Implementation of SPI Controller mode.
void IRAM_ATTR HOT delayMicroseconds(uint32_t us)
void write_bit_(bool value)
void write_byte_(uint8_t data)
uint8_t correct_current_level_bits_(uint8_t current)