#include "system/includes.h"
#include "app_config.h"
#include "user_cfg.h"
#include "color_led_app.h"
#include "color_led_table.h"

const color_cell_t color_table_demo1[] = {
    COLOR_TYPE_COLOR_INIT(0, 300, COLOR_RED),
    COLOR_TYPE_BREATH_INIT(0, 0, 0x00003000, BREATH_RGB_SEL(0, GREEN_EN, 0), BREATH_RGB_DIR_UP(0, 0, 0), 10, 1, 0x10, 0xff),

    COLOR_END(),
};
COLOR_TABLE_REGISTER(color_table_demo1);

/*stage*/
const color_cell_t color_table_stage[] = {
    COLOR_TYPE_COLOR_INIT(0, 300, COLOR_RED),
    COLOR_TYPE_BREATH_MEASURE_BY_STEP_INIT(0, 0xef, 0x00003000, BREATH_RGB_SEL(0, GREEN_EN, 0), BREATH_RGB_DIR_UP(0, 0, 0), 5, 1, 0x10, 0xff),
    COLOR_TYPE_BREATH_MEASURE_BY_STEP_INIT(0, 0xef, 0x00300000, BREATH_RGB_SEL(BLUE_EN, 0, 0), BREATH_RGB_DIR_UP(0, 0, 0), 5, 1, 0x10, 0xff),
    COLOR_TYPE_COLOR_INIT(0, TWINKLE_FAST_FRE, COLOR_RED),
    COLOR_TYPE_COLOR_INIT(0, TWINKLE_FAST_FRE, COLOR_BLACK),
    COLOR_TYPE_COLOR_INIT(0, TWINKLE_FAST_FRE, COLOR_ORANGE),
    COLOR_TYPE_COLOR_INIT(0, TWINKLE_FAST_FRE, COLOR_BLACK),
    COLOR_TYPE_COLOR_INIT(0, TWINKLE_FAST_FRE, COLOR_YELLOW),
    COLOR_TYPE_COLOR_INIT(0, TWINKLE_FAST_FRE, COLOR_BLACK),
    COLOR_TYPE_BREATH_MEASURE_BY_STEP_INIT(0, 0xff, 0x000000ff, BREATH_RGB_SEL(RED_EN, GREEN_EN, 0), BREATH_RGB_DIR_UP(0, GREEN_EN, 0), 20, 1, 0x00, 0xff),
    COLOR_TYPE_COLOR_INIT(0, TWINKLE_FAST_FRE, COLOR_GREEN),
    COLOR_TYPE_COLOR_INIT(0, TWINKLE_FAST_FRE, COLOR_BLACK),
    COLOR_TYPE_COLOR_INIT(0, TWINKLE_FAST_FRE, COLOR_CYAN),
    COLOR_TYPE_COLOR_INIT(0, TWINKLE_FAST_FRE, COLOR_BLACK),
    COLOR_TYPE_COLOR_INIT(0, TWINKLE_FAST_FRE, COLOR_BLUE),
    COLOR_TYPE_COLOR_INIT(0, TWINKLE_FAST_FRE, COLOR_BLACK),
    COLOR_TYPE_COLOR_INIT(0, TWINKLE_FAST_FRE, COLOR_PURPLE),
    COLOR_TYPE_COLOR_INIT(0, TWINKLE_FAST_FRE, COLOR_BLACK),

    COLOR_TYPE_BREATH_INIT(0, 2000, 0x0aa3030, BREATH_RGB_SEL(RED_EN, GREEN_EN, BLUE_EN), BREATH_RGB_DIR_UP(RED_EN, 0, 0), 20, 1, 0x10, 0xff),
    COLOR_TYPE_LOOP_INIT(0/*back to step zero*/, 0xffffffff),

    COLOR_END(),
};
COLOR_TABLE_REGISTER(color_table_stage);

/*light*/
const color_cell_t color_table_light_base[] = {
    COLOR_TYPE_COLOR_INIT(0, 0, COLOR_RED),

    COLOR_END(),
};
COLOR_TABLE_REGISTER(color_table_light_base);

