Просмотр исходного кода

[Keyboard] New kbd 1k (#15509)

Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: mtei <2170248+mtei@users.noreply.github.com>
Co-authored-by: Nick Brassel <nick@tzarc.org>
MakotoKurauchi 3 лет назад
Родитель
Сommit
bdd1f318c3

+ 16 - 0
keyboards/1k/1k.c

@@ -0,0 +1,16 @@
+/* Copyright 2020 zvecr<git@zvecr.com>
+ *
+ * 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 "1k.h"

+ 33 - 0
keyboards/1k/1k.h

@@ -0,0 +1,33 @@
+/* Copyright 2020 zvecr<git@zvecr.com>
+ *
+ * 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"
+
+/* This 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_ortho_1x1( \
+	K01 \
+) \
+{ \
+  { K01 }, \
+}

+ 60 - 0
keyboards/1k/config.h

@@ -0,0 +1,60 @@
+/* Copyright 2020 zvecr<git@zvecr.com>
+ *
+ * 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 "config_common.h"
+
+/* USB Device descriptor parameter */
+#define VENDOR_ID  0x0009
+#define PRODUCT_ID 0x0001
+#define DEVICE_VER 0x0001
+#define MANUFACTURER MakotoKurauchi
+#define PRODUCT 1K
+
+/* matrix size */
+#define MATRIX_ROWS 1
+#define MATRIX_COLS 1
+
+/*
+ * Keyboard Matrix Assignments
+ *
+ * On this board we have direct connection: no diodes.
+ */
+#define DIRECT_PINS {{ B0 }}
+
+/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
+#define DEBOUNCE 5
+
+#define RGBLED_NUM 1
+#define RGB_DI_PIN B2
+
+// Save as much space as we can...
+#define LAYER_STATE_8BIT
+#define NO_ACTION_LAYER
+#define NO_ACTION_TAPPING
+#define NO_ACTION_ONESHOT
+#define NO_RESET
+
+// usbconfig.h overrides
+#define USB_CFG_IOPORTNAME B
+#define USB_CFG_DMINUS_BIT 3
+#define USB_CFG_DPLUS_BIT 4
+#define USB_COUNT_SOF 0
+#define USB_INTR_CFG PCMSK
+#define USB_INTR_CFG_SET (1<<USB_CFG_DPLUS_BIT)
+#define USB_INTR_ENABLE_BIT PCIE
+#define USB_INTR_PENDING_BIT PCIF
+#define USB_INTR_VECTOR SIG_PIN_CHANGE

+ 12 - 0
keyboards/1k/info.json

@@ -0,0 +1,12 @@
+{
+  "keyboard_name": "1k",
+  "url": "",
+  "maintainer": "MakotoKurauchi",
+  "layouts": {
+    "LAYOUT_ortho_1x1": {
+      "layout": [
+        {"x":0, "y":0}
+      ]
+    }
+  }
+}

+ 25 - 0
keyboards/1k/keymaps/default/keymap.c

@@ -0,0 +1,25 @@
+// Copyright 2022 Makoto Kurauchi (@MakotoKurauchi)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include QMK_KEYBOARD_H
+#include "rgblite.h"
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+  [0] = LAYOUT_ortho_1x1(
+    RGB_HUI
+  )
+};
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+  if (record->event.pressed) {
+    switch (keycode) {
+      case RGB_HUI:
+        rgblite_increase_hue();
+        break;
+    }
+  }
+  return true;
+}
+
+void keyboard_post_init_user(void) {
+  rgblite_increase_hue();
+}

+ 23 - 0
keyboards/1k/keymaps/default/rgblite.h

@@ -0,0 +1,23 @@
+// Copyright 2022 Makoto Kurauchi (@MakotoKurauchi)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "ws2812.h"
+#include "color.h"
+
+static inline void rgblite_setrgb(RGB rgb) {
+    LED_TYPE leds[RGBLED_NUM] = {{.r = rgb.r, .g = rgb.g, .b = rgb.b}};
+    ws2812_setleds(leds, RGBLED_NUM);
+}
+
+static void rgblite_increase_hue(void) {
+    static uint8_t state = 0;
+
+    HSV hsv = { 255, 255, 255 };
+    hsv.h = state;
+    state = (state + 8) % 256;
+
+    rgblite_setrgb(hsv_to_rgb(hsv));
+
+}

+ 2 - 0
keyboards/1k/keymaps/default/rules.mk

@@ -0,0 +1,2 @@
+SRC += ws2812.c
+SRC += color.c

+ 22 - 0
keyboards/1k/keymaps/media/keymap.c

@@ -0,0 +1,22 @@
+// Copyright 2022 Makoto Kurauchi (@MakotoKurauchi)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include QMK_KEYBOARD_H
+#include "rgblite.h"
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+  [0] = LAYOUT_ortho_1x1(
+    KC_MUTE
+  )
+};
+
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+  if (record->event.pressed) {
+    rgblite_increase_hue();
+  }
+  return true;
+}
+
+void keyboard_post_init_user(void) {
+  rgblite_increase_hue();
+}

