Compare commits

...

3 Commits

Author SHA1 Message Date
QMK Bot da481f5cc4 Merge remote-tracking branch 'origin/master' into develop 2026-07-06 20:09:23 +00:00
Harry Cutts 7a15cd2482 Add "handwired" TwentyPad macro pad (#26264)
* Add "handwired" TwentyPad macro pad

TwentyPad is 20-key macro pad I created as a hobby project. Its
configuration is based on ez_maker/directpins/teensy_2, with the
bootloader and layout changed.

* Host the image on Imgur

Co-authored-by: Joel Challis <git@zvecr.com>

---------

Co-authored-by: Joel Challis <git@zvecr.com>
2026-07-06 13:08:39 -07:00
Harrison 428b1cd568 Use memmove for overlapping copies in RGB/LED matrix last-hit tracker (#26306)
Use memmove for overlapping copies in RGB/LED matrix last-hit tracker
2026-07-06 12:30:13 -07:00
5 changed files with 102 additions and 8 deletions
@@ -0,0 +1,54 @@
{
"manufacturer": "Harry Cutts",
"keyboard_name": "TwentyPad",
"maintainer": "HarryCutts",
"bootloader": "atmel-dfu",
"features": {
"bootmagic": true,
"extrakey": true,
"mousekey": true
},
"matrix_pins": {
"direct": [
["B7", "D5", "B5", "F6"],
["B3", "D3", "B4", "F7"],
["B2", "D2", "D7", "C7"],
["B1", "D1", "D6", "C6"],
["B0", "D0", "D4", "B6"]
]
},
"processor": "atmega32u4",
"url": "https://github.com/HarryCutts/twentypad/",
"usb": {
"device_version": "1.0.0",
"pid": "0x209D",
"vid": "0xFEED"
},
"community_layouts": ["ortho_5x4"],
"layouts": {
"LAYOUT_ortho_5x4": {
"layout": [
{"label": "B7", "matrix": [0, 0], "x": 0, "y": 0},
{"label": "D5", "matrix": [0, 1], "x": 1, "y": 0},
{"label": "B5", "matrix": [0, 2], "x": 2, "y": 0},
{"label": "F6", "matrix": [0, 3], "x": 3, "y": 0},
{"label": "B3", "matrix": [1, 0], "x": 0, "y": 1},
{"label": "D3", "matrix": [1, 1], "x": 1, "y": 1},
{"label": "B4", "matrix": [1, 2], "x": 2, "y": 1},
{"label": "F7", "matrix": [1, 3], "x": 3, "y": 1},
{"label": "B2", "matrix": [2, 0], "x": 0, "y": 2},
{"label": "D2", "matrix": [2, 1], "x": 1, "y": 2},
{"label": "D7", "matrix": [2, 2], "x": 2, "y": 2},
{"label": "C7", "matrix": [2, 3], "x": 3, "y": 2},
{"label": "B1", "matrix": [3, 0], "x": 0, "y": 3},
{"label": "D1", "matrix": [3, 1], "x": 1, "y": 3},
{"label": "D6", "matrix": [3, 2], "x": 2, "y": 3},
{"label": "C6", "matrix": [3, 3], "x": 3, "y": 3},
{"label": "B0", "matrix": [4, 0], "x": 0, "y": 4},
{"label": "D0", "matrix": [4, 1], "x": 1, "y": 4},
{"label": "D4", "matrix": [4, 2], "x": 2, "y": 4},
{"label": "B6", "matrix": [4, 3], "x": 3, "y": 4}
]
}
}
}
@@ -0,0 +1,14 @@
{
"keyboard": "handwired/twentypad",
"keymap": "default",
"layout": "LAYOUT_ortho_5x4",
"layers": [
[
"KC_CALCULATOR", "KC_KP_SLASH", "KC_KP_ASTERISK", "KC_KP_MINUS",
"KC_KP_7", "KC_KP_8", "KC_KP_9", "KC_KP_PLUS",
"KC_KP_4", "KC_KP_5", "KC_KP_6", "KC_LEFT_PAREN",
"KC_KP_1", "KC_KP_2", "KC_KP_3", "KC_RIGHT_PAREN",
"KC_KP_0", "KC_KP_DOT", "KC_KP_EQUAL", "KC_KP_ENTER"
]
]
}
+26
View File
@@ -0,0 +1,26 @@
# TwentyPad
![TwentyPad](https://i.imgur.com/e1Bsg1M.jpeg)
A simple twenty-key macro pad, built to learn PCB design.
* Keyboard Maintainer: [Harry Cutts](https://github.com/HarryCutts)
* Hardware Supported: ATMEGA32U4 on a [custom PCB](https://github.com/HarryCutts/twentypad/)
Make example for this keyboard (after setting up your build environment):
qmk compile -kb handwired/twentypad -km default
Flashing example for this keyboard:
qmk flash -kb handwired/twentypad -km default
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).
## Bootloader
Enter the bootloader in 3 ways:
* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (the top left key) and plug in the keyboard
* **Physical reset button**: Press the button marked `SWR1` in the top-left of the PCB
* **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available
+4 -4
View File
@@ -200,10 +200,10 @@ void led_matrix_handle_key_event(uint8_t row, uint8_t col, bool pressed) {
}
if (last_hit_buffer.count + led_count > LED_HITS_TO_REMEMBER) {
memcpy(&last_hit_buffer.x[0], &last_hit_buffer.x[led_count], LED_HITS_TO_REMEMBER - led_count);
memcpy(&last_hit_buffer.y[0], &last_hit_buffer.y[led_count], LED_HITS_TO_REMEMBER - led_count);
memcpy(&last_hit_buffer.tick[0], &last_hit_buffer.tick[led_count], (LED_HITS_TO_REMEMBER - led_count) * 2); // 16 bit
memcpy(&last_hit_buffer.index[0], &last_hit_buffer.index[led_count], LED_HITS_TO_REMEMBER - led_count);
memmove(&last_hit_buffer.x[0], &last_hit_buffer.x[led_count], LED_HITS_TO_REMEMBER - led_count);
memmove(&last_hit_buffer.y[0], &last_hit_buffer.y[led_count], LED_HITS_TO_REMEMBER - led_count);
memmove(&last_hit_buffer.tick[0], &last_hit_buffer.tick[led_count], (LED_HITS_TO_REMEMBER - led_count) * 2); // 16 bit
memmove(&last_hit_buffer.index[0], &last_hit_buffer.index[led_count], LED_HITS_TO_REMEMBER - led_count);
last_hit_buffer.count = LED_HITS_TO_REMEMBER - led_count;
}
+4 -4
View File
@@ -213,10 +213,10 @@ void rgb_matrix_handle_key_event(uint8_t row, uint8_t col, bool pressed) {
}
if (last_hit_buffer.count + led_count > LED_HITS_TO_REMEMBER) {
memcpy(&last_hit_buffer.x[0], &last_hit_buffer.x[led_count], LED_HITS_TO_REMEMBER - led_count);
memcpy(&last_hit_buffer.y[0], &last_hit_buffer.y[led_count], LED_HITS_TO_REMEMBER - led_count);
memcpy(&last_hit_buffer.tick[0], &last_hit_buffer.tick[led_count], (LED_HITS_TO_REMEMBER - led_count) * 2); // 16 bit
memcpy(&last_hit_buffer.index[0], &last_hit_buffer.index[led_count], LED_HITS_TO_REMEMBER - led_count);
memmove(&last_hit_buffer.x[0], &last_hit_buffer.x[led_count], LED_HITS_TO_REMEMBER - led_count);
memmove(&last_hit_buffer.y[0], &last_hit_buffer.y[led_count], LED_HITS_TO_REMEMBER - led_count);
memmove(&last_hit_buffer.tick[0], &last_hit_buffer.tick[led_count], (LED_HITS_TO_REMEMBER - led_count) * 2); // 16 bit
memmove(&last_hit_buffer.index[0], &last_hit_buffer.index[led_count], LED_HITS_TO_REMEMBER - led_count);
last_hit_buffer.count = LED_HITS_TO_REMEMBER - led_count;
}