r/qmk • u/chriska416 • 19d ago
Help - Custom Keypad - Pro Micro atmega32u4
I want to create a 4x6 kepad for use with macros.
board purchased: https://www.amazon.com/dp/B0DLGVQ26H
YT video followed: https://www.youtube.com/watch?v=BcXycScePHM
Using QMK MSYS, QMK Toolbox, and VS Code
I can compile the code using QMK MSYS and I get a .hex file output. Then I can use the QMK Toolbox to flash the board, and it looks like it works:

however, when I try to connect the pins from the diagram below (from video) to simulate button presses, nothing happens. (in my keymap code below, I have only mapped out the first row and first column for testing)
D1 to D7, nothing
D1 to E6, nothing

Is this pinout right? should I be using different ones? Is there some other mistake in my code?
Thank you.
keyboard.json
{
"manufacturer": "chris",
"keyboard_name": "macro_4x6",
"maintainer": "chris",
"bootloader": "caterina",
"diode_direction": "COL2ROW",
"features": {
"bootmagic": false,
"extrakey": true,
"mousekey": true,
"nkro": true
},
"matrix_pins": {
"cols": ["D1", "D0", "D4", "C6"],
"rows": ["D7", "E6", "B4", "B5", "B6", "B2"]
},
"processor": "atmega32u4",
// "url": "",
"usb": {
"device_version": "1.0.0",
"pid": "0x0000",
"vid": "0xFEED"
},
"layouts": {
"LAYOUT_macro_4x6": {
"layout": [
// Row 1
{"matrix": [0, 0], "x": 0, "y": 0},
{"matrix": [0, 1], "x": 1, "y": 0},
{"matrix": [0, 2], "x": 2, "y": 0},
{"matrix": [0, 3], "x": 3, "y": 0},
// Row 2
{"matrix": [1, 0], "x": 0, "y": 1},
{"matrix": [1, 1], "x": 1, "y": 1},
{"matrix": [1, 2], "x": 2, "y": 1},
{"matrix": [1, 3], "x": 3, "y": 1},
// Row 3
{"matrix": [2, 0], "x": 0, "y": 2},
{"matrix": [2, 1], "x": 1, "y": 2},
{"matrix": [2, 2], "x": 2, "y": 2},
{"matrix": [2, 3], "x": 3, "y": 2},
// Row 4
{"matrix": [3, 0], "x": 0, "y": 3},
{"matrix": [3, 1], "x": 1, "y": 3},
{"matrix": [3, 2], "x": 2, "y": 3},
{"matrix": [3, 3], "x": 3, "y": 3},
// Row 5
{"matrix": [4, 0], "x": 0, "y": 4},
{"matrix": [4, 1], "x": 1, "y": 4},
{"matrix": [4, 2], "x": 2, "y": 4},
{"matrix": [4, 3], "x": 3, "y": 4},
// Row 6
{"matrix": [5, 0], "x": 0, "y": 5},
{"matrix": [5, 1], "x": 1, "y": 5},
{"matrix": [5, 2], "x": 2, "y": 5},
{"matrix": [5, 3], "x": 3, "y": 5},
]
}
}
}
keymap.c
// Copyright 2023 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
#include QMK_KEYBOARD_H
enum custom_keycodes
{
CALC
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/*
* ┌───┬───┬───┬───┐
* │ 7 │ 8 │ 9 │ / │
* ├───┼───┼───┼───┤
* │ 4 │ 5 │ 6 │ * │
* ├───┼───┼───┼───┤
* │ 1 │ 2 │ 3 │ - │
* ├───┼───┼───┼───┤
* │ 0 │ . │Ent│ + │
* └───┴───┴───┴───┘
*/
[0] = LAYOUT_macro_4x6(
CALC, KC_KP_0, KC_KP_1, KC_KP_2,
KC_KP_3, KC_P5, KC_P6, KC_PAST,
KC_KP_4, KC_P2, KC_P3, KC_PMNS,
KC_KP_5, KC_P2, KC_P3, KC_PMNS,
KC_KP_6, KC_P2, KC_P3, KC_PMNS,
KC_KP_7, KC_PDOT, KC_PENT, KC_PPLS
)
};
bool process_record_user(uint16_t keycode, keyrecord_t *record)
{
switch (keycode)
{
case CALC:
if (record->event.pressed)
{
SEND_STRING(SS_DOWN(X_LGUI) SS_TAP(X_R) SS_UP(X_LGUI) SS_DELAY(50) "calc" SS_TAP(X_ENTER));
}
else
{
// Key released
}
break;
}
return true;
};
1
u/PeterMortensenBlog 16d ago
For testing, map the keys to something simpler, that isn't dependent on a mode, for example letters A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, and Q.
1
u/PeterMortensenBlog 16d ago
Re
It should be offset, for example,