Data Structures | |
struct | ratbag_color |
Represents LED color in RGB format. More... | |
struct | ratbag_led |
Represents a led on the device. More... | |
Enumerations | |
enum | ratbag_led_mode { RATBAG_LED_OFF, RATBAG_LED_ON, RATBAG_LED_CYCLE, RATBAG_LED_BREATHING } |
RATBAG_LED_OFF - led is now off, RATBAG_LED_ON - led is on with static color, RATBAG_LED_CYCLE - led is cycling between all colors. More... | |
enum | ratbag_led_type { RATBAG_LED_TYPE_UNKNOWN, RATBAG_LED_TYPE_LOGO, RATBAG_LED_TYPE_SIDE } |
LED types, usually based on their physical location. More... | |
Functions | |
struct ratbag_led * | ratbag_profile_get_led (struct ratbag_profile *profile, unsigned int index) |
Return a reference to the LED given by the index. More... | |
enum ratbag_led_type | ratbag_led_get_type (struct ratbag_led *led) |
This function returns the type for ratbag_led. More... | |
enum ratbag_led_mode | ratbag_led_get_mode (struct ratbag_led *led) |
This function returns the mode for ratbag_led. More... | |
struct ratbag_color | ratbag_led_get_color (struct ratbag_led *led) |
This function returns the led color. More... | |
int | ratbag_led_get_effect_rate (struct ratbag_led *led) |
This function returns the LED effect rate. More... | |
unsigned int | ratbag_led_get_brightness (struct ratbag_led *led) |
This function returns the LED brightness. More... | |
enum ratbag_error_code | ratbag_led_set_mode (struct ratbag_led *led, enum ratbag_led_mode mode) |
this function sets the LED mode. More... | |
enum ratbag_error_code | ratbag_led_set_color (struct ratbag_led *led, struct ratbag_color color) |
If the LED's mode is RATBAG_LED_ON or RATBAG_LED_BREATHING then this function sets the LED color, otherwise it has no effect. More... | |
enum ratbag_error_code | ratbag_led_set_effect_rate (struct ratbag_led *led, unsigned int rate) |
If the LED's mode is RATBAG_LED_CYCLE or RATBAG_LED_BREATHING then this function sets the LED rate in Hz. More... | |
enum ratbag_error_code | ratbag_led_set_brightness (struct ratbag_led *led, unsigned int brightness) |
If the LED's mode is RATBAG_LED_CYCLE or RATBAG_LED_BREATHING then this function sets the LED brightness, otherwise it has no effect. More... | |
struct ratbag_led * | ratbag_led_ref (struct ratbag_led *led) |
Add a reference to the led. More... | |
struct ratbag_led * | ratbag_led_unref (struct ratbag_led *led) |
Dereference the ratbag led. More... | |
Detailed Description
Enumeration Type Documentation
◆ ratbag_led_mode
enum ratbag_led_mode |
RATBAG_LED_OFF - led is now off, RATBAG_LED_ON - led is on with static color, RATBAG_LED_CYCLE - led is cycling between all colors.
RATBAG_LED_BREATHING - led is pulsating with static color
Each LED mode has different properties, e.g. the brightness and rate are only available in modes RATBAG_LED_CYCLE and RATBAG_LED_BREATHING modes
Enumerator | |
---|---|
RATBAG_LED_OFF | |
RATBAG_LED_ON | |
RATBAG_LED_CYCLE | |
RATBAG_LED_BREATHING |
◆ ratbag_led_type
enum ratbag_led_type |
Function Documentation
◆ ratbag_led_get_brightness()
unsigned int ratbag_led_get_brightness | ( | struct ratbag_led * | led | ) |
This function returns the LED brightness.
- Parameters
-
led A previously initialized ratbag LED
- Returns
- The LED brightness 0 - 255
- See also
- ratbag_led_get_brightness
◆ ratbag_led_get_color()
struct ratbag_color ratbag_led_get_color | ( | struct ratbag_led * | led | ) |
This function returns the led color.
- Parameters
-
led A previously initialized ratbag LED
- Returns
- The LED color in ratbag_led_mode
- See also
- ratbag_led_set_color
◆ ratbag_led_get_effect_rate()
int ratbag_led_get_effect_rate | ( | struct ratbag_led * | led | ) |
This function returns the LED effect rate.
- Parameters
-
led A previously initialized ratbag LED
- Returns
- The LED rate in Hz, can be 100 - 20000
- See also
- ratbag_led_set_effect_rate
◆ ratbag_led_get_mode()
enum ratbag_led_mode ratbag_led_get_mode | ( | struct ratbag_led * | led | ) |
This function returns the mode for ratbag_led.
- Parameters
-
led A previously initialized ratbag LED
- Returns
- The LED mod ratbag_led_mode
- See also
- ratbag_led_set_mode
◆ ratbag_led_get_type()
enum ratbag_led_type ratbag_led_get_type | ( | struct ratbag_led * | led | ) |
This function returns the type for ratbag_led.
- Parameters
-
led A previously initialized ratbag LED
- Returns
- The LED type ratbag_led_type
- See also
- ratbag_led_set_mode
◆ ratbag_led_ref()
struct ratbag_led* ratbag_led_ref | ( | struct ratbag_led * | led | ) |
Add a reference to the led.
A led is destroyed whenever the reference count reaches 0. See ratbag_led_unref.
- Parameters
-
led A previously initialized valid ratbag led
- Returns
- The passed ratbag led
◆ ratbag_led_set_brightness()
enum ratbag_error_code ratbag_led_set_brightness | ( | struct ratbag_led * | led, |
unsigned int | brightness | ||
) |
If the LED's mode is RATBAG_LED_CYCLE or RATBAG_LED_BREATHING then this function sets the LED brightness, otherwise it has no effect.
- Parameters
-
led A previously initialized ratbag LED brightness Effect brightness 0 - 255
- Returns
- 0 on success or an error code otherwise.
- See also
- ratbag_led_get_brightness
◆ ratbag_led_set_color()
enum ratbag_error_code ratbag_led_set_color | ( | struct ratbag_led * | led, |
struct ratbag_color | color | ||
) |
If the LED's mode is RATBAG_LED_ON or RATBAG_LED_BREATHING then this function sets the LED color, otherwise it has no effect.
- Parameters
-
led A previously initialized ratbag LED color A LED color.
- Returns
- 0 on success or an error code otherwise.
- See also
- ratbag_led_get_color
◆ ratbag_led_set_effect_rate()
enum ratbag_error_code ratbag_led_set_effect_rate | ( | struct ratbag_led * | led, |
unsigned int | rate | ||
) |
If the LED's mode is RATBAG_LED_CYCLE or RATBAG_LED_BREATHING then this function sets the LED rate in Hz.
- Parameters
-
led A previously initialized ratbag LED rate Effect rate in hz, 100 - 20000
- Returns
- 0 on success or an error code otherwise.
- See also
- ratbag_led_get_effect_rate
◆ ratbag_led_set_mode()
enum ratbag_error_code ratbag_led_set_mode | ( | struct ratbag_led * | led, |
enum ratbag_led_mode | mode | ||
) |
this function sets the LED mode.
- Parameters
-
led A previously initialized ratbag LED mode LED mode ratbag_led_mode.
- Returns
- 0 on success or an error code otherwise.
- See also
- ratbag_led_get_mode
◆ ratbag_led_unref()
struct ratbag_led* ratbag_led_unref | ( | struct ratbag_led * | led | ) |
Dereference the ratbag led.
When the internal refcount reaches zero, all resources associated with this object are released. The object must be considered invalid once unref is called.
- Parameters
-
led A previously initialized ratbag led
- Returns
- Always NULL
◆ ratbag_profile_get_led()
struct ratbag_led* ratbag_profile_get_led | ( | struct ratbag_profile * | profile, |
unsigned int | index | ||
) |
Return a reference to the LED given by the index.
The order of the LEDs is device-specific though.
The LED is refcounted with an initial value of at least 1. Use ratbag_led_unref() to release the LED.
- Parameters
-
profile A previously initialized ratbag profile index The index of the LED
- Returns
- A LED context, or NULL if the LED does not exist.
- See also
- ratbag_device_get_profile