/*
 * rgbled.h
 *
 *  Created on: Oct 13, 2024
 *      Author: true
 */

#ifndef USER_LED_RGBLED_H_
#define USER_LED_RGBLED_H_



#include <stdint.h>

#include "hsv2rgb.h"

#include "../comm/i2c.h"

#include "../hw/ch32sub.h"



#define RGBLED_COUNT            12

#define RGBLED_BRT_STANDARD     AW20X_IMAX_13_3MA
#define RGBLED_BRT_DIMMED       AW20X_IMAX_3_3MA



typedef struct LedProgram {
    char *name;
    void (*prog)(uint8_t *, uint16_t);
    const uint8_t * (*edit_disp)(uint8_t);        // index to menu entry
} LedProgram;



#define RGB_STR_UNUSED          rgb_str_unused
#define RGB_STR_RESERVED        rgb_str_reserved
#define RGB_STR_INCREMENT       rgb_str_increment
#define RGB_STR_DELAY           rgb_str_delay
#define RGB_STR_BRIGHTNESS      rgb_str_brightness

extern const uint8_t rgb_str_unused[];
extern const uint8_t rgb_str_reserved[];
extern const uint8_t rgb_str_increment[];
extern const uint8_t rgb_str_delay[];
extern const uint8_t rgb_str_brightness[];



extern const uint8_t rgb_map[RGBLED_COUNT];
extern const LedProgram rgb_pgm[6];

extern struct color_hsv hsv_out[RGBLED_COUNT];



void rgbled_init();

void rgbled_send();
void rgbled_runprog(uint8_t tick_ctr);

void rgbled_set_imax_normal();
void rgbled_set_imax_dim();



#endif /* USER_LED_RGBLED_H_ */

