![]() |
Pico Led Controller 1.0.3
A project to control LEDs using Raspberry Pi Pico W
|
#include "led_controller.h"
#include <stdio.h>
#include <stdlib.h>
#include "urgb.h"
#include "hsv.h"
#include "ws2812b.h"
#include "light_state.h"
#include "wifi_credentials.h"
#include "generated/ws2812.pio.h"
#include "lwipopts.h"
#include "lwip/apps/httpd.h"
#include "ssi.h"
#include "cgi.h"
#include "ntp.h"
Go to the source code of this file.
Functions | |
void | connect_to_wifi () |
Connect to WiFi. More... | |
void | gpio_button_irq_handler (uint gpio, uint32_t events) |
GPIO button interrupt handler. More... | |
enum init_result_t | init () |
Init. More... | |
void | run_loop () |
Run loop. More... | |
Variables | |
volatile bool | light_state_toggle_request = false |
volatile bool | light_mode_toggle_request = false |
volatile bool | stop_flag = false |
volatile uint64_t | last_press_time = 0 |
void connect_to_wifi | ( | ) |
Connect to WiFi.
Function connects to WiFi using the SSID and password defined in the wifi_credentials.h file.
Definition at line 24 of file led_controller.c.
References BLINK_CODE_WIFI_CONNECTED, and BLINK_CODE_WIFI_CONNECTING.
Referenced by main().
void gpio_button_irq_handler | ( | uint | gpio, |
uint32_t | events | ||
) |
GPIO button interrupt handler.
Function handles button interrupts setting proper flags.
Definition at line 37 of file led_controller.c.
References DEBOUNCE_TIME_US, last_press_time, light_mode_toggle_request, light_state, light_state_toggle_request, LIGHT_TOGGLE_PIN, MODE_BUTTON_PIN, light_state_t::state, STOP_BUTTON_PIN, and stop_flag.
enum init_result_t init | ( | ) |
Init.
Function initializes the LED controller.
Definition at line 37 of file led_controller.c.
Referenced by main().
void run_loop | ( | ) |
Run loop.
Function runs the main loop of the LED controller.
Definition at line 119 of file led_controller.c.
References apply_breathing_effect(), apply_flashing_effect(), apply_rainbow_cycle_effect(), apply_rainbow_wheel_effect(), light_state_t::brightness, get_current_color(), light_state_t::light_mode, light_mode_toggle_request, light_state, light_state_toggle_request, MODE_BREATHING, MODE_FLASHING, MODE_RAINBOW_CYCLE, MODE_RAINBOW_WHEEL, NUM_PIXELS, light_state_t::state, stop_flag, toggle_light_mode(), toggle_light_state(), and turn_off_all().
Referenced by main().
volatile uint64_t last_press_time = 0 |
Definition at line 22 of file led_controller.c.
Referenced by gpio_button_irq_handler().
volatile bool light_mode_toggle_request = false |
Definition at line 20 of file led_controller.c.
Referenced by gpio_button_irq_handler(), and run_loop().
volatile bool light_state_toggle_request = false |
Definition at line 19 of file led_controller.c.
Referenced by gpio_button_irq_handler(), and run_loop().
volatile bool stop_flag = false |
Definition at line 21 of file led_controller.c.
Referenced by gpio_button_irq_handler(), main(), and run_loop().