Skip to content

Commit

Permalink
Merge pull request qmk#17 from lalalademaxiya1/playground
Browse files Browse the repository at this point in the history
Update matrix.c and slightly trim some code formats.
  • Loading branch information
KeychronMacro authored Feb 9, 2022
2 parents 06260b9 + 809dac5 commit 56e090f
Show file tree
Hide file tree
Showing 27 changed files with 535 additions and 694 deletions.
3 changes: 3 additions & 0 deletions keyboards/keychron/q2/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
#define MATRIX_COL_PINS \
{ C14, C15, A0, A1, A2, A3, A4, A5, A6, A7, B0, B1, A8, A9, H3 }

/* We make pin H3 with a stronger pull resistor than the internal MCU pins */
#define MATRIX_UNSELECT_DRIVE_HIGH

/* Set 0 if debouncing isn't needed */
#define DEBOUNCE 5

Expand Down
139 changes: 0 additions & 139 deletions keyboards/keychron/q2/matrix.c

This file was deleted.

43 changes: 21 additions & 22 deletions keyboards/keychron/q2/q2_ansi_stm32l432/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,21 @@
"layouts": {
"LAYOUT_ansi_67": {
"layout": [
{"label":"Insert", "x":15.25, "y":0},

{"label":"Esc", "x":0, "y":0.25},
{"label":"!", "x":1, "y":0.25},
{"label":"@", "x":2, "y":0.25},
{"label":"", "x":3, "y":0.25},
{"label":"$", "x":4, "y":0.25},
{"label":"%", "x":5, "y":0.25},
{"label":"^", "x":6, "y":0.25},
{"label":"&", "x":7, "y":0.25},
{"label":"*", "x":8, "y":0.25},
{"label":"(", "x":9, "y":0.25},
{"label":")", "x":10, "y":0.25},
{"label":"_", "x":11, "y":0.25},
{"label":"+", "x":12, "y":0.25},
{"label":"1!", "x":1, "y":0.25},
{"label":"2@", "x":2, "y":0.25},
{"label":"3#", "x":3, "y":0.25},
{"label":"4$", "x":4, "y":0.25},
{"label":"5%", "x":5, "y":0.25},
{"label":"6^", "x":6, "y":0.25},
{"label":"7&", "x":7, "y":0.25},
{"label":"8*", "x":8, "y":0.25},
{"label":"9(", "x":9, "y":0.25},
{"label":"0)", "x":10, "y":0.25},
{"label":"-_", "x":11, "y":0.25},
{"label":"=+", "x":12, "y":0.25},
{"label":"Backspace", "x":13, "y":0.25, "w":2},
{"label":"Mute", "x":15.25, "y":0},

{"label":"Tab", "x":0, "y":1.25, "w":1.5},
{"label":"Q", "x":1.5, "y":1.25},
Expand All @@ -33,9 +32,9 @@
{"label":"I", "x":8.5, "y":1.25},
{"label":"O", "x":9.5, "y":1.25},
{"label":"P", "x":10.5, "y":1.25},
{"label":"{", "x":11.5, "y":1.25},
{"label":"}", "x":12.5, "y":1.25},
{"label":"|", "x":13.5, "y":1.25, "w":1.5},
{"label":"[{", "x":11.5, "y":1.25},
{"label":"]}", "x":12.5, "y":1.25},
{"label":"\\|", "x":13.5, "y":1.25, "w":1.5},
{"label":"Delete", "x":15.25, "y":1.25},

{"label":"Caps Lock", "x":0, "y":2.25, "w":1.75},
Expand All @@ -48,8 +47,8 @@
{"label":"J", "x":7.75, "y":2.25},
{"label":"K", "x":8.75, "y":2.25},
{"label":"L", "x":9.75, "y":2.25},
{"label":":", "x":10.75, "y":2.25},
{"label":"\"", "x":11.75, "y":2.25},
{"label":";:", "x":10.75, "y":2.25},
{"label":"'\"", "x":11.75, "y":2.25},
{"label":"Enter", "x":12.75, "y":2.25, "w":2.25},
{"label":"Home", "x":15.25, "y":2.25},

Expand All @@ -61,9 +60,9 @@
{"label":"B", "x":6.25, "y":3.25},
{"label":"N", "x":7.25, "y":3.25},
{"label":"M", "x":8.25, "y":3.25},
{"label":"<", "x":9.25, "y":3.25},
{"label":">", "x":10.25, "y":3.25},
{"label":"?", "x":11.25, "y":3.25},
{"label":",<", "x":9.25, "y":3.25},
{"label":".>", "x":10.25, "y":3.25},
{"label":"/?", "x":11.25, "y":3.25},
{"label":"Shift", "x":12.25, "y":3.25, "w":1.75},
{"label":"Up", "x":14.25, "y":3.5},

Expand Down
32 changes: 16 additions & 16 deletions keyboards/keychron/q2/q2_ansi_stm32l432/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ enum layers{
enum custom_keycodes {
KC_MISSION_CONTROL = USER_START,
KC_LAUNCHPAD,
KC_TASK_VIEW,
KC_FILE_EXPLORER,
KC_LOPTN,
KC_ROPTN,
KC_LCMMD,
KC_RCMMD
KC_RCMMD,
KC_TASK_VIEW,
KC_FILE_EXPLORER
};

#define KC_WAVE S(KC_GRV)
Expand Down Expand Up @@ -98,30 +98,30 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case KC_LOPTN:
case KC_ROPTN:
case KC_LCMMD:
case KC_RCMMD:
if (record->event.pressed) {
register_code(mac_keycode[keycode - KC_LOPTN]);
} else {
unregister_code(mac_keycode[keycode - KC_LOPTN]);
}
return false;
case KC_MCTL:
case KC_MISSION_CONTROL:
if (record->event.pressed) {
host_consumer_send(0x29F);
} else {
host_consumer_send(0);
}
return false; // Skip all further processing of this key
case KC_LPAD:
case KC_LAUNCHPAD:
if (record->event.pressed) {
host_consumer_send(0x2A0);
} else {
host_consumer_send(0);
}
return false; // Skip all further processing of this key
case KC_LOPTN:
case KC_ROPTN:
case KC_LCMMD:
case KC_RCMMD:
if (record->event.pressed) {
register_code(mac_keycode[keycode - KC_LOPTN]);
} else {
unregister_code(mac_keycode[keycode - KC_LOPTN]);
}
return false; // Skip all further processing of this key
case KC_TASK:
case KC_FLXP:
if (record->event.pressed) {
Expand All @@ -135,6 +135,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
return false; // Skip all further processing of this key
default:
return true; // Process all other keycodes normally
return true; // Process all other keycodes normally
}
}
32 changes: 16 additions & 16 deletions keyboards/keychron/q2/q2_ansi_stm32l432/keymaps/via/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ enum layers{
enum custom_keycodes {
KC_MISSION_CONTROL = USER_START,
KC_LAUNCHPAD,
KC_TASK_VIEW,
KC_FILE_EXPLORER,
KC_LOPTN,
KC_ROPTN,
KC_LCMMD,
KC_RCMMD
KC_RCMMD,
KC_TASK_VIEW,
KC_FILE_EXPLORER
};

#define KC_WAVE S(KC_GRV)
Expand Down Expand Up @@ -98,30 +98,30 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case KC_LOPTN:
case KC_ROPTN:
case KC_LCMMD:
case KC_RCMMD:
if (record->event.pressed) {
register_code(mac_keycode[keycode - KC_LOPTN]);
} else {
unregister_code(mac_keycode[keycode - KC_LOPTN]);
}
return false;
case KC_MCTL:
case KC_MISSION_CONTROL:
if (record->event.pressed) {
host_consumer_send(0x29F);
} else {
host_consumer_send(0);
}
return false; // Skip all further processing of this key
case KC_LPAD:
case KC_LAUNCHPAD:
if (record->event.pressed) {
host_consumer_send(0x2A0);
} else {
host_consumer_send(0);
}
return false; // Skip all further processing of this key
case KC_LOPTN:
case KC_ROPTN:
case KC_LCMMD:
case KC_RCMMD:
if (record->event.pressed) {
register_code(mac_keycode[keycode - KC_LOPTN]);
} else {
unregister_code(mac_keycode[keycode - KC_LOPTN]);
}
return false; // Skip all further processing of this key
case KC_TASK:
case KC_FLXP:
if (record->event.pressed) {
Expand All @@ -135,6 +135,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
return false; // Skip all further processing of this key
default:
return true; // Process all other keycodes normally
return true; // Process all other keycodes normally
}
}
5 changes: 0 additions & 5 deletions keyboards/keychron/q2/q2_ansi_stm32l432/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,3 @@ RGB_MATRIX_DRIVER = CKLED2001

# Enter lower-power sleep mode when on the ChibiOS idle thread
OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE

# custom matrix setup
CUSTOM_MATRIX = lite

SRC += matrix.c
Loading

0 comments on commit 56e090f

Please sign in to comment.