diff --git a/keyboard/aardvark/config.h b/keyboard/aardvark/config.h new file mode 100644 index 00000000..94a466c7 --- /dev/null +++ b/keyboard/aardvark/config.h @@ -0,0 +1,86 @@ +/* +Copyright 2012 Jun Wako + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#ifndef CONFIG_H +#define CONFIG_H + + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x0A0C +#define DEVICE_VER 0x0033 +#define MANUFACTURER di0ib +#define PRODUCT The aardvark Keyboard +#define DESCRIPTION A compact keyboard + +/* key matrix size */ +#define MATRIX_ROWS 3 +#define MATRIX_COLS 12 + +/* number of backlight levels */ +#define BACKLIGHT_LEVELS 4 + +/* define if matrix has ghost */ +//#define MATRIX_HAS_GHOST + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 5 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE + +/* key combination for command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +/* ws2812 RGB LED */ +#define ws2812_PORTREG PORTB +#define ws2812_DDRREG DDRB +#define ws2812_pin PB2 +#define RGBLED_NUM 3 // Number of LEDs +#ifndef RGBLIGHT_HUE_STEP +#define RGBLIGHT_HUE_STEP 10 +#endif +#ifndef RGBLIGHT_SAT_STEP +#define RGBLIGHT_SAT_STEP 17 +#endif +#ifndef RGBLIGHT_VAL_STEP +#define RGBLIGHT_VAL_STEP 17 +#endif + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +//#define NO_DEBUG + +/* disable print */ +//#define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION + +#endif diff --git a/keyboard/aardvark/keymap_aardvark.c b/keyboard/aardvark/keymap_aardvark.c new file mode 100644 index 00000000..c94b2b97 --- /dev/null +++ b/keyboard/aardvark/keymap_aardvark.c @@ -0,0 +1,116 @@ +#include "keymap_common.h" +#include "rgblight.h" + +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, +}; + +const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +KEYMAP( + ESC, Q, W, E, R, T, Y, U, I, O, P, BSPC, + FN2, A, S, D, F, G, H, J, K, L, SCLN, QUOT, + LSFT, Z, X, C, V, B, N, M, COMM, DOT, SLSH, FN3 +), + +KEYMAP( + GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, DELETE, + TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, MINS, EQL, LBRC, RBRC, BSLS, + TRNS, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, TRNS +), + +KEYMAP( + FN6, FN7, FN8, FN9, FN10, FN11, FN12, FN13, FN14, FN15, FN16, DELETE, + TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, FN17, FN18, FN19, FN20, FN21, + TRNS, F1, F2, F3, TRNS, TRNS, F6, F7, F8, F9, F10, TRNS +), + +KEYMAP( /* Tab */ + ESC, CALC, WHOM, MAIL, MYCM, TRNS, TRNS, TRNS, TRNS, TRNS, PSCR, TRNS, + TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, + TRNS, FN4, FN5, FN22, FN23, FN24, FN25, FN26, FN27, TRNS, TRNS, TRNS +), +}; + +const action_t PROGMEM fn_actions[] = { + [0] = ACTION_LAYER_MOMENTARY(1), + [1] = ACTION_LAYER_MOMENTARY(2), + [2] = ACTION_LAYER_TAP_KEY(3, KC_TAB), + [3] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_ENT), + [4] = ACTION_FUNCTION(RGBLED_TOGGLE), + [5] = ACTION_FUNCTION(RGBLED_STEP_MODE), + [6] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), + [7] = ACTION_MODS_KEY(MOD_LSFT, KC_1), + [8] = ACTION_MODS_KEY(MOD_LSFT, KC_2), + [9] = ACTION_MODS_KEY(MOD_LSFT, KC_3), + [10] = ACTION_MODS_KEY(MOD_LSFT, KC_4), + [11] = ACTION_MODS_KEY(MOD_LSFT, KC_5), + [12] = ACTION_MODS_KEY(MOD_LSFT, KC_6), + [13] = ACTION_MODS_KEY(MOD_LSFT, KC_7), + [14] = ACTION_MODS_KEY(MOD_LSFT, KC_8), + [15] = ACTION_MODS_KEY(MOD_LSFT, KC_9), + [16] = ACTION_MODS_KEY(MOD_LSFT, KC_0), + [17] = ACTION_MODS_KEY(MOD_LSFT, KC_MINS), + [18] = ACTION_MODS_KEY(MOD_LSFT, KC_EQL), + [19] = ACTION_MODS_KEY(MOD_LSFT, KC_LBRC), + [20] = ACTION_MODS_KEY(MOD_LSFT, KC_RBRC), + [21] = ACTION_MODS_KEY(MOD_LSFT, KC_BSLS), + [22] = ACTION_FUNCTION(RGBLED_INCREASE_HUE), + [23] = ACTION_FUNCTION(RGBLED_DECREASE_HUE), + [24] = ACTION_FUNCTION(RGBLED_INCREASE_SAT), + [25] = ACTION_FUNCTION(RGBLED_DECREASE_SAT), + [26] = ACTION_FUNCTION(RGBLED_INCREASE_VAL), + [27] = 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_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; + case RGBLED_STEP_MODE: + if (record->event.pressed) { + rgblight_step(); + } + break; + } +}