/*colorful twinkle base*/
const color_cell_t color_table_twinkle_base[] = {
    COLOR_TYPE_COLOR_INIT(0, TWINKLE_SLOW_FRE, COLOR_RED),
    COLOR_TYPE_COLOR_INIT(0, TWINKLE_SLOW_FRE, COLOR_BLACK),

    COLOR_TYPE_LOOP_INIT(0/*back to step zero*/, 0xffffffff),
    COLOR_END(),
};
COLOR_TABLE_REGISTER(color_table_twinkle_base);

/*colorful twinkle slow*/
const color_cell_t color_table_colorful_twinkle_slow[] = {
    COLOR_TYPE_COLOR_INIT(COLOR_RED		, TWINKLE_SLOW_FRE, COLOR_RED),
    COLOR_TYPE_COLOR_INIT(COLOR_BLACK	, TWINKLE_SLOW_FRE, COLOR_BLACK),
    COLOR_TYPE_COLOR_INIT(COLOR_ORANGE	, TWINKLE_SLOW_FRE, COLOR_ORANGE),
    COLOR_TYPE_COLOR_INIT(COLOR_BLACK	, TWINKLE_SLOW_FRE, COLOR_BLACK),
    COLOR_TYPE_COLOR_INIT(COLOR_YELLOW	, TWINKLE_SLOW_FRE, COLOR_YELLOW),
    COLOR_TYPE_COLOR_INIT(COLOR_BLACK	, TWINKLE_SLOW_FRE, COLOR_BLACK),
    COLOR_TYPE_COLOR_INIT(COLOR_GREEN	, TWINKLE_SLOW_FRE, COLOR_GREEN),
    COLOR_TYPE_COLOR_INIT(COLOR_BLACK	, TWINKLE_SLOW_FRE, COLOR_BLACK),
    COLOR_TYPE_COLOR_INIT(COLOR_CYAN	, TWINKLE_SLOW_FRE, COLOR_CYAN),
    COLOR_TYPE_COLOR_INIT(COLOR_BLACK	, TWINKLE_SLOW_FRE, COLOR_BLACK),
    COLOR_TYPE_COLOR_INIT(COLOR_BLUE	, TWINKLE_SLOW_FRE, COLOR_BLUE),
    COLOR_TYPE_COLOR_INIT(COLOR_BLACK	, TWINKLE_SLOW_FRE, COLOR_BLACK),
    COLOR_TYPE_COLOR_INIT(COLOR_PURPLE	, TWINKLE_SLOW_FRE, COLOR_PURPLE),
    COLOR_TYPE_COLOR_INIT(COLOR_BLACK	, TWINKLE_SLOW_FRE, COLOR_BLACK),

    COLOR_TYPE_LOOP_INIT(0/*back to step zero*/, 0xffffffff),
    COLOR_END(),
};
COLOR_TABLE_REGISTER(color_table_colorful_twinkle_slow);

/*colorful twinkle middle*/
const color_cell_t color_table_colorful_twinkle_mid[] = {
    COLOR_TYPE_COLOR_INIT(COLOR_RED		, TWINKLE_MID_FRE, COLOR_RED),
    COLOR_TYPE_COLOR_INIT(COLOR_BLACK	, TWINKLE_MID_FRE, COLOR_BLACK),
    COLOR_TYPE_COLOR_INIT(COLOR_ORANGE	, TWINKLE_MID_FRE, COLOR_ORANGE),
    COLOR_TYPE_COLOR_INIT(COLOR_BLACK	, TWINKLE_MID_FRE, COLOR_BLACK),
    COLOR_TYPE_COLOR_INIT(COLOR_YELLOW	, TWINKLE_MID_FRE, COLOR_YELLOW),
    COLOR_TYPE_COLOR_INIT(COLOR_BLACK	, TWINKLE_MID_FRE, COLOR_BLACK),
    COLOR_TYPE_COLOR_INIT(COLOR_GREEN	, TWINKLE_MID_FRE, COLOR_GREEN),
    COLOR_TYPE_COLOR_INIT(COLOR_BLACK	, TWINKLE_MID_FRE, COLOR_BLACK),
    COLOR_TYPE_COLOR_INIT(COLOR_CYAN	, TWINKLE_MID_FRE, COLOR_CYAN),
    COLOR_TYPE_COLOR_INIT(COLOR_BLACK	, TWINKLE_MID_FRE, COLOR_BLACK),
    COLOR_TYPE_COLOR_INIT(COLOR_BLUE	, TWINKLE_MID_FRE, COLOR_BLUE),
    COLOR_TYPE_COLOR_INIT(COLOR_BLACK	, TWINKLE_MID_FRE, COLOR_BLACK),
    COLOR_TYPE_COLOR_INIT(COLOR_PURPLE	, TWINKLE_MID_FRE, COLOR_PURPLE),
    COLOR_TYPE_COLOR_INIT(COLOR_BLACK	, TWINKLE_MID_FRE, COLOR_BLACK),

    COLOR_TYPE_LOOP_INIT(0/*back to step zero*/, 0xffffffff),
    COLOR_END(),
};
COLOR_TABLE_REGISTER(color_table_colorful_twinkle_mid);

