Skip to content

Commit

Permalink
3x3 matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
arai-ta committed Jun 6, 2021
1 parent 112e97e commit 9090790
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
8 changes: 4 additions & 4 deletions keyboards/sttemtrx/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define PRODUCT sttemtrx

/* key matrix size */
#define MATRIX_ROWS 2
#define MATRIX_COLS 2
#define MATRIX_ROWS 3
#define MATRIX_COLS 3

/*
* Keyboard Matrix Assignments
Expand All @@ -40,8 +40,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
* ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
*
*/
#define MATRIX_ROW_PINS { B2, B6 }
#define MATRIX_COL_PINS { B4, B5 }
#define MATRIX_ROW_PINS { B3, B2, B6 }
#define MATRIX_COL_PINS { E6, B4, B5 }
#define UNUSED_PINS

/* COL2ROW, ROW2COL */
Expand Down
16 changes: 13 additions & 3 deletions keyboards/sttemtrx/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,16 @@ enum layer_names {
// Defines the keycodes used by our macros in process_record_user
enum custom_keycodes {
QMKBEST = SAFE_RANGE,
QMKURL
QMKURL,
ARAINAME
};

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Base */
[_BASE] = LAYOUT(
KC_A, KC_B,
KC_C, KC_D
KC_A, KC_B, KC_C,
KC_1, KC_2, KC_3,
QMKBEST, QMKURL, ARAINAME
)
};

Expand All @@ -52,6 +54,14 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
// when keycode QMKURL is released
}
break;
case ARAINAME:
if (record->event.pressed) {
// when keycode QMKURL is pressed
} else {
// when keycode QMKURL is released
SEND_STRING("ARAI Takashi\n");
}
break;
}
return true;
}
10 changes: 6 additions & 4 deletions keyboards/sttemtrx/sttemtrx.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@
* represents the switch matrix.
*/
#define LAYOUT( \
k00, k01, \
k10, k11 \
k00, k01, k02, \
k10, k11, k12, \
k20, k21, k22 \
) { \
{ k00, k01 }, \
{ k10, k11 } \
{ k00, k01, k02 }, \
{ k10, k11, k12 }, \
{ k20, k21, k22 } \
}

0 comments on commit 9090790

Please sign in to comment.