MCU_PIO: generic PIO driver with config-driven program loading, function-pointer init callbacks, blocking put, and DMA async put. ws2812.pio written from scratch — 800 kHz, 10 cycles/bit, side-set. HAL_LED: pixel buffer with intensity scaling, RGB byte order for RP2040-Zero WS2812 variant. SetColor immediately pushes the strip. APP_CLSW: rainbow HSV hue rotation on startup (auto-mode). Color commands (red/green/blue/off/rainbow) stop the rainbow and set the LED to a static color. Integer-only HSV-to-RGB conversion. CMake: added hardware_pio link and pico_generate_pio_header for ws2812.pio compilation. SYS_ECU init sequence updated.
51 lines
1.7 KiB
C
51 lines
1.7 KiB
C
/******************************************************************************
|
|
* File: HAL_LED_priv.h
|
|
* Component: HAL_LED
|
|
* Description: Private header — pixel struct, control struct with the
|
|
* pixel buffer, and extern config array declaration.
|
|
*
|
|
* Layer: HAL - internal use only
|
|
*****************************************************************************/
|
|
|
|
#ifndef HAL_LED_PRIV_H
|
|
#define HAL_LED_PRIV_H
|
|
|
|
#include "HAL_LED.h"
|
|
#include "HAL_LED_cfg.h"
|
|
|
|
extern const HAL_LED_tstrConfig HAL_LED_astrConfig[HAL_LED_NUM_INSTANCES];
|
|
|
|
/* ------------------------------------------------------------------------ */
|
|
/* PIXEL STRUCTURE */
|
|
/* ------------------------------------------------------------------------ */
|
|
|
|
/**
|
|
* @brief Per-LED color data in GRB order (matching WS2812 protocol).
|
|
*
|
|
* Stored after intensity scaling has been applied, so these values
|
|
* are the actual brightnesses sent to the hardware.
|
|
*/
|
|
typedef struct
|
|
{
|
|
u8 u8Green;
|
|
u8 u8Red;
|
|
u8 u8Blue;
|
|
} HAL_LED_tstrPixel;
|
|
|
|
/* ------------------------------------------------------------------------ */
|
|
/* CONTROL STRUCTURE */
|
|
/* ------------------------------------------------------------------------ */
|
|
|
|
/**
|
|
* @brief Internal runtime state for all HAL_LED instances.
|
|
*
|
|
* astrPixels is a 2D array: [instance][led_index]. Each pixel holds
|
|
* the intensity-scaled GRB values ready to be packed into 32-bit words
|
|
* for the PIO FIFO.
|
|
*/
|
|
typedef struct
|
|
{
|
|
HAL_LED_tstrPixel astrPixels[HAL_LED_NUM_INSTANCES][HAL_LED_MAX_LEDS_PER_INSTANCE];
|
|
} HAL_LED_tstrControl;
|
|
|
|
#endif /* HAL_LED_PRIV_H */ |