diff options
author | marksard <38324387+marksard@users.noreply.github.com> | 2020-01-14 03:06:40 +0900 |
---|---|---|
committer | Drashna Jaelre <drashna@live.com> | 2020-01-13 10:06:40 -0800 |
commit | 240e1ef6fd4b3356f3d21a50b0a0ad6c0673b1dd (patch) | |
tree | 2bb6492f22a39e389a8e5fe2bdb56e2de6558d55 /keyboards/treadstone48/keymaps/default | |
parent | 1b8cb95f2e56acf09bb66e779b800ae14aa074e5 (diff) |
[Keyboard] Rebuild treadstone48 rev1 firmware (#7856)
* Keyboard: add treeadstone48
* rename layout defines
* Use of pragma once
* move common include code
* fixed info.json
* change keymap layout from kc to normal
* fix alpha revision keymap
* fixed info.json
* remove USE_Link_Time_Optimization
* I re-created treastone48 keyboard firmware from ./util/new_keyboard.sh
After that I use common OLED_DRIVER, RGB_LIGHT and SPLIT_KEYBOARD options.
And then check all keymap.
* Modified by PR review
Diffstat (limited to 'keyboards/treadstone48/keymaps/default')
-rw-r--r-- | keyboards/treadstone48/keymaps/default/config.h | 54 | ||||
-rw-r--r-- | keyboards/treadstone48/keymaps/default/keymap.c | 115 | ||||
-rw-r--r-- | keyboards/treadstone48/keymaps/default/rules.mk | 48 |
3 files changed, 73 insertions, 144 deletions
diff --git a/keyboards/treadstone48/keymaps/default/config.h b/keyboards/treadstone48/keymaps/default/config.h index e22040cdd6..baa4ec8461 100644 --- a/keyboards/treadstone48/keymaps/default/config.h +++ b/keyboards/treadstone48/keymaps/default/config.h @@ -1,22 +1,18 @@ -/* -This is the c configuration file for the keymap - -Copyright 2012 Jun Wako <wakojun@gmail.com> -Copyright 2015 Jack Humbert - -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 <http://www.gnu.org/licenses/>. -*/ +/* Copyright 2020 marksard + * + * 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 <http://www.gnu.org/licenses/>. + */ #pragma once @@ -26,7 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #undef TAPPING_TERM #endif #define TAPPING_TERM 225 -// #define IGNORE_MOD_TAP_INTERRUPT #ifdef MOUSEKEY_ENABLE #undef MOUSEKEY_INTERVAL @@ -45,15 +40,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define MOUSEKEY_DELAY 0 #endif -// Selection of RGBLIGHT MODE to use. -#if defined(LED_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 +// If you use the HashTwenty(alpha), please enable USE_HASHTWENTY +// #define ANGELINA_KEYMAP + +// If you plug in the USB on the right side, please enable MASTER_RIGHT +// #define RHYMESTONE_RIGHTHAND + +#define OLED_FONT_H "keyboards/treadstone48/common/glcdfont.c" diff --git a/keyboards/treadstone48/keymaps/default/keymap.c b/keyboards/treadstone48/keymaps/default/keymap.c index 6143307528..100434246d 100644 --- a/keyboards/treadstone48/keymaps/default/keymap.c +++ b/keyboards/treadstone48/keymaps/default/keymap.c @@ -1,8 +1,22 @@ +/* Copyright 2020 marksard + * + * 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 <http://www.gnu.org/licenses/>. + */ #include QMK_KEYBOARD_H #include "keymap_jp.h" #include "../common/oled_helper.h" - #ifdef RGBLIGHT_ENABLE //Following line allows macro to read current RGB settings extern rgblight_config_t rgblight_config; @@ -115,7 +129,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { #define L_ADJUST (1<<_ADJUST) #define L_ADJUST_TRI (L_ADJUST|L_RAISE|L_LOWER) -#ifdef SSD1306OLED +#ifdef OLED_DRIVER_ENABLE +#include <stdio.h> +#include <string.h> + typedef struct { uint8_t state; char name[8]; @@ -152,18 +169,42 @@ static inline void update_keymap_status(void) { keymap_config.swap_lalt_lgui? "win" : "mac", get_leyer_status()); } -static inline void render_keymap_status(struct CharacterMatrix *matrix) { +static inline void render_keymap_status(void) { - matrix_write(matrix, layer_status_buf); + oled_write(layer_status_buf, false); } #define UPDATE_KEYMAP_STATUS() update_keymap_status() -#define RENDER_KEYMAP_STATUS(a) render_keymap_status(a) + +static inline void render_status(void) { + + UPDATE_LED_STATUS(); + RENDER_LED_STATUS(); + render_keymap_status(); + UPDATE_LOCK_STATUS(); + RENDER_LOCK_STATUS(); + RENDER_KEY_STATUS(); +} + +oled_rotation_t oled_init_user(oled_rotation_t rotation) { + +// if (is_keyboard_master()) +// return OLED_ROTATION_180; // flips the display 180 degrees if offhand + return rotation; +} + +void oled_task_user(void) { + + if (is_keyboard_master()) { + render_status(); + } else { + render_logo(); + } +} #else #define UPDATE_KEYMAP_STATUS() -#define RENDER_KEYMAP_STATUS(a) #endif @@ -198,18 +239,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } break; #ifdef RGBLIGHT_ENABLE - case RGB_MOD: - if (record->event.pressed) { - rgblight_mode(RGB_current_mode); - rgblight_step(); - RGB_current_mode = rgblight_config.mode; - } - break; case RGBRST: if (record->event.pressed) { eeconfig_update_rgblight_default(); rgblight_enable(); - RGB_current_mode = rgblight_config.mode; } break; #endif @@ -221,57 +254,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { UPDATE_KEYMAP_STATUS(); return result; } - -void matrix_init_user(void) { - #ifdef RGBLIGHT_ENABLE - RGB_current_mode = rgblight_config.mode; - #endif - //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h - #ifdef SSD1306OLED - iota_gfx_init(!has_usb()); // turns on the display - #endif -} - -//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h -#ifdef SSD1306OLED - -void matrix_scan_user(void) { - iota_gfx_task(); // this is what updates the display continuously -} - -static inline void matrix_update(struct CharacterMatrix *dest, - const struct CharacterMatrix *source) { - if (memcmp(dest->display, source->display, sizeof(dest->display))) { - memcpy(dest->display, source->display, sizeof(dest->display)); - dest->dirty = true; - } -} - -static inline void render_status(struct CharacterMatrix *matrix) { - - UPDATE_LED_STATUS(); - RENDER_LED_STATUS(matrix); - RENDER_KEYMAP_STATUS(matrix); - UPDATE_LOCK_STATUS(); - RENDER_LOCK_STATUS(matrix); - RENDER_KEY_STATUS(matrix); -} - -void iota_gfx_task_user(void) { - struct CharacterMatrix matrix; - - #if DEBUG_TO_SCREEN - if (debug_enable) { - return; - } - #endif - - matrix_clear(&matrix); - if (is_master) { - render_status(&matrix); - } - - matrix_update(&display, &matrix); -} - -#endif diff --git a/keyboards/treadstone48/keymaps/default/rules.mk b/keyboards/treadstone48/keymaps/default/rules.mk index 38ef4cc9fe..474e71ab11 100644 --- a/keyboards/treadstone48/keymaps/default/rules.mk +++ b/keyboards/treadstone48/keymaps/default/rules.mk @@ -1,49 +1,9 @@ +MOUSEKEY_ENABLE = yes # Mouse keys TAP_DANCE_ENABLE = yes -# If your custom treadstone48 pcb, you can rewrite to yes. -OLED_ENABLE = no # OLED_ENABLE -LED_UNDERGLOW_ENABLE = yes # LED underglow (Enable WS2812 RGB underlight.) -LED_ANIMATIONS = yes # LED animations - -# Other selectable option -IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone) -LOCAL_GLCDFONT = no # use each keymaps "font.h" insted of "common/glcdfont.c" -# RHYMESTONE_RIGHTHAND = no # If connect right hand side of the Rhymestone, set to yes. -ANGELINA_KEYMAP = no # If Alfa verstion use set to yes. - -ifeq ($(strip $(OLED_ENABLE)), yes) - OPT_DEFS += -DOLED_ENABLE -endif - -ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes) - RGBLIGHT_ENABLE = yes -else - RGBLIGHT_ENABLE = no -endif - -ifeq ($(strip $(LED_ANIMATIONS)), yes) - # OPT_DEFS += -DRGBLIGHT_ANIMATIONS - OPT_DEFS += -DLED_ANIMATIONS -endif - -ifeq ($(strip $(IOS_DEVICE_ENABLE)), yes) - OPT_DEFS += -DIOS_DEVICE_ENABLE -endif - -ifeq ($(strip $(LOCAL_GLCDFONT)), yes) - OPT_DEFS += -DLOCAL_GLCDFONT -endif - -# ifeq ($(strip $(RHYMESTONE_RIGHTHAND)), yes) -# OPT_DEFS += -DRHYMESTONE_RIGHTHAND -# endif - -ifeq ($(strip $(ANGELINA_KEYMAP)), yes) - OPT_DEFS += -DANGELINA_KEYMAP -endif - -# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE -SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow +OLED_DRIVER_ENABLE = no +LTO_ENABLE = yes # If you want to change the display of OLED, you need to change here SRC += ./common/oled_helper.c \ |