From 9a4db7a860ecb35ed6d1402955cc169512a8ba74 Mon Sep 17 00:00:00 2001 From: Fred Silberberg Date: Sun, 5 Aug 2018 08:42:16 -0700 Subject: 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. --- users/333fred/333fred.c | 24 ++++++++++++++++++++++++ users/333fred/333fred.h | 5 +---- users/333fred/333fred_config.h | 5 +---- users/333fred/rgb.c | 28 ++++++++++++++++++++++++++++ users/333fred/rules.mk | 5 ++++- 5 files changed, 58 insertions(+), 9 deletions(-) create mode 100644 users/333fred/rgb.c (limited to 'users/333fred') diff --git a/users/333fred/333fred.c b/users/333fred/333fred.c index ef2d741e5b..12ee9e7d7d 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 4a0462b7a2..8599198a57 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 f796abc095..7c637d8d36 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 0000000000..a3dfd905cc --- /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 3160ac2e69..0e2cc2588c 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 -- cgit v1.2.3