PebbleOS
Loading...
Searching...
No Matches
Functions
Light

Controlling Pebble's backlight. More...

Functions

void light_enable (bool enable)
 Turn the watch's backlight on or put it back into automatic control.
 
void light_enable_interaction (void)
 Trigger the backlight and schedule a timer to automatically disable the backlight after a short delay.
 
void light_set_color_rgb888 (uint32_t rgb)
 Tint the backlight LED to a packed 24-bit RGB value.
 
void light_set_system_color (void)
 Restore the backlight to the user's default color.
 
bool light_is_on (void)
 Check whether the backlight is on.
 

Detailed Description

Controlling Pebble's backlight.

The Light API provides you with functions to turn on Pebble’s backlight or put it back into automatic control. You can trigger the backlight and schedule a timer to automatically disable the backlight after a short delay, which is the preferred method of interacting with the backlight.

Function Documentation

◆ light_enable()

void light_enable ( bool  enable)

Turn the watch's backlight on or put it back into automatic control.

Developers should take care when calling this function, keeping Pebble's backlight on for long periods of time will rapidly deplete the battery. Ignores the user's backlight settings; see light_enable_respect_settings().

Parameters
enableTurn the backlight on if true, otherwise false to turn it off and put it back into automatic control. While buttons are held, the light stays on until they are released.

◆ light_enable_interaction()

void light_enable_interaction ( void  )

Trigger the backlight and schedule a timer to automatically disable the backlight after a short delay.

This is the preferred method of interacting with the backlight. Does nothing while buttons are held or the backlight was forced on with light_enable(), and the light only turns on if the user's settings and the ambient light allow it.

◆ light_is_on()

bool light_is_on ( void  )

Check whether the backlight is on.

Returns
true if the backlight is currently on in any form (on, timed, or fading out). Returns false only when the backlight is fully off.

◆ light_set_color_rgb888()

void light_set_color_rgb888 ( uint32_t  rgb)

Tint the backlight LED to a packed 24-bit RGB value.

The override lasts until light_set_system_color() is called; the app manager calls it on app exit. While light_system_color_request() is held, the user's default color is shown instead. No-op on platforms without a color backlight.

Parameters
rgbPacked 0x00RRGGBB value; 8 bits per channel. High byte ignored.

◆ light_set_system_color()

void light_set_system_color ( void  )

Restore the backlight to the user's default color.

Clears the override set with light_set_color_rgb888(). No-op on platforms without a color backlight.