/*colorful twinkle fast*/
const color_cell_t color_table_colorful_twinkle_fast[] = {
    COLOR_TYPE_COLOR_INIT(COLOR_RED		, TWINKLE_FAST_FRE, COLOR_RED),
    COLOR_TYPE_COLOR_INIT(COLOR_BLACK	, TWINKLE_FAST_FRE, COLOR_BLACK),
    COLOR_TYPE_COLOR_INIT(COLOR_ORANGE	, TWINKLE_FAST_FRE, COLOR_ORANGE),
    COLOR_TYPE_COLOR_INIT(COLOR_BLACK	, TWINKLE_FAST_FRE, COLOR_BLACK),
    COLOR_TYPE_COLOR_INIT(COLOR_YELLOW	, TWINKLE_FAST_FRE, COLOR_YELLOW),
    COLOR_TYPE_COLOR_INIT(COLOR_BLACK	, TWINKLE_FAST_FRE, COLOR_BLACK),
    COLOR_TYPE_COLOR_INIT(COLOR_GREEN	, TWINKLE_FAST_FRE, COLOR_GREEN),
    COLOR_TYPE_COLOR_INIT(COLOR_BLACK	, TWINKLE_FAST_FRE, COLOR_BLACK),
    COLOR_TYPE_COLOR_INIT(COLOR_CYAN	, TWINKLE_FAST_FRE, COLOR_CYAN),
    COLOR_TYPE_COLOR_INIT(COLOR_BLACK	, TWINKLE_FAST_FRE, COLOR_BLACK),
    COLOR_TYPE_COLOR_INIT(COLOR_BLUE	, TWINKLE_FAST_FRE, COLOR_BLUE),
    COLOR_TYPE_COLOR_INIT(COLOR_BLACK	, TWINKLE_FAST_FRE, COLOR_BLACK),
    COLOR_TYPE_COLOR_INIT(COLOR_PURPLE	, TWINKLE_FAST_FRE, COLOR_PURPLE),
    COLOR_TYPE_COLOR_INIT(COLOR_BLACK	, TWINKLE_FAST_FRE, COLOR_BLACK),

    COLOR_TYPE_LOOP_INIT(0/*back to step zero*/, 0xffffffff),
    COLOR_END(),
};
COLOR_TABLE_REGISTER(color_table_colorful_twinkle_fast);
/*colorful twinkle pause*/
const color_cell_t color_table_colorful_twinkle_pause[] = {
    COLOR_TYPE_COLOR_INIT(0, 0, COLOR_GREEN),

    COLOR_END(),
};
COLOR_TABLE_REGISTER(color_table_colorful_twinkle_pause);

/*nice emotion*/
const color_cell_t color_table_sunset[] = {
    COLOR_TYPE_BREATH_MEASURE_BY_STEP_INIT(0, 0x90, 0x00009999, BREATH_RGB_SEL(RED_EN, GREEN_EN, 0), BREATH_RGB_DIR_UP(0, 0, 0), 100, 1, 0x00, 0xff),
    COLOR_TYPE_COLOR_INIT(0, 2000, COLOR_BLACK),
    COLOR_TYPE_LOOP_INIT(0/*back to step zero*/, 0xffffffff),
    COLOR_END(),
};
COLOR_TABLE_REGISTER(color_table_sunset);

