From bdd1f318c3f4bcbf7f9dfeaff908013780bf753a Mon Sep 17 00:00:00 2001 From: MakotoKurauchi Date: Tue, 19 Apr 2022 19:39:43 +0900 Subject: [PATCH] [Keyboard] New kbd 1k (#15509) Co-authored-by: Drashna Jaelre Co-authored-by: mtei <2170248+mtei@users.noreply.github.com> Co-authored-by: Nick Brassel --- keyboards/1k/1k.c | 16 +++++++ keyboards/1k/1k.h | 33 ++++++++++++++ keyboards/1k/config.h | 60 +++++++++++++++++++++++++ keyboards/1k/info.json | 12 +++++ keyboards/1k/keymaps/default/keymap.c | 25 +++++++++++ keyboards/1k/keymaps/default/rgblite.h | 23 ++++++++++ keyboards/1k/keymaps/default/rules.mk | 2 + keyboards/1k/keymaps/media/keymap.c | 22 +++++++++ keyboards/1k/keymaps/media/rgblite.h | 23 ++++++++++ keyboards/1k/keymaps/media/rules.mk | 3 ++ keyboards/1k/keymaps/tap_dance/config.h | 6 +++ keyboards/1k/keymaps/tap_dance/keymap.c | 22 +++++++++ keyboards/1k/keymaps/tap_dance/rules.mk | 1 + keyboards/1k/readme.md | 47 +++++++++++++++++++ keyboards/1k/rules.mk | 26 +++++++++++ 15 files changed, 321 insertions(+) create mode 100644 keyboards/1k/1k.c create mode 100644 keyboards/1k/1k.h create mode 100644 keyboards/1k/config.h create mode 100644 keyboards/1k/info.json create mode 100644 keyboards/1k/keymaps/default/keymap.c create mode 100644 keyboards/1k/keymaps/default/rgblite.h create mode 100644 keyboards/1k/keymaps/default/rules.mk create mode 100644 keyboards/1k/keymaps/media/keymap.c create mode 100644 keyboards/1k/keymaps/media/rgblite.h create mode 100644 keyboards/1k/keymaps/media/rules.mk create mode 100644 keyboards/1k/keymaps/tap_dance/config.h create mode 100644 keyboards/1k/keymaps/tap_dance/keymap.c create mode 100644 keyboards/1k/keymaps/tap_dance/rules.mk create mode 100644 keyboards/1k/readme.md create mode 100644 keyboards/1k/rules.mk diff --git a/keyboards/1k/1k.c b/keyboards/1k/1k.c new file mode 100644 index 00000000000..0e8f44b44d1 --- /dev/null +++ b/keyboards/1k/1k.c @@ -0,0 +1,16 @@ +/* Copyright 2020 zvecr + * + * 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 "1k.h" diff --git a/keyboards/1k/1k.h b/keyboards/1k/1k.h new file mode 100644 index 00000000000..a6142bc5c52 --- /dev/null +++ b/keyboards/1k/1k.h @@ -0,0 +1,33 @@ +/* Copyright 2020 zvecr + * + * 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 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 }, \ +} diff --git a/keyboards/1k/config.h b/keyboards/1k/config.h new file mode 100644 index 00000000000..be680b41944 --- /dev/null +++ b/keyboards/1k/config.h @@ -0,0 +1,60 @@ +/* Copyright 2020 zvecr + * + * 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 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<event.pressed) { + switch (keycode) { + case RGB_HUI: + rgblite_increase_hue(); + break; + } + } + return true; +} + +void keyboard_post_init_user(void) { + rgblite_increase_hue(); +} diff --git a/keyboards/1k/keymaps/default/rgblite.h b/keyboards/1k/keymaps/default/rgblite.h new file mode 100644 index 00000000000..e64f49ee0aa --- /dev/null +++ b/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)); + +} diff --git a/keyboards/1k/keymaps/default/rules.mk b/keyboards/1k/keymaps/default/rules.mk new file mode 100644 index 00000000000..ff480ff890a --- /dev/null +++ b/keyboards/1k/keymaps/default/rules.mk @@ -0,0 +1,2 @@ +SRC += ws2812.c +SRC += color.c diff --git a/keyboards/1k/keymaps/media/keymap.c b/keyboards/1k/keymaps/media/keymap.c new file mode 100644 index 00000000000..6fd3eb92dea --- /dev/null +++ b/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(); +} diff --git a/keyboards/1k/keymaps/media/rgblite.h b/keyboards/1k/keymaps/media/rgblite.h new file mode 100644 index 00000000000..e64f49ee0aa --- /dev/null +++ b/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)); + +} diff --git a/keyboards/1k/keymaps/media/rules.mk b/keyboards/1k/keymaps/media/rules.mk new file mode 100644 index 00000000000..23687276408 --- /dev/null +++ b/keyboards/1k/keymaps/media/rules.mk @@ -0,0 +1,3 @@ +SRC += ws2812.c +SRC += color.c +EXTRAKEY_ENABLE = yes diff --git a/keyboards/1k/keymaps/tap_dance/config.h b/keyboards/1k/keymaps/tap_dance/config.h new file mode 100644 index 00000000000..5df7869537e --- /dev/null +++ b/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 diff --git a/keyboards/1k/keymaps/tap_dance/keymap.c b/keyboards/1k/keymaps/tap_dance/keymap.c new file mode 100644 index 00000000000..c2a8cf1aeab --- /dev/null +++ b/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) + ) +}; diff --git a/keyboards/1k/keymaps/tap_dance/rules.mk b/keyboards/1k/keymaps/tap_dance/rules.mk new file mode 100644 index 00000000000..e5ddcae8d92 --- /dev/null +++ b/keyboards/1k/keymaps/tap_dance/rules.mk @@ -0,0 +1 @@ +TAP_DANCE_ENABLE = yes diff --git a/keyboards/1k/readme.md b/keyboards/1k/readme.md new file mode 100644 index 00000000000..8c44c3549db --- /dev/null +++ b/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 +``` + +### Recovery + +* [Original Firmware](https://github.com/xiudi/Attiny85_vusb_pad_test) +* [Bootloader Repair](https://digistump.com/wiki/digispark/tutorials/proisp) diff --git a/keyboards/1k/rules.mk b/keyboards/1k/rules.mk new file mode 100644 index 00000000000..b3bd401f6ba --- /dev/null +++ b/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