Infuse-IoT SDK API 0.0.1
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
LP581x LED Controller API

Advanced LP581x LED Controller configuration. More...

Data Structures

struct  lp581x_animation_pattern
 LED pattern configuration. More...
struct  lp581x_animation_engine_config
 Configuration of a single engine. More...
struct  lp581x_animation_engines_config
 Configuration of all engines. More...

Macros

#define LP581X_MAX_LEDS   4
 Maximum number of LED channels.
#define LP581X_PATTERN_PLAY_FOREVER   0xF
 Repeat the pattern forever.

Enumerations

enum  lp581x_engine {
  LP581X_ENGINE_0 = 0 , LP581X_ENGINE_1 = 1 , LP581X_ENGINE_2 = 2 , LP581X_ENGINE_3 = 3 ,
  LP581X_NUM_ENGINES
}
enum  lp581x_pattern {
  LP581X_PATTERN_0 = 0 , LP581X_PATTERN_1 = 1 , LP581X_PATTERN_2 = 2 , LP581X_PATTERN_3 = 3 ,
  LP581X_NUM_PATTERNS , LP581X_PATTERN_SKIP = LP581X_NUM_PATTERNS
}
enum  lp581x_phase_duration {
  LP581X_PHASE_0_MS = 0x0 , LP581X_PHASE_50_MS = 0x1 , LP581X_PHASE_100_MS = 0x2 , LP581X_PHASE_150_MS = 0x3 ,
  LP581X_PHASE_200_MS = 0x4 , LP581X_PHASE_250_MS = 0x5 , LP581X_PHASE_300_MS = 0x6 , LP581X_PHASE_350_MS = 0x7 ,
  LP581X_PHASE_400_MS = 0x8 , LP581X_PHASE_450_MS = 0x9 , LP581X_PHASE_500_MS = 0xA , LP581X_PHASE_1000_MS = 0xB ,
  LP581X_PHASE_2000_MS = 0xC , LP581X_PHASE_4000_MS = 0xD , LP581X_PHASE_6000_MS = 0xE , LP581X_PHASE_8000_MS = 0xF ,
  _LP581X_PHASE_END
}
 Duration of an pattern phase. More...
enum  lp581x_animation_engine_repeats { LP581X_ENGINE_REPEAT_NONE = 0 , LP581X_ENGINE_REPEAT_ONCE = 1 , LP581X_ENGINE_REPEAT_TWICE = 2 , LP581X_ENGINE_REPEAT_FOREVER = 3 }
 Number of times the animation engine repeats the configured patterns. More...

Functions

int lp581x_animation_pattern_program (const struct device *dev, uint8_t pattern_idx, const struct lp581x_animation_pattern *pattern)
 Program an animation pattern to the LP581X.
int lp581x_animation_engines_configure (const struct device *dev, const struct lp581x_animation_engines_config *config)
 Configure LP581X animation engines.
int lp581x_animation_start (const struct device *dev, uint8_t led_bitmask)
 Start animations.
int lp581x_animation_stop (const struct device *dev)
 Stop animations.

Detailed Description

Advanced LP581x LED Controller configuration.

Macro Definition Documentation

◆ LP581X_MAX_LEDS

#define LP581X_MAX_LEDS   4

◆ LP581X_PATTERN_PLAY_FOREVER

#define LP581X_PATTERN_PLAY_FOREVER   0xF

Enumeration Type Documentation

◆ lp581x_animation_engine_repeats

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/drivers/led/lp581x.h>

Number of times the animation engine repeats the configured patterns.

Enumerator
LP581X_ENGINE_REPEAT_NONE 

Engine does not repeat the configured pattern (one total run)

LP581X_ENGINE_REPEAT_ONCE 

Engine repeats the configured pattern once (two total runs)

LP581X_ENGINE_REPEAT_TWICE 

Engine repeats the configured pattern twice (three total runs)

