aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--layouts/community/75_ansi/spidey3/keymap.c33
-rw-r--r--layouts/community/75_ansi/spidey3/readme.md14
-rw-r--r--layouts/community/75_ansi/spidey3/rules.mk15
-rw-r--r--users/spidey3/config.h5
-rw-r--r--users/spidey3/init.c21
-rw-r--r--users/spidey3/layer_rgb.c81
-rw-r--r--users/spidey3/readme.md14
-rw-r--r--users/spidey3/rules.mk10
-rw-r--r--users/spidey3/spidey3.c80
-rw-r--r--users/spidey3/spidey3.h40
-rw-r--r--users/spidey3/unicode.c19
-rw-r--r--users/spidey3/unicode.h19
12 files changed, 351 insertions, 0 deletions
diff --git a/layouts/community/75_ansi/spidey3/keymap.c b/layouts/community/75_ansi/spidey3/keymap.c
new file mode 100644
index 000000000..511fea28d
--- /dev/null
+++ b/layouts/community/75_ansi/spidey3/keymap.c
@@ -0,0 +1,33 @@
1#include "spidey3.h"
2
3#define SETTINGS A(S(KC_S))
4
5const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
6 // Linux / Win layout
7 [_BASE] = LAYOUT_75_ansi(
8 KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, SETTINGS, KC_INS, KC_DEL,
9 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_HOME,
10 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGUP,
11 KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGDN,
12 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_END,
13 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
14 ),
15 // OSX layout
16 [_OSX] = LAYOUT_75_ansi(
17 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_EJCT, _______, _______,
18 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
19 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
20 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
21 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
22 _______, KC_LALT, KC_LGUI, _______, _______, _______, _______, _______, _______, _______
23 ),
24 // FN
25 [_FN] = LAYOUT_75_ansi(
26 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PWR,
27 _______, _______, _______, _______, _______, _______, _______, _______, X_BUL, _______, _______, X_DASH, _______, RESET, EEP_RST,
28 _______, RGB_TOG, RGB_MOD, RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, RGB_VAD, RGB_VAI, RGB_SPD, RGB_SPI, VLK_TOG, _______, _______, KC_VOLU,
29 _______, RGB_M_P, RGB_M_B, RGB_M_R, RGB_M_SW, RGB_M_SN, RGB_M_K, RGB_M_G, RGB_M_T, SPI_LNX, _______, _______, _______, KC_VOLD,
30 _______, SPI_GLO, _______, SPI_WIN, _______, _______, _______, SPI_OSX, X(LARR), X(RARR), DEBUG, _______, KC_BRIU, KC_MUTE,
31 _______, _______, _______, _______, _______, _______, _______, _______, KC_BRID, _______
32 )
33};
diff --git a/layouts/community/75_ansi/spidey3/readme.md b/layouts/community/75_ansi/spidey3/readme.md
new file mode 100644
index 000000000..409d6e5f8
--- /dev/null
+++ b/layouts/community/75_ansi/spidey3/readme.md
@@ -0,0 +1,14 @@
1Copyright 2020 Joshua Diamond josh@windowoffire.com @spidey3
2
3This program is free software: you can redistribute it and/or modify
4it under the terms of the GNU General Public License as published by
5the Free Software Foundation, either version 2 of the License, or
6(at your option) any later version.
7
8This program is distributed in the hope that it will be useful,
9but WITHOUT ANY WARRANTY; without even the implied warranty of
10MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11GNU General Public License for more details.
12
13You should have received a copy of the GNU General Public License
14along with this program. If not, see <http://www.gnu.org/licenses/>.
diff --git a/layouts/community/75_ansi/spidey3/rules.mk b/layouts/community/75_ansi/spidey3/rules.mk
new file mode 100644
index 000000000..d9ac1126c
--- /dev/null
+++ b/layouts/community/75_ansi/spidey3/rules.mk
@@ -0,0 +1,15 @@
1# Build Options
2# comment out to disable the options.
3#
4BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration
5MOUSEKEY_ENABLE = no # Mouse keys
6EXTRAKEY_ENABLE = yes # Audio control and System control
7CONSOLE_ENABLE = yes # Console for debug
8COMMAND_ENABLE = no # Commands for debug and configuration
9SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
10NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
11BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
12AUDIO_ENABLE = no
13RGBLIGHT_ENABLE = yes
14UNICODEMAP_ENABLE = yes
15VELOCIKEY_ENABLE = yes
diff --git a/users/spidey3/config.h b/users/spidey3/config.h
new file mode 100644
index 000000000..9da7f5530
--- /dev/null
+++ b/users/spidey3/config.h
@@ -0,0 +1,5 @@
1#pragma once
2
3#define LED_DISABLE_WHEN_USB_SUSPENDED true
4#define RGB_DISABLE_WHEN_USB_SUSPENDED true
5#define RGBLIGHT_LAYERS
diff --git a/users/spidey3/init.c b/users/spidey3/init.c
new file mode 100644
index 000000000..a4be6113f
--- /dev/null
+++ b/users/spidey3/init.c
@@ -0,0 +1,21 @@
1#include "spidey3.h"
2
3void keyboard_post_init_user(void) {
4 print("SPIDEY3: keyboard_post_init_user\n");
5 uprintf(" debug_enable=%u\n", debug_enable);
6#ifdef RGBLIGHT_ENABLE
7 keyboard_post_init_user_rgb();
8#endif
9}
10
11void eeconfig_init_user(void) {
12 print("SPIDEY3: eeconfig_init_user\n");
13 set_single_persistent_default_layer(_BASE);
14#ifdef UNICODEMAP_ENABLE
15 eeconfig_init_user_unicode();
16#endif
17
18#ifdef RGBLIGHT_ENABLE
19 eeconfig_init_user_rgb();
20#endif
21}
diff --git a/users/spidey3/layer_rgb.c b/users/spidey3/layer_rgb.c
new file mode 100644
index 000000000..d80eb20a3
--- /dev/null
+++ b/users/spidey3/layer_rgb.c
@@ -0,0 +1,81 @@
1#include QMK_KEYBOARD_H
2
3#include "spidey3.h"
4#include "velocikey.h"
5
6uint32_t rgb_mode;
7uint16_t rgb_hue;
8uint8_t rgb_sat;
9uint8_t rgb_val;
10bool rgb_saved = 0;
11
12void spidey_swirl(void) {
13 dprint("SPIDEY3: Setting Spidey Swirl!\n");
14 rgblight_enable();
15 rgblight_mode(RGBLIGHT_MODE_RAINBOW_SWIRL);
16 rgblight_sethsv(213, 255, 128);
17#ifdef VELOCIKEY_ENABLE
18 if (!velocikey_enabled())
19 velocikey_toggle();
20#endif
21}
22
23void eeconfig_init_user_rgb(void)
24{
25 spidey_swirl();
26}
27
28const rgblight_segment_t PROGMEM _capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS( {0, 2, HSV_AZURE}, {14, 2, HSV_AZURE} );
29const rgblight_segment_t PROGMEM _layer1_layer[] = RGBLIGHT_LAYER_SEGMENTS( {7, 1, HSV_PURPLE} );
30const rgblight_segment_t PROGMEM _layer2_layer[] = RGBLIGHT_LAYER_SEGMENTS( {9, 2, HSV_GREEN} );
31
32// Now define the array of layers. Later layers take precedence
33const rgblight_segment_t* const PROGMEM _rgb_layers[] = RGBLIGHT_LAYERS_LIST( _capslock_layer, _layer1_layer, _layer2_layer );
34const uint8_t PROGMEM _n_rgb_layers = sizeof(_rgb_layers) / sizeof(_rgb_layers[0]) - 1;
35
36void do_rgb_layers(layer_state_t state, uint8_t start, uint8_t end) {
37 dprint("SPIDEY3: do_rgb_layers()\n");
38 for (uint8_t i=start; i<end; i++) {
39 bool is_on = layer_state_cmp(state, i);
40 dprintf(" layer[%d]=%u\n", i, is_on);
41 rgblight_set_layer_state(i, is_on);
42 }
43}
44
45void keyboard_post_init_user_rgb(void) {
46 do_rgb_layers(default_layer_state, 1u, RGB_LAYER_BASE_REGULAR);
47 do_rgb_layers(layer_state, RGB_LAYER_BASE_REGULAR, _n_rgb_layers);
48 // Enable the LED layers
49 rgblight_layers = _rgb_layers;
50}
51
52layer_state_t default_layer_state_set_user_rgb(layer_state_t state) {
53 dprint("SPIDEY3: default_layer_state_set_user_rgb()\n");
54 do_rgb_layers(state, 1u, RGB_LAYER_BASE_REGULAR);
55 return state;
56}
57
58layer_state_t layer_state_set_user_rgb(layer_state_t state) {
59 dprint("SPIDEY3: layer_state_set_user_rgb()\n");
60 do_rgb_layers(state, RGB_LAYER_BASE_REGULAR, _n_rgb_layers);
61 return state;
62}
63
64bool led_update_user_rgb(led_t led_state) {
65 dprintf("SPIDEY3: caps_lock=%u\n", led_state.caps_lock);
66 rgblight_set_layer_state(0, led_state.caps_lock);
67 return true;
68}
69
70bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) {
71
72 switch (keycode) {
73 case SPI_GLO:
74 if (record->event.pressed) {
75 spidey_swirl();
76 }
77 break;
78 }
79
80 return true;
81}
diff --git a/users/spidey3/readme.md b/users/spidey3/readme.md
new file mode 100644
index 000000000..409d6e5f8
--- /dev/null
+++ b/users/spidey3/readme.md
@@ -0,0 +1,14 @@
1Copyright 2020 Joshua Diamond josh@windowoffire.com @spidey3
2
3This program is free software: you can redistribute it and/or modify
4it under the terms of the GNU General Public License as published by
5the Free Software Foundation, either version 2 of the License, or
6(at your option) any later version.
7
8This program is distributed in the hope that it will be useful,
9but WITHOUT ANY WARRANTY; without even the implied warranty of
10MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11GNU General Public License for more details.
12
13You should have received a copy of the GNU General Public License
14along with this program. If not, see <http://www.gnu.org/licenses/>.
diff --git a/users/spidey3/rules.mk b/users/spidey3/rules.mk
new file mode 100644
index 000000000..0a77d2bfc
--- /dev/null
+++ b/users/spidey3/rules.mk
@@ -0,0 +1,10 @@
1
2SRC += init.c
3SRC += spidey3.c
4
5ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
6 SRC += layer_rgb.c
7endif
8ifeq ($(strip $(UNICODEMAP_ENABLE)), yes)
9 SRC += unicode.c
10endif
diff --git a/users/spidey3/spidey3.c b/users/spidey3/spidey3.c
new file mode 100644
index 000000000..d0b794704
--- /dev/null
+++ b/users/spidey3/spidey3.c
@@ -0,0 +1,80 @@
1#include QMK_KEYBOARD_H
2
3#include "spidey3.h"
4
5bool process_record_user(uint16_t keycode, keyrecord_t *record) {
6
7// If console is enabled, it will print the matrix position and status of each key pressed
8// dprintf("KL: kc: %u, col: %u, row: %u, pressed: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed);
9
10 if (record->event.pressed) {
11 switch (keycode) {
12#ifndef NO_DEBUG
13 // Re-implement this here, but fix the persistence!
14 case DEBUG:
15 debug_enable ^= 1;
16 if (debug_enable) {
17 print("DEBUG: enabled.\n");
18 } else {
19 print("DEBUG: disabled.\n");
20 }
21 eeconfig_update_debug(debug_config.raw);
22#endif
23 return false;
24 case SPI_LNX:
25 dprint("SPIDEY3: SPI_LNX\n");
26 set_single_persistent_default_layer(_BASE);
27 layer_off(_OSX);
28#if defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE)
29 set_unicode_input_mode(UC_LNX);
30#endif
31 return false;
32 case SPI_OSX:
33 dprint("SPIDEY3: SPI_OSX\n");
34 set_single_persistent_default_layer(_OSX);
35#if defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE)
36 set_unicode_input_mode(UC_OSX);
37#endif
38 return false;
39 case SPI_WIN:
40 dprint("SPIDEY3: SPI_WIN\n");
41 set_single_persistent_default_layer(_BASE);
42 layer_off(_OSX);
43#if defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE)
44 set_unicode_input_mode(UC_WINC);
45#endif
46 return false;
47 }
48 }
49
50#ifdef RGBLIGHT_ENABLE
51 bool res = process_record_user_rgb(keycode, record);
52 if (!res) return false;
53#endif
54
55 return true;
56}
57
58layer_state_t default_layer_state_set_user(layer_state_t state) {
59#ifdef RGBLIGHT_ENABLE
60 return default_layer_state_set_user_rgb(state);
61#else
62 return state;
63#endif
64}
65
66layer_state_t layer_state_set_user(layer_state_t state) {
67#ifdef RGBLIGHT_ENABLE
68 return layer_state_set_user_rgb(state);
69#else
70 return state;
71#endif
72}
73
74bool led_update_user(led_t led_state) {
75#ifdef RGBLIGHT_ENABLE
76 return led_update_user_rgb(led_state);
77#else
78 return true;
79#endif
80}
diff --git a/users/spidey3/spidey3.h b/users/spidey3/spidey3.h
new file mode 100644
index 000000000..125f70a9a
--- /dev/null
+++ b/users/spidey3/spidey3.h
@@ -0,0 +1,40 @@
1#pragma once
2
3#include QMK_KEYBOARD_H
4
5#ifdef UNICODEMAP_ENABLE
6#include "unicode.h"
7#endif
8
9enum userspace_layers {
10 _BASE = 0,
11 _OSX,
12 _FN,
13};
14
15enum rgb_base_layer {
16 RGB_LAYER_BASE_DEFAULT = _BASE,
17 RGB_LAYER_BASE_REGULAR = _FN,
18};
19
20enum custom_keycodes {
21 SPI_GLO = SAFE_RANGE,
22 SPI_LNX,
23 SPI_OSX,
24 SPI_WIN,
25};
26
27#ifdef RGBLIGHT_ENABLE
28void eeconfig_init_user_rgb(void);
29void matrix_init_user_rgb(void);
30void keyboard_post_init_user_rgb(void);
31bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record);
32layer_state_t layer_state_set_user_rgb(layer_state_t state);
33layer_state_t default_layer_state_set_user_rgb(layer_state_t state);
34bool led_update_user_rgb(led_t led_state);
35#endif
36
37#ifdef UNICODEMAP_ENABLE
38void eeconfig_init_user_unicode(void);
39#endif
40
diff --git a/users/spidey3/unicode.c b/users/spidey3/unicode.c
new file mode 100644
index 000000000..41ceef837
--- /dev/null
+++ b/users/spidey3/unicode.c
@@ -0,0 +1,19 @@
1
2#include "unicode.h"
3
4const uint32_t PROGMEM unicode_map[] = {
5 [BUL1] = 0x2022, // •
6 [BUL2] = 0x25E6, // ◦
7 [LARR] = 0x2190, // ←
8 [RARR] = 0x2192, // →
9 [ENDASH] = 0x2013, // –
10 [EMDASH] = 0x2014, // —
11};
12
13void eeconfig_init_user_unicode(void)
14{
15 // Default to Linux style
16 set_unicode_input_mode(UC_LNX);
17}
18
19
diff --git a/users/spidey3/unicode.h b/users/spidey3/unicode.h
new file mode 100644
index 000000000..72a91e8a8
--- /dev/null
+++ b/users/spidey3/unicode.h
@@ -0,0 +1,19 @@
1#pragma once
2
3#include QMK_KEYBOARD_H
4
5#ifdef UNICODEMAP_ENABLE
6
7enum unicode_names {
8 BUL1,
9 BUL2,
10 LARR,
11 RARR,
12 ENDASH,
13 EMDASH,
14};
15
16#define X_BUL (XP(BUL1, BUL2))
17#define X_DASH (XP(ENDASH, EMDASH))
18
19#endif