From f7aaed1b57d264a983d4890ce6ada930ce2f6368 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Sun, 31 Jul 2022 20:36:30 +0100 Subject: Migrate crkbd keymaps to oled driver (#17863) --- keyboards/crkbd/keymaps/madhatter/config.h | 3 -- keyboards/crkbd/keymaps/madhatter/keymap.c | 50 ++++++++---------------------- keyboards/crkbd/keymaps/madhatter/rules.mk | 8 ++--- 3 files changed, 16 insertions(+), 45 deletions(-) (limited to 'keyboards/crkbd/keymaps/madhatter') diff --git a/keyboards/crkbd/keymaps/madhatter/config.h b/keyboards/crkbd/keymaps/madhatter/config.h index bcf4e05005..6cbe5befb8 100644 --- a/keyboards/crkbd/keymaps/madhatter/config.h +++ b/keyboards/crkbd/keymaps/madhatter/config.h @@ -28,9 +28,6 @@ along with this program. If not, see . // #define MASTER_RIGHT // #define EE_HANDS -#define SSD1306OLED -#define USE_SSD_I2C - #define USE_SERIAL_PD2 #define TAPPING_FORCE_HOLD diff --git a/keyboards/crkbd/keymaps/madhatter/keymap.c b/keyboards/crkbd/keymaps/madhatter/keymap.c index c228a7b573..f833428a02 100644 --- a/keyboards/crkbd/keymaps/madhatter/keymap.c +++ b/keyboards/crkbd/keymaps/madhatter/keymap.c @@ -17,10 +17,7 @@ along with this program. If not, see . */ #include QMK_KEYBOARD_H -#ifdef SSD1306OLED -# include "ssd1306.h" -# include -#endif +#include enum corny_layers { _QWERTY, @@ -108,14 +105,9 @@ void matrix_init_user(void) { #ifdef RGBLIGHT_ENABLE RGB_current_mode = rgblight_get_mode(); #endif - //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h - #ifdef SSD1306OLED - iota_gfx_init(); // turns on the display - #endif } -//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h -#ifdef SSD1306OLED +#ifdef OLED_ENABLE // When add source files to SRC in rules.mk, you can use functions. const char *read_layer_state(void); @@ -129,42 +121,26 @@ const char *read_keylogs(void); // void set_timelog(void); // const char *read_timelog(void); -void matrix_scan_user(void) { - iota_gfx_task(); -} - -void matrix_render_user(struct CharacterMatrix *matrix) { +bool oled_task_user(void) { if (is_keyboard_master()) { // If you want to change the display of OLED, you need to change here - matrix_write(matrix, read_layer_state()); - matrix_write(matrix, read_keylog()); - //matrix_write_ln(matrix, read_keylogs()); - //matrix_write_ln(matrix, read_mode_icon(keymap_config.swap_lalt_lgui)); - //matrix_write_ln(matrix, read_host_led_state()); - //matrix_write_ln(matrix, read_timelog()); + oled_write(read_layer_state(), false); + oled_write(read_keylog(), false); + //oled_write_ln(read_keylogs(), false); + //oled_write_ln(read_mode_icon(keymap_config.swap_lalt_lgui), false); + //oled_write_ln(read_host_led_state(), false); + //oled_write_ln(read_timelog(), false); } else { - matrix_write(matrix, read_logo()); + oled_write(read_logo(), false); } + return false; } -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; - } -} - -void iota_gfx_task_user(void) { - struct CharacterMatrix matrix; - matrix_clear(&matrix); - matrix_render_user(&matrix); - matrix_update(&display, &matrix); -} -#endif//SSD1306OLED +#endif bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { -#ifdef SSD1306OLED +#ifdef OLED_ENABLE set_keylog(keycode, record); #endif // set_timelog(); diff --git a/keyboards/crkbd/keymaps/madhatter/rules.mk b/keyboards/crkbd/keymaps/madhatter/rules.mk index 489b16ef1c..89a2791bcd 100644 --- a/keyboards/crkbd/keymaps/madhatter/rules.mk +++ b/keyboards/crkbd/keymaps/madhatter/rules.mk @@ -1,13 +1,11 @@ +OLED_ENABLE = yes +OLED_DRIVER = SSD1306 # If you want to change the display of OLED, you need to change here -SRC += ./lib/glcdfont.c \ - ./lib/rgb_state_reader.c \ +SRC += ./lib/rgb_state_reader.c \ ./lib/layer_state_reader.c \ ./lib/logo_reader.c \ ./lib/keylogger.c \ # ./lib/mode_icon_reader.c \ # ./lib/host_led_state_reader.c \ # ./lib/timelogger.c \ - -VPATH += keyboards/crkbd/lib -LIB_SRC += ssd1306.c i2c.c -- cgit v1.2.3 From bbc3bc55f2d52b90881470695ee132f5a57bfaa3 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Sun, 21 Aug 2022 23:55:30 +0100 Subject: RESET -> QK_BOOT user keymaps (#17940) --- keyboards/crkbd/keymaps/madhatter/keymap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'keyboards/crkbd/keymaps/madhatter') diff --git a/keyboards/crkbd/keymaps/madhatter/keymap.c b/keyboards/crkbd/keymaps/madhatter/keymap.c index f833428a02..59b4cc7a20 100644 --- a/keyboards/crkbd/keymaps/madhatter/keymap.c +++ b/keyboards/crkbd/keymaps/madhatter/keymap.c @@ -83,7 +83,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RESET, + RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, QK_BOOT, //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| KC_TRNS, LOWER, KC_TRNS, KC_TRNS, RAISE, KC_TRNS //`--------------------------' `--------------------------' -- cgit v1.2.3