ESPHome 2026.12.0-dev
Loading...
Searching...
No Matches
mipi_dsi_light.h
Go to the documentation of this file.
1#pragma once
2
3#ifdef USE_ESP32_VARIANT_ESP32P4
9
10namespace esphome::mipi_dsi {
11
12// Brightness-only light that sets the panel brightness with a DSI command.
13// Brightness is scaled into [min_brightness, max_brightness]; off writes min_brightness.
14class MipiDsiLight final : public light::LightOutput, public Parented<MipiDsi> {
15 public:
16 MipiDsiLight(uint8_t min_brightness, uint8_t max_brightness)
17 : min_brightness_(min_brightness), max_brightness_(max_brightness) {}
18
20 auto traits = light::LightTraits();
21 traits.set_supported_color_modes({light::ColorMode::BRIGHTNESS});
22 return traits;
23 }
24
26 float brightness;
27 state->current_values_as_brightness(&brightness);
28 this->parent_->set_brightness(scale_brightness(brightness, this->min_brightness_, this->max_brightness_));
29 }
30
31 protected:
34};
35
36} // namespace esphome::mipi_dsi
37#endif
Helper class to easily give an object a parent of type T.
Definition helpers.h:2432
Interface to write LightStates to hardware.
This class represents the communication layer between the front-end MQTT layer and the hardware outpu...
Definition light_state.h:74
This class is used to represent the capabilities of a light.
Definition light_traits.h:9
light::LightTraits get_traits() override
void write_state(light::LightState *state) override
MipiDsiLight(uint8_t min_brightness, uint8_t max_brightness)
bool state
Definition fan.h:2
@ BRIGHTNESS
Dimmable light.
uint8_t scale_brightness(float brightness, uint8_t min_brightness, uint8_t max_brightness)
Definition brightness.h:9