| 8 | #include <PwmBacklight.h> |
| 9 | |
| 10 | static bool initBoot() { |
| 11 | if (!driver::pwmbacklight::init(LCD_PIN_BACKLIGHT)) { |
| 12 | return false; |
| 13 | } |
| 14 | |
| 15 | // Set the RGB LED Pins to output and turn them off |
| 16 | ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_4, GPIO_MODE_OUTPUT)); // Red |
| 17 | ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_16, GPIO_MODE_OUTPUT)); // Green |
| 18 | ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_17, GPIO_MODE_OUTPUT)); // Blue |
| 19 | |
| 20 | // 0 on, 1 off |
| 21 | ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_4, 1)); // Red |
| 22 | ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_16, 1)); // Green |
| 23 | ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_17, 1)); // Blue |
| 24 | |
| 25 | // This display has a weird glitch with gamma during boot, which results in uneven dark gray colours. |
| 26 | // Setting gamma curve index to 0 doesn't work at boot for an unknown reason, so we set the curve index to 1: |
| 27 | tt::kernel::subscribeSystemEvent(tt::kernel::SystemEvent::BootSplash, [](auto) { |
| 28 | auto display = tt::hal::findFirstDevice<tt::hal::display::DisplayDevice>(tt::hal::Device::Type::Display); |
| 29 | assert(display != nullptr); |
| 30 | tt::lvgl::lock(portMAX_DELAY); |
| 31 | display->setGammaCurve(1U); |
| 32 | tt::lvgl::unlock(); |
| 33 | }); |
| 34 | |
| 35 | return true; |
| 36 | } |
| 37 | |
| 38 | static tt::hal::DeviceVector createDevices() { |
| 39 | return { |
nothing calls this directly
no test coverage detected