forked from vial-kb/vial-qmk
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
45 changed files
with
3,978 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
|
||
#pragma once | ||
|
||
#include "config_common.h" | ||
#include "config_ble51.h" | ||
|
||
/* USB Device descriptor parameter */ | ||
#define FW_VER_DATE DO6M | ||
#define VENDOR_ID 0x9D5B | ||
#define PRODUCT_ID 0x21A0 | ||
#define DEVICE_VER 0x0001 | ||
#define MANUFACTURER YDKB | ||
#define PRODUCT Xikii i104 (FW_VER) | ||
|
||
|
||
/* key matrix size */ | ||
#define MATRIX_ROWS 13 | ||
#define MATRIX_COLS 8 | ||
|
||
#define DEFAULT_6KRO // macOS's Capslock switching between Chinese and English has compatibility issues with NKRO | ||
|
||
#define SUSPEND_ACTION | ||
|
||
#define BACKLIGHT_PIN C6 | ||
#define BACKLIGHT_LEVELS 6 | ||
#define BACKLIGHT_ON_STATE 0 | ||
|
||
#define ws2812_PORTREG PORTD | ||
#define ws2812_DDRREG DDRD | ||
#define ws2812_pin PD1 | ||
#define RGBLED_NUM 12 // Number of LEDs | ||
|
||
/* BT Power Control */ | ||
#define BT_POWERED (~PORTD & (1<<5)) | ||
#define bt_power_init() do { DDRD |= (1<<5); PORTD &= ~(1<<5); } while(0) | ||
#define bt_power_reset() do {PORTD |= (1<<5); WAIT_MS(100); PORTD &= ~(1<<5);} while(0) | ||
#define turn_off_bt() do { PORTD |= (1<<5); UCSR1B = (1<<RXCIE1 | 1<<RXEN1); } while(0) | ||
#define turn_on_bt() do { PORTD &= ~(1<<5); if (UCSR1B == (1<<RXCIE1 | 1<<RXEN1)) WAIT_MS(200); UCSR1B = (1<<RXCIE1 | 1<<RXEN1 | 1<<TXEN1); } while(0) | ||
|
||
#define BLE_NAME "Xikii i104 BLE" | ||
#define BLE_LIGHT_ON (~PORTD & (1<<0)) //RGB Power IO | ||
#define HARDWARE_BT_SWITCH | ||
|
||
#define UPDATE_BATTERY_WHEN_CHARGING | ||
#define BATTERY_CHARGING (~PINC & (1<<7)) | ||
#define CHARGING_FIX_VALUE 90 | ||
#define CHARGING_STATE_INIT() do { DDRC &= ~(1<<7); PORTC |= (1<<7);} while(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#pragma once | ||
#undef PRODUCT | ||
#define PRODUCT Xikii_i104 (FW_VER) | ||
#define DYNAMIC_KEYMAP_LAYER_COUNT 3 | ||
#define FLASH_KEYMAP_COUNT 1 | ||
#define VIAL_KEYBOARD_UID {0x2E, 0xE6, 0x0E, 0x23, 0x34, 0xEF, 0x99, 0x37} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include QMK_KEYBOARD_H | ||
|
||
enum user_keycode { | ||
BT_USB = USER00, | ||
KB_RESET, | ||
BATT_LEVEL, | ||
LOCK_MODE, | ||
RGB_Toogle, | ||
RGB_Mode_DN, | ||
RGB_Mode_UP, | ||
RGB_HUE_DN, | ||
RGB_HUE_UP, | ||
RGB_SAT_DN, | ||
RGB_SAT_UP, | ||
RGB_LUM_DN, | ||
RGB_LUM_UP, | ||
}; | ||
|
||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
{ | ||
{KC_PAUSE, KC_KP_MINUS, KC_KP_PLUS, KC_KP_ENTER, KC_KP_3, KC_KP_6, KC_KP_9, KC_KP_ASTERISK}, | ||
{KC_SCROLLLOCK, KC_KP_SLASH, KC_KP_8, KC_KP_5, KC_KP_2, KC_KP_DOT, KC_KP_0, KC_NUMLOCK}, | ||
{KC_PSCREEN, KC_KP_7, KC_KP_4, KC_KP_1, KC_RIGHT, KC_PGDOWN, KC_END, KC_PGUP}, | ||
{KC_F12, KC_HOME, KC_UP, KC_DOWN, KC_LEFT, KC_RCTRL, KC_DELETE, KC_INSERT}, | ||
{KC_F11, KC_BSLASH, KC_ENTER, KC_RSHIFT, MO(1), KC_BSPACE, KC_RBRACKET, KC_LBRACKET}, | ||
{KC_F10, KC_EQUAL, KC_QUOTE, KC_RGUI, KC_SLASH, KC_SCOLON, KC_P, KC_MINUS}, | ||
{KC_F8, KC_F9, KC_0, KC_O, KC_L, KC_DOT, KC_RALT, KC_COMMA}, | ||
{KC_F7, KC_9, KC_I, KC_K, KC_M, KC_J, KC_U, KC_8}, | ||
{KC_F5, KC_F6, KC_7, KC_Y, KC_H, KC_N, KC_B, KC_6}, | ||
{KC_F4, KC_T, KC_G, KC_SPACE, KC_V, KC_F, KC_R, KC_5}, | ||
{KC_F3, KC_C, KC_4, KC_E, KC_D, KC_X, KC_S, KC_W}, | ||
{KC_F2, KC_3, KC_Z, KC_LALT, KC_A, KC_Q, KC_2, KC_F1}, | ||
{KC_ESCAPE, KC_1, KC_LGUI, KC_LCTRL, KC_LSHIFT, KC_CAPSLOCK, KC_TAB, KC_GRAVE} | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Changelog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
VIA_ENABLE = yes | ||
VIAL_ENABLE = yes | ||
VIAL_INSECURE = yes | ||
QMK_SETTINGS = no | ||
TAP_DANCE_ENABLE = yes | ||
COMBO_ENABLE = no | ||
KEY_OVERRIDE_ENABLE = no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"lighting": "none", | ||
"matrix": {"rows": 13, "cols": 8}, | ||
"customKeycodes": [ | ||
{"name": "BT/USB", "title": "", "shortName": "BT/USB"}, | ||
{"name": "RESET", "title": "", "shortName": "RESET"}, | ||
{"name": "BAT%", "title": "", "shortName": "BAT%"}, | ||
{"name": "LkMode", "title": "", "shortName": "LkMode"}, | ||
{"name": "RGB_TG", "title": "", "shortName": "RGB_TG"}, | ||
{"name": "RGB_M-", "title": "", "shortName": "Mode-"}, | ||
{"name": "RGB_M+", "title": "", "shortName": "Mode+"}, | ||
{"name": "HUE-", "title": "", "shortName": "HUE-"}, | ||
{"name": "HUE+", "title": "", "shortName": "HUE+"}, | ||
{"name": "SAT-", "title": "", "shortName": "SAT-"}, | ||
{"name": "SAT+", "title": "", "shortName": "SAT+"}, | ||
{"name": "LUM-", "title": "", "shortName": "LUM-"}, | ||
{"name": "LUM+", "title": "", "shortName": "LUM+"} | ||
], | ||
"layouts": { | ||
"labels":[["Bottom Row", "WK", "WKL1", "WKL2"]], | ||
"keymap": [ | ||
[{"c":"#777777"},"12,0",{"x":1,"c":"#cccccc"},"11,7","11,0","10,0","9,0",{"x":0.5,"c":"#aaaaaa"},"8,0","8,1","7,0","6,0",{"x":0.5,"c":"#cccccc"},"6,1","5,0","4,0","3,0",{"x":0.25,"c":"#aaaaaa"},"2,0","1,0","0,0"], | ||
[{"y":0.5,"c":"#cccccc"},"12,7","12,1","11,6","11,1","10,2","9,7","8,7","8,2","7,7","7,1","6,2","5,7","5,1",{"c":"#aaaaaa","w":2},"4,5",{"x":0.25},"3,7","3,1","2,7",{"x":0.25},"1,7","1,1","0,7","0,1"], | ||
[{"w":1.5},"12,6",{"c":"#cccccc"},"11,5","10,7","10,3","9,6","9,1","8,3","7,6","7,2","6,3","5,6","4,7","4,6",{"w":1.5},"4,1",{"x":0.25,"c":"#aaaaaa"},"3,6","2,6","2,5",{"x":0.25,"c":"#cccccc"},"2,1","1,2","0,6",{"c":"#aaaaaa","h":2},"0,2"], | ||
[{"w":1.75},"12,5",{"c":"#cccccc"},"11,4","10,6","10,4","9,5","9,2","8,4","7,5","7,3","6,4","5,5","5,2",{"c":"#777777","w":2.25},"4,2",{"x":3.5,"c":"#cccccc"},"2,2","1,3","0,5"], | ||
[{"c":"#aaaaaa","w":2.25},"12,4",{"c":"#cccccc"},"11,2","10,5","10,1","9,4","8,6","8,5","7,4","6,7","6,5","5,4",{"c":"#aaaaaa","w":2.75},"4,3",{"x":1.25},"3,2",{"x":1.25,"c":"#cccccc"},"2,3","1,4","0,4",{"c":"#aaaaaa","h":2},"0,3"], | ||
[{"w":1.25},"12,3\n\n\n0,0",{"w":1.25},"12,2\n\n\n0,0",{"w":1.25},"11,3\n\n\n0,0",{"c":"#cccccc","w":6.25},"9,3\n\n\n0,0",{"c":"#aaaaaa","w":1.25},"6,6\n\n\n0,0",{"w":1.25},"5,3\n\n\n0,0",{"w":1.25},"4,4\n\n\n0,0",{"w":1.25},"3,5\n\n\n0,0",{"x":0.25},"3,4","3,3","2,4",{"x":0.25,"c":"#cccccc","w":2},"1,6","1,5"], | ||
[{"y":0.25,"c":"#aaaaaa","w":1.5},"12,3\n\n\n0,1","12,2\n\n\n0,1",{"w":1.5},"11,3\n\n\n0,1",{"c":"#cccccc","w":7},"9,3\n\n\n0,1",{"c":"#aaaaaa","w":1.5},"5,3\n\n\n0,1","4,4\n\n\n0,1",{"w":1.5},"3,5\n\n\n0,1"], | ||
[{"w":1.5},"12,3\n\n\n0,2",{"x":1,"w":1.5},"11,3\n\n\n0,2",{"c":"#cccccc","w":7},"9,3\n\n\n0,2",{"c":"#aaaaaa","w":1.5},"5,3\n\n\n0,2",{"x":1,"w":1.5},"3,5\n\n\n0,2"] | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
Copyright 2022 YANG | ||
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 <avr/io.h> | ||
#include "quantum.h" | ||
#include "stdint.h" | ||
#include "led.h" | ||
#include "via.h" | ||
#include "command.h" | ||
#include "ble51.h" | ||
#include "rgblight.h" | ||
|
||
void led_fn_init(void) { | ||
// led init | ||
DDRD |= (1<<7 | 1<<6 | 1<<4); | ||
PORTD &= ~(1<<7 | 1<<6 | 1<<4); | ||
} | ||
|
||
void led_set_user(uint8_t usb_led) | ||
{ | ||
if (usb_led & (1<<USB_LED_NUM_LOCK)) { | ||
PORTD |= (1<<7); | ||
} else { | ||
PORTD &= ~(1<<7); | ||
} | ||
|
||
if (usb_led & (1<<USB_LED_CAPS_LOCK)) { | ||
PORTD |= (1<<6); | ||
} else { | ||
PORTD &= ~(1<<6); | ||
} | ||
|
||
if (usb_led & (1<<USB_LED_SCROLL_LOCK)) { | ||
PORTD |= (1<<4); | ||
} else { | ||
// output low | ||
PORTD &= ~(1<<4); | ||
} | ||
} | ||
|
||
void post_process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
if (record->event.pressed) { | ||
switch (keycode) { | ||
case USER00: | ||
command_extra(KC_U); | ||
break; | ||
case USER01: //RESET | ||
command_extra(KC_B); | ||
break; | ||
case USER02: //BATTERY LEVEL | ||
command_extra(KC_V); | ||
break; | ||
case USER03: //LOCK MODE | ||
command_extra(KC_L); | ||
break; | ||
case USER04 ... USER12: | ||
rgblight_action(keycode - USER04); | ||
break; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
/* | ||
* light weight WS2812 lib V2.0b | ||
* | ||
* Controls WS2811/WS2812/WS2812B RGB-LEDs | ||
* Author: Tim ([email protected]) | ||
* | ||
* Jan 18th, 2014 v2.0b Initial Version | ||
* | ||
* License: GNU GPL v2 (see License.txt) | ||
*/ | ||
|
||
#include "light_ws2812.h" | ||
#include <avr/interrupt.h> | ||
#include <avr/io.h> | ||
#include <util/delay.h> | ||
|
||
void ws2812_setleds(struct cRGB *ledarray) | ||
{ | ||
ws2812_DDRREG |= _BV(ws2812_pin); // Enable DDR | ||
ws2812_sendarray_mask((uint8_t *)(ledarray), _BV(ws2812_pin)); | ||
//_delay_us(50); | ||
} | ||
|
||
|
||
// Timing in ns | ||
#define w_zeropulse 350 | ||
#define w_onepulse 900 | ||
#define w_totalperiod 1250 | ||
|
||
// Fixed cycles used by the inner loop | ||
#define w_fixedlow 2 | ||
#define w_fixedhigh 4 | ||
#define w_fixedtotal 8 | ||
|
||
// Insert NOPs to match the timing, if possible | ||
#define w_zerocycles (((F_CPU/1000)*w_zeropulse )/1000000) | ||
#define w_onecycles (((F_CPU/1000)*w_onepulse +500000)/1000000) | ||
#define w_totalcycles (((F_CPU/1000)*w_totalperiod +500000)/1000000) | ||
|
||
// w1 - nops between rising edge and falling edge - low | ||
#define w1 (w_zerocycles-w_fixedlow) | ||
// w2 nops between fe low and fe high | ||
#define w2 (w_onecycles-w_fixedhigh-w1) | ||
// w3 nops to complete loop | ||
#define w3 (w_totalcycles-w_fixedtotal-w1-w2) | ||
|
||
#if w1>0 | ||
#define w1_nops w1 | ||
#else | ||
#define w1_nops 0 | ||
#endif | ||
|
||
// The only critical timing parameter is the minimum pulse length of the "0" | ||
// Warn or throw error if this timing can not be met with current F_CPU settings. | ||
#define w_lowtime ((w1_nops+w_fixedlow)*1000000)/(F_CPU/1000) | ||
#if w_lowtime>550 | ||
#error "Light_ws2812: Sorry, the clock speed is too low. Did you set F_CPU correctly?" | ||
#elif w_lowtime>450 | ||
#warning "Light_ws2812: The timing is critical and may only work on WS2812B, not on WS2812(S)." | ||
#warning "Please consider a higher clockspeed, if possible" | ||
#endif | ||
|
||
#if w2>0 | ||
#define w2_nops w2 | ||
#else | ||
#define w2_nops 0 | ||
#endif | ||
|
||
#if w3>0 | ||
#define w3_nops w3 | ||
#else | ||
#define w3_nops 0 | ||
#endif | ||
|
||
#define w_nop1 "nop \n\t" | ||
#define w_nop2 "rjmp .+0 \n\t" | ||
#define w_nop4 w_nop2 w_nop2 | ||
#define w_nop8 w_nop4 w_nop4 | ||
#define w_nop16 w_nop8 w_nop8 | ||
|
||
void ws2812_sendarray_mask(uint8_t *data ,uint8_t maskhi) | ||
{ | ||
uint8_t curbyte,ctr,masklo; | ||
uint8_t sreg_prev; | ||
uint8_t datlen = RGBLED_NUM*3; | ||
|
||
masklo =~maskhi&ws2812_PORTREG; | ||
maskhi |= ws2812_PORTREG; | ||
sreg_prev=SREG; | ||
cli(); | ||
|
||
while (datlen--) { | ||
curbyte=*data++; | ||
|
||
asm volatile( | ||
" ldi %0,8 \n\t" | ||
"loop%=: \n\t" | ||
" out %2,%3 \n\t" // '1' [01] '0' [01] - re | ||
#if (w1_nops&1) | ||
w_nop1 | ||
#endif | ||
#if (w1_nops&2) | ||
w_nop2 | ||
#endif | ||
#if (w1_nops&4) | ||
w_nop4 | ||
#endif | ||
#if (w1_nops&8) | ||
w_nop8 | ||
#endif | ||
#if (w1_nops&16) | ||
w_nop16 | ||
#endif | ||
" sbrs %1,7 \n\t" // '1' [03] '0' [02] | ||
" out %2,%4 \n\t" // '1' [--] '0' [03] - fe-low | ||
" lsl %1 \n\t" // '1' [04] '0' [04] | ||
#if (w2_nops&1) | ||
w_nop1 | ||
#endif | ||
#if (w2_nops&2) | ||
w_nop2 | ||
#endif | ||
#if (w2_nops&4) | ||
w_nop4 | ||
#endif | ||
#if (w2_nops&8) | ||
w_nop8 | ||
#endif | ||
#if (w2_nops&16) | ||
w_nop16 | ||
#endif | ||
" out %2,%4 \n\t" // '1' [+1] '0' [+1] - fe-high | ||
#if (w3_nops&1) | ||
w_nop1 | ||
#endif | ||
#if (w3_nops&2) | ||
w_nop2 | ||
#endif | ||
#if (w3_nops&4) | ||
w_nop4 | ||
#endif | ||
#if (w3_nops&8) | ||
w_nop8 | ||
#endif | ||
#if (w3_nops&16) | ||
w_nop16 | ||
#endif | ||
|
||
" dec %0 \n\t" // '1' [+2] '0' [+2] | ||
" brne loop%=\n\t" // '1' [+3] '0' [+4] | ||
: "=&d" (ctr) | ||
: "r" (curbyte), "I" (_SFR_IO_ADDR(ws2812_PORTREG)), "r" (maskhi), "r" (masklo) | ||
); | ||
} | ||
|
||
SREG=sreg_prev; | ||
} |
Oops, something went wrong.