/*nice emotion*/
const color_cell_t color_table_nice_emotion[] = {
    COLOR_TYPE_BREATH_MEASURE_BY_STEP_INIT(0, 0x50, 0x0000ff00, BREATH_RGB_SEL(RED_EN, GREEN_EN, 0), BREATH_RGB_DIR_UP(RED_EN, 0, 0), 100, 1, 0x00, 0xff),
    COLOR_TYPE_BREATH_MEASURE_BY_STEP_INIT(0, 0x50, 0x0000af50, BREATH_RGB_SEL(RED_EN, GREEN_EN, 0), BREATH_RGB_DIR_UP(0, GREEN_EN, 0), 100, 1, 0x00, 0xff),
    COLOR_TYPE_BREATH_MEASURE_BY_STEP_INIT(0, 0x50, 0x0000ff00, BREATH_RGB_SEL(0, GREEN_EN, BLUE_EN), BREATH_RGB_DIR_UP(0, 0, BLUE_EN), 100, 1, 0x00, 0xff),
    COLOR_TYPE_BREATH_MEASURE_BY_STEP_INIT(0, 0x50, 0x0050af00, BREATH_RGB_SEL(0, GREEN_EN, BLUE_EN), BREATH_RGB_DIR_UP(0, GREEN_EN, 0), 100, 1, 0x00, 0xff),

    COLOR_TYPE_BREATH_MEASURE_BY_STEP_INIT(0, 0x50, 0x0000ff00, BREATH_RGB_SEL(RED_EN, GREEN_EN, BLUE_EN), BREATH_RGB_DIR_UP(RED_EN, 0, BLUE_EN), 100, 1, 0x00, 0xff),
    COLOR_TYPE_BREATH_MEASURE_BY_STEP_INIT(0, 0x50, 0x0050af50, BREATH_RGB_SEL(RED_EN, GREEN_EN, BLUE_EN), BREATH_RGB_DIR_UP(0, GREEN_EN, 0), 100, 1, 0x00, 0xff),

    COLOR_TYPE_LOOP_INIT(0/*back to step zero*/, 0xffffffff),
    COLOR_END(),
};
COLOR_TABLE_REGISTER(color_table_nice_emotion);

/*blue breath*/
const color_cell_t color_table_blue_breath[] = {
    COLOR_TYPE_BREATH_INIT(0, 0, 0x00300000, BREATH_RGB_SEL(0, 0, BLUE_EN), BREATH_RGB_DIR_UP(0, 0, 0), 20, 1, 0x10, 0xff),
    COLOR_TYPE_LOOP_INIT(0/*back to step zero*/, 0xffffffff),
    COLOR_END(),
};
COLOR_TABLE_REGISTER(color_table_blue_breath);

/*green breath*/
const color_cell_t color_table_green_breath[] = {
    COLOR_TYPE_BREATH_INIT(0, 0, 0x00003000, BREATH_RGB_SEL(0, GREEN_EN, 0), BREATH_RGB_DIR_UP(0, 0, 0), 20, 1, 0x10, 0xff),
    COLOR_TYPE_LOOP_INIT(0/*back to step zero*/, 0xffffffff),
    COLOR_END(),
};
COLOR_TABLE_REGISTER(color_table_green_breath);

/*red breath*/
const color_cell_t color_table_red_breath[] = {
    COLOR_TYPE_BREATH_INIT(0, 0, 0x00000030, BREATH_RGB_SEL(RED_EN, 0, 0), BREATH_RGB_DIR_UP(0, 0, 0), 20, 1, 0x10, 0xff),
    COLOR_TYPE_LOOP_INIT(0/*back to step zero*/, 0xffffffff),
    COLOR_END(),
};
COLOR_TABLE_REGISTER(color_table_red_breath);

