Skip to content

Commit

Permalink
[Keyboard] New kbd 1k (#15509)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
4 people authored Apr 19, 2022
1 parent 67329cf commit bdd1f31
Show file tree
Hide file tree
Showing 15 changed files with 321 additions and 0 deletions.
16 changes: 16 additions & 0 deletions keyboards/1k/1k.c
Original file line number Diff line number Diff line change
@@ -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 changes: 33 additions & 0 deletions keyboards/1k/1k.h
Original file line number Diff line number Diff line change
@@ -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 changes: 60 additions & 0 deletions keyboards/1k/config.h
Original file line number Diff line number Diff line change
@@ -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 changes: 12 additions & 0 deletions keyboards/1k/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"keyboard_name": "1k",
"url": "",
"maintainer": "MakotoKurauchi",
"layouts": {
"LAYOUT_ortho_1x1": {
"layout": [
{"x":0, "y":0}
]
}
}
}
25 changes: 25 additions & 0 deletions keyboards/1k/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
@@ -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 changes: 23 additions & 0 deletions keyboards/1k/keymaps/default/rgblite.h
Original file line number Diff line number Diff line change
@@ -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 changes: 2 additions & 0 deletions keyboards/1k/keymaps/default/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SRC += ws2812.c
SRC += color.c
22 changes: 22 additions & 0 deletions keyboards/1k/keymaps/media/keymap.c
Original file line number Diff line number Diff line change
@@ -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 changes: 23 additions & 0 deletions keyboards/1k/keymaps/media/rgblite.h
Original file line number Diff line number Diff line change
@@ -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 changes: 3 additions & 0 deletions keyboards/1k/keymaps/media/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SRC += ws2812.c
SRC += color.c
EXTRAKEY_ENABLE = yes
6 changes: 6 additions & 0 deletions keyboards/1k/keymaps/tap_dance/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Copyright 2022 Makoto Kurauchi (@MakotoKurauchi)
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

#define TAPPING_TERM 500
22 changes: 22 additions & 0 deletions keyboards/1k/keymaps/tap_dance/keymap.c
Original file line number Diff line number Diff line change
@@ -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 change: 1 addition & 0 deletions keyboards/1k/keymaps/tap_dance/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TAP_DANCE_ENABLE = yes
47 changes: 47 additions & 0 deletions keyboards/1k/readme.md
Original file line number Diff line number Diff line change
@@ -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 changes: 26 additions & 0 deletions keyboards/1k/rules.mk
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit bdd1f31

Please sign in to comment.