LP581X_ENGINE_REPEAT_FOREVER 

Engine repeats the configured pattern forever.

◆ lp581x_engine

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/drivers/led/lp581x.h>

Enumerator
LP581X_ENGINE_0 
LP581X_ENGINE_1 
LP581X_ENGINE_2 
LP581X_ENGINE_3 
LP581X_NUM_ENGINES 

Number of available engines.

◆ lp581x_pattern

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/drivers/led/lp581x.h>

Enumerator
LP581X_PATTERN_0 
LP581X_PATTERN_1 
LP581X_PATTERN_2 
LP581X_PATTERN_3 
LP581X_NUM_PATTERNS 

Number of available patterns.

LP581X_PATTERN_SKIP 

Skip pattern in this step.

◆ lp581x_phase_duration

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/drivers/led/lp581x.h>

Duration of an pattern phase.

Enumerator
LP581X_PHASE_0_MS 

No phase duration.

LP581X_PHASE_50_MS 

50ms duration

LP581X_PHASE_100_MS 

100ms duration

LP581X_PHASE_150_MS 

150ms duration

LP581X_PHASE_200_MS 

200ms duration

LP581X_PHASE_250_MS 

250ms duration

LP581X_PHASE_300_MS 

300ms duration

LP581X_PHASE_350_MS 

350ms duration

LP581X_PHASE_400_MS 

400ms duration

LP581X_PHASE_450_MS 

450ms duration

LP581X_PHASE_500_MS 

500ms duration

LP581X_PHASE_1000_MS 

1000ms duration

LP581X_PHASE_2000_MS 

2000ms duration

LP581X_PHASE_4000_MS 

4000ms duration

LP581X_PHASE_6000_MS 

6000ms duration

LP581X_PHASE_8000_MS 

8000ms duration

Function Documentation

◆ lp581x_animation_engines_configure()

int lp581x_animation_engines_configure ( const struct device * dev,
const struct lp581x_animation_engines_config * config )

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/drivers/led/lp581x.h>

Configure LP581X animation engines.

The LP581X devices have 4 independent programmable animation engines. Each engine has 4 steps, where each step runs a pattern programed by lp581x_animation_pattern_program.

Animation engines must be programmed before starting the animation.

Parameters
devLP581X device
configEngine configuration
Return values
0On success
-ENOTSUPPart variant does not support animations
-EINVALIf config has invalid values
-EBUSYIf animation engines are already running
-errnoOn failure

◆ lp581x_animation_pattern_program()

int lp581x_animation_pattern_program ( const struct device * dev,
uint8_t pattern_idx,
const struct lp581x_animation_pattern * pattern )

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/drivers/led/lp581x.h>

Program an animation pattern to the LP581X.

The LP581X devices have 4 programmable patterns, with each pattern being available to any of the animation engines. Any number of animation engines can use each pattern at the same time.

Animation patterns must be programmed before starting the animation.

Parameters
devLP581X device
pattern_idxPattern to program, 0 to 3
patternPattern configuration
Return values
0On success
-ENOTSUPPart variant does not support animations
-EINVALIf pattern_idx or pattern have invalid values
-EBUSYIf animation engines are already running
-errnoOn failure

◆ lp581x_animation_start()

int lp581x_animation_start ( const struct device * dev,
uint8_t led_bitmask )

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/drivers/led/lp581x.h>

Start animations.

Parameters
devLP581X device
led_bitmaskBitmask of LEDs that should be enabled
Return values
0On success
-ENOTSUPPart variant does not support animations
-EINVALIf led_bitmask has invalid values
-EBUSYIf animation engines are already running
-errnoOn failure

◆ lp581x_animation_stop()

int lp581x_animation_stop ( const struct device * dev)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/drivers/led/lp581x.h>

Stop animations.

Parameters
devLP581X device
Return values
0On success
-ENOTSUPPart variant does not support animations
-EAGAINAnimations are not currently running
-errnoOn failure