|
PebbleOS v4.47.0-512-g5285d4236
|
Backlight state machine. More...
Modules | |
| Light level | |
| Coarse ambient light level, classified against the backlight dark threshold. | |
Functions | |
| void | light_init (void) |
| Initialize the backlight service at startup. | |
| void | light_handle_color_prefs_changed (void) |
| Reschedule the day/night color switch after a backlight color pref is loaded or changed. | |
| void | light_handle_clock_change (void) |
| Re-apply the system color after the wall clock or time zone changes. | |
| void | light_button_pressed (void) |
| Handle a button press. | |
| void | light_button_released (void) |
| Handle a button release. | |
| void | light_touch_down (void) |
| Handle a touch finger-down. | |
| void | light_touch_moved (void) |
| Handle a touch moving while down. | |
| void | light_touch_up (void) |
| Release the hold taken by light_touch_down(). | |
| void | light_enable_respect_settings (bool enable) |
| light_enable() that respects the user's backlight settings. | |
| void | light_reset_user_controlled_by_task (PebbleTask task) |
Return to the normal state machine if task forced the light with light_enable(). | |
| void | light_system_color_request (void) |
| Make the system color take precedence over any app color. | |
| void | light_system_color_release (void) |
| Release a light_system_color_request(). | |
| void | light_toggle_enabled (void) |
| Toggle the user's backlight enabled setting. | |
| void | light_toggle_ambient_sensor_enabled (void) |
| Toggle the user's ambient light sensor setting. | |
| void | light_set_dynamic_mode (BacklightDynamicMode mode) |
| Set the dynamic backlight mode. | |
| void | light_allow (bool allowed) |
| Allow or disallow the backlight, e.g. | |
| uint8_t | light_get_current_brightness_percent (void) |
| Get the current backlight brightness. | |
| bool | light_is_lit_by_touch (void) |
| Check whether the backlight was lit by touch alone. | |
| uint32_t | light_get_ambient_lux (void) |
| Get the ambient light level. | |
| uint32_t | light_get_ambient_gate_lux (void) |
| Get the ambient light level the backlight wake gate compares against the dark threshold. | |
| uint32_t | light_get_dark_threshold (void) |
| Get the ambient light level below which the backlight turns on. | |
| void | light_set_dark_threshold (uint32_t threshold) |
| Set the ambient light level below which the backlight turns on. | |
Backlight state machine.
Buttons and touches keep the backlight on while held and start a timed fade-out once released. Whether it turns on at all depends on the user's backlight settings and, with the ambient light sensor enabled, on the ambient light level. Apps can force the light on or off, and set its color on platforms with a color backlight. Entities shared with the app SDK are documented in the SDK's Light group.
| void light_allow | ( | bool | allowed | ) |
Allow or disallow the backlight, e.g.
in low power mode.
Disallowing turns the light off.
| allowed | true to allow the backlight. |
| void light_button_pressed | ( | void | ) |
Handle a button press.
Turns the backlight on, if allowed, until all buttons are released. Called by the launcher on button down.
| void light_button_released | ( | void | ) |
Handle a button release.
Starts the fade-out timer once no button is held, unless the light is forced on. Called by the launcher on button up.
| void light_enable_respect_settings | ( | bool | enable | ) |
light_enable() that respects the user's backlight settings.
When enabling, the light only turns on if the settings and ambient light allow it.
| enable | true to force the light on, false to turn it off. |
| uint32_t light_get_ambient_gate_lux | ( | void | ) |
Get the ambient light level the backlight wake gate compares against the dark threshold.
Same sample as light_get_ambient_lux() but without screen compensation, so dark screen content can't keep the backlight off in a dim room.
| uint32_t light_get_ambient_lux | ( | void | ) |
Get the ambient light level.
Screen-compensated and converted with the board's calibration; raw counts pass through on boards without lux coefficients. Served from a short-lived cache; while the backlight is on, the last value read before it turned on is returned.
| uint8_t light_get_current_brightness_percent | ( | void | ) |
Get the current backlight brightness.
May differ from the configured brightness when dynamic backlight is enabled.
| uint32_t light_get_dark_threshold | ( | void | ) |
Get the ambient light level below which the backlight turns on.
| void light_handle_clock_change | ( | void | ) |
Re-apply the system color after the wall clock or time zone changes.
| void light_handle_color_prefs_changed | ( | void | ) |
Reschedule the day/night color switch after a backlight color pref is loaded or changed.
| void light_init | ( | void | ) |
Initialize the backlight service at startup.
| bool light_is_lit_by_touch | ( | void | ) |
Check whether the backlight was lit by touch alone.
| void light_reset_user_controlled_by_task | ( | PebbleTask | task | ) |
Return to the normal state machine if task forced the light with light_enable().
| task | Task that exited. |
| void light_set_dark_threshold | ( | uint32_t | threshold | ) |
Set the ambient light level below which the backlight turns on.
| threshold | Threshold, in the units of light_get_ambient_gate_lux(). |
| void light_set_dynamic_mode | ( | BacklightDynamicMode | mode | ) |
Set the dynamic backlight mode.
Briefly turns the light on so the user sees the effect.
| mode | New mode. |
| void light_system_color_release | ( | void | ) |
Release a light_system_color_request().
When the count drops to zero, any app color is applied again.
| void light_system_color_request | ( | void | ) |
Make the system color take precedence over any app color.
Reference counted: while held, the LED shows the user's current system color even if an app set an override. Used by notifications and other modals to show neutral white without clearing the app's color. No-op on platforms without a color backlight.
| void light_toggle_ambient_sensor_enabled | ( | void | ) |
Toggle the user's ambient light sensor setting.
| void light_toggle_enabled | ( | void | ) |
Toggle the user's backlight enabled setting.
Also clears a forced-on state and briefly shows the result.
| void light_touch_down | ( | void | ) |
Handle a touch finger-down.
Lights the backlight for the timeout; repeated calls before light_touch_up() count once. Unlike a held button, a held touch doesn't keep the backlight on: only light_touch_moved() restarts the timeout.
| void light_touch_moved | ( | void | ) |
Handle a touch moving while down.
Restarts the timeout of the backlight lit by light_touch_down().
| void light_touch_up | ( | void | ) |
Release the hold taken by light_touch_down().
Called on liftoff and on app teardown. No-op if no touch is holding the backlight.