aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--users/stanrc85/rgblight_layers.c38
-rw-r--r--users/stanrc85/rules.mk18
-rw-r--r--users/stanrc85/stanrc85.c36
-rw-r--r--users/stanrc85/startup_fanfare.c43
4 files changed, 80 insertions, 55 deletions
diff --git a/users/stanrc85/rgblight_layers.c b/users/stanrc85/rgblight_layers.c
index 780555e7b..1fbd54149 100644
--- a/users/stanrc85/rgblight_layers.c
+++ b/users/stanrc85/rgblight_layers.c
@@ -3,44 +3,7 @@
3static uint8_t middle = 0; 3static uint8_t middle = 0;
4static uint8_t bottom = 0; 4static uint8_t bottom = 0;
5 5
6const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS(
7 {3, 2, HSV_RED},
8 {10, 2, HSV_RED}
9);
10
11const rgblight_segment_t PROGMEM my_layer1_layer[] = RGBLIGHT_LAYER_SEGMENTS(
12 {3, 1, HSV_GREEN},
13 {11, 1, HSV_GREEN}
14);
15
16const rgblight_segment_t PROGMEM my_layer2_layer[] = RGBLIGHT_LAYER_SEGMENTS(
17 {3, 1, HSV_BLUE},
18 {11, 1, HSV_BLUE}
19);
20
21const rgblight_segment_t PROGMEM my_layer3_layer[] = RGBLIGHT_LAYER_SEGMENTS(
22 {3, 1, HSV_WHITE},
23 {11, 1, HSV_WHITE}
24);
25
26// Now define the array of layers. Later layers take precedence
27const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST(
28 my_capslock_layer,
29 my_layer1_layer,
30 my_layer2_layer,
31 my_layer3_layer
32);
33
34void keyboard_post_init_user(void) {
35 // Enable the LED layers
36 rgblight_layers = my_rgb_layers;
37}
38
39layer_state_t layer_state_set_user(layer_state_t state) { 6layer_state_t layer_state_set_user(layer_state_t state) {
40 // Both layers will light up if both kb layers are active
41 rgblight_set_layer_state(1, layer_state_cmp(state, 1));
42 rgblight_set_layer_state(2, layer_state_cmp(state, 2));
43 rgblight_set_layer_state(3, layer_state_cmp(state, 3));
44 middle = bottom = 0; 7 middle = bottom = 0;
45 switch (get_highest_layer(state)) { 8 switch (get_highest_layer(state)) {
46 case _FN1_60: 9 case _FN1_60:
@@ -60,7 +23,6 @@ layer_state_t layer_state_set_user(layer_state_t state) {
60} 23}
61 24
62bool led_update_user(led_t led_state) { 25bool led_update_user(led_t led_state) {
63 //rgblight_set_layer_state(0, led_state.caps_lock);
64 writePin(INDICATOR_PIN_0, !led_state.caps_lock); 26 writePin(INDICATOR_PIN_0, !led_state.caps_lock);
65 writePin(INDICATOR_PIN_1, !middle); 27 writePin(INDICATOR_PIN_1, !middle);
66 writePin(INDICATOR_PIN_2, !bottom); 28 writePin(INDICATOR_PIN_2, !bottom);
diff --git a/users/stanrc85/rules.mk b/users/stanrc85/rules.mk
index 5c572c0af..54f0f7626 100644
--- a/users/stanrc85/rules.mk
+++ b/users/stanrc85/rules.mk
@@ -10,24 +10,10 @@ NKRO_ENABLE = no
10 10
11SRC += stanrc85.c 11SRC += stanrc85.c
12 12
13ifeq ($(strip $(KEYBOARD)), 1upkeyboards/1up60hse)
14 SRC += layer_rgb.c
15 VIA_ENABLE = yes
16 LTO_ENABLE = yes
17endif
18ifeq ($(strip $(KEYBOARD)), dz60)
19 SRC += layer_rgb.c
20 VIA_ENABLE = yes
21 LTO_ENABLE = yes
22endif
23ifeq ($(strip $(KEYBOARD)), projectkb/alice/rev1)
24 SRC += rgblight_layers.c
25 VIA_ENABLE = yes
26 LTO_ENABLE = no
27 VELOCIKEY_ENABLE=yes
28endif
29ifeq ($(strip $(KEYBOARD)), projectkb/alice/rev2) 13ifeq ($(strip $(KEYBOARD)), projectkb/alice/rev2)
30 SRC += rgblight_layers.c 14 SRC += rgblight_layers.c
15 SRC += startup_fanfare.c
16 OPT_DEFS += -DHAS_INDICATORS
31 VIA_ENABLE = yes 17 VIA_ENABLE = yes
32 LTO_ENABLE = no 18 LTO_ENABLE = no
33 VELOCIKEY_ENABLE=yes 19 VELOCIKEY_ENABLE=yes
diff --git a/users/stanrc85/stanrc85.c b/users/stanrc85/stanrc85.c
index c1aaad1a1..2dbd41974 100644
--- a/users/stanrc85/stanrc85.c
+++ b/users/stanrc85/stanrc85.c
@@ -44,8 +44,42 @@ void ctl_copy_reset (qk_tap_dance_state_t *state, void *user_data) {
44 } 44 }
45} 45}
46 46
47#if defined(HAS_INDICATORS)
48 static uint8_t led_user = 0;
49#endif
50
51void lock_unlock (qk_tap_dance_state_t *state, void *user_data) {
52 td_state = cur_dance(state);
53 switch (td_state) {
54 case SINGLE_TAP: // Ctl + Alt + Del to unlock workstation
55 tap_code16(KC_CAD);
56 #if defined(HAS_INDICATORS)
57 led_user = 0;
58 writePin(INDICATOR_PIN_0, !led_user);
59 wait_ms(200);
60 writePin(INDICATOR_PIN_1, !led_user);
61 wait_ms(200);
62 writePin(INDICATOR_PIN_2, !led_user);
63 #endif
64 break;
65 case SINGLE_HOLD:
66 break;
67 case DOUBLE_TAP: //Lock workstation
68 tap_code16(KC_LOCK);
69 #if defined(HAS_INDICATORS)
70 led_user = 1;
71 writePin(INDICATOR_PIN_2, !led_user);
72 wait_ms(200);
73 writePin(INDICATOR_PIN_1, !led_user);
74 wait_ms(200);
75 writePin(INDICATOR_PIN_0, !led_user);
76 #endif
77 break;
78 }
79}
80
47qk_tap_dance_action_t tap_dance_actions[] = { 81qk_tap_dance_action_t tap_dance_actions[] = {
48 [TD_WIN] = ACTION_TAP_DANCE_DOUBLE(KC_CAD, KC_LOCK), 82 [TD_WIN] = ACTION_TAP_DANCE_FN(lock_unlock),
49 [TD_ESC] = ACTION_TAP_DANCE_DOUBLE(KC_ESC, KC_GRV), 83 [TD_ESC] = ACTION_TAP_DANCE_DOUBLE(KC_ESC, KC_GRV),
50 [TD_RCTL] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ctl_copy_finished, ctl_copy_reset) 84 [TD_RCTL] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ctl_copy_finished, ctl_copy_reset)
51}; 85};
diff --git a/users/stanrc85/startup_fanfare.c b/users/stanrc85/startup_fanfare.c
new file mode 100644
index 000000000..507d9e389
--- /dev/null
+++ b/users/stanrc85/startup_fanfare.c
@@ -0,0 +1,43 @@
1#include "stanrc85.h"
2
3static uint8_t top = 0;
4static uint8_t middle = 0;
5static uint8_t bottom = 0;
6
7static bool is_enabled = true;
8static bool is_rgblight_startup = true;
9static uint16_t rgblight_startup_loop_timer;
10
11void matrix_scan_user(void) {
12 // Boot up "fanfare"
13 if (is_rgblight_startup && is_keyboard_master()) {
14 if (timer_elapsed(rgblight_startup_loop_timer) > 10) {
15 static uint8_t counter;
16 counter++;
17 if (counter == 1) {
18 top = 1;
19 writePin(INDICATOR_PIN_0, !top);
20 wait_ms(200);
21 top = 0;
22 writePin(INDICATOR_PIN_0, !top);
23 }
24 if (counter == 2) {
25 middle = 1;
26 writePin(INDICATOR_PIN_1, !middle);
27 wait_ms(200);
28 middle = 0;
29 writePin(INDICATOR_PIN_1, !middle);
30 }
31 if (counter == 3) {
32 bottom = 1;
33 writePin(INDICATOR_PIN_2, !bottom);
34 wait_ms(200);
35 bottom = 0;
36 writePin(INDICATOR_PIN_2, !bottom);
37 }
38 if (counter == 4) {
39 is_enabled = is_rgblight_startup = false;
40 }
41 }
42 }
43}