Merge remote-tracking branch 'origin/master' into develop

This commit is contained in:
QMK Bot 2022-03-07 03:28:12 +00:00
commit 45929ca657
11 changed files with 430 additions and 0 deletions

View file

@ -0,0 +1,47 @@
// Copyright 2022 Takuya Urakawa @hsgw (dm9records.com, 5z6p.com)
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "config_common.h"
/* USB Device descriptor parameter */
#define VENDOR_ID 0x04D8
#define PRODUCT_ID 0xE8F4
#define DEVICE_VER 0x0001
#define MANUFACTURER Dm9Records
#define PRODUCT lain
/* key matrix size */
#define MATRIX_ROWS 4
#define MATRIX_COLS 13
/*
* Keyboard Matrix Assignments
*/
#define MATRIX_ROW_PINS \
{ C6, D7, D6, D4 }
#define MATRIX_COL_PINS \
{ C7, F7, F6, F5, F4, F1, F0, B3, B2, B1, D2, D3, D5 }
/* COL2ROW, ROW2COL */
#define DIODE_DIRECTION COL2ROW
/* LED Settings */
#define LED_NUM 3
#define LED_PINS \
{ B6, B5, B4 }
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 5
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE
/* disable these deprecated features by default */
#define NO_ACTION_MACRO
#define NO_ACTION_FUNCTION
#define DYNAMIC_KEYMAP_LAYER_COUNT 6

View file

@ -0,0 +1,60 @@
{
"keyboard_name": "lain",
"url": "https://5z6p.com/lain",
"maintainer": "hsgw",
"layouts": {
"LAYOUT": {
"layout": [
{ "x": 0, "y": 0 },
{ "x": 1, "y": 0 },
{ "x": 2, "y": 0 },
{ "x": 3, "y": 0 },
{ "x": 4, "y": 0 },
{ "x": 5, "y": 0 },
{ "x": 6, "y": 0 },
{ "x": 8.5, "y": 0 },
{ "x": 9.5, "y": 0 },
{ "x": 10.5, "y": 0 },
{ "x": 11.5, "y": 0 },
{ "x": 12.5, "y": 0 },
{ "x": 13.5, "y": 0, "w": 1.5 },
{ "x": 0.25, "y": 1 },
{ "x": 1.25, "y": 1 },
{ "x": 2.25, "y": 1 },
{ "x": 3.25, "y": 1 },
{ "x": 4.25, "y": 1 },
{ "x": 5.25, "y": 1 },
{ "x": 6.25, "y": 1 },
{ "x": 8.75, "y": 1 },
{ "x": 9.75, "y": 1 },
{ "x": 10.75, "y": 1 },
{ "x": 11.75, "y": 1 },
{ "x": 12.75, "y": 1 },
{ "x": 13.75, "y": 1 },
{ "x": 0.5, "y": 2, "w": 1.25 },
{ "x": 1.75, "y": 2 },
{ "x": 2.75, "y": 2 },
{ "x": 3.75, "y": 2 },
{ "x": 4.75, "y": 2 },
{ "x": 5.75, "y": 2 },
{ "x": 8.25, "y": 2 },
{ "x": 9.25, "y": 2 },
{ "x": 10.25, "y": 2 },
{ "x": 11.25, "y": 2 },
{ "x": 12.25, "y": 2 },
{ "x": 13.25, "y": 2, "w": 1.25 },
{ "x": 1, "y": 3, "w": 1.75 },
{ "x": 2.75, "y": 3, "w": 1.25 },
{ "x": 4, "y": 3 },
{ "x": 5, "y": 3, "w": 1.25 },
{ "x": 6.25, "y": 3 },
{ "x": 7.75, "y": 3 },
{ "x": 8.75, "y": 3, "w": 1.25 },
{ "x": 10, "y": 3 },
{ "x": 11, "y": 3 },
{ "x": 12, "y": 3 },
{ "x": 13, "y": 3, "w": 1.25 }
]
}
}
}

View file

