Data Fields
light_state_t Struct Reference

The parameters that can be set for a given light. More...

Data Fields

int brightnessMode
 Policy used by the framework to manage the light's brightness. More...
 
unsigned int color
 The color of the LED in ARGB. More...
 
int flashMode
 See the LIGHT_FLASH_* constants. More...
 
int flashOffMS
 
int flashOnMS
 

Detailed Description

The parameters that can be set for a given light.

Not all lights must support all parameters. If you can do something backward-compatible, you should.

Definition at line 90 of file lights.h.

Field Documentation

int light_state_t::brightnessMode

Policy used by the framework to manage the light's brightness.

Currently the values are BRIGHTNESS_MODE_USER and BRIGHTNESS_MODE_SENSOR.

Definition at line 118 of file lights.h.

unsigned int light_state_t::color

The color of the LED in ARGB.

Do your best here.

  • If your light can only do red or green, if they ask for blue, you should do green.
  • If you can only do a brightness ramp, then use this formula: unsigned char brightness = ((77*((color>>16)&0x00ff))
    • (150*((color>>8)&0x00ff)) + (29*(color&0x00ff))) >> 8;
  • If you can only do on or off, 0 is off, anything else is on.

The high byte should be ignored. Callers will set it to 0xff (which would correspond to 255 alpha).

Definition at line 105 of file lights.h.

int light_state_t::flashMode

See the LIGHT_FLASH_* constants.

Definition at line 110 of file lights.h.

int light_state_t::flashOffMS

Definition at line 112 of file lights.h.

int light_state_t::flashOnMS

Definition at line 111 of file lights.h.