From 738b072bb0f25d0369a998c550c369e4f64cc7a5 Mon Sep 17 00:00:00 2001 From: Luiz Ribeiro Date: Tue, 4 Jul 2017 11:12:42 -0400 Subject: [PATCH] Fixed indentation and now using quantum keycodes for rgblight --- build_keyboard.mk | 10 +-- keyboards/ps2avrGB/keymaps/default/keymap.c | 89 ++++----------------- keyboards/ps2avrGB/program | 2 +- keyboards/ps2avrGB/ps2avrGB.h | 1 + 4 files changed, 24 insertions(+), 78 deletions(-) diff --git a/build_keyboard.mk b/build_keyboard.mk index 550440cbcf..b4f1c1cfff 100644 --- a/build_keyboard.mk +++ b/build_keyboard.mk @@ -201,11 +201,11 @@ ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) SRC += $(QUANTUM_DIR)/rgblight.c CIE1931_CURVE = yes LED_BREATHING_TABLE = yes -ifeq ($(strip $(RGBLIGHT_CUSTOM_DRIVER)), yes) - OPT_DEFS += -DRGBLIGHT_CUSTOM_DRIVER -else - SRC += $(QUANTUM_DIR)/light_ws2812.c -endif + ifeq ($(strip $(RGBLIGHT_CUSTOM_DRIVER)), yes) + OPT_DEFS += -DRGBLIGHT_CUSTOM_DRIVER + else + SRC += $(QUANTUM_DIR)/light_ws2812.c + endif endif ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) diff --git a/keyboards/ps2avrGB/keymaps/default/keymap.c b/keyboards/ps2avrGB/keymaps/default/keymap.c index 60929ac997..4650ff633f 100644 --- a/keyboards/ps2avrGB/keymaps/default/keymap.c +++ b/keyboards/ps2avrGB/keymaps/default/keymap.c @@ -20,79 +20,24 @@ along with this program. If not, see . #include "rgblight.h" const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - KC_KEYMAP( - ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,HOME,END, - GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, DEL, - TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, INS, - CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT,ENT, PGUP, - LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT, UP, PGDN, - LCTL,LALT,LGUI, SPC, RGUI,RALT,RCTL,LEFT,DOWN,RGHT - ) -}; - -enum function_id { - RGBLED_TOGGLE, - RGBLED_STEP_MODE, - RGBLED_INCREASE_HUE, - RGBLED_DECREASE_HUE, - RGBLED_INCREASE_SAT, - RGBLED_DECREASE_SAT, - RGBLED_INCREASE_VAL, - RGBLED_DECREASE_VAL, + [0] = KEYMAP( + 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, KC_PSCR,KC_HOME,KC_END, + 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_DEL, + 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_INS, + KC_FN0, 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_PGUP, + 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_PGDN, + KC_LCTL,KC_LALT,KC_LGUI, KC_SPC, KC_RGUI,KC_RALT,KC_RCTL,KC_LEFT,KC_DOWN,KC_RGHT + ), + [1] = KEYMAP( + KC_TRNS,RGB_TOG,RGB_MOD,RGB_HUI,RGB_SAI,RGB_VAI,RGB_HUD,RGB_SAD,RGB_VAD,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_END, + KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_DEL, + KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_INS, + KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS,KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_RGHT + ), }; const uint16_t PROGMEM fn_actions[] = { - [0] = ACTION_FUNCTION(RGBLED_TOGGLE), - [1] = ACTION_FUNCTION(RGBLED_STEP_MODE), - [2] = ACTION_FUNCTION(RGBLED_INCREASE_HUE), - [3] = ACTION_FUNCTION(RGBLED_DECREASE_HUE), - [4] = ACTION_FUNCTION(RGBLED_INCREASE_SAT), - [5] = ACTION_FUNCTION(RGBLED_DECREASE_SAT), - [6] = ACTION_FUNCTION(RGBLED_INCREASE_VAL), - [7] = ACTION_FUNCTION(RGBLED_DECREASE_VAL), -}; - -void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { - switch (id) { - case RGBLED_TOGGLE: - if (record->event.pressed) { - rgblight_toggle(); - } - break; - case RGBLED_STEP_MODE: - if (record->event.pressed) { - rgblight_step(); - } - break; - case RGBLED_INCREASE_HUE: - if (record->event.pressed) { - rgblight_increase_hue(); - } - break; - case RGBLED_DECREASE_HUE: - if (record->event.pressed) { - rgblight_decrease_hue(); - } - break; - case RGBLED_INCREASE_SAT: - if (record->event.pressed) { - rgblight_increase_sat(); - } - break; - case RGBLED_DECREASE_SAT: - if (record->event.pressed) { - rgblight_decrease_sat(); - } - break; - case RGBLED_INCREASE_VAL: - if (record->event.pressed) { - rgblight_increase_val(); - } - break; - case RGBLED_DECREASE_VAL: - if (record->event.pressed) { - rgblight_decrease_val(); - } - break; - } + [0] = ACTION_LAYER_MOMENTARY(1), }; diff --git a/keyboards/ps2avrGB/program b/keyboards/ps2avrGB/program index b45bff8e5f..a88d9cd9b0 100755 --- a/keyboards/ps2avrGB/program +++ b/keyboards/ps2avrGB/program @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python # Copyright 2017 Luiz Ribeiro # # This program is free software: you can redistribute it and/or modify diff --git a/keyboards/ps2avrGB/ps2avrGB.h b/keyboards/ps2avrGB/ps2avrGB.h index 813f31f804..35902cff4d 100644 --- a/keyboards/ps2avrGB/ps2avrGB.h +++ b/keyboards/ps2avrGB/ps2avrGB.h @@ -18,6 +18,7 @@ along with this program. If not, see . #ifndef KEYMAP_COMMON_H #define KEYMAP_COMMON_H +#include "quantum_keycodes.h" #include "keycode.h" #include "action.h"