summaryrefslogtreecommitdiffstats
path: root/keyboards/treadstone48/keymaps/like_jis/keymap.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/treadstone48/keymaps/like_jis/keymap.c')
-rw-r--r--keyboards/treadstone48/keymaps/like_jis/keymap.c116
1 files changed, 47 insertions, 69 deletions
diff --git a/keyboards/treadstone48/keymaps/like_jis/keymap.c b/keyboards/treadstone48/keymaps/like_jis/keymap.c
index b63b0c9f49..6cde28d24b 100644
--- a/keyboards/treadstone48/keymaps/like_jis/keymap.c
+++ b/keyboards/treadstone48/keymaps/like_jis/keymap.c
@@ -1,9 +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"
-extern keymap_config_t keymap_config;
-
#ifdef RGBLIGHT_ENABLE
//Following line allows macro to read current RGB settings
extern rgblight_config_t rgblight_config;
@@ -116,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];
@@ -153,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
@@ -199,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
@@ -222,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