From 985b8cab7ca7103aee2b83696824683bd5159888 Mon Sep 17 00:00:00 2001 From: Ryan Date: Fri, 8 Jan 2021 06:39:38 +1100 Subject: [PATCH] [Keyboard] JM60 refactor (#11421) --- keyboards/jm60/config.h | 110 ++++++++++++++++---- keyboards/jm60/info.json | 78 +++++++++++++++ keyboards/jm60/jm60.c | 3 +- keyboards/jm60/jm60.h | 45 +++------ keyboards/jm60/keymaps/default/keymap.c | 75 +++++++------- keyboards/jm60/keymaps/poker3/keymap.c | 43 ++++---- keyboards/jm60/led.c | 24 ----- keyboards/jm60/matrix.c | 128 ------------------------ keyboards/jm60/readme.md | 24 ++--- keyboards/jm60/rules.mk | 29 +++--- 10 files changed, 261 insertions(+), 298 deletions(-) create mode 100644 keyboards/jm60/info.json delete mode 100644 keyboards/jm60/led.c delete mode 100644 keyboards/jm60/matrix.c diff --git a/keyboards/jm60/config.h b/keyboards/jm60/config.h index f490037f6..2409142e0 100644 --- a/keyboards/jm60/config.h +++ b/keyboards/jm60/config.h @@ -15,39 +15,105 @@ 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 +#pragma once /* USB Device descriptor parameter */ -#define VENDOR_ID 0xFEED -#define PRODUCT_ID 0x6464 -#define DEVICE_VER 0x0001 +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x6464 +#define DEVICE_VER 0x0001 #define MANUFACTURER JMWS -#define PRODUCT JM60 RGB Keyboard(QMK) -#define DESCRIPTION QMK keyboard firmware for JM60 RGB Keyboard +#define PRODUCT JM60 /* key matrix size */ #define MATRIX_ROWS 5 #define MATRIX_COLS 14 -/* number of backlight levels */ -//#define BACKLIGHT_LEVELS 1 +/* + * 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 { B11, B10, B2, B1, B0 } +#define MATRIX_COL_PINS { A15, C10, C11, C12, D2, B3, B4, B5, B6, B7, B8, B9, A2, A3 } +#define UNUSED_PINS -//#define LED_BRIGHTNESS_LO 100 -//#define LED_BRIGHTNESS_HI 255 +/* COL2ROW, ROW2COL */ +#define DIODE_DIRECTION ROW2COL -/* define if matrix has ghost */ +//#define BACKLIGHT_PIN B7 +//#define BACKLIGHT_LEVELS 3 +//#define BACKLIGHT_BREATHING + +//#define RGB_DI_PIN E2 +//#ifdef RGB_DI_PIN +//# define RGBLED_NUM 16 +//# define RGBLIGHT_HUE_STEP 8 +//# define RGBLIGHT_SAT_STEP 8 +//# define RGBLIGHT_VAL_STEP 8 +//# define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */ +//# define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */ +/*== all animations enable ==*/ +//# define RGBLIGHT_ANIMATIONS +/*== or choose animations ==*/ +//# define RGBLIGHT_EFFECT_BREATHING +//# define RGBLIGHT_EFFECT_RAINBOW_MOOD +//# define RGBLIGHT_EFFECT_RAINBOW_SWIRL +//# define RGBLIGHT_EFFECT_SNAKE +//# define RGBLIGHT_EFFECT_KNIGHT +//# define RGBLIGHT_EFFECT_CHRISTMAS +//# define RGBLIGHT_EFFECT_STATIC_GRADIENT +//# define RGBLIGHT_EFFECT_RGB_TEST +//# define RGBLIGHT_EFFECT_ALTERNATING +/*== customize breathing effect ==*/ +/*==== (DEFAULT) use fixed table instead of exp() and sin() ====*/ +//# define RGBLIGHT_BREATHE_TABLE_SIZE 256 // 256(default) or 128 or 64 +/*==== use exp() and sin() ====*/ +//# define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 // 1 to 2.7 +//# define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0 to 255 +//#endif + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCE 5 + +/* define if matrix has ghost (lacks anti-ghosting diodes) */ //#define MATRIX_HAS_GHOST -/* Set 0 if debouncing isn't needed */ -#define DEBOUNCE 5 - /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ -//#define LOCKING_SUPPORT_ENABLE - +#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 useful 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 + /* * Feature disable options * These options are also useful to firmware size reduction. @@ -63,7 +129,11 @@ along with this program. If not, see . //#define NO_ACTION_LAYER //#define NO_ACTION_TAPPING //#define NO_ACTION_ONESHOT -//#define NO_ACTION_MACRO -//#define NO_ACTION_FUNCTION -#endif +/* disable these deprecated features by default */ +#define NO_ACTION_MACRO +#define NO_ACTION_FUNCTION + +/* Bootmagic Lite key configuration */ +//#define BOOTMAGIC_LITE_ROW 0 +//#define BOOTMAGIC_LITE_COLUMN 0 diff --git a/keyboards/jm60/info.json b/keyboards/jm60/info.json new file mode 100644 index 000000000..2cc2ce4e3 --- /dev/null +++ b/keyboards/jm60/info.json @@ -0,0 +1,78 @@ +{ + "keyboard_name": "JM60", + "url": "", + "maintainer": "qmk", + "width": 15, + "height": 5, + "layouts": { + "LAYOUT_60_ansi": { + "layout": [ + {"x": 0, "y": 0}, + {"x": 1, "y": 0}, + {"x": 2, "y": 0}, + {"x": 3, "y": 0}, + {"x": 4, "y": 0}, + {"x": 5, "y": 0}, + {"x": 6, "y": 0}, + {"x": 7, "y": 0}, + {"x": 8, "y": 0}, + {"x": 9, "y": 0}, + {"x": 10, "y": 0}, + {"x": 11, "y": 0}, + {"x": 12, "y": 0}, + {"x": 13, "y": 0, "w": 2}, + + {"x": 0, "y": 1, "w": 1.5}, + {"x": 1.5, "y": 1}, + {"x": 2.5, "y": 1}, + {"x": 3.5, "y": 1}, + {"x": 4.5, "y": 1}, + {"x": 5.5, "y": 1}, + {"x": 6.5, "y": 1}, + {"x": 7.5, "y": 1}, + {"x": 8.5, "y": 1}, + {"x": 9.5, "y": 1}, + {"x": 10.5, "y": 1}, + {"x": 11.5, "y": 1}, + {"x": 12.5, "y": 1}, + {"x": 13.5, "y": 1, "w": 1.5}, + + {"x": 0, "y": 2, "w": 1.75}, + {"x": 1.75, "y": 2}, + {"x": 2.75, "y": 2}, + {"x": 3.75, "y": 2}, + {"x": 4.75, "y": 2}, + {"x": 5.75, "y": 2}, + {"x": 6.75, "y": 2}, + {"x": 7.75, "y": 2}, + {"x": 8.75, "y": 2}, + {"x": 9.75, "y": 2}, + {"x": 10.75, "y": 2}, + {"x": 11.75, "y": 2}, + {"x": 12.75, "y": 2, "w": 2.25}, + + {"x": 0, "y": 3, "w": 2.25}, + {"x": 2.25, "y": 3}, + {"x": 3.25, "y": 3}, + {"x": 4.25, "y": 3}, + {"x": 5.25, "y": 3}, + {"x": 6.25, "y": 3}, + {"x": 7.25, "y": 3}, + {"x": 8.25, "y": 3}, + {"x": 9.25, "y": 3}, + {"x": 10.25, "y": 3}, + {"x": 11.25, "y": 3}, + {"x": 12.25, "y": 3, "w": 2.75}, + + {"x": 0, "y": 4, "w": 1.25}, + {"x": 1.25, "y": 4, "w": 1.25}, + {"x": 2.5, "y": 4, "w": 1.25}, + {"x": 3.75, "y": 4, "w": 6.25}, + {"x": 10, "y": 4, "w": 1.25}, + {"x": 11.25, "y": 4, "w": 1.25}, + {"x": 12.5, "y": 4, "w": 1.25}, + {"x": 13.75, "y": 4, "w": 1.25} + ] + } + } +} diff --git a/keyboards/jm60/jm60.c b/keyboards/jm60/jm60.c index 3c8b43db9..d8fe9cecc 100644 --- a/keyboards/jm60/jm60.c +++ b/keyboards/jm60/jm60.c @@ -14,4 +14,5 @@ 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 QMK_KEYBOARD_H + +#include "jm60.h" diff --git a/keyboards/jm60/jm60.h b/keyboards/jm60/jm60.h index f83b94f90..bea4451a0 100644 --- a/keyboards/jm60/jm60.h +++ b/keyboards/jm60/jm60.h @@ -14,40 +14,23 @@ 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 JM60_H -#define JM60_H + +#pragma once #include "quantum.h" -// readability #define XXX KC_NO -/* Satan GH60 ANSI layout - * ,-----------------------------------------------------------. - * | 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| 1d | - * |-----------------------------------------------------------| - * | 20 | 21| 22| 23| 24| 25| 26| 27| 28| 29| 2a| 2c| 2d | - * |-----------------------------------------------------------| - * | 30 | 31| 32| 33| 34| 35| 36| 37| 38| 39| 3b| 3d | - * |-----------------------------------------------------------| - * | 40 | 41 | 42 | 46 | 4a | 4b | 4c | 4d | - * `-----------------------------------------------------------' - */ -#define KEYMAP_ANSI( \ - k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0d, \ - k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1d, \ - k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2c, k2d, \ - k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3b, k3d, \ - k40, k41, k42, k46, k4a, k4b, k4c, k4d \ -) \ -{ \ - {k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0d}, \ - {k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1d}, \ - {k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, XXX, k2c, k2d}, \ - {k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, XXX, k3b, XXX, k3d}, \ - {k40, k41, k42, XXX, XXX, XXX, k46, XXX, XXX, XXX, k4a, k4b, k4c, k4d} \ +#define LAYOUT_60_ansi( \ + k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D, \ + k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, \ + k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2C, k2D, \ + k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3B, k3D, \ + k40, k41, k42, k46, k4A, k4B, k4C, k4D \ +) { \ + { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D }, \ + { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D }, \ + { k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, XXX, k2C, k2D }, \ + { k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, XXX, k3B, XXX, k3D }, \ + { k40, k41, k42, XXX, XXX, XXX, k46, XXX, XXX, XXX, k4A, k4B, k4C, k4D } \ } - -#endif diff --git a/keyboards/jm60/keymaps/default/keymap.c b/keyboards/jm60/keymaps/default/keymap.c index 6ca04c505..0940d7efc 100644 --- a/keyboards/jm60/keymaps/default/keymap.c +++ b/keyboards/jm60/keymaps/default/keymap.c @@ -1,44 +1,39 @@ #include QMK_KEYBOARD_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 - -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| [| ]| \ | - * |-----------------------------------------------------------| - * |CAPS | A| S| D| F| G| H| J| K| L| ;| '|Return | - * |-----------------------------------------------------------| - * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | - * |-----------------------------------------------------------| - * |Ctrl|Gui |Alt | Space |Alt |Gui |FN |Ctrl | - * `-----------------------------------------------------------' - */ -[_BL] = KEYMAP_ANSI( - 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_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_LCTL, KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI, MO(_FL),KC_RCTL), - - /* Keymap _FL: Function Layer - */ -[_FL] = KEYMAP_ANSI( - KC_GRV, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,RESET, \ - _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, BL_DEC, BL_INC,BL_TOGG, \ - _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, \ - _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, \ - _______,_______,_______, _______, _______,_______,_______,_______), +enum layer_names { + _BL, + _FL }; +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| [| ]| \ | + * |-----------------------------------------------------------| + * |CAPS | A| S| D| F| G| H| J| K| L| ;| '|Return | + * |-----------------------------------------------------------| + * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | + * |-----------------------------------------------------------| + * |Ctrl|Gui |Alt | Space |Alt |Gui |FN |Ctrl | + * `-----------------------------------------------------------' + */ + [_BL] = LAYOUT_60_ansi( + 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_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_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, MO(_FL), KC_RCTL + ), + + /* Keymap _FL: Function Layer + */ + [_FL] = LAYOUT_60_ansi( + KC_GRV, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RESET, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, BL_DEC, BL_INC, BL_TOGG, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______ + ) +}; diff --git a/keyboards/jm60/keymaps/poker3/keymap.c b/keyboards/jm60/keymaps/poker3/keymap.c index 07f432dcd..72e64bbcc 100644 --- a/keyboards/jm60/keymaps/poker3/keymap.c +++ b/keyboards/jm60/keymaps/poker3/keymap.c @@ -1,31 +1,24 @@ #include QMK_KEYBOARD_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 +enum layer_names { + _BL, + _FL +}; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - /* Keymap _BL: (Base Layer) Default Layer - */ -[_BL] = KEYMAP_ANSI( - 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_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, \ - 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_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_RSFT, \ - KC_LCTL, KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI, MO(_FL),KC_RCTL), + [_BL] = LAYOUT_60_ansi( + 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_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, + 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_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, MO(_FL), KC_RCTL + ), - /* Keymap _FL: Function Layer - */ -[_FL] = KEYMAP_ANSI( - 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_MPRV,KC_MPLY,KC_MNXT,_______,_______,_______,KC_PGUP,KC_UP,KC_PGDN,KC_PSCR, KC_SLCK, KC_PAUS,_______, \ - KC_CAPS,_______,KC_VOLD,KC_VOLU,KC_MUTE,_______,KC_HOME,KC_LEFT,KC_DOWN,KC_RGHT,KC_INS,KC_DEL,_______, \ - _______,KC_APP,_______,_______,_______,_______,KC_END,_______,_______,_______,_______,_______, \ - _______,_______,_______, _______, _______,_______,_______,_______), + [_FL] = LAYOUT_60_ansi( + 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_MPRV, KC_MPLY, KC_MNXT, _______, _______, _______, KC_PGUP, KC_UP, KC_PGDN, KC_PSCR, KC_SLCK, KC_PAUS, _______, + KC_CAPS, _______, KC_VOLD, KC_VOLU, KC_MUTE, _______, KC_HOME, KC_LEFT, KC_DOWN, KC_RGHT, KC_INS, KC_DEL, _______, + _______, KC_APP, _______, _______, _______, _______, KC_END, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______ + ) }; diff --git a/keyboards/jm60/led.c b/keyboards/jm60/led.c deleted file mode 100644 index 4ce0b3e26..000000000 --- a/keyboards/jm60/led.c +++ /dev/null @@ -1,24 +0,0 @@ -/* -Copyright 2012 Jun Wako - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#include - -#include "led.h" - - -void led_set(uint8_t usb_led) { -} diff --git a/keyboards/jm60/matrix.c b/keyboards/jm60/matrix.c deleted file mode 100644 index e19d4f02b..000000000 --- a/keyboards/jm60/matrix.c +++ /dev/null @@ -1,128 +0,0 @@ -#include -#include -#include -#include -#include "timer.h" -#include "wait.h" -#include "print.h" -#include "matrix.h" - - -/* - * JM60 - * Column pins are input with internal pull-down. Row pins are output and strobe with high. - * Key is high or 1 when it turns on. - * - * col: { PTA15, PTC10, PTC11, PTC12, PTD2, PTB3, PTB4, PTB5, PTB6, PTB7, PTB8, PTB9, PTA2, PTA3 } - * row: { PTB11, PTB10, PTB2, PTB1, PTB0} - */ -/* matrix state(1:on, 0:off) */ -static matrix_row_t matrix[MATRIX_ROWS]; -static matrix_row_t matrix_debouncing[MATRIX_ROWS]; -static bool debouncing = false; -static uint16_t debouncing_time = 0; - - -void matrix_init(void) -{ -//debug_matrix = true; - /* Column(sense) */ - palSetPadMode(GPIOA, 15, PAL_MODE_INPUT_PULLDOWN); - palSetPadMode(GPIOC, 10, PAL_MODE_INPUT_PULLDOWN); - palSetPadMode(GPIOC, 11, PAL_MODE_INPUT_PULLDOWN); - palSetPadMode(GPIOC, 12, PAL_MODE_INPUT_PULLDOWN); - palSetPadMode(GPIOD, 2, PAL_MODE_INPUT_PULLDOWN); - palSetPadMode(GPIOB, 3, PAL_MODE_INPUT_PULLDOWN); - palSetPadMode(GPIOB, 4, PAL_MODE_INPUT_PULLDOWN); - palSetPadMode(GPIOB, 5, PAL_MODE_INPUT_PULLDOWN); - palSetPadMode(GPIOB, 6, PAL_MODE_INPUT_PULLDOWN); - palSetPadMode(GPIOB, 7, PAL_MODE_INPUT_PULLDOWN); - palSetPadMode(GPIOB, 8, PAL_MODE_INPUT_PULLDOWN); - palSetPadMode(GPIOB, 9, PAL_MODE_INPUT_PULLDOWN); - palSetPadMode(GPIOA, 2, PAL_MODE_INPUT_PULLDOWN); - palSetPadMode(GPIOA, 3, PAL_MODE_INPUT_PULLDOWN); - - /* Row(strobe) */ - palSetPadMode(GPIOB, 11, PAL_MODE_OUTPUT_PUSHPULL); - palSetPadMode(GPIOB, 10, PAL_MODE_OUTPUT_PUSHPULL); - palSetPadMode(GPIOB, 2, PAL_MODE_OUTPUT_PUSHPULL); - palSetPadMode(GPIOB, 1, PAL_MODE_OUTPUT_PUSHPULL); - palSetPadMode(GPIOB, 0, PAL_MODE_OUTPUT_PUSHPULL); - - memset(matrix, 0, MATRIX_ROWS * sizeof(matrix_row_t)); - memset(matrix_debouncing, 0, MATRIX_ROWS * sizeof(matrix_row_t)); -} - -uint8_t matrix_scan(void) -{ - for (int row = 0; row < MATRIX_ROWS; row++) { - matrix_row_t data = 0; - - // strobe row - switch (row) { - case 0: palSetPad(GPIOB, 11); break; - case 1: palSetPad(GPIOB, 10); break; - case 2: palSetPad(GPIOB, 2); break; - case 3: palSetPad(GPIOB, 1); break; - case 4: palSetPad(GPIOB, 0); break; - } - - wait_us(20); // need wait to settle pin state - - // read col data: { PTA15, PTC10, PTC11, PTC12, PTD2, PTB3, PTB4, PTB5, PTB6, PTB7, PTB8, PTB9, PTA2, PTA3 } - data = ((palReadPort(GPIOA) & 0x8000UL) >> 15) | // 0 - ((palReadPort(GPIOC) & 0x1C00UL) >> 9) | // 1, 2, 3 - ((palReadPort(GPIOD) & 0x0004UL) << 2) | // 4 - ((palReadPort(GPIOB) & 0x03F8UL) << 2) | // 5, 6, 7, 8, 9, 10, 11 - ((palReadPort(GPIOA) & 0x000CUL) << 10); // 12, 13 - - // un-strobe row - switch (row) { - case 0: palClearPad(GPIOB, 11); break; - case 1: palClearPad(GPIOB, 10); break; - case 2: palClearPad(GPIOB, 2); break; - case 3: palClearPad(GPIOB, 1); break; - case 4: palClearPad(GPIOB, 0); break; - } - - if (matrix_debouncing[row] != data) { - matrix_debouncing[row] = data; - debouncing = true; - debouncing_time = timer_read(); - } - } - - if (debouncing && timer_elapsed(debouncing_time) > DEBOUNCE) { - for (int row = 0; row < MATRIX_ROWS; row++) { - matrix[row] = matrix_debouncing[row]; - } - debouncing = false; - } - return 1; -} - -bool matrix_is_on(uint8_t row, uint8_t col) -{ - return (matrix[row] & (1<