aboutsummaryrefslogtreecommitdiff
path: root/keyboards/np12
diff options
context:
space:
mode:
authornut1414 <nut.pannapat@gmail.com>2021-05-13 08:27:16 +0700
committerGitHub <noreply@github.com>2021-05-12 18:27:16 -0700
commit0bada398dfba61c93ee5dbec0aeb92b8af0f45a4 (patch)
treeb4eedf68f5ee95b8667f160801002b736ee390ac /keyboards/np12
parentfc52b43592abd0f6b82e54474adb59adb893b858 (diff)
downloadqmk_firmware-0bada398dfba61c93ee5dbec0aeb92b8af0f45a4.tar.gz
qmk_firmware-0bada398dfba61c93ee5dbec0aeb92b8af0f45a4.zip
[Keyboard] Add np12 (#12703)
Co-authored-by: Ryan <fauxpark@gmail.com>
Diffstat (limited to 'keyboards/np12')
-rw-r--r--keyboards/np12/config.h45
-rw-r--r--keyboards/np12/info.json26
-rw-r--r--keyboards/np12/keymaps/default/keymap.c60
-rw-r--r--keyboards/np12/keymaps/default/readme.md6
-rw-r--r--keyboards/np12/keymaps/via/keymap.c60
-rw-r--r--keyboards/np12/keymaps/via/rules.mk1
-rw-r--r--keyboards/np12/np12.c17
-rw-r--r--keyboards/np12/np12.h31
-rw-r--r--keyboards/np12/readme.md24
-rw-r--r--keyboards/np12/rules.mk23
10 files changed, 293 insertions, 0 deletions
diff --git a/keyboards/np12/config.h b/keyboards/np12/config.h
new file mode 100644
index 000000000..b330c29fe
--- /dev/null
+++ b/keyboards/np12/config.h
@@ -0,0 +1,45 @@
1 /* Copyright 2021 nut1414
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17
18
19#include "config_common.h"
20
21/* USB Device descriptor parameter */
22#define VENDOR_ID 0xA4A4
23#define PRODUCT_ID 0x4401
24#define DEVICE_VER 0x0001
25#define MANUFACTURER nut1414
26#define PRODUCT np12
27
28
29
30/* key matrix size */
31#define MATRIX_ROWS 4
32#define MATRIX_COLS 5
33
34#define MATRIX_ROW_PINS { D7, E6, B4, F7 }
35#define MATRIX_COL_PINS { D1, D0, D4, C6, F6 }
36#define UNUSED_PINS
37
38
39/* COL2ROW or ROW2COL */
40#define DIODE_DIRECTION COL2ROW
41
42#define ENCODERS_PAD_A { F4 }
43#define ENCODERS_PAD_B { F5 }
44
45
diff --git a/keyboards/np12/info.json b/keyboards/np12/info.json
new file mode 100644
index 000000000..2bb513d84
--- /dev/null
+++ b/keyboards/np12/info.json
@@ -0,0 +1,26 @@
1{
2 "keyboard_name": "np12",
3 "url": "https://github.com/nut1414/np12",
4 "maintainer": "nut1414",
5 "width": 4,
6 "height": 4,
7 "layouts": {
8 "LAYOUT": {
9 "layout": [
10 { "label": "k34", "x": 3, "y": 0 },
11 { "label": "k00", "x": 0, "y": 1 },
12 { "label": "k01", "x": 1, "y": 1 },
13 { "label": "k02", "x": 2, "y": 1 },
14 { "label": "k03", "x": 3, "y": 1 },
15 { "label": "k10", "x": 0, "y": 2 },
16 { "label": "k11", "x": 1, "y": 2 },
17 { "label": "k12", "x": 2, "y": 2 },
18 { "label": "k13", "x": 3, "y": 2 },
19 { "label": "k20", "x": 0, "y": 3 },
20 { "label": "k21", "x": 1, "y": 3 },
21 { "label": "k22", "x": 2, "y": 3 },
22 { "label": "k23", "x": 3, "y": 3 }
23 ]
24 }
25 }
26} \ No newline at end of file
diff --git a/keyboards/np12/keymaps/default/keymap.c b/keyboards/np12/keymaps/default/keymap.c
new file mode 100644
index 000000000..4a02b1d3a
--- /dev/null
+++ b/keyboards/np12/keymaps/default/keymap.c
@@ -0,0 +1,60 @@
1 /* Copyright 2021 nut1414
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include QMK_KEYBOARD_H
18
19const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
20
21
22 [0] = LAYOUT(
23 KC_MPLY,
24 KC_9, KC_6, KC_3, KC_PENT,
25 KC_8, KC_5, KC_2, KC_BSPC,
26 KC_7, KC_4, KC_1, KC_0),
27
28 [1] = LAYOUT(
29 KC_TRNS,
30 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
31 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
32 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
33
34 [2] = LAYOUT(
35 KC_TRNS,
36 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
37 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
38 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
39
40 [3] = LAYOUT(
41 KC_TRNS,
42 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
43 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
44 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
45
46
47
48};
49
50void encoder_update_user(uint8_t index, bool clockwise) {
51 if (index == 0) {
52 if (clockwise) {
53 tap_code(KC_AUDIO_VOL_UP);
54 } else {
55 tap_code(KC_AUDIO_VOL_DOWN);
56 }
57 }
58}
59
60
diff --git a/keyboards/np12/keymaps/default/readme.md b/keyboards/np12/keymaps/default/readme.md
new file mode 100644
index 000000000..d8c4c20f9
--- /dev/null
+++ b/keyboards/np12/keymaps/default/readme.md
@@ -0,0 +1,6 @@
1# np12 Layout
2![np12 layout](https://i.imgur.com/pxOYYil.png)
3
4This is the default layout for np12. The top-right key is for the encoder pushbutton.
5
6
diff --git a/keyboards/np12/keymaps/via/keymap.c b/keyboards/np12/keymaps/via/keymap.c
new file mode 100644
index 000000000..4a02b1d3a
--- /dev/null
+++ b/keyboards/np12/keymaps/via/keymap.c
@@ -0,0 +1,60 @@
1 /* Copyright 2021 nut1414
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include QMK_KEYBOARD_H
18
19const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
20
21
22 [0] = LAYOUT(
23 KC_MPLY,
24 KC_9, KC_6, KC_3, KC_PENT,
25 KC_8, KC_5, KC_2, KC_BSPC,
26 KC_7, KC_4, KC_1, KC_0),
27
28 [1] = LAYOUT(
29 KC_TRNS,
30 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
31 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
32 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
33
34 [2] = LAYOUT(
35 KC_TRNS,
36 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
37 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
38 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
39
40 [3] = LAYOUT(
41 KC_TRNS,
42 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
43 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
44 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
45
46
47
48};
49
50void encoder_update_user(uint8_t index, bool clockwise) {
51 if (index == 0) {
52 if (clockwise) {
53 tap_code(KC_AUDIO_VOL_UP);
54 } else {
55 tap_code(KC_AUDIO_VOL_DOWN);
56 }
57 }
58}
59
60
diff --git a/keyboards/np12/keymaps/via/rules.mk b/keyboards/np12/keymaps/via/rules.mk
new file mode 100644
index 000000000..1e5b99807
--- /dev/null
+++ b/keyboards/np12/keymaps/via/rules.mk
@@ -0,0 +1 @@
VIA_ENABLE = yes
diff --git a/keyboards/np12/np12.c b/keyboards/np12/np12.c
new file mode 100644
index 000000000..062bd9a83
--- /dev/null
+++ b/keyboards/np12/np12.c
@@ -0,0 +1,17 @@
1 /* Copyright 2021 nut1414
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include "np12.h"
diff --git a/keyboards/np12/np12.h b/keyboards/np12/np12.h
new file mode 100644
index 000000000..ee82786d8
--- /dev/null
+++ b/keyboards/np12/np12.h
@@ -0,0 +1,31 @@
1 /* Copyright 2021 nut1414
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#pragma once
18
19#include "quantum.h"
20
21#define LAYOUT( \
22 k34, \
23 k00, k01, k02, k03, \
24 k10, k11, k12, k13, \
25 k20, k21, k22, k23 \
26) { \
27 { k00, k01, k02, k03, KC_NO}, \
28 { k10, k11, k12, k13, KC_NO}, \
29 { k20, k21, k22, k23, KC_NO}, \
30 { KC_NO, KC_NO, KC_NO, KC_NO, k34 } \
31}
diff --git a/keyboards/np12/readme.md b/keyboards/np12/readme.md
new file mode 100644
index 000000000..2b33920a6
--- /dev/null
+++ b/keyboards/np12/readme.md
@@ -0,0 +1,24 @@
1# np12
2
3![np12](https://i.imgur.com/gci7qqZh.jpg)
4
5![np12 pcb](https://i.imgur.com/DIIvW95h.jpg)
6
7Square-shaped 12 keys keypad with an encoder.
8
9* Keyboard Maintainer: [nut1414](https://github.com/nut1414)
10* Hardware Supported: np12 keypad
11* Hardware Availability: Open Source https://github.com/nut1414/np12
12
13
14Make example for this keypad (after setting up your build environment):
15
16 make np12:default
17
18Flashing example for this keyboard:
19
20 make np12:default:flash
21
22To enter bootloader mode, press the reset button located on the left of the encoder.
23
24See 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/np12/rules.mk b/keyboards/np12/rules.mk
new file mode 100644
index 000000000..8b8bacdcf
--- /dev/null
+++ b/keyboards/np12/rules.mk
@@ -0,0 +1,23 @@
1# MCU name
2MCU = atmega32u4
3
4# Bootloader selection
5BOOTLOADER = caterina
6
7# Build Options
8# change yes to no to disable
9#
10BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration
11MOUSEKEY_ENABLE = yes # Mouse keys
12EXTRAKEY_ENABLE = yes # Audio control and System control
13CONSOLE_ENABLE = no # Console for debug
14COMMAND_ENABLE = no # Commands for debug and configuration
15# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
16SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
17# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
18NKRO_ENABLE = no # USB Nkey Rollover
19BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
20RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
21BLUETOOTH_ENABLE = no # Enable Bluetooth
22AUDIO_ENABLE = no # Audio output
23ENCODER_ENABLE = yes