diff options
author | Xelus22 <17491233+Xelus22@users.noreply.github.com> | 2021-08-24 16:28:26 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-24 16:28:26 +1000 |
commit | 4e1c5887c5c08ebd2cf7868c8d9292aa728e7bf0 (patch) | |
tree | 24ff5bdf570a6a9f5a77a517005bffbb35e46b22 /keyboards/crkbd/keymaps/devdev | |
parent | 6fd20acf4be76e7a2bd82d3dfd0a9bcca8c507eb (diff) |
[Core] Refactor OLED to allow easy addition of other types (#13454)
* add docs
* core changes
* update keyboards to new OLED
* updated users to new OLED
* update layouts to new OLED
* fixup docs
* drashna's suggestion
* fix up docs
* new keyboards with oled
* core split changes
* remaining keyboard files
* Fix The Helix keyboards oled options
* reflect develop
Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: mtei <2170248+mtei@users.noreply.github.com>
Diffstat (limited to 'keyboards/crkbd/keymaps/devdev')
-rw-r--r-- | keyboards/crkbd/keymaps/devdev/keymap.c | 140 | ||||
-rw-r--r-- | keyboards/crkbd/keymaps/devdev/rules.mk | 3 |
2 files changed, 72 insertions, 71 deletions
diff --git a/keyboards/crkbd/keymaps/devdev/keymap.c b/keyboards/crkbd/keymaps/devdev/keymap.c index 4da3fcaa64..aa4d39a253 100644 --- a/keyboards/crkbd/keymaps/devdev/keymap.c +++ b/keyboards/crkbd/keymaps/devdev/keymap.c @@ -1,18 +1,18 @@ /* Copyright 2020 Dane Evans - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ // CRKBD @@ -20,12 +20,12 @@ char layer_state_str[24]; - - + + enum userspace_layers { _DEFAULTS = 0, _COLEMAK = 0, - _COLEMAKDH, + _COLEMAKDH, _QWERTY, _NUM, _SYM, @@ -33,37 +33,37 @@ char layer_state_str[24]; _NUMPAD, _SWITCH, _MOVE, - + }; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - - // colemak + + // colemak [_COLEMAK] = LAYOUT( //,-----------------------------------------------------. ,-----------------------------------------------------. LT(_NUMPAD,KC_TAB), KC_Q, KC_W, KC_F, KC_P, KC_G, LT(_SWITCH,KC_J), KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| KC_LSFT, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I,LT(_NUMPAD,KC_O),KC_QUOT, - //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| KC_LCTL, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| KC_LGUI, MO(_NUM), KC_SPC, KC_ENT, MO(_SYM), KC_LALT //`--------------------------' `--------------------------' ), - + // colemak DH [_COLEMAKDH] = LAYOUT( //,-----------------------------------------------------. ,-----------------------------------------------------. LT(_NUMPAD,KC_TAB), KC_Q, KC_W, KC_F, KC_P, KC_B, LT(_SWITCH,KC_J), KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| KC_LSFT, KC_A, KC_R, KC_S, KC_T, KC_G, KC_M, KC_N, KC_E, KC_I,LT(_NUMPAD,KC_O),KC_QUOT, - //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| KC_LCTL, KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| - KC_LGUI, MO(_NUM), KC_SPC, KC_ENT, MO(_SYM), KC_LALT + KC_LGUI, MO(_NUM), KC_SPC, KC_ENT, MO(_SYM), KC_LALT //`--------------------------' `--------------------------' ), - + // qwerty [_QWERTY] = LAYOUT( //,-----------------------------------------------------. ,-----------------------------------------------------. @@ -77,9 +77,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { //`--------------------------' `--------------------------' ), - - - // numbers - L thumb + + + // numbers - L thumb [_NUM] = LAYOUT( //,-----------------------------------------------------. ,-----------------------------------------------------. KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, @@ -91,8 +91,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(_COMMAND), KC_TRNS //`--------------------------' `--------------------------' ), - - // symbols - R thumb + + // symbols - R thumb [_SYM] = LAYOUT( //,-----------------------------------------------------. ,-----------------------------------------------------. KC_ESC, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, @@ -104,8 +104,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRNS, MO(_COMMAND), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS //`--------------------------' `--------------------------' ), - - // commands - both thumbs + + // commands - both thumbs [_COMMAND] = LAYOUT( //,-----------------------------------------------------. ,-----------------------------------------------------. RESET, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_NO, @@ -114,24 +114,24 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD, KC_NO, DF(2), KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS //`--------------------------' `--------------------------' ), - - // numpad + + // numpad [_NUMPAD] = LAYOUT( //,-----------------------------------------------------. ,-----------------------------------------------------. LT(0,KC_NO), KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_CIRC, KC_P7, KC_P8, KC_P9, KC_ASTR, KC_BSPC, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_MINS, KC_P4, KC_P5, KC_P6, KC_EQL, KC_DEL, - //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_PLUS, KC_P1, KC_P2, KC_P3, KC_SLSH, KC_NO, - //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| OSM(MOD_MEH), KC_NO, KC_TRNS, KC_ENT, KC_P0, KC_PDOT //`--------------------------' `--------------------------' - ), - - // layer switcher + ), + + // layer switcher [_SWITCH] = LAYOUT( //,-----------------------------------------------------. ,-----------------------------------------------------. TO(0), TO(1), TO(2), TO(3), TO(4), TO(5), KC_NO, TO(7), KC_NO, KC_NO, KC_NO, RESET, @@ -139,62 +139,62 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_NO, KC_NO, KC_BRIU, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, EEP_RST, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| KC_SYSTEM_SLEEP, KC_NO, KC_BRID, 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 //`--------------------------' `--------------------------' - - ), - - // amovement + + ), + + // amovement [_MOVE] = LAYOUT( //,-----------------------------------------------------. ,-----------------------------------------------------. LT(0,KC_NO), KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_HOME, KC_UP, KC_PGUP, KC_NO, KC_NO, KC_NO, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_LEFT, KC_ENT, KC_RGHT, KC_NO, KC_NO, KC_NO, - //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| KC_APP, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_END, KC_DOWN, KC_PGDN, KC_DEL, KC_NO, KC_NO, - //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| - KC_NO, KC_NO, KC_NO, KC_TRNS, KC_NO, KC_NO + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + KC_NO, KC_NO, KC_NO, KC_TRNS, KC_NO, KC_NO //`--------------------------' `--------------------------' ) }; -// it appears that these are different to the board numbering. -// when you specify n here, it lightss up n+1 on the board diagram - actually may be an entirely different pattern +// it appears that these are different to the board numbering. +// when you specify n here, it lightss up n+1 on the board diagram - actually may be an entirely different pattern // _QWERTY, -// Light on inner column and underglow +// Light on inner column and underglow const rgblight_segment_t PROGMEM layer_qwerty_lights[] = RGBLIGHT_LAYER_SEGMENTS( {0, 10, HSV_AZURE} ); // _COLEMAKDH, -// Light on inner column and underglow +// Light on inner column and underglow const rgblight_segment_t PROGMEM layer_colemakdh_lights[] = RGBLIGHT_LAYER_SEGMENTS( {0, 10, HSV_RED} ); // _NUM, -// Light on inner column and underglow +// Light on inner column and underglow const rgblight_segment_t PROGMEM layer_num_lights[] = RGBLIGHT_LAYER_SEGMENTS( {0, 10, HSV_TEAL} ); // _SYMBOL, -// Light on inner column and underglow +// Light on inner column and underglow const rgblight_segment_t PROGMEM layer_symbol_lights[] = RGBLIGHT_LAYER_SEGMENTS( {0, 10, HSV_BLUE} ); // _COMMAND, -// Light on inner column and underglow +// Light on inner column and underglow const rgblight_segment_t PROGMEM layer_command_lights[] = RGBLIGHT_LAYER_SEGMENTS( {0, 10, HSV_PURPLE} ); //_NUMPAD -//havent worked out how to do each side individually either +//havent worked out how to do each side individually either const rgblight_segment_t PROGMEM layer_numpad_lights[] = RGBLIGHT_LAYER_SEGMENTS( {0, 10, HSV_ORANGE} ); @@ -206,13 +206,13 @@ const rgblight_segment_t PROGMEM layer_numpad_rh_lights[] = RGBLIGHT_LAYER_SEGME ); // _MOVE, -// Light on inner column and underglow +// Light on inner column and underglow const rgblight_segment_t PROGMEM layer_move_lights[] = RGBLIGHT_LAYER_SEGMENTS( {0, 10, HSV_PINK} ); // _SWITCHER // light up top row -const rgblight_segment_t PROGMEM layer_switcher_lights[] = RGBLIGHT_LAYER_SEGMENTS( +const rgblight_segment_t PROGMEM layer_switcher_lights[] = RGBLIGHT_LAYER_SEGMENTS( {0, 6, HSV_GREEN}, {9, 2, HSV_GREEN}, {17, 2, HSV_GREEN}, @@ -222,12 +222,12 @@ const rgblight_segment_t PROGMEM layer_switcher_lights[] = RGBLIGHT_LAYER_SEGMEN // Now define the array of layers. Later layers take precedence const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST( - layer_qwerty_lights, + layer_qwerty_lights, layer_colemakdh_lights, layer_num_lights,// overrides layer 1 layer_symbol_lights, - layer_command_lights, - layer_numpad_lights, + layer_command_lights, + layer_numpad_lights, layer_numpad_rh_lights, layer_move_lights, layer_switcher_lights // Overrides other layers @@ -236,7 +236,7 @@ const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST( void keyboard_post_init_user(void) { // Enable the LED layers rgblight_layers = my_rgb_layers; - rgblight_mode(10);// haven't found a way to set this in a more useful way + rgblight_mode(10);// haven't found a way to set this in a more useful way } @@ -244,7 +244,7 @@ void keyboard_post_init_user(void) { layer_state_t layer_state_set_user(layer_state_t state) { rgblight_set_layer_state(0, layer_state_cmp(state, _DEFAULTS) && layer_state_cmp(default_layer_state,_QWERTY)); rgblight_set_layer_state(1, layer_state_cmp(state, _DEFAULTS) && layer_state_cmp(default_layer_state,_QWERTY)); - + rgblight_set_layer_state(2, layer_state_cmp(state, _NUM)); rgblight_set_layer_state(3, layer_state_cmp(state, _SYM)); rgblight_set_layer_state(4, layer_state_cmp(state, _COMMAND)); @@ -266,7 +266,7 @@ bool led_update_user(led_t led_state) { //SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h -#ifdef OLED_DRIVER_ENABLE +#ifdef OLED_ENABLE oled_rotation_t oled_init_user(oled_rotation_t rotation) { if (!is_keyboard_master()) { return OLED_ROTATION_180; // flips the display 180 degrees if offhand @@ -288,7 +288,7 @@ const char *read_mode_icon(bool swap); void oled_render_layer_state(void) { - char string [24]; + char string [24]; switch (get_highest_layer(default_layer_state|layer_state)) { case _QWERTY: @@ -296,10 +296,10 @@ void oled_render_layer_state(void) { break; case _COLEMAK: oled_write_ln_P(PSTR("Layer: COLEMAK"),false); - break; + break; case _COLEMAKDH: oled_write_ln_P(PSTR("Layer: COLEMAKDH"),false); - break; + break; case _NUM: oled_write_ln_P(PSTR("Layer: Numbers"),false); break; @@ -311,13 +311,13 @@ void oled_render_layer_state(void) { break; case _NUMPAD: oled_write_ln_P(PSTR("Layer: Numpad"),false); - break; + break; case _MOVE: oled_write_ln_P(PSTR("Layer: Movement"),false); break; case _SWITCH: oled_write_ln_P(PSTR("Layer: Layer Switch"),false); - break; + break; default: snprintf(string, sizeof(string), "%ld",layer_state); oled_write_P(PSTR("Layer: Undef-"),false); @@ -407,4 +407,4 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return true; } -#endif // OLED_DRIVER_ENABLE
\ No newline at end of file +#endif // OLED_ENABLE diff --git a/keyboards/crkbd/keymaps/devdev/rules.mk b/keyboards/crkbd/keymaps/devdev/rules.mk index 58e90c8116..4aaf22fd04 100644 --- a/keyboards/crkbd/keymaps/devdev/rules.mk +++ b/keyboards/crkbd/keymaps/devdev/rules.mk @@ -1,4 +1,5 @@ MOUSEKEY_ENABLE = yes EXTRAKEY_ENABLE = yes RGBLIGHT_ENABLE = yes -OLED_DRIVER_ENABLE = yes
\ No newline at end of file +OLED_ENABLE = yes +OLED_DRIVER = SSD1306 |