From 30fd69886dcf069a4e0d2c02ce18803500fcad2e Mon Sep 17 00:00:00 2001 From: Gregorio <38576492+ohchiko@users.noreply.github.com> Date: Thu, 18 Jun 2020 11:39:16 +0700 Subject: [Keyboard] Add Mixi (#9364) * [Keyboard] Add Mixi Co-authored-by: Ryan Co-authored-by: Ryan --- keyboards/mixi/config.h | 47 +++++++++++++ keyboards/mixi/info.json | 22 ++++++ keyboards/mixi/keymaps/default/keymap.c | 116 +++++++++++++++++++++++++++++++ keyboards/mixi/keymaps/default/readme.md | 10 +++ keyboards/mixi/keymaps/via/keymap.c | 116 +++++++++++++++++++++++++++++++ keyboards/mixi/keymaps/via/rules.mk | 2 + keyboards/mixi/mixi.c | 13 ++++ keyboards/mixi/mixi.h | 13 ++++ keyboards/mixi/readme.md | 15 ++++ keyboards/mixi/rules.mk | 27 +++++++ 10 files changed, 381 insertions(+) create mode 100644 keyboards/mixi/config.h create mode 100644 keyboards/mixi/info.json create mode 100644 keyboards/mixi/keymaps/default/keymap.c create mode 100644 keyboards/mixi/keymaps/default/readme.md create mode 100644 keyboards/mixi/keymaps/via/keymap.c create mode 100644 keyboards/mixi/keymaps/via/rules.mk create mode 100644 keyboards/mixi/mixi.c create mode 100644 keyboards/mixi/mixi.h create mode 100644 keyboards/mixi/readme.md create mode 100644 keyboards/mixi/rules.mk (limited to 'keyboards') diff --git a/keyboards/mixi/config.h b/keyboards/mixi/config.h new file mode 100644 index 000000000..cb89dd2cb --- /dev/null +++ b/keyboards/mixi/config.h @@ -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 diff --git a/keyboards/mixi/info.json b/keyboards/mixi/info.json new file mode 100644 index 000000000..123e23dc6 --- /dev/null +++ b/keyboards/mixi/info.json @@ -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} + ] + } + } +} diff --git a/keyboards/mixi/keymaps/default/keymap.c b/keyboards/mixi/keymaps/default/keymap.c new file mode 100644 index 000000000..806a7a924 --- /dev/null +++ b/keyboards/mixi/keymaps/default/keymap.c @@ -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); + } + } + } +} diff --git a/keyboards/mixi/keymaps/default/readme.md b/keyboards/mixi/keymaps/default/readme.md new file mode 100644 index 000000000..863fa6f5d --- /dev/null +++ b/keyboards/mixi/keymaps/default/readme.md @@ -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. diff --git a/keyboards/mixi/keymaps/via/keymap.c b/keyboards/mixi/keymaps/via/keymap.c new file mode 100644 index 000000000..806a7a924 --- /dev/null +++ b/keyboards/mixi/keymaps/via/keymap.c @@ -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); + } + } + } +} diff --git a/keyboards/mixi/keymaps/via/rules.mk b/keyboards/mixi/keymaps/via/rules.mk new file mode 100644 index 000000000..36b7ba9cb --- /dev/null +++ b/keyboards/mixi/keymaps/via/rules.mk @@ -0,0 +1,2 @@ +VIA_ENABLE = yes +LTO_ENABLE = yes diff --git a/keyboards/mixi/mixi.c b/keyboards/mixi/mixi.c new file mode 100644 index 000000000..533cf3b88 --- /dev/null +++ b/keyboards/mixi/mixi.c @@ -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(); +} diff --git a/keyboards/mixi/mixi.h b/keyboards/mixi/mixi.h new file mode 100644 index 000000000..8b2bc7090 --- /dev/null +++ b/keyboards/mixi/mixi.h @@ -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 } \ +} diff --git a/keyboards/mixi/readme.md b/keyboards/mixi/readme.md new file mode 100644 index 000000000..4c911db57 --- /dev/null +++ b/keyboards/mixi/readme.md @@ -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). diff --git a/keyboards/mixi/rules.mk b/keyboards/mixi/rules.mk new file mode 100644 index 000000000..99b1f1cbc --- /dev/null +++ b/keyboards/mixi/rules.mk @@ -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 -- cgit v1.2.3