@ -0,0 +1,79 @@
// Copyright 2022 Takuya Urakawa @hsgw (dm9records.com, 5z6p.com)
// SPDX-License-Identifier: GPL-2.0-or-later
#include QMK_KEYBOARD_H
enum layers { BASE, NUM, FUNC, CONF };
enum custom_keycodes { LED_EN = SAFE_RANGE };
// clang-format off
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[BASE] = LAYOUT(
KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_LBRC, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_RBRC, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_INS, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH,
KC_LCTL, KC_LALT, KC_LGUI, MO(NUM), KC_SPC, KC_ENT, MO(FUNC), KC_RALT, KC_MENU, KC_RCTL, KC_RSFT
),
[NUM] = LAYOUT(
KC_DEL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL,
KC_CAPS, S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), S(KC_MINS),S(KC_EQL),
_______, _______, _______, _______, _______, _______, KC_PSCR, _______, _______, _______, _______, KC_BSLS,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
[FUNC] = LAYOUT(
KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,
_______, _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT,_______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
[CONF] = LAYOUT(
RESET, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
LED_EN, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
)
};
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case LED_EN:
if (record->event.pressed) {
lain_enable_leds_toggle();
}
return false;
default:
break;
}
return true;
}
// clang-format on
layer_state_t layer_state_set_user(layer_state_t state) {
layer_state_t computed = update_tri_layer_state(state, NUM, FUNC, CONF);
switch (get_highest_layer(computed)) {
case NUM:
lain_set_led(1, 1);
lain_set_led(2, 0);
break;
case FUNC:
lain_set_led(1, 0);
lain_set_led(2, 1);
break;
case CONF:
lain_set_led(1, 1);
lain_set_led(2, 1);
break;
default:
lain_set_led(1, 0);
lain_set_led(2, 0);
break;
}
return computed;
}
bool led_update_user(led_t led_state) {
lain_set_led(0, led_state.caps_lock);
return false;
}

View file

@ -0,0 +1,5 @@
# The default keymap for lain
## Leds setting
1: CAPS LOCK
2-3: Layor indicator

View file

@ -0,0 +1,90 @@
// Copyright 2022 Takuya Urakawa @hsgw (dm9records.com, 5z6p.com)
// SPDX-License-Identifier: GPL-2.0-or-later
#include QMK_KEYBOARD_H
enum layers { BASE, NUM, FUNC, CONF, _04, _05 };
// clang-format off
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[BASE] = LAYOUT(
KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_LBRC, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_RBRC, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_INS, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH,
KC_LCTL, KC_LALT, KC_LGUI, FN_MO13, KC_SPC, KC_ENT, FN_MO23, KC_RALT, KC_MENU, KC_RCTL, KC_RSFT
),
[NUM] = LAYOUT(
KC_DEL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL,
KC_CAPS, S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), S(KC_MINS),S(KC_EQL),
_______, _______, _______, _______, _______, _______, KC_PSCR, _______, _______, _______, _______, KC_BSLS,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
[FUNC] = LAYOUT(
KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,
_______, _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT,_______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
[CONF] = LAYOUT(
RESET, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
USER00, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
),
[_04] = LAYOUT(
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
),
[_05] = LAYOUT(
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
)
};
// clang-format on
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case USER00:
// via user keycode USER00 : toggle leds enable
if (record->event.pressed) {
lain_enable_leds_toggle();
}
return false;
default:
break;
}
return true;
}
layer_state_t layer_state_set_user(layer_state_t state) {
switch (get_highest_layer(state)) {
case NUM:
lain_set_led(1, 1);
lain_set_led(2, 0);
break;
case FUNC:
lain_set_led(1, 0);
lain_set_led(2, 1);
break;
case CONF:
lain_set_led(1, 1);
lain_set_led(2, 1);
break;
default:
lain_set_led(1, 0);
lain_set_led(2, 0);
break;
}
return state;
}
bool led_update_user(led_t led_state) {
lain_set_led(0, led_state.caps_lock);
return false;
}

View file

@ -0,0 +1,8 @@
# The via keymap for lain
## Leds setting
1: CAPS LOCK
2-3: Layor indicator
## Via user keycode
USER00 : toggle leds enable

View file

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

View file

@ -0,0 +1,49 @@
// Copyright 2022 Takuya Urakawa @hsgw (dm9records.com, 5z6p.com)
// SPDX-License-Identifier: GPL-2.0-or-later
#include "lain.h"
keyboard_config_t lain_config;
static const pin_t leds[LED_NUM] = LED_PINS;
bool led_states[LED_NUM] = {0};
void lain_eeconfig_update_kb(void) { eeconfig_update_kb(lain_config.raw); }
void lain_set_led(uint8_t no, bool flag) {
led_states[no] = flag;
writePin(leds[no], lain_config.led_enabled ? flag : false);
}
void lain_enable_leds(bool flag) {
lain_config.led_enabled = flag;
lain_eeconfig_update_kb();
for (int i = 0; i < LED_NUM; i++) {
writePin(leds[i], lain_config.led_enabled ? led_states[i] : false);
}
}
void lain_enable_leds_toggle(void) { lain_enable_leds(!lain_config.led_enabled); }
void led_init_ports(void) {
for (uint8_t i = 0; i < LED_NUM; i++) {
setPinOutput(leds[i]);
lain_set_led(leds[i], 0);
}
}
void eeconfig_init_kb(void) {
// set default config
lain_config.led_enabled = true;
lain_eeconfig_update_kb();
eeconfig_init_user();
}
void keyboard_post_init_kb(void) {
// read stored config
lain_config.raw = eeconfig_read_kb();
keyboard_post_init_user();
}

View file

@ -0,0 +1,41 @@
// Copyright 2022 Takuya Urakawa @hsgw (dm9records.com, 5z6p.com)
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "quantum.h"
typedef union {
uint32_t raw;
struct {
bool led_enabled : 1;
};
} keyboard_config_t;
extern keyboard_config_t lain_config;
void lain_set_led(uint8_t no, bool flag);
void lain_enable_leds(bool flag);
void lain_enable_leds_toggle(void);
/* This is 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.
*/
// clang-format off
#define LAYOUT( \
k01,k02,k03,k04,k05,k06,k07, k08,k09,k10,k11,k12,k13, \
k14,k15,k16,k17,k18,k19,k20, k21,k22,k23,k24,k25,k26, \
k27,k28,k29,k30,k31,k32, k33,k34,k35,k36,k37,k38, \
k39,k40,k41,k42,k43, k44,k45,k46,k47,k48,k49) \
{ \
{k01, k02, k03,k04,k05,k06,k07, k08,k09,k10,k11,k12,k13}, \
{k14, k15, k16,k17,k18,k19,k20, k21,k22,k23,k24,k25,k26}, \
{k27, k28, k29,k30,k31,k32,KC_NO, k33,k34,k35,k36,k37,k38}, \
{KC_NO,k39, k40,k41,k42,k43,KC_NO, k44,k45,k46,k47,k48,k49} \
}
// clang-format on

View file

@ -0,0 +1,32 @@
# lain
![lain](https://i.imgur.com/V0mR1Bgh.jpg)
Ergonomic 40% keyboard.
serial exprement lain themed.
licensed under #lainttl (https://www.nbcuni.co.jp/rondorobe/anime/lain/ttl/)
* Keyboard Maintainer: [Takuya Urakawa @hsgw](https://github.com/hsgw), https://5z6p.com
* Hardware Supported: onboard MCU.
* Hardware Availability: Group buy. (https://5z6p.com/products/lain/)
Make example for this keyboard (after setting up your build environment):
make dm9records/lain:default:flash
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).
## Note
### PCB revision
If your pcb is not Rev.1, you should use the firmware in below repository.
https://github.com/hsgw/qmk_firmware/tree/lain/keyboards/dm9records/lain
### Bootloader
Enter the bootloader in 3 ways:
* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard
* **Physical reset button**: Briefly press the button on the back of the PCB
* **Keycode in layout**: Press the key mapped to `RESET` if it is available

View file

@ -0,0 +1,18 @@
# MCU name
MCU = atmega32u4
# Bootloader selection
BOOTLOADER = atmel-dfu
# Build Options
# change yes to no to disable
#
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = no # Console for debug
COMMAND_ENABLE = no # Commands for debug and configuration
NKRO_ENABLE = yes # Enable N-Key Rollover
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
AUDIO_ENABLE = no # Audio output