1
0
Fork 0

[Keyboard] Add np12 (#12703)

Co-authored-by: Ryan <fauxpark@gmail.com>
This commit is contained in:
nut1414 2021-05-13 08:27:16 +07:00 committed by GitHub
parent fc52b43592
commit 0bada398df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 293 additions and 0 deletions

45
keyboards/np12/config.h Normal file
View file

@ -0,0 +1,45 @@
/* Copyright 2021 nut1414
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config_common.h"
/* USB Device descriptor parameter */
#define VENDOR_ID 0xA4A4
#define PRODUCT_ID 0x4401
#define DEVICE_VER 0x0001
#define MANUFACTURER nut1414
#define PRODUCT np12
/* key matrix size */
#define MATRIX_ROWS 4
#define MATRIX_COLS 5
#define MATRIX_ROW_PINS { D7, E6, B4, F7 }
#define MATRIX_COL_PINS { D1, D0, D4, C6, F6 }
#define UNUSED_PINS
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
#define ENCODERS_PAD_A { F4 }
#define ENCODERS_PAD_B { F5 }

26
keyboards/np12/info.json Normal file
View file

@ -0,0 +1,26 @@
{
"keyboard_name": "np12",
"url": "https://github.com/nut1414/np12",
"maintainer": "nut1414",
"width": 4,
"height": 4,
"layouts": {
"LAYOUT": {
"layout": [
{ "label": "k34", "x": 3, "y": 0 },
{ "label": "k00", "x": 0, "y": 1 },
{ "label": "k01", "x": 1, "y": 1 },
{ "label": "k02", "x": 2, "y": 1 },
{ "label": "k03", "x": 3, "y": 1 },
{ "label": "k10", "x": 0, "y": 2 },
{ "label": "k11", "x": 1, "y": 2 },
{ "label": "k12", "x": 2, "y": 2 },
{ "label": "k13", "x": 3, "y": 2 },
{ "label": "k20", "x": 0, "y": 3 },
{ "label": "k21", "x": 1, "y": 3 },
{ "label": "k22", "x": 2, "y": 3 },
{ "label": "k23", "x": 3, "y": 3 }
]
}
}
}

View file

@ -0,0 +1,60 @@
/* Copyright 2021 nut1414
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT(
KC_MPLY,
KC_9, KC_6, KC_3, KC_PENT,
KC_8, KC_5, KC_2, KC_BSPC,
KC_7, KC_4, KC_1, KC_0),
[1] = LAYOUT(
KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
[2] = LAYOUT(
KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
[3] = LAYOUT(
KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
};
void encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) {
if (clockwise) {
tap_code(KC_AUDIO_VOL_UP);
} else {
tap_code(KC_AUDIO_VOL_DOWN);
}
}
}

View file

@ -0,0 +1,6 @@
# np12 Layout
![np12 layout](https://i.imgur.com/pxOYYil.png)
This is the default layout for np12. The top-right key is for the encoder pushbutton.

View file

@ -0,0 +1,60 @@
/* Copyright 2021 nut1414
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT(
KC_MPLY,
KC_9, KC_6, KC_3, KC_PENT,
KC_8, KC_5, KC_2, KC_BSPC,
KC_7, KC_4, KC_1, KC_0),
[1] = LAYOUT(
KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
[2] = LAYOUT(
KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
[3] = LAYOUT(
KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
};
void encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) {
if (clockwise) {
tap_code(KC_AUDIO_VOL_UP);
} else {
tap_code(KC_AUDIO_VOL_DOWN);
}
}
}

View file

@ -0,0 +1 @@
VIA_ENABLE = yes

17
keyboards/np12/np12.c Normal file
View file

@ -0,0 +1,17 @@
/* Copyright 2021 nut1414
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "np12.h"

31
keyboards/np12/np12.h Normal file
View file

@ -0,0 +1,31 @@
/* Copyright 2021 nut1414
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "quantum.h"
#define LAYOUT( \
k34, \
k00, k01, k02, k03, \
k10, k11, k12, k13, \
k20, k21, k22, k23 \
) { \
{ k00, k01, k02, k03, KC_NO}, \
{ k10, k11, k12, k13, KC_NO}, \
{ k20, k21, k22, k23, KC_NO}, \
{ KC_NO, KC_NO, KC_NO, KC_NO, k34 } \
}

24
keyboards/np12/readme.md Normal file
View file

@ -0,0 +1,24 @@
# np12
![np12](https://i.imgur.com/gci7qqZh.jpg)
![np12 pcb](https://i.imgur.com/DIIvW95h.jpg)
Square-shaped 12 keys keypad with an encoder.
* Keyboard Maintainer: [nut1414](https://github.com/nut1414)
* Hardware Supported: np12 keypad
* Hardware Availability: Open Source https://github.com/nut1414/np12
Make example for this keypad (after setting up your build environment):
make np12:default
Flashing example for this keyboard:
make np12:default:flash
To enter bootloader mode, press the reset button located on the left of the encoder.
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).

23
keyboards/np12/rules.mk Normal file
View file

@ -0,0 +1,23 @@
# MCU name
MCU = atmega32u4
# Bootloader selection
BOOTLOADER = caterina
# Build Options
# change yes to no to disable
#
BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration
MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = no # Console for debug
COMMAND_ENABLE = no # Commands for debug and configuration
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
NKRO_ENABLE = no # USB Nkey Rollover
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
BLUETOOTH_ENABLE = no # Enable Bluetooth
AUDIO_ENABLE = no # Audio output
ENCODER_ENABLE = yes