From 6d0f944e5e986af0fd3e6abec482dd0d31a4101a Mon Sep 17 00:00:00 2001 From: "T.Shinohara" Date: Tue, 13 Dec 2022 08:23:54 +0900 Subject: Keyboard rura66 (#15853) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add : BlackMask60 and MayShi.No30 * fix:spell miss * change:keyboard name area * change: default keymap * 配列を自分用に変更 * MyKemap Update * 構成変更 * Add RURA66 new keyboard * remove additional files * fix file * fix info.json from rura66 * fix KC_LANG to KC_LNG from rura66 * Fix readme - fix purchase URL - adjust to the recent standard * Fix rules.mk - no backlight - remove DIP switch/Bluetooth - OLED_DRIVER_ENABLE -> OLED_ENABLE * Fix rura66.h: add LICENSE * Fix config.h - UNUSED_PINS is deprecated - accept suggestion on PR * Fix oled_display.c - remove snprintf() - OLED_DRIVER_ENABLE->OLED_ENABLE - oled_task_user() returns false * Fix config.h - no SPLIT_HAND_MATRIX_GRID - no RGB Matrix * move default keymap readme * add VIA keymap * Fix info.json - Fix keyboard URL - Change VID/PID * Fix comments in rules.mk * fix info.json keyboard url Co-authored-by: yswallow <1426202+yswallow@users.noreply.github.com> --- keyboards/rura66/rev1/config.h | 132 ++++++++++++++++++++++++ keyboards/rura66/rev1/info.json | 22 ++++ keyboards/rura66/rev1/keymaps/default/keymap.c | 120 +++++++++++++++++++++ keyboards/rura66/rev1/keymaps/default/readme.md | 3 + keyboards/rura66/rev1/keymaps/via/keymap.c | 120 +++++++++++++++++++++ keyboards/rura66/rev1/keymaps/via/rules.mk | 1 + keyboards/rura66/rev1/oled_display.c | 118 +++++++++++++++++++++ keyboards/rura66/rev1/rev1.c | 34 ++++++ keyboards/rura66/rev1/rev1.h | 50 +++++++++ keyboards/rura66/rev1/rules.mk | 10 ++ 10 files changed, 610 insertions(+) create mode 100644 keyboards/rura66/rev1/config.h create mode 100644 keyboards/rura66/rev1/info.json create mode 100644 keyboards/rura66/rev1/keymaps/default/keymap.c create mode 100644 keyboards/rura66/rev1/keymaps/default/readme.md create mode 100644 keyboards/rura66/rev1/keymaps/via/keymap.c create mode 100644 keyboards/rura66/rev1/keymaps/via/rules.mk create mode 100644 keyboards/rura66/rev1/oled_display.c create mode 100644 keyboards/rura66/rev1/rev1.c create mode 100644 keyboards/rura66/rev1/rev1.h create mode 100644 keyboards/rura66/rev1/rules.mk (limited to 'keyboards/rura66/rev1') diff --git a/keyboards/rura66/rev1/config.h b/keyboards/rura66/rev1/config.h new file mode 100644 index 0000000000..b9a617ffa6 --- /dev/null +++ b/keyboards/rura66/rev1/config.h @@ -0,0 +1,132 @@ +/* +Copyright 2021 T.Shinohara + +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 . +*/ + +#pragma once + +#include "config_common.h" + +/* key matrix size */ +#define MATRIX_ROWS 10 +#define MATRIX_COLS 7 + +/* + * Keyboard Matrix Assignments + * + * Change this to how you wired your keyboard + * COLS: AVR pins used for columns, left to right + * ROWS: AVR pins used for rows, top to bottom + * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) + * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) + * + */ +#define MATRIX_ROW_PINS { D4, C6, D7, E6, B4 } +#define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3, B2 } + +/* COL2ROW, ROW2COL*/ +#define DIODE_DIRECTION COL2ROW + +/* Split hand configration */ +#define MASTER_LEFT + +/* + * Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk, and define SOFT_SERIAL_PIN. + */ +#define SOFT_SERIAL_PIN D2 // or D1, D2, D3, E6 + +#ifdef RGBLIGHT_ENABLE + #define RGB_DI_PIN D3 + #define RGBLED_NUM 66 // Number of LEDs + #define RGBLIGHT_SPLIT + #define RGBLED_SPLIT { 33, 33 } + #define RGBLIGHT_LIMIT_VAL 120 /* The maximum brightness level */ + #define RGBLIGHT_HUE_STEP 8 + #define RGBLIGHT_SAT_STEP 8 + #define RGBLIGHT_VAL_STEP 8 + #define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_RGB_TEST +// #define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */ + + /*== choose animations ==*/ +// #define RGBLIGHT_EFFECT_BREATHING + #define RGBLIGHT_EFFECT_RAINBOW_MOOD + #define RGBLIGHT_EFFECT_RAINBOW_SWIRL +// #define RGBLIGHT_EFFECT_SNAKE +// #define RGBLIGHT_EFFECT_KNIGHT +// #define RGBLIGHT_EFFECT_CHRISTMAS + #define RGBLIGHT_EFFECT_STATIC_GRADIENT + #define RGBLIGHT_EFFECT_RGB_TEST +// #define RGBLIGHT_EFFECT_ALTERNATING +#endif + +/* Custom font */ +#define OLED_FONT_H "keyboards/rura66/common/glcdfont.c" + +/* Encorder */ +// #define ENCODERS_PAD_A { B6 } +// #define ENCODERS_PAD_B { B5 } + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCE 5 + +/* define if matrix has ghost (lacks anti-ghosting diodes) */ +//#define MATRIX_HAS_GHOST + +/* 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 + +/* If defined, GRAVE_ESC will always act as ESC when CTRL is held. + * This is userful for the Windows task manager shortcut (ctrl+shift+esc). + */ +// #define GRAVE_ESC_CTRL_OVERRIDE + +/* + * Force NKRO + * + * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved + * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the + * makefile for this to work.) + * + * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) + * until the next keyboard reset. + * + * NKRO may prevent your keystrokes from being detected in the BIOS, but it is + * fully operational during normal computer usage. + * + * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) + * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by + * bootmagic, NKRO mode will always be enabled until it is toggled again during a + * power-up. + * + */ +//#define FORCE_NKRO + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +//#define NO_DEBUG + +/* disable print */ +//#define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT diff --git a/keyboards/rura66/rev1/info.json b/keyboards/rura66/rev1/info.json new file mode 100644 index 0000000000..bfa85a0eea --- /dev/null +++ b/keyboards/rura66/rev1/info.json @@ -0,0 +1,22 @@ +{ + "keyboard_name": "RURA66", + "manufacturer": "ShinoharaTa", + "url": "https://github.com/ShinoharaTa/keyboards/tree/master/RURA66", + "maintainer": "ShinoharaTa", + "usb": { + "vid": "0x7335", + "pid": "0x0200", + "device_version": "0.0.1" + }, + "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":10, "y":0}, {"x":11, "y":0}, {"x":12, "y":0}, {"x":13, "y":0}, {"x":14, "y":0}, {"x":15, "y":0}, + {"x":0, "y":1}, {"x":1, "y":1}, {"x":2, "y":1}, {"x":3, "y":1}, {"x":4, "y":1}, {"x":5, "y":1}, {"x":10, "y":1}, {"x":11, "y":1}, {"x":12, "y":1}, {"x":13, "y":1}, {"x":14, "y":1}, {"x":15, "y":1}, + {"x":0, "y":2}, {"x":1, "y":2}, {"x":2, "y":2}, {"x":3, "y":2}, {"x":4, "y":2}, {"x":5, "y":2}, {"x":6, "y":2}, {"x":9, "y":2}, {"x":10, "y":2}, {"x":11, "y":2}, {"x":12, "y":2}, {"x":13, "y":2}, {"x":14, "y":2}, {"x":15, "y":2}, + {"x":0, "y":3}, {"x":1, "y":3}, {"x":2, "y":3}, {"x":3, "y":3}, {"x":4, "y":3}, {"x":5, "y":3}, {"x":6, "y":3}, {"x":7, "y":3}, {"x":8, "y":3}, {"x":9, "y":3}, {"x":10, "y":3}, {"x":11, "y":3}, {"x":12, "y":3}, {"x":13, "y":3}, {"x":14, "y":3}, {"x":15, "y":3}, + {"x":0, "y":4}, {"x":1, "y":4}, {"x":2, "y":4}, {"x":5, "y":4}, {"x":6, "y":4}, {"x":7, "y":4}, {"x":8, "y":4}, {"x":9, "y":4}, {"x":10, "y":4}, {"x":13, "y":4}, {"x":14, "y":4}, {"x":15, "y":4} + ] + } + } +} diff --git a/keyboards/rura66/rev1/keymaps/default/keymap.c b/keyboards/rura66/rev1/keymaps/default/keymap.c new file mode 100644 index 0000000000..e09e22dedd --- /dev/null +++ b/keyboards/rura66/rev1/keymaps/default/keymap.c @@ -0,0 +1,120 @@ +/* +Copyright 2021 T.Shinohara + +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 . +*/ +#include QMK_KEYBOARD_H + +// Defines names for use in layer keycodes and the keymap +enum layer_number { + _QWERTY = 0, + _LOWER, + _RAISE, + _ADJUST +}; + +enum custom_keycodes { + EISU = SAFE_RANGE, + KANA, + ADJUST, + RGBRST +}; + +#define KC_LOSP LT(_LOWER, KC_SPC) +#define KC_LODEL LT(_LOWER, KC_DEL) +#define KC_RACOM LT(_RAISE, KC_COMM) +#define KC_RADOT LT(_RAISE, KC_DOT) +#define KC_RASLS LT(_RAISE, KC_SLSH) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_QWERTY] = LAYOUT( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, + KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_GRV, KC_EQL, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_LBRC, KC_ENT, KC_ESC, KC_RBRC, KC_B, KC_N, KC_M, KC_BSLS, KC_QUOT, KC_PIPE, + KC_LCTL, KC_LGUI, KC_LALT, KC_LODEL,KC_LOSP, KANA, KC_RASLS,KC_RACOM,KC_RADOT, KC_RCTL, KC_RGUI, KC_RALT + ), + [_LOWER] = LAYOUT( + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, XXXXXXX, + _______, KC_F11, KC_F12, KC_PGUP, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_UP, XXXXXXX, XXXXXXX, _______, + _______, XXXXXXX, KC_HOME, KC_PGDN, KC_END, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, XXXXXXX, _______, + _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + _______, _______, _______, _______, _______, XXXXXXX, _______, _______, _______, _______, _______, _______ + ), + [_RAISE] = 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, _______, _______, _______, _______, _______, _______ + ), + [_ADJUST] = LAYOUT( + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, QK_BOOT, RGBRST, EE_CLR, XXXXXXX, XXXXXXX, RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, AG_NORM, AG_SWAP, RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD, 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 + ) +}; + +layer_state_t layer_state_set_user(layer_state_t state) { + return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case EISU: + if (record->event.pressed) { + if (is_mac_mode()) { + register_code(KC_LNG2); + }else{ + tap_code16(LALT(KC_GRAVE)); + } + } else { + unregister_code(KC_LNG2); + } + return false; + break; + case KANA: + if (record->event.pressed) { + if (is_mac_mode()) { + register_code(KC_LNG1); + }else{ + tap_code16(LALT(KC_GRAVE)); + } + } else { + unregister_code(KC_LNG1); + } + return false; + break; + case ADJUST: + if (record->event.pressed) { + layer_on(_LOWER); + layer_on(_RAISE); + } else { + layer_off(_LOWER); + layer_off(_RAISE); + } + break; + case RGBRST: + #ifdef RGBLIGHT_ENABLE + if (record->event.pressed) { + eeconfig_update_rgblight_default(); + rgblight_enable(); + } + #endif + break; + } + return true; +} diff --git a/keyboards/rura66/rev1/keymaps/default/readme.md b/keyboards/rura66/rev1/keymaps/default/readme.md new file mode 100644 index 0000000000..67e1380f50 --- /dev/null +++ b/keyboards/rura66/rev1/keymaps/default/readme.md @@ -0,0 +1,3 @@ +# RURA66 default Keymap + +![keymap](https://raw.githubusercontent.com/ShinoharaTa/keyboards/master/RURA66/manual/images/keymap.png) diff --git a/keyboards/rura66/rev1/keymaps/via/keymap.c b/keyboards/rura66/rev1/keymaps/via/keymap.c new file mode 100644 index 0000000000..e09e22dedd --- /dev/null +++ b/keyboards/rura66/rev1/keymaps/via/keymap.c @@ -0,0 +1,120 @@ +/* +Copyright 2021 T.Shinohara + +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 . +*/ +#include QMK_KEYBOARD_H + +// Defines names for use in layer keycodes and the keymap +enum layer_number { + _QWERTY = 0, + _LOWER, + _RAISE, + _ADJUST +}; + +enum custom_keycodes { + EISU = SAFE_RANGE, + KANA, + ADJUST, + RGBRST +}; + +#define KC_LOSP LT(_LOWER, KC_SPC) +#define KC_LODEL LT(_LOWER, KC_DEL) +#define KC_RACOM LT(_RAISE, KC_COMM) +#define KC_RADOT LT(_RAISE, KC_DOT) +#define KC_RASLS LT(_RAISE, KC_SLSH) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_QWERTY] = LAYOUT( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, + KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_GRV, KC_EQL, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_LBRC, KC_ENT, KC_ESC, KC_RBRC, KC_B, KC_N, KC_M, KC_BSLS, KC_QUOT, KC_PIPE, + KC_LCTL, KC_LGUI, KC_LALT, KC_LODEL,KC_LOSP, KANA, KC_RASLS,KC_RACOM,KC_RADOT, KC_RCTL, KC_RGUI, KC_RALT + ), + [_LOWER] = LAYOUT( + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, XXXXXXX, + _______, KC_F11, KC_F12, KC_PGUP, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_UP, XXXXXXX, XXXXXXX, _______, + _______, XXXXXXX, KC_HOME, KC_PGDN, KC_END, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, XXXXXXX, _______, + _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + _______, _______, _______, _______, _______, XXXXXXX, _______, _______, _______, _______, _______, _______ + ), + [_RAISE] = 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, _______, _______, _______, _______, _______, _______ + ), + [_ADJUST] = LAYOUT( + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, QK_BOOT, RGBRST, EE_CLR, XXXXXXX, XXXXXXX, RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, AG_NORM, AG_SWAP, RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD, 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 + ) +}; + +layer_state_t layer_state_set_user(layer_state_t state) { + return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case EISU: + if (record->event.pressed) { + if (is_mac_mode()) { + register_code(KC_LNG2); + }else{ + tap_code16(LALT(KC_GRAVE)); + } + } else { + unregister_code(KC_LNG2); + } + return false; + break; + case KANA: + if (record->event.pressed) { + if (is_mac_mode()) { + register_code(KC_LNG1); + }else{ + tap_code16(LALT(KC_GRAVE)); + } + } else { + unregister_code(KC_LNG1); + } + return false; + break; + case ADJUST: + if (record->event.pressed) { + layer_on(_LOWER); + layer_on(_RAISE); + } else { + layer_off(_LOWER); + layer_off(_RAISE); + } + break; + case RGBRST: + #ifdef RGBLIGHT_ENABLE + if (record->event.pressed) { + eeconfig_update_rgblight_default(); + rgblight_enable(); + } + #endif + break; + } + return true; +} diff --git a/keyboards/rura66/rev1/keymaps/via/rules.mk b/keyboards/rura66/rev1/keymaps/via/rules.mk new file mode 100644 index 0000000000..1e5b99807c --- /dev/null +++ b/keyboards/rura66/rev1/keymaps/via/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes diff --git a/keyboards/rura66/rev1/oled_display.c b/keyboards/rura66/rev1/oled_display.c new file mode 100644 index 0000000000..137fd188c7 --- /dev/null +++ b/keyboards/rura66/rev1/oled_display.c @@ -0,0 +1,118 @@ +/* Copyright 2021 T.Shinohara + * + * 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 . + */ + +#include QMK_KEYBOARD_H + +// Defines names for use in layer keycodes and the keymap +enum layer_names { + _QWERTY = 0, + _LOWER, + _RAISE, + _ADJUST +}; + +#ifdef OLED_ENABLE + +void render_status(void) { + + // Render to mode icon + static const char os_logo[][2][3] PROGMEM ={{{0x95,0x96,0},{0xb5,0xb6,0}},{{0x97,0x98,0},{0xb7,0xb8,0}}}; + if (is_mac_mode()) { + oled_write_P(os_logo[0][0], false); + oled_write_P(PSTR("\n"), false); + oled_write_P(os_logo[0][1], false); + }else{ + oled_write_P(os_logo[1][0], false); + oled_write_P(PSTR("\n"), false); + oled_write_P(os_logo[1][1], false); + } + + oled_write_P(PSTR(" "), false); + + // Host Keyboard Layer Status + oled_write_P(PSTR("Layer: "), false); + + switch (get_highest_layer(layer_state)) { + case _QWERTY: + oled_write_P(PSTR("Default\n"), false); + break; + case _RAISE: + oled_write_P(PSTR("Raise\n"), false); + break; + case _LOWER: + oled_write_P(PSTR("Lower\n"), false); + break; + case _ADJUST: + oled_write_P(PSTR("Adjust\n"), false); + break; + default: + // Or use the write_ln shortcut over adding '\n' to the end of your string + oled_write_ln_P(PSTR("Undefined"), false); + } + + oled_write_P(PSTR("\n"), false); + + // Host Keyboard LED Status + led_t led_state = host_keyboard_led_state(); + oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false); + oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false); + oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false); +} + + +static void render_logo(void) { + static const char PROGMEM qmk_logo[] = { + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, 0x93, 0x94, + 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, + 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0x00 + }; + + oled_write_P(qmk_logo, false); +} + +static void render_rgbled_status(bool full) { +#ifdef RGBLIGHT_ENABLE + if (RGBLIGHT_MODES > 1 && rgblight_is_enabled()) { + if (full) { + // " LED %d:%d,%d,%d" + oled_write_P(PSTR(" LED"), false); + oled_write(get_u8_str(rgblight_get_mode(), ' '), false); + oled_write_char(':', false); + oled_write(get_u8_str(rgblight_get_hue()/RGBLIGHT_HUE_STEP, ' '), false); + oled_write_char(',', false); + oled_write(get_u8_str(rgblight_get_sat()/RGBLIGHT_SAT_STEP, ' '), false); + oled_write_char(',', false); + oled_write(get_u8_str(rgblight_get_val()/RGBLIGHT_VAL_STEP, ' '), false); + } else { + // "[%2d] " + oled_write_char('[', false); + oled_write(get_u8_str(rgblight_get_mode(), ' '), false); + oled_write_char(']', false); + } + } +#endif +} + +bool oled_task_user(void) { + if(is_keyboard_master()){ + render_status(); + }else{ + render_logo(); + render_rgbled_status(true); + } + return false; +} +#endif diff --git a/keyboards/rura66/rev1/rev1.c b/keyboards/rura66/rev1/rev1.c new file mode 100644 index 0000000000..f42bdad44b --- /dev/null +++ b/keyboards/rura66/rev1/rev1.c @@ -0,0 +1,34 @@ +/* Copyright 2021 T.Shinohara + * + * 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 . + */ + +#include "rura66.h" + +bool is_mac_mode(void) { + return keymap_config.swap_lalt_lgui == false; +} + +void set_mac_mode(bool macmode) { + if (macmode) { + /* The result is the same as pressing the AG_NORM(=MAGIC_UNSWAP_ALT_GUI) key. */ + /* https://github.com/qmk/qmk_firmware/blob/fb4a6ad30ea7a648acd59793ed4a30c3a8d8dc32/quantum/process_keycode/process_magic.c#L123-L124 */ + keymap_config.swap_lalt_lgui = keymap_config.swap_ralt_rgui = false; + } else { + /* The result is the same as pressing the AG_SWAP(=MAGIC_SWAP_ALT_GUI) key. */ + /* https://github.com/qmk/qmk_firmware/blob/fb4a6ad30ea7a648acd59793ed4a30c3a8d8dc32/quantum/process_keycode/process_magic.c#L80-L81 */ + keymap_config.swap_lalt_lgui = keymap_config.swap_ralt_rgui = true; + } +} + diff --git a/keyboards/rura66/rev1/rev1.h b/keyboards/rura66/rev1/rev1.h new file mode 100644 index 0000000000..70f793ca3d --- /dev/null +++ b/keyboards/rura66/rev1/rev1.h @@ -0,0 +1,50 @@ +/* Copyright 2021 T.Shinohara + * + * 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 . + */ + +#pragma once + +#include "quantum.h" + +bool is_mac_mode(void); +void set_mac_mode(bool macmode); + +/* 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. + */ +#define LAYOUT( \ + L00, L01, L02, L03, L04, L05, R05, R04, R03, R02, R01, R00, \ + L10, L11, L12, L13, L14, L15, R15, R14, R13, R12, R11, R10, \ + L20, L21, L22, L23, L24, L25, L26, R26, R25, R24, R23, R22, R21, R20, \ + L30, L31, L32, L33, L34, L35, L36, L06, R06, R36, R35, R34, R33, R32, R31, R30, \ + L40, L41, L42, L45, L46, L16, R16, R46, R45, R42, R41, R40 \ +) \ +{ \ + { L00, L01, L02, L03, L04, L05, L06 }, \ + { L10, L11, L12, L13, L14, L15, L16 }, \ + { L20, L21, L22, L23, L24, L25, L26 }, \ + { L30, L31, L32, L33, L34, L35, L36 }, \ + { L40, L41, L42, KC_NO, KC_NO, L45, L46 }, \ + { R00, R01, R02, R03, R04, R05, R06 }, \ + { R10, R11, R12, R13, R14, R15, R16 }, \ + { R20, R21, R22, R23, R24, R25, R26 }, \ + { R30, R31, R32, R33, R34, R35, R36 }, \ + { R40, R41, R42, KC_NO, KC_NO, R45, R46 } \ +} diff --git a/keyboards/rura66/rev1/rules.mk b/keyboards/rura66/rev1/rules.mk new file mode 100644 index 0000000000..5130195b44 --- /dev/null +++ b/keyboards/rura66/rev1/rules.mk @@ -0,0 +1,10 @@ +EXTRAKEY_ENABLE = yes # Audio control and System control +RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow +SPLIT_KEYBOARD = yes +RGB_MATRIX_ENABLE = no +RGB_MATRIX_DRIVER = WS2812 +OLED_DRIVER = SSD1306 +ENCODER_ENABLE = no +LTO_ENABLE = yes + +SRC += oled_display.c -- cgit v1.2.3