![]() |
Pico Led Controller 1.0.3
A project to control LEDs using Raspberry Pi Pico W
|
Go to the source code of this file.
Data Structures | |
struct | light_state_t |
Light state struct. More... | |
Macros | |
#define | NUM_PIXELS 120 |
#define | NUM_LIGHT_MODES 8 |
#define | NUM_LIGHT_COLORS 11 |
Enumerations | |
enum | light_modes { MODE_RAINBOW_WHEEL , MODE_RAINBOW_CYCLE , MODE_STATIC , MODE_BREATHING , MODE_FLASHING , MODE_LOADING , MODE_WAVE , MODE_FADE } |
Light modes enum. More... | |
enum | light_colors { COLOR_RED , COLOR_GREEN , COLOR_BLUE , COLOR_CYAN , COLOR_YELLOW , COLOR_MAGENTA , COLOR_PURPLE , COLOR_ORANGE , COLOR_TURQUOISE , COLOR_PINK , COLOR_WHITE } |
Light colors enum. More... | |
Functions | |
void | toggle_light_state () |
Toggle light state. More... | |
void | toggle_light_mode () |
Toggle light mode. More... | |
void | toggle_light_color () |
Toggle light color. More... | |
void | set_light_mode (enum light_modes mode) |
Set light mode. More... | |
void | set_light_color (enum light_colors color) |
Set light color. More... | |
uint32_t | get_current_color () |
Get current color. More... | |
Variables | |
volatile struct light_state_t | light_state |
Light state. More... | |
#define NUM_LIGHT_COLORS 11 |
Definition at line 6 of file light_state.h.
#define NUM_LIGHT_MODES 8 |
Definition at line 5 of file light_state.h.
#define NUM_PIXELS 120 |
Definition at line 4 of file light_state.h.
enum light_colors |
Light colors enum.
Enum for the light colors.
Enumerator | |
---|---|
COLOR_RED | |
COLOR_GREEN | |
COLOR_BLUE | |
COLOR_CYAN | |
COLOR_YELLOW | |
COLOR_MAGENTA | |
COLOR_PURPLE | |
COLOR_ORANGE | |
COLOR_TURQUOISE | |
COLOR_PINK | |
COLOR_WHITE |
Definition at line 32 of file light_state.h.
enum light_modes |
Light modes enum.
Enum for the light modes.
Enumerator | |
---|---|
MODE_RAINBOW_WHEEL | |
MODE_RAINBOW_CYCLE | |
MODE_STATIC | |
MODE_BREATHING | |
MODE_FLASHING | |
MODE_LOADING | |
MODE_WAVE | |
MODE_FADE |
Definition at line 17 of file light_state.h.
uint32_t get_current_color | ( | ) |
Get current color.
Function gets the current color.
Definition at line 116 of file light_state.c.
References light_state_t::brightness, light_state_t::color, COLOR_BLUE, COLOR_CYAN, COLOR_GREEN, COLOR_MAGENTA, COLOR_ORANGE, COLOR_PINK, COLOR_PURPLE, COLOR_RED, COLOR_TURQUOISE, COLOR_WHITE, COLOR_YELLOW, get_blue(), get_cyan(), get_green(), get_magenta(), get_orange(), get_pink(), get_purple(), get_red(), get_turquoise(), get_white(), get_yellow(), and light_state.
Referenced by run_loop().
void set_light_color | ( | enum light_colors | color | ) |
Set light color.
Function sets the light mode to the specified color.
color | color |
Definition at line 68 of file light_state.c.
References light_state_t::brightness, light_state_t::color, COLOR_BLUE, COLOR_CYAN, COLOR_GREEN, COLOR_MAGENTA, COLOR_ORANGE, COLOR_PINK, COLOR_PURPLE, COLOR_RED, COLOR_TURQUOISE, COLOR_WHITE, COLOR_YELLOW, light_state_t::light_mode, light_state, MODE_STATIC, NUM_PIXELS, set_all_blue(), set_all_cyan(), set_all_green(), set_all_magenta(), set_all_orange(), set_all_pink(), set_all_purple(), set_all_red(), set_all_turquoise(), set_all_white(), set_all_yellow(), and light_state_t::state.
Referenced by cgi_led_brightness_handler(), cgi_led_color_handler(), set_light_mode(), and toggle_light_color().
void set_light_mode | ( | enum light_modes | mode | ) |
Set light mode.
Function sets the light mode to the specified mode.
mode | mode |
Definition at line 31 of file light_state.c.
References light_state_t::brightness, light_state_t::color, light_state_t::light_mode, light_state, MODE_BREATHING, MODE_FADE, MODE_FLASHING, MODE_LOADING, MODE_RAINBOW_CYCLE, MODE_RAINBOW_WHEEL, MODE_STATIC, MODE_WAVE, set_light_color(), and light_state_t::state.
Referenced by cgi_led_mode_handler(), toggle_light_mode(), and toggle_light_state().
void toggle_light_color | ( | ) |
Toggle light color.
Function toggles the light color iterating through the light colors.
Definition at line 25 of file light_state.c.
References light_state_t::color, light_state, NUM_LIGHT_COLORS, and set_light_color().
void toggle_light_mode | ( | ) |
Toggle light mode.
Function toggles the light mode iterating through the light modes.
Definition at line 19 of file light_state.c.
References light_state_t::light_mode, light_state, NUM_LIGHT_MODES, and set_light_mode().
Referenced by run_loop().
void toggle_light_state | ( | ) |
Toggle light state.
Function toggles on/off the light state.
Definition at line 10 of file light_state.c.
References light_state_t::brightness, light_state_t::light_mode, light_state, NUM_PIXELS, set_light_mode(), light_state_t::state, and turn_off_all().
Referenced by cgi_led_handler(), led_blink(), and run_loop().
|
extern |
Light state.
External, not optimized variable for the light state.
Definition at line 1 of file light_state.c.
Referenced by cgi_led_brightness_handler(), cgi_led_color_handler(), cgi_led_handler(), cgi_led_mode_handler(), get_current_color(), gpio_button_irq_handler(), run_loop(), set_light_color(), set_light_mode(), ssi_handler(), toggle_light_color(), toggle_light_mode(), and toggle_light_state().