aboutsummaryrefslogtreecommitdiff
path: root/users/tominabox1/tominabox1.c
diff options
context:
space:
mode:
authortominabox1 <tom.campie@gmail.com>2019-10-18 20:15:57 -0500
committerDrashna Jaelre <drashna@live.com>2019-10-18 18:15:57 -0700
commitc26faed2b60e59293f631e041619567f23a93406 (patch)
tree4c51f318dafe4e2345adcebf2ce4c94ba8f8a6be /users/tominabox1/tominabox1.c
parentb23f6011c34dcb471c312655f7af37c0a0f5f779 (diff)
downloadqmk_firmware-c26faed2b60e59293f631e041619567f23a93406.tar.gz
qmk_firmware-c26faed2b60e59293f631e041619567f23a93406.zip
[Keymap] Tominabox1 userspace creation (#7014)
* rebaselined the whole fork and added cool matrix animations * Updated dfu bootloader rules, oleds working on test map * Moving test branch into main moving my _test branch files into the main since the repo is now in the dev branch, don't see any reason to keep separate folders. * Update keymap.c Adding DOT to number layer * added LED sleeping * working on getting matrix rgb to sleep upon usb suspend uploading to github for qmk staff help * Added master sleep on usb suspend Unfortunately the sleep function does not work on the slave side so will probably revert this change later * bringing hhkb config up to current with other tominabox1 configs * Update config.h since master side is the only one that sleeps, going to disable this for now. * testing oled stuff * Update rules.mk * tinkering with oled still * Finally fixed custom image with corne doug * Adding keymap to dimple instead of screwing up the upstream references. * Changed oled image to peepo ggers * working on oled sleep * Update keymap.c * fixes oled wake/sleep issues * Adding :b: and BEPIS macros * Update .gitignore * Cleaning up and improving documentation * Update keymap.c * Adding my minivan keymap * Fixed error on keymap * fixed OLEDs not turning on and moved tapping term to the keymap file * Changed tapping term from 200 to 250 * Revised Fkey layers, arrows, question mark locations * Update keymap.c * tweaked tapping term and types on CRKBD, revised layout on HHKB * Update keymap.c * general code cleanup, keymap displays * Set up userspace for common keymap elements * tapping term stuff for shift * testing * Fixed new tapdance for accessing number and fkey layers * Update tominabox1.h * stuff * fixing function calls for userspace * cleaning up crkbd config and moving stuff to userspace * finally fixed oled lightup issues * cleaning up a few maps and rules * Removing permissive hold and returning spacefn to all boards. * Settting up wrapper keymaps for Dimple, Minivan, and Corne Wrappers * small tweaks * Update wrappers.h * finishing wrappers on Minivan and Dimple * Revised tapping term definition Providing additional tapping term config for CRKBD only. * Code cleanup and documentation * Update readme.md * Update readme.md * Wrapers and continued code cleanup and documentation * moved oled py scripts to user folder * completed wrapper implementation of CRKBD * added matrix startup mode - not working yet pending upstream changes * removed unused code in tominabox1.c * Fixing custom keycodes and tap dance indices fixed custom keycodes and tap dance indices Adding beginning of dimple RGB matrix definition changed oled on corne to scrolling matrix thing Added copy pasta * Secondary layer tweaks Swapping hands of numbers and symbols as well as tweaking tapping terms accordingly * Update tominabox1.c Continued refinement of tapping term to support better right hand symbol access. * Fixes from pr 7014 Removed gitignore data from qmk master Reverted changes to Drashna's crkbd keymap Accepted changes to crkbd keymap Added ignore to hhkb keymap - I think I need this because Teensy. Will revisit another time * Removing hhkb keymap for rework * Adding back hhkb keymap Re-adding hhkb folder with ignores * Reverting changes to Dimple default totally did not intend to modify these * Update keymap.c Reverting changes to Drashna's corne map * Accepting recommended changes * Reduced tap hold caps delay moved bootmagic enable to general usage Revised tapping terms Removed unused keycode defs * bootmagic * Update rules.mk * Fixed permissions (support 7014) and bootmagic addition Fixed permissions on Drashna's keymap and Dimple default keymap files. Adding bootmagic to my crkbd config. * Fixing permissions
Diffstat (limited to 'users/tominabox1/tominabox1.c')
-rw-r--r--users/tominabox1/tominabox1.c281
1 files changed, 281 insertions, 0 deletions
diff --git a/users/tominabox1/tominabox1.c b/users/tominabox1/tominabox1.c
new file mode 100644
index 000000000..95e6ee780
--- /dev/null
+++ b/users/tominabox1/tominabox1.c
@@ -0,0 +1,281 @@
1#include "tominabox1.h"
2
3#ifdef KEYBOARD_lazydesigners_dimple
4#ifdef RGBLIGHT_ENABLE
5__attribute__ ((weak))
6void keyboard_post_init_keymap(void) {}
7
8void keyboard_post_init_user(void) { // sets the backlighting to come on upon successful load then turn off
9 rgblight_enable_noeeprom();
10 rgblight_sethsv_noeeprom(RGB_RED);
11 rgblight_mode_noeeprom(0);
12 wait_ms(700);
13 rgblight_disable_noeeprom();
14}
15#endif // RGBLIGHT
16#endif // Dimple
17
18
19#ifdef RGB_MATRIX_ENABLE
20void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode, uint8_t speed, uint8_t led_type);
21static bool is_suspended;
22static bool rgb_matrix_enabled;
23
24__attribute__ ((weak))
25void suspend_power_down_keymap(void) {}
26
27void suspend_power_down_user(void) {
28 rgb_matrix_set_suspend_state(true);
29 if (!is_suspended) {
30 is_suspended = true;
31 rgb_matrix_enabled = (bool)rgb_matrix_config.enable;
32 rgb_matrix_disable_noeeprom();
33 }
34}
35
36__attribute__ ((weak))
37void suspend_wakeup_init_keymap(void) {}
38
39void suspend_wakeup_init_user(void) {
40 rgb_matrix_set_suspend_state(false);
41 is_suspended = false;
42 if (rgb_matrix_enabled) {
43 rgb_matrix_enable_noeeprom();
44 }
45}
46
47# include "lib/lib8tion/lib8tion.h"
48extern led_config_t g_led_config;
49void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode, uint8_t speed, uint8_t led_type) {
50 HSV hsv = {hue, sat, val};
51 if (hsv.v > rgb_matrix_config.hsv.v) {
52 hsv.v = rgb_matrix_config.hsv.v;
53 }
54
55 switch (mode) {
56 case 1: // breathing
57 {
58 uint16_t time = scale16by8(g_rgb_counters.tick, speed / 8);
59 hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v);
60 RGB rgb = hsv_to_rgb(hsv);
61 for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) {
62 if (HAS_FLAGS(g_led_config.flags[i], led_type)) {
63 rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
64 }
65 }
66 break;
67 }
68 default: // Solid Color
69 {
70 RGB rgb = hsv_to_rgb(hsv);
71 for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) {
72 if (HAS_FLAGS(g_led_config.flags[i], led_type)) {
73 rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
74 }
75 }
76 break;
77 }
78 }
79}
80#endif //RGB_MATRIX_ENABLE
81
82void dance_cln_finished (qk_tap_dance_state_t *state, void *user_data) {
83 if (state->count == 1) {
84 register_code16(S(KC_2));
85 } else {
86 SEND_STRING("tom.campie@gmail.com");
87 }
88}
89
90void dance_cln_reset (qk_tap_dance_state_t *state, void *user_data) {
91 if (state->count == 1) {
92 unregister_code16(S(KC_2));
93 } else {
94 }
95}
96
97qk_tap_dance_action_t tap_dance_actions[] = {
98 [KC_EMAIL] = ACTION_TAP_DANCE_FN_ADVANCED (NULL, dance_cln_finished, dance_cln_reset),
99 [TD_SFT_CPS] = ACTION_TAP_DANCE_DOUBLE(KC_LSFT, KC_CAPS),
100};
101
102#define TAPPING_TERM 200
103#define IGNORE_MOD_TAP_INTERRUPT
104
105#ifdef KEYBOARD_crkbd_rev1
106
107#endif // CRKBD
108
109uint16_t get_tapping_term(uint16_t keycode) {
110 switch (keycode) {
111 case LSFT_T(KC_CAPS):
112 return 250;
113 case KC_ENT_LOW:
114 return 150;
115 case KC_SPC_RSE:
116 return(250);
117 case LCTL_T(KC_TAB):
118 return 300;
119 default:
120 return TAPPING_TERM;
121 }
122};
123
124__attribute__ ((weak))
125layer_state_t layer_state_set_keymap (layer_state_t state) {
126 return state;
127}
128
129uint32_t layer_state_set_user(uint32_t state) {
130 state = update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
131 switch (biton32(state)) {
132 case _LOWER:
133 break;
134 case _RAISE:
135 break;
136 case _ADJUST:
137 break;
138 default:
139 break;
140 }
141 return state;
142}
143
144#ifdef KEYBOARD_crkbd_rev1
145
146__attribute__((weak))
147void matrix_scan_keymap(void) {}
148
149extern bool oled_initialized;
150void matrix_scan_user(void) {
151 if(!oled_initialized) {
152 wait_ms(200);
153 oled_init(0);
154 return;
155 }
156 matrix_scan_keymap();
157 }
158
159extern uint8_t is_master;
160#endif // CRKBD
161
162uint16_t oled_timer;
163
164__attribute__ ((weak))
165bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
166 return true;
167}
168
169bool process_record_user(uint16_t keycode, keyrecord_t *record) {
170 #ifdef CONSOLE_ENABLE
171 uprintf("KL: kc: %u, col: %u, row: %u, pressed: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed);
172 #endif
173
174 if (record->event.pressed) {
175 #ifdef OLED_DRIVER_ENABLE
176 oled_timer = timer_read();
177 oled_on();
178 #endif // OLED_DRIVER_ENABLE
179 switch (keycode) {
180 case KC_BBB:
181 if (record->event.pressed) {
182 SEND_STRING(":b:");
183 } else {}
184 break;
185 case KC_BEPIS:
186 if (record->event.pressed) {
187 SEND_STRING("BEPIS");
188 } else {}
189 break;
190 }
191 }
192 return true;
193
194}
195#ifdef KEYBOARD_crkbd_rev1
196#ifdef OLED_DRIVER_ENABLE
197void render_logo(void) {
198 static const char PROGMEM logo[] = {
199 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94,
200 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4,
201 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4,
202 0};
203 oled_write_P(logo, false);
204}
205
206void render_status_main(void) {
207 // Host Keyboard USB Status
208 oled_write_P(PSTR("USB: "), false);
209 switch (USB_DeviceState) {
210 case DEVICE_STATE_Unattached:
211 oled_write_P(PSTR("Unattached\n"), false);
212 break;
213 case DEVICE_STATE_Suspended:
214 oled_write_P(PSTR("Suspended\n"), false);
215 break;
216 case DEVICE_STATE_Configured:
217 oled_write_P(PSTR("Connected\n"), false);
218 break;
219 case DEVICE_STATE_Powered:
220 oled_write_P(PSTR("Powered\n"), false);
221 break;
222 case DEVICE_STATE_Default:
223 oled_write_P(PSTR("Default\n"), false);
224 break;
225 case DEVICE_STATE_Addressed:
226 oled_write_P(PSTR("Addressed\n"), false);
227 break;
228 default:
229 oled_write_P(PSTR("Invalid\n"), false);
230 }
231
232 // Host Keyboard Layer Status
233 oled_write_P(PSTR("Layer: "), false);
234 switch (biton32(layer_state)) {
235 case _BASE:
236 oled_write_P(PSTR("Colemak\n"), false);
237 break;
238 case _RAISE:
239 oled_write_P(PSTR("Numbers\n"), false);
240 break;
241 case _LOWER:
242 oled_write_P(PSTR("Symbols\n"), false);
243 break;
244 case _ADJUST:
245 oled_write_P(PSTR("Adjust\n"), false);
246 break;
247 case _ARROW:
248 oled_write_P(PSTR("Navigation\n"), false);
249 break;
250 case _FKEY:
251 oled_write_P(PSTR("Function\n"), false);
252 break;
253 default:
254 // Or use the write_ln shortcut over adding '\n' to the end of your string
255 oled_write_ln_P(PSTR("Undefined"), false);
256 }
257
258 // Host Keyboard LED Status
259
260 oled_write_ln_P(IS_HOST_LED_ON(USB_LED_CAPS_LOCK) ? PSTR("Caps Lock\n") : PSTR(" \n"), false);
261}
262__attribute__ ((weak))
263void oled_task_keymap(void) {}
264
265void oled_task_user(void) {
266
267 if (timer_elapsed(oled_timer) > 20000) {
268 oled_off();
269 return;
270 }
271 if (is_master) {
272 render_status_main(); // Renders the current keyboard state (layer, lock, caps, scroll, etc)
273 } else {
274 render_logo();
275 oled_scroll_left();
276 }
277 oled_task_keymap();
278 }
279
280#endif // OLED_Driver
281#endif // crkbd