From 2e8d171f3983cd1160bd8be6597ec0c7057eeebe Mon Sep 17 00:00:00 2001 From: Alejandro Lembke Barrientos Date: Wed, 28 Sep 2022 13:43:20 -0600 Subject: [PATCH] prueba de led 2 --- config.h | 34 ++++++++++++++++++++++++++------- keymap.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++--------- rules.mk | 5 +++-- 3 files changed, 78 insertions(+), 18 deletions(-) diff --git a/config.h b/config.h index 5cde6b8..ba8e047 100644 --- a/config.h +++ b/config.h @@ -28,18 +28,18 @@ along with this program. If not, see . #define TAPPING_TERM 200 #define TAPPING_TOGGLE 2 -#define RGBLIGHT_LAYERS +// #define RGBLIGHT_LAYERS // #define RGBLIGHT_LAYERS_OVERRIDE_RGB_OFF // #define SPLIT_LAYER_STATE_ENABLE #ifdef RGBLIGHT_ENABLE - #define RGBLIGHT_EFFECT_BREATHING - #define RGBLIGHT_EFFECT_RAINBOW_MOOD + // #define RGBLIGHT_EFFECT_BREATHING + // #define RGBLIGHT_EFFECT_RAINBOW_MOOD #define RGBLIGHT_EFFECT_RAINBOW_SWIRL - #define RGBLIGHT_EFFECT_SNAKE - #define RGBLIGHT_EFFECT_KNIGHT - #define RGBLIGHT_EFFECT_CHRISTMAS - #define RGBLIGHT_EFFECT_STATIC_GRADIENT + // #define RGBLIGHT_EFFECT_SNAKE + // #define RGBLIGHT_EFFECT_KNIGHT + // #define RGBLIGHT_EFFECT_CHRISTMAS + // #define RGBLIGHT_EFFECT_STATIC_GRADIENT // #define RGBLIGHT_EFFECT_RGB_TEST // #define RGBLIGHT_EFFECT_ALTERNATING // #define RGBLIGHT_EFFECT_TWINKLE @@ -49,4 +49,24 @@ along with this program. If not, see . #define RGBLIGHT_VAL_STEP 17 #endif +#ifdef RGB_MATRIX_ENABLE +#define SPLIT_USB_DETECT +# define RGB_MATRIX_KEYPRESSES // reacts to keypresses +// # define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (instead of keypresses) +// # define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects +# define RGB_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended +# define RGB_MATRIX_FRAMEBUFFER_EFFECTS +// # define RGB_MATRIX_LED_PROCESS_LIMIT (DRIVER_LED_TOTAL + 4) / 5 // limits the number of LEDs to process in an animation per task run (increases keyboard responsiveness) +// # define RGB_MATRIX_LED_FLUSH_LIMIT 16 // limits in milliseconds how frequently an animation will update the LEDs. 16 (16ms) is equivalent to limiting to 60fps (increases keyboard responsiveness) +# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 150 // limits maximum brightness of LEDs to 150 out of 255. Higher may cause the controller to crash. +# define RGB_MATRIX_HUE_STEP 8 +# define RGB_MATRIX_SAT_STEP 8 +# define RGB_MATRIX_VAL_STEP 8 +# define RGB_MATRIX_SPD_STEP 10 +#endif + +#define SPLIT_LAYER_STATE_ENABLE + +#define LAYER_STATE_16BIT + #define OLED_FONT_H "keyboards/crkbd/lib/glcdfont.c" diff --git a/keymap.c b/keymap.c index d8f9495..38fc76e 100644 --- a/keymap.c +++ b/keymap.c @@ -283,9 +283,43 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { const int firstLed = 1; const int lastLed = 53; +// uint8_t rgbmode; +// bool rgbStatus = true; + +void rgb_matrix_indicators_user(void) { + #ifdef RGB_MATRIX_ENABLE + switch (biton32(layer_state)) { + case 1: + /* for (int i = 0; i < DRIVER_LED_TOTAL; i++) { + rgb_matrix_set_color(i, 255, 0, 0); + } */ + rgb_matrix_set_color_all(255, 0, 0); + break; + + case 2: + /* for (int i = 0; i < DRIVER_LED_TOTAL; i++) { + rgb_matrix_set_color(i, 0, 0, 255); + } */ + rgb_matrix_set_color_all(0, 0, 255); + break; + + default: + if (isWindows == false){ + rgb_matrix_set_color(8, 0, 255, 0); + } + if (host_keyboard_leds() & (1<