bfbcfbc83e9c496abff002726f7cc07108d99003

Author
dezli <29718605+dezlidezlidezli@users.noreply.github.com>
Committer
GitHub <noreply@github.com>
Date

Message

[Keyboard] Add miniMACRO5 Macropad (#10392)

* add miniMACRO5

add all nessecary files for the miniMACRO5

I have rewritten the readme, and changed the keymaps to be more simple. I have tested compiling, and everything works perfectly.

* update miniMACRO5 readme

add the make example into the readme file

* Update keyboards/minimacro5/config.h

Co-authored-by: Ryan <fauxpark@gmail.com>

* Update keyboards/minimacro5/keymaps/default/keymap.c

Co-authored-by: Ryan <fauxpark@gmail.com>

* Update keyboards/minimacro5/keymaps/media/keymap.c

Co-authored-by: Ryan <fauxpark@gmail.com>

* Update keyboards/minimacro5/keymaps/media/keymap.c

Co-authored-by: Ryan <fauxpark@gmail.com>

* Update keyboards/minimacro5/minimacro5.c

Co-authored-by: Ryan <fauxpark@gmail.com>

* Update keyboards/minimacro5/info.json

Co-authored-by: Ryan <fauxpark@gmail.com>

* Apply suggestions from code review

applied all suggestions.

Co-authored-by: Ryan <fauxpark@gmail.com>

* drashna suggestions - enum rather than define

committed enum update by drashna

Co-authored-by: Drashna Jaelre <drashna@live.com>

* update keymap.c

incorrect brackets

Co-authored-by: dezli <m@dez.li>
Co-authored-by: Ryan <fauxpark@gmail.com>
Co-authored-by: Drashna Jaelre <drashna@live.com>

Diff

This diff is truncated to protect this page.

  1diff --git a/keyboards/minimacro5/config.h b/keyboards/minimacro5/config.h
  2new file mode 100644
  3index 0000000000000000000000000000000000000000..b48b5df21ef20858cb4d8f21cb146a62c7458e88
  4--- /dev/null
  5+++ b/keyboards/minimacro5/config.h
  6@@ -0,0 +1,62 @@
  7+/*
  8+Copyright 2012 Jun Wako <wakojun@gmail.com>
  9+
 10+This program is free software: you can redistribute it and/or modify
 11+it under the terms of the GNU General Public License as published by
 12+the Free Software Foundation, either version 2 of the License, or
 13+(at your option) any later version.
 14+
 15+This program is distributed in the hope that it will be useful,
 16+but WITHOUT ANY WARRANTY; without even the implied warranty of
 17+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 18+GNU General Public License for more details.
 19+
 20+You should have received a copy of the GNU General Public License
 21+along with this program.  If not, see <http://www.gnu.org/licenses/>.
 22+*/
 23+
 24+#pragma once
 25+
 26+#include "config_common.h"
 27+
 28+/* USB Device descriptor parameter */
 29+#define VENDOR_ID       0xCEEB
 30+#define PRODUCT_ID      0x0007
 31+#define DEVICE_VER      0x0001
 32+#define MANUFACTURER    leafcutterlabs
 33+#define PRODUCT         miniMACRO5
 34+
 35+/* key matrix size */
 36+#define MATRIX_ROWS 1
 37+#define MATRIX_COLS 5
 38+
 39+/*
 40+ * Keyboard Matrix Assignments
 41+ *
 42+ * Change this to how you wired your keyboard
 43+ * COLS: AVR pins used for columns, left to right
 44+ * ROWS: AVR pins used for rows, top to bottom
 45+ * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
 46+ *                  ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
 47+ *                  NO_DIODE = switches are directly connected to AVR pins
 48+ *
 49+*/
 50+// #define MATRIX_ROW_PINS { D0, D5 }
 51+// #define MATRIX_COL_PINS { F1, F0, B0 }
 52+#define DIRECT_PINS {   \
 53+    { F4, B6, B2, D7, B4 } \
 54+}
 55+//speed for double tap
 56+#define TAPPING_TERM 200
 57+
 58+#define UNUSED_PINS
 59+
 60+/* rotary encoder 1,2,3 closest to usb port is 0*/
 61+#define ENCODERS_PAD_B { D3, F6, F7, D4, C6}
 62+#define ENCODERS_PAD_A { F5, D2, D1, D0, E6}
 63+#define ENCODER_RESOLUTION 2 //default/suggested
 64+
 65+/* ws2812 RGB LED */
 66+#define RGB_DI_PIN B5
 67+#define RGBLIGHT_ANIMATIONS
 68+#define RGBLED_NUM 5    // Number of LEDs
 69diff --git a/keyboards/minimacro5/info.json b/keyboards/minimacro5/info.json
 70new file mode 100644
 71index 0000000000000000000000000000000000000000..1cc2a2e41ce351f41346619def5f6a80f6219f9b
 72--- /dev/null
 73+++ b/keyboards/minimacro5/info.json
 74@@ -0,0 +1,12 @@
 75+{
 76+  "keyboard_name": "minimacro5",
 77+  "url": "",
 78+  "maintainer": "qmk",
 79+  "width": 5,
 80+  "height": 1,
 81+  "layouts": {
 82+    "LAYOUT_ortho_1x5": {
 83+      "layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":5, "y":0}]
 84+    }
 85+  }
 86+}
 87diff --git a/keyboards/minimacro5/keymaps/default/keymap.c b/keyboards/minimacro5/keymaps/default/keymap.c
 88new file mode 100644
 89index 0000000000000000000000000000000000000000..acd7f328311031edb5f56ef218824ed7a064fb94
 90--- /dev/null
 91+++ b/keyboards/minimacro5/keymaps/default/keymap.c
 92@@ -0,0 +1,46 @@
 93+#include QMK_KEYBOARD_H
 94+
 95+enum layers {
 96+     _MAIN,
 97+};
 98+
 99+void encoder_update_user(uint8_t index, bool clockwise) {
100+  if (index == 0) { /* First encoder*/
101+    if (clockwise) {
102+      tap_code(KC_1);
103+    } else {
104+      tap_code(KC_2);
105+    }
106+  } else if (index == 1) { /* Second encoder*/
107+    if (clockwise) {
108+      tap_code(KC_3);
109+    } else {
110+      tap_code(KC_4);
111+    }
112+  } else if (index == 2) { /* Third encoder*/
113+    if (clockwise) {
114+      tap_code(KC_5);
115+    } else {
116+      tap_code(KC_6);
117+    }
118+  } else if (index == 3) { /* Fourth encoder*/
119+    if (clockwise) {
120+      tap_code(KC_7);
121+    } else {
122+      tap_code(KC_8);
123+    }
124+  } else if (index == 4) { /* Fifth encoder*/
125+    if (clockwise) {
126+      tap_code(KC_9);
127+    } else {
128+      tap_code(KC_0);
129+    }
130+  }
131+}
132+
133+//
134+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { //buttion closest to usb is first
135+  [_MAIN] = LAYOUT_ortho_1x5(
136+     KC_A, KC_B, KC_C, KC_D, KC_E
137+  )
138+};
139diff --git a/keyboards/minimacro5/keymaps/media/keymap.c b/keyboards/minimacro5/keymaps/media/keymap.c
140new file mode 100644
141index 0000000000000000000000000000000000000000..f36954b07479546dcf9deca8f6ce9a92e6692e7b
142--- /dev/null
143+++ b/keyboards/minimacro5/keymaps/media/keymap.c
144@@ -0,0 +1,43 @@
145+#include QMK_KEYBOARD_H
146+
147+#define _MAIN 0
148+
149+void encoder_update_user(uint8_t index, bool clockwise) {
150+  if (index == 0) { /* First encoder*/
151+    if (clockwise) {
152+      tap_code(KC_VOLU);
153+    } else {
154+      tap_code(KC_VOLD);
155+    }
156+  } else if (index == 1) { /* Second encoder*/
157+    if (clockwise) {
158+      tap_code(KC_3);
159+    } else {
160+      tap_code(KC_4);
161+    }
162+  } else if (index == 2) { /* Third encoder*/
163+    if (clockwise) {
164+      tap_code(KC_5);
165+    } else {
166+      tap_code(KC_6);
167+    }
168+  } else if (index == 3) { /* Fourth encoder*/
169+    if (clockwise) {
170+      tap_code(KC_7);
171+    } else {
172+      tap_code(KC_8);
173+    }
174+  } else if (index == 4) { /* Fifth encoder*/
175+    if (clockwise) {
176+      tap_code(KC_9);
177+    } else {
178+      tap_code(KC_0);
179+    }
180+  }
181+}
182+
183+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { //buttion closest to usb is first
184+  [_MAIN] = LAYOUT_ortho_1x5(
185+     KC_MUTE, KC_MEDIA_PREV_TRACK, KC_MEDIA_NEXT_TRACK, KC_MEDIA_PLAY_PAUSE, KC_MEDIA_STOP
186+  )
187+};
188diff --git a/keyboards/minimacro5/minimacro5.c b/keyboards/minimacro5/minimacro5.c
189new file mode 100644
190index 0000000000000000000000000000000000000000..7f9c5af1c783e149100d4525b2700e642f66f0ff
191--- /dev/null
192+++ b/keyboards/minimacro5/minimacro5.c
193@@ -0,0 +1 @@
194+#include "minimacro5.h"
195diff --git a/keyboards/minimacro5/minimacro5.h b/keyboards/minimacro5/minimacro5.h
196new file mode 100644
197index 0000000000000000000000000000000000000000..2d61ed893bb1bf0691510971a88ae0135b2ddbf9
198--- /dev/null
199+++ b/keyboards/minimacro5/minimacro5.h
200@@ -0,0 +1,9 @@
201+#pragma once
202+
203+#include "quantum.h"
204+
205+#define LAYOUT_ortho_1x5( \
206+    k01, k02, k03, k04, k05\
207+  ) { \
208+    { k01, k02, k03, k04, k05 } \
209+}
210diff --git a/keyboards/minimacro5/readme.md b/keyboards/minimacro5/readme.md
211new file mode 100644
212index 0000000000000000000000000000000000000000..6266d2ba35091746a9de90b7e04ef47322592380
213--- /dev/null
214+++ b/keyboards/minimacro5/readme.md
215@@ -0,0 +1,15 @@
216+# miniMACRO5
217+
218+A 5 key Macropad based on Arduino Pro Micro with support for a combination of rotary encoders and mechanical switches.
219+
220+![](https://i.imgur.com/lxA8DSCl.jpg)
221+
222+* Keyboard Maintainer: [LeafCutterLabs](https://github.com/LeafCutterLabs)
223+* Hardware Supported: Pro Micro 5V/16MHz and compatible.
224+* Hardware availability: PCB Files are available [here](https://github.com/LeafCutterLabs/miniMACRO5), which you can get produced.
225+
226+Make example for this keyboard (after setting up your build environment):
227+
228+    make minimacro5:default
229+
230diff --git a/keyboards/minimacro5/rules.mk b/keyboards/minimacro5/rules.mk
231new file mode 100644
232index 0000000000000000000000000000000000000000..dd66c4fbd8c3c0f997a19991d07d92b66ebb7154
233--- /dev/null
234+++ b/keyboards/minimacro5/rules.mk
235@@ -0,0 +1,23 @@
236+# MCU name
237+MCU = atmega32u4
238+
239+# Bootloader selection
240+BOOTLOADER = caterina
241+
242+# Build Options
243+#   change yes to no to disable
244+#
245+BOOTMAGIC_ENABLE = no       # Virtual DIP switch configuration
246+MOUSEKEY_ENABLE = yes       # Mouse keys
247+EXTRAKEY_ENABLE = yes       # Audio control and System control
248+CONSOLE_ENABLE = no         # Console for debug
249+COMMAND_ENABLE = no         # Commands for debug and configuration
250+# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
251+SLEEP_LED_ENABLE = no       # Breathing sleep LED during USB suspend
252+# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
253+NKRO_ENABLE = yes           # USB Nkey Rollover
254+BACKLIGHT_ENABLE = no       # Enable keyboard backlight functionality
255+RGBLIGHT_ENABLE = yes       # Enable keyboard RGB underglow
256+BLUETOOTH_ENABLE = no       # Enable Bluetooth
257+AUDIO_ENABLE = no           # Audio output
258+ENCODER_ENABLE = yes        #enable rotary encoders