From 9113f3387a670373919fe62899b0ab27e9d89eba Mon Sep 17 00:00:00 2001 From: RandTrawick Date: Mon, 27 Nov 2017 14:08:53 -0700 Subject: [PATCH] JJ40 updates (#2056) * my bits * fixed safdb * readme * readme * better name, fixed compile error * fixed matrix user * cleanup --- keyboards/jj40/config.h | 6 ++ keyboards/jj40/jj40.c | 12 +++ keyboards/jj40/keymaps/fun40/config.h | 9 ++ keyboards/jj40/keymaps/fun40/jj40.h | 70 ++++++++++++++ keyboards/jj40/keymaps/fun40/keymap.c | 123 +++++++++++++++++++++++++ keyboards/jj40/keymaps/fun40/readme.md | 4 + keyboards/jj40/keymaps/fun40/rules.mk | 20 ++++ keyboards/jj40/rules.mk | 3 + 8 files changed, 247 insertions(+) create mode 100644 keyboards/jj40/keymaps/fun40/config.h create mode 100644 keyboards/jj40/keymaps/fun40/jj40.h create mode 100644 keyboards/jj40/keymaps/fun40/keymap.c create mode 100644 keyboards/jj40/keymaps/fun40/readme.md create mode 100644 keyboards/jj40/keymaps/fun40/rules.mk diff --git a/keyboards/jj40/config.h b/keyboards/jj40/config.h index fdea4a042..42a37c957 100644 --- a/keyboards/jj40/config.h +++ b/keyboards/jj40/config.h @@ -29,6 +29,12 @@ along with this program. If not, see . #define MATRIX_ROWS 8 #define MATRIX_COLS 15 +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +#define BACKLIGHT_PIN B6 +#define BACKLIGHT_LEVELS 3 + #define TAPPING_TOGGLE 3 #define NO_UART 1 diff --git a/keyboards/jj40/jj40.c b/keyboards/jj40/jj40.c index 136e023fa..d5add2a6b 100644 --- a/keyboards/jj40/jj40.c +++ b/keyboards/jj40/jj40.c @@ -26,3 +26,15 @@ __attribute__ ((weak)) void matrix_scan_user(void) { /* Nothing to do here... yet */ } + +void matrix_init_kb(void) { + + // Call the keymap level matrix init. + matrix_init_user(); + + // Set our LED pins as output + DDRB |= (1<<6); +} + +void matrix_init_user(void) { +} \ No newline at end of file diff --git a/keyboards/jj40/keymaps/fun40/config.h b/keyboards/jj40/keymaps/fun40/config.h new file mode 100644 index 000000000..89807d84a --- /dev/null +++ b/keyboards/jj40/keymaps/fun40/config.h @@ -0,0 +1,9 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +#define FORCE_NKRO +#define PREVENT_STUCK_MODIFIERS + +#endif diff --git a/keyboards/jj40/keymaps/fun40/jj40.h b/keyboards/jj40/keymaps/fun40/jj40.h new file mode 100644 index 000000000..a6162d9c0 --- /dev/null +++ b/keyboards/jj40/keymaps/fun40/jj40.h @@ -0,0 +1,70 @@ +/* +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 . +*/ + +#ifndef KEYMAP_COMMON_H +#define KEYMAP_COMMON_H + +#include "quantum.h" +// #include "keycode.h" +// #include "action.h" + +#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, \ + K21, K22, K23, K24, K25, K26, K27, K28, K29, K210, K211, K212, \ + K31, K32, K33, K34, K35, K36, K37, K38, K39, K310, K311, K312 \ +) \ +{ \ + { K012, K011, K010, K09, K05, K06, K07, K08, K04, K03, K02, K01 }, \ + { K112, K111, K110, K19, K15, K16, K17, K18, K14, K13, K12, K11 }, \ + { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ + { K212, K211, K210, K29, K25, K26, K27, K28, K24, K23, K22, K21 }, \ + { K312, K311, K310, K39, K35, K36, K37, K38, K34, K33, K32, K31 } \ +} + +#define KEYMAP_MIT( \ + K01, K02, K03, K04, K05, K06, K07, K08, K09, K010, K011, K012, \ + K11, K12, K13, K14, K15, K16, K17, K18, K19, K110, K111, K112, \ + K21, K22, K23, K24, K25, K26, K27, K28, K29, K210, K211, K212, \ + K31, K32, K33, K34, K35, K3X, K38, K39, K310, K311, K312 \ +) \ +{ \ + { K012, K011, K010, K09, K05, K06, K07, K08, K04, K03, K02, K01 }, \ + { K112, K111, K110, K19, K15, K16, K17, K18, K14, K13, K12, K11 }, \ + { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ + { K212, K211, K210, K29, K25, K26, K27, K28, K24, K23, K22, K21 }, \ + { K312, K311, K310, K39, K35, K3X, KC_NO, K38, K34, K33, K32, K31 } \ +} + +#define KEYMAP_OFFSET( \ + K01, K02, K03, K04, K05, K06, K07, K08, K09, K010, K011, K012, \ + K11, K12, K13, K14, K15, K16, K17, K18, K19, K110, K111, K112, \ + K21, K22, K23, K24, K25, K26, K27, K28, K29, K210, K211, K212, \ + K31, K32, K33, K34, K35, K36, K3X, K39, K310, K311, K312 \ +) \ +{ \ + { K012, K011, K010, K09, K05, K06, K07, K08, K04, K03, K02, K01 }, \ + { K112, K111, K110, K19, K15, K16, K17, K18, K14, K13, K12, K11 }, \ + { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ + { K212, K211, K210, K29, K25, K26, K27, K28, K24, K23, K22, K21 }, \ + { K312, K311, K310, K39, K35, K36, K3X, KC_NO, K34, K33, K32, K31 } \ +} + +#define KEYMAP KEYMAP_GRID +#define LAYOUT_ortho_4x12 LAYOUT_planck_grid + +#endif diff --git a/keyboards/jj40/keymaps/fun40/keymap.c b/keyboards/jj40/keymaps/fun40/keymap.c new file mode 100644 index 000000000..f5641e297 --- /dev/null +++ b/keyboards/jj40/keymaps/fun40/keymap.c @@ -0,0 +1,123 @@ +#include "jj40.h" +#include "action_layer.h" +#include "eeconfig.h" +#ifdef BACKLIGHT_ENABLE + #include "backlight.h" +#endif + +#define _QWERTY 0 +#define _LOWER 1 +#define _RAISE 2 +#define _BL 4 // Backlight +// #define _ADJUST 3 +#define TG_NKRO MAGIC_TOGGLE_NKRO + + +enum custom_keycodes { + QWERTY = SAFE_RANGE, + LOWER, + RAISE, +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +/* Qwerty + * ,-----------------------------------------------------------------------------------. + * | Esc | Q | W | E | R | T | Y | U | I | O | P | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Tab | A | S | D | F | G | H | J | K | L | ; | " | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Ctrl | Del | Alt | GUI |Lower | Space|Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_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_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_LCTL, KC_DEL, KC_LALT, KC_LGUI, MO(_LOWER),KC_SPC,KC_SPC, MO(_RAISE), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ +), + +/* Lower + * ,-----------------------------------------------------------------------------------. + * | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | ! | @ | # | $ | % | ^ | & | * | ( | ) | | | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Shift|PrScr |ISO ~ |ISO | | | | | | |bl_on |bl_stp| Enter| + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Ctrl | nkro | Alt | NKRO |Lower | PgDn | PgUp |Raise | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ +[_LOWER] = KEYMAP( \ + 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_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, _______, \ + KC_LSFT, KC_PSCR, S(KC_NUHS), S(KC_NUBS), _______, _______, _______, _______, _______, BL_ON, BL_STEP, KC_ENT, \ + KC_LCTL, MAGIC_TOGGLE_NKRO, KC_LALT, TG_NKRO, _______, KC_PGDN, KC_PGUP, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ +), + +/* Raise + * ,-----------------------------------------------------------------------------------. + * | Caps | + | - | = | ( | ) | | 7 | 8 | 9 | Bksp | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Lock | ~ | _ | | [ | ] | | 4 | 5 | 6 | |Enter | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Ins | ` | \ | | | { | } | | 1 | 2 | 3 | . | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Ctrl | | Alt | |Lower | | |Raise | 0 | | Home | End | + * `-----------------------------------------------------------------------------------' + */ +[_RAISE] = KEYMAP( \ + KC_CAPS, KC_MINS, KC_PLUS, KC_EQL, KC_LPRN, KC_RPRN, _______, KC_7, KC_8, KC_9, KC_BSPC, KC_DEL, \ + KC_LOCK, KC_TILD, KC_UNDS, _______,KC_LBRC, KC_RBRC, _______, KC_4, KC_5, KC_6, _______, _______, \ + KC_INS, KC_GRV, KC_BSLS, KC_PIPE, KC_LCBR, KC_RCBR, _______, KC_1, KC_2, KC_3, KC_DOT, _______, \ + KC_LCTL, _______, KC_LALT, _______, _______, _______, _______, _______, KC_0, _______, KC_HOME, KC_END \ +) + +/* Adjust + G = git + M = mail + * ,-----------------------------------------------------------------------------------. + * | gAdd |gStash| | const| | Clog | | | Mstk | Mrad |Mgmail| | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | gPush| | | if() | | Clog2| | | | |Mcity | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | gPull| | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | |Lower | | |Raise | | | | | + * `-----------------------------------------------------------------------------------' + */ + + +/* Empty + * ,-----------------------------------------------------------------------------------. + * | | | | | | | | | | | | | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | | | | | | | | | | | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | |Lower | | |Raise | | | | | + * `-----------------------------------------------------------------------------------' + */ +}; + +// Macro actions for each corresponding ID. +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); +#ifdef BACKLIGHT_ENABLE + backlight_step(); +#endif + } + else { + unregister_code(KC_RSFT); + } + break; + } + return MACRO_NONE; +}; diff --git a/keyboards/jj40/keymaps/fun40/readme.md b/keyboards/jj40/keymaps/fun40/readme.md new file mode 100644 index 000000000..f4036fa0e --- /dev/null +++ b/keyboards/jj40/keymaps/fun40/readme.md @@ -0,0 +1,4 @@ +# Fun 40%. + +* backlighting on flash + * backlight fails on reboot \ No newline at end of file diff --git a/keyboards/jj40/keymaps/fun40/rules.mk b/keyboards/jj40/keymaps/fun40/rules.mk new file mode 100644 index 000000000..cd2208edd --- /dev/null +++ b/keyboards/jj40/keymaps/fun40/rules.mk @@ -0,0 +1,20 @@ + + +BOOTMAGIC_ENABLE = yes # 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 = yes # Commands for debug and configuration +NKRO_ENABLE = no # 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 = yes # 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/jj40/rules.mk b/keyboards/jj40/rules.mk index 4b0a9e190..c39ebf222 100644 --- a/keyboards/jj40/rules.mk +++ b/keyboards/jj40/rules.mk @@ -35,6 +35,9 @@ RGBLIGHT_ENABLE = no RGBLIGHT_CUSTOM_DRIVER = no KEY_LOCK_ENABLE = yes +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + OPT_DEFS = -DDEBUG_LEVEL=0 OPT_DEFS += -DBOOTLOADER_SIZE=2048