Backlight Interface

[中文]

Public header: #include "brookesia/hal_interface/display/backlight.hpp"

API Reference

Header File

Classes

class DisplayBacklightIface : public esp_brookesia::hal::Interface

Display backlight control interface.

Public Functions

inline DisplayBacklightIface(Info info)

Construct a display backlight interface.

Parameters

info[in] Static backlight capability information.

virtual ~DisplayBacklightIface() = default

Virtual destructor for polymorphic backlight interfaces.

virtual bool set_brightness(uint8_t percent) = 0

Set backlight brightness.

Parameters

percent[in] Brightness percentage.

Returns

true on success; otherwise false.

virtual bool get_brightness(uint8_t &percent) = 0

Get current backlight brightness.

Parameters

percent[out] Current brightness percentage.

Returns

true on success; otherwise false.

virtual bool turn_on() = 0

Turn on the backlight.

Note

Calling this interface will restore the brightness to the last set value. If the last set value is zero, the brightness will be restored to the default value.

Returns

true on success; otherwise false.

virtual bool turn_off() = 0

Turn off the backlight.

Note

Calling this interface will turn off the backlight. Even if the minimum brightness is not zero, the brightness will be turned off to zero.

Returns

true on success; otherwise false.

inline const Info &get_info() const

Get static backlight capability information.

Returns

Backlight information.

Public Static Attributes

static constexpr const char *NAME = "DisplayBacklight"

Interface registry name.

struct Info

Static backlight capability information.

Public Members

uint8_t brightness_default

Default brightness percentage.

uint8_t brightness_min

Minimum brightness percentage.

uint8_t brightness_max

Maximum brightness percentage.