| 178 | static std::shared_ptr<Axp2101> axp2101; |
| 179 | |
| 180 | bool initBoot() { |
| 181 | auto* i2c = device_find_by_name("i2c_internal"); |
| 182 | if (i2c == nullptr) { |
| 183 | LOG_E(TAG, "i2c_internal not found"); |
| 184 | return false; |
| 185 | } |
| 186 | // Boost enable via AXP2101 before GPIO expander init (same as CoreS3) |
| 187 | // AW9523B P1 bit 7 = SY7088 boost enable — set after AXP2101 is configured |
| 188 | if (!initPowerControl(i2c)) { |
| 189 | LOG_E(TAG, "AXP2101 init failed"); |
| 190 | return false; |
| 191 | } |
| 192 | |
| 193 | if (!initGpioExpander(i2c)) { |
| 194 | LOG_E(TAG, "AW9523B init failed"); |
| 195 | return false; |
| 196 | } |
| 197 | |
| 198 | // AW88298 default state after reset is sufficient for SfxEngine (16kHz). |
| 199 | // Full 44100Hz support requires esp_codec_dev integration (see memory notes). |
| 200 | if (!initSpeaker(i2c, 16000)) { |
| 201 | LOG_W(TAG, "AW88298 init failed (non-fatal)"); |
| 202 | } |
| 203 | |
| 204 | if (!initMicrophone(i2c)) { |
| 205 | LOG_W(TAG, "ES7210 init failed (non-fatal)"); |
| 206 | } |
| 207 | |
| 208 | // Boot LED pattern — confirms PY32IOExpander is working. |
| 209 | // PY32 pin 0 = servo VM_EN (output), pin 13 = WS2812C data line. |
| 210 | auto* py32 = device_find_by_name("py32"); |
| 211 | if (py32 != nullptr) { |
| 212 | static constexpr uint8_t LED_COUNT = 12; |
| 213 | static constexpr uint8_t COLORS[][3] = { |
| 214 | { 255, 0, 0 }, // red |
| 215 | { 0, 255, 0 }, // green |
| 216 | { 0, 0, 255 }, // blue |
| 217 | }; |
| 218 | py32_led_set_count(py32, LED_COUNT); |
| 219 | for (auto& c : COLORS) { |
| 220 | for (uint8_t i = 0; i < LED_COUNT; i++) { |
| 221 | py32_led_set_color(py32, i, c[0], c[1], c[2]); |
| 222 | } |
| 223 | py32_led_refresh(py32); |
| 224 | vTaskDelay(pdMS_TO_TICKS(150)); |
| 225 | } |
| 226 | py32_led_disable(py32); |
| 227 | } else { |
| 228 | LOG_W(TAG, "py32 not found — LED boot pattern skipped"); |
| 229 | } |
| 230 | |
| 231 | // Keep Axp2101 C++ wrapper alive for Axp2101Power (backlight + battery) |
| 232 | axp2101 = std::make_shared<Axp2101>(i2c); |
| 233 | return true; |
| 234 | } |
| 235 | |
| 236 | // --------------------------------------------------------------------------- |
| 237 | // Device list |
nothing calls this directly
no test coverage detected