[Keyboard] JM60 refactor (#11421)
parent
581368596e
commit
985b8cab7c
@ -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} |
||||||
|
] |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -1,31 +1,24 @@ |
|||||||
#include QMK_KEYBOARD_H |
#include QMK_KEYBOARD_H |
||||||
|
|
||||||
// Used for SHIFT_ESC
|
enum layer_names { |
||||||
#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)) |
_BL, |
||||||
|
_FL |
||||||
// 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] = { |
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
||||||
/* Keymap _BL: (Base Layer) Default Layer
|
[_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, |
||||||
[_BL] = KEYMAP_ANSI( |
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_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, \
|
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_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_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, |
||||||
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_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, MO(_FL), KC_RCTL |
||||||
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, 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, |
||||||
[_FL] = KEYMAP_ANSI( |
_______, KC_MPRV, KC_MPLY, KC_MNXT, _______, _______, _______, KC_PGUP, KC_UP, KC_PGDN, KC_PSCR, KC_SLCK, KC_PAUS, _______, |
||||||
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_CAPS, _______, KC_VOLD, KC_VOLU, KC_MUTE, _______, KC_HOME, KC_LEFT, KC_DOWN, KC_RGHT, KC_INS, KC_DEL, _______, |
||||||
_______,KC_MPRV,KC_MPLY,KC_MNXT,_______,_______,_______,KC_PGUP,KC_UP,KC_PGDN,KC_PSCR, KC_SLCK, KC_PAUS,_______, \
|
_______, KC_APP, _______, _______, _______, _______, KC_END, _______, _______, _______, _______, _______, |
||||||
KC_CAPS,_______,KC_VOLD,KC_VOLU,KC_MUTE,_______,KC_HOME,KC_LEFT,KC_DOWN,KC_RGHT,KC_INS,KC_DEL,_______, \
|
_______, _______, _______, _______, _______, _______, _______, _______ |
||||||
_______,KC_APP,_______,_______,_______,_______,KC_END,_______,_______,_______,_______,_______, \
|
) |
||||||
_______,_______,_______, _______, _______,_______,_______,_______), |
|
||||||
}; |
}; |
||||||
|
@ -1,24 +0,0 @@ |
|||||||
/*
|
|
||||||
Copyright 2012 Jun Wako <wakojun@gmail.com> |
|
||||||
|
|
||||||
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 <http://www.gnu.org/licenses/>.
|
|
||||||
*/ |
|
||||||
|
|
||||||
#include <hal.h> |
|
||||||
|
|
||||||
#include "led.h" |
|
||||||
|
|
||||||
|
|
||||||
void led_set(uint8_t usb_led) { |
|
||||||
} |
|
@ -1,128 +0,0 @@ |
|||||||
#include <stdint.h> |
|
||||||
#include <stdbool.h> |
|
||||||
#include <string.h> |
|
||||||
#include <hal.h> |
|
||||||
#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<<col)); |
|
||||||
} |
|
||||||
|
|
||||||
matrix_row_t matrix_get_row(uint8_t row) |
|
||||||
{ |
|
||||||
return matrix[row]; |
|
||||||
} |
|
||||||
|
|
||||||
void matrix_print(void) |
|
||||||
{ |
|
||||||
xprintf("\nr/c 01234567\n"); |
|
||||||
for (uint8_t row = 0; row < MATRIX_ROWS; row++) { |
|
||||||
xprintf("%X0: ", row); |
|
||||||
matrix_row_t data = matrix_get_row(row); |
|
||||||
for (int col = 0; col < MATRIX_COLS; col++) { |
|
||||||
if (data & (1<<col)) |
|
||||||
xprintf("1"); |
|
||||||
else |
|
||||||
xprintf("0"); |
|
||||||
} |
|
||||||
xprintf("\n"); |
|
||||||
} |
|
||||||
} |
|
@ -1,27 +1,21 @@ |
|||||||
JM60 |
# JM60 |
||||||
======== |
|
||||||
|
|
||||||
A compact 60% keyboard with full RGB led support. |
A compact 60% keyboard with full RGB led support. |
||||||
|
|
||||||
Keyboard Maintainer: QMK Community |
* Keyboard Maintainer: QMK Community |
||||||
Hardware Supported: JM60 |
* Hardware Supported: JM60 |
||||||
Hardware Availability: https://kbdfans.myshopify.com/ (is no longer sold) |
* Hardware Availability: https://kbdfans.myshopify.com/ (is no longer sold) |
||||||
|
|
||||||
Make example for this keyboard (after setting up your build environment): |
Make example for this keyboard (after setting up your build environment): |
||||||
|
|
||||||
make jm60:default:bin |
make jm60:default |
||||||
|
|
||||||
See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. |
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). |
||||||
|
|
||||||
## Flashing Instructions |
## Flashing Instructions |
||||||
|
|
||||||
1) from the `qmk_firmware` directory run: |
1) rename 'jm60_default.bin' to 'jm60_default.firmware' |
||||||
``` |
|
||||||
$ make jm60:default:bin |
|
||||||
``` |
|
||||||
|
|
||||||
2) rename 'jm60_default.bin' to 'jm60_default.firmware' |
2) Press 'R' and reconnect the keyboard. |
||||||
|
|
||||||
3) Press 'R' and reconnect the keyboard. |
3) Start the original Configuration Tool and flash 'jm60_default.bin' |
||||||
|
|
||||||
4) Start the original Configuration Tool and flash 'jm60_default.bin' |
|
||||||
|
Loading…
Reference in new issue