summaryrefslogtreecommitdiff
path: root/keyboards/sendyyeah/pix/keymaps/via/keymap.c
diff options
context:
space:
mode:
authorSendy Aditya Suryana <sendzation@gmail.com>2021-12-27 17:06:35 +0700
committerGitHub <noreply@github.com>2021-12-27 21:06:35 +1100
commitdad7424becdb10d1dc3ad70a456fc40513255e71 (patch)
tree87527dad8f7f1d8ba8361ae45ff437da61e723a5 /keyboards/sendyyeah/pix/keymaps/via/keymap.c
parentce0ca94600b94bafa132dacccc662615e8a9befe (diff)
[Keyboard][Update] Add RGB Backlight feature to Pix (#14057)
* Initiate RGB Support * Add RGB Support for PIX * Revert Encoder pin assignment * Lower default RGB LED to 15 * Use Left shift for far left key * Replicate via keymap to default keymap
Diffstat (limited to 'keyboards/sendyyeah/pix/keymaps/via/keymap.c')
-rw-r--r--keyboards/sendyyeah/pix/keymaps/via/keymap.c65
1 files changed, 60 insertions, 5 deletions
diff --git a/keyboards/sendyyeah/pix/keymaps/via/keymap.c b/keyboards/sendyyeah/pix/keymaps/via/keymap.c
index bcaf52d53b..951aadeae8 100644
--- a/keyboards/sendyyeah/pix/keymaps/via/keymap.c
+++ b/keyboards/sendyyeah/pix/keymaps/via/keymap.c
@@ -16,11 +16,12 @@
#include QMK_KEYBOARD_H
-#define LAYERNUM 2
+#define LAYERNUM 3
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT(KC_MUTE, KC_MPLY, KC_MPRV, KC_MNXT, TO(1)),
- [1] = LAYOUT(KC_TRNS, KC_MSTP, KC_MRWD, KC_MFFD, TO(0))
+ [1] = LAYOUT(KC_TRNS, KC_MSTP, KC_MRWD, KC_MFFD, TO(2)),
+ [2] = LAYOUT(KC_LSFT, RGB_MOD, RGB_HUI, RGB_SAI, TO(0))
};
int get_icon_start_position(int key_position) {
@@ -44,13 +45,12 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
oled_write_P(UP_ICON, false);
} else {
tap_code(KC_VOLD);
-
oled_set_cursor(get_icon_start_position(7), 2);
oled_write_P(PSTR(" "), false);
oled_set_cursor(get_icon_start_position(7), 3);
oled_write_P(DOWN_ICON, false);
}
- } else {
+ } else if (layer_state_is(1)) {
if (clockwise) {
tap_code(KC_BRIU);
oled_set_cursor(get_icon_start_position(7), 3);
@@ -64,6 +64,20 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
oled_set_cursor(get_icon_start_position(7), 3);
oled_write_P(DOWN_ICON, false);
}
+ } else if (layer_state_is(2)) {
+ if (clockwise) {
+ rgblight_increase_val();
+ oled_set_cursor(get_icon_start_position(7), 3);
+ oled_write_P(PSTR(" "), false);
+ oled_set_cursor(get_icon_start_position(7), 2);
+ oled_write_P(UP_ICON, false);
+ } else {
+ rgblight_decrease_val();
+ oled_set_cursor(get_icon_start_position(7), 2);
+ oled_write_P(PSTR(" "), false);
+ oled_set_cursor(get_icon_start_position(7), 3);
+ oled_write_P(DOWN_ICON, false);
+ }
}
}
return true;
@@ -174,7 +188,34 @@ void draw_brightness_icon(int key_position, int row) {
oled_write_P(ICON_BRIGHTNESS_1, false);
}
-bool oled_task_user(void) {
+void draw_mode_icon(int key_position, int row) {
+ static const char PROGMEM ICON_MODE_0[] = {0x94, 0x95, 0};
+ static const char PROGMEM ICON_MODE_1[] = {0xB4, 0xB5, 0};
+ oled_set_cursor(get_icon_start_position(key_position), row);
+ oled_write_P(ICON_MODE_0, false);
+ oled_set_cursor(get_icon_start_position(key_position), row + 1);
+ oled_write_P(ICON_MODE_1, false);
+}
+
+void draw_hue_icon(int key_position, int row) {
+ static const char PROGMEM ICON_HUE_0[] = {0x96, 0x97, 0};
+ static const char PROGMEM ICON_HUE_1[] = {0xB6, 0xB7, 0};
+ oled_set_cursor(get_icon_start_position(key_position), row);
+ oled_write_P(ICON_HUE_0, false);
+ oled_set_cursor(get_icon_start_position(key_position), row + 1);
+ oled_write_P(ICON_HUE_1, false);
+}
+
+void draw_sat_icon(int key_position, int row) {
+ static const char PROGMEM ICON_SAT_0[] = {0xBB, 0xBC, 0};
+ static const char PROGMEM ICON_SAT_1[] = {0xDB, 0xDC, 0};
+ oled_set_cursor(get_icon_start_position(key_position), row);
+ oled_write_P(ICON_SAT_0, false);
+ oled_set_cursor(get_icon_start_position(key_position), row + 1);
+ oled_write_P(ICON_SAT_1, false);
+}
+
+void oled_task_user(void) {
// Host Keyboard Layer Status
static const char PROGMEM ICON_LAYER[] = {0x80, 0x81, 0x82, 0x83, 0};
static const char PROGMEM ICON_ENCODER[] = {0x84, 0x85, 0x86, 0x87, 0};
@@ -189,6 +230,9 @@ bool oled_task_user(void) {
case 1:
oled_write_P(PSTR("2ND "), false);
break;
+ case 2:
+ oled_write_P(PSTR("3RD "), false);
+ break;
default:
// Or use the write_ln shortcut over adding '\n' to the end of your string
oled_write_P(PSTR("UNDF"), false);
@@ -204,6 +248,9 @@ bool oled_task_user(void) {
case 1:
oled_write_P(PSTR("BRGT"), false);
break;
+ case 2:
+ oled_write_P(PSTR("RGB "), false);
+ break;
default:
// Or use the write_ln shortcut over adding '\n' to the end of your string
oled_write_P(PSTR("UNDF"), false);
@@ -227,6 +274,14 @@ bool oled_task_user(void) {
draw_lower_icon(5, 2);
draw_brightness_icon(6, 2);
break;
+ case 2:
+ draw_raise_icon(1, 2);
+ draw_mode_icon(2, 2);
+ draw_hue_icon(3, 2);
+ draw_sat_icon(4, 2);
+ draw_lower_icon(5, 2);
+ draw_brightness_icon(6, 2);
+ break;
}
return false;