[Keyboard] Add Mixi (#9364)

* [Keyboard] Add Mixi

Co-authored-by: Ryan <fauxpark@gmail.com>

Co-authored-by: Ryan <fauxpark@gmail.com>
master
Gregorio 2020-06-18 11:39:16 +07:00 committed by GitHub
parent ed528403fd
commit 30fd69886d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 381 additions and 0 deletions

View File

@ -0,0 +1,47 @@
#pragma once
#include "config_common.h"
/* USB Device descriptor parameter */
#define VENDOR_ID 0x4752
#define PRODUCT_ID 0x4D49
#define DEVICE_VER 0x0001
#define MANUFACTURER gregorio
#define PRODUCT Mixi
#define DESCRIPTION Mixi macropad by gregorio
/* key matrix size */
#define MATRIX_ROWS 3
#define MATRIX_COLS 3
/* Keyboard Matrix Assignments */
#define DIRECT_PINS { \
{ D1, D4, F4 }, \
{ D0, B4, F5 }, \
{ C6, F7, B6 } \
}
#define ENCODERS_PAD_A { F5 }
#define ENCODERS_PAD_B { F4 }
/* Set 0 if debouncing isn't 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
#define RGB_DI_PIN B5
#ifdef RGB_DI_PIN
#define RGBLED_NUM 5
#define RGBLIGHT_HUE_STEP 8
#define RGBLIGHT_SAT_STEP 8
#define RGBLIGHT_VAL_STEP 8
#define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */
#define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */
#define RGBLIGHT_ANIMATIONS
#define RGBLIGHT_LAYERS
#define RGBLIGHT_LAYER_BLINK
#endif

View File

@ -0,0 +1,22 @@
{
"keyboard_name": "Mixi",
"url": "https://tokopedia.com/sell-stuffs",
"maintainer": "ohchiko",
"width": 3,
"height": 3,
"layouts": {
"LAYOUT": {
"layout": [
{"x":0, "y":0},
{"x":1, "y":0},
{"x":2, "y":0},
{"x":0, "y":1},
{"x":1, "y":1},
{"x":2, "y":1},
{"x":0, "y":2},
{"x":1, "y":2},
{"x":2, "y":2}
]
}
}
}

View File

@ -0,0 +1,116 @@
#include QMK_KEYBOARD_H
// please change this value to the desired layer definitions
#define LAYERNUM 3
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/*
* | Knob: Layer +/- |
* .---------------------------------------.
* | Mute | Play/Pause | Hold: Layer 2 |
* |----------|------------|---------------|
* | Previous | Up | Next |
* |----------|------------|---------------|
* | Left | Down | Right |
* '---------------------------------------'
*/
[0] =
LAYOUT(
KC_MUTE, KC_MPLY, MO(2),
KC_MNXT, KC_UP , KC_MPRV ,
KC_LEFT, KC_DOWN , KC_RGHT
),
/*
* .-----------------------.
* | NUM 7 | NUM 8 | NUM 9 |
* |-------|-------|-------|
* | NUM 4 | NUM 5 | NUM 6 |
* |-------|-------|-------|
* | NUM 1 | NUM 2 | NUM 3 |
* '-----------------------'
*/
[1] =
LAYOUT(
KC_P7, KC_P8, KC_P8,
KC_P4, KC_P5, KC_P6,
KC_P1, KC_P2, KC_P3
),
/*
* | Knob: Volume +/- |
* .--------------------------------------.
* | N/A | N/A | Hold: Layer 2 |
* |--------------|-------|---------------|
* | RESET EEPROM | RESET | DEBUG MODE |
* |--------------|-------|---------------|
* | N/A | N/A | N/A |
* '--------------------------------------'
*/
[2] =
LAYOUT(
KC_NO , KC_NO, KC_TRNS,
EEP_RST, RESET, DEBUG ,
KC_NO , KC_NO, KC_NO
)
};
const rgblight_segment_t PROGMEM _base_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{0, RGBLED_NUM, HSV_WHITE}
);
const rgblight_segment_t PROGMEM _middle_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{0, RGBLED_NUM, HSV_GREEN}
);
const rgblight_segment_t PROGMEM _top_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{0, RGBLED_NUM, HSV_RED}
);
const rgblight_segment_t* const PROGMEM _rgb_layers[] =
RGBLIGHT_LAYERS_LIST(
_base_layer,
_middle_layer,
_top_layer
);
void keyboard_post_init_user(void) {
rgblight_layers = _rgb_layers;
}
layer_state_t layer_state_set_user(layer_state_t state) {
switch (get_highest_layer(state)) {
case 0:
rgblight_blink_layer(0, 500);
break;
case 1:
rgblight_blink_layer(1, 500);
break;
case 2:
rgblight_blink_layer(2, 500);
break;
}
return state;
}
uint8_t selected_layer = 0;
void encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) {
if (layer_state_is(2)) {
if (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
} else {
if (clockwise && selected_layer < (LAYERNUM-2)) { /* Prevent switch to layer 2 using encoder */
selected_layer++;
layer_move(selected_layer);
} else if (!clockwise && selected_layer > 0) {
selected_layer--;
layer_move(selected_layer);
}
}
}
}

View File

