diff --git a/common_features.mk b/common_features.mk index a67cf230..1c0b3546 100644 --- a/common_features.mk +++ b/common_features.mk @@ -155,6 +155,9 @@ endif ifeq ($(strip $(BACKLIGHT_ENABLE)), yes) ifeq ($(strip $(VISUALIZER_ENABLE)), yes) CIE1931_CURVE = yes + endif + ifeq ($(strip $(BACKLIGHT_CUSTOM_DRIVER)), yes) + OPT_DEFS += -DBACKLIGHT_CUSTOM_DRIVER endif endif diff --git a/docs/feature_layouts.md b/docs/feature_layouts.md index 24c42c09..bfae9204 100644 --- a/docs/feature_layouts.md +++ b/docs/feature_layouts.md @@ -35,10 +35,12 @@ New names should try to stick to the standards set by existing layouts, and can ## Supporting a Layout -For a keyboard to support a layout, the variable (`[a-z0-9_]`) must be defined in it's `.h`, and match the number of arguments/keys (and preferably the physical layout): +For a keyboard to support a layout, the variable must be defined in it's `.h`, and match the number of arguments/keys (and preferably the physical layout): #define LAYOUT_60_ansi KEYMAP_ANSI +The name of the layout must match this regex: `[a-z0-9_]+` + The folder name must be added to the keyboard's `rules.mk`: LAYOUTS = 60_ansi diff --git a/keyboards/chocopad/README.md b/keyboards/chocopad/README.md new file mode 100644 index 00000000..ad0f6b35 --- /dev/null +++ b/keyboards/chocopad/README.md @@ -0,0 +1,14 @@ +Chocopad +======== + +A 4x4 macropad keyboard using Kailh PG1350 Lower Profile Choc switches. + +Keyboard Maintainer: Keebio +Hardware Supported: Chocopad PCB, Arduino Pro Micro +Hardware Availability: [Keebio](https://keeb.io) + +Make example for this keyboard (after setting up your build environment): + + make chocopad:default + +See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. diff --git a/keyboards/chocopad/chocopad.c b/keyboards/chocopad/chocopad.c new file mode 100644 index 00000000..f54753af --- /dev/null +++ b/keyboards/chocopad/chocopad.c @@ -0,0 +1 @@ +#include "chocopad.h" diff --git a/keyboards/chocopad/chocopad.h b/keyboards/chocopad/chocopad.h new file mode 100644 index 00000000..329e2d56 --- /dev/null +++ b/keyboards/chocopad/chocopad.h @@ -0,0 +1,32 @@ +#ifndef CHOCOPAD_H +#define CHOCOPAD_H + +#include "quantum.h" + +#define KEYMAP( \ + A1, A2, A3, A4, \ + B1, B2, B3, B4, \ + C1, C2, C3, C4, \ + D1, D2, D3, D4 \ +) { \ + { A1, A2, A3, A4 }, \ + { B1, B2, B3, B4 }, \ + { C1, C2, C3, C4 }, \ + { D1, D2, D3, D4 } \ +} + +// Used to create a keymap using only KC_ prefixed keys +#define KC_KEYMAP( \ + A1, A2, A3, A4, \ + B1, B2, B3, B4, \ + C1, C2, C3, C4, \ + D1, D2, D3, D4 \ +) \ + KEYMAP( \ + KC_##A1, KC_##A2, KC_##A3, KC_##A4, \ + KC_##B1, KC_##B2, KC_##B3, KC_##B4, \ + KC_##C1, KC_##C2, KC_##C3, KC_##C4, \ + KC_##D1, KC_##D2, KC_##D3, KC_##D4 \ + ) + +#endif diff --git a/keyboards/chocopad/config.h b/keyboards/chocopad/config.h new file mode 100644 index 00000000..bf861ccd --- /dev/null +++ b/keyboards/chocopad/config.h @@ -0,0 +1,59 @@ +#ifndef CONFIG_H +#define CONFIG_H + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xCEEB +#define PRODUCT_ID 0x1144 +#define DEVICE_VER 0x0100 +#define MANUFACTURER Keebio +#define PRODUCT Chocopad +#define DESCRIPTION 4x4 macropad using Kailh Choc low-profile switches + +/* key matrix size */ +#define MATRIX_ROWS 4 +#define MATRIX_COLS 4 + +/* key matrix pins */ +#define MATRIX_ROW_PINS { D7, E6, B3, B2 } +#define MATRIX_COL_PINS { D2, D4, F6, F5 } + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* number of backlight levels */ +#define BACKLIGHT_PIN B5 +#define BACKLIGHT_LEVELS 6 + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCING_DELAY 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)) \ +) + +/* prevent stuck modifiers */ +#define PREVENT_STUCK_MODIFIERS + + +#ifdef RGB_DI_PIN +#define RGBLIGHT_ANIMATIONS +#define RGBLIGHT_HUE_STEP 8 +#define RGBLIGHT_SAT_STEP 8 +#define RGBLIGHT_VAL_STEP 8 +#endif +#define RGB_DI_PIN D3 +#define RGBLIGHT_TIMER +#define RGBLED_NUM 4 +#define ws2812_PORTREG PORTD +#define ws2812_DDRREG DDRD + +#endif \ No newline at end of file diff --git a/keyboards/chocopad/keymaps/default/config.h b/keyboards/chocopad/keymaps/default/config.h new file mode 100644 index 00000000..7fa3bf32 --- /dev/null +++ b/keyboards/chocopad/keymaps/default/config.h @@ -0,0 +1,6 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +#endif diff --git a/keyboards/chocopad/keymaps/default/keymap.c b/keyboards/chocopad/keymaps/default/keymap.c new file mode 100644 index 00000000..c4536a1b --- /dev/null +++ b/keyboards/chocopad/keymaps/default/keymap.c @@ -0,0 +1,61 @@ +#include "chocopad.h" + +#define _BASE 0 +#define _FN1 1 +#define _FN2 2 + +#define KC_ KC_TRNS +#define _______ KC_TRNS + +#define KC_X1 MO(_FN1) +#define KC_X2 MO(_FN2) +#define KC_RST RESET +#define KC_BSTP BL_STEP +#define KC_RTOG RGB_TOG +#define KC_RMOD RGB_MOD +#define KC_RHUI RGB_HUI +#define KC_RHUD RGB_HUD +#define KC_RSAI RGB_SAI +#define KC_RSAD RGB_SAD +#define KC_RVAI RGB_VAI +#define KC_RVAD RGB_VAD + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [_BASE] = KC_KEYMAP( + //,----+----+----+----. + PGUP,HOME, UP ,END , + //|----+----+----+----| + PGDN,LEFT,DOWN,RGHT, + //|----+----+----+----| + X2 ,VOLU,MPLY,MPRV, + //|----+----+----+----| + X1 ,VOLD,MUTE,MNXT + //`----+----+----+----' + ), + + [_FN1] = KC_KEYMAP( + //,----+----+----+----. + ESC , P7 , P8 , P9 , + //|----+----+----+----| + TAB , P4 , P5 , P6 , + //|----+----+----+----| + ENT , P1 , P2 , P3 , + //|----+----+----+----| + , P0 , P0 ,DOT + //`----+----+----+----' + ), + + [_FN2] = KC_KEYMAP( + //,----+----+----+----. + RTOG,RHUI,RSAI,RVAI, + //|----+----+----+----| + RMOD,RHUD,RSAD,RVAD, + //|----+----+----+----| + , , ,RST , + //|----+----+----+----| + BSTP, , , + //`----+----+----+----' + ) + +}; diff --git a/keyboards/chocopad/keymaps/default/rules.mk b/keyboards/chocopad/keymaps/default/rules.mk new file mode 100644 index 00000000..1e576127 --- /dev/null +++ b/keyboards/chocopad/keymaps/default/rules.mk @@ -0,0 +1,5 @@ +RGBLIGHT_ENABLE = yes + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif diff --git a/keyboards/chocopad/rules.mk b/keyboards/chocopad/rules.mk new file mode 100644 index 00000000..cd9222a1 --- /dev/null +++ b/keyboards/chocopad/rules.mk @@ -0,0 +1,56 @@ +# MCU name +MCU = atmega32u4 + +# Processor frequency. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +# +# This will be an integer division of F_USB below, as it is sourced by +# F_USB after it has run through any CPU prescalers. Note that this value +# does not *change* the processor frequency - it should merely be updated to +# reflect the processor speed set externally so that the code can use accurate +# software delays. +F_CPU = 16000000 + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + + +# Boot Section Size in *bytes* +OPT_DEFS += -DBOOTLOADER_SIZE=4096 + + +# Build Options +# comment out to disable the options. +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality +AUDIO_ENABLE = no +RGBLIGHT_ENABLE = yes diff --git a/keyboards/clueboard/60/rules.mk b/keyboards/clueboard/60/rules.mk index 93e6019a..e0c4b850 100644 --- a/keyboards/clueboard/60/rules.mk +++ b/keyboards/clueboard/60/rules.mk @@ -28,11 +28,13 @@ MCU = cortex-m4 # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 ARMV = 7 +USE_FPU = yes + # Vector table for application # 0x00000000-0x00001000 area is occupied by bootlaoder.*/ # The CORTEX_VTOR... is needed only for MCHCK/Infinity KB # OPT_DEFS = -DCORTEX_VTOR_INIT=0x08005000 -OPT_DEFS = +OPT_DEFS = # Options to pass to dfu-util when flashing DFU_ARGS = -d 0483:df11 -a 0 -s 0x08000000 -R diff --git a/keyboards/clueboard/66/keymaps/manofinterests/keymap.c b/keyboards/clueboard/66/keymaps/manofinterests/keymap.c new file mode 100644 index 00000000..ae74b12d --- /dev/null +++ b/keyboards/clueboard/66/keymaps/manofinterests/keymap.c @@ -0,0 +1,39 @@ +#include "66.h" + +// Helpful defines +#define _______ KC_TRNS + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +#define _BL 0 +#define _FL 1 +#define _CL 2 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Keymap _BL: Base Layer (Default Layer) + */ +[_BL] = KEYMAP( + KC_GESC,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_GRV, KC_BSPC, RGB_VAI, \ + 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, RGB_VAD, \ + KC_CAPS,KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT,KC_NUHS,KC_ENT, \ + KC_LSFT,KC_NUBS,KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH,KC_RO, KC_RSFT, KC_UP, \ + KC_LCTL,KC_LGUI,KC_LALT,KC_MHEN, KC_SPC, KC_SPC, KC_HENK,KC_RALT,MO(_FL),KC_RCTL,KC_LEFT,KC_DOWN,KC_RGHT), + + /* Keymap _FL: Function Layer + */ +[_FL] = KEYMAP( + KC_GRV, 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_DEL, KC_VOLU, \ + _______,_______,_______,_______,_______,_______,_______,_______,_______,KC_MPRV,KC_MPLY,KC_MNXT,_______,KC_MUTE, KC_VOLD, \ + _______,_______,MO(_CL),_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, \ + _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, KC_PGUP, \ + _______,_______,_______,_______, _______,_______, _______,_______,MO(_FL),_______,KC_HOME,KC_PGDN,KC_END), + + /* Keymap _CL: Control layer + */ +[_CL] = KEYMAP( + BL_STEP,RGB_M_P,RGB_M_B,RGB_M_R,RGB_M_SW,RGB_M_SN,RGB_M_K,RGB_M_X,RGB_M_G,_______,_______,_______,_______,_______,RGB_TOG, RGB_VAI, \ + _______,_______,_______,_______,RESET, _______,_______,_______,_______,_______,_______,_______,_______,_______, RGB_VAD, \ + _______,_______,MO(_CL),_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, \ + MO(_FL),_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, RGB_SAI, \ + _______,_______,_______,_______, RGB_MOD, RGB_MOD, _______,_______,MO(_FL),_______,RGB_HUD,RGB_SAD,RGB_HUI), +}; diff --git a/keyboards/clueboard/66/keymaps/manofinterests/readme.md b/keyboards/clueboard/66/keymaps/manofinterests/readme.md new file mode 100644 index 00000000..019131ae --- /dev/null +++ b/keyboards/clueboard/66/keymaps/manofinterests/readme.md @@ -0,0 +1,8 @@ +![Clueboard Layout Image](http://i.imgur.com/7Capi8W.png) + +# Default Clueboard Layout + +This is the default layout that comes flashed on every Clueboard. For the most +part it's a straightforward and easy to follow layout. The only unusual key is +the key in the upper left, which sends Escape normally, but Grave when any of +the Ctrl, Alt, or GUI modifiers are held down. diff --git a/keyboards/dz60/keymaps/60_plus_arrows/keymap.c b/keyboards/dz60/keymaps/60_plus_arrows/keymap.c new file mode 100644 index 00000000..6b857e3f --- /dev/null +++ b/keyboards/dz60/keymaps/60_plus_arrows/keymap.c @@ -0,0 +1,86 @@ +#include "dz60.h" + +#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)) + +#define ______ KC_TRNS + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* Qwerty + * ,-----------------------------------------------------------------------------------------. + * | ` ~ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | Bkspc | + * |-----------------------------------------------------------------------------------------+ + * | Tab | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ | + * |-----------------------------------------------------------------------------------------+ + * | Caps | A | S | D | F | G | H | J | K | L | ; | ' | Enter | + * |-----------------------------------------------------------------------------------------+ + * | Shift | Z | X | C | V | B | N | M | , | . | / | RSh | U | FN | + * |-----------------------------------------------------------------------------------------+ + * | Ctrl | Alt | Cmd | Space | Cmd | RAlt | L | D | R | + * `-----------------------------------------------------------------------------------------' + */ + + KEYMAP_2_SHIFTS( + 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_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_CAPS, 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_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, MO(1), + KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_SPC, KC_SPC, KC_RGUI, KC_RALT, KC_LEFT, KC_DOWN, KC_RIGHT + ), + +/* FN Layer + * ,-----------------------------------------------------------------------------------------. + * | Esc | BL- | BL+ | BL | | | |RESET| | | | | | | + * |-----------------------------------------------------------------------------------------+ + * | |RBGM | | | | | | | | | | Val+ | Val- |RBGTOG| + * |-----------------------------------------------------------------------------------------+ + * | | Hue+| Hue-| Sat+| Sat-| | | | | | | | | + * |-----------------------------------------------------------------------------------------+ + * | | | | | | | | | | | | | Ctrl| | + * |-----------------------------------------------------------------------------------------+ + * | | | | | | | | | | + * `-----------------------------------------------------------------------------------------' + */ + + KEYMAP_DIRECTIONAL( + KC_ESC, BL_TOGG, BL_STEP, BL_DEC, BL_INC, ______, ______, RESET, ______, ______, ______, ______, ______, ______, ______, + ______, RGB_MOD, ______, ______, ______, ______, ______, ______, ______, ______, ______, RGB_VAI, RGB_VAD, RGB_TOG, + ______, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, ______, ______, ______, ______, ______, ______, ______, + ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, KC_RCTL, ______, + ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______ + ), +}; + +enum function_id { + SHIFT_ESC, +}; + +const uint16_t PROGMEM fn_actions[] = { + [0] = ACTION_FUNCTION(SHIFT_ESC), +}; + +void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { + static uint8_t shift_esc_shift_mask; + switch (id) { + case SHIFT_ESC: + shift_esc_shift_mask = get_mods()&MODS_CTRL_MASK; + if (record->event.pressed) { + if (shift_esc_shift_mask) { + add_key(KC_GRV); + send_keyboard_report(); + } else { + add_key(KC_ESC); + send_keyboard_report(); + } + } else { + if (shift_esc_shift_mask) { + del_key(KC_GRV); + send_keyboard_report(); + } else { + del_key(KC_ESC); + send_keyboard_report(); + } + } + break; + } +} \ No newline at end of file diff --git a/keyboards/ergodox_ez/keymaps/default/keymap.c b/keyboards/ergodox_ez/keymaps/default/keymap.c index 3c15b8a4..e400ffcd 100644 --- a/keyboards/ergodox_ez/keymaps/default/keymap.c +++ b/keyboards/ergodox_ez/keymaps/default/keymap.c @@ -217,8 +217,10 @@ uint32_t layer_state_set_user(uint32_t state) { #ifdef RGBLIGHT_COLOR_LAYER_0 rgblight_setrgb(RGBLIGHT_COLOR_LAYER_0); #else + #ifdef RGBLIGHT_ENABLE rgblight_init(); #endif + #endif break; case 1: ergodox_right_led_1_on(); diff --git a/keyboards/ergodox_ez/keymaps/drashna/config.h b/keyboards/ergodox_ez/keymaps/drashna/config.h index c0286f16..2f5422b1 100644 --- a/keyboards/ergodox_ez/keymaps/drashna/config.h +++ b/keyboards/ergodox_ez/keymaps/drashna/config.h @@ -20,4 +20,7 @@ #define IGNORE_MOD_TAP_INTERRUPT // this makes it possible to do rolling combos (zx) with keys that convert to other keys on hold (z becomes ctrl when you hold it, and when this option isn't enabled, z rapidly followed by x actually sends Ctrl-x. That's bad.) #define ONESHOT_TAP_TOGGLE 2 +#undef PRODUCT +#define PRODUCT DrashnaDox - Hacked ErgoDox EZ Shine + #endif diff --git a/keyboards/ergodox_ez/keymaps/drashna/keymap.c b/keyboards/ergodox_ez/keymaps/drashna/keymap.c index c7939de3..0d0e1fba 100644 --- a/keyboards/ergodox_ez/keymaps/drashna/keymap.c +++ b/keyboards/ergodox_ez/keymaps/drashna/keymap.c @@ -52,7 +52,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_EQUAL, KC_1, KC_2, KC_3, KC_4, KC_5, TG(_MOUS), KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(_DIABLO), KC_BSPACE, KC_A, KC_S, KC_D, KC_F, KC_G, - OSM(MOD_LSFT), LCTL_T(KC_Z),KC_X, KC_C, KC_V, KC_B, TG(_GAMEPAD), + KC_LSFT, LCTL_T(KC_Z),KC_X, KC_C, KC_V, KC_B, TG(_GAMEPAD), LT(_SYMB,KC_GRAVE),KC_QUOTE, KC_LGUI, KC_LBRACKET,KC_RBRACKET, ALT_T(KC_APPLICATION), KC_LGUI, @@ -96,7 +96,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, TG(_MOUS), KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, TG(_DIABLO), KC_BSPC, KC_A, KC_R, KC_S, KC_T, KC_D, - OSM(MOD_LSFT), LCTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, TG(_GAMEPAD), + KC_LSFT, LCTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, TG(_GAMEPAD), LT(_SYMB,KC_GRV),KC_QUOT, KC_LGUI, KC_LBRACKET,KC_RBRACKET, ALT_T(KC_APP), KC_LGUI, KC_HOME, @@ -139,7 +139,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, TG(_MOUS), KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, TG(_DIABLO), KC_BSPC, KC_A, KC_O, KC_E, KC_U, KC_I, - OSM(MOD_LSFT), LCTL_T(KC_SCLN), KC_Q, KC_J, KC_K, KC_X, TG(_GAMEPAD), + KC_LSFT, LCTL_T(KC_SCLN), KC_Q, KC_J, KC_K, KC_X, TG(_GAMEPAD), LT(_SYMB,KC_GRV),KC_QUOT, KC_LGUI, KC_LBRACKET, KC_RBRACKET, ALT_T(KC_APP), KC_LEAD, KC_HOME, @@ -182,7 +182,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, TG(_MOUS), KC_TAB, KC_Q, KC_D, KC_R, KC_W, KC_B, TG(_DIABLO), KC_BSPC, KC_A, KC_S, KC_H, KC_T, KC_G, - OSM(MOD_LSFT), LCTL_T(KC_Z), KC_X, KC_M, KC_C, KC_V, TG(_GAMEPAD), + KC_LSFT, LCTL_T(KC_Z), KC_X, KC_M, KC_C, KC_V, TG(_GAMEPAD), LT(_SYMB,KC_GRV),KC_QUOT, KC_LGUI, KC_LBRACKET,KC_RBRACKET, ALT_T(KC_APP), KC_LEAD, KC_HOME, diff --git a/keyboards/iris/iris.h b/keyboards/iris/iris.h index ec2aabab..a0df746f 100644 --- a/keyboards/iris/iris.h +++ b/keyboards/iris/iris.h @@ -3,6 +3,8 @@ #ifdef KEYBOARD_iris_rev1 #include "rev1.h" +#elif KEYBOARD_iris_rev1_led + #include "rev1_led.h" #else #include "rev2.h" #endif diff --git a/keyboards/iris/keymaps/default/config.h b/keyboards/iris/keymaps/default/config.h index c4604af4..72e35c47 100644 --- a/keyboards/iris/keymaps/default/config.h +++ b/keyboards/iris/keymaps/default/config.h @@ -1,5 +1,5 @@ /* -Copyright 2017 Danny Nguyen +Copyright 2017 Danny Nguyen 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 diff --git a/keyboards/iris/keymaps/hexwire/config.h b/keyboards/iris/keymaps/hexwire/config.h index 81df2e91..53b00d24 100644 --- a/keyboards/iris/keymaps/hexwire/config.h +++ b/keyboards/iris/keymaps/hexwire/config.h @@ -1,5 +1,5 @@ /* -Copyright 2017 Danny Nguyen +Copyright 2017 Danny Nguyen 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 diff --git a/keyboards/iris/keymaps/lewisridden/config.h b/keyboards/iris/keymaps/lewisridden/config.h index 259efc8d..6d96b31b 100644 --- a/keyboards/iris/keymaps/lewisridden/config.h +++ b/keyboards/iris/keymaps/lewisridden/config.h @@ -1,5 +1,5 @@ /* -Copyright 2017 Danny Nguyen +Copyright 2017 Danny Nguyen 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 diff --git a/keyboards/iris/matrix.c b/keyboards/iris/matrix.c index b83311ce..3d8d2adb 100644 --- a/keyboards/iris/matrix.c +++ b/keyboards/iris/matrix.c @@ -208,6 +208,15 @@ int i2c_transaction(void) { err = i2c_master_write(0x00); if (err) goto i2c_error; +#ifdef BACKLIGHT_ENABLE + // Write backlight level for slave to read + err = i2c_master_write(get_backlight_level()); +#else + // Write zero, so our byte index is the same + err = i2c_master_write(0x00); +#endif + if (err) goto i2c_error; + // Start read err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_READ); if (err) goto i2c_error; @@ -285,8 +294,12 @@ void matrix_slave_scan(void) { int offset = (isLeftHand) ? 0 : ROWS_PER_HAND; #ifdef USE_I2C +#ifdef BACKLIGHT_ENABLE + // Read backlight level sent from master and update level on slave + backlight_set(i2c_slave_buffer[0]); +#endif for (int i = 0; i < ROWS_PER_HAND; ++i) { - i2c_slave_buffer[i] = matrix[offset+i]; + i2c_slave_buffer[i+1] = matrix[offset+i]; } #else // USE_SERIAL for (int i = 0; i < ROWS_PER_HAND; ++i) { diff --git a/keyboards/iris/rev1/config.h b/keyboards/iris/rev1/config.h index c9bc6252..c22d49b2 100644 --- a/keyboards/iris/rev1/config.h +++ b/keyboards/iris/rev1/config.h @@ -1,5 +1,5 @@ /* -Copyright 2017 Danny Nguyen +Copyright 2017 Danny Nguyen 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 @@ -35,7 +35,7 @@ along with this program. If not, see . // wiring of each half #define MATRIX_ROW_PINS { D7, E6, B4, B5, D4 } -#define MATRIX_COL_PINS { F6, F7, B1, B3, B2, F4 } +#define MATRIX_COL_PINS { F6, F7, B1, B3, B2, B6 } /* COL2ROW or ROW2COL */ #define DIODE_DIRECTION COL2ROW @@ -59,7 +59,7 @@ along with this program. If not, see . keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ ) -#define BACKLIGHT_PIN B6 +#define BACKLIGHT_PIN D2 #define BACKLIGHT_LEVELS 5 /* ws2812 RGB LED */ diff --git a/keyboards/iris/rev1_led/config.h b/keyboards/iris/rev1_led/config.h new file mode 100644 index 00000000..95777602 --- /dev/null +++ b/keyboards/iris/rev1_led/config.h @@ -0,0 +1,90 @@ +/* +Copyright 2017 Danny Nguyen + +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 REV1_CONFIG_H +#define REV1_CONFIG_H + +#include QMK_KEYBOARD_CONFIG_H + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xCEEB +#define PRODUCT_ID 0x1256 +#define DEVICE_VER 0x0100 +#define MANUFACTURER Keebio +#define PRODUCT Iris Keyboard +#define DESCRIPTION Split 50 percent ergonomic keyboard + +/* key matrix size */ +// Rows are doubled-up +#define MATRIX_ROWS 10 +#define MATRIX_COLS 6 + +// wiring of each half +#define MATRIX_ROW_PINS { D7, E6, B4, B5, D4 } +#define MATRIX_COL_PINS { F6, F7, B1, B3, B2, F4 } + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* define if matrix has ghost */ +//#define MATRIX_HAS_GHOST + +/* number of backlight levels */ +// #define BACKLIGHT_LEVELS 3 + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCING_DELAY 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)) \ +) + +#define BACKLIGHT_PIN B6 +#define BACKLIGHT_LEVELS 5 + +/* ws2812 RGB LED */ +#define RGB_DI_PIN D3 +#define RGBLIGHT_TIMER +#define RGBLED_NUM 12 // Number of LEDs +#define ws2812_PORTREG PORTD +#define ws2812_DDRREG DDRD + +/* + * 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/keyboards/iris/rev1_led/rev1_led.c b/keyboards/iris/rev1_led/rev1_led.c new file mode 100644 index 00000000..7a4c8748 --- /dev/null +++ b/keyboards/iris/rev1_led/rev1_led.c @@ -0,0 +1,22 @@ +#include "rev1_led.h" + + +#ifdef SSD1306OLED +void led_set_kb(uint8_t usb_led) { + // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here + led_set_user(usb_led); +} +#endif + +void matrix_init_kb(void) { + + // // green led on + // DDRD |= (1<<5); + // PORTD &= ~(1<<5); + + // // orange led on + // DDRB |= (1<<0); + // PORTB &= ~(1<<0); + + matrix_init_user(); +}; diff --git a/keyboards/iris/rev1_led/rev1_led.h b/keyboards/iris/rev1_led/rev1_led.h new file mode 100644 index 00000000..82aa01eb --- /dev/null +++ b/keyboards/iris/rev1_led/rev1_led.h @@ -0,0 +1,40 @@ +#ifndef REV1_LED_H +#define REV1_LED_H + +#include "iris.h" + +//void promicro_bootloader_jmp(bool program); +#include "quantum.h" + + +#ifdef USE_I2C +#include +#ifdef __AVR__ + #include + #include +#endif +#endif + +//void promicro_bootloader_jmp(bool program); + +#define KEYMAP( \ + L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \ + L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \ + L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \ + L30, L31, L32, L33, L34, L35, LT4, RT4, R30, R31, R32, R33, R34, R35, \ + LT1, LT2, LT3, RT3, RT2, RT1 \ + ) \ + { \ + { L00, L01, L02, L03, L04, L05 }, \ + { L10, L11, L12, L13, L14, L15 }, \ + { L20, L21, L22, L23, L24, L25 }, \ + { L30, L31, L32, L33, L34, L35 }, \ + { KC_NO, KC_NO, LT4, LT1, LT2, LT3 }, \ + { R05, R04, R03, R02, R01, R00 }, \ + { R15, R14, R13, R12, R11, R10 }, \ + { R25, R24, R23, R22, R21, R20 }, \ + { R35, R34, R33, R32, R31, R30 }, \ + { KC_NO, KC_NO, RT4, RT1, RT2, RT3 } \ + } + +#endif diff --git a/keyboards/iris/rev1_led/rules.mk b/keyboards/iris/rev1_led/rules.mk new file mode 100644 index 00000000..7b30c0be --- /dev/null +++ b/keyboards/iris/rev1_led/rules.mk @@ -0,0 +1 @@ +BACKLIGHT_ENABLE = no diff --git a/keyboards/iris/rev2/config.h b/keyboards/iris/rev2/config.h index 290fba45..4aa8cda1 100644 --- a/keyboards/iris/rev2/config.h +++ b/keyboards/iris/rev2/config.h @@ -1,5 +1,5 @@ /* -Copyright 2017 Danny Nguyen +Copyright 2017 Danny Nguyen 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 diff --git a/keyboards/iris/rev2/rev2.h b/keyboards/iris/rev2/rev2.h index 6d205365..e0230673 100644 --- a/keyboards/iris/rev2/rev2.h +++ b/keyboards/iris/rev2/rev2.h @@ -1,5 +1,5 @@ -#ifndef REV1_H -#define REV1_H +#ifndef REV2_H +#define REV2_H #include "iris.h" diff --git a/keyboards/jc65/keymaps/na7thana/config.h b/keyboards/jc65/keymaps/na7thana/config.h new file mode 100644 index 00000000..a5568e40 --- /dev/null +++ b/keyboards/jc65/keymaps/na7thana/config.h @@ -0,0 +1 @@ +#include "../../config.h" diff --git a/keyboards/jc65/keymaps/na7thana/keymap.c b/keyboards/jc65/keymaps/na7thana/keymap.c new file mode 100644 index 00000000..2f262efa --- /dev/null +++ b/keyboards/jc65/keymaps/na7thana/keymap.c @@ -0,0 +1,18 @@ +#include "jc65.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = KEYMAP( + KC_GESC, 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_NO, KC_BSLS, KC_HOME, + 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_BSPC, KC_PGUP, + KC_LCTL, 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_PGDN, + KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, MO(1), + KC_LCTL, KC_LALT, KC_LALT, KC_SPACE, KC_SPACE, KC_SPACE, KC_SPACE, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT + ), + [1] = KEYMAP( + RESET, 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_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_HOME, KC_END, KC_DEL, KC_TRNS, + KC_CAPS, RGB_TOG, RGB_MOD, RGB_RMOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLU, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_MPLY, KC_MPLY, KC_VOLU, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_VOLD, KC_TRNS + ), +}; \ No newline at end of file diff --git a/keyboards/jc65/keymaps/na7thana/readme.md b/keyboards/jc65/keymaps/na7thana/readme.md new file mode 100644 index 00000000..13430a63 --- /dev/null +++ b/keyboards/jc65/keymaps/na7thana/readme.md @@ -0,0 +1,10 @@ +Default Keymap +=== + +Super simple default keymap with only a base layer. + +Keymap Maintainer: [Ethan Madden](https://github.com/jetpacktuxedo) + +Difference from base layout: This is (as close as I can tell) the same as the layout that ships on the boards other than default underglow color. + +Intended usage: This is mostly provided for testing before you build your own keymap and as a reference to a stock(ish) configuration diff --git a/keyboards/jc65/keymaps/na7thana/rules.mk b/keyboards/jc65/keymaps/na7thana/rules.mk new file mode 100644 index 00000000..e69de29b diff --git a/keyboards/jj40/backlight.c b/keyboards/jj40/backlight.c new file mode 100644 index 00000000..079c410f --- /dev/null +++ b/keyboards/jj40/backlight.c @@ -0,0 +1,212 @@ +/** + * Backlighting code for PS2AVRGB boards (ATMEGA32A) + * Kenneth A. (github.com/krusli | krusli.me) + */ + +#include "backlight.h" +#include "quantum.h" + +#include +#include + +#include "backlight_custom.h" +#include "breathing_custom.h" + +// DEBUG +#include +#include + +// Port D: digital pins of the AVR chipset +#define NUMLOCK_PORT (1 << 1) // 1st pin of Port D (digital) +#define CAPSLOCK_PORT (1 << 2) // 2nd pin +#define BACKLIGHT_PORT (1 << 4) // 4th pin +#define SCROLLLOCK_PORT (1 << 6) // 6th pin + +#define TIMER_CLK_DIV64 0x03 ///< Timer clocked at F_CPU/64 +#define TIMER1PRESCALE TIMER_CLK_DIV64 ///< timer 1 prescaler default + +#define TIMER_PRESCALE_MASK 0x07 ///< Timer Prescaler Bit-Mask + +#define PWM_MAX 0xFF +#define TIMER_TOP 255 // 8 bit PWM + +extern backlight_config_t backlight_config; + +/** + * References + * Port Registers: https://www.arduino.cc/en/Reference/PortManipulation + * TCCR1A: https://electronics.stackexchange.com/questions/92350/what-is-the-difference-between-tccr1a-and-tccr1b + * Timers: http://www.avrbeginners.net/architecture/timers/timers.html + * 16-bit timer setup: http://sculland.com/ATmega168/Interrupts-And-Timers/16-Bit-Timer-Setup/ + * PS2AVRGB firmware: https://github.com/showjean/ps2avrU/tree/master/firmware + */ + +// @Override +// turn LEDs on and off depending on USB caps/num/scroll lock states. +void led_set_user(uint8_t usb_led) { + if (usb_led & (1 << USB_LED_NUM_LOCK)) { + // turn on + DDRD |= NUMLOCK_PORT; + PORTD |= NUMLOCK_PORT; + } else { + // turn off + DDRD &= ~NUMLOCK_PORT; + PORTD &= ~NUMLOCK_PORT; + } + + if (usb_led & (1 << USB_LED_CAPS_LOCK)) { + DDRD |= CAPSLOCK_PORT; + PORTD |= CAPSLOCK_PORT; + } else { + DDRD &= ~CAPSLOCK_PORT; + PORTD &= ~CAPSLOCK_PORT; + } + + if (usb_led & (1 << USB_LED_SCROLL_LOCK)) { + DDRD |= SCROLLLOCK_PORT; + PORTD |= SCROLLLOCK_PORT; + } else { + DDRD &= ~SCROLLLOCK_PORT; + PORTD &= ~SCROLLLOCK_PORT; + } +} + +#ifdef BACKLIGHT_ENABLE + +// sets up Timer 1 for 8-bit PWM +void timer1PWMSetup(void) { // NOTE ONLY CALL THIS ONCE + // default 8 bit mode + TCCR1A &= ~(1 << 1); // cbi(TCCR1A,PWM11); <- set PWM11 bit to HIGH + TCCR1A |= (1 << 0); // sbi(TCCR1A,PWM10); <- set PWM10 bit to LOW + + // clear output compare value A + // outb(OCR1AH, 0); + // outb(OCR1AL, 0); + + // clear output comparator registers for B + OCR1BH = 0; // outb(OCR1BH, 0); + OCR1BL = 0; // outb(OCR1BL, 0); +} + +bool is_init = false; +void timer1Init(void) { + // timer1SetPrescaler(TIMER1PRESCALE) + // set to DIV/64 + (TCCR1B) = ((TCCR1B) & ~TIMER_PRESCALE_MASK) | TIMER1PRESCALE; + + // reset TCNT1 + TCNT1H = 0; // outb(TCNT1H, 0); + TCNT1L = 0; // outb(TCNT1L, 0); + + // TOIE1: Timer Overflow Interrupt Enable (Timer 1); + TIMSK |= _BV(TOIE1); // sbi(TIMSK, TOIE1); + + is_init = true; +} + +void timer1UnInit(void) { + // set prescaler back to NONE + (TCCR1B) = ((TCCR1B) & ~TIMER_PRESCALE_MASK) | 0x00; // TIMERRTC_CLK_STOP + + // disable timer overflow interrupt + TIMSK &= ~_BV(TOIE1); // overflow bit? + + setPWM(0); + + is_init = false; +} + + +// handle TCNT1 overflow +//! Interrupt handler for tcnt1 overflow interrupt +ISR(TIMER1_OVF_vect, ISR_NOBLOCK) +{ + // sei(); + // handle breathing here + #ifdef BACKLIGHT_BREATHING + if (is_breathing()) { + custom_breathing_handler(); + } + #endif + + // TODO call user defined function +} + +// enable timer 1 PWM +// timer1PWMBOn() +void timer1PWMBEnable(void) { + // turn on channel B (OC1B) PWM output + // set OC1B as non-inverted PWM + TCCR1A |= _BV(COM1B1); + TCCR1A &= ~_BV(COM1B0); +} + +// disable timer 1 PWM +// timer1PWMBOff() +void timer1PWMBDisable(void) { + TCCR1A &= ~_BV(COM1B1); + TCCR1A &= ~_BV(COM1B0); +} + +void enableBacklight(void) { + DDRD |= BACKLIGHT_PORT; // set digital pin 4 as output + PORTD |= BACKLIGHT_PORT; // set digital pin 4 to high +} + +void disableBacklight(void) { + // DDRD &= ~BACKLIGHT_PORT; // set digital pin 4 as input + PORTD &= ~BACKLIGHT_PORT; // set digital pin 4 to low +} + +void startPWM(void) { + timer1Init(); + timer1PWMBEnable(); + enableBacklight(); +} + +void stopPWM(void) { + timer1UnInit(); + disableBacklight(); + timer1PWMBDisable(); +} + +void b_led_init_ports(void) { + /* turn backlight on/off depending on user preference */ + #if BACKLIGHT_ON_STATE == 0 + // DDRx register: sets the direction of Port D + // DDRD &= ~BACKLIGHT_PORT; // set digital pin 4 as input + PORTD &= ~BACKLIGHT_PORT; // set digital pin 4 to low + #else + DDRD |= BACKLIGHT_PORT; // set digital pin 4 as output + PORTD |= BACKLIGHT_PORT; // set digital pin 4 to high + #endif + + timer1PWMSetup(); + startPWM(); + + #ifdef BACKLIGHT_BREATHING + breathing_enable(); + #endif +} + +void b_led_set(uint8_t level) { + if (level > BACKLIGHT_LEVELS) { + level = BACKLIGHT_LEVELS; + } + + setPWM((int)(TIMER_TOP * (float) level / BACKLIGHT_LEVELS)); +} + +// called every matrix scan +void b_led_task(void) { + // do nothing for now +} + +void setPWM(uint16_t xValue) { + if (xValue > TIMER_TOP) { + xValue = TIMER_TOP; + } + OCR1B = xValue; // timer1PWMBSet(xValue); +} + +#endif // BACKLIGHT_ENABLE diff --git a/keyboards/jj40/backlight_custom.h b/keyboards/jj40/backlight_custom.h new file mode 100644 index 00000000..7210be84 --- /dev/null +++ b/keyboards/jj40/backlight_custom.h @@ -0,0 +1,15 @@ +/** + * Backlighting code for PS2AVRGB boards (ATMEGA32A) + * Kenneth A. (github.com/krusli | krusli.me) + */ + +#ifndef BACKLIGHT_CUSTOM_H +#define BACKLIGHT_CUSTOM_H + +#include +void b_led_init_ports(void); +void b_led_set(uint8_t level); +void b_led_task(void); +void setPWM(uint16_t xValue); + +#endif // BACKLIGHT_CUSTOM_H diff --git a/keyboards/jj40/breathing_custom.h b/keyboards/jj40/breathing_custom.h new file mode 100644 index 00000000..71416b1b --- /dev/null +++ b/keyboards/jj40/breathing_custom.h @@ -0,0 +1,140 @@ +/** + * Breathing effect code for PS2AVRGB boards (ATMEGA32A) + * Works in conjunction with `backlight.c`. + * + * Code adapted from `quantum.c` to register with the existing TIMER1 overflow + * handler in `backlight.c` instead of setting up its own timer. + * Kenneth A. (github.com/krusli | krusli.me) + */ + +#ifdef BACKLIGHT_ENABLE +#ifdef BACKLIGHT_BREATHING + +#include "backlight_custom.h" + +#ifndef BREATHING_PERIOD +#define BREATHING_PERIOD 6 +#endif + +#define breathing_min() do {breathing_counter = 0;} while (0) +#define breathing_max() do {breathing_counter = breathing_period * 244 / 2;} while (0) + +// TODO make this share code with quantum.c + +#define BREATHING_NO_HALT 0 +#define BREATHING_HALT_OFF 1 +#define BREATHING_HALT_ON 2 +#define BREATHING_STEPS 128 + +static uint8_t breathing_period = BREATHING_PERIOD; +static uint8_t breathing_halt = BREATHING_NO_HALT; +static uint16_t breathing_counter = 0; + +static bool breathing = false; + +bool is_breathing(void) { + return breathing; +} + +// See http://jared.geek.nz/2013/feb/linear-led-pwm +static uint16_t cie_lightness(uint16_t v) { + if (v <= 5243) // if below 8% of max + return v / 9; // same as dividing by 900% + else { + uint32_t y = (((uint32_t) v + 10486) << 8) / (10486 + 0xFFFFUL); // add 16% of max and compare + // to get a useful result with integer division, we shift left in the expression above + // and revert what we've done again after squaring. + y = y * y * y >> 8; + if (y > 0xFFFFUL) // prevent overflow + return 0xFFFFU; + else + return (uint16_t) y; + } +} + +void breathing_enable(void) { + breathing = true; + breathing_counter = 0; + breathing_halt = BREATHING_NO_HALT; + // interrupt already registered +} + +void breathing_pulse(void) { + if (get_backlight_level() == 0) + breathing_min(); + else + breathing_max(); + breathing_halt = BREATHING_HALT_ON; + // breathing_interrupt_enable(); + breathing = true; +} + +void breathing_disable(void) { + breathing = false; + // backlight_set(get_backlight_level()); + b_led_set(get_backlight_level()); // custom implementation of backlight_set() +} + +void breathing_self_disable(void) +{ + if (get_backlight_level() == 0) + breathing_halt = BREATHING_HALT_OFF; + else + breathing_halt = BREATHING_HALT_ON; +} + +void breathing_toggle(void) { + if (is_breathing()) + breathing_disable(); + else + breathing_enable(); +} + +void breathing_period_set(uint8_t value) +{ + if (!value) + value = 1; + breathing_period = value; +} + +void breathing_period_default(void) { + breathing_period_set(BREATHING_PERIOD); +} + +void breathing_period_inc(void) +{ + breathing_period_set(breathing_period+1); +} + +void breathing_period_dec(void) +{ + breathing_period_set(breathing_period-1); +} + +/* To generate breathing curve in python: + * from math import sin, pi; [int(sin(x/128.0*pi)**4*255) for x in range(128)] + */ +static const uint8_t breathing_table[BREATHING_STEPS] PROGMEM = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 17, 20, 24, 28, 32, 36, 41, 46, 51, 57, 63, 70, 76, 83, 91, 98, 106, 113, 121, 129, 138, 146, 154, 162, 170, 178, 185, 193, 200, 207, 213, 220, 225, 231, 235, 240, 244, 247, 250, 252, 253, 254, 255, 254, 253, 252, 250, 247, 244, 240, 235, 231, 225, 220, 213, 207, 200, 193, 185, 178, 170, 162, 154, 146, 138, 129, 121, 113, 106, 98, 91, 83, 76, 70, 63, 57, 51, 46, 41, 36, 32, 28, 24, 20, 17, 15, 12, 10, 8, 6, 5, 4, 3, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + +// Use this before the cie_lightness function. +static inline uint16_t scale_backlight(uint16_t v) { + return v / BACKLIGHT_LEVELS * get_backlight_level(); +} + +void custom_breathing_handler(void) { + uint16_t interval = (uint16_t) breathing_period * 244 / BREATHING_STEPS; + // resetting after one period to prevent ugly reset at overflow. + breathing_counter = (breathing_counter + 1) % (breathing_period * 244); + uint8_t index = breathing_counter / interval % BREATHING_STEPS; + + if (((breathing_halt == BREATHING_HALT_ON) && (index == BREATHING_STEPS / 2)) || + ((breathing_halt == BREATHING_HALT_OFF) && (index == BREATHING_STEPS - 1))) + { + // breathing_interrupt_disable(); + } + + setPWM(cie_lightness(scale_backlight((uint16_t) pgm_read_byte(&breathing_table[index]) * 0x0101U))); +} + +#endif // BACKLIGHT_BREATHING +#endif // BACKLIGHT_ENABLE diff --git a/keyboards/jj40/config.h b/keyboards/jj40/config.h index 3152f22b..7fac1ed5 100644 --- a/keyboards/jj40/config.h +++ b/keyboards/jj40/config.h @@ -34,8 +34,8 @@ along with this program. If not, see . /* COL2ROW or ROW2COL */ #define DIODE_DIRECTION COL2ROW -#define BACKLIGHT_PIN B6 -#define BACKLIGHT_LEVELS 3 +#define BACKLIGHT_LEVELS 12 +// #define BACKLIGHT_BREATHING // works, but BL_TOGG might not work #define TAPPING_TOGGLE 3 @@ -45,7 +45,7 @@ along with this program. If not, see . // The RGB_DI_PIN value seems to be shared between all PS2AVRGB boards. // The same pin is used on the JJ40, at least. #define RGBLED_NUM 5 -#define RGB_DI_PIN E2 +#define RGB_DI_PIN E2 // NOTE: for PS2AVRGB boards, underglow commands are sent via I2C to 0xB0. #define RGBLIGHT_ANIMATIONS /* key combination for command */ diff --git a/keyboards/jj40/jj40.c b/keyboards/jj40/jj40.c index 6044e83f..9c1775d6 100644 --- a/keyboards/jj40/jj40.c +++ b/keyboards/jj40/jj40.c @@ -1,5 +1,6 @@ /* Copyright 2017 Luiz Ribeiro +Modified 2018 Kenneth A. 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 @@ -24,8 +25,34 @@ along with this program. If not, see . #include "i2c.h" -// custom RGB driver +#include "backlight.h" +#include "backlight_custom.h" + extern rgblight_config_t rgblight_config; + +// for keyboard subdirectory level init functions +// @Override +void matrix_init_kb(void) { + // call user level keymaps, if any + // matrix_init_user(); +} + +#ifdef BACKLIGHT_ENABLE +/// Overrides functions in `quantum.c` +void backlight_init_ports(void) { + b_led_init_ports(); +} + +void backlight_task(void) { + b_led_task(); +} + +void backlight_set(uint8_t level) { + b_led_set(level); +} +#endif + +// custom RGB driver void rgblight_set(void) { if (!rgblight_config.enable) { for (uint8_t i=0; i. #include "keycode.h" #include "action.h" +void matrix_init_user(void); // TODO port this to other PS2AVRGB boards + #define KEYMAP_GRID( \ K01, K02, K03, K04, K05, K06, K07, K08, K09, K010, K011, K012, \ K11, K12, K13, K14, K15, K16, K17, K18, K19, K110, K111, K112, \ diff --git a/keyboards/jj40/keymaps/default/keymap.c b/keyboards/jj40/keymaps/default/keymap.c index 480486a1..e02dd902 100644 --- a/keyboards/jj40/keymaps/default/keymap.c +++ b/keyboards/jj40/keymaps/default/keymap.c @@ -1,20 +1,3 @@ -/* -Copyright 2017 Luiz Ribeiro - -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 . -*/ - #include "jj40.h" #include "action_layer.h" diff --git a/keyboards/jj40/keymaps/krusli/config.h b/keyboards/jj40/keymaps/krusli/config.h new file mode 100644 index 00000000..11cafbef --- /dev/null +++ b/keyboards/jj40/keymaps/krusli/config.h @@ -0,0 +1,8 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +#define PREVENT_STUCK_MODIFIERS + +#endif diff --git a/keyboards/jj40/keymaps/krusli/keymap.c b/keyboards/jj40/keymaps/krusli/keymap.c index 59e3988e..5a985199 100644 --- a/keyboards/jj40/keymaps/krusli/keymap.c +++ b/keyboards/jj40/keymaps/krusli/keymap.c @@ -1,20 +1,3 @@ -/* -Copyright 2017 Luiz Ribeiro - -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 . -*/ - #include "jj40.h" #include "action_layer.h" @@ -62,7 +45,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, \ KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \ _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______,_______, _______, _______, \ - _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ + BL_TOGG, BL_STEP, BL_BRTG, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ ), /* Raise @@ -73,13 +56,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+------|------+------+------+------+------+------| * | | F7 | F8 | F9 | F10 | F11 | F12 | RGB | RGB | RGB | RGB |Enter | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | RGB | RGB | RGB | RGB | | | Next | Vol- | Vol+ | Play | + * | RGB | RGB | RGB | RGB | | | | Next | Vol- | Vol+ | Play | * `-----------------------------------------------------------------------------------' */ [_RAISE] = KEYMAP( \ KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \ KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \ _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, RGB_TOG, RGB_MOD, RGB_VAD, RGB_VAI, _______, \ - _______, RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ + RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ ) }; diff --git a/keyboards/jj40/matrix.c b/keyboards/jj40/matrix.c index 14002601..a9e9cb53 100644 --- a/keyboards/jj40/matrix.c +++ b/keyboards/jj40/matrix.c @@ -29,6 +29,9 @@ static uint8_t debouncing = DEBOUNCE; static matrix_row_t matrix[MATRIX_ROWS]; static matrix_row_t matrix_debouncing[MATRIX_ROWS]; +void matrix_set_row_status(uint8_t row); +uint8_t bit_reverse(uint8_t x); + void matrix_init(void) { // all outputs for rows high DDRB = 0xFF; @@ -47,18 +50,8 @@ void matrix_init(void) { matrix[row] = 0x00; matrix_debouncing[row] = 0x00; } -} -void matrix_set_row_status(uint8_t row) { - DDRB = (1 << row); - PORTB = ~(1 << row); -} - -uint8_t bit_reverse(uint8_t x) { - x = ((x >> 1) & 0x55) | ((x << 1) & 0xaa); - x = ((x >> 2) & 0x33) | ((x << 2) & 0xcc); - x = ((x >> 4) & 0x0f) | ((x << 4) & 0xf0); - return x; + matrix_init_quantum(); // missing from original port by Luiz } uint8_t matrix_scan(void) { @@ -93,11 +86,30 @@ uint8_t matrix_scan(void) { } } - matrix_scan_user(); + matrix_scan_quantum(); // also missing in original PS2AVRGB implementation return 1; } +void matrix_scan_kb(void) { + // Looping keyboard code goes here + // This runs every cycle (a lot) + matrix_scan_user(); +}; + +// declarations +void matrix_set_row_status(uint8_t row) { + DDRB = (1 << row); + PORTB = ~(1 << row); +} + +uint8_t bit_reverse(uint8_t x) { + x = ((x >> 1) & 0x55) | ((x << 1) & 0xaa); + x = ((x >> 2) & 0x33) | ((x << 2) & 0xcc); + x = ((x >> 4) & 0x0f) | ((x << 4) & 0xf0); + return x; +} + inline matrix_row_t matrix_get_row(uint8_t row) { return matrix[row]; } diff --git a/keyboards/jj40/rules.mk b/keyboards/jj40/rules.mk index cdc898c0..670967fb 100644 --- a/keyboards/jj40/rules.mk +++ b/keyboards/jj40/rules.mk @@ -36,11 +36,13 @@ MOUSEKEY_ENABLE = no EXTRAKEY_ENABLE = yes CONSOLE_ENABLE = no COMMAND_ENABLE = yes -BACKLIGHT_ENABLE = no + +BACKLIGHT_ENABLE = yes +BACKLIGHT_CUSTOM_DRIVER = yes RGBLIGHT_ENABLE = yes RGBLIGHT_CUSTOM_DRIVER = yes -DISABLE_WS2812 = yes # TODO check if this is necessary +# DISABLE_WS2812 = no KEY_LOCK_ENABLE = yes @@ -51,7 +53,7 @@ OPT_DEFS = -DDEBUG_LEVEL=0 # custom matrix setup CUSTOM_MATRIX = yes -SRC = matrix.c i2c.c +SRC = matrix.c i2c.c backlight.c # programming options PROGRAM_CMD = ./util/atmega32a_program.py $(TARGET).hex diff --git a/keyboards/jj40/usbconfig.h b/keyboards/jj40/usbconfig.h index 520d08f6..ad97e7f0 100644 --- a/keyboards/jj40/usbconfig.h +++ b/keyboards/jj40/usbconfig.h @@ -119,7 +119,7 @@ section at the end of this file). * device is powered from the USB bus. */ // max power draw with maxed white underglow measured at 120 mA (peaks) -#define USB_CFG_MAX_BUS_POWER 150 +#define USB_CFG_MAX_BUS_POWER 100 /* Set this variable to the maximum USB bus power consumption of your device. * The value is in milliamperes. [It will be divided by two since USB * communicates power requirements in units of 2 mA.] diff --git a/keyboards/kbd66/config.h b/keyboards/kbd66/config.h new file mode 100644 index 00000000..1802a021 --- /dev/null +++ b/keyboards/kbd66/config.h @@ -0,0 +1,191 @@ +/* +Copyright 2018 Alex Peters + +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 + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0xBD66 +#define DEVICE_VER 0x0001 +#define MANUFACTURER KBDFans +#define PRODUCT KBD66 +#define DESCRIPTION QMK keyboard firmware for KBD66 + +/* key matrix size */ +#define MATRIX_ROWS 5 +#define MATRIX_COLS 16 + +/* + * Keyboard Matrix Assignments + * + * Change this to how you wired your keyboard + * COLS: AVR pins used for columns, left to right + * ROWS: AVR pins used for rows, top to bottom + * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) + * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) + * +*/ +#define MATRIX_ROW_PINS { B0, B1, F0, F1, D4 } // From qmkeyboard.cn +#define MATRIX_COL_PINS { C6, C7, E2, F5, F6, F4, D3, D2, D5, D0, D1, B4, D7, D6, E6, B3 } +#define UNUSED_PINS + +/* COL2ROW, ROW2COL, or CUSTOM_MATRIX */ +#define DIODE_DIRECTION COL2ROW + +#define BACKLIGHT_PIN B6 +#define BACKLIGHT_LEVELS 3 +#define BACKLIGHT_BREATHING +#define BREATHING_PERIOD 6 + + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCING_DELAY 5 + +/* define if matrix has ghost (lacks anti-ghosting diodes) */ +//#define MATRIX_HAS_GHOST + +/* number of backlight levels */ + +/* 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 + +/* If defined, GRAVE_ESC will always act as ESC when CTRL is held. + * This is userful for the Windows task manager shortcut (ctrl+shift+esc). + */ +// #define GRAVE_ESC_CTRL_OVERRIDE + +/* + * Force NKRO + * + * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved + * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the + * makefile for this to work.) + * + * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) + * until the next keyboard reset. + * + * NKRO may prevent your keystrokes from being detected in the BIOS, but it is + * fully operational during normal computer usage. + * + * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) + * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by + * bootmagic, NKRO mode will always be enabled until it is toggled again during a + * power-up. + * + */ +//#define FORCE_NKRO + +/* + * Magic Key Options + * + * Magic keys are hotkey commands that allow control over firmware functions of + * the keyboard. They are best used in combination with the HID Listen program, + * found here: https://www.pjrc.com/teensy/hid_listen.html + * + * The options below allow the magic key functionality to be changed. This is + * useful if your keyboard/keypad is missing keys and you want magic key support. + * + */ + +/* key combination for magic key command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +/* control how magic key switches layers */ +//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true +//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true +//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false + +/* override magic key keymap */ +//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS +//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS +//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM +//#define MAGIC_KEY_HELP1 H +//#define MAGIC_KEY_HELP2 SLASH +//#define MAGIC_KEY_DEBUG D +//#define MAGIC_KEY_DEBUG_MATRIX X +//#define MAGIC_KEY_DEBUG_KBD K +//#define MAGIC_KEY_DEBUG_MOUSE M +//#define MAGIC_KEY_VERSION V +//#define MAGIC_KEY_STATUS S +//#define MAGIC_KEY_CONSOLE C +//#define MAGIC_KEY_LAYER0_ALT1 ESC +//#define MAGIC_KEY_LAYER0_ALT2 GRAVE +//#define MAGIC_KEY_LAYER0 0 +//#define MAGIC_KEY_LAYER1 1 +//#define MAGIC_KEY_LAYER2 2 +//#define MAGIC_KEY_LAYER3 3 +//#define MAGIC_KEY_LAYER4 4 +//#define MAGIC_KEY_LAYER5 5 +//#define MAGIC_KEY_LAYER6 6 +//#define MAGIC_KEY_LAYER7 7 +//#define MAGIC_KEY_LAYER8 8 +//#define MAGIC_KEY_LAYER9 9 +//#define MAGIC_KEY_BOOTLOADER PAUSE +//#define MAGIC_KEY_LOCK CAPS +//#define MAGIC_KEY_EEPROM E +//#define MAGIC_KEY_NKRO N +//#define MAGIC_KEY_SLEEP_LED Z + +/* + * 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 + +/* + * MIDI options + */ + +/* Prevent use of disabled MIDI features in the keymap */ +//#define MIDI_ENABLE_STRICT 1 + +/* enable basic MIDI features: + - MIDI notes can be sent when in Music mode is on +*/ +//#define MIDI_BASIC + +/* enable advanced MIDI features: + - MIDI notes can be added to the keymap + - Octave shift and transpose + - Virtual sustain, portamento, and modulation wheel + - etc. +*/ +//#define MIDI_ADVANCED + +/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ +//#define MIDI_TONE_KEYCODE_OCTAVES 1 + +#endif diff --git a/keyboards/kbd66/kbd66.c b/keyboards/kbd66/kbd66.c new file mode 100644 index 00000000..7a84b636 --- /dev/null +++ b/keyboards/kbd66/kbd66.c @@ -0,0 +1,43 @@ +/* Copyright 2018 Alex Peters + * + * 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 . + */ +#include "kbd66.h" + +void matrix_init_kb(void) { + // put your keyboard start-up code here + // runs once when the firmware starts up + + matrix_init_user(); +} + +void matrix_scan_kb(void) { + // put your looping keyboard code here + // runs every cycle (a lot) + + matrix_scan_user(); +} + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + // put your per-action keyboard code here + // runs for every action, just before processing by the firmware + + return process_record_user(keycode, record); +} + +void led_set_kb(uint8_t usb_led) { + // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here + + led_set_user(usb_led); +} diff --git a/keyboards/kbd66/kbd66.h b/keyboards/kbd66/kbd66.h new file mode 100644 index 00000000..af1156e5 --- /dev/null +++ b/keyboards/kbd66/kbd66.h @@ -0,0 +1,36 @@ +/* Copyright 2018 Alex Peters + * + * 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 KBD66_H +#define KBD66_H + +#include "quantum.h" + +// This a shortcut to help you visually see your layout. +#define KEYMAP( \ + k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D,k0E, k0F, \ + k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, k1F, \ + k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, k2D, \ + k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, k3E, \ + k40, k41, k42, k45, k48, k4A, k4B, k4C, k4D, k4E, k4F \ +) { \ + { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D, k0E, k0F}, \ + { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, KC_NO, k1F}, \ + { k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, KC_NO, k2D, KC_NO, KC_NO}, \ + { k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, k3E, KC_NO}, \ + { k40, k41, k42, KC_NO, KC_NO, k45, KC_NO, KC_NO, k48, KC_NO, k4A, k4B, k4C, k4D, k4E, k4F}, \ +} + +#endif diff --git a/keyboards/kbd66/keymaps/ansi/config.h b/keyboards/kbd66/keymaps/ansi/config.h new file mode 100644 index 00000000..c7b3d6ec --- /dev/null +++ b/keyboards/kbd66/keymaps/ansi/config.h @@ -0,0 +1,24 @@ +/* Copyright 2018 Alex Peters + * + * 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_USER_H +#define CONFIG_USER_H + +#include "config_common.h" + +// place overrides here + +#endif diff --git a/keyboards/kbd66/keymaps/ansi/keymap.c b/keyboards/kbd66/keymaps/ansi/keymap.c new file mode 100644 index 00000000..f5ffa7b7 --- /dev/null +++ b/keyboards/kbd66/keymaps/ansi/keymap.c @@ -0,0 +1,103 @@ +/* Copyright 2018 Alex Peters + * + * 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 . + */ +#include "kbd66.h" + +#define _____ KC_TRNS +#define XXXXX KC_NO +#define _L0 0 +#define _L1 1 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Layer 0 + * ,-----------------------------------------------------------. ,---. + * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| BckSp | |INS| + * |-----------------------------------------------------------| |---| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |DEL| + * |-----------------------------------------------------------| `---' + * |Cap | A| S| D| F| G| H| J| K| L| ;| '| Enter | + * |---------------------------------------------------------------. + * | Shift | Z| X| C| V| B| N| M| ,| .| /| Shift | UP| + * |-------------------------------------------------------------------. + * |Ctl |OS |Alt | Space |Alt | Fn |Ctl |LFT|DWN|RIG| + * `-------------------------------------------------------------------' + */ +[_L0] = KEYMAP( + KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, XXXXX, KC_BSPC, KC_INS, + 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_DEL, + KC_CAPS, 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_LSFT, XXXXX, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, XXXXX, KC_UP, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_RALT, MO(_L1), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT +), + + /* Layer 1 + * ,-----------------------------------------------------------. ,---. + * | `| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| | |HOM| + * |-----------------------------------------------------------| |---| + * | | | | | | | | | | |PSc|VDn|VUp| Mute| |END| + * |-----------------------------------------------------------| `---' + * |RESET| | | | | | |PRV|PLY|NXT|STP| | | + * |---------------------------------------------------------------. + * | | | | | | | | |BLB|BLC|Slp| |PUp| + * |-------------------------------------------------------------------. + * | | | | | | | | |PDn|SLk| + * `-------------------------------------------------------------------' + */ +[_L1] = KEYMAP( + KC_GRV, 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_HOME, + _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, KC_PSCR, KC_VOLD, KC_VOLU, KC_MUTE, KC_END, + RESET, _____, _____, _____, _____, _____, _____, KC_MPRV, KC_MPLY, KC_MNXT, KC_MSTP, _____, _____, + _____, _____, _____, _____, _____, _____, _____, _____, _____, BL_BRTG, BL_STEP, KC_SLEP, _____, _____, KC_PGUP, + _____, _____, _____, _____, _____, _____, _____, _____, _____, KC_PGDN, KC_SLCK +) + +}; + +const uint16_t PROGMEM fn_actions[] = { + +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + // MACRODOWN only works in this function + switch(id) { + case 0: + if (record->event.pressed) { + register_code(KC_RSFT); + } else { + unregister_code(KC_RSFT); + } + break; + } + return MACRO_NONE; +}; + + +void matrix_init_user(void) { + +} + +void matrix_scan_user(void) { + +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} + +void led_set_user(uint8_t usb_led) { + +} diff --git a/keyboards/kbd66/keymaps/ansi/readme.md b/keyboards/kbd66/keymaps/ansi/readme.md new file mode 100644 index 00000000..6ad0d85e --- /dev/null +++ b/keyboards/kbd66/keymaps/ansi/readme.md @@ -0,0 +1,11 @@ +# ANSI keymap for KBD66 + +![KBD66 Layout Image](https://i.imgur.com/Hmt5QDW.jpg) + +Your standard ANSI layout for the KBD66. +Cycle backlight: Fn + . +Backlight breathing: Fn + , +Volume Up/Down: Fn + [ and Fn + ] +Mute: Fn + \ +Sleep: Fn + / +Bootloader Mode: Fn + CapsLock \ No newline at end of file diff --git a/keyboards/kbd66/keymaps/default/config.h b/keyboards/kbd66/keymaps/default/config.h new file mode 100644 index 00000000..c7b3d6ec --- /dev/null +++ b/keyboards/kbd66/keymaps/default/config.h @@ -0,0 +1,24 @@ +/* Copyright 2018 Alex Peters + * + * 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_USER_H +#define CONFIG_USER_H + +#include "config_common.h" + +// place overrides here + +#endif diff --git a/keyboards/kbd66/keymaps/default/keymap.c b/keyboards/kbd66/keymaps/default/keymap.c new file mode 100644 index 00000000..551df141 --- /dev/null +++ b/keyboards/kbd66/keymaps/default/keymap.c @@ -0,0 +1,103 @@ +/* Copyright 2018 Alex Peters + * + * 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 . + */ +#include "kbd66.h" + +#define _____ KC_TRNS +#define XXXXX KC_NO +#define _L0 0 +#define _L1 1 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Layer 0 + * ,-----------------------------------------------------------. ,---. + * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| `| BS| |INS| + * |-----------------------------------------------------------| |---| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |DEL| + * |-----------------------------------------------------------| `---' + * |Cap | A| S| D| F| G| H| J| K| L| ;| '| Enter | + * |---------------------------------------------------------------. + * |Shft| `| Z| X| C| V| B| N| M| ,| .| /| Shft |Fn | UP| + * |-------------------------------------------------------------------. + * |Ctl |OS |Alt | Space |Alt | Fn |Ctl |LFT|DWN|RIG| + * `-------------------------------------------------------------------' + */ +[_L0] = KEYMAP( + KC_GESC, 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_GRV, KC_BSPC, KC_INS, + 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_DEL, + KC_CAPS, 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_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(_L1), KC_UP, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_RALT, MO(_L1), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT +), + + /* Layer 1 + * ,-----------------------------------------------------------. ,---. + * | `| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| | | |HOM| + * |-----------------------------------------------------------| |---| + * | | | | | | | | | | |PSc|VDn|VUp| Mute| |END| + * |-----------------------------------------------------------| `---' + * |RESET| | | | | | |PRV|PLY|NXT|STP| | | + * |---------------------------------------------------------------. + * | | | | | | | | | |BLB|BLC|Slp| | |PUp| + * |-------------------------------------------------------------------. + * | | | | | | | | |PDn|SLk| + * `-------------------------------------------------------------------' + */ +[_L1] = KEYMAP( + KC_GRV, 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_HOME, + _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, KC_PSCR, KC_VOLD, KC_VOLU, KC_MUTE, KC_END, + RESET, _____, _____, _____, _____, _____, _____, KC_MPRV, KC_MPLY, KC_MNXT, KC_MSTP, _____, _____, + _____, _____, _____, _____, _____, _____, _____, _____, _____, BL_BRTG, BL_STEP, KC_SLEP, _____, _____, KC_PGUP, + _____, _____, _____, _____, _____, _____, _____, _____, _____, KC_PGDN, KC_SLCK +) + +}; + +const uint16_t PROGMEM fn_actions[] = { + +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + // MACRODOWN only works in this function + switch(id) { + case 0: + if (record->event.pressed) { + register_code(KC_RSFT); + } else { + unregister_code(KC_RSFT); + } + break; + } + return MACRO_NONE; +}; + + +void matrix_init_user(void) { + +} + +void matrix_scan_user(void) { + +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} + +void led_set_user(uint8_t usb_led) { + +} diff --git a/keyboards/kbd66/keymaps/default/readme.md b/keyboards/kbd66/keymaps/default/readme.md new file mode 100644 index 00000000..f4ab771a --- /dev/null +++ b/keyboards/kbd66/keymaps/default/readme.md @@ -0,0 +1,12 @@ +# The default keymap for KBD66 + +![KBD66 Layout Image](https://i.imgur.com/QNpHnMe.jpg) + +This is a fairly universal layout that supports standard ANSI, split backspace, +split left shift, and split right shift. +Cycle backlight: Fn + . +Backlight breathing: Fn + , +Volume Up/Down: Fn + [ and Fn + ] +Mute: Fn + \ +Sleep: Fn + / +Bootloader Mode: Fn + CapsLock \ No newline at end of file diff --git a/keyboards/kbd66/keymaps/iso/config.h b/keyboards/kbd66/keymaps/iso/config.h new file mode 100644 index 00000000..c7b3d6ec --- /dev/null +++ b/keyboards/kbd66/keymaps/iso/config.h @@ -0,0 +1,24 @@ +/* Copyright 2018 Alex Peters + * + * 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_USER_H +#define CONFIG_USER_H + +#include "config_common.h" + +// place overrides here + +#endif diff --git a/keyboards/kbd66/keymaps/iso/keymap.c b/keyboards/kbd66/keymaps/iso/keymap.c new file mode 100644 index 00000000..fa9202ca --- /dev/null +++ b/keyboards/kbd66/keymaps/iso/keymap.c @@ -0,0 +1,103 @@ +/* Copyright 2018 Alex Peters + * + * 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 . + */ +#include "kbd66.h" + +#define _____ KC_TRNS +#define XXXXX KC_NO +#define _L0 0 +#define _L1 1 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Layer 0 + * ,-----------------------------------------------------------. ,---. + * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| BckSp | |INS| + * |-----------------------------------------------------------| |---| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | |DEL| + * |------------------------------------------------------|Ent | `---' + * |Cap | A| S| D| F| G| H| J| K| L| ;| '| #| | + * |---------------------------------------------------------------. + * |Shft| \| Z| X| C| V| B| N| M| ,| .| /| Shft |Fn | UP| + * |-------------------------------------------------------------------. + * |Ctl |OS |Alt | Space |Alt | Fn |Ctl |LFT|DWN|RIG| + * `-------------------------------------------------------------------' + */ +[_L0] = KEYMAP( + KC_GESC, 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_GRV, KC_BSPC, KC_INS, + 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_NUHS, KC_DEL, + KC_CAPS, 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_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(_L1), KC_UP, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_RALT, MO(_L1), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT +), + + /* Layer 1 + * ,-----------------------------------------------------------. ,---. + * | `| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| | | |HOM| + * |-----------------------------------------------------------| |---| + * | | | | | | | | | | |PSc|VDn|VUp| | |END| + * |------------------------------------------------------| | `---' + * |RESET | | | | | | |PRV|PLY|NXT|STP| |Mut| | + * |---------------------------------------------------------------. + * | | | | | | | | | |BLB|BLC|Slp| | |PUp| + * |-------------------------------------------------------------------. + * | | | | | | | | |PDn|SLk| + * `-------------------------------------------------------------------' + */ +[_L1] = KEYMAP( + KC_GRV, 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_HOME, + _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, KC_PSCR, KC_VOLD, KC_VOLU, KC_MUTE, KC_END, + RESET, _____, _____, _____, _____, _____, _____, KC_MPRV, KC_MPLY, KC_MNXT, KC_MSTP, _____, _____, + _____, _____, _____, _____, _____, _____, _____, _____, _____, BL_BRTG, BL_STEP, KC_SLEP, _____, _____, KC_PGUP, + _____, _____, _____, _____, _____, _____, _____, _____, _____, KC_PGDN, KC_SLCK +) + +}; + +const uint16_t PROGMEM fn_actions[] = { + +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + // MACRODOWN only works in this function + switch(id) { + case 0: + if (record->event.pressed) { + register_code(KC_RSFT); + } else { + unregister_code(KC_RSFT); + } + break; + } + return MACRO_NONE; +}; + + +void matrix_init_user(void) { + +} + +void matrix_scan_user(void) { + +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} + +void led_set_user(uint8_t usb_led) { + +} diff --git a/keyboards/kbd66/keymaps/iso/readme.md b/keyboards/kbd66/keymaps/iso/readme.md new file mode 100644 index 00000000..f325b741 --- /dev/null +++ b/keyboards/kbd66/keymaps/iso/readme.md @@ -0,0 +1,11 @@ +# ISO keymap for KBD66 + +![KBD66 Layout Image](https://i.imgur.com/q6GTOsb.jpg) + +Standard ISO layout for KBD66. +Cycle backlight: Fn + . +Backlight breathing: Fn + , +Volume Up/Down: Fn + [ and Fn + ] +Mute: Fn + # +Sleep: Fn + / +Bootloader Mode: Fn + CapsLock \ No newline at end of file diff --git a/keyboards/kbd66/readme.md b/keyboards/kbd66/readme.md new file mode 100644 index 00000000..71fe1f2e --- /dev/null +++ b/keyboards/kbd66/readme.md @@ -0,0 +1,15 @@ +# KBD66 + +![KBD66](https://i.imgur.com/qtLuL2o.jpg) + +A 65% keyboard from KBDFans. + +Keyboard Maintainer: [Alex](https://github.com/allo-world) +Hardware Supported: KBD66, ATmega32U4 +Hardware Availability: [KBDFans](https://kbdfans.cn), [Massdrop](https://www.massdrop.com/buy/kbd66-mechanical-keyboard-kit?mode=guest_open) + +Make example for this keyboard (after setting up your build environment): + + make kbd66:default + +See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. \ No newline at end of file diff --git a/keyboards/kbd66/rules.mk b/keyboards/kbd66/rules.mk new file mode 100644 index 00000000..45eb6ee3 --- /dev/null +++ b/keyboards/kbd66/rules.mk @@ -0,0 +1,68 @@ +# MCU name +#MCU = at90usb1286 +MCU = atmega32u4 + +# Processor frequency. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +# +# This will be an integer division of F_USB below, as it is sourced by +# F_USB after it has run through any CPU prescalers. Note that this value +# does not *change* the processor frequency - it should merely be updated to +# reflect the processor speed set externally so that the code can use accurate +# software delays. +F_CPU = 16000000 + + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + + +# Boot Section Size in *bytes* +# Teensy halfKay 512 +# Teensy++ halfKay 1024 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +# USBaspLoader 2048 +OPT_DEFS += -DBOOTLOADER_SIZE=4096 + + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = yes # Console for debug(+400) +COMMAND_ENABLE = yes # Commands for debug and configuration +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +NKRO_ENABLE = no # USB Nkey Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default +MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config) +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +AUDIO_ENABLE = no # Audio output on port C6 +FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches diff --git a/keyboards/niu_mini/keymaps/mason/keymap.c b/keyboards/niu_mini/keymaps/mason/keymap.c new file mode 100644 index 00000000..09a755a8 --- /dev/null +++ b/keyboards/niu_mini/keymaps/mason/keymap.c @@ -0,0 +1,116 @@ +#include "niu_mini.h" + +enum layers { + _QWERTY, + _LOWER, + _RAISE, + _ADJUST +}; + +enum keycodes { + LOWER, + RAISE +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* Qwerty + * ,-----------------------------------------------------------------------------------. + * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | S | D | F | G | H | J | K | L | ;: | '" | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | N | M | ,< | .> | /? |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Caps | Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_QWERTY] = { + {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, + {KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, + {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, + {KC_CAPS, KC_ESC, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} +}, + +/* Lower + * ,-----------------------------------------------------------------------------------. + * | | ! | @ | # | $ | % | ^ | & | * | ( | ) | | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | F12 | ~ | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ +[_LOWER] = { + {_______, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______}, + {_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, _______}, + {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_GRV), S(KC_BSLS), _______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} +}, + +/* Raise + * ,-----------------------------------------------------------------------------------. + * | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | Ins | Home | PgUp | | | | - | = | [ | ] | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | Del | End | PgDn | | | | ` | \ | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ +[_RAISE] = { + {_______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______}, + {_______, KC_INS, KC_HOME, KC_PGUP, _______, _______, _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, _______}, + {_______, KC_DEL, KC_END, KC_PGDN, _______, _______, _______, KC_GRV, KC_BSLS, _______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} +}, + +/* Adjust (Lower + Raise) + * ,-----------------------------------------------------------------------------------. + * | | Reset| | | | | | | | | | | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | |BLtogg|BLstep| | | | | | | | | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | |RGBtog|RGBhui|RGBhud|RGBmod|RGBsai|RGBsad| | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_ADJUST] = { + {_______, RESET, DEBUG, _______, _______, _______, _______, _______, _______, _______, _______, KC_POWER}, + {_______, BL_TOGG, BL_STEP, _______, _______, _______, _______, _______, _______, _______, _______, _______}, + {_______, RGB_TOG, RGB_HUI, RGB_HUD, RGB_MOD, RGB_SAI, RGB_SAD, _______, _______, _______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} +} + + +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case LOWER: + if (record->event.pressed) { + layer_on(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case RAISE: + if (record->event.pressed) { + layer_on(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + } + return true; +} diff --git a/keyboards/orthodox/keymaps/drashna/config.h b/keyboards/orthodox/keymaps/drashna/config.h index f39c34e7..d83b7792 100644 --- a/keyboards/orthodox/keymaps/drashna/config.h +++ b/keyboards/orthodox/keymaps/drashna/config.h @@ -27,7 +27,7 @@ along with this program. If not, see . /* Use I2C or Serial, not both */ #define USE_SERIAL -// #define USE_I2C +#undef USE_I2C /* Select hand configuration */ @@ -71,4 +71,10 @@ along with this program. If not, see . #define STARTUP_SONG SONG(ZELDA_TREASURE) #endif +#undef PRODUCT +#ifdef KEYBOARD_orthodox_rev1 +#define PRODUCT Drashna Hacked Orthodox Rev.1 +#elif KEYBOARD_orthodox_rev3 +#define PRODUCT Drashna Hacked Orthodox Rev.3 +#endif #endif diff --git a/keyboards/orthodox/keymaps/drashna/keymap.c b/keyboards/orthodox/keymaps/drashna/keymap.c index af235f55..f74b39ae 100644 --- a/keyboards/orthodox/keymaps/drashna/keymap.c +++ b/keyboards/orthodox/keymaps/drashna/keymap.c @@ -32,42 +32,30 @@ along with this program. If not, see . #define _______ KC_TRNS #define XXXXXXX KC_NO -#ifdef FAUXCLICKY_ENABLE -float fauxclicky_pressed_note[2] = MUSICAL_NOTE(_A6, 2); // (_D4, 0.25); -float fauxclicky_released_note[2] = MUSICAL_NOTE(_A6, 2); // (_C4, 0.125); -float fauxclicky_beep_note[2] = MUSICAL_NOTE(_C6, 2); // (_C4, 0.25); -#define AUD_ON FC_ON -#define AUD_OFF FC_OFF -#else -#define AUD_ON AU_ON -#define AUD_OFF AU_OFF - -#endif - const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_QWERTY] = KEYMAP(\ KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \ KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_UP, KC_DOWN, KC_LEFT, KC_RIGHT, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ - OSM(MOD_LSFT),CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, LOWER, KC_SPACE, KC_BSPC, KC_DEL, KC_ENT, RAISE, KC_N, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLASH), KC_LGUI \ + KC_LSFT,CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, LOWER, KC_SPACE, KC_BSPC, KC_DEL, KC_ENT, RAISE, KC_N, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLASH), KC_LGUI \ ), [_COLEMAK] = KEYMAP(\ KC_ESC, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, \ KC_TAB, KC_A, KC_R, KC_S, KC_T, KC_D, KC_UP, KC_DOWN, KC_LEFT, KC_RIGHT, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, \ - OSM(MOD_LSFT), CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, LOWER, KC_SPACE, KC_BSPC, KC_DEL, KC_ENT, RAISE, KC_K, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLASH), KC_LGUI \ + KC_LSFT, CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, LOWER, KC_SPACE, KC_BSPC, KC_DEL, KC_ENT, RAISE, KC_K, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLASH), KC_LGUI \ ), [_DVORAK] = KEYMAP(\ KC_ESC, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, \ KC_TAB, KC_A, KC_O, KC_E, KC_U, KC_I, KC_UP, KC_DOWN, KC_LEFT, KC_RIGHT, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, \ - OSM(MOD_LSFT), CTL_T(KC_SCLN), KC_Q, KC_J, KC_K, KC_X, LOWER, KC_SPACE, KC_BSPC, KC_DEL, KC_ENT, RAISE, KC_B, KC_M, KC_W, KC_V, CTL_T(KC_Z), KC_LGUI \ + KC_LSFT, CTL_T(KC_SCLN), KC_Q, KC_J, KC_K, KC_X, LOWER, KC_SPACE, KC_BSPC, KC_DEL, KC_ENT, RAISE, KC_B, KC_M, KC_W, KC_V, CTL_T(KC_Z), KC_LGUI \ ), [_WORKMAN] = KEYMAP(\ KC_ESC, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, \ KC_TAB, KC_A, KC_O, KC_E, KC_U, KC_I, KC_UP, KC_DOWN, KC_LEFT, KC_RIGHT, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, \ - OSM(MOD_LSFT), CTL_T(KC_SCLN), KC_Q, KC_J, KC_K, KC_X, LOWER, KC_SPACE, KC_BSPC, KC_DEL, KC_ENT, RAISE, KC_B, KC_M, KC_W, KC_V, CTL_T(KC_Z), KC_LGUI \ + KC_LSFT,CTL_T(KC_SCLN), KC_Q, KC_J, KC_K, KC_X, LOWER, KC_SPACE, KC_BSPC, KC_DEL, KC_ENT, RAISE, KC_B, KC_M, KC_W, KC_V, CTL_T(KC_Z), KC_LGUI \ ), [_LOWER] = KEYMAP(\ @@ -84,7 +72,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_ADJUST] = KEYMAP(\ KC_MAKE,KC_RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ - RGB_SMOD,RGB_HUI, _______, AUD_ON, AUD_OFF, AG_NORM, _______, _______, _______, _______, AG_SWAP, KC_QWERTY, KC_COLEMAK, KC_DVORAK, KC_WORKMAN, _______, \ + RGB_SMOD,RGB_HUI, KC_FXCL, AUD_ON, AUD_OFF, AG_NORM, _______, _______, _______, _______, AG_SWAP, KC_QWERTY, KC_COLEMAK, KC_DVORAK, KC_WORKMAN, _______, \ KC_RGB_T,RGB_HUD, MU_ON, MU_OFF, MU_TOG, MU_MOD, _______, _______, _______, _______, _______, _______, MAGIC_TOGGLE_NKRO, KC_MUTE, KC_VOLD, KC_VOLU, KC_MNXT, KC_MPLY \ ) diff --git a/keyboards/orthodox/keymaps/drashna/rules.mk b/keyboards/orthodox/keymaps/drashna/rules.mk index 53a44424..c4cf6629 100644 --- a/keyboards/orthodox/keymaps/drashna/rules.mk +++ b/keyboards/orthodox/keymaps/drashna/rules.mk @@ -1,7 +1,11 @@ -CONSOLE_ENABLE = no +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration TAP_DANCE_ENABLE = no RGBLIGHT_ENABLE = yes -AUDIO_ENABLE = no -MOUSEKEY_ENABLE = no +AUDIO_ENABLE = yes NKRO_ENABLE = yes FAUXCLICKY_ENABLE = no +USE_I2C = no diff --git a/keyboards/planck/keymaps/mason/keymap.c b/keyboards/planck/keymaps/mason/keymap.c new file mode 100644 index 00000000..87039cf4 --- /dev/null +++ b/keyboards/planck/keymaps/mason/keymap.c @@ -0,0 +1,116 @@ +#include "planck.h" + +enum planck_layers { + _QWERTY, + _LOWER, + _RAISE, + _ADJUST +}; + +enum planck_keycodes { + LOWER, + RAISE +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* Qwerty + * ,-----------------------------------------------------------------------------------. + * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | S | D | F | G | H | J | K | L | ;: | '" | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | N | M | ,< | .> | /? |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Caps | Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_QWERTY] = { + {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, + {KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, + {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, + {KC_CAPS, KC_ESC, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} +}, + +/* Lower + * ,-----------------------------------------------------------------------------------. + * | | ! | @ | # | $ | % | ^ | & | * | ( | ) | | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | F12 | ~ | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ +[_LOWER] = { + {_______, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______}, + {_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, _______}, + {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_GRV), S(KC_BSLS), _______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} +}, + +/* Raise + * ,-----------------------------------------------------------------------------------. + * | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | Ins | Home | PgUp | | | | - | = | [ | ] | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | Del | End | PgDn | | | | ` | \ | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ +[_RAISE] = { + {_______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______}, + {_______, KC_INS, KC_HOME, KC_PGUP, _______, _______, _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, _______}, + {_______, KC_DEL, KC_END, KC_PGDN, _______, _______, _______, KC_GRV, KC_BSLS, _______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} +}, + +/* Adjust (Lower + Raise) + * ,-----------------------------------------------------------------------------------. + * | | Reset| | | | | | | | | | | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | |BLtogg|BLstep| | | | | | | | | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | |RGBtog|RGBhui|RGBhud|RGBmod|RGBsai|RGBsad| | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_ADJUST] = { + {_______, RESET, DEBUG, _______, _______, _______, _______, _______, _______, _______, _______, KC_POWER}, + {_______, BL_TOGG, BL_STEP, _______, _______, _______, _______, _______, _______, _______, _______, _______}, + {_______, RGB_TOG, RGB_HUI, RGB_HUD, RGB_MOD, RGB_SAI, RGB_SAD, _______, _______, _______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} +} + + +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case LOWER: + if (record->event.pressed) { + layer_on(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case RAISE: + if (record->event.pressed) { + layer_on(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + } + return true; +} diff --git a/keyboards/planck/rev5/rules.mk b/keyboards/planck/rev5/rules.mk index 2ca882a0..7e64e7ed 100644 --- a/keyboards/planck/rev5/rules.mk +++ b/keyboards/planck/rev5/rules.mk @@ -1,2 +1 @@ AUDIO_ENABLE = yes # Audio output on port C6 -MIDI_ENABLE = no diff --git a/keyboards/planck/rules.mk b/keyboards/planck/rules.mk index 439f7db6..4d882d0b 100644 --- a/keyboards/planck/rules.mk +++ b/keyboards/planck/rules.mk @@ -65,7 +65,7 @@ CONSOLE_ENABLE = yes # Console for debug(+400) COMMAND_ENABLE = no # Commands for debug and configuration NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -MIDI_ENABLE = yes # MIDI controls +MIDI_ENABLE = no # MIDI controls AUDIO_ENABLE = yes # Audio output on port C6 UNICODE_ENABLE = no # Unicode BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID diff --git a/keyboards/satan/keymaps/isoHHKB/keymap.c b/keyboards/satan/keymaps/isoHHKB/keymap.c new file mode 100644 index 00000000..a14c5c39 --- /dev/null +++ b/keyboards/satan/keymaps/isoHHKB/keymap.c @@ -0,0 +1,110 @@ +#include "satan.h" +#include "stunny_iso_hhkb.h" + +// Used for SHIFT_ESC +#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)) + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. +#define _BL 0 +#define _FL 1 + +#define KC_ENYE M(0) +#define KC_CEDL M(1) + +#define _______ KC_TRNS + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Keymap _BL: (Base Layer) Default Layer + * ,-----------------------------------------------------------. + * |Esc~| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | + * |-----------------------------------------------------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| Ret | + * |-----------------------------------------------------------| + * |Ctrl | A| S| D| F| G| H| J| K| L| Ñ| ;| ' |urn| + * |-----------------------------------------------------------| + * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | Fn| + * |-----------------------------------------------------------| + * | |Alt|WinK | Space |WinK |Alt| | + * `-----------------------------------------------------------' + * + */ + + [_BL] = KEYMAP_ISO_HHKB( \ + F(0), 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_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_LCTRL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_ENYE,KC_SCLN,KC_QUOT,KC_ENT, \ + OSM(MOD_LSFT),_______, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, OSM(MOD_RSFT), MO(_FL), \ + _______, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI,_______, _______), + + /* Keymap _FL: (Function Layer) Second Layer + * ,-----------------------------------------------------------. + * | |F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|PSR| RESET| + * |-----------------------------------------------------------| + * | | |VUP| | | | | | | | | | | | + * |-----------------------------------------------------------| + * |CapsLck|PRV|VDN|NXT| |RGB|FRW|BRT|VAI|VAD|INC|DEC| | | + * |-----------------------------------------------------------| + * | | | | Ç| |BTG| |MUT| | | | | | + * |-----------------------------------------------------------| + * | | | | PLY/PAU | | | | + * `-----------------------------------------------------------' + */ + [_FL] = KEYMAP_ISO_HHKB(\ + + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_PSCR, RESET, \ + _______,_______,KC_VOLU,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______, _______, \ + KC_CAPS,KC_MPRV,KC_VOLD,KC_MNXT,_______,_______,RGB_TOG,RGB_MOD,RGB_M_B,RGB_VAI,RGB_VAD,BL_INC, BL_DEC, _______, \ + _______,_______,_______,_______,KC_CEDL,_______,BL_TOGG,_______,KC_MUTE,_______,_______,_______,_______, _______, \ + _______,_______,_______, KC_MPLY, _______,_______,_______, _______) + +}; + +enum function_id { + SHIFT_ESC, +}; + +const uint16_t PROGMEM fn_actions[] = { + [0] = ACTION_FUNCTION(SHIFT_ESC), +}; + +void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { + static uint8_t shift_esc_shift_mask; + switch (id) { + case SHIFT_ESC: + shift_esc_shift_mask = get_mods()&MODS_CTRL_MASK; + if (record->event.pressed) { + if (shift_esc_shift_mask) { + add_key(KC_GRV); + send_keyboard_report(); + } else { + add_key(KC_ESC); + send_keyboard_report(); + } + } else { + if (shift_esc_shift_mask) { + del_key(KC_GRV); + send_keyboard_report(); + } else { + del_key(KC_ESC); + send_keyboard_report(); + } + } + break; + } +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { + if (record->event.pressed) { + switch(id) { + case 0: // Ñ + return MACRO(D(LALT), T(KP_0), T(KP_2), T(KP_4), T(KP_1), U(LALT), END); + case 1: // Ç + return MACRO(D(LALT), T(KP_0), T(KP_2), T(KP_3), T(KP_1), U(LALT), END); + } + } + return MACRO_NONE; +}; diff --git a/keyboards/satan/keymaps/isoHHKB/readme.md b/keyboards/satan/keymaps/isoHHKB/readme.md new file mode 100644 index 00000000..60454efb --- /dev/null +++ b/keyboards/satan/keymaps/isoHHKB/readme.md @@ -0,0 +1,55 @@ +# HKKB-ISO Satan Layout by Stunny + +This layout combines the split Right Shift ISO layout with the popular HHKB layout. The Caps Lock key will be replaced in the default layout by the Control key, which is more convenient for some people. + +This version is designed to have in its base layer letter 'Ñ' for Spanish writing. Also, 'ç' is included for those who have to write in French, Catalan or other languages that may need it. + +This keymap also supports control for a WS2812B RGB led strip connected to pin E2 of the microcontroller. If you want more functionalities, pls check RGB documentation at [QMK Docs]( https://docs.qmk.fm/feature_rgblight.html#rgb-lighting). This also goes for backlighting functionalities. If you want more control, check [QMK Docs](https://docs.qmk.fm/feature_backlight.html#backlighting) on that. + +Base Layer: + +``` +,-----------------------------------------------------------. +|Esc~| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | +|-----------------------------------------------------------| +|Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| Ret | +|-----------------------------------------------------------| +|Ctrl | A| S| D| F| G| H| J| K| L| Ñ| ;| ' |urn| +|-----------------------------------------------------------| +|Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | Fn| +|-----------------------------------------------------------| +| |Alt|LGUI | Space |RGUI |Alt| | +`-----------------------------------------------------------' +``` + +Function Layer +``` +,-----------------------------------------------------------. +| |F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|PSR| RESET| +|-----------------------------------------------------------| +| | |VUP| | | | | | | | | | | | +|-----------------------------------------------------------| +|CapsLck|PRV|VDN|NXT| |RGB|FRW|BRT|VAI|VAD|INC|DEC| | | +|-----------------------------------------------------------| +| | | | Ç| |BTG| |MUT| | | | | | +|-----------------------------------------------------------| +| | | | PLY/PAU | | | | +`-----------------------------------------------------------' +``` + +Where: +- `PRV` is `KC_MEDIA_PREV_TRACK` +- `NXT` is `KC_MEDIA_NEXT_TRACK` +- `VUP` is `KC_AUDIO_VOL_UP` +- `VDN` is `KC_AUDIO_VOL_DOWN` +- `MUT` is `KC_AUDIO_MUTE` +- `PLY/PAU` is `KC_MEDIA_PLAY_PAUSE` +- `BTG` is `BL_TOGG` (toggles key backlighting) +- `INC` increases backlighting brightness +- `DEC` decreases backlighting brightness +- `PSR` is `KC_PSCREEN` +- `RGB` is `RGB_TOG` +- `FRW` jumps to next RGB mode +- `BRT` activates RGB breathing mode directly +- `VAI` increases RGB brightness +- `VAD` decreases RGB brightness diff --git a/keyboards/satan/keymaps/isoHHKB/rules.mk b/keyboards/satan/keymaps/isoHHKB/rules.mk new file mode 100644 index 00000000..026b33c7 --- /dev/null +++ b/keyboards/satan/keymaps/isoHHKB/rules.mk @@ -0,0 +1,21 @@ +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = yes # Commands for debug and configuration +NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif diff --git a/keyboards/satan/keymaps/isoHHKB/stunny_iso_hhkb.h b/keyboards/satan/keymaps/isoHHKB/stunny_iso_hhkb.h new file mode 100644 index 00000000..b5737f5a --- /dev/null +++ b/keyboards/satan/keymaps/isoHHKB/stunny_iso_hhkb.h @@ -0,0 +1,21 @@ +#ifndef STUNNY_ISO_HHKB_H +#define STUNNY_ISO_HHKB_H + +/* Satan ISO - HHKB matrix layout + * With 7u space bar, split right shift and 2u Backspace + * ,------------------------------------------------------------. + * | 00 |01| 02| 03| 04| 05| 06| 07| 08| 09| 0a| 0b| 0c| 0d | + * |------------------------------------------------------------| + * | 10 | 11| 12| 13| 14| 15| 16| 17| 18| 19| 1a| 1b| 1c| | + * |------------------------------------------------------------| + * | 20 | 21| 22| 23| 24| 25| 26| 27| 28| 29| 2a| 2b| 2c| 2d | + * |------------------------------------------------------------| + * | 30 | 32| 33| 34| 35| 36| 37| 38| 39| 3a| 3b| 3d | 3c | + * |------------------------------------------------------------| + * | | 41| 42 | 45 | 4a | 4b | | | + * `------------------------------------------------------------' + */ + +#define KEYMAP_ISO_HHKB KEYMAP_ISO_SPLITRSHIFT + +#endif diff --git a/keyboards/tada68/keymaps/stephengrier/config.h b/keyboards/tada68/keymaps/stephengrier/config.h new file mode 100755 index 00000000..56c5996d --- /dev/null +++ b/keyboards/tada68/keymaps/stephengrier/config.h @@ -0,0 +1,3 @@ +#include "../../config.h" + +#define BACKLIGHT_BREATHING diff --git a/keyboards/tada68/keymaps/stephengrier/keymap.c b/keyboards/tada68/keymaps/stephengrier/keymap.c new file mode 100755 index 00000000..ee9054e0 --- /dev/null +++ b/keyboards/tada68/keymaps/stephengrier/keymap.c @@ -0,0 +1,52 @@ +#include "tada68.h" + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. +#define _BL 0 +#define _FL 1 + +#define _______ KC_TRNS + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Keymap _BL: (Base Layer) Default Layer + * ,----------------------------------------------------------------. + * |Esc | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp |~ ` | + * |----------------------------------------------------------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ |Del | + * |----------------------------------------------------------------| + * |FN | A| S| D| F| G| H| J| K| L| ;| '|Return |PgUp| + * |----------------------------------------------------------------| + * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | Up|PgDn| + * |----------------------------------------------------------------| + * |Ctrl|Win |Alt | Space |Alt| FN|Ctrl|Lef|Dow|Rig | + * `----------------------------------------------------------------' + */ +[_BL] = KEYMAP_ANSI( + KC_ESC, 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_GRV, \ + 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_DEL, \ + MO(_FL), 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_RALT,MO(_FL),KC_RCTRL, KC_LEFT,KC_DOWN,KC_RGHT), + + /* Keymap _FL: Function Layer + * ,----------------------------------------------------------------. + * | | F1|F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12|Del |Ins | + * |----------------------------------------------------------------| + * | | |Up | | | | | |UP | | | | | |Hme | + * |----------------------------------------------------------------| + * | |<- |Dn | ->| | | |<- |Dn | ->| | | |End | + * |----------------------------------------------------------------| + * | | |BR |Bl-|BL |BL+| |VU-|VU+|MUT| | McL|MsU|McR | + * |----------------------------------------------------------------| + * | | | | | | | |MsL|MsD|MsR | + * `----------------------------------------------------------------' + */ +[_FL] = KEYMAP_ANSI( + _______, 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_DEL, KC_INS , \ + _______,_______, KC_UP,_______,_______, _______,_______,_______, KC_UP,_______,_______,_______,_______, _______,KC_HOME, \ + _______,KC_LEFT,KC_DOWN,KC_RIGHT,_______,_______,_______,KC_LEFT,KC_DOWN,KC_RIGHT,_______,_______, _______,KC_END, \ + _______,_______,BL_BRTG,BL_DEC, BL_TOGG,BL_INC, _______,KC_VOLD,KC_VOLU,KC_MUTE,_______,KC_BTN1, KC_MS_U, KC_BTN2, \ + _______,_______,_______, _______, _______,_______,_______,KC_MS_L,KC_MS_D, KC_MS_R), +}; diff --git a/keyboards/tada68/keymaps/stephengrier/readme.md b/keyboards/tada68/keymaps/stephengrier/readme.md new file mode 100755 index 00000000..f10f4ebd --- /dev/null +++ b/keyboards/tada68/keymaps/stephengrier/readme.md @@ -0,0 +1,15 @@ +# stephengrier's TADA68 layout + +This layout mostly replicates the default ANSI layout of the TADA68 but with a +few modifications to suit my tastes. + +The modifications from the default keymap are: + +* Replaced capslock with a second function key +* Swapped the left ALT and Win keys to be more like the Mac layout +* Added an arrow key cluster on the IJKL keys +* Fn+x toggles backlight breathing mode + +With this keymap backlight breathing mode can be enabled/disabled with Fn+x. +This is not supported at all in the default keymap. + diff --git a/keyboards/tada68/keymaps/stephengrier/rules.mk b/keyboards/tada68/keymaps/stephengrier/rules.mk new file mode 100644 index 00000000..2a7ff277 --- /dev/null +++ b/keyboards/tada68/keymaps/stephengrier/rules.mk @@ -0,0 +1,21 @@ +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = yes # Commands for debug and configuration +NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif diff --git a/keyboards/tkc1800/i2c.c b/keyboards/tkc1800/i2c.c new file mode 100644 index 00000000..cd2b835d --- /dev/null +++ b/keyboards/tkc1800/i2c.c @@ -0,0 +1,166 @@ +#include +#include +#include +#include +#include +#include +#include "i2c.h" + +#ifdef USE_I2C + +// Limits the amount of we wait for any one i2c transaction. +// Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is +// 9 bits, a single transaction will take around 90μs to complete. +// +// (F_CPU/SCL_CLOCK) => # of μC cycles to transfer a bit +// poll loop takes at least 8 clock cycles to execute +#define I2C_LOOP_TIMEOUT (9+1)*(F_CPU/SCL_CLOCK)/8 + +#define BUFFER_POS_INC() (slave_buffer_pos = (slave_buffer_pos+1)%SLAVE_BUFFER_SIZE) + +volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; + +static volatile uint8_t slave_buffer_pos; +static volatile bool slave_has_register_set = false; + +// Wait for an i2c operation to finish +inline static +void i2c_delay(void) { + uint16_t lim = 0; + while(!(TWCR & (1<10. + // Check datasheets for more info. + TWBR = ((F_CPU/SCL_CLOCK)-16)/2; +} + +// Start a transaction with the given i2c slave address. The direction of the +// transfer is set with I2C_READ and I2C_WRITE. +// returns: 0 => success +// 1 => error +uint8_t i2c_master_start(uint8_t address) { + TWCR = (1< slave ACK +// 1 => slave NACK +uint8_t i2c_master_write(uint8_t data) { + TWDR = data; + TWCR = (1<= SLAVE_BUFFER_SIZE ) { + ack = 0; + slave_buffer_pos = 0; + } + slave_has_register_set = true; + } else { + i2c_slave_buffer[slave_buffer_pos] = TWDR; + BUFFER_POS_INC(); + } + break; + + case TW_ST_SLA_ACK: + case TW_ST_DATA_ACK: + // master has addressed this device as a slave transmitter and is + // requesting data. + TWDR = i2c_slave_buffer[slave_buffer_pos]; + BUFFER_POS_INC(); + break; + + case TW_BUS_ERROR: // something went wrong, reset twi state + TWCR = 0; + default: + break; + } + // Reset everything, so we are ready for the next TWI interrupt + TWCR |= (1< + +#ifndef F_CPU +#define F_CPU 16000000UL +#endif + +#define I2C_READ 1 +#define I2C_WRITE 0 + +#define I2C_ACK 1 +#define I2C_NACK 0 + +#define SLAVE_BUFFER_SIZE 0x10 + +// i2c SCL clock frequency +#define SCL_CLOCK 800000L + +extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; + +void i2c_master_init(void); +uint8_t i2c_master_start(uint8_t address); +void i2c_master_stop(void); +uint8_t i2c_master_write(uint8_t data); +uint8_t i2c_master_read(int); +void i2c_reset_state(void); +void i2c_slave_init(uint8_t address); + + +static inline unsigned char i2c_start_read(unsigned char addr) { + return i2c_master_start((addr << 1) | I2C_READ); +} + +static inline unsigned char i2c_start_write(unsigned char addr) { + return i2c_master_start((addr << 1) | I2C_WRITE); +} + +// from SSD1306 scrips +extern unsigned char i2c_rep_start(unsigned char addr); +extern void i2c_start_wait(unsigned char addr); +extern unsigned char i2c_readAck(void); +extern unsigned char i2c_readNak(void); +extern unsigned char i2c_read(unsigned char ack); + +#define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak(); + +#endif diff --git a/keyboards/tkc1800/keymaps/default/config.h b/keyboards/tkc1800/keymaps/default/config.h index a3828f7d..30973348 100644 --- a/keyboards/tkc1800/keymaps/default/config.h +++ b/keyboards/tkc1800/keymaps/default/config.h @@ -19,6 +19,11 @@ #include "../../config.h" +#define USE_I2C +#define SSD1306OLED +//#define OLED_ROTATE180 +#define SSD1306_ADDRESS 0x3C + // place overrides here #endif diff --git a/keyboards/tkc1800/keymaps/default/keymap.c b/keyboards/tkc1800/keymaps/default/keymap.c index 1b9f390b..7821f0f3 100644 --- a/keyboards/tkc1800/keymaps/default/keymap.c +++ b/keyboards/tkc1800/keymaps/default/keymap.c @@ -14,21 +14,33 @@ * along with this program. If not, see . */ #include "tkc1800.h" +#include "LUFA/Drivers/Peripheral/TWI.h" +#include "i2c.h" +#include "ssd1306.h" + #define MODS_SHFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)|MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) #define MODS_GUI_MASK (MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) + // Helpful defines #define ______ KC_TRNS #define XXXXXX KC_NO -#define _DEFAULT 0 -#define _FUNCTION 1 +//Layers + +enum { + BASE = 0, + FUNCTION, +}; + +//13 characters max without re-writing the "Layer: " format in iota_gfx_task_user() +static char layer_lookup[][14] = {"Base","Function"}; + -//RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - /* Keymap _BL: (Base Layer) Default Layer + /* Keymap BASE: (Base Layer) Default Layer * ,-------------------------------------------------------. ,-------------------. * |Esc| F1| F2| F3| F4| | F5| F6| F7| F8| | F9|F10|F11|F12| |Ins |Home|PgUp|PrSc| * `-------------------------------------------------------' |-------------------| @@ -45,41 +57,89 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |Ctrl|Gui |Alt | Space |Alt |Gui|Ctr|Left |Down|Rght| 0 | . | | * `---------------------------------------------------------------------------------' */ - [_DEFAULT] = KEYMAP( + [BASE] = 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_INS, KC_HOME, KC_PGUP, KC_PSCR, \ KC_DEL, KC_END, KC_PGDN, KC_SLCK, \ - KC_TILD, 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, XXXXXX, KC_NLCK, KC_PSLS, KC_PAST, KC_PAUS, \ + 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, XXXXXX, KC_NLCK, KC_PSLS, KC_PAST, KC_PAUS, \ 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_P7, KC_P8, KC_P9, KC_PMNS, \ KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, XXXXXX, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, \ - KC_LSFT, XXXXXX, 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_P1, KC_P2, KC_P3, KC_PENT, \ - KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(_FUNCTION), KC_RGUI, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, XXXXXX + KC_LSFT, XXXXXX, 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_P1, KC_P2, KC_P3, XXXXXX, \ + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(FUNCTION), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT ), - [_FUNCTION] = KEYMAP( + [FUNCTION] = 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_INS, KC_HOME, KC_PGUP, KC_PSCR, \ KC_DEL, KC_END, KC_PGDN, KC_SLCK, \ - KC_TILD, 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, XXXXXX, KC_NLCK, KC_PSLS, KC_PAST, KC_PAUS, \ + 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, RESET, XXXXXX, KC_NLCK, KC_PSLS, KC_PAST, KC_PAUS, \ 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_P7, KC_P8, KC_P9, KC_PMNS, \ KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, XXXXXX, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, \ - KC_LSFT, XXXXXX, RGB_TOG,RGB_MOD,RGB_HUI,RGB_HUD,RGB_SAI,RGB_SAD,RGB_VAI,RGB_VAD, KC_DOT,KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, \ - KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, ______, KC_RGUI, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, XXXXXX + KC_LSFT, XXXXXX, RGB_TOG,RGB_MOD,RGB_HUI,RGB_HUD,RGB_SAI,RGB_SAD,RGB_VAI,RGB_VAD, KC_DOT,KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, XXXXXX, \ + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, ______, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT ), }; // const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {}; +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} -void matrix_init_user(void) { +void led_set_user(uint8_t usb_led) { } +void matrix_init_user(void) { + #ifdef USE_I2C + i2c_master_init(); + #ifdef SSD1306OLED + // calls code for the SSD1306 OLED + _delay_ms(400); + TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000)); + iota_gfx_init(); // turns on the display + #endif + #endif + #ifdef AUDIO_ENABLE + startup_user(); + #endif +} void matrix_scan_user(void) { - + #ifdef SSD1306OLED + iota_gfx_task(); // this is what updates the display continuously + #endif } -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - return true; +void matrix_update(struct CharacterMatrix *dest, + const struct CharacterMatrix *source) { + if (memcmp(dest->display, source->display, sizeof(dest->display))) { + memcpy(dest->display, source->display, sizeof(dest->display)); + dest->dirty = true; + } } -void led_set_user(uint8_t usb_led) { +void iota_gfx_task_user(void) { +#if DEBUG_TO_SCREEN + if (debug_enable) { + return; + } +#endif + + struct CharacterMatrix matrix; + + matrix_clear(&matrix); + matrix_write_P(&matrix, PSTR("TKC1800")); + + uint8_t layer = biton32(layer_state); + + char buf[40]; + snprintf(buf,sizeof(buf), "Undef-%d", layer); + matrix_write_P(&matrix, PSTR("\nLayer: ")); + matrix_write(&matrix, layer_lookup[layer]); + // Host Keyboard LED Status + char led[40]; + snprintf(led, sizeof(led), "\n\n%s %s %s", + (host_keyboard_leds() & (1< + * + * 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_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +#define USE_I2C +#define SSD1306OLED +//#define OLED_ROTATE180 +#define SSD1306_ADDRESS 0x3C + +// place overrides here + +#endif diff --git a/keyboards/tkc1800/keymaps/wkl/keymap.c b/keyboards/tkc1800/keymaps/wkl/keymap.c new file mode 100644 index 00000000..b72a77c2 --- /dev/null +++ b/keyboards/tkc1800/keymaps/wkl/keymap.c @@ -0,0 +1,145 @@ +/* Copyright 2017 Mathias Andersson + * + * 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 . + */ +#include "tkc1800.h" +#include "LUFA/Drivers/Peripheral/TWI.h" +#include "i2c.h" +#include "ssd1306.h" + + +#define MODS_SHFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)|MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) +#define MODS_GUI_MASK (MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) + + +// Helpful defines +#define ______ KC_TRNS +#define XXXXXX KC_NO + +//Layers + +enum { + BASE = 0, + FUNCTION, +}; + +//13 characters max without re-writing the "Layer: " format in iota_gfx_task_user() +static char layer_lookup[][14] = {"Base","Function"}; + + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Keymap BASE: (Base Layer) Default Layer + * ,-------------------------------------------------------. ,-------------------. + * |Esc| F1| F2| F3| F4| | F5| F6| F7| F8| | F9|F10|F11|F12| |Ins |Home|PgUp|PrSc| + * `-------------------------------------------------------' |-------------------| + * |Del |End |PgDn|ScrL| + * ,-----------------------------------------------------------. |-------------------| + * | ~ | 1 | 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | |NumL| / | * |Paus| + * |-----------------------------------------------------------| |-------------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ | | 7 | 8 | 9 | - | + * |-----------------------------------------------------------| |-------------------| + * |CAPS | A| S| D| F| G| H| J| K| L| ;| '|Return | | 4 | 5 | 6 | + | + * |-----------------------------------------------------------' |-------------------| + * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | Up | 1 | 2 | 3 | Ent| + * |--------------------------------------------------------'----`--------------| | + * |Ctrl|Gui |Alt | Space |Alt |Gui|Ctr|Left |Down|Rght| 0 | . | | + * `---------------------------------------------------------------------------------' + */ + [BASE] = 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_INS, KC_HOME, KC_PGUP, KC_PSCR, \ + KC_DEL, KC_END, KC_PGDN, KC_SLCK, \ + 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, XXXXXX, KC_NLCK, KC_PSLS, KC_PAST, KC_PAUS, \ + 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_P7, KC_P8, KC_P9, KC_PMNS, \ + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, XXXXXX, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, \ + KC_LSFT, XXXXXX, 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_P1, KC_P2, KC_P3, XXXXXX, \ + KC_LCTL, KC_LALT, XXXXXX, KC_SPC, XXXXXX, MO(FUNCTION), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT + ), + [FUNCTION] = 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_INS, KC_HOME, KC_PGUP, KC_PSCR, \ + KC_DEL, KC_END, KC_PGDN, KC_SLCK, \ + 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, RESET, XXXXXX, KC_NLCK, KC_PSLS, KC_PAST, KC_PAUS, \ + 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_P7, KC_P8, KC_P9, KC_PMNS, \ + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, XXXXXX, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, \ + KC_LSFT, XXXXXX, RGB_TOG,RGB_MOD,RGB_HUI,RGB_HUD,RGB_SAI,RGB_SAD,RGB_VAI,RGB_VAD, KC_DOT,KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, XXXXXX, \ + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, XXXXXX, ______, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT + ), +}; + +// const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} + +void led_set_user(uint8_t usb_led) { + +} +void matrix_init_user(void) { + #ifdef USE_I2C + i2c_master_init(); + #ifdef SSD1306OLED + // calls code for the SSD1306 OLED + _delay_ms(400); + TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000)); + iota_gfx_init(); // turns on the display + #endif + #endif + #ifdef AUDIO_ENABLE + startup_user(); + #endif +} + +void matrix_scan_user(void) { + #ifdef SSD1306OLED + iota_gfx_task(); // this is what updates the display continuously + #endif +} + +void matrix_update(struct CharacterMatrix *dest, + const struct CharacterMatrix *source) { + if (memcmp(dest->display, source->display, sizeof(dest->display))) { + memcpy(dest->display, source->display, sizeof(dest->display)); + dest->dirty = true; + } +} + +void iota_gfx_task_user(void) { +#if DEBUG_TO_SCREEN + if (debug_enable) { + return; + } +#endif + + struct CharacterMatrix matrix; + + matrix_clear(&matrix); + matrix_write_P(&matrix, PSTR("TKC1800")); + + uint8_t layer = biton32(layer_state); + + char buf[40]; + snprintf(buf,sizeof(buf), "Undef-%d", layer); + matrix_write_P(&matrix, PSTR("\nLayer: ")); + matrix_write(&matrix, layer_lookup[layer]); + + // Host Keyboard LED Status + char led[40]; + snprintf(led, sizeof(led), "\n\n%s %s %s", + (host_keyboard_leds() & (1<event.pressed) { register_code(KC_RSFT); } + else { unregister_code(KC_RSFT); } + break; + } + + return MACRO_NONE; +}; + +// Loop +void matrix_scan_user(void) { + // Empty +}; diff --git a/keyboards/xd60/keymaps/krusli/readme.md b/keyboards/xd60/keymaps/krusli/readme.md new file mode 100644 index 00000000..7b6bce9c --- /dev/null +++ b/keyboards/xd60/keymaps/krusli/readme.md @@ -0,0 +1,2 @@ +# krusli's HHKB-style keymap for the XD60 +HHKB-style keymap for the XD60. The board was not built with split backspace but still has Backspace and |\\ swapped. diff --git a/quantum/quantum.c b/quantum/quantum.c index 88617412..65fa2596 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -138,13 +138,13 @@ void reset_keyboard(void) { clear_keyboard(); #if defined(MIDI_ENABLE) && defined(MIDI_BASIC) process_midi_all_notes_off(); -#endif +#endif #if defined(AUDIO_ENABLE) music_all_notes_off(); uint16_t timer_start = timer_read(); PLAY_SONG(goodbye_song); shutdown_user(); - while(timer_elapsed(timer_start) < 250) + while(timer_elapsed(timer_start) < 250) wait_ms(1); stop_all_notes(); #else @@ -885,6 +885,7 @@ void backlight_set(uint8_t level) {} uint8_t backlight_tick = 0; +#ifndef BACKLIGHT_CUSTOM_DRIVER void backlight_task(void) { if ((0xFFFF >> ((BACKLIGHT_LEVELS - get_backlight_level()) * ((BACKLIGHT_LEVELS + 1) / 2))) & (1 << backlight_tick)) { #if BACKLIGHT_ON_STATE == 0 @@ -905,9 +906,12 @@ void backlight_task(void) { } backlight_tick = backlight_tick + 1 % 16; } +#endif #ifdef BACKLIGHT_BREATHING -#error "Backlight breathing only available with hardware PWM. Please disable." + #ifndef BACKLIGHT_CUSTOM_DRIVER + #error "Backlight breathing only available with hardware PWM. Please disable." + #endif #endif #else // pwm through timer @@ -935,6 +939,7 @@ static inline void set_pwm(uint16_t val) { OCR1x = val; } +#ifndef BACKLIGHT_CUSTOM_DRIVER __attribute__ ((weak)) void backlight_set(uint8_t level) { if (level > BACKLIGHT_LEVELS) @@ -952,6 +957,7 @@ void backlight_set(uint8_t level) { } void backlight_task(void) {} +#endif // BACKLIGHT_CUSTOM_DRIVER #ifdef BACKLIGHT_BREATHING diff --git a/tmk_core/chibios.mk b/tmk_core/chibios.mk index 4fa9fac2..cb0482d7 100644 --- a/tmk_core/chibios.mk +++ b/tmk_core/chibios.mk @@ -26,7 +26,7 @@ endif # Imported source files and paths CHIBIOS = $(TOP_DIR)/lib/chibios CHIBIOS_CONTRIB = $(TOP_DIR)/lib/chibios-contrib -# Startup files. Try a few different locations, for compability with old versions and +# Startup files. Try a few different locations, for compability with old versions and # for things hardware in the contrib repository STARTUP_MK = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_$(MCU_STARTUP).mk ifeq ("$(wildcard $(STARTUP_MK))","") @@ -46,7 +46,7 @@ endif include $(PLATFORM_MK) -BOARD_MK := +BOARD_MK := ifneq ("$(wildcard $(KEYBOARD_PATH_5)/boards/$(BOARD)/board.mk)","") BOARD_PATH = $(KEYBOARD_PATH_5) @@ -115,14 +115,14 @@ CHIBISRC = $(STARTUPSRC) \ $(STREAMSSRC) \ $(STARTUPASM) \ $(PORTASM) \ - $(OSALASM) + $(OSALASM) CHIBISRC := $(patsubst $(TOP_DIR)/%,%,$(CHIBISRC)) - + EXTRAINCDIRS += $(CHIBIOS)/os/license \ $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \ - $(STREAMSINC) $(CHIBIOS)/os/various + $(STREAMSINC) $(CHIBIOS)/os/various # # Project, sources and paths @@ -139,17 +139,17 @@ SIZE = arm-none-eabi-size AR = arm-none-eabi-ar NM = arm-none-eabi-nm HEX = $(OBJCOPY) -O $(FORMAT) -EEP = +EEP = BIN = $(OBJCOPY) -O binary -THUMBFLAGS = -DTHUMB_PRESENT -mno-thumb-interwork -DTHUMB_NO_INTERWORKING -mthumb -DTHUMB +THUMBFLAGS = -DTHUMB_PRESENT -mno-thumb-interwork -DTHUMB_NO_INTERWORKING -mthumb -DTHUMB -COMPILEFLAGS += -fomit-frame-pointer +COMPILEFLAGS += -fomit-frame-pointer COMPILEFLAGS += -falign-functions=16 COMPILEFLAGS += -ffunction-sections COMPILEFLAGS += -fdata-sections COMPILEFLAGS += -fno-common -COMPILEFLAGS += $(THUMBFLAGS) +COMPILEFLAGS += $(THUMBFLAGS) CFLAGS += $(COMPILEFLAGS) @@ -168,6 +168,22 @@ OPT_DEFS += -DPROTOCOL_CHIBIOS MCUFLAGS = -mcpu=$(MCU) +# FPU options default (Cortex-M4 and Cortex-M7 single precision). +ifeq ($(USE_FPU_OPT),) + USE_FPU_OPT = -mfloat-abi=$(USE_FPU) -mfpu=fpv4-sp-d16 -fsingle-precision-constant +endif + +# FPU-related options +ifeq ($(USE_FPU),) + USE_FPU = no +endif +ifneq ($(USE_FPU),no) + OPT += $(USE_FPU_OPT) + OPT_DEFS += -DCORTEX_USE_FPU=TRUE +else + OPT_DEFS += -DCORTEX_USE_FPU=FALSE +endif + DEBUG = gdb DFU_ARGS ?= diff --git a/tmk_core/common/backlight.c b/tmk_core/common/backlight.c index 4d2491b9..12f75b38 100644 --- a/tmk_core/common/backlight.c +++ b/tmk_core/common/backlight.c @@ -94,4 +94,4 @@ void backlight_level(uint8_t level) uint8_t get_backlight_level(void) { return backlight_config.level; -} \ No newline at end of file +} diff --git a/tmk_core/common/wait.h b/tmk_core/common/wait.h index 553f5243..a7cded94 100644 --- a/tmk_core/common/wait.h +++ b/tmk_core/common/wait.h @@ -13,13 +13,8 @@ extern "C" { # define wait_us(us) _delay_us(us) #elif defined PROTOCOL_CHIBIOS # include "ch.h" -# if defined(STM32F3xx_MCUCONF) -# define wait_ms(ms) chSysPolledDelayX(MS2RTC(STM32_HCLK, (ms))) -# define wait_us(us) chSysPolledDelayX(US2RTC(STM32_HCLK, (us))) -# else -# define wait_ms(ms) chThdSleepMilliseconds(ms) -# define wait_us(us) chThdSleepMicroseconds(us) -# endif +# define wait_ms(ms) chThdSleepMilliseconds(ms) +# define wait_us(us) chThdSleepMicroseconds(us) #elif defined(__arm__) # include "wait_api.h" #else // Unit tests diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c index 2ac0257b..a07d7440 100644 --- a/users/drashna/drashna.c +++ b/users/drashna/drashna.c @@ -30,6 +30,15 @@ PROGMEM const char secret[][64] = { }; #endif +#ifdef FAUXCLICKY_ENABLE +float fauxclicky_pressed_note[2] = MUSICAL_NOTE(_A6, 2); // (_D4, 0.25); +float fauxclicky_released_note[2] = MUSICAL_NOTE(_A6, 2); // (_C4, 0.125); +#else +float fauxclicky_pressed[][2] = SONG(E__NOTE(_A6)); // change to your tastes +float fauxclicky_released[][2] = SONG(E__NOTE(_A6)); // change to your tastes +#endif +bool faux_click_enabled = true; + #ifdef TAP_DANCE_ENABLE //define diablo macro timer variables static uint16_t diablo_timer[4]; @@ -222,11 +231,22 @@ void persistent_default_layer_set(uint16_t default_layer) { // Defines actions tor my global custom keycodes. Defined in drashna.h file // Then runs the _keymap's recod handier if not processed here bool process_record_user(uint16_t keycode, keyrecord_t *record) { - + #ifdef CONSOLE_ENABLE xprintf("KL: row: %u, column: %u, pressed: %u\n", record->event.key.col, record->event.key.row, record->event.pressed); #endif +#ifdef AUDIO_ENABLE + if (faux_click_enabled) { + if (record->event.pressed) { + PLAY_SONG(fauxclicky_pressed); + } else { + stop_note(NOTE_A6); + PLAY_SONG(fauxclicky_released); + } + } +#endif + switch (keycode) { case KC_QWERTY: if (record->event.pressed) { @@ -295,7 +315,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return false; break; -#if !(defined(KEYBOARD_orthodox_rev1) || defined(KEYBOARD_ergodox_ez)) +#if !(defined(KEYBOARD_orthodox_rev1) || defined(KEYBOARD_orthodox_rev3) || defined(KEYBOARD_ergodox_ez)) case KC_OVERWATCH: if (record->event.pressed) { is_overwatch = !is_overwatch; @@ -460,11 +480,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { " AUDIO_ENABLE=yes" #else " AUDIO_ENABLE=no" -#endif -#ifdef FAUXCLICKY_ENABLE - " FAUXCLICKY_ENABLE=yes" -#else - " FAUXCLICKY_ENABLE=no" #endif SS_TAP(X_ENTER)); } @@ -499,6 +514,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return false; break; + case KC_FXCL: + if (!record->event.pressed) { + faux_click_enabled = !faux_click_enabled; + } + return false; + break; case KC_RGB_T: // Because I want the option to go back to normal RGB mode rather than always layer indication #ifdef RGBLIGHT_ENABLE if (record->event.pressed) { diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h index 2475c99d..aa9c8308 100644 --- a/users/drashna/drashna.h +++ b/users/drashna/drashna.h @@ -101,6 +101,7 @@ enum userspace_custom_keycodes { KC_SECRET_3, KC_SECRET_4, KC_SECRET_5, + KC_FXCL, NEW_SAFE_RANGE //use "NEWPLACEHOLDER for keymap specific codes }; @@ -133,4 +134,12 @@ enum { #define IGNORE_MOD_TAP_INTERRUPT // this makes it possible to do rolling combos (zx) with keys that convert to other keys on hold (z becomes ctrl when you hold it, and when this option isn't enabled, z rapidly followed by x actually sends Ctrl-x. That's bad.) +#ifdef FAUXCLICKY_ENABLE +#define AUD_ON FC_ON +#define AUD_OFF FC_OFF +#else +#define AUD_ON AU_ON +#define AUD_OFF AU_OFF +#endif + #endif diff --git a/util/new_project.sh b/util/new_project.sh index 18d16e56..0f507b67 100755 --- a/util/new_project.sh +++ b/util/new_project.sh @@ -12,19 +12,11 @@ cd "$(dirname "$0")/.." KEYBOARD=$1 KEYBOARD_UPPERCASE=$(echo $1 | awk '{print toupper($0)}') -mkdir keyboards/$1 -mkdir keyboards/$1/keymaps -mkdir keyboards/$1/keymaps/default -sed -e "s;%KEYBOARD%;$KEYBOARD;g" -e "s;%KEYBOARD_UPPERCASE%;$KEYBOARD_UPPERCASE;g" quantum/template/template.h > keyboards/$KEYBOARD/$KEYBOARD.h -sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/template.c > keyboards/$KEYBOARD/$KEYBOARD.c -sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/config.h > keyboards/$KEYBOARD/config.h -sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/readme.md > keyboards/$KEYBOARD/readme.md -sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/Makefile > keyboards/$KEYBOARD/Makefile -sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/rules.mk > keyboards/$KEYBOARD/rules.mk -sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/keymaps/default/config.h > keyboards/$KEYBOARD/keymaps/default/config.h -sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/keymaps/default/keymap.c > keyboards/$KEYBOARD/keymaps/default/keymap.c -sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/keymaps/default/Makefile > keyboards/$KEYBOARD/keymaps/default/Makefile -sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/keymaps/default/readme.md > keyboards/$KEYBOARD/keymaps/default/readme.md +cp -r quantum/template keyboards/$KEYBOARD +mv keyboards/$KEYBOARD/template.c keyboards/$KEYBOARD/$KEYBOARD.c +mv keyboards/$KEYBOARD/template.h keyboards/$KEYBOARD/$KEYBOARD.h +find keyboards/${KEYBOARD} -type f -exec sed -i "s;%KEYBOARD%;$KEYBOARD;g" {} \; +find keyboards/${KEYBOARD} -type f -exec sed -i "s;%KEYBOARD_UPPERCASE%;$KEYBOARD_UPPERCASE;g" {} \; echo "######################################################" echo "# /keyboards/$KEYBOARD project created. To start"