prueba de led 2

This commit is contained in:
Alejandro Lembke Barrientos 2022-09-28 13:43:20 -06:00
parent 4c8d53bf78
commit 2e8d171f39
3 changed files with 78 additions and 18 deletions

View File

@ -28,18 +28,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#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 <http://www.gnu.org/licenses/>.
#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"

View File

@ -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<<USB_LED_CAPS_LOCK)) {
rgb_matrix_set_color(10, 0, 255, 0);
}
break;
}
#endif
}
// Light LEDs when caps lock is active. Hard to ignore!
const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{ lastLed, 1, HSV_RED }, // Light last LEDs only
/* const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{ lastLed, 1, HSV_RED } // Light last LEDs only
);
const rgblight_segment_t PROGMEM isWindos_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{ firstLed, 1, HSV_RED } // Light first LEDs only
);
// Light LEDs layer 1 is active
@ -303,7 +337,8 @@ const rgblight_segment_t PROGMEM my_layer3_layer[] = RGBLIGHT_LAYER_SEGMENTS(
// Now define the array of layers. Later layers take precedence
const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST(
my_capslock_layer, // Overrides caps lock and Windos layer
my_capslock_layer, // Overrides caps lock and Windos layer,
isWindos_layer,
my_layer1_layer, // Overrides other layers
my_layer2_layer, // Overrides other layers
my_layer3_layer // Overrides other layers
@ -317,17 +352,21 @@ void keyboard_post_init_user(void) {
// enabling disabling layers
bool led_update_user(led_t led_state) {
rgblight_set_layer_state(0, led_state.caps_lock);
return true;
}
layer_state_t default_layer_state_set_user(layer_state_t state) {
rgblight_set_layer_state(0, layer_state_cmp(state, 0));
return state;
}
} */
layer_state_t layer_state_set_user(layer_state_t state) {
rgblight_set_layer_state(1, layer_state_cmp(state, 1));
rgblight_set_layer_state(2, layer_state_cmp(state, 2));
rgblight_set_layer_state(3, layer_state_cmp(state, 3));
/* layer_state_t layer_state_set_user(layer_state_t state) {
if(isWindows == false){
rgblight_set_layer_state(1, layer_state_cmp(state, 0));
}
rgblight_set_layer_state(2, layer_state_cmp(state, 1));
rgblight_set_layer_state(3, layer_state_cmp(state, 2));
rgblight_set_layer_state(4, layer_state_cmp(state, 3));
return state;
}
} */

View File

@ -1,8 +1,9 @@
MOUSEKEY_ENABLE = no # Mouse keys
RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight.
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
RGB_MATRIX_ENABLE = yes
#VIA_ENABLE = yes # Enable VIA
OLED_ENABLE = yes
OLED_DRIVER = SSD1306
LTO_ENABLE = yes
TAP_DANCE_ENABLE = yes
TAP_DANCE_ENABLE = yes
SEND_STRING_ENABLE = yes