+ 23 - 0
keyboards/1k/keymaps/media/rgblite.h

@@ -0,0 +1,23 @@
+// Copyright 2022 Makoto Kurauchi (@MakotoKurauchi)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "ws2812.h"
+#include "color.h"
+
+static inline void rgblite_setrgb(RGB rgb) {
+    LED_TYPE leds[RGBLED_NUM] = {{.r = rgb.r, .g = rgb.g, .b = rgb.b}};
+    ws2812_setleds(leds, RGBLED_NUM);
+}
+
+static void rgblite_increase_hue(void) {
+    static uint8_t state = 0;
+
+    HSV hsv = { 255, 255, 255 };
+    hsv.h = state;
+    state = (state + 8) % 256;
+
+    rgblite_setrgb(hsv_to_rgb(hsv));
+
+}

+ 3 - 0
keyboards/1k/keymaps/media/rules.mk

@@ -0,0 +1,3 @@
+SRC += ws2812.c
+SRC += color.c
+EXTRAKEY_ENABLE = yes

+ 6 - 0
keyboards/1k/keymaps/tap_dance/config.h

@@ -0,0 +1,6 @@
+// Copyright 2022 Makoto Kurauchi (@MakotoKurauchi)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#define TAPPING_TERM 500

+ 22 - 0
keyboards/1k/keymaps/tap_dance/keymap.c

@@ -0,0 +1,22 @@
+// Copyright 2022 Makoto Kurauchi (@MakotoKurauchi)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include QMK_KEYBOARD_H
+
+enum layers {
+  _BASE = 0,
+};
+
+enum {
+  TD_AB = 0
+};
+
+qk_tap_dance_action_t tap_dance_actions[] = {
+  [TD_AB]  = ACTION_TAP_DANCE_DOUBLE(KC_A, KC_B)
+};
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+  [_BASE] = LAYOUT_ortho_1x1(
+    TD(TD_AB)
+  )
+};

+ 1 - 0
keyboards/1k/keymaps/tap_dance/rules.mk

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

+ 47 - 0
keyboards/1k/readme.md

@@ -0,0 +1,47 @@
+# 1k
+
+![1k](https://booth.pximg.net/aaeb2dda-e169-44c0-ba5a-5b42cc5c2627/i/3504781/c1708a8a-061b-4a6c-907d-72d0eab47d4a.png)
+
+1% Custom mechanical keyboard. ATtiny85 powered, with 1*WS2812 LED, and the micronucleus bootloader.
+
+**Note**: Due to limited firmware space, a _**lot**_ of features have to be disabled to get a functioning QMK based keyboard.
+
+* Keyboard Maintainer: [MakotoKurauchi](https://github.com/MakotoKurauchi)
+* Hardware Supported: 1k
+* Hardware Availability: [booth](https://ninep.booth.pm/items/3504781)
+
+Make example for this keyboard (after setting up your build environment):
+
+    make 1k:default
+
+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).
+
+## Flashing
+### Prerequisites
+
+```bash
+git clone https://github.com/micronucleus/micronucleus.git
+cd micronucleus/commandline/
+sudo make install
+```
+
+On Linux, you’ll need proper privileges to access the MCU. You can either use sudo when flashing firmware, or place [these files](https://github.com/micronucleus/micronucleus/blob/master/commandline/49-micronucleus.rules) in /etc/udev/rules.d/. Once added run the following:
+
+```bash
+sudo udevadm control --reload-rules
+sudo udevadm trigger
+```
+
+### Instructions
+
+```bash
+make 1k:default:flash
+
+# or directly with...
+micronucleus --run <firmware.hex>
+```
+
+### Recovery
+
+* [Original Firmware](https://github.com/xiudi/Attiny85_vusb_pad_test)
+* [Bootloader Repair](https://digistump.com/wiki/digispark/tutorials/proisp)

+ 26 - 0
keyboards/1k/rules.mk

@@ -0,0 +1,26 @@
+# MCU name
+MCU = attiny85
+
+# Bootloader selection
+BOOTLOADER = custom
+BOOTLOADER_SIZE = 1862
+PROGRAM_CMD = micronucleus --run $(BUILD_DIR)/$(TARGET).hex
+
+# Build Options
+#   change yes to no to disable
+#
+BOOTMAGIC_ENABLE = no       # Enable Bootmagic Lite
+MOUSEKEY_ENABLE = no        # Mouse keys
+EXTRAKEY_ENABLE = no        # Audio control and System control
+CONSOLE_ENABLE = no         # Console for debug
+COMMAND_ENABLE = no         # Commands for debug and configuration
+NKRO_ENABLE = no            # Enable N-Key Rollover
+BACKLIGHT_ENABLE = no       # Enable keyboard backlight functionality
+RGBLIGHT_ENABLE = no        # Enable keyboard RGB underglow
+AUDIO_ENABLE = no           # Audio output
+
+# Save as much space as we can...
+LTO_ENABLE = yes
+GRAVE_ESC_ENABLE = no
+MAGIC_ENABLE = no
+SPACE_CADET_ENABLE = no