u_effect_normal.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. #ifndef _U_EFFECT_NORMAL_H_
  2. #define _U_EFFECT_NORMAL_H_
  3. #include "u_global.h"
  4. #define BREATH_BRIGHT_STEP_VAL (2)
  5. typedef struct //light_info
  6. {
  7. //uint8_t mode_en;
  8. uint8_t clr_num_max;
  9. uint8_t clr_ind;
  10. uint8_t set_speed; //1 - 10 递减
  11. uint8_t set_bright; //1 - 100 递增
  12. uint8_t change_cnt;
  13. uint8_t curr_ind;
  14. uint16_t clr_temp[3];
  15. uint8_t clr_buff[8][3]; //light_mode_gradual
  16. uint8_t bright_dir;
  17. int16_t curr_bright;
  18. const uint32_t *color_buff; //brkght
  19. uint8_t play_dir;
  20. int16_t play_ind;
  21. uint32_t *play_buff; //幻彩播放缓存指针
  22. uint8_t seg_len; //色块长度
  23. uint8_t seg_num; //色块数量
  24. int16_t change_diff[8][3];
  25. int16_t color_temp[8][3];
  26. }LightInfo_t;
  27. typedef struct //_rhythm_param
  28. {
  29. uint8_t bright;
  30. uint8_t clr_ind;
  31. uint8_t clr_max_num;
  32. //uint8_t type;
  33. uint8_t speed;
  34. //uint8_t *sensit;
  35. uint8_t vol_value;
  36. const uint32_t *clr_buff;
  37. //uint8_t music_mode_ind;
  38. //uint8_t color_ind; //渐变律动专用
  39. //uint8_t color_end; //渐变律动专用
  40. uint8_t grad_dir;
  41. uint8_t grad_first;
  42. uint8_t grad_r_period; //
  43. uint8_t grad_g_period; //
  44. uint8_t grad_b_period; //
  45. uint8_t grad_refer; //
  46. uint8_t music_start;
  47. uint16_t clr_temp[3];
  48. uint8_t color_buff[8][3];
  49. //uint8_t music_end;
  50. }RhythmPara_t;
  51. enum //_light_effect
  52. {
  53. LIGHT_EFFECT_NULL = 0,
  54. LIGHT_EFFECT_STATIC,
  55. LIGHT_EFFECT_JUMP,
  56. LIGHT_EFFECT_GRADUAL,
  57. LIGHT_EFFECT_BREATH,
  58. LIGHT_EFFECT_BLINK,
  59. LIGHT_EFFECT_RHYTHM_MIN,
  60. LIGHT_EFFECT_RHYTHM_JUMP = LIGHT_EFFECT_RHYTHM_MIN,
  61. LIGHT_EFFECT_RHYTHM_BREATH,
  62. LIGHT_EFFECT_RHYTHM_GRADUAL,
  63. LIGHT_EFFECT_RHYTHM_ONE_CLR,
  64. };
  65. enum _bright_dir
  66. {
  67. BRIGHT_DIR_SUBT = 0,
  68. BRIGHT_DIR_PLUS = 1,
  69. };
  70. extern LightInfo_t g_light_info;
  71. uint8_t u_fabs(uint8_t x, uint8_t y);
  72. uint32_t light_color_bright_create(uint32_t light_color, uint8_t bright);
  73. uint32_t light_color_bright_alter(uint32_t light_color, uint8_t old_bright, uint8_t new_bright);
  74. void light_mode_jump_timer_cb(LightInfo_t *jump);
  75. void light_mode_jump_cfg(LightInfo_t *jump, const uint32_t *color_buff, uint8_t color_num, uint8_t speed, uint8_t bright);
  76. void light_mode_gradual_timer_cb(LightInfo_t *gradual);
  77. void light_mode_gradual_cfg(LightInfo_t *gradual_cfg, const uint32_t *color_buff, uint8_t color_num, uint8_t speed, uint8_t bright);
  78. void light_mode_breath_timer_cb(LightInfo_t *breath);
  79. void light_mode_breath_cfg(LightInfo_t *breath_cfg, const uint32_t *color_buff, uint8_t color_num, uint8_t speed, uint8_t bright);
  80. void light_mode_blink_timer_cb(LightInfo_t *light_breath);
  81. void light_mode_blink_cfg(LightInfo_t *blink_cfg, const uint32_t *color_buff, uint8_t color_num, uint8_t switch_ration, uint8_t speed, uint8_t bright);
  82. void light_mode_static_cfg(LightInfo_t *static_cfg, const uint32_t *color_buff, uint8_t bright);
  83. void light_rhythm_mode_fade_timer_cb(RhythmPara_t *Grad_Cfg);
  84. void light_rhythm_mode_fade_cfg(RhythmPara_t *rhythm_gradual_cfg, const uint32_t *color_buff, uint8_t color_num, uint8_t speed);
  85. void light_rhythm_mode_jump_timer_cb(RhythmPara_t *rhythm_jump);
  86. void light_rhythm_mode_jump_cfg(RhythmPara_t *rhythm_jump_cfg, const uint32_t *color_buff, uint8_t color_num, uint8_t speed);
  87. void light_rhythm_mode_one_clr_cfg(RhythmPara_t *one_clr_cfg, const uint32_t *color_buff, uint8_t speed);
  88. void light_rhythm_mode_one_clr_timer_cb(RhythmPara_t *rhythm_one_clr);
  89. void light_rhythm_mode_gradual_cfg(RhythmPara_t *gradual_rhythm_cfg, const uint32_t *color_buff, uint8_t color_num, uint8_t speed);
  90. void light_rhythm_mode_gradual_timer_cb(RhythmPara_t *gradual_rhythm);
  91. #endif // _U_EFFECT_NORMAL_H_