![]() |
Pico Led Controller 1.0.3
A project to control LEDs using Raspberry Pi Pico W
|
#include <stdio.h>
#include <stdbool.h>
#include <stdint.h>
Go to the source code of this file.
Functions | |
static void | put_pixel (uint32_t pixel_grb) |
Put pixel to the LED strip. More... | |
void | set_all_leds (uint32_t color, uint32_t len) |
Set all leds to the same color. More... | |
void | turn_off_all (uint32_t len) |
Turn off all leds. More... | |
uint32_t | get_red (uint8_t brightness) |
Get red color. More... | |
uint32_t | get_green (uint8_t brightness) |
Get green color. More... | |
uint32_t | get_blue (uint8_t brightness) |
Get blue color. More... | |
uint32_t | get_white (uint8_t brightness) |
Get white color. More... | |
uint32_t | get_purple (uint8_t brightness) |
Get purple color. More... | |
uint32_t | get_yellow (uint8_t brightness) |
Get yellow color. More... | |
uint32_t | get_cyan (uint8_t brightness) |
Get cyan color. More... | |
uint32_t | get_orange (uint8_t brightness) |
Get orange color. More... | |
uint32_t | get_pink (uint8_t brightness) |
Get pink color. More... | |
uint32_t | get_turquoise (uint8_t brightness) |
Get turquoise color. More... | |
uint32_t | get_magenta (uint8_t brightness) |
Get magenta color. More... | |
void | set_all_red (uint32_t len, uint8_t brightness) |
Set all leds to red. More... | |
void | set_all_green (uint32_t len, uint8_t brightness) |
Set all leds to green. More... | |
void | set_all_blue (uint32_t len, uint8_t brightness) |
Set all leds to blue. More... | |
void | set_all_white (uint32_t len, uint8_t brightness) |
Set all leds to white. More... | |
void | set_rainbow_spectrum (uint32_t len) |
Set all leds to rainbow spectrum. More... | |
void | set_all_purple (uint32_t len, uint8_t brightness) |
Set all leds purple. More... | |
void | set_all_yellow (uint32_t len, uint8_t brightness) |
Set all leds yellow. More... | |
void | set_all_cyan (uint32_t len, uint8_t brightness) |
Set all leds cyan. More... | |
void | set_all_orange (uint32_t len, uint8_t brightness) |
Set all leds orange. More... | |
void | set_all_pink (uint32_t len, uint8_t brightness) |
Set all leds pink. More... | |
void | set_all_turquoise (uint32_t len, uint8_t brightness) |
Set all leds turquoise. More... | |
void | set_all_magenta (uint32_t len, uint8_t brightness) |
Set all leds magenta. More... | |
void | apply_rainbow_wheel_effect (uint32_t len, uint16_t *base_hue, uint8_t *speed_factor, uint8_t *density_factor, volatile uint8_t *brightness) |
Apply rainbow wheel effect. More... | |
void | apply_rainbow_cycle_effect (uint32_t len, uint16_t *hue, uint8_t *speed_factor, volatile uint8_t *brightness) |
Apply rainbow cycle effect. More... | |
void | apply_breathing_effect (uint32_t len, uint8_t *speed_factor, uint32_t *color, volatile uint8_t *base_brightness, uint8_t *brightness, bool *breathing_up) |
Apply breathing effect. More... | |
void | apply_flashing_effect (uint32_t len, uint32_t *color) |
Apply flashing effect. More... | |
void apply_breathing_effect | ( | uint32_t | len, |
uint8_t * | speed_factor, | ||
uint32_t * | color, | ||
volatile uint8_t * | base_brightness, | ||
uint8_t * | brightness, | ||
bool * | breathing_up | ||
) |
Apply breathing effect.
len | number of leds |
speed_factor | speed factor |
color | color |
base_brightness | base brightness |
brightness | brightness |
breathing_up | breathing up |
Definition at line 184 of file ws2812b.c.
References put_pixel(), URGB, URGB_B, URGB_G, and URGB_R.
Referenced by run_loop().
void apply_flashing_effect | ( | uint32_t | len, |
uint32_t * | color | ||
) |
Apply flashing effect.
len | number of leds |
led_values | led values |
color | color |
Definition at line 214 of file ws2812b.c.
References put_pixel(), URGB, URGB_B, URGB_G, and URGB_R.
Referenced by run_loop().
void apply_rainbow_cycle_effect | ( | uint32_t | len, |
uint16_t * | hue, | ||
uint8_t * | speed_factor, | ||
volatile uint8_t * | brightness | ||
) |
Apply rainbow cycle effect.
len | number of leds |
hue | hue |
speed_factor | speed factor |
brightness | brightness |
Definition at line 174 of file ws2812b.c.
References hsv_to_rgb(), and put_pixel().
Referenced by run_loop().
void apply_rainbow_wheel_effect | ( | uint32_t | len, |
uint16_t * | base_hue, | ||
uint8_t * | speed_factor, | ||
uint8_t * | density_factor, | ||
volatile uint8_t * | brightness | ||
) |
Apply rainbow wheel effect.
len | number of leds |
base_hue | base hue |
speed_factor | speed factor |
density_factor | density factor |
brightness | brightness |
Definition at line 160 of file ws2812b.c.
References hsv_to_rgb(), and put_pixel().
Referenced by run_loop().
uint32_t get_blue | ( | uint8_t | brightness | ) |
Get blue color.
brightness | brightness |
Definition at line 40 of file ws2812b.c.
References URGB.
Referenced by get_current_color().
uint32_t get_cyan | ( | uint8_t | brightness | ) |
Get cyan color.
brightness | brightness |
Definition at line 60 of file ws2812b.c.
References URGB.
Referenced by get_current_color().
uint32_t get_green | ( | uint8_t | brightness | ) |
Get green color.
brightness | brightness |
Definition at line 35 of file ws2812b.c.
References URGB.
Referenced by get_current_color().
uint32_t get_magenta | ( | uint8_t | brightness | ) |
Get magenta color.
brightness | brightness |
Definition at line 80 of file ws2812b.c.
References URGB.
Referenced by get_current_color().
uint32_t get_orange | ( | uint8_t | brightness | ) |
Get orange color.
brightness | brightness |
Definition at line 65 of file ws2812b.c.
References URGB.
Referenced by get_current_color().
uint32_t get_pink | ( | uint8_t | brightness | ) |
Get pink color.
brightness | brightness |
Definition at line 70 of file ws2812b.c.
References URGB.
Referenced by get_current_color().
uint32_t get_purple | ( | uint8_t | brightness | ) |
Get purple color.
brightness | brightness |
Definition at line 50 of file ws2812b.c.
References URGB.
Referenced by get_current_color().
uint32_t get_red | ( | uint8_t | brightness | ) |
Get red color.
brightness | brightness |
Definition at line 30 of file ws2812b.c.
References URGB.
Referenced by get_current_color().
uint32_t get_turquoise | ( | uint8_t | brightness | ) |
Get turquoise color.
brightness | brightness |
Definition at line 75 of file ws2812b.c.
References URGB.
Referenced by get_current_color().
uint32_t get_white | ( | uint8_t | brightness | ) |
Get white color.
brightness | brightness |
Definition at line 45 of file ws2812b.c.
References URGB.
Referenced by get_current_color().
uint32_t get_yellow | ( | uint8_t | brightness | ) |
Get yellow color.
brightness | brightness |
Definition at line 55 of file ws2812b.c.
References URGB.
Referenced by get_current_color().
|
inlinestatic |
Put pixel to the LED strip.
pixel_grb | pixel color in GRB format |
void set_all_blue | ( | uint32_t | len, |
uint8_t | brightness | ||
) |
Set all leds to blue.
len | number of leds |
brightness | brightness |
Definition at line 97 of file ws2812b.c.
References set_all_leds(), and URGB.
Referenced by set_light_color().
void set_all_cyan | ( | uint32_t | len, |
uint8_t | brightness | ||
) |
Set all leds cyan.
len | number of leds |
brightness | brightness |
Definition at line 121 of file ws2812b.c.
References set_all_leds(), and URGB.
Referenced by set_light_color().
void set_all_green | ( | uint32_t | len, |
uint8_t | brightness | ||
) |
Set all leds to green.
len | number of leds |
brightness | brightness |
Definition at line 91 of file ws2812b.c.
References set_all_leds(), and URGB.
Referenced by set_light_color().
void set_all_leds | ( | uint32_t | color, |
uint32_t | len | ||
) |
Set all leds to the same color.
color | color in RGB format |
len | number of leds |
Definition at line 15 of file ws2812b.c.
References put_pixel().
Referenced by 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 turn_off_all().
void set_all_magenta | ( | uint32_t | len, |
uint8_t | brightness | ||
) |
Set all leds magenta.
len | number of leds |
brightness | brightness |
Definition at line 145 of file ws2812b.c.
References set_all_leds(), and URGB.
Referenced by set_light_color().
void set_all_orange | ( | uint32_t | len, |
uint8_t | brightness | ||
) |
Set all leds orange.
len | number of leds |
brightness | brightness |
Definition at line 127 of file ws2812b.c.
References set_all_leds(), and URGB.
Referenced by set_light_color().
void set_all_pink | ( | uint32_t | len, |
uint8_t | brightness | ||
) |
Set all leds pink.
len | number of leds |
brightness | brightness |
Definition at line 133 of file ws2812b.c.
References set_all_leds(), and URGB.
Referenced by set_light_color().
void set_all_purple | ( | uint32_t | len, |
uint8_t | brightness | ||
) |
Set all leds purple.
len | number of leds |
brightness | brightness |
Definition at line 109 of file ws2812b.c.
References set_all_leds(), and URGB.
Referenced by set_light_color().
void set_all_red | ( | uint32_t | len, |
uint8_t | brightness | ||
) |
Set all leds to red.
len | number of leds |
brightness | brightness |
Definition at line 85 of file ws2812b.c.
References set_all_leds(), and URGB.
Referenced by set_light_color().
void set_all_turquoise | ( | uint32_t | len, |
uint8_t | brightness | ||
) |
Set all leds turquoise.
len | number of leds |
brightness | brightness |
Definition at line 139 of file ws2812b.c.
References set_all_leds(), and URGB.
Referenced by set_light_color().
void set_all_white | ( | uint32_t | len, |
uint8_t | brightness | ||
) |
Set all leds to white.
len | number of leds |
brightness | brightness |
Definition at line 103 of file ws2812b.c.
References set_all_leds(), and URGB.
Referenced by set_light_color().
void set_all_yellow | ( | uint32_t | len, |
uint8_t | brightness | ||
) |
Set all leds yellow.
len | number of leds |
brightness | brightness |
Definition at line 115 of file ws2812b.c.
References set_all_leds(), and URGB.
Referenced by set_light_color().
void set_rainbow_spectrum | ( | uint32_t | len | ) |
Set all leds to rainbow spectrum.
len | number of leds |
Definition at line 151 of file ws2812b.c.
References hsv_to_rgb(), and put_pixel().
void turn_off_all | ( | uint32_t | len | ) |
Turn off all leds.
len | number of leds |
Definition at line 23 of file ws2812b.c.
References set_all_leds(), and URGB.
Referenced by cgi_led_brightness_handler(), cgi_led_handler(), run_loop(), and toggle_light_state().