8static const char *
const TAG =
"my9231.output";
11static const uint8_t MY9231_CMD_ONE_SHOT_DISABLE = 0x0 << 6;
12static const uint8_t MY9231_CMD_ONE_SHOT_ENFORCE = 0x1 << 6;
14static const uint8_t MY9231_CMD_REACTION_FAST = 0x0 << 5;
15static const uint8_t MY9231_CMD_REACTION_SLOW = 0x1 << 5;
17static const uint8_t MY9231_CMD_BIT_WIDTH_16 = 0x0 << 3;
18static const uint8_t MY9231_CMD_BIT_WIDTH_14 = 0x1 << 3;
19static const uint8_t MY9231_CMD_BIT_WIDTH_12 = 0x2 << 3;
20static const uint8_t MY9231_CMD_BIT_WIDTH_8 = 0x3 << 3;
22static const uint8_t MY9231_CMD_FREQUENCY_DIVIDE_1 = 0x0 << 1;
23static const uint8_t MY9231_CMD_FREQUENCY_DIVIDE_4 = 0x1 << 1;
24static const uint8_t MY9231_CMD_FREQUENCY_DIVIDE_16 = 0x2 << 1;
25static const uint8_t MY9231_CMD_FREQUENCY_DIVIDE_64 = 0x3 << 1;
27static const uint8_t MY9231_CMD_SCATTER_APDM = 0x0 << 0;
28static const uint8_t MY9231_CMD_SCATTER_PWM = 0x1 << 0;
31 ESP_LOGCONFIG(TAG,
"Setting up MY9231OutputComponent...");
40 command |= MY9231_CMD_BIT_WIDTH_8;
43 command |= MY9231_CMD_BIT_WIDTH_12;
46 command |= MY9231_CMD_BIT_WIDTH_14;
49 command |= MY9231_CMD_BIT_WIDTH_16;
52 MY9231_CMD_SCATTER_APDM | MY9231_CMD_FREQUENCY_DIVIDE_1 | MY9231_CMD_REACTION_FAST | MY9231_CMD_ONE_SHOT_DISABLE;
53 ESP_LOGV(TAG,
" Command: 0x%02X", command);
60 ESP_LOGV(TAG,
" Chips initialized.");
63 ESP_LOGCONFIG(TAG,
"MY9231:");
64 LOG_PIN(
" DI Pin: ", this->
pin_di_);
66 ESP_LOGCONFIG(TAG,
" Total number of channels: %u", this->
num_channels_);
67 ESP_LOGCONFIG(TAG,
" Number of chips: %u", this->
num_chips_);
68 ESP_LOGCONFIG(TAG,
" Bit depth: %u", this->
bit_depth_);
85 ESP_LOGV(TAG,
"set channels %u to %u", channel, value);
97 for (uint8_t i = 0; i < this->
num_chips_; i++) {
106 for (uint8_t i = bits; i > 0; i--) {
113 for (uint8_t i = 0; i < count; i++) {
120 for (uint8_t i = 0; i < count; i++) {