forked from mirrors/qmk_firmware
updated matrix and keymap
This commit is contained in:
parent
78ea99d154
commit
fc91bf4a65
8 changed files with 79 additions and 127 deletions
|
@ -29,17 +29,19 @@
|
|||
/* The fully-featured KEYMAP() that has every single key available in the matrix.
|
||||
*/
|
||||
#define KEYMAP(\
|
||||
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0d, k0e, \
|
||||
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1e, \
|
||||
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, k2e, \
|
||||
k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, k3e, \
|
||||
k40, k41, k42, k47, k4a, k4b, k4c, k4e \
|
||||
k00, k01, k02, k03, k04, k05, k06, \
|
||||
k10, k11, k12, k13, k14, k15, k16, \
|
||||
k20, k21, k22, k23, k24, k25, k26, \
|
||||
k31, k32, k33, k34, k35, k36, \
|
||||
k42, k43, k44, k45, k46, \
|
||||
k50, k51, k52 \
|
||||
) { \
|
||||
{ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0d, k0e, }, \
|
||||
{ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, KC_NO, k1e, }, \
|
||||
{ k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, KC_NO, k2e, }, \
|
||||
{ k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, KC_NO, k3e, }, \
|
||||
{ k40, k41, k42, KC_NO, KC_NO, KC_NO, KC_NO, k47, KC_NO, KC_NO, k4a, k4b, k4c, KC_NO, k4e, }, \
|
||||
{ k00, k01, k02, k03, k04, k05, k06 }, \
|
||||
{ k10, k11, k12, k13, k14, k15, k16 }, \
|
||||
{ k20, k21, k22, k23, k24, k25, k26 }, \
|
||||
{ 0, k31, k32, k33, k34, k35, k36 }, \
|
||||
{ 0, 0, k42, k43, k44, k45, k46 }, \
|
||||
{ k50, k51, k52, 0, 0, 0, 0 } \
|
||||
}
|
||||
|
||||
#endif
|
|
@ -19,8 +19,8 @@
|
|||
#define CONFIG_H
|
||||
|
||||
/* USB Device descriptor parameter */
|
||||
#define VENDOR_ID 0xC1ED
|
||||
#define PRODUCT_ID 0x2350
|
||||
#define VENDOR_ID 0x125A
|
||||
#define PRODUCT_ID 0x1770
|
||||
#define DEVICE_VER 0x0001
|
||||
#define MANUFACTURER "QMK"
|
||||
#define USBSTR_MANUFACTURER 'Q', '\x00', 'M', '\x00', 'K', '\x00'
|
||||
|
@ -29,8 +29,8 @@
|
|||
#define DESCRIPTION "Handwire protoboard"
|
||||
|
||||
/* key matrix size */
|
||||
#define MATRIX_ROWS 5
|
||||
#define MATRIX_COLS 15
|
||||
#define MATRIX_ROWS 6
|
||||
#define MATRIX_COLS 7
|
||||
|
||||
/*
|
||||
* Keyboard Matrix Assignments
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
* @brief Enables the I2C subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_I2C) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_I2C FALSE
|
||||
#define HAL_USE_I2C TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
|
@ -33,37 +33,14 @@ enum custom_keycodes {
|
|||
#endif
|
||||
|
||||
const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
/* Layer 0: Default Layer
|
||||
* ,-----------------------------------------------------------.
|
||||
* |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| `|BSp|
|
||||
* |-----------------------------------------------------------|
|
||||
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \|
|
||||
* |-----------------------------------------------------------|
|
||||
* |Contro| A| S| D| F| G| H| J| K| L| ;| '|Enter |
|
||||
* |-----------------------------------------------------------|
|
||||
* |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift |Fn0|
|
||||
* |-----------------------------------------------------------'
|
||||
* |Ctrl |Gui|Alt | Space |Alt |Gui|Fn |Ctrl |
|
||||
* `-----------------------------------------------------------'
|
||||
*/
|
||||
[_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,\
|
||||
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_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_RSFT, KC_BSLS, \
|
||||
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, MO(_FL), KC_RCTL),
|
||||
[_FL] = 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, _______,_______,\
|
||||
_______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, \
|
||||
_______, _______,MO(_CL),_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, \
|
||||
_______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, _______, \
|
||||
_______,_______,_______, _______, _______, _______, MO(_FL), _______),
|
||||
[_CL] = KEYMAP(
|
||||
BL_STEP,S_BSKTC,S_ODEJY,S_RCKBY,S_DOEDR,S_SCALE,S_ONEUP,S_COIN, S_SONIC,S_ZELDA,_______,_______,_______,_______,_______,\
|
||||
_______, _______,_______,_______,RESET, _______,_______,_______,_______,_______,_______,_______,_______,_______, \
|
||||
_______, _______,MO(_CL),_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, \
|
||||
_______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, MO(_FL), _______)
|
||||
[0] = KEYMAP(
|
||||
KC_INS, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
|
||||
KC_PGUP, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_DEL,
|
||||
KC_PGDN, KC_H, KC_J, KC_K, KC_L, KC_COLN, KC_QUOT,
|
||||
KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT,
|
||||
KC_RCTL, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT,
|
||||
MO(2), MO(1), KC_SPC
|
||||
)
|
||||
};
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
void backlight_init_ports(void) {
|
||||
printf("backlight_init_ports()\n");
|
||||
#ifdef BACKLIGHT_ENABLE
|
||||
palSetPadMode(GPIOB, 8, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
palSetPad(GPIOB, 8);
|
||||
// palSetPadMode(GPIOB, 8, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
// palSetPad(GPIOB, 8);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -33,10 +33,10 @@ void backlight_set(uint8_t level) {
|
|||
#ifdef BACKLIGHT_ENABLE
|
||||
if (level == 0) {
|
||||
// Turn backlight off
|
||||
palSetPad(GPIOB, 8);
|
||||
// palSetPad(GPIOB, 8);
|
||||
} else {
|
||||
// Turn backlight on
|
||||
palClearPad(GPIOB, 8);
|
||||
// palClearPad(GPIOB, 8);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -45,9 +45,9 @@ void led_set_kb(uint8_t usb_led) {
|
|||
printf("led_set_kb(%d)\n", usb_led);
|
||||
if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
|
||||
// Turn capslock on
|
||||
palSetPad(GPIOB, 7);
|
||||
// palSetPad(GPIOB, 7);
|
||||
} else {
|
||||
// Turn capslock off
|
||||
palClearPad(GPIOB, 7);
|
||||
// palClearPad(GPIOB, 7);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,12 +15,12 @@
|
|||
* Row pins are output and strobe with high.
|
||||
* Key is high or 1 when it turns on.
|
||||
*
|
||||
* col: { PA2, PA3, PA6, PB14, PB15, PA8, PA9, PA7, PB3, PB4, PC15, PC14, PC13, PB5, PB6 }
|
||||
* row: { PB0, PB1, PB2, PA15, PA10 }
|
||||
* col: { A13, A14, A15, B3, B4, B5, B6 }
|
||||
* row: { B10, B2, B1, B0, A7, A6 }
|
||||
*/
|
||||
/* matrix state(1:on, 0:off) */
|
||||
static matrix_row_t matrix[MATRIX_ROWS];
|
||||
static matrix_row_t matrix_debouncing[MATRIX_COLS];
|
||||
static matrix_row_t matrix_debouncing[MATRIX_ROWS];
|
||||
static bool debouncing = false;
|
||||
static uint16_t debouncing_time = 0;
|
||||
|
||||
|
@ -45,92 +45,69 @@ void matrix_init(void) {
|
|||
//debug_matrix = true;
|
||||
|
||||
/* Column(sense) */
|
||||
palSetPadMode(GPIOA, 2, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
palSetPadMode(GPIOA, 3, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
palSetPadMode(GPIOA, 6, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
palSetPadMode(GPIOB, 14, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
palSetPadMode(GPIOB, 15, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
palSetPadMode(GPIOA, 8, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
palSetPadMode(GPIOA, 9, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
palSetPadMode(GPIOA, 7, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
palSetPadMode(GPIOB, 3, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
palSetPadMode(GPIOB, 4, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
palSetPadMode(GPIOC, 15, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
palSetPadMode(GPIOC, 14, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
palSetPadMode(GPIOC, 13, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
palSetPadMode(GPIOB, 5, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
palSetPadMode(GPIOB, 6, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
palSetPadMode(GPIOA, 13, PAL_MODE_INPUT_PULLDOWN);
|
||||
palSetPadMode(GPIOA, 14, PAL_MODE_INPUT_PULLDOWN);
|
||||
palSetPadMode(GPIOA, 15, 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);
|
||||
|
||||
/* Row(strobe) */
|
||||
palSetPadMode(GPIOB, 0, PAL_MODE_INPUT_PULLDOWN);
|
||||
palSetPadMode(GPIOB, 1, PAL_MODE_INPUT_PULLDOWN);
|
||||
palSetPadMode(GPIOB, 2, PAL_MODE_INPUT_PULLDOWN);
|
||||
palSetPadMode(GPIOA, 15, PAL_MODE_INPUT_PULLDOWN);
|
||||
palSetPadMode(GPIOA, 10, PAL_MODE_INPUT_PULLDOWN);
|
||||
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);
|
||||
palSetPadMode(GPIOA, 7, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
palSetPadMode(GPIOA, 6, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
|
||||
memset(matrix, 0, MATRIX_ROWS * sizeof(matrix_row_t));
|
||||
memset(matrix_debouncing, 0, MATRIX_COLS * sizeof(matrix_row_t));
|
||||
memset(matrix_debouncing, 0, MATRIX_ROWS * sizeof(matrix_row_t));
|
||||
|
||||
palClearPad(GPIOB, 7); // Turn off capslock
|
||||
// palClearPad(GPIOB, 7); // Turn off capslock
|
||||
matrix_init_quantum();
|
||||
}
|
||||
|
||||
uint8_t matrix_scan(void) {
|
||||
for (int col = 0; col < MATRIX_COLS; col++) {
|
||||
for (int row = 0; row < MATRIX_ROWS; row++) {
|
||||
matrix_row_t data = 0;
|
||||
|
||||
// strobe col { PA2, PA3, PA6, PB14, PB15, PA8, PA9, PA7, PB3, PB4, PC14, PC15, PC13, PB5, PB6 }
|
||||
switch (col) {
|
||||
case 0: palSetPad(GPIOA, 2); break;
|
||||
case 1: palSetPad(GPIOA, 3); break;
|
||||
case 2: palSetPad(GPIOA, 6); break;
|
||||
case 3: palSetPad(GPIOB, 14); break;
|
||||
case 4: palSetPad(GPIOB, 15); break;
|
||||
case 5: palSetPad(GPIOA, 8); break;
|
||||
case 6: palSetPad(GPIOA, 9); break;
|
||||
case 7: palSetPad(GPIOA, 7); break;
|
||||
case 8: palSetPad(GPIOB, 3); break;
|
||||
case 9: palSetPad(GPIOB, 4); break;
|
||||
case 10: palSetPad(GPIOC, 15); break;
|
||||
case 11: palSetPad(GPIOC, 14); break;
|
||||
case 12: palSetPad(GPIOC, 13); break;
|
||||
case 13: palSetPad(GPIOB, 5); break;
|
||||
case 14: palSetPad(GPIOB, 6); break;
|
||||
// strobe row { A6, A7, B0, B1, B2, B10 }
|
||||
switch (row) {
|
||||
case 5: palSetPad(GPIOA, 6); break;
|
||||
case 4: palSetPad(GPIOA, 7); break;
|
||||
case 3: palSetPad(GPIOB, 0); break;
|
||||
case 2: palSetPad(GPIOB, 1); break;
|
||||
case 1: palSetPad(GPIOB, 2); break;
|
||||
case 0: palSetPad(GPIOB, 10); break;
|
||||
}
|
||||
|
||||
// need wait to settle pin state
|
||||
wait_us(20);
|
||||
|
||||
// read row data { PB0, PB1, PB2, PA15, PA10 }
|
||||
// read col data { B6, B5, B4, B3, A15, A14, A13 }
|
||||
data = (
|
||||
(palReadPad(GPIOB, 0) << 0 ) |
|
||||
(palReadPad(GPIOB, 1) << 1 ) |
|
||||
(palReadPad(GPIOB, 2) << 2 ) |
|
||||
(palReadPad(GPIOA, 15) << 3 ) |
|
||||
(palReadPad(GPIOA, 10) << 4 )
|
||||
(palReadPad(GPIOB, 6) << 6 ) |
|
||||
(palReadPad(GPIOB, 5) << 5 ) |
|
||||
(palReadPad(GPIOB, 4) << 4 ) |
|
||||
(palReadPad(GPIOB, 3) << 3 ) |
|
||||
(palReadPad(GPIOA, 15) << 2 ) |
|
||||
(palReadPad(GPIOA, 14) << 1 ) |
|
||||
(palReadPad(GPIOA, 13) << 0 )
|
||||
);
|
||||
|
||||
// unstrobe col { PA2, PA3, PA6, PB14, PB15, PA8, PA9, PA7, PB3, PB4, PC15, PC14, PC13, PB5, PB6 }
|
||||
switch (col) {
|
||||
case 0: palClearPad(GPIOA, 2); break;
|
||||
case 1: palClearPad(GPIOA, 3); break;
|
||||
case 2: palClearPad(GPIOA, 6); break;
|
||||
case 3: palClearPad(GPIOB, 14); break;
|
||||
case 4: palClearPad(GPIOB, 15); break;
|
||||
case 5: palClearPad(GPIOA, 8); break;
|
||||
case 6: palClearPad(GPIOA, 9); break;
|
||||
case 7: palClearPad(GPIOA, 7); break;
|
||||
case 8: palClearPad(GPIOB, 3); break;
|
||||
case 9: palClearPad(GPIOB, 4); break;
|
||||
case 10: palClearPad(GPIOC, 15); break;
|
||||
case 11: palClearPad(GPIOC, 14); break;
|
||||
case 12: palClearPad(GPIOC, 13); break;
|
||||
case 13: palClearPad(GPIOB, 5); break;
|
||||
case 14: palClearPad(GPIOB, 6); break;
|
||||
// unstrobe row { A6, A7, B0, B1, B2, B10 }
|
||||
switch (row) {
|
||||
case 5: palClearPad(GPIOA, 6); break;
|
||||
case 4: palClearPad(GPIOA, 7); break;
|
||||
case 3: palClearPad(GPIOB, 0); break;
|
||||
case 2: palClearPad(GPIOB, 1); break;
|
||||
case 1: palClearPad(GPIOB, 2); break;
|
||||
case 0: palClearPad(GPIOB, 10); break;
|
||||
}
|
||||
|
||||
if (matrix_debouncing[col] != data) {
|
||||
matrix_debouncing[col] = data;
|
||||
if (matrix_debouncing[row] != data) {
|
||||
matrix_debouncing[row] = data;
|
||||
debouncing = true;
|
||||
debouncing_time = timer_read();
|
||||
}
|
||||
|
@ -138,14 +115,10 @@ uint8_t matrix_scan(void) {
|
|||
|
||||
if (debouncing && timer_elapsed(debouncing_time) > DEBOUNCE) {
|
||||
for (int row = 0; row < MATRIX_ROWS; row++) {
|
||||
matrix[row] = 0;
|
||||
for (int col = 0; col < MATRIX_COLS; col++) {
|
||||
matrix[row] |= ((matrix_debouncing[col] & (1 << row) ? 1 : 0) << col);
|
||||
}
|
||||
matrix[row] = matrix_debouncing[row];
|
||||
}
|
||||
debouncing = false;
|
||||
}
|
||||
|
||||
matrix_scan_quantum();
|
||||
|
||||
return 1;
|
||||
|
|
|
@ -154,7 +154,7 @@
|
|||
/*
|
||||
* I2C driver system settings.
|
||||
*/
|
||||
#define STM32_I2C_USE_I2C1 FALSE
|
||||
#define STM32_I2C_USE_I2C1 TRUE
|
||||
#define STM32_I2C_USE_I2C2 FALSE
|
||||
#define STM32_I2C_BUSY_TIMEOUT 50
|
||||
#define STM32_I2C_I2C1_IRQ_PRIORITY 10
|
||||
|
|
|
@ -36,7 +36,7 @@ USE_FPU = yes
|
|||
OPT_DEFS =
|
||||
|
||||
# Options to pass to dfu-util when flashing
|
||||
DFU_ARGS = -d 0483:df11 -a 0 -s 0x08000000 -R
|
||||
DFU_ARGS = -d 0483:df11 -a 0 -s 0x08000000:leave
|
||||
|
||||
# Build Options
|
||||
# comment out to disable the options.
|
||||
|
|
Loading…
Reference in a new issue