From 6b205c30648a3d5334eeb027daab6f1de3f196f7 Mon Sep 17 00:00:00 2001
From: cttt <57359810+ctt-t@users.noreply.github.com>
Date: Mon, 3 Apr 2023 01:55:20 +0800
Subject: [PATCH] [Keyboard] Add Erdnuss 65 (#20202)
Co-authored-by: jack <0x6a73@protonmail.com>
---
keyboards/citrus/erdnuss65/config.h | 23 ++++
keyboards/citrus/erdnuss65/erdnuss65.c | 28 +++++
keyboards/citrus/erdnuss65/info.json | 109 ++++++++++++++++++
.../citrus/erdnuss65/keymaps/default/keymap.c | 23 ++++
.../citrus/erdnuss65/keymaps/via/keymap.c | 39 +++++++
.../citrus/erdnuss65/keymaps/via/rules.mk | 1 +
keyboards/citrus/erdnuss65/readme.md | 22 ++++
keyboards/citrus/erdnuss65/rules.mk | 2 +
keyboards/citrus/readme.md | 2 +
9 files changed, 249 insertions(+)
create mode 100644 keyboards/citrus/erdnuss65/config.h
create mode 100644 keyboards/citrus/erdnuss65/erdnuss65.c
create mode 100644 keyboards/citrus/erdnuss65/info.json
create mode 100644 keyboards/citrus/erdnuss65/keymaps/default/keymap.c
create mode 100644 keyboards/citrus/erdnuss65/keymaps/via/keymap.c
create mode 100644 keyboards/citrus/erdnuss65/keymaps/via/rules.mk
create mode 100644 keyboards/citrus/erdnuss65/readme.md
create mode 100644 keyboards/citrus/erdnuss65/rules.mk
create mode 100644 keyboards/citrus/readme.md
diff --git a/keyboards/citrus/erdnuss65/config.h b/keyboards/citrus/erdnuss65/config.h
new file mode 100644
index 00000000000..5e4a88b9e23
--- /dev/null
+++ b/keyboards/citrus/erdnuss65/config.h
@@ -0,0 +1,23 @@
+/* Copyright 2023 Citrus Lab
+ *
+ * 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
+
+// The pin connected to the data pin of the LEDs
+#define RGBLIGHT_LAYERS//允许您定义可打开或关闭的照明层。非常适合显示当前键盘层或大写锁定状态。
+#define RGBLIGHT_LAYERS_OVERRIDE_RGB_OFF//如果已定义,则即使 RGB 光源处于关闭状态,也会显示照明图层。
+
+#define LOCKING_SUPPORT_ENABLE
+#define LOCKING_RESYNC_ENABLE//尝试使开关状态与键盘指示灯状态保持一致
\ No newline at end of file
diff --git a/keyboards/citrus/erdnuss65/erdnuss65.c b/keyboards/citrus/erdnuss65/erdnuss65.c
new file mode 100644
index 00000000000..d10f476c66d
--- /dev/null
+++ b/keyboards/citrus/erdnuss65/erdnuss65.c
@@ -0,0 +1,28 @@
+/* Copyright 2023 Citrus Lab
+ *
+ * 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"
+
+//Indicator light function
+bool led_update_kb(led_t led_state) {
+ if (led_update_user(led_state)) {
+ if (led_state.caps_lock) {
+ rgblight_setrgb_at(255, 255, 255, 0); //white
+ } else {
+ rgblight_setrgb_at(0, 0, 0, 0);
+ }
+ }
+ return true;
+}
\ No newline at end of file
diff --git a/keyboards/citrus/erdnuss65/info.json b/keyboards/citrus/erdnuss65/info.json
new file mode 100644
index 00000000000..a33d44561dc
--- /dev/null
+++ b/keyboards/citrus/erdnuss65/info.json
@@ -0,0 +1,109 @@
+{
+ "keyboard_name": "Erdnuss65",
+ "manufacturer": "Citrus Lab",
+ "processor": "STM32F103",
+ "bootloader": "stm32duino",
+ "maintainer": "ctt",
+ "usb": {
+ "vid": "0x636C",
+ "pid": "0x6374",
+ "device_version": "0.0.1"
+ },
+
+ "matrix_pins": {
+ "rows":
+ ["B10","B1", "B0","A7","A6"],
+ "cols":
+ ["B12","B14","B15","A8","B13","B3","B4","B5","A1","A2","A0","A3","A4","A5","B11"]
+ },
+
+ "diode_direction": "COL2ROW",
+
+ "features": {
+ "bootmagic": true,
+ "mousekey": true,
+ "extrakey": true,
+ "console": false,
+ "command": false,
+ "nkro": true,
+ "backlight": false,
+ "rgblight": true,
+ "audio": false
+ },
+ "rgblight": {
+ "pin": "A15",
+ "led_count": 1
+ },
+ "layouts": {
+ "LAYOUT": {
+ "layout": [
+ {"label": "ESC K00 (B10,B12)", "matrix": [0, 0], "x": 0, "y": 0},
+ {"label": "1 K01 (B10,B14)", "matrix": [0, 1], "x": 1, "y": 0},
+ {"label": "2 K02 (B10,B15)", "matrix": [0, 2], "x": 2, "y": 0},
+ {"label": "3 K03 (B10,A8)", "matrix": [0, 3], "x": 3, "y": 0},
+ {"label": "4 K04 (B10,B13)", "matrix": [0, 4], "x": 4, "y": 0},
+ {"label": "5 K05 (B10,B3)", "matrix": [0, 5], "x": 5, "y": 0},
+ {"label": "6 K06 (B10,B4)", "matrix": [0, 6], "x": 6, "y": 0},
+ {"label": "7 K07 (B10,B5)", "matrix": [0, 7], "x": 7, "y": 0},
+ {"label": "8 K08 (B10,A1)", "matrix": [0, 8], "x": 8, "y": 0},
+ {"label": "9 K09 (B10,A2)", "matrix": [0, 9], "x": 9, "y": 0},
+ {"label": "0 K0A (B10,A0)", "matrix": [0, 10], "x": 10, "y": 0},
+ {"label": "- K0B (B10,A3)", "matrix": [0, 11], "x": 11, "y": 0},
+ {"label": "= K0C (B10,A4)", "matrix": [0, 12], "x": 12, "y": 0},
+ {"label": "BACKSPACE K0D (B10,A5)", "matrix": [0, 13], "x": 13, "y": 0, "w": 2},
+ {"label": "INS (B10,B11)", "matrix": [0, 14], "x": 15, "y": 0},
+ {"label": "TAB (B1,B12)", "matrix": [1, 0], "x": 0, "y": 1, "w": 1.5},
+ {"label": "Q (B1,B14)", "matrix": [1, 1], "x": 1.5, "y": 1},
+ {"label": "W (B1,B15)", "matrix": [1, 2], "x": 2.5, "y": 1},
+ {"label": "E (B1,A8)", "matrix": [1, 3], "x": 3.5, "y": 1},
+ {"label": "R (B1,B13)", "matrix": [1, 4], "x": 4.5, "y": 1},
+ {"label": "T (B1,B3)", "matrix": [1, 5], "x": 5.5, "y": 1},
+ {"label": "Y (B1,B4)", "matrix": [1, 6], "x": 6.5, "y": 1},
+ {"label": "U (B1,B5)", "matrix": [1, 7], "x": 7.5, "y": 1},
+ {"label": "I (B1,A1)", "matrix": [1, 8], "x": 8.5, "y": 1},
+ {"label": "O (B1,A2)", "matrix": [1, 9], "x": 9.5, "y": 1},
+ {"label": "P (B1,A0)", "matrix": [1, 10], "x": 10.5, "y": 1},
+ {"label": "[ (B1,A3)", "matrix": [1, 11], "x": 11.5, "y": 1},
+ {"label": "] (B1,A4)", "matrix": [1, 12], "x": 12.5, "y": 1},
+ {"label": "\" (B1,A5)", "matrix": [1, 13], "x": 13.5, "y": 1, "w": 1.5},
+ {"label": "DEL (B1,B11)", "matrix": [1, 14], "x": 15, "y": 1},
+ {"label": "CAPSLOCK (B0,B12)", "matrix": [2, 0], "x": 0, "y": 2, "w": 1.25},
+ {"label": "A (B0,B14)", "matrix": [2, 1], "x": 1.75, "y": 2},
+ {"label": "S (B0,B15)", "matrix": [2, 2], "x": 2.75, "y": 2},
+ {"label": "D (B0,A8)", "matrix": [2, 3], "x": 3.75, "y": 2},
+ {"label": "F (B0,B13)", "matrix": [2, 4], "x": 4.75, "y": 2},
+ {"label": "G (B0,B3)", "matrix": [2, 5], "x": 5.75, "y": 2},
+ {"label": "H (B0,B4)", "matrix": [2, 6], "x": 6.75, "y": 2},
+ {"label": "J (B0,B5)", "matrix": [2, 7], "x": 7.75, "y": 2},
+ {"label": "K (B0,A1)", "matrix": [2, 8], "x": 8.75, "y": 2},
+ {"label": "L (B0,A2)", "matrix": [2, 9], "x": 9.75, "y": 2},
+ {"label": "; (B0,A0)", "matrix": [2, 10], "x": 10.75, "y": 2},
+ {"label": "' (B0,A3)", "matrix": [2, 11], "x": 11.75, "y": 2},
+ {"label": "ENTER (B0,A5)", "matrix": [2, 13], "x": 12.75, "y": 2, "w": 2.25},
+ {"label": "PGUP (B0,B11)", "matrix": [2, 14], "x": 15, "y": 2},
+ {"label": "LSHIFT (A7,B12)", "matrix": [3, 0], "x": 0, "y": 3, "w": 2.25},
+ {"label": "Z (A7,B14)", "matrix": [3, 1], "x": 2.25, "y": 3},
+ {"label": "X (A7,B15)", "matrix": [3, 2], "x": 3.25, "y": 3},
+ {"label": "C (A7,A8)", "matrix": [3, 3], "x": 4.25, "y": 3},
+ {"label": "V (A7,B13)", "matrix": [3, 4], "x": 5.25, "y": 3},
+ {"label": "B (A7,B3)", "matrix": [3, 5], "x": 6.25, "y": 3},
+ {"label": "N (A7,B4)", "matrix": [3, 6], "x": 7.25, "y": 3},
+ {"label": "M (A7,B5)", "matrix": [3, 7], "x": 8.25, "y": 3},
+ {"label": ", (A7,A1)", "matrix": [3, 8], "x": 9.25, "y": 3},
+ {"label": ". (A7,A2)", "matrix": [3, 9], "x": 10.25, "y": 3},
+ {"label": "/ (A7,A0)", "matrix": [3, 10], "x": 11.25, "y": 3},
+ {"label": "RSHIFT (A7,A4)", "matrix": [3, 12], "x": 12.25, "y": 3, "w": 1.75},
+ {"label": "UP (A7,A5)", "matrix": [3, 13], "x": 14, "y": 3},
+ {"label": "PGDN (A7,B11)", "matrix": [3, 14], "x": 15, "y": 3},
+ {"label": "LCTRL (A6,B12)", "matrix": [4, 0], "x": 0, "y": 4, "w": 1.5},
+ {"label": "WIN (A6,B14)", "matrix": [4, 1], "x": 1.5, "y": 4},
+ {"label": "ALT (A6,B15)", "matrix": [4, 2], "x": 2.5, "y": 4, "w": 1.5},
+ {"label": "SPACE (A6,A8)", "matrix": [4, 3], "x": 4, "y": 4, "w": 7},
+ {"label": "FN (A6,A0)", "matrix": [4, 10], "x": 11, "y": 4, "w": 1.5},
+ {"label": "LEFT (A6,A4)", "matrix": [4, 12], "x": 13, "y": 4},
+ {"label": "DOWN (A6,A5)", "matrix": [4, 13], "x": 14, "y": 4},
+ {"label": "RIGHT (A6,B11)", "matrix": [4, 14], "x": 15, "y": 4}
+ ]
+ }
+ }
+}
diff --git a/keyboards/citrus/erdnuss65/keymaps/default/keymap.c b/keyboards/citrus/erdnuss65/keymaps/default/keymap.c
new file mode 100644
index 00000000000..0daef5af646
--- /dev/null
+++ b/keyboards/citrus/erdnuss65/keymaps/default/keymap.c
@@ -0,0 +1,23 @@
+// Copyright 2023 Citrus Lab
+// SPDX-License-Identifier: GPL-2.0
+#include QMK_KEYBOARD_H
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+ [0] = LAYOUT(
+ KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS,
+ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL,
+ KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGUP,
+ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_LSFT, KC_UP, KC_PGDN,
+ KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(1), KC_LEFT, KC_DOWN, KC_RGHT
+ ),
+
+ [1] = LAYOUT(
+ KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, KC_MPRV,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, _______, _______, RESET, KC_MNXT,
+ _______, _______, _______, _______, _______, _______, _______, KC_CALC, _______, _______, _______, _______, _______, KC_HOME,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MYCM, KC_VOLU, KC_END,
+ _______, _______, _______, _______, _______, KC_MUTE, KC_VOLU, KC_MPLY
+ )
+};
+
diff --git a/keyboards/citrus/erdnuss65/keymaps/via/keymap.c b/keyboards/citrus/erdnuss65/keymaps/via/keymap.c
new file mode 100644
index 00000000000..0f1bf9525e6
--- /dev/null
+++ b/keyboards/citrus/erdnuss65/keymaps/via/keymap.c
@@ -0,0 +1,39 @@
+// Copyright 2023 Citrus Lab
+// SPDX-License-Identifier: GPL-2.0
+#include QMK_KEYBOARD_H
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+ [0] = LAYOUT(
+ KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS,
+ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL,
+ KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGUP,
+ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_LSFT, KC_UP, KC_PGDN,
+ KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(1), KC_LEFT, KC_DOWN, KC_RGHT
+ ),
+
+ [1] = LAYOUT(
+ KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, KC_MPRV,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, _______, _______, RESET, KC_MNXT,
+ _______, _______, _______, _______, _______, _______, _______, KC_CALC, _______, _______, _______, _______, _______, KC_HOME,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MYCM, KC_VOLU, KC_END,
+ _______, _______, _______, _______, _______, KC_MUTE, KC_VOLU, KC_MPLY
+ ),
+
+ [2] = LAYOUT(
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______
+ ),
+
+ [3] = LAYOUT(
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______
+ ),
+
+};
diff --git a/keyboards/citrus/erdnuss65/keymaps/via/rules.mk b/keyboards/citrus/erdnuss65/keymaps/via/rules.mk
new file mode 100644
index 00000000000..036bd6d1c3e
--- /dev/null
+++ b/keyboards/citrus/erdnuss65/keymaps/via/rules.mk
@@ -0,0 +1 @@
+VIA_ENABLE = yes
\ No newline at end of file
diff --git a/keyboards/citrus/erdnuss65/readme.md b/keyboards/citrus/erdnuss65/readme.md
new file mode 100644
index 00000000000..0bb952c1115
--- /dev/null
+++ b/keyboards/citrus/erdnuss65/readme.md
@@ -0,0 +1,22 @@
+# Erdnuss65
+
+* Keyboard Maintainer: [Citrus Lab](https://github.com/ctt-t)
+* Hardware Supported: STM32F103C8T6
+
+Make example for this keyboard (after setting up your build environment):
+
+ make citrus/erdnuss65:default
+
+Flashing example for this keyboard:
+
+ make citrus/erdnuss65: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).
+
+## Bootloader
+
+Enter the bootloader in 3 ways:
+
+* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard
+* **Physical reset button**: Briefly press the button on the back of the PCB - some may have pads you must short instead
+* **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available
\ No newline at end of file
diff --git a/keyboards/citrus/erdnuss65/rules.mk b/keyboards/citrus/erdnuss65/rules.mk
new file mode 100644
index 00000000000..80b5a0b8f5a
--- /dev/null
+++ b/keyboards/citrus/erdnuss65/rules.mk
@@ -0,0 +1,2 @@
+# Enter lower-power sleep mode when on the ChibiOS idle thread
+OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE
\ No newline at end of file
diff --git a/keyboards/citrus/readme.md b/keyboards/citrus/readme.md
new file mode 100644
index 00000000000..bde8a9620f8
--- /dev/null
+++ b/keyboards/citrus/readme.md
@@ -0,0 +1,2 @@
+# Citrus Lab
+QMK folders for PCB commissions.
\ No newline at end of file