From e0f91f37c4b944b328f9e022b18f2f1ad702fcf4 Mon Sep 17 00:00:00 2001 From: Elias Date: Fri, 23 Aug 2019 23:18:37 +0200 Subject: [PATCH] Added 4by3 keyboard (#6547) * Added 4by3 keyboard * Added DEVICE_VER and DESCRIPTION * Removed F_CPU, F_USB, ARCH, and OPT_DEFS * Add 3 new LAYOUT macros for orientations and fixes * Apply suggestions from code review Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Added comments to 4by3 and changed info.json * Update keyboards/4by3/4by3.h Co-Authored-By: fauxpark --- keyboards/4by3/4by3.c | 1 + keyboards/4by3/4by3.h | 70 +++++++++++++++++++ keyboards/4by3/config.h | 26 +++++++ keyboards/4by3/info.json | 41 +++++++++++ keyboards/4by3/keymaps/arrowpad/keymap.c | 12 ++++ keyboards/4by3/keymaps/default/keymap.c | 9 +++ keyboards/4by3/keymaps/default/readme.md | 3 + .../4by3/keymaps/funcpad_horizontal/keymap.c | 9 +++ .../4by3/keymaps/funcpad_vertical/keymap.c | 12 ++++ .../4by3/keymaps/numpad_horizontal/keymap.c | 9 +++ .../4by3/keymaps/numpad_vertical/keymap.c | 12 ++++ keyboards/4by3/readme.md | 15 ++++ keyboards/4by3/rules.mk | 8 +++ 13 files changed, 227 insertions(+) create mode 100644 keyboards/4by3/4by3.c create mode 100644 keyboards/4by3/4by3.h create mode 100644 keyboards/4by3/config.h create mode 100644 keyboards/4by3/info.json create mode 100644 keyboards/4by3/keymaps/arrowpad/keymap.c create mode 100644 keyboards/4by3/keymaps/default/keymap.c create mode 100644 keyboards/4by3/keymaps/default/readme.md create mode 100644 keyboards/4by3/keymaps/funcpad_horizontal/keymap.c create mode 100644 keyboards/4by3/keymaps/funcpad_vertical/keymap.c create mode 100644 keyboards/4by3/keymaps/numpad_horizontal/keymap.c create mode 100644 keyboards/4by3/keymaps/numpad_vertical/keymap.c create mode 100644 keyboards/4by3/readme.md create mode 100644 keyboards/4by3/rules.mk diff --git a/keyboards/4by3/4by3.c b/keyboards/4by3/4by3.c new file mode 100644 index 0000000000..3ae27260d4 --- /dev/null +++ b/keyboards/4by3/4by3.c @@ -0,0 +1 @@ +#include "4by3.h" \ No newline at end of file diff --git a/keyboards/4by3/4by3.h b/keyboards/4by3/4by3.h new file mode 100644 index 0000000000..b41628137a --- /dev/null +++ b/keyboards/4by3/4by3.h @@ -0,0 +1,70 @@ +#pragma once + +#include "quantum.h" + +/* LAYOUT_horizontal + * ┌───┐ + * │USB│ + * ├───┼───┬───┬───┐ + * │K00│K01│K02│K03│ + * ├───┼───┼───┼───┤ + * │K10│K11│K12│K13│ + * ├───┼───┼───┼───┤ + * │K20│K21│K22│K23│ + * └───┴───┴───┴───┘ + */ +#define LAYOUT_horizontal( \ + K00, K01, K02, K03, \ + K10, K11, K12, K13, \ + K20, K21, K22, K23 \ +) { \ + { K00, K01, K02, K03 }, \ + { K10, K11, K12, K13 }, \ + { K20, K21, K22, K23 } \ +} + +/* LAYOUT_vertical_right + * ┌───┬───┬───┬───┐ + * │K00│K01│K03│USB│ + * ├───┼───┼───┬───┘ + * │K04│K05│K06│ + * ├───┼───┼───┤ + * │K07│K08│K09│ + * ├───┼───┼───┤ + * │K10│K11│K12│ + * └───┴───┴───┘ + */ +#define LAYOUT_vertical_right( \ + K20, K10, K00, \ + K21, K11, K01, \ + K22, K12, K02, \ + K23, K13, K03 \ +) { \ + { K00, K01, K02, K03 }, \ + { K10, K11, K12, K13 }, \ + { K20, K21, K22, K23 } \ +} + +/* LAYOUT_vertical_left + * ┌───┬───┬───┐ + * │K00│K01│K03│ + * ├───┼───┼───┤ + * │K04│K05│K06│ + * ├───┼───┼───┤ + * │K07│K08│K09│ + * ┌───┼───┼───┼───┤ + * │USB│K10│K11│K12│ + * └───┴───┴───┴───┘ + */ +#define LAYOUT_vertical_left( \ + K03, K13, K23, \ + K02, K12, K22, \ + K01, K11, K21, \ + K00, K10, K20 \ +) { \ + { K00, K01, K02, K03 }, \ + { K10, K11, K12, K13 }, \ + { K20, K21, K22, K23 } \ +} + +#define LAYOUT LAYOUT_horizontal diff --git a/keyboards/4by3/config.h b/keyboards/4by3/config.h new file mode 100644 index 0000000000..2095ee42c2 --- /dev/null +++ b/keyboards/4by3/config.h @@ -0,0 +1,26 @@ +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xEEEE +#define PRODUCT_ID 0x2019 +#define DEVICE_VER 0x0001 +#define MANUFACTURER Elias Sjögreen +#define PRODUCT 4by3 +#define DESCRIPTION A small 12 key keypad + +/* key matrix size */ +#define MATRIX_ROWS 3 +#define MATRIX_COLS 4 + +/* key matrix pins */ +#define MATRIX_ROW_PINS { D1, D0, D4 } +#define MATRIX_COL_PINS { C6, D7, E6, B4 } +#define UNUSED_PINS + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 5 diff --git a/keyboards/4by3/info.json b/keyboards/4by3/info.json new file mode 100644 index 0000000000..9cc07a9240 --- /dev/null +++ b/keyboards/4by3/info.json @@ -0,0 +1,41 @@ +{ + "keyboard_name": "4by3", + "url": "https://github.com/eliassjogreen/4by3", + "maintainer": "eliassjogreen", + "width": 4, + "height": 3, + "layouts": { + "LAYOUT_horizontal": { + "key_count": 12, + "width": 4, + "height": 3, + "layout": [ + { "x": 0, "y": 0 }, { "x": 1, "y": 0 }, { "x": 2, "y": 0 }, { "x": 3, "y": 0 }, + { "x": 0, "y": 1 }, { "x": 1, "y": 1 }, { "x": 2, "y": 1 }, { "x": 3, "y": 1 }, + { "x": 0, "y": 2 }, { "x": 1, "y": 2 }, { "x": 2, "y": 2 }, { "x": 3, "y": 2 } + ] + }, + "LAYOUT_vertical_right": { + "key_count": 12, + "width": 3, + "height": 4, + "layout": [ + { "x": 0, "y": 0 }, { "x": 1, "y": 0 }, { "x": 2, "y": 0 }, + { "x": 0, "y": 1 }, { "x": 1, "y": 1 }, { "x": 2, "y": 1 }, + { "x": 0, "y": 2 }, { "x": 1, "y": 2 }, { "x": 2, "y": 2 }, + { "x": 0, "y": 3 }, { "x": 1, "y": 3 }, { "x": 2, "y": 3 } + ] + }, + "LAYOUT_vertical_left": { + "key_count": 12, + "width": 3, + "height": 4, + "layout": [ + { "x": 0, "y": 0 }, { "x": 1, "y": 0 }, { "x": 2, "y": 0 }, + { "x": 0, "y": 1 }, { "x": 1, "y": 1 }, { "x": 2, "y": 1 }, + { "x": 0, "y": 2 }, { "x": 1, "y": 2 }, { "x": 2, "y": 2 }, + { "x": 0, "y": 3 }, { "x": 1, "y": 3 }, { "x": 2, "y": 3 } + ] + } + } +} diff --git a/keyboards/4by3/keymaps/arrowpad/keymap.c b/keyboards/4by3/keymaps/arrowpad/keymap.c new file mode 100644 index 0000000000..df803a35e6 --- /dev/null +++ b/keyboards/4by3/keymaps/arrowpad/keymap.c @@ -0,0 +1,12 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Change 'LAYOUT_vertical_right' to 'LAYOUT_vertical_left' + to change the side where the pro micro usb port is. */ + [0] = LAYOUT_vertical_right( + KC_INS , KC_HOME , KC_PGUP , + KC_DEL , KC_END , KC_PGDN , + KC_PSCR , KC_UP , KC_PAUS , + KC_LEFT , KC_DOWN , KC_RGHT + ) +}; diff --git a/keyboards/4by3/keymaps/default/keymap.c b/keyboards/4by3/keymaps/default/keymap.c new file mode 100644 index 0000000000..f348dc84fb --- /dev/null +++ b/keyboards/4by3/keymaps/default/keymap.c @@ -0,0 +1,9 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_horizontal( + KC_VOLU , _______ , _______ , _______ , + KC_MUTE , KC_MPRV , KC_MPLY , KC_MNXT , + KC_VOLD , _______ , _______ , _______ + ) +}; diff --git a/keyboards/4by3/keymaps/default/readme.md b/keyboards/4by3/keymaps/default/readme.md new file mode 100644 index 0000000000..281dfd5463 --- /dev/null +++ b/keyboards/4by3/keymaps/default/readme.md @@ -0,0 +1,3 @@ +# The default 4by3 keymap + +![The default 4by3 keymap](https://i.imgur.com/E4OlQAs.png) diff --git a/keyboards/4by3/keymaps/funcpad_horizontal/keymap.c b/keyboards/4by3/keymaps/funcpad_horizontal/keymap.c new file mode 100644 index 0000000000..287d125ef1 --- /dev/null +++ b/keyboards/4by3/keymaps/funcpad_horizontal/keymap.c @@ -0,0 +1,9 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_horizontal( + KC_F1 , KC_F2 , KC_F3 , KC_F4 , + KC_F5 , KC_F6 , KC_F7 , KC_F8 , + KC_F9 , KC_F10 , KC_F11 , KC_F12 + ) +}; diff --git a/keyboards/4by3/keymaps/funcpad_vertical/keymap.c b/keyboards/4by3/keymaps/funcpad_vertical/keymap.c new file mode 100644 index 0000000000..c345f28240 --- /dev/null +++ b/keyboards/4by3/keymaps/funcpad_vertical/keymap.c @@ -0,0 +1,12 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Change 'LAYOUT_vertical_right' to 'LAYOUT_vertical_left' + to change the side where the pro micro usb port is. */ + [0] = LAYOUT_vertical_right( + KC_F1 , KC_F2 , KC_F3 , + KC_F4 , KC_F5 , KC_F6 , + KC_F7 , KC_F8 , KC_F9 , + KC_F10 , KC_F11 , KC_F12 + ) +}; diff --git a/keyboards/4by3/keymaps/numpad_horizontal/keymap.c b/keyboards/4by3/keymaps/numpad_horizontal/keymap.c new file mode 100644 index 0000000000..c1195b0bc9 --- /dev/null +++ b/keyboards/4by3/keymaps/numpad_horizontal/keymap.c @@ -0,0 +1,9 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_horizontal( + KC_P1 , KC_P2 , KC_P3 , KC_P4 , + KC_P5 , KC_P6 , KC_P7 , KC_P8 , + KC_P9 , KC_P0 , KC_BSPC , KC_ENT + ), +}; diff --git a/keyboards/4by3/keymaps/numpad_vertical/keymap.c b/keyboards/4by3/keymaps/numpad_vertical/keymap.c new file mode 100644 index 0000000000..7705ea9b83 --- /dev/null +++ b/keyboards/4by3/keymaps/numpad_vertical/keymap.c @@ -0,0 +1,12 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Change 'LAYOUT_vertical_right' to 'LAYOUT_vertical_left' + to change the side where the pro micro usb port is. */ + [0] = LAYOUT_vertical_right( + KC_P1 , KC_P2 , KC_P3 , + KC_P4 , KC_P5 , KC_P6 , + KC_P7 , KC_P8 , KC_P9 , + KC_BSPC , KC_P0 , KC_ENT + ), +}; diff --git a/keyboards/4by3/readme.md b/keyboards/4by3/readme.md new file mode 100644 index 0000000000..0197c4ff80 --- /dev/null +++ b/keyboards/4by3/readme.md @@ -0,0 +1,15 @@ +# 4by3 + +![4by3](https://i.imgur.com/Ykb7evL.jpg) + +A 12 key mechanical keypad. + +Keyboard Maintainer: [eliassjogreen](https://github.com/eliassjogreen) +Hardware Supported: 4by3 +Hardware Availability: [eliassjogreen/4by3](https://github.com/eliassjogreen/4by3) + +Make example for this keyboard (after setting up your build environment): + + make 4by3: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). diff --git a/keyboards/4by3/rules.mk b/keyboards/4by3/rules.mk new file mode 100644 index 0000000000..7d22998333 --- /dev/null +++ b/keyboards/4by3/rules.mk @@ -0,0 +1,8 @@ +MCU = atmega32u4 +BOOTLOADER = caterina + +EXTRAKEY_ENABLE = yes +NKRO_ENABLE = yes +CONSOLE_ENABLE = yes +COMMAND_ENABLE = yes +