@ -0,0 +1,10 @@
![Mixi Layout Image](https://i.imgur.com/UIXj9O6.png)
# Default Mixi Layout
This is the default layout that comes flashed on every Mixi macropad. Layer 1
and Layer 2 are accessible by rotating the encoder. Layer 3 is not accessible
by the encoder, instead is accessible by holding the [0,2] key on Layer 1. While
Layer 3 is active, rotating the encoder will results in increasing/decreasing
media volume. This layout is expected the encoder is on the left side or [0,0]
key.

View File

@ -0,0 +1,116 @@
#include QMK_KEYBOARD_H
// please change this value to the desired layer definitions
#define LAYERNUM 3
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/*
* | Knob: Layer +/- |
* .---------------------------------------.
* | Mute | Play/Pause | Hold: Layer 2 |
* |----------|------------|---------------|
* | Previous | Up | Next |
* |----------|------------|---------------|
* | Left | Down | Right |
* '---------------------------------------'
*/
[0] =
LAYOUT(
KC_MUTE, KC_MPLY, MO(2),
KC_MNXT, KC_UP , KC_MPRV ,
KC_LEFT, KC_DOWN , KC_RGHT
),
/*
* .-----------------------.
* | NUM 7 | NUM 8 | NUM 9 |
* |-------|-------|-------|
* | NUM 4 | NUM 5 | NUM 6 |
* |-------|-------|-------|
* | NUM 1 | NUM 2 | NUM 3 |
* '-----------------------'
*/
[1] =
LAYOUT(
KC_P7, KC_P8, KC_P8,
KC_P4, KC_P5, KC_P6,
KC_P1, KC_P2, KC_P3
),
/*
* | Knob: Volume +/- |
* .--------------------------------------.
* | N/A | N/A | Hold: Layer 2 |
* |--------------|-------|---------------|
* | RESET EEPROM | RESET | DEBUG MODE |
* |--------------|-------|---------------|
* | N/A | N/A | N/A |
* '--------------------------------------'
*/
[2] =
LAYOUT(
KC_NO , KC_NO, KC_TRNS,
EEP_RST, RESET, DEBUG ,
KC_NO , KC_NO, KC_NO
)
};
const rgblight_segment_t PROGMEM _base_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{0, RGBLED_NUM, HSV_WHITE}
);
const rgblight_segment_t PROGMEM _middle_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{0, RGBLED_NUM, HSV_GREEN}
);
const rgblight_segment_t PROGMEM _top_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{0, RGBLED_NUM, HSV_RED}
);
const rgblight_segment_t* const PROGMEM _rgb_layers[] =
RGBLIGHT_LAYERS_LIST(
_base_layer,
_middle_layer,
_top_layer
);
void keyboard_post_init_user(void) {
rgblight_layers = _rgb_layers;
}
layer_state_t layer_state_set_user(layer_state_t state) {
switch (get_highest_layer(state)) {
case 0:
rgblight_blink_layer(0, 500);
break;
case 1:
rgblight_blink_layer(1, 500);
break;
case 2:
rgblight_blink_layer(2, 500);
break;
}
return state;
}
uint8_t selected_layer = 0;
void encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) {
if (layer_state_is(2)) {
if (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
} else {
if (clockwise && selected_layer < (LAYERNUM-2)) { /* Prevent switch to layer 2 using encoder */
selected_layer++;
layer_move(selected_layer);
} else if (!clockwise && selected_layer > 0) {
selected_layer--;
layer_move(selected_layer);
}
}
}
}

View File

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

View File

@ -0,0 +1,13 @@
#include "mixi.h"
void eeconfig_init_kb(void) {
#ifdef RGBLIGHT_ENABLE
rgblight_enable(); // Enable RGB underglow by default
#ifdef RGBLIGHT_ANIMATIONS
rgblight_mode(RGBLIGHT_MODE_TWINKLE + 5); // Set to RGB_TWINKLE animation by default
#endif
#endif
eeconfig_update_kb(0);
eeconfig_init_user();
}

View File

@ -0,0 +1,13 @@
#pragma once
#include "quantum.h"
#define LAYOUT( \
K00, K01, K02, \
K10, K11, K12, \
K20, K21, K22 \
) { \
{ K00, K01, K02 }, \
{ K10, K11, K12 }, \
{ K20, K21, K22 } \
}

View File

@ -0,0 +1,15 @@
# Mixi
![Mixi](https://i.imgur.com/GPO6Khu.jpg)
A mini 3x3 macropad with rotary encoders support and RGB underglow and also tray mount support. Currently the PCB and kits can only be purchased in Indonesia.
* Keyboard Maintainer: [ohchiko](https://github.com/ohchiko)
* Hardware Supported: Mixi PCB, Arduino Pro Micro
* Hardware Availability: [Tokopedia/Sell Stuffs](https://tokopedia.com/sell-stuffs) (Indonesia only).
Make example for this keyboard (after setting up your build environment):
make mixi: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).

View File

@ -0,0 +1,27 @@
# MCU name
MCU = atmega32u4
# Bootloader selection
# Teensy halfkay
# Pro Micro caterina
# Atmel DFU atmel-dfu
# LUFA DFU lufa-dfu
# QMK DFU qmk-dfu
# ATmega32A bootloadHID
# ATmega328P USBasp
BOOTLOADER = caterina
# Build Options
# comment out to disable the options.
#
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration
MOUSEKEY_ENABLE = no # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = yes # Console for debug
COMMAND_ENABLE = yes # Commands for debug and configuration
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
NKRO_ENABLE = no # USB 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
RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
ENCODER_ENABLE = yes
AUDIO_ENABLE = no