diff options
author | Fred Silberberg <fred@silberberg.xyz> | 2018-08-05 08:42:16 -0700 |
---|---|---|
committer | Drashna Jaelre <drashna@live.com> | 2018-08-05 08:42:16 -0700 |
commit | 9a4db7a860ecb35ed6d1402955cc169512a8ba74 (patch) | |
tree | 636775298097afdd1f052759d8d389d86a9795bb /users | |
parent | a6e1cb08c657e5fe1d355a662b6cbd2e613d5f9b (diff) | |
download | qmk_firmware-9a4db7a860ecb35ed6d1402955cc169512a8ba74.tar.gz |
Keymap: Adds zen layout for 333fred (#3563)
* Initial commit of zen keymap
* Added RGB control for my zen
* Fixed ergodox layout.
* Reduce brightness.
* PR feedback.
Diffstat (limited to 'users')
-rw-r--r-- | users/333fred/333fred.c | 24 | ||||
-rw-r--r-- | users/333fred/333fred.h | 5 | ||||
-rw-r--r-- | users/333fred/333fred_config.h | 5 | ||||
-rw-r--r-- | users/333fred/rgb.c | 28 | ||||
-rw-r--r-- | users/333fred/rules.mk | 5 |
5 files changed, 58 insertions, 9 deletions
diff --git a/users/333fred/333fred.c b/users/333fred/333fred.c index ef2d741e5..12ee9e7d7 100644 --- a/users/333fred/333fred.c +++ b/users/333fred/333fred.c @@ -34,6 +34,7 @@ void tap_dance_layer_finished(qk_tap_dance_state_t *state, void *user_data) { break; case DOUBLE: layer_on(VIM); + break; } } @@ -61,3 +62,26 @@ void tap_dance_process_record(uint16_t keycode) { tap_dance_active = false; } } + +__attribute__ ((weak)) +void matrix_init_rgb(void) {} + +__attribute__ ((weak)) +void layer_state_set_rgb(uint32_t state) {} + +__attribute__ ((weak)) +void matrix_scan_user_keyboard(void) {} + +void matrix_scan_user() { + static bool first_run = true; + if (first_run) { + first_run = false; + matrix_init_rgb(); + } + matrix_scan_user_keyboard(); +} + +uint32_t layer_state_set_user(uint32_t state) { + layer_state_set_rgb(state); + return state; +} diff --git a/users/333fred/333fred.h b/users/333fred/333fred.h index 4a0462b7a..8599198a5 100644 --- a/users/333fred/333fred.h +++ b/users/333fred/333fred.h @@ -1,5 +1,4 @@ -#ifndef FRED_333 -#define FRED_333 +#pragma once #include "quantum.h" @@ -18,5 +17,3 @@ enum tap_dance_declarations { void tap_dance_layer_finished(qk_tap_dance_state_t*, void*); void tap_dance_layer_reset(qk_tap_dance_state_t*, void*); void tap_dance_process_record(uint16_t); - -#endif diff --git a/users/333fred/333fred_config.h b/users/333fred/333fred_config.h index f796abc09..7c637d8d3 100644 --- a/users/333fred/333fred_config.h +++ b/users/333fred/333fred_config.h @@ -1,7 +1,4 @@ -#ifndef FRED333_CONFIG -#define FRED333_CONFIG +#pragma once #define PREVENT_STUCK_MODIFIERS #define PERMISSIVE_HOLD - -#endif diff --git a/users/333fred/rgb.c b/users/333fred/rgb.c new file mode 100644 index 000000000..a3dfd905c --- /dev/null +++ b/users/333fred/rgb.c @@ -0,0 +1,28 @@ +#include "quantum.h" +#include "333fred.h" + +void matrix_init_rgb(void) { + rgblight_enable_noeeprom(); + rgblight_sethsv_noeeprom(270, 255, 20); +} + +void layer_state_set_rgb(uint32_t state) { + switch (biton32(state)) { + case BASE: + // purple + rgblight_sethsv_noeeprom(270, 255, 20); + break; + case SYMB: + // blue + rgblight_sethsv_noeeprom(240, 255, 20); + break; + case VIM: + // green + rgblight_sethsv_noeeprom(120, 255, 20); + break; + case GAME: + // red + rgblight_sethsv_noeeprom(0, 255, 20); + break; + } +} diff --git a/users/333fred/rules.mk b/users/333fred/rules.mk index 3160ac2e6..0e2cc2588 100644 --- a/users/333fred/rules.mk +++ b/users/333fred/rules.mk @@ -1,2 +1,5 @@ - SRC += 333fred.c + +ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) + SRC += rgb.c +endif |