/*wonderful breath*/
const color_cell_t color_table_wonderful_breath[] = {
    COLOR_TYPE_BREATH_MEASURE_BY_STEP_INIT(0, 0xff, 0x000000ff, BREATH_RGB_SEL(RED_EN, GREEN_EN, 0), BREATH_RGB_DIR_UP(0, GREEN_EN, 0), 20, 1, 0x00, 0xff),
    COLOR_TYPE_BREATH_MEASURE_BY_STEP_INIT(0, 0xff, 0x0000ff00, BREATH_RGB_SEL(0, GREEN_EN, BLUE_EN), BREATH_RGB_DIR_UP(0, 0, BLUE_EN), 20, 1, 0x00, 0xff),
    COLOR_TYPE_BREATH_MEASURE_BY_STEP_INIT(0, 0xff, 0x00ff0000, BREATH_RGB_SEL(RED_EN, 0, BLUE_EN), BREATH_RGB_DIR_UP(RED_EN, 0, 0), 20, 1, 0x00, 0xff),
    COLOR_TYPE_LOOP_INIT(0/*back to step zero*/, 0xffffffff),
    COLOR_END(),
};
COLOR_TABLE_REGISTER(color_table_wonderful_breath);

/*night light*/
const color_cell_t color_table_nightlight[] = {
    COLOR_TYPE_COLOR_INIT(0, 0, COLOR_WHITE),
    COLOR_END(),
};
COLOR_TABLE_REGISTER(color_table_nightlight);

/*candle light*/
const color_cell_t color_table_candlelight[] = {
    COLOR_TYPE_BREATH_INIT(0, 0, COLOR_YELLOW, BREATH_RGB_SEL(RED_EN, GREEN_EN, 0), BREATH_RGB_DIR_UP(RED_EN, 0, 0), 10000, 1, 0xf0, 0xff),
    COLOR_END(),
};
COLOR_TABLE_REGISTER(color_table_candlelight);

/*heart beat*/
const color_cell_t color_table_heartbeat[] = {
    COLOR_TYPE_COLOR_INIT(0, 1000, COLOR_RED - 0x60),
    COLOR_TYPE_COLOR_INIT(0, 2000, COLOR_BLACK),
    COLOR_TYPE_COLOR_INIT(0, 900, COLOR_RED - 0x50),
    COLOR_TYPE_COLOR_INIT(0, 1500, COLOR_BLACK),
    COLOR_TYPE_COLOR_INIT(0, 800, COLOR_RED - 0x40),
    COLOR_TYPE_COLOR_INIT(0, 1200, COLOR_BLACK),
    COLOR_TYPE_COLOR_INIT(0, 700, COLOR_RED - 0x30),
    COLOR_TYPE_COLOR_INIT(0, 800, COLOR_BLACK),
    COLOR_TYPE_COLOR_INIT(0, 600, COLOR_RED - 0x20),
    COLOR_TYPE_COLOR_INIT(0, 700, COLOR_BLACK),
    COLOR_TYPE_COLOR_INIT(0, 500, COLOR_RED),
    COLOR_TYPE_COLOR_INIT(0, 500, COLOR_BLACK),
    COLOR_TYPE_COLOR_INIT(0, 600, COLOR_RED - 0x20),
    COLOR_TYPE_COLOR_INIT(0, 700, COLOR_BLACK),
    COLOR_TYPE_COLOR_INIT(0, 700, COLOR_RED - 0x30),
    COLOR_TYPE_COLOR_INIT(0, 800, COLOR_BLACK),
    COLOR_TYPE_COLOR_INIT(0, 800, COLOR_RED - 0x40),
    COLOR_TYPE_COLOR_INIT(0, 1200, COLOR_BLACK),
    COLOR_TYPE_COLOR_INIT(0, 900, COLOR_RED - 0x50),
    COLOR_TYPE_COLOR_INIT(0, 1500, COLOR_BLACK),

    COLOR_TYPE_LOOP_INIT(0/*back to step zero*/, 0xffffffff),
    COLOR_END(),
};
COLOR_TABLE_REGISTER(color_table_heartbeat);

/*rain bow*/
const color_cell_t color_table_rainbow[] = {
    COLOR_TYPE_BREATH_INIT(0, 0, 0x0aa3030, BREATH_RGB_SEL(RED_EN, GREEN_EN, BLUE_EN), BREATH_RGB_DIR_UP(RED_EN, 0, 0), 2000, 1, 0x10, 0xff),
    COLOR_END(),
};
COLOR_TABLE_REGISTER(color_table_rainbow);

