Organize KPrepublic, K.T.E.C, xiudi boards into directories (#12159)

* reset; redoing my steps; and recommit

* include xd002/.noci
This commit is contained in:
peepeetee
2021-08-21 22:53:49 -05:00
committed by GitHub
parent c70abc8d04
commit 78ccd9c201
577 changed files with 0 additions and 0 deletions

View File

View File

@@ -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 0x7844 // "XD"
#define PRODUCT_ID 0x0202
#define DEVICE_VER 0x0001
#define MANUFACTURER XIUDI
#define PRODUCT XD002
/* matrix size */
#define MATRIX_ROWS 1
#define MATRIX_COLS 2
/*
* Keyboard Matrix Assignments
*
* On this board we have direct connection: no diodes.
*/
#define DIRECT_PINS {{ B0, B1 }}
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 5
#define RGBLED_NUM 2
#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

View File

@@ -0,0 +1,16 @@
{
"keyboard_name": "xd002",
"url": "https://kprepublic.com/products/xd002-xiudi-2-custom-mechanical-keyboard-2-keys-underglow-and-switch-rgb-pcb-programmed-hot-swappable-macro-key-aluminum-case",
"maintainer": "zvecr",
"width": 2,
"height": 1,
"layouts": {
"LAYOUT": {
"key_count": 2,
"layout": [
{"x":0, "y":0},
{"x":1, "y":0}
]
}
}
}

View File

@@ -0,0 +1,7 @@
#include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT(
KC_A, KC_B
)
};

View File

@@ -0,0 +1,22 @@
/* Copyright 2020 elmo-space<mail@elmo.space>
*
* 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
/*enable layers*/
#undef NO_ACTION_LAYER
/* increase tap duration (spotify doesn't like very short taps)*/
#define TAP_CODE_DELAY 100

View File

