Skip to content

Commit

Permalink
Groundwork for dedicated color keycodes
Browse files Browse the repository at this point in the history
  • Loading branch information
Erez Zukerman committed Nov 18, 2016
1 parent 9bbc9a7 commit 285c5a9
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
24 changes: 23 additions & 1 deletion keyboards/ergodox/keymaps/erez_experimental/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
#define SYMB 1 // symbols
#define MDIA 2 // media keys

enum custom_keycodes {
PLACEHOLDER = SAFE_RANGE, // can always be here
RGB_FF00BB // always start with RGB_
};


const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap 0: Basic layer
*
Expand Down Expand Up @@ -75,7 +81,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// SYMBOLS
[SYMB] = KEYMAP(
// left hand
KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS,
RGB_FF00BB, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS,
KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_1, KC_2, KC_3, KC_4, KC_5,
KC_TRNS, KC_6, KC_7, KC_8, KC_9, KC_0, KC_TRNS,
Expand Down Expand Up @@ -152,6 +158,22 @@ void matrix_init_user(void) {

};


bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
// dynamically generate these.
case RGB_FF00BB:
if (record->event.pressed) {
rgblight_enable();
rgblight_mode(1);
rgblight_setrgb(0xff,0x00,0xbb);
}
return false;
break;
}
return true;
}

LEADER_EXTERNS();

// Runs constantly in the background, in a loop.
Expand Down
7 changes: 7 additions & 0 deletions quantum/rgblight.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,13 @@ void rgblight_toggle(void) {
}
}

void rgblight_enable(void) {
rgblight_config.enable = 1;
eeconfig_update_rgblight(rgblight_config.raw);
xprintf("rgblight enable: rgblight_config.enable = %u\n", rgblight_config.enable);
rgblight_mode(rgblight_config.mode);
}


void rgblight_increase_hue(void) {
uint16_t hue;
Expand Down
1 change: 1 addition & 0 deletions quantum/rgblight.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ void rgblight_init(void);
void rgblight_increase(void);
void rgblight_decrease(void);
void rgblight_toggle(void);
void rgblight_enable(void);
void rgblight_step(void);
void rgblight_mode(uint8_t mode);
void rgblight_set(void);
Expand Down

0 comments on commit 285c5a9

Please sign in to comment.