[Keyboard] new keyboard lovelive9 (#5266)

* new keyboard lovelive9

* Update keyboards/lovelive9/config.h

thank you

Co-Authored-By: ginjake <hsginjake123@gmail.com>

* Apply suggestions from code review

Co-Authored-By: ginjake <hsginjake123@gmail.com>

* fix review

* fix readme

* move handwired

* Update keyboards/handwired/lovelive9/keymaps/default/keymap.c

thanks

Co-Authored-By: ginjake <hsginjake123@gmail.com>

* Apply suggestions from code review

commit suggestion

Co-Authored-By: ginjake <hsginjake123@gmail.com>

* fix spell miss

* fix review

* fix col and row

* fix layout define
master
ginjake 2019-03-15 07:54:16 +09:00 committed by Drashna Jaelre
parent 577e99f195
commit c025d813ba
7 changed files with 486 additions and 0 deletions

View File

@ -0,0 +1,39 @@
#pragma once
#include "config_common.h"
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x0007
#define DEVICE_VER 0x0001
#define MANUFACTURER numazu Keyboards
#define PRODUCT lovelive9
#define DESCRIPTION lovelive sunshine Keyboards 9Key
/* key matrix size */
#define MATRIX_ROWS 1
#define MATRIX_COLS 9
/* default pin-out */
#define MATRIX_ROW_PINS { NO_PIN }
#define MATRIX_COL_PINS { B4, B6, B2, D7, B1, F7, F6, F5, F4 }
#define UNUSED_PINS
/* ws2812 RGB LED */
#define RGB_DI_PIN D3
#define RGBLED_NUM 9 // Number of LEDs
#define RGBLIGHT_ANIMATIONS
#define BACKLIGHT_LEVELS 5
#define RGBLIGHT_EFFECT_SNAKE_LENGTH 4
#define BREATHING_PERIOD 2
#define RGBLIGHT_LIMIT_VAL 255
#define RGBLIGHT_HUE_STEP 10
#define RGBLIGHT_SAT_STEP 17
#define RGBLIGHT_VAL_STEP 17
#define USB_MAX_POWER_CONSUMPTION 400
#define TAPPING_TERM 200

View File

@ -0,0 +1,12 @@
{
"keyboard_name": "lovelive9",
"url": "https://github.com/ginjake",
"maintainer": "ginjake",
"width": 9,
"height": 1,
"layouts": {
"LAYOUT": {
"layout": [{"label":"k00", "x":0, "y":0}, {"label":"k01", "x":1, "y":0}, {"label":"k02", "x":2, "y":0}, {"label":"k03", "x":3, "y":0}, {"label":"k04", "x":4, "y":0}, {"label":"k05", "x":5, "y":0}, {"label":"k06", "x":6, "y":0}, {"label":"k07", "x":7, "y":0}, {"label":"k08", "x":8, "y":0}]
}
}
}

View File

@ -0,0 +1,338 @@
#include QMK_KEYBOARD_H
//#include "v1.h"
//Following line allows macro to read current RGB settings
rgblight_config_t RGB_current_config;
#define KC_KANJI KC_GRV
enum Layer
{
_QWERTY,
_DIA,
_YOU,
_CHIKA,
_ZURA,
_RUBY,
_YOHANE,
_RIKO,
_MARI,
_KANAN,
_RUBY_SUB1,
_RUBY_SUB2,
_RUBY_SUB3,
_SCHOOL_IDOL_FESTIVAL
};
#define SEND_DIA 100
#define SEND_YOU 101
#define SEND_CHIKA 102
#define SEND_ZURA 103
#define SEND_RUBY 104
#define SEND_YOHANE 105
#define SEND_RIKO 106
#define SEND_MARI 107
#define SEND_KANAN 108
enum custom_keycodes {
QWERTY = SAFE_RANGE,
DIA,
YOU,
CHIKA,
ZURA,
RUBY,
RUBY_SUB1,
RUBY_SUB2,
RUBY_SUB3,
YOHANE,
RIKO,
MARI,
KANAN,
TO_SCHOOL_IDOL_FESTIVAL,
RETURN_SCHOOL_IDOL_FESTIVAL
};
int long_tap_timer;
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_QWERTY] = LAYOUT(
DIA, YOU, CHIKA, ZURA, RUBY, YOHANE, RIKO, MARI, KANAN
),
[_DIA] = LAYOUT(
DIA, KC_A, KC_B, KC_C, KC_D, KC_E, KC_F, KC_G, KC_LSFT
),
[_YOU] = LAYOUT(
KC_H, YOU, KC_I, KC_J, KC_K, KC_L, KC_M, KC_N, KC_LSFT
),
[_CHIKA] = LAYOUT(
KC_O, KC_P, CHIKA, KC_Q, KC_R, KC_S, KC_T, KC_U, KC_LSFT
),
[_ZURA] = LAYOUT(
KC_V, KC_W, KC_X, ZURA, KC_Y, KC_Z, KC_M, KC_N, KC_LSFT
),
//推しをたくさん押せるようにルビーちゃんには複数のレイヤー設定
[_RUBY] = LAYOUT(
KC_CIRC, KC_LPRN, KC_QUOT, RUBY_SUB1, RUBY, RUBY_SUB2, KC_LCBR, KC_EXLM, KC_LSFT
),
[_RUBY_SUB1] = LAYOUT(
KC_RCBR, KC_AT, KC_PIPE, RUBY_SUB1, RUBY, RUBY_SUB2, KC_HASH, KC_EQL, KC_LSFT
),
[_RUBY_SUB2] = LAYOUT(
KC_TILD, KC_DLR, KC_LBRC, RUBY_SUB1, RUBY, RUBY_SUB2, KC_PERC, KC_RBRC, KC_LSFT
),
[_RUBY_SUB3] = LAYOUT(
TO_SCHOOL_IDOL_FESTIVAL, KC_DLR, KC_LBRC, RUBY_SUB1, RUBY, RUBY_SUB2, KC_PERC, KC_RBRC, RETURN_SCHOOL_IDOL_FESTIVAL
),
[_YOHANE] = LAYOUT(
KC_0, KC_1, KC_2, KC_3, KC_4, YOHANE, KC_5, KC_6, KC_LSFT
),
[_RIKO] = LAYOUT(
KC_7, KC_8, KC_9, KC_PLUS, KC_MINS, KC_ASTR, RIKO, KC_SLSH, KC_LSFT
),
[_MARI] = LAYOUT(
KC_TAB, KC_DEL, KC_COMM, KC_SPC, KC_ENT, KC_BSPC, KC_DOT, MARI, KC_LSFT
),
[_KANAN] = LAYOUT(
KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_ENT, KC_BSPC, KC_AMPR, KC_KANJI, KANAN
),
[_SCHOOL_IDOL_FESTIVAL] = LAYOUT(
KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9
),
};
void check_tap_and_send_key(int MEMBER) {
if (long_tap_timer < 500) {
switch (MEMBER) {
case SEND_DIA:
SEND_STRING("KUROSAWA DIA");
break;
case SEND_YOU:
SEND_STRING("WATANABE YOU");
break;
case SEND_CHIKA:
SEND_STRING("TAKAMI CHIKA");
break;
case SEND_ZURA:
SEND_STRING("KUNIKIDA HANAMARU");
break;
case SEND_RUBY:
SEND_STRING("KUROSAWA RUBY");
break;
case SEND_YOHANE:
SEND_STRING("TSUSHIMA YOSHIKO");
break;
case SEND_RIKO:
SEND_STRING("SAKURAUCHI RIKO");
break;
case SEND_MARI:
SEND_STRING("OHARA MARI");
break;
case SEND_KANAN:
SEND_STRING("MATSUURA KANAN");
break;
}
}
long_tap_timer = 0;
}
int aqours_color_h[] = { 26, 340, 150, 0, 199, 220, 53, 265, 322};
int aqours_color_s[] = {255, 165, 255, 255, 255, 350, 255, 255, 255};
int aqours_color_v[] = {255, 255, 255, 255, 255, 255, 200, 255, 255};
void LED_default_set(void) {
sethsv(aqours_color_h[2], aqours_color_s[2], aqours_color_v[2], (LED_TYPE *)&led[0]);
sethsv(aqours_color_h[7], aqours_color_s[7], aqours_color_v[7], (LED_TYPE *)&led[1]);
sethsv(aqours_color_h[1], aqours_color_s[1], aqours_color_v[1], (LED_TYPE *)&led[2]);
sethsv(aqours_color_h[5], aqours_color_s[5], aqours_color_v[5], (LED_TYPE *)&led[3]);
sethsv(aqours_color_h[8], aqours_color_s[8], aqours_color_v[8], (LED_TYPE *)&led[4]);
sethsv(aqours_color_h[6], aqours_color_s[6], aqours_color_v[6], (LED_TYPE *)&led[5]);
sethsv(aqours_color_h[0], aqours_color_s[0], aqours_color_v[0], (LED_TYPE *)&led[6]);
sethsv(aqours_color_h[4], aqours_color_s[4], aqours_color_v[4], (LED_TYPE *)&led[7]);
sethsv(aqours_color_h[3], aqours_color_s[3], aqours_color_v[3], (LED_TYPE *)&led[8]);
rgblight_set();
}
void LED_layer_set(int aqours_index) {
for (int c = 0; c < 9; c++) {
sethsv(aqours_color_h[aqours_index], aqours_color_s[aqours_index], aqours_color_v[aqours_index], (LED_TYPE *)&led[c]);
}
rgblight_set();
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case DIA:
if (record->event.pressed) {
long_tap_timer = 1;
layer_on(_DIA);
LED_layer_set(3);
} else {
check_tap_and_send_key(SEND_DIA);
layer_off(_DIA);
LED_default_set();
}
break;
case YOU:
if (record->event.pressed) {
long_tap_timer = 1;
layer_on(_YOU);
LED_layer_set(4);
} else {
check_tap_and_send_key(SEND_YOU);
layer_off(_YOU);
LED_default_set();
}
break;
case CHIKA:
if (record->event.pressed) {
long_tap_timer = 1;
layer_on(_CHIKA);
LED_layer_set(0);
} else {
check_tap_and_send_key(SEND_CHIKA);
layer_off(_CHIKA);
LED_default_set();
}
break;
case ZURA:
if (record->event.pressed) {
long_tap_timer = 1;
layer_on(_ZURA);
LED_layer_set(6);
} else {
check_tap_and_send_key(SEND_ZURA);
layer_off(_ZURA);
LED_default_set();
}
break;
case RUBY:
if (record->event.pressed) {
long_tap_timer = 1;
layer_on(_RUBY);
LED_layer_set(8);
} else {
check_tap_and_send_key(SEND_RUBY);
layer_off(_RUBY);
LED_default_set();
}
break;
case RUBY_SUB1:
if (record->event.pressed) {
layer_on(_RUBY_SUB1);
if (IS_LAYER_ON(_RUBY_SUB1) && IS_LAYER_ON(_RUBY_SUB2)) {
layer_on(_RUBY_SUB3);
} else {
layer_off(_RUBY_SUB3);
}
} else {
layer_off(_RUBY_SUB1);
}
break;
case RUBY_SUB2:
if (record->event.pressed) {
layer_on(_RUBY_SUB2);
if (IS_LAYER_ON(_RUBY_SUB1) && IS_LAYER_ON(_RUBY_SUB2)) {
layer_on(_RUBY_SUB3);
} else {
layer_off(_RUBY_SUB3);
}
} else {
layer_off(_RUBY_SUB2);
}
break;
case YOHANE:
if (record->event.pressed) {
long_tap_timer = 1;
layer_on(_YOHANE);
LED_layer_set(5);
} else {
check_tap_and_send_key(SEND_YOHANE);
layer_off(_YOHANE);
LED_default_set();
}
break;
case RIKO:
if (record->event.pressed) {
long_tap_timer = 1;
layer_on(_RIKO);
LED_layer_set(1);
} else {
check_tap_and_send_key(SEND_RIKO);
layer_off(_RIKO);
LED_default_set();
}
break;
case MARI:
if (record->event.pressed) {
long_tap_timer = 1;
layer_on(_MARI);
LED_layer_set(7);
} else {
check_tap_and_send_key(SEND_MARI);
layer_off(_MARI);
LED_default_set();
}
break;
case KANAN:
if (record->event.pressed) {
long_tap_timer = 1;
layer_on(_KANAN);
LED_layer_set(2);
} else {
check_tap_and_send_key(SEND_KANAN);
layer_off(_KANAN);
LED_default_set();
}
break;
case TO_SCHOOL_IDOL_FESTIVAL:
if (record->event.pressed) {
LED_default_set();
layer_on(_SCHOOL_IDOL_FESTIVAL);
}
break;
case RETURN_SCHOOL_IDOL_FESTIVAL:
if (record->event.pressed) {
layer_off(_SCHOOL_IDOL_FESTIVAL);
}
break;
}
return true;
}
void matrix_scan_user(void) {
if (long_tap_timer > 0) {
long_tap_timer++;
}
}

