mirror of
https://github.com/qmk/qmk_firmware.git
synced 2026-09-30 13:58:57 +02:00
Finish stub for effect mapping
This commit is contained in:
+1
-3
@@ -28,9 +28,7 @@ bool get_config_blob_chunk(uint16_t offset, uint8_t *data, uint8_t data_len) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO: return actual values
|
||||
#define ENABLED_RGBLIGHT_EFFECTS 0xFFFFFFFF
|
||||
#define ENABLED_RGB_MATRIX_EFFECTS 0xFFFFFFFF
|
||||
// TODO: move to better location?
|
||||
#ifdef BACKLIGHT_BREATHING
|
||||
# define ENABLED_BACKLIGHT_EFFECTS 0b00000001
|
||||
#else
|
||||
|
||||
@@ -182,6 +182,8 @@ bool xap_respond_dynamic_encoder_set_keycode(xap_token_t token, const void *data
|
||||
}
|
||||
#endif
|
||||
|
||||
#define INVALID_EFFECT 0xFF
|
||||
|
||||
#if ((defined(BACKLIGHT_ENABLE)))
|
||||
# include "backlight.h"
|
||||
|
||||
@@ -204,66 +206,13 @@ bool xap_respond_get_backlight_config(xap_token_t token, const void *data, size_
|
||||
|
||||
extern rgblight_config_t rgblight_config;
|
||||
|
||||
// static uint8_t effect_map[][2] = {
|
||||
// {1, RGBLIGHT_MODE_STATIC_LIGHT},
|
||||
// # ifdef RGBLIGHT_EFFECT_BREATHING
|
||||
// {2, RGBLIGHT_MODE_BREATHING},
|
||||
// {3, RGBLIGHT_MODE_BREATHING + 1},
|
||||
// {4, RGBLIGHT_MODE_BREATHING + 2},
|
||||
// {5, RGBLIGHT_MODE_BREATHING + 3},
|
||||
// # endif
|
||||
// /*...*/
|
||||
// };
|
||||
|
||||
// static uint8_t xap2rgb(uint8_t val) {
|
||||
// for(uint8_t i = 0; i < ARRAY_SIZE(effect_map); i++){
|
||||
// if (effect_map[i][0] == val) {
|
||||
// return effect_map[i][1];
|
||||
// }
|
||||
// }
|
||||
// return 0;
|
||||
// }
|
||||
|
||||
// static uint8_t rgb2xap(uint8_t val) {
|
||||
// for(uint8_t i = 0; i < ARRAY_SIZE(effect_map); i++){
|
||||
// if (effect_map[i][1] == val) {
|
||||
// return effect_map[i][0];
|
||||
// }
|
||||
// }
|
||||
// return 0;
|
||||
// }
|
||||
|
||||
static uint8_t effect_map[43] = {
|
||||
0, //
|
||||
RGBLIGHT_MODE_STATIC_LIGHT, //
|
||||
# ifdef RGBLIGHT_EFFECT_BREATHING
|
||||
RGBLIGHT_MODE_BREATHING,
|
||||
RGBLIGHT_MODE_BREATHING + 1,
|
||||
RGBLIGHT_MODE_BREATHING + 2,
|
||||
RGBLIGHT_MODE_BREATHING + 3,
|
||||
# endif
|
||||
0,
|
||||
/*...*/
|
||||
};
|
||||
|
||||
// static uint8_t xap2rgb(uint8_t val) {
|
||||
// return effect_map[val];
|
||||
// }
|
||||
|
||||
static uint8_t rgb2xap(uint8_t val) {
|
||||
for (uint8_t i = 0; i < ARRAY_SIZE(effect_map); i++) {
|
||||
if (effect_map[i] == val) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
uint8_t rgblight2xap(uint8_t val);
|
||||
|
||||
bool xap_respond_get_rgblight_config(xap_token_t token, const void *data, size_t length) {
|
||||
xap_route_lighting_rgblight_get_config_t ret;
|
||||
|
||||
ret.enable = rgblight_config.enable;
|
||||
ret.mode = rgb2xap(rgblight_config.mode);
|
||||
ret.mode = rgblight2xap(rgblight_config.mode);
|
||||
ret.hue = rgblight_config.hue;
|
||||
ret.sat = rgblight_config.sat;
|
||||
ret.val = rgblight_config.val;
|
||||
@@ -278,34 +227,13 @@ bool xap_respond_get_rgblight_config(xap_token_t token, const void *data, size_t
|
||||
|
||||
extern rgb_config_t rgb_matrix_config;
|
||||
|
||||
static uint8_t effect_map[43] = {
|
||||
0, //
|
||||
RGB_MATRIX_SOLID_COLOR, //
|
||||
# ifdef ENABLE_RGB_MATRIX_ALPHAS_MODS
|
||||
RGB_MATRIX_ALPHAS_MODS,
|
||||
# endif
|
||||
0,
|
||||
/*...*/
|
||||
};
|
||||
|
||||
// static uint8_t xap2rgb(uint8_t val) {
|
||||
// return effect_map[val];
|
||||
// }
|
||||
|
||||
static uint8_t rgb2xap(uint8_t val) {
|
||||
for (uint8_t i = 0; i < ARRAY_SIZE(effect_map); i++) {
|
||||
if (effect_map[i] == val) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
uint8_t rgb_matrix2xap(uint8_t val);
|
||||
|
||||
bool xap_respond_get_rgb_matrix_config(xap_token_t token, const void *data, size_t length) {
|
||||
xap_route_lighting_rgb_matrix_get_config_t ret;
|
||||
|
||||
ret.enable = rgb_matrix_config.enable;
|
||||
ret.mode = rgb2xap(rgb_matrix_config.mode);
|
||||
ret.mode = rgb_matrix2xap(rgb_matrix_config.mode);
|
||||
ret.hue = rgb_matrix_config.hsv.h;
|
||||
ret.sat = rgb_matrix_config.hsv.s;
|
||||
ret.val = rgb_matrix_config.hsv.v;
|
||||
|
||||
Reference in New Issue
Block a user