summaryrefslogtreecommitdiffstats
path: root/keyboards/xiudi/xd75/keymaps/ericgebhart/keymap.c
blob: a500e4b682e315501c11827424af89a02754312a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
/*
  Copyright 2018 Eric Gebhart <e.a.gebhart@gmail.com>

  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/>.
*/

#include "keymap_bepo.h"
#include "ericgebhart.h"


const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  // 4x10
  [_DVORAK]  = BASE_5x15(___NUMS___, ___DVORAK___),
  [_QWERTY]  = BASE_5x15(___NUMS___, ___QWERTY___),
  [_COLEMAK] = BASE_5x15(___NUMS___, ___COLEMAK_DH___),
  [_BEAKL]   = BASE_5x15(___BKLNUMS___, ___BEAKL15___),

  //[_DVORAK_BP] = BASE_5x15_bepo(___DVORAK_FR___),
  //[_BEAKL_BP]  = BASE_5x15_bepo(___BEAKL15_FR___),

  // 4x12
  //[_BEPO]      = BASE_5x15_bepo6(___BEPO6_FR___),

  // transient macro takes a 4x12 for args
  [_SYMB]    = TRANSIENT_5x15(___12___, ___SYMB_BEAKLA_3x12___),
  //[_SYMB_BP] = TRANSIENT_5x15(___12___, ___SYMB_BEAKLA_BP_3x12___),

  [_TOPROWS]    = TRANSIENT_5x15(___12___, ___TOPROWS_3x12___),
  //[_TOPROWS_BP] = TRANSIENT_5x15(___12___, ___TOPROWS_BP_3x12___),

  [_KEYPAD]    = TRANSIENT_5x15(___12___, ___KP_C_3x12___),
  //[_KEYPAD_BP] = TRANSIENT_5x15(___12___, ___KP_C_BP_3x12___),

  // Navigation and control
  [_NAV]    = TRANSIENT_5x15(___12___, ___NAV_3x12___),
  [_LAYERS] = TRANSIENT_5x15(___12___, ___LAYERS_3x12___),
  //[_RGB]  = TRANSIENT_5x15(___12___, ___RGB_3x12___),
  [_ADJUST]    = TRANSIENT_5x15(___12___, ___ADJUST_3x12___),
};


/********************************************************************************/
/* Using layers to do RGB underlighting */
/********************************************************************************/

const rgblight_segment_t PROGMEM on_bepo[] = RGBLIGHT_LAYER_SEGMENTS(
                                                                     {0, 2, HSV_AZURE}
                                                                     );

const rgblight_segment_t PROGMEM bepo[] = RGBLIGHT_LAYER_SEGMENTS(
                                                                  {3, 2, HSV_MAGENTA}
                                                                  );

const rgblight_segment_t PROGMEM dvorak[] = RGBLIGHT_LAYER_SEGMENTS(
                                                                    {3, 2, HSV_AZURE}
                                                                    );

const rgblight_segment_t PROGMEM media[] = RGBLIGHT_LAYER_SEGMENTS(
                                                                   {5, 1, HSV_GREEN}
                                                                   );

const rgblight_segment_t PROGMEM symbol[] = RGBLIGHT_LAYER_SEGMENTS(
                                                                    {4, 2, HSV_GOLD}
                                                                    );

const rgblight_segment_t PROGMEM keypad[] = RGBLIGHT_LAYER_SEGMENTS(
                                                                    {4, 2, HSV_BLUE}
                                                                    );

const rgblight_segment_t PROGMEM layers[] = RGBLIGHT_LAYER_SEGMENTS(
                                                                    {5, 1, HSV_RED}
                                                                    );

const rgblight_segment_t PROGMEM rgb[] = RGBLIGHT_LAYER_SEGMENTS(
                                                                 {5, 1, HSV_ORANGE}
                                                                 );

const rgblight_segment_t* const PROGMEM rgb_layers[] = RGBLIGHT_LAYERS_LIST(on_bepo, bepo, dvorak, media, symbol,
                                                                            keypad, layers, rgb);

void keyboard_post_init_user(void) {
  rgblight_sethsv_noeeprom(HSV_PURPLE);
  rgblight_layers = rgb_layers;
}

layer_state_t layer_state_set_user(layer_state_t state) {
  // rgblight_set_layer_state(0, !on_qwerty());
  rgblight_set_layer_state(0, layer_state_cmp(state, _DVORAK));

  rgblight_set_layer_state(1, layer_state_cmp(state, _BEPO));
  rgblight_set_layer_state(2, layer_state_cmp(state, _DVORAK));
  //|| layer_state_cmp(state, DVORAK_ON_BEPO)));
  rgblight_set_layer_state(3, layer_state_cmp(state, _NAV));
  rgblight_set_layer_state(4, layer_state_cmp(state, _SYMB) );

  //(layer_state_cmp(state, SYMB) || (layer_state_cmp(state, SYMB_ON_BEPO))));
  rgblight_set_layer_state(5, layer_state_cmp(state, _KEYPAD) );
  ///(layer_state_cmp(state, KEYPAD) || (layer_state_cmp(state, KEYPAD_ON_BEPO))));
  rgblight_set_layer_state(6, layer_state_cmp(state, _LAYERS));
  rgblight_set_layer_state(7, layer_state_cmp(state, _RGB));
  return state;
}

/* void suspend_power_down_user(void) { */
/*   rgblight_disable(); */
/* } */

/* void suspend_wakeup_init_user(void) { */
/*   rgblight_enable(); */
/* } */

/* bool is_shift_pressed = false; */

/* bool led_update_user(led_t led_state) { */
/*   rgblight_set_layer_state(2, is_shift_pressed != led_state.caps_lock); */
/*   return true; */
/* } */

/* bool process_record_user(uint16_t keycode, keyrecord_t* record) { */
/*   switch (keycode) { */
/*   case KC_LSFT: */
/*   case KC_RSFT: */
/*     is_shift_pressed = record->event.pressed; */
/*     rgblight_set_layer_state(2, is_shift_pressed != host_keyboard_led_state().caps_lock); */
/*   default: */
/*     return true; */
/*   } */
/* } */