View File

@ -0,0 +1,7 @@
#include "lovelive9.h"
void matrix_init_kb(void) {
matrix_init_user();
}

View File

@ -0,0 +1,9 @@
#pragma once
#include "quantum.h"
#define LAYOUT( \
k00, k01, k02, k03, k04, k05, k06, k07, k08 \
) \
{ \
{ k00, k01, k02, k03, k04, k05, k06, k07, k08 } \
}

View File

@ -0,0 +1,14 @@
# lovelive9
lovelive9 is 9keys keyboard.
![lovelive9](https://user-images.githubusercontent.com/16838187/53496102-a6fc0700-3ae4-11e9-85e4-1e6cd981b410.jpg)
Keyboard Maintainer: [ginjake](https://github.com/ginjake) [Twitter:@sirojake](https://twitter.com/sirojake)
Hardware Supported: Pro Micro, handwired (LED used [CherryMXLEDBitBoard](https://github.com/swanmatch/MxLEDBitPCB) with handwired)
Make example for this keyboard (after setting up your build environment):
make handwired/lovelive9: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/#/n

View File

@ -0,0 +1,67 @@
# MCU name
#MCU = at90usb1287
MCU = atmega32u4
# Processor frequency.
# This will define a symbol, F_CPU, in all source code files equal to the
# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
# This will be an integer division of F_USB below, as it is sourced by
# F_USB after it has run through any CPU prescalers. Note that this value
# does not *change* the processor frequency - it should merely be updated to
# reflect the processor speed set externally so that the code can use accurate
# software delays.
F_CPU = 16000000
#
# LUFA specific
#
# Target architecture (see library "Board Types" documentation).
ARCH = AVR8
# Input clock frequency.
# This will define a symbol, F_USB, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
# at the end, this will be done automatically to create a 32-bit value in your
# source code.
#
# If no clock division is performed on the input clock inside the AVR (via the
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_USB = $(F_CPU)
# Interrupt driven control endpoint task(+60)
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
# Boot Section Size in *bytes*
# Teensy halfKay 512
# Teensy++ halfKay 1024
# Atmel DFU loader 4096
# LUFA bootloader 4096
# USBaspLoader 2048
BOOTLOADER = caterina
# Build Options
# change to "no" to disable the options, or define them in the Makefile in
# the appropriate keymap folder that will get included automatically
#
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
CONSOLE_ENABLE = no # Console for debug(+400)
COMMAND_ENABLE = no # Commands for debug and configuration
NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
MIDI_ENABLE = no # MIDI controls
AUDIO_ENABLE = no # Audio output on port C6
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight.
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend