From 666944df2e2172614f9bdeef227b2d89ed511a36 Mon Sep 17 00:00:00 2001
From: GLozares <49708169+GLozares@users.noreply.github.com>
Date: Tue, 20 Apr 2021 09:15:21 -0700
Subject: [PATCH] [Keyboard] Add millipad keypad and default keymap (#12522)
---
keyboards/millipad/config.h | 94 ++++++++++++++++++++
keyboards/millipad/info.json | 26 ++++++
keyboards/millipad/keymaps/default/keymap.c | 41 +++++++++
keyboards/millipad/keymaps/default/readme.md | 1 +
keyboards/millipad/millipad.c | 17 ++++
keyboards/millipad/millipad.h | 35 ++++++++
keyboards/millipad/readme.md | 29 ++++++
keyboards/millipad/rules.mk | 23 +++++
8 files changed, 266 insertions(+)
create mode 100644 keyboards/millipad/config.h
create mode 100644 keyboards/millipad/info.json
create mode 100644 keyboards/millipad/keymaps/default/keymap.c
create mode 100644 keyboards/millipad/keymaps/default/readme.md
create mode 100644 keyboards/millipad/millipad.c
create mode 100644 keyboards/millipad/millipad.h
create mode 100644 keyboards/millipad/readme.md
create mode 100644 keyboards/millipad/rules.mk
diff --git a/keyboards/millipad/config.h b/keyboards/millipad/config.h
new file mode 100644
index 0000000000..c15d433a4c
--- /dev/null
+++ b/keyboards/millipad/config.h
@@ -0,0 +1,94 @@
+/*
+Copyright 2021 Jirou
+
+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 .
+*/
+
+#pragma once
+
+#include "config_common.h"
+
+/* USB Device descriptor parameter */
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0x1A1B
+#define DEVICE_VER 0x0001
+#define MANUFACTURER Jirou
+#define PRODUCT millipad
+
+/* key matrix size */
+#define MATRIX_ROWS 2
+#define MATRIX_COLS 6
+
+/*
+ * Keyboard Matrix Assignments
+ *
+ * Change this to how you wired your keyboard
+ * COLS: AVR pins used for columns, left to right
+ * ROWS: AVR pins used for rows, top to bottom
+ * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
+ * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
+ *
+ */
+#define MATRIX_ROW_PINS { C6, C7 }
+#define MATRIX_COL_PINS { F0, F1, F4, D7, D6, D4 }
+#define UNUSED_PINS
+
+/* COL2ROW, ROW2COL */
+#define DIODE_DIRECTION COL2ROW
+
+
+
+/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
+#define DEBOUNCE 5
+
+
+#define LOCKING_RESYNC_ENABLE
+
+
+/*
+ * Force NKRO
+ *
+ * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
+ * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
+ * makefile for this to work.)
+ *
+ * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
+ * until the next keyboard reset.
+ *
+ * NKRO may prevent your keystrokes from being detected in the BIOS, but it is
+ * fully operational during normal computer usage.
+ *
+ * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
+ * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
+ * bootmagic, NKRO mode will always be enabled until it is toggled again during a
+ * power-up.
+ *
+ */
+#define FORCE_NKRO
+
+
+
+/* disable these deprecated features by default */
+#define NO_ACTION_MACRO
+#define NO_ACTION_FUNCTION
+
+/* Bootmagic Lite key configuration */
+//#define BOOTMAGIC_LITE_ROW 0
+//#define BOOTMAGIC_LITE_COLUMN 0
+
+/* Encoder Definitions */
+
+#define ENCODERS_PAD_A { D3 }
+#define ENCODERS_PAD_B { D2 }
+#define ENCODER_RESOLUTION 4
\ No newline at end of file
diff --git a/keyboards/millipad/info.json b/keyboards/millipad/info.json
new file mode 100644
index 0000000000..565ec71365
--- /dev/null
+++ b/keyboards/millipad/info.json
@@ -0,0 +1,26 @@
+{
+ "keyboard_name": "millipad",
+ "url": "https://github.com/GLozares/millipad",
+ "maintainer": "Jirou",
+ "width": 6,
+ "height": 2,
+ "layouts": {
+ "LAYOUT": {
+ "layout": [
+ {"label": "k00", "x": 0, "y": 0},
+ {"label": "k01", "x": 1, "y": 0},
+ {"label": "k02", "x": 2, "y": 0},
+ {"label": "k03", "x": 3, "y": 0},
+ {"label": "k04", "x": 4, "y": 0},
+ {"label": "k05", "x": 5, "y": 0},
+
+ {"label": "k10", "x": 0, "y": 1},
+ {"label": "k11", "x": 1, "y": 1},
+ {"label": "k12", "x": 2, "y": 1},
+ {"label": "k13", "x": 3, "y": 1},
+ {"label": "k14", "x": 4, "y": 1},
+ {"label": "k15", "x": 5, "y": 1}
+ ]
+ }
+ }
+}
diff --git a/keyboards/millipad/keymaps/default/keymap.c b/keyboards/millipad/keymaps/default/keymap.c
new file mode 100644
index 0000000000..0fd145dd09
--- /dev/null
+++ b/keyboards/millipad/keymaps/default/keymap.c
@@ -0,0 +1,41 @@
+/* Copyright 2021 Jirou
+ *
+ * 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 .
+ */
+#include QMK_KEYBOARD_H
+
+// Defines names for use in layer keycodes and the keymap
+enum layer_names {
+ _BASE
+};
+
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+ [_BASE] = LAYOUT(
+ KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F11,
+ KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F12
+ )
+};
+
+
+void encoder_update_user(uint8_t index, bool clockwise) {
+ if (index == 0) { /* First encoder */
+ if (clockwise) {
+ tap_code(KC_VOLU);
+ } else {
+ tap_code(KC_VOLD);
+ }
+ }
+}
\ No newline at end of file
diff --git a/keyboards/millipad/keymaps/default/readme.md b/keyboards/millipad/keymaps/default/readme.md
new file mode 100644
index 0000000000..effc205a24
--- /dev/null
+++ b/keyboards/millipad/keymaps/default/readme.md
@@ -0,0 +1 @@
+# The default keymap for millipad
diff --git a/keyboards/millipad/millipad.c b/keyboards/millipad/millipad.c
new file mode 100644
index 0000000000..5b6b668289
--- /dev/null
+++ b/keyboards/millipad/millipad.c
@@ -0,0 +1,17 @@
+/* Copyright 2021 Jirou
+ *
+ * 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 .
+ */
+
+#include "millipad.h"
diff --git a/keyboards/millipad/millipad.h b/keyboards/millipad/millipad.h
new file mode 100644
index 0000000000..35eb843d6f
--- /dev/null
+++ b/keyboards/millipad/millipad.h
@@ -0,0 +1,35 @@
+/* Copyright 2021 Jirou
+ *
+ * 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 .
+ */
+
+#pragma once
+
+#include "quantum.h"
+
+/* This is a shortcut to help you visually see your layout.
+ *
+ * The first section contains all of the arguments representing the physical
+ * layout of the board and position of the keys.
+ *
+ * The second converts the arguments into a two-dimensional array which
+ * represents the switch matrix.
+ */
+#define LAYOUT( \
+ k00, k01, k02, k03, k04, k05, \
+ k10, k11, k12, k13, k14, k15 \
+) { \
+ { k00, k01, k02, k03, k04, k05 }, \
+ { k10, k11, k12, k13, k14, k15 } \
+}
diff --git a/keyboards/millipad/readme.md b/keyboards/millipad/readme.md
new file mode 100644
index 0000000000..8cabc8a962
--- /dev/null
+++ b/keyboards/millipad/readme.md
@@ -0,0 +1,29 @@
+# millipad
+
+![millipad](https://i.imgur.com/ZM2qel5h.jpg)
+
+An open source 2x6 macropad with rotary encoder. Designed to be cheap and simple.
+
+
+## More Pictures:
+![PCB Layout](https://i.imgur.com/ilhfBfQ.png)
+![Front of PCB](https://i.imgur.com/UiQkmuvh.jpg)
+![Back of PCB](https://i.imgur.com/Inh6UTLh.jpg)
+
+
+* Keyboard Maintainer: [Jirou](https://github.com/GLozares)
+* Hardware Supported: Jirou.Design Millipad
+* Hardware Availability: Open Source at https://github.com/GLozares/millipad
+
+## Bootloader Mode (Flashing Hex Files):
+To flash a new hex file, press the hardware reset button located to the left of the rotary encoder to enter Bootloader mode.
+
+Make example for this keyboard (after setting up your build environment):
+
+ make millipad:default
+
+Flashing example for this keyboard:
+
+ make millipad:default:flash
+
+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/millipad/rules.mk b/keyboards/millipad/rules.mk
new file mode 100644
index 0000000000..57daefea4e
--- /dev/null
+++ b/keyboards/millipad/rules.mk
@@ -0,0 +1,23 @@
+# MCU name
+MCU = atmega32u4
+
+# Bootloader selection
+BOOTLOADER = atmel-dfu
+
+# Build Options
+# change yes to no to disable
+#
+BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration
+MOUSEKEY_ENABLE = no # 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
\ No newline at end of file