-Se agrega indicador rgb para el bloq mayús.

-Se agrega manejo del rgb_tog.
-Se agrega botón para reset(del teclado).
-Ajustes de keymap varios.
-Limpieza de código.
This commit is contained in:
Franco Rosi 2020-12-10 22:12:27 -03:00
parent dd2763cb70
commit 60e960c99f
3 changed files with 49 additions and 363 deletions

View File

@ -2,7 +2,7 @@
"version": 1, "version": 1,
"notes": "", "notes": "",
"documentation": "\"This file is a QMK Configurator export. You can import this at <https://config.qmk.fm>. It can also be used directly with QMK's source code.\n\nTo setup your QMK environment check out the tutorial: <https://docs.qmk.fm/#/newbs>\n\nYou can convert this file to a keymap.c using this command: `qmk json2c {keymap}`\n\nYou can compile this keymap using this command: `qmk compile {keymap}`\"\n", "documentation": "\"This file is a QMK Configurator export. You can import this at <https://config.qmk.fm>. It can also be used directly with QMK's source code.\n\nTo setup your QMK environment check out the tutorial: <https://docs.qmk.fm/#/newbs>\n\nYou can convert this file to a keymap.c using this command: `qmk json2c {keymap}`\n\nYou can compile this keymap using this command: `qmk compile {keymap}`\"\n",
"keyboard": "helix/rev2/back", "keyboard": "helix/rev2/under",
"keymap": "franco_rosi_latinoamerica", "keymap": "franco_rosi_latinoamerica",
"layout": "LAYOUT", "layout": "LAYOUT",
"layers": [ "layers": [
@ -158,8 +158,8 @@
"RGB_TOG", "RGB_TOG",
"KC_NO", "KC_NO",
"KC_NO", "KC_NO",
"RGB_MOD",
"RGB_RMOD", "RGB_RMOD",
"RGB_MOD",
"KC_NO", "KC_NO",
"KC_NO", "KC_NO",
"KC_NO", "KC_NO",
@ -170,8 +170,8 @@
"RGB_M_X", "RGB_M_X",
"KC_NO", "KC_NO",
"KC_NO", "KC_NO",
"RGB_HUI",
"RGB_HUD", "RGB_HUD",
"RGB_HUI",
"KC_NO", "KC_NO",
"KC_NO", "KC_NO",
"KC_NO", "KC_NO",
@ -181,7 +181,7 @@
"KC_NO", "KC_NO",
"KC_NO", "KC_NO",
"KC_NO", "KC_NO",
"KC_NO", "RESET",
"KC_NO", "KC_NO",
"KC_NO", "KC_NO",
"KC_NO", "KC_NO",

View File

@ -16,10 +16,13 @@
extern rgblight_config_t rgblight_config; extern rgblight_config_t rgblight_config;
uint8_t RGB_current_mode; uint8_t RGB_current_mode;
HSV CURRENT_COLOR; HSV CURRENT_COLOR;
bool caps_is_active = false;
void keyboard_post_init_user(void) { void keyboard_post_init_user(void) {
rgblight_enable(); // Enables RGB, without saving settings rgblight_enable(); // Enables RGB, without saving settings
rgblight_mode(RGBLIGHT_MODE_CHRISTMAS); rgblight_mode(RGBLIGHT_MODE_STATIC_GRADIENT + 5);
RGB_current_mode = rgblight_config.mode; RGB_current_mode = rgblight_config.mode;
rgblight_sethsv(HSV_RED);
CURRENT_COLOR = (HSV){rgblight_config.hue, rgblight_config.sat, rgblight_config.val};
} }
#endif #endif
@ -29,214 +32,19 @@ extern uint8_t is_master;
// The underscores don't mean anything - you can have a layer called STUFF or any other name. // The underscores don't mean anything - you can have a layer called STUFF or any other name.
// Layer names don't all need to be of the same length, obviously, and you can also skip them // Layer names don't all need to be of the same length, obviously, and you can also skip them
// entirely and just use numbers. // entirely and just use numbers.
enum layer_number { _QWERTY = 0, _COLEMAK, _DVORAK, _LOWER, _RAISE }; enum layer_number { _QWERTY = 0, _LOWER, _RAISE };
enum custom_keycodes { QWERTY = SAFE_RANGE, COLEMAK, DVORAK, LOWER, RAISE, RGBRST }; enum custom_keycodes { QWERTY = SAFE_RANGE, LOWER, RAISE, RGBRST };
#define LOWER MO(1) #define LOWER MO(1)
#define RAISE MO(2) #define RAISE MO(2)
// HELIX_ROWS == 5 // HELIX_ROWS == 5
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {[_QWERTY] = LAYOUT( const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {[_QWERTY] = LAYOUT(KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, KC_TAB, KC_Q, KC_W, KC_E, KC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O, RGB_HUD, RGB_HUI, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, RESET, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO)};
KC_NO,
KC_NO,
KC_NO,
KC_NO,
KC_NO,
KC_NO,
KC_NO,
KC_NO,
KC_NO,
KC_NO,
KC_NO,
KC_NO,
RGB_M_R,
RGB_M_K,
RGB_M_SN,
RGB_M_SW,
RGB_TOG,
KC_NO,
KC_NO,
RGB_MOD,
RGB_RMOD,
KC_NO,
KC_NO,
KC_NO,
RGB_M_G,
RGB_M_B,
RGB_M_P,
RGB_M_T,
RGB_M_X,
KC_NO,
KC_NO,
RGB_HUI,
RGB_HUD,
KC_NO,
KC_NO,
KC_NO,
KC_NO,
KC_NO,
KC_NO,
KC_NO,
KC_NO,
KC_NO,
KC_NO,
KC_NO,
KC_NO,
KC_NO,
KC_NO,
KC_NO,
KC_NO,
KC_NO,
KC_NO,
KC_NO,
KC_NO,
KC_NO,
KC_TRNS,
KC_NO,
KC_NO,
KC_NO,
KC_NO,
KC_NO,
KC_NO,
KC_NO,
KC_NO,
KC_NO
)};
// define variables for reactive RGB // define variables for reactive RGB
bool TOG_STATUS = false; bool TOG_STATUS = false;
@ -248,33 +56,6 @@ void persistent_default_layer_set(uint16_t default_layer) {
bool process_record_user(uint16_t keycode, keyrecord_t *record) { bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) { switch (keycode) {
case QWERTY:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_SONG(tone_qwerty);
#endif
persistent_default_layer_set(1UL << _QWERTY);
}
return false;
break;
case COLEMAK:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_SONG(tone_colemak);
#endif
persistent_default_layer_set(1UL << _COLEMAK);
}
return false;
break;
case DVORAK:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_SONG(tone_dvorak);
#endif
persistent_default_layer_set(1UL << _DVORAK);
}
return false;
break;
case LOWER: case LOWER:
if (record->event.pressed) { if (record->event.pressed) {
// not sure how to have keyboard check mode and set it to a variable, so my work around // not sure how to have keyboard check mode and set it to a variable, so my work around
@ -294,7 +75,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#ifdef RGBLIGHT_ENABLE #ifdef RGBLIGHT_ENABLE
rgblight_mode(RGB_current_mode); rgblight_mode(RGB_current_mode);
rgblight_sethsv(CURRENT_COLOR.h, CURRENT_COLOR.s, CURRENT_COLOR.v); rgblight_sethsv(CURRENT_COLOR.h, CURRENT_COLOR.s, CURRENT_COLOR.v);
CURRENT_COLOR = (HSV){rgblight_config.hue, rgblight_config.sat, rgblight_config.val};
#endif #endif
TOG_STATUS = false; TOG_STATUS = false;
layer_off(_LOWER); layer_off(_LOWER);
@ -320,7 +100,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#ifdef RGBLIGHT_ENABLE #ifdef RGBLIGHT_ENABLE
rgblight_mode(RGB_current_mode); rgblight_mode(RGB_current_mode);
rgblight_sethsv(CURRENT_COLOR.h, CURRENT_COLOR.s, CURRENT_COLOR.v); rgblight_sethsv(CURRENT_COLOR.h, CURRENT_COLOR.s, CURRENT_COLOR.v);
CURRENT_COLOR = (HSV){rgblight_config.hue, rgblight_config.sat, rgblight_config.val};
#endif #endif
layer_off(_RAISE); layer_off(_RAISE);
TOG_STATUS = false; TOG_STATUS = false;
@ -363,7 +142,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case RGB_M_K: case RGB_M_K:
#ifdef RGBLIGHT_ENABLE #ifdef RGBLIGHT_ENABLE
if (record->event.pressed) { if (record->event.pressed) {
rgblight_mode(RGBLIGHT_MODE_KNIGHT + 1); rgblight_mode(RGBLIGHT_MODE_KNIGHT);
RGB_current_mode = rgblight_config.mode; RGB_current_mode = rgblight_config.mode;
} }
#endif #endif
@ -372,7 +151,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case RGB_M_SN: case RGB_M_SN:
#ifdef RGBLIGHT_ENABLE #ifdef RGBLIGHT_ENABLE
if (record->event.pressed) { if (record->event.pressed) {
rgblight_mode(RGBLIGHT_MODE_SNAKE + 3); rgblight_mode(RGBLIGHT_MODE_SNAKE);
RGB_current_mode = rgblight_config.mode; RGB_current_mode = rgblight_config.mode;
} }
#endif #endif
@ -399,7 +178,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case RGB_M_B: case RGB_M_B:
#ifdef RGBLIGHT_ENABLE #ifdef RGBLIGHT_ENABLE
if (record->event.pressed) { if (record->event.pressed) {
rgblight_mode(RGBLIGHT_MODE_BREATHING + 2); rgblight_mode(RGBLIGHT_MODE_BREATHING + 3);
RGB_current_mode = rgblight_config.mode; RGB_current_mode = rgblight_config.mode;
} }
#endif #endif
@ -417,7 +196,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case RGB_M_T: case RGB_M_T:
#ifdef RGBLIGHT_ENABLE #ifdef RGBLIGHT_ENABLE
if (record->event.pressed) { if (record->event.pressed) {
rgblight_mode(RGBLIGHT_MODE_RGB_TEST); rgblight_mode(RGBLIGHT_MODE_STATIC_GRADIENT + 5);
RGB_current_mode = rgblight_config.mode; RGB_current_mode = rgblight_config.mode;
} }
#endif #endif
@ -454,6 +233,36 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif #endif
return false; return false;
break; break;
case RGB_TOG:
if (record->event.pressed) {
if (!rgblight_config.enable) {
rgblight_enable();
rgblight_mode(RGBLIGHT_MODE_STATIC_GRADIENT + 5);
RGB_current_mode = rgblight_config.mode;
CURRENT_COLOR = (HSV){rgblight_config.hue, rgblight_config.sat, rgblight_config.val};
} else {
rgblight_disable();
}
}
return false;
break;
case KC_CAPS:
if (record->event.pressed) {
register_code(KC_CAPS);
caps_is_active = !caps_is_active;
if (caps_is_active) {
RGB_current_mode = rgblight_config.mode;
CURRENT_COLOR = (HSV){rgblight_config.hue, rgblight_config.sat, rgblight_config.val};
rgblight_mode(RGBLIGHT_MODE_ALTERNATING);
rgblight_sethsv(HSV_WHITE);
} else if (!caps_is_active) {
unregister_code(KC_CAPS);
rgblight_mode(RGB_current_mode);
rgblight_sethsv(CURRENT_COLOR.h, CURRENT_COLOR.s, CURRENT_COLOR.v);
}
}
return false;
break;
case RGBRST: case RGBRST:
#ifdef RGBLIGHT_ENABLE #ifdef RGBLIGHT_ENABLE
if (record->event.pressed) { if (record->event.pressed) {
@ -480,126 +289,3 @@ void matrix_init_user(void) {
iota_gfx_init(!has_usb()); // turns on the display iota_gfx_init(!has_usb()); // turns on the display
#endif #endif
} }
#ifdef AUDIO_ENABLE
void startup_user() {
_delay_ms(20); // gets rid of tick
}
void shutdown_user() {
_delay_ms(150);
stop_all_notes();
}
void music_on_user(void) { music_scale_user(); }
void music_scale_user(void) { PLAY_SONG(music_scale); }
#endif
// SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h
#ifdef SSD1306OLED
void matrix_scan_user(void) {
iota_gfx_task(); // this is what updates the display continuously
}
void matrix_update(struct CharacterMatrix *dest, const struct CharacterMatrix *source) {
if (memcmp(dest->display, source->display, sizeof(dest->display))) {
memcpy(dest->display, source->display, sizeof(dest->display));
dest->dirty = true;
}
}
// assign the right code to your layers for OLED display
# define L_BASE 0
# define L_LOWER (1 << _LOWER)
# define L_RAISE (1 << _RAISE)
static void render_logo(struct CharacterMatrix *matrix) {
static const char helix_logo[] PROGMEM = {0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0};
matrix_write_P(matrix, helix_logo);
// matrix_write_P(&matrix, PSTR(" Split keyboard kit"));
}
static void render_rgbled_status(bool full, struct CharacterMatrix *matrix) {
# ifdef RGBLIGHT_ENABLE
char buf[30];
if (RGBLIGHT_MODES > 1 && rgblight_config.enable) {
if (full) {
snprintf(buf, sizeof(buf), " LED %2d: %d,%d,%d ", rgblight_config.mode, rgblight_config.hue / RGBLIGHT_HUE_STEP, rgblight_config.sat / RGBLIGHT_SAT_STEP, rgblight_config.val / RGBLIGHT_VAL_STEP);
} else {
snprintf(buf, sizeof(buf), "[%2d] ", rgblight_config.mode);
}
matrix_write(matrix, buf);
}
# endif
}
static void render_layer_status(struct CharacterMatrix *matrix) {
// Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below
char buf[10];
matrix_write_P(matrix, PSTR("Layer: "));
switch (layer_state) {
case L_BASE:
matrix_write_P(matrix, PSTR("Default"));
break;
case L_RAISE:
matrix_write_P(matrix, PSTR("Raise"));
break;
case L_LOWER:
matrix_write_P(matrix, PSTR("Lower"));
break;
default:
matrix_write_P(matrix, PSTR("Undef-"));
snprintf(buf, sizeof(buf), "%ld", layer_state);
matrix_write(matrix, buf);
}
}
void render_status(struct CharacterMatrix *matrix) {
// Render to mode icon
static const char os_logo[][2][3] PROGMEM = {{{0x95, 0x96, 0}, {0xb5, 0xb6, 0}}, {{0x97, 0x98, 0}, {0xb7, 0xb8, 0}}};
if (keymap_config.swap_lalt_lgui == false) {
matrix_write_P(matrix, os_logo[0][0]);
matrix_write_P(matrix, PSTR("\n"));
matrix_write_P(matrix, os_logo[0][1]);
} else {
matrix_write_P(matrix, os_logo[1][0]);
matrix_write_P(matrix, PSTR("\n"));
matrix_write_P(matrix, os_logo[1][1]);
}
matrix_write_P(matrix, PSTR(" "));
render_layer_status(matrix);
matrix_write_P(matrix, PSTR("\n"));
// Host Keyboard LED Status
matrix_write_P(matrix, (host_keyboard_leds() & (1 << USB_LED_NUM_LOCK)) ? PSTR("NUMLOCK") : PSTR(" "));
matrix_write_P(matrix, (host_keyboard_leds() & (1 << USB_LED_CAPS_LOCK)) ? PSTR("CAPS") : PSTR(" "));
matrix_write_P(matrix, (host_keyboard_leds() & (1 << USB_LED_SCROLL_LOCK)) ? PSTR("SCLK") : PSTR(" "));
matrix_write_P(matrix, PSTR("\n"));
render_rgbled_status(true, matrix);
}
void iota_gfx_task_user(void) {
struct CharacterMatrix matrix;
# if DEBUG_TO_SCREEN
if (debug_enable) {
return;
}
# endif
matrix_clear(&matrix);
if (is_master) {
render_status(&matrix);
} else {
render_logo(&matrix);
render_rgbled_status(false, &matrix);
render_layer_status(&matrix);
}
matrix_update(&display, &matrix);
}
#endif

View File

@ -12,5 +12,5 @@ The keymap has multiple layers, moving extra keys to different layers.
![keymap](https://i.pinimg.com/originals/ec/36/b2/ec36b2f124c2ca3c635e38c40f7305b0.png) ![keymap](https://i.pinimg.com/originals/9b/81/44/9b8144c211c59ea0dba6b91e56904292.jpg)