@@ -0,0 +1,173 @@
/* Copyright 2020 elmo-space<mail@elmo.space>
*
* 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 QMK_KEYBOARD_H
#include "rgblite.h"
// Defines names for use in layer keycodes and the keymap
enum layer_names {
_BASE,
_FUNC,
};
// set your keycodes here
#define layer1_left KC_PAUS
#define layer1_right KC_MPLY
#define layer2_left KC_MPRV
#define layer2_right KC_MNXT
enum custom_keycodes {
LEFT1 = SAFE_RANGE,
RIGHT1,
LEFT2,
RIGHT2
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_BASE] = LAYOUT(
LEFT1, RIGHT1
),
[_FUNC] = LAYOUT(
LEFT2, RIGHT2
)
};
static bool key1_down = false;
static bool key2_down = false;
static char layer_switched = 0; // this prevents the individual keys getting triggered after a layerchange
bool process_record_user(uint16_t keycode, keyrecord_t *record)
{
switch (keycode)
{
case LEFT1:
if (record->event.pressed)
{
if (key2_down)
{
layer_on(1);
layer_switched = 2;
return false;
break;
}
key1_down = true;
}
else {
if (layer_switched > 0) {
--layer_switched;
key1_down = false;
}
else {
tap_code(layer1_left);
key1_down = false;
}
}
return false;
break;
case RIGHT1:
if (record->event.pressed)
{
if (key1_down)
{
layer_on(1);
layer_switched = 2;
return false;
break;
}
key2_down = true;
}
else {
if (layer_switched > 0) {
--layer_switched;
key2_down = false;
}
else {
tap_code(layer1_right);
key2_down = false;
}
}
return false;
break;
case LEFT2:
if (record->event.pressed)
{
if (key2_down)
{
layer_off(1);
layer_switched = 2;
return false;
break;
}
key1_down = true;
}
else {
if (layer_switched > 0) {
--layer_switched;
key1_down = false;
}
else {
tap_code(layer2_left);
key1_down = false;
}
}
return false;
break;
case RIGHT2:
if (record->event.pressed)
{
if (key1_down)
{
layer_off(1);
layer_switched = 2;
return false;
break;
}
key2_down = true;
}
else {
if (layer_switched > 0) {
--layer_switched;
key2_down = false;
}
else {
tap_code(layer2_right);
key2_down = false;
}
}
return false;
break;
}
return true;
};
// layer colors
layer_state_t layer_state_set_user(layer_state_t state) {
switch (get_highest_layer(state)) {
case _FUNC:
rgblite_setrgb(RGB_RED);
break;
default: // for any other layers, or the default layer
rgblite_setrgb(RGB_GREEN);
break;
}
return state;
}
// default color
void keyboard_post_init_user(void) {
rgblite_setrgb(RGB_GREEN);
}

View File

@@ -0,0 +1,9 @@
#pragma once
#include "ws2812.h"
#include "color.h"
static inline void rgblite_setrgb(uint8_t _r, uint8_t _g, uint8_t _b) {
LED_TYPE leds[RGBLED_NUM] = {{.r = _r, .g = _g, .b = _b}, {.r = _r, .g = _g, .b = _b}};
ws2812_setleds(leds, RGBLED_NUM);
}

View File

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

View File

@@ -0,0 +1,46 @@
#include QMK_KEYBOARD_H
// Defines the keycodes used by our macros in process_record_user
enum custom_keycodes {
QMKURL = SAFE_RANGE,
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT(
RGB_HUI, QMKURL
)
};
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
switch (keycode) {
case QMKURL:
// Using SEND_STRING here adds 400bytes ...
// SEND_STRING("https://qmk.fm/" SS_TAP(X_ENTER));
tap_code(KC_H);
tap_code(KC_T);
tap_code(KC_T);
tap_code(KC_P);
tap_code(KC_S);
tap_code16(KC_COLON);
tap_code(KC_SLASH);
tap_code(KC_SLASH);
tap_code(KC_Q);
tap_code(KC_M);
tap_code(KC_K);
tap_code(KC_DOT);
tap_code(KC_F);
tap_code(KC_M);
tap_code(KC_SLASH);
tap_code(KC_ENTER);
break;
}
}
return true;
}
void keyboard_post_init_user(void) {
rgblight_enable_noeeprom(); // enables Rgb, without saving settings
rgblight_sethsv_noeeprom(180, 255, 255); // sets the color to teal/cyan without saving
rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); // sets mode to Fast breathing without saving
}

View File

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

View File

@@ -0,0 +1,31 @@
#include QMK_KEYBOARD_H
#include "rgblite.h"
// Defines the keycodes used by our macros in process_record_user
enum custom_keycodes {
QMKURL = SAFE_RANGE,
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT(
RGB_HUI, QMKURL
)
};
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
switch (keycode) {
case RGB_HUI:
rgblite_increase_hue();
break;
case QMKURL:
SEND_STRING("https://qmk.fm/" SS_TAP(X_ENTER));
break;
}
}
return true;
}
void keyboard_post_init_user(void) {
rgblite_increase_hue();
}

View File

@@ -0,0 +1,26 @@
#pragma once
#include "ws2812.h"
#include "color.h"
static inline void rgblite_setrgb(uint8_t _r, uint8_t _g, uint8_t _b) {
LED_TYPE leds[RGBLED_NUM] = {{.r = _r, .g = _g, .b = _b}, {.r = _r, .g = _g, .b = _b}};
ws2812_setleds(leds, RGBLED_NUM);
}
static void rgblite_increase_hue(void) {
static uint8_t state = 0;
state = (state + 1) % 3;
switch (state) {
case 1:
rgblite_setrgb(RGB_RED);
break;
case 2:
rgblite_setrgb(RGB_BLUE);
break;
default:
rgblite_setrgb(RGB_GREEN);
break;
}
}

View File

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

View File

@@ -0,0 +1,3 @@
#pragma once
#define TAPPING_TERM 500

View File

@@ -0,0 +1,19 @@
#include QMK_KEYBOARD_H
enum layers {
_BASE = 0,
};
enum {
TD_BC = 0
};
qk_tap_dance_action_t tap_dance_actions[] = {
[TD_BC] = ACTION_TAP_DANCE_DOUBLE(KC_B, KC_C)
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_BASE] = LAYOUT(
KC_A, TD(TD_BC)
)
};

View File

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

View File

@@ -0,0 +1,7 @@
#include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT(
KC_VOLU, KC_VOLD
)
};

View File

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

View File

@@ -0,0 +1,49 @@
# xd002
![xd002](https://cdn.shopify.com/s/files/1/2711/4238/products/xd002_1024x1024.jpg?v=1522134411)
2% Custom mechanical keyboard. ATtiny85 powered, with 2*WS2812 LEDs, 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: [zvecr](https://github.com/zvecr)
* Hardware Supported: xd002
* Hardware Availability: [kprepublic](https://kprepublic.com/products/xd002-xiudi-2-custom-mechanical-keyboard-2-keys-underglow-and-switch-rgb-pcb-programmed-hot-swappable-macro-key-aluminum-case)
Make example for this keyboard (after setting up your build environment):
make xd002: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, youll 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
**Reset Key**: Hold down key nearest to the USB socket while plugging in the keyboard.
```bash
make xd002: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)

View File

@@ -0,0 +1,31 @@
# MCU name
MCU = attiny85
# Bootloader selection
BOOTLOADER = micronucleus
OPT_DEFS += -DBOOTLOADER_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
# 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 on B7 by default
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
AUDIO_ENABLE = no # Audio output on port C6
# Save as much space as we can...
LTO_ENABLE = yes
GRAVE_ESC_ENABLE = no
MAGIC_ENABLE = no
SPACE_CADET_ENABLE = no

View File

@@ -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 "xd002.h"

View File

@@ -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( \
K01, K02 \
) \
{ \
{ K01, K02 }, \
}