diff options
author | Nick Brassel <nick@tzarc.org> | 2022-08-28 14:23:01 +1000 |
---|---|---|
committer | Nick Brassel <nick@tzarc.org> | 2022-08-28 14:23:01 +1000 |
commit | 0a3f7e48690bb2b7b008300a54554979a55be19a (patch) | |
tree | 7499d52f20040ed7d5a56496ecb81ed114f80719 /keyboards/satt/comet46/keymaps | |
parent | fc0bf67f372c38f72c303cdec21b1d4afb5e8cb4 (diff) | |
parent | 9b5b0722555891ba94f240760ef3a6d4c870fd13 (diff) |
Merge remote-tracking branch 'upstream/develop'
Diffstat (limited to 'keyboards/satt/comet46/keymaps')
-rw-r--r-- | keyboards/satt/comet46/keymaps/default-rgbled/keymap.c | 2 | ||||
-rw-r--r-- | keyboards/satt/comet46/keymaps/default/config.h | 29 | ||||
-rw-r--r-- | keyboards/satt/comet46/keymaps/default/keymap.c | 49 | ||||
-rw-r--r-- | keyboards/satt/comet46/keymaps/default/rules.mk | 5 | ||||
-rw-r--r-- | keyboards/satt/comet46/keymaps/satt/config.h | 29 | ||||
-rw-r--r-- | keyboards/satt/comet46/keymaps/satt/keymap.c | 111 | ||||
-rw-r--r-- | keyboards/satt/comet46/keymaps/satt/rules.mk | 4 |
7 files changed, 58 insertions, 171 deletions
diff --git a/keyboards/satt/comet46/keymaps/default-rgbled/keymap.c b/keyboards/satt/comet46/keymaps/default-rgbled/keymap.c index 6c88b70bfe..1e96bd7fbc 100644 --- a/keyboards/satt/comet46/keymaps/default-rgbled/keymap.c +++ b/keyboards/satt/comet46/keymaps/default-rgbled/keymap.c @@ -173,7 +173,7 @@ void matrix_init_user(void) { } void matrix_scan_user(void) { - uint8_t layer = biton32(layer_state); + uint8_t layer = get_highest_layer(layer_state); uint8_t default_layer = biton32(eeconfig_read_default_layer()); switch (layer) { case _LOWER: diff --git a/keyboards/satt/comet46/keymaps/default/config.h b/keyboards/satt/comet46/keymaps/default/config.h deleted file mode 100644 index ee02a94b7e..0000000000 --- a/keyboards/satt/comet46/keymaps/default/config.h +++ /dev/null @@ -1,29 +0,0 @@ -/* -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/>. -*/ - -#pragma once - -// place overrides here - - -/* Use I2C or Serial */ - -#define USE_I2C -#define SSD1306OLED diff --git a/keyboards/satt/comet46/keymaps/default/keymap.c b/keyboards/satt/comet46/keymaps/default/keymap.c index cf2c911d4c..3e6f9045ff 100644 --- a/keyboards/satt/comet46/keymaps/default/keymap.c +++ b/keyboards/satt/comet46/keymaps/default/keymap.c @@ -2,9 +2,6 @@ // This is the canonical layout file for the Quantum project. If you want to add another keyboard, #include QMK_KEYBOARD_H -#ifdef SSD1306OLED - #include "ssd1306.h" -#endif // Each layer gets a name for readability, which is then used in the keymap matrix below. @@ -148,8 +145,7 @@ layer_state_t layer_state_set_user(layer_state_t state) { return update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST); } -//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h -#ifdef SSD1306OLED +#ifdef OLED_ENABLE // You need to add source files to SRC in rules.mk when using OLED display functions void set_keylog(uint16_t keycode); @@ -157,27 +153,12 @@ const char *read_keylog(void); const char *read_modifier_state(void); const char *read_host_led_state(void); -void matrix_init_user(void) { - iota_gfx_init(false); // turns on the display -} - -void matrix_scan_user(void) { - iota_gfx_task(); // this is what updates the display continuously -} - -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 render_status(struct CharacterMatrix *matrix) { +bool oled_task_user(void) { // Layer state char layer_str[22]; - matrix_write(matrix, "Layer: "); - uint8_t layer = biton32(layer_state); - uint8_t default_layer = biton32(eeconfig_read_default_layer()); + oled_write_P(PSTR("Layer: "), false); + uint8_t layer = get_highest_layer(layer_state); + uint8_t default_layer = get_highest_layer(eeconfig_read_default_layer()); switch (layer) { case _QWERTY: switch (default_layer) { @@ -207,27 +188,21 @@ void render_status(struct CharacterMatrix *matrix) { default: snprintf(layer_str, sizeof(layer_str), "Undef-%d", layer); } - matrix_write_ln(matrix, layer_str); + oled_write_ln(layer_str, false); // Last entered keycode - matrix_write_ln(matrix, read_keylog()); + oled_write_ln(read_keylog(), false); // Modifier state - matrix_write_ln(matrix, read_modifier_state()); + oled_write_ln(read_modifier_state(), false); // Host Keyboard LED Status - matrix_write(matrix, read_host_led_state()); -} + oled_write(read_host_led_state(), false); - -void iota_gfx_task_user(void) { - struct CharacterMatrix matrix; - matrix_clear(&matrix); - render_status(&matrix); - matrix_update(&display, &matrix); + return false; } -#endif//SSD1306OLED +#endif bool process_record_user(uint16_t keycode, keyrecord_t *record) { - #ifdef SSD1306OLED + #ifdef OLED_ENABLE if (record->event.pressed) { set_keylog(keycode); } diff --git a/keyboards/satt/comet46/keymaps/default/rules.mk b/keyboards/satt/comet46/keymaps/default/rules.mk index 3fa01f96af..3ceffe90ec 100644 --- a/keyboards/satt/comet46/keymaps/default/rules.mk +++ b/keyboards/satt/comet46/keymaps/default/rules.mk @@ -1,5 +1,6 @@ # If you want to change display settings of the OLED, you need to change the following lines -SRC += ./lib/glcdfont.c \ - ./lib/keylogger.c \ +SRC += ./lib/keylogger.c \ ./lib/modifier_state_reader.c \ ./lib/host_led_state_reader.c + +OLED_ENABLE = yes diff --git a/keyboards/satt/comet46/keymaps/satt/config.h b/keyboards/satt/comet46/keymaps/satt/config.h deleted file mode 100644 index a3ca2ebfef..0000000000 --- a/keyboards/satt/comet46/keymaps/satt/config.h +++ /dev/null @@ -1,29 +0,0 @@ -/* -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/>. -*/ - -#ifndef CONFIG_USER_H -#define CONFIG_USER_H - -/* Use I2C or Serial */ - -#define USE_I2C -#define SSD1306OLED - -#endif diff --git a/keyboards/satt/comet46/keymaps/satt/keymap.c b/keyboards/satt/comet46/keymaps/satt/keymap.c index cdd094f747..0f5c6876e7 100644 --- a/keyboards/satt/comet46/keymaps/satt/keymap.c +++ b/keyboards/satt/comet46/keymaps/satt/keymap.c @@ -5,9 +5,6 @@ #include "keymap_jis2us.h" #include "action_pseudo_lut.h" #include "keymap_japanese.h" -#ifdef SSD1306OLED - #include "ssd1306.h" -#endif // Each layer gets a name for readability, which is then used in the keymap matrix below. // The underscores don't mean anything - you can have a layer called STUFF or any other name. @@ -73,7 +70,7 @@ enum custom_keycodes { #define KC_IMON ALT_T(KC_F13) #define KC_IMOF GUI_T(KC_F14) #define KC_CAD LCA(KC_DEL) -#define KC_RST RESET +#define KC_RST QK_BOOT const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { @@ -165,7 +162,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; layer_state_t layer_state_set_user(layer_state_t state) { - switch (biton32(state)) { + switch (get_highest_layer(state)) { case _PSEUDO_US_LOWER: case _PSEUDO_US_RAISE: return update_tri_layer_state(state, _PSEUDO_US_RAISE, _PSEUDO_US_LOWER, _ADJUST); @@ -176,8 +173,7 @@ layer_state_t layer_state_set_user(layer_state_t state) { } } -//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h -#ifdef SSD1306OLED +#ifdef OLED_ENABLE // You need to add source files to SRC in rules.mk when using OLED display functions void set_keylog(uint16_t keycode); @@ -185,86 +181,59 @@ const char *read_keylog(void); const char *read_modifier_state(void); const char *read_host_led_state(void); -void matrix_init_user(void) { - iota_gfx_init(false); // turns on the display -} - -void matrix_scan_user(void) { - iota_gfx_task(); // this is what updates the display continuously -} - -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 render_status(struct CharacterMatrix *matrix) { +bool oled_task_user(void) { // Layer state char layer_str[22]; - matrix_write(matrix, "Layer: "); - uint8_t layer = biton32(layer_state); - uint8_t default_layer = biton32(eeconfig_read_default_layer()); - switch (layer) { - case _QWERTY: - switch (default_layer) { - case _QWERTY: - snprintf(layer_str, sizeof(layer_str), "Qwerty"); - break; - case _PSEUDO_US: - snprintf(layer_str, sizeof(layer_str), "Psuedo_US"); - break; - default: - snprintf(layer_str, sizeof(layer_str), "Undef-%d", default_layer); - break; - } - break; - case _RAISE: - snprintf(layer_str, sizeof(layer_str), "Raise"); - break; - case _LOWER: - snprintf(layer_str, sizeof(layer_str), "Lower"); - break; + oled_write_P(PSTR("Layer: "), false); + uint8_t layer = get_highest_layer(layer_state); + uint8_t default_layer = get_highest_layer(eeconfig_read_default_layer()); + switch (layer) { + case _QWERTY: + switch (default_layer) { + case _QWERTY: + snprintf(layer_str, sizeof(layer_str), "Qwerty"); + break; + case _PSEUDO_US: + snprintf(layer_str, sizeof(layer_str), "Psuedo_US"); + break; + default: + snprintf(layer_str, sizeof(layer_str), "Undef-%d", default_layer); + break; + } + break; + case _RAISE: + snprintf(layer_str, sizeof(layer_str), "Raise"); + break; + case _LOWER: + snprintf(layer_str, sizeof(layer_str), "Lower"); + break; case _PSEUDO_US_RAISE: snprintf(layer_str, sizeof(layer_str), "P_US_Raise"); break; case _PSEUDO_US_LOWER: snprintf(layer_str, sizeof(layer_str), "P_US_Lower"); break; - case _ADJUST: - snprintf(layer_str, sizeof(layer_str), "Adjust"); - break; - default: - snprintf(layer_str, sizeof(layer_str), "Undef-%d", layer); - } - matrix_write_ln(matrix, layer_str); + case _ADJUST: + snprintf(layer_str, sizeof(layer_str), "Adjust"); + break; + default: + snprintf(layer_str, sizeof(layer_str), "Undef-%d", layer); + } + oled_write_ln(layer_str, false); // Last entered keycode - matrix_write_ln(matrix, read_keylog()); + oled_write_ln(read_keylog(), false); // Modifier state - matrix_write_ln(matrix, read_modifier_state()); + oled_write_ln(read_modifier_state(), false); // Host Keyboard LED Status - matrix_write(matrix, read_host_led_state()); -} - -void iota_gfx_task_user(void) { - struct CharacterMatrix matrix; - -#if DEBUG_TO_SCREEN - if (debug_enable) { - return; - } -#endif + oled_write(read_host_led_state(), false); - matrix_clear(&matrix); - render_status(&matrix); - matrix_update(&display, &matrix); + return false; } -#endif//SSD1306OLED +#endif bool process_record_user(uint16_t keycode, keyrecord_t *record) { - #ifdef SSD1306OLED + #ifdef OLED_ENABLE if (record->event.pressed) { set_keylog(keycode); } diff --git a/keyboards/satt/comet46/keymaps/satt/rules.mk b/keyboards/satt/comet46/keymaps/satt/rules.mk index 91609dd4fd..9c07b12fcb 100644 --- a/keyboards/satt/comet46/keymaps/satt/rules.mk +++ b/keyboards/satt/comet46/keymaps/satt/rules.mk @@ -1,8 +1,8 @@ SRC += action_pseudo_lut.c # If you want to change display settings of the OLED, you need to change the following lines -SRC += ./lib/glcdfont.c \ - ./lib/keylogger.c \ +SRC += ./lib/keylogger.c \ ./lib/modifier_state_reader.c \ ./lib/host_led_state_reader.c +OLED_ENABLE = yes |