From 574b3d8a5a6891fff6d8058abc5c091f65f8dec2 Mon Sep 17 00:00:00 2001 From: Sergi Meseguer Date: Tue, 28 Sep 2021 07:10:10 +0200 Subject: [Keyboard] z12 micropad by zigotica (#14583) Co-authored-by: Drashna Jaelre Co-authored-by: Ryan --- keyboards/z12/config.h | 53 +++++++++++++++++++++++++++++ keyboards/z12/info.json | 26 +++++++++++++++ keyboards/z12/keymaps/default/config.h | 26 +++++++++++++++ keyboards/z12/keymaps/default/keymap.c | 59 +++++++++++++++++++++++++++++++++ keyboards/z12/keymaps/default/readme.md | 3 ++ keyboards/z12/keymaps/default/rules.mk | 2 ++ keyboards/z12/readme.md | 3 ++ keyboards/z12/rules.mk | 24 ++++++++++++++ keyboards/z12/z12.c | 39 ++++++++++++++++++++++ keyboards/z12/z12.h | 34 +++++++++++++++++++ 10 files changed, 269 insertions(+) create mode 100644 keyboards/z12/config.h create mode 100644 keyboards/z12/info.json create mode 100644 keyboards/z12/keymaps/default/config.h create mode 100644 keyboards/z12/keymaps/default/keymap.c create mode 100644 keyboards/z12/keymaps/default/readme.md create mode 100644 keyboards/z12/keymaps/default/rules.mk create mode 100644 keyboards/z12/readme.md create mode 100644 keyboards/z12/rules.mk create mode 100644 keyboards/z12/z12.c create mode 100644 keyboards/z12/z12.h (limited to 'keyboards/z12') diff --git a/keyboards/z12/config.h b/keyboards/z12/config.h new file mode 100644 index 0000000000..7f897b795d --- /dev/null +++ b/keyboards/z12/config.h @@ -0,0 +1,53 @@ +/* Copyright 2020 Sergi Meseguer + +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 0x7A74 +#define PRODUCT_ID 0x0001 +#define DEVICE_VER 0x0001 +#define MANUFACTURER zigotica +#define PRODUCT z12 + +#define ENCODERS_PAD_A { B4, B2 } +#define ENCODERS_PAD_B { B5, B6 } +#define ENCODER_DIRECTION_FLIP + +/* key matrix size */ +#define MATRIX_ROWS 4 +#define MATRIX_COLS 4 + +/*Keyboard Matrix Assignments */ + +#define DIRECT_PINS { \ + { NO_PIN, E6, C6, NO_PIN }, \ + { D2, D7, D4, D3 }, \ + { F7, B1, B3, NO_PIN }, \ + { F6, F5, F4, NO_PIN } \ +} + +#define UNUSED_PINS + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCE 5 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE diff --git a/keyboards/z12/info.json b/keyboards/z12/info.json new file mode 100644 index 0000000000..3ae8937571 --- /dev/null +++ b/keyboards/z12/info.json @@ -0,0 +1,26 @@ +{ + "keyboard_name": "z12", + "url": "https://github.com/zigotica/mechanical-keyboards/tree/main/z12", + "maintainer": "@zigotica", + "layouts": { + "LAYOUT": { + "layout": [ + {"x": 1, "y": 0}, + {"x": 2, "y": 0}, + + {"x": 0, "y": 0.5}, + {"x": 1, "y": 1}, + {"x": 2, "y": 1}, + {"x": 3, "y": 0.5}, + + {"x": 0.5, "y": 2}, + {"x": 1.5, "y": 2}, + {"x": 2.5, "y": 2}, + + {"x": 0.5, "y": 3}, + {"x": 1.5, "y": 3}, + {"x": 2.5, "y": 3}, + ] + } + } +} diff --git a/keyboards/z12/keymaps/default/config.h b/keyboards/z12/keymaps/default/config.h new file mode 100644 index 0000000000..1fcf924f35 --- /dev/null +++ b/keyboards/z12/keymaps/default/config.h @@ -0,0 +1,26 @@ +/* Copyright 2020 Sergi Meseguer + +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 + +#define OLED_DISPLAY_128X32 + +// EC11 encoders' resolution. +// Reduce the value to 2 if you feel missing values: +#define ENCODER_RESOLUTION 4 + +// Allows correct registered values by rotary encoder: +#define TAP_CODE_DELAY 10 diff --git a/keyboards/z12/keymaps/default/keymap.c b/keyboards/z12/keymaps/default/keymap.c new file mode 100644 index 0000000000..16a6c1f70e --- /dev/null +++ b/keyboards/z12/keymaps/default/keymap.c @@ -0,0 +1,59 @@ +/* Copyright 2020 Sergi Meseguer + +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 + +enum layers { + BASE = 0 +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +/* + * Base Layer: BASE + * + * ,-----------------------. + * | | o | o | | + * |-------+---+---+-------| + * | o | o | o | o | + * |-------+-------+-------| + * | o | o | o | + * |-------+-------+-------| + * | o | o | o | + * |-------+-------+-------| + */ + [BASE] = LAYOUT( + KC_Q, KC_W, + KC_E, KC_R, KC_T, KC_Y, + KC_U, KC_I, KC_O, + KC_P, KC_K, KC_A + ), + +/* + * TEMPLATE + * + * ,-----------------------. + * | | o | o | | + * |-------+---+---+-------| + * | o | o | o | o | + * |-------+-------+-------| + * | o | o | o | + * |-------+-------+-------| + * | o | o | o | + * |-------+-------+-------| + */ + +}; + diff --git a/keyboards/z12/keymaps/default/readme.md b/keyboards/z12/keymaps/default/readme.md new file mode 100644 index 0000000000..5f30ab6a39 --- /dev/null +++ b/keyboards/z12/keymaps/default/readme.md @@ -0,0 +1,3 @@ +# Default z12 Layout + +This is the default layout that comes flashed on every z12. diff --git a/keyboards/z12/keymaps/default/rules.mk b/keyboards/z12/keymaps/default/rules.mk new file mode 100644 index 0000000000..b220469c6c --- /dev/null +++ b/keyboards/z12/keymaps/default/rules.mk @@ -0,0 +1,2 @@ +OLED_ENABLE = yes # Enables the use of OLED displays +MOUSEKEY_ENABLE = yes diff --git a/keyboards/z12/readme.md b/keyboards/z12/readme.md new file mode 100644 index 0000000000..17e4bfdb84 --- /dev/null +++ b/keyboards/z12/readme.md @@ -0,0 +1,3 @@ +# z12 + +Firmware for [z12 micropad](https://github.com/zigotica/mechanical-keyboards/tree/main/z12) designed by @zigotica diff --git a/keyboards/z12/rules.mk b/keyboards/z12/rules.mk new file mode 100644 index 0000000000..32cdab8e95 --- /dev/null +++ b/keyboards/z12/rules.mk @@ -0,0 +1,24 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = caterina + +# Build Options +BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite +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 +ENCODER_ENABLE = yes # Enables the use of encoders +# 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 +AUDIO_ENABLE = no # Audio output +LTO_ENABLE = yes # Enables Link Time Optimization (LTO) which reduces the compiled size +OLED_ENABLE = yes # Enables the use of OLED displays +OLED_DRIVER = SSD1306 # Enables the use of OLED displays + diff --git a/keyboards/z12/z12.c b/keyboards/z12/z12.c new file mode 100644 index 0000000000..99fe62ab93 --- /dev/null +++ b/keyboards/z12/z12.c @@ -0,0 +1,39 @@ +/* Copyright 2020 Sergi Meseguer + * + * 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 "z12.h" + +#ifdef ENCODER_ENABLE +bool encoder_update_kb(uint8_t index, bool clockwise) { + if (!encoder_update_user(index, clockwise)) { return false; } + if (index == 0) { // LEFT + // Scroll + if (clockwise) { + tap_code_delay(KC_PGDN, 10); + } else { + tap_code_delay(KC_PGUP, 10); + } + } else { // RIGHT + // Volume control. + if (clockwise) { + tap_code_delay(KC_VOLU, 10); + } else { + tap_code_delay(KC_VOLD, 10); + } + } + return false; +} +#endif diff --git a/keyboards/z12/z12.h b/keyboards/z12/z12.h new file mode 100644 index 0000000000..0ea6c303f7 --- /dev/null +++ b/keyboards/z12/z12.h @@ -0,0 +1,34 @@ +/* Copyright 2020 Sergi Meseguer + * + * 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 "quantum.h" + +/* This a shortcut to help you visually see your layout */ + +#define ___ KC_NO + +#define LAYOUT( \ + BN4, BN2, \ + SW7, BN3, BN1, SW8, \ + SW4, SW5, SW6, \ + SW3, SW2, SW1 \ + ) \ + { \ + { ___, BN4, BN2, ___ }, \ + { SW7, BN3, BN1, SW8 }, \ + { SW4, SW5, SW6, ___ }, \ + { SW3, SW2, SW1, ___ }, \ + } -- cgit v1.2.3