PebbleOS v4.47.0
Loading...
Searching...
No Matches

LEDs, single color or multicolor, driven by an LED controller. More...

Modules

 AW2016
 Awinic AW2016 RGB LED controller, driving one multicolor LED on its three channels.
 

Data Structures

struct  pbl_led_ops
 LED driver operations. More...
 
struct  pbl_led
 LED. More...
 

Macros

#define PBL_LED_BRIGHTNESS_MAX   255U
 Full brightness.
 
#define PBL_LED_INIT(sym, _name, _init, _parent, _ops)
 Initialize a struct pbl_led.
 

Functions

int pbl_led_set (const struct pbl_led *led, uint8_t brightness, uint32_t rgb_color)
 Set an LED.
 
int pbl_led_refresh (const struct pbl_led *led, uint8_t brightness, uint32_t rgb_color)
 Configure the controller of an LED again and set the LED, after the controller may have lost its configuration.
 

Detailed Description

LEDs, single color or multicolor, driven by an LED controller.

A multicolor LED mixes its channels after a color; a single color LED ignores it. Consumers, such as a backlight on an LED, keep the state and set it whole.


Data Structure Documentation

◆ pbl_led

struct pbl_led

LED.

Data Fields
struct pbl_device dev Device.
const struct pbl_led_ops * ops Driver operations.

Macro Definition Documentation

◆ PBL_LED_BRIGHTNESS_MAX

#define PBL_LED_BRIGHTNESS_MAX   255U

Full brightness.

◆ PBL_LED_INIT

#define PBL_LED_INIT (   sym,
  _name,
  _init,
  _parent,
  _ops 
)
Value:
{ \
.dev = PBL_DEVICE_INIT_CLASS(sym, _name, _init, _parent, nullptr, &pbl_led_class), \
.ops = (_ops), \
}
#define PBL_DEVICE_INIT_CLASS(sym, _name, _init, _parent, _deps, _cls)
Initializer for the struct pbl_device of device instance sym, in class _cls.
Definition device.h:145

Initialize a struct pbl_led.

Parameters
symSymbol of the instance, with its state defined by PBL_DEVICE_STATE_DEFINE().
_nameName.
_initDevice init function, or NULL.
_parentParent device, e.g. the bus of the controller, or NULL.
_opsDriver operations.

Function Documentation

◆ pbl_led_refresh()

int pbl_led_refresh ( const struct pbl_led *  led,
uint8_t  brightness,
uint32_t  rgb_color 
)

Configure the controller of an LED again and set the LED, after the controller may have lost its configuration.

Parameters
ledLED.
brightnessBrightness, 0 (off) to PBL_LED_BRIGHTNESS_MAX.
rgb_colorColor as 0xRRGGBB, for multicolor LEDs.
Returns
0, -ENODEV if the LED is not ready, or another negative errno.

◆ pbl_led_set()

int pbl_led_set ( const struct pbl_led *  led,
uint8_t  brightness,
uint32_t  rgb_color 
)

Set an LED.

Parameters
ledLED.
brightnessBrightness, 0 (off) to PBL_LED_BRIGHTNESS_MAX.
rgb_colorColor as 0xRRGGBB, for multicolor LEDs.
Returns
0, -ENODEV if the LED is not ready, or another negative errno.