diff options
Diffstat (limited to 'keyboards/tkc1800/keymaps')
| -rw-r--r-- | keyboards/tkc1800/keymaps/default/config.h | 24 | ||||
| -rw-r--r-- | keyboards/tkc1800/keymaps/default/keymap.c | 99 | ||||
| -rw-r--r-- | keyboards/tkc1800/keymaps/smt/config.h | 24 | ||||
| -rw-r--r-- | keyboards/tkc1800/keymaps/smt/keymap.c | 95 | ||||
| -rw-r--r-- | keyboards/tkc1800/keymaps/via/keymap.c | 99 | ||||
| -rw-r--r-- | keyboards/tkc1800/keymaps/wkl/config.h | 24 | ||||
| -rw-r--r-- | keyboards/tkc1800/keymaps/wkl/keymap.c | 100 | ||||
| -rw-r--r-- | keyboards/tkc1800/keymaps/yanfali/config.h | 24 | ||||
| -rw-r--r-- | keyboards/tkc1800/keymaps/yanfali/keymap.c | 94 |
9 files changed, 120 insertions, 463 deletions
diff --git a/keyboards/tkc1800/keymaps/default/config.h b/keyboards/tkc1800/keymaps/default/config.h deleted file mode 100644 index ee142927f..000000000 --- a/keyboards/tkc1800/keymaps/default/config.h +++ /dev/null | |||
| @@ -1,24 +0,0 @@ | |||
| 1 | /* Copyright 2017 Mathias Andersson <wraul@dbox.se> | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #pragma once | ||
| 18 | |||
| 19 | #define USE_I2C | ||
| 20 | #define SSD1306OLED | ||
| 21 | //#define OLED_ROTATE180 | ||
| 22 | #define SSD1306_ADDRESS 0x3C | ||
| 23 | |||
| 24 | // place overrides here | ||
diff --git a/keyboards/tkc1800/keymaps/default/keymap.c b/keyboards/tkc1800/keymaps/default/keymap.c index 5455934a3..4f4c7f8e9 100644 --- a/keyboards/tkc1800/keymaps/default/keymap.c +++ b/keyboards/tkc1800/keymaps/default/keymap.c | |||
| @@ -13,11 +13,8 @@ | |||
| 13 | * You should have received a copy of the GNU General Public License | 13 | * You should have received a copy of the GNU General Public License |
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ | 15 | */ |
| 16 | |||
| 16 | #include QMK_KEYBOARD_H | 17 | #include QMK_KEYBOARD_H |
| 17 | #include "LUFA/Drivers/Peripheral/TWI.h" | ||
| 18 | #include "i2c.h" | ||
| 19 | #include "ssd1306.h" | ||
| 20 | |||
| 21 | 18 | ||
| 22 | //Layers | 19 | //Layers |
| 23 | 20 | ||
| @@ -26,13 +23,6 @@ enum { | |||
| 26 | FUNCTION, | 23 | FUNCTION, |
| 27 | }; | 24 | }; |
| 28 | 25 | ||
| 29 | bool screenWorks = 0; | ||
| 30 | |||
| 31 | //13 characters max without re-writing the "Layer: " format in iota_gfx_task_user() | ||
| 32 | static char layer_lookup[][14] = {"Base","Function"}; | ||
| 33 | |||
| 34 | |||
| 35 | |||
| 36 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | 26 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
| 37 | /* Keymap BASE: (Base Layer) Default Layer | 27 | /* Keymap BASE: (Base Layer) Default Layer |
| 38 | * ,-------------------------------------------------------. ,-------------------. | 28 | * ,-------------------------------------------------------. ,-------------------. |
| @@ -88,72 +78,29 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 88 | ), | 78 | ), |
| 89 | }; | 79 | }; |
| 90 | 80 | ||
| 91 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 92 | return true; | ||
| 93 | } | ||
| 94 | |||
| 95 | void led_set_user(uint8_t usb_led) { | ||
| 96 | 81 | ||
| 97 | } | 82 | #ifdef OLED_DRIVER_ENABLE |
| 98 | 83 | void oled_task_user(void) { | |
| 99 | void matrix_init_user(void) { | 84 | oled_write_P(PSTR("TKC1800\n"),false); |
| 100 | #ifdef USE_I2C | 85 | // Host Keyboard Layer Status |
| 101 | i2c_master_init(); | 86 | oled_write_P(PSTR("Layer: "), false); |
| 102 | #ifdef SSD1306OLED | 87 | |
| 103 | // calls code for the SSD1306 OLED | 88 | switch (get_highest_layer(layer_state)) { |
| 104 | _delay_ms(400); | 89 | case BASE: |
| 105 | TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000)); | 90 | oled_write_P(PSTR("Base\n"), false); |
| 106 | if ( iota_gfx_init() ) { // turns on the display | 91 | break; |
| 107 | screenWorks = 1; | 92 | case FUNCTION: |
| 108 | } | 93 | oled_write_P(PSTR("Function\n"), false); |
| 109 | #endif | 94 | break; |
| 110 | #endif | 95 | default: |
| 111 | #ifdef AUDIO_ENABLE | 96 | // Or use the write_ln shortcut over adding '\n' to the end of your string |
| 112 | startup_user(); | 97 | oled_write_ln_P(PSTR("Undefined"), false); |
| 113 | #endif | ||
| 114 | } | ||
| 115 | |||
| 116 | void matrix_scan_user(void) { | ||
| 117 | #ifdef SSD1306OLED | ||
| 118 | if ( screenWorks ) { | ||
| 119 | iota_gfx_task(); // this is what updates the display continuously | ||
| 120 | }; | ||
| 121 | #endif | ||
| 122 | } | ||
| 123 | |||
| 124 | void matrix_update(struct CharacterMatrix *dest, | ||
| 125 | const struct CharacterMatrix *source) { | ||
| 126 | if (memcmp(dest->display, source->display, sizeof(dest->display))) { | ||
| 127 | memcpy(dest->display, source->display, sizeof(dest->display)); | ||
| 128 | dest->dirty = true; | ||
| 129 | } | ||
| 130 | } | ||
| 131 | |||
| 132 | void iota_gfx_task_user(void) { | ||
| 133 | #if DEBUG_TO_SCREEN | ||
| 134 | if (debug_enable) { | ||
| 135 | return; | ||
| 136 | } | 98 | } |
| 137 | #endif | ||
| 138 | |||
| 139 | struct CharacterMatrix matrix; | ||
| 140 | |||
| 141 | matrix_clear(&matrix); | ||
| 142 | matrix_write_P(&matrix, PSTR("TKC1800")); | ||
| 143 | |||
| 144 | uint8_t layer = biton32(layer_state); | ||
| 145 | |||
| 146 | char buf[40]; | ||
| 147 | snprintf(buf,sizeof(buf), "Undef-%d", layer); | ||
| 148 | matrix_write_P(&matrix, PSTR("\nLayer: ")); | ||
| 149 | matrix_write(&matrix, layer_lookup[layer]); | ||
| 150 | 99 | ||
| 151 | // Host Keyboard LED Status | 100 | // Host Keyboard LED Status |
| 152 | char led[40]; | 101 | led_t led_state = host_keyboard_led_state(); |
| 153 | snprintf(led, sizeof(led), "\n\n%s %s %s", | 102 | oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false); |
| 154 | (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ", | 103 | oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false); |
| 155 | (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ", | 104 | oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false); |
| 156 | (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " "); | ||
| 157 | matrix_write(&matrix, led); | ||
| 158 | matrix_update(&display, &matrix); | ||
| 159 | } | 105 | } |
| 106 | #endif \ No newline at end of file | ||
diff --git a/keyboards/tkc1800/keymaps/smt/config.h b/keyboards/tkc1800/keymaps/smt/config.h deleted file mode 100644 index ee142927f..000000000 --- a/keyboards/tkc1800/keymaps/smt/config.h +++ /dev/null | |||
| @@ -1,24 +0,0 @@ | |||
| 1 | /* Copyright 2017 Mathias Andersson <wraul@dbox.se> | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #pragma once | ||
| 18 | |||
| 19 | #define USE_I2C | ||
| 20 | #define SSD1306OLED | ||
| 21 | //#define OLED_ROTATE180 | ||
| 22 | #define SSD1306_ADDRESS 0x3C | ||
| 23 | |||
| 24 | // place overrides here | ||
diff --git a/keyboards/tkc1800/keymaps/smt/keymap.c b/keyboards/tkc1800/keymaps/smt/keymap.c index 9f506b443..9b6ad80d3 100644 --- a/keyboards/tkc1800/keymaps/smt/keymap.c +++ b/keyboards/tkc1800/keymaps/smt/keymap.c | |||
| @@ -13,10 +13,8 @@ | |||
| 13 | * You should have received a copy of the GNU General Public License | 13 | * You should have received a copy of the GNU General Public License |
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ | 15 | */ |
| 16 | |||
| 16 | #include QMK_KEYBOARD_H | 17 | #include QMK_KEYBOARD_H |
| 17 | #include "LUFA/Drivers/Peripheral/TWI.h" | ||
| 18 | #include "i2c.h" | ||
| 19 | #include "ssd1306.h" | ||
| 20 | 18 | ||
| 21 | // Custom macros | 19 | // Custom macros |
| 22 | #define CTL_ESC CTL_T(KC_ESC) // Tap for Esc, hold for Ctrl | 20 | #define CTL_ESC CTL_T(KC_ESC) // Tap for Esc, hold for Ctrl |
| @@ -32,11 +30,6 @@ enum { | |||
| 32 | FUNCTION, | 30 | FUNCTION, |
| 33 | }; | 31 | }; |
| 34 | 32 | ||
| 35 | //13 characters max without re-writing the "Layer: " format in iota_gfx_task_user() | ||
| 36 | static char layer_lookup[][14] = {"Qwerty","Dvorak","Function"}; | ||
| 37 | |||
| 38 | |||
| 39 | |||
| 40 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | 33 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
| 41 | /* Keymap QWERTY: (Qwerty Layer) Default Layer | 34 | /* Keymap QWERTY: (Qwerty Layer) Default Layer |
| 42 | * ,-------------------------------------------------------. ,-------------------. | 35 | * ,-------------------------------------------------------. ,-------------------. |
| @@ -151,64 +144,34 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 151 | return true; | 144 | return true; |
| 152 | } | 145 | } |
| 153 | 146 | ||
| 154 | void led_set_user(uint8_t usb_led) { | 147 | #ifdef OLED_DRIVER_ENABLE |
| 155 | 148 | void oled_task_user(void) { | |
| 156 | } | 149 | oled_write_P(PSTR("TKC1800\n"),false); |
| 157 | 150 | // Host Keyboard Layer Status | |
| 158 | void matrix_init_user(void) { | 151 | oled_write_P(PSTR("Layer: "), false); |
| 159 | #ifdef USE_I2C | 152 | |
| 160 | i2c_master_init(); | 153 | switch (get_highest_layer(layer_state)) { |
| 161 | #ifdef SSD1306OLED | 154 | case QWERTY: |
| 162 | // calls code for the SSD1306 OLED | 155 | oled_write_P(PSTR("Base\n"), false); |
| 163 | _delay_ms(400); | 156 | break; |
| 164 | TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000)); | 157 | case COLEMAK: |
| 165 | iota_gfx_init(); // turns on the display | 158 | oled_write_P(PSTR("Colemak\n"), false); |
| 166 | #endif | 159 | break; |
| 167 | #endif | 160 | case DVORAK: |
| 168 | #ifdef AUDIO_ENABLE | 161 | oled_write_P(PSTR("Dvorak\n"), false); |
| 169 | startup_user(); | 162 | break; |
| 170 | #endif | 163 | case FUNCTION: |
| 171 | } | 164 | oled_write_P(PSTR("Function\n"), false); |
| 172 | 165 | break; | |
| 173 | void matrix_scan_user(void) { | 166 | default: |
| 174 | #ifdef SSD1306OLED | 167 | // Or use the write_ln shortcut over adding '\n' to the end of your string |
| 175 | iota_gfx_task(); // this is what updates the display continuously | 168 | oled_write_ln_P(PSTR("Undefined"), false); |
| 176 | #endif | ||
| 177 | } | ||
| 178 | |||
| 179 | void matrix_update(struct CharacterMatrix *dest, | ||
| 180 | const struct CharacterMatrix *source) { | ||
| 181 | if (memcmp(dest->display, source->display, sizeof(dest->display))) { | ||
| 182 | memcpy(dest->display, source->display, sizeof(dest->display)); | ||
| 183 | dest->dirty = true; | ||
| 184 | } | ||
| 185 | } | ||
| 186 | |||
| 187 | void iota_gfx_task_user(void) { | ||
| 188 | #if DEBUG_TO_SCREEN | ||
| 189 | if (debug_enable) { | ||
| 190 | return; | ||
| 191 | } | 169 | } |
| 192 | #endif | ||
| 193 | |||
| 194 | struct CharacterMatrix matrix; | ||
| 195 | |||
| 196 | matrix_clear(&matrix); | ||
| 197 | matrix_write_P(&matrix, PSTR("TKC1800")); | ||
| 198 | |||
| 199 | uint8_t layer = biton32(layer_state); | ||
| 200 | |||
| 201 | char buf[40]; | ||
| 202 | snprintf(buf,sizeof(buf), "Undef-%d", layer); | ||
| 203 | matrix_write_P(&matrix, PSTR("\nLayer: ")); | ||
| 204 | matrix_write(&matrix, layer_lookup[layer]); | ||
| 205 | 170 | ||
| 206 | // Host Keyboard LED Status | 171 | // Host Keyboard LED Status |
| 207 | char led[40]; | 172 | led_t led_state = host_keyboard_led_state(); |
| 208 | snprintf(led, sizeof(led), "\n\n%s %s %s", | 173 | oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false); |
| 209 | (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ", | 174 | oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false); |
| 210 | (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ", | 175 | oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false); |
| 211 | (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " "); | ||
| 212 | matrix_write(&matrix, led); | ||
| 213 | matrix_update(&display, &matrix); | ||
| 214 | } | 176 | } |
| 177 | #endif \ No newline at end of file | ||
diff --git a/keyboards/tkc1800/keymaps/via/keymap.c b/keyboards/tkc1800/keymaps/via/keymap.c index 5455934a3..76fdf0540 100644 --- a/keyboards/tkc1800/keymaps/via/keymap.c +++ b/keyboards/tkc1800/keymaps/via/keymap.c | |||
| @@ -14,10 +14,6 @@ | |||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ | 15 | */ |
| 16 | #include QMK_KEYBOARD_H | 16 | #include QMK_KEYBOARD_H |
| 17 | #include "LUFA/Drivers/Peripheral/TWI.h" | ||
| 18 | #include "i2c.h" | ||
| 19 | #include "ssd1306.h" | ||
| 20 | |||
| 21 | 17 | ||
| 22 | //Layers | 18 | //Layers |
| 23 | 19 | ||
| @@ -26,13 +22,6 @@ enum { | |||
| 26 | FUNCTION, | 22 | FUNCTION, |
| 27 | }; | 23 | }; |
| 28 | 24 | ||
| 29 | bool screenWorks = 0; | ||
| 30 | |||
| 31 | //13 characters max without re-writing the "Layer: " format in iota_gfx_task_user() | ||
| 32 | static char layer_lookup[][14] = {"Base","Function"}; | ||
| 33 | |||
| 34 | |||
| 35 | |||
| 36 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | 25 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
| 37 | /* Keymap BASE: (Base Layer) Default Layer | 26 | /* Keymap BASE: (Base Layer) Default Layer |
| 38 | * ,-------------------------------------------------------. ,-------------------. | 27 | * ,-------------------------------------------------------. ,-------------------. |
| @@ -88,72 +77,28 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 88 | ), | 77 | ), |
| 89 | }; | 78 | }; |
| 90 | 79 | ||
| 91 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | 80 | #ifdef OLED_DRIVER_ENABLE |
| 92 | return true; | 81 | void oled_task_user(void) { |
| 93 | } | 82 | oled_write_P(PSTR("TKC1800\n"),false); |
| 94 | 83 | // Host Keyboard Layer Status | |
| 95 | void led_set_user(uint8_t usb_led) { | 84 | oled_write_P(PSTR("Layer: "), false); |
| 96 | 85 | ||
| 97 | } | 86 | switch (get_highest_layer(layer_state)) { |
| 98 | 87 | case BASE: | |
| 99 | void matrix_init_user(void) { | 88 | oled_write_P(PSTR("Base\n"), false); |
| 100 | #ifdef USE_I2C | 89 | break; |
| 101 | i2c_master_init(); | 90 | case FUNCTION: |
| 102 | #ifdef SSD1306OLED | 91 | oled_write_P(PSTR("Function\n"), false); |
| 103 | // calls code for the SSD1306 OLED | 92 | break; |
| 104 | _delay_ms(400); | 93 | default: |
| 105 | TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000)); | 94 | // Or use the write_ln shortcut over adding '\n' to the end of your string |
| 106 | if ( iota_gfx_init() ) { // turns on the display | 95 | oled_write_ln_P(PSTR("Undefined"), false); |
| 107 | screenWorks = 1; | ||
| 108 | } | ||
| 109 | #endif | ||
| 110 | #endif | ||
| 111 | #ifdef AUDIO_ENABLE | ||
| 112 | startup_user(); | ||
| 113 | #endif | ||
| 114 | } | ||
| 115 | |||
| 116 | void matrix_scan_user(void) { | ||
| 117 | #ifdef SSD1306OLED | ||
| 118 | if ( screenWorks ) { | ||
| 119 | iota_gfx_task(); // this is what updates the display continuously | ||
| 120 | }; | ||
| 121 | #endif | ||
| 122 | } | ||
| 123 | |||
| 124 | void matrix_update(struct CharacterMatrix *dest, | ||
| 125 | const struct CharacterMatrix *source) { | ||
| 126 | if (memcmp(dest->display, source->display, sizeof(dest->display))) { | ||
| 127 | memcpy(dest->display, source->display, sizeof(dest->display)); | ||
| 128 | dest->dirty = true; | ||
| 129 | } | ||
| 130 | } | ||
| 131 | |||
| 132 | void iota_gfx_task_user(void) { | ||
| 133 | #if DEBUG_TO_SCREEN | ||
| 134 | if (debug_enable) { | ||
| 135 | return; | ||
| 136 | } | 96 | } |
| 137 | #endif | ||
| 138 | |||
| 139 | struct CharacterMatrix matrix; | ||
| 140 | |||
| 141 | matrix_clear(&matrix); | ||
| 142 | matrix_write_P(&matrix, PSTR("TKC1800")); | ||
| 143 | |||
| 144 | uint8_t layer = biton32(layer_state); | ||
| 145 | |||
| 146 | char buf[40]; | ||
| 147 | snprintf(buf,sizeof(buf), "Undef-%d", layer); | ||
| 148 | matrix_write_P(&matrix, PSTR("\nLayer: ")); | ||
| 149 | matrix_write(&matrix, layer_lookup[layer]); | ||
| 150 | 97 | ||
| 151 | // Host Keyboard LED Status | 98 | // Host Keyboard LED Status |
| 152 | char led[40]; | 99 | led_t led_state = host_keyboard_led_state(); |
| 153 | snprintf(led, sizeof(led), "\n\n%s %s %s", | 100 | oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false); |
| 154 | (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ", | 101 | oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false); |
| 155 | (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ", | 102 | oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false); |
| 156 | (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " "); | ||
| 157 | matrix_write(&matrix, led); | ||
| 158 | matrix_update(&display, &matrix); | ||
| 159 | } | 103 | } |
| 104 | #endif \ No newline at end of file | ||
diff --git a/keyboards/tkc1800/keymaps/wkl/config.h b/keyboards/tkc1800/keymaps/wkl/config.h deleted file mode 100644 index ee142927f..000000000 --- a/keyboards/tkc1800/keymaps/wkl/config.h +++ /dev/null | |||
| @@ -1,24 +0,0 @@ | |||
| 1 | /* Copyright 2017 Mathias Andersson <wraul@dbox.se> | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #pragma once | ||
| 18 | |||
| 19 | #define USE_I2C | ||
| 20 | #define SSD1306OLED | ||
| 21 | //#define OLED_ROTATE180 | ||
| 22 | #define SSD1306_ADDRESS 0x3C | ||
| 23 | |||
| 24 | // place overrides here | ||
diff --git a/keyboards/tkc1800/keymaps/wkl/keymap.c b/keyboards/tkc1800/keymaps/wkl/keymap.c index 6f331c61c..3c65b61d1 100644 --- a/keyboards/tkc1800/keymaps/wkl/keymap.c +++ b/keyboards/tkc1800/keymaps/wkl/keymap.c | |||
| @@ -13,11 +13,8 @@ | |||
| 13 | * You should have received a copy of the GNU General Public License | 13 | * You should have received a copy of the GNU General Public License |
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ | 15 | */ |
| 16 | |||
| 16 | #include QMK_KEYBOARD_H | 17 | #include QMK_KEYBOARD_H |
| 17 | #include "LUFA/Drivers/Peripheral/TWI.h" | ||
| 18 | #include "i2c.h" | ||
| 19 | #include "ssd1306.h" | ||
| 20 | |||
| 21 | 18 | ||
| 22 | //Layers | 19 | //Layers |
| 23 | 20 | ||
| @@ -26,13 +23,6 @@ enum { | |||
| 26 | FUNCTION, | 23 | FUNCTION, |
| 27 | }; | 24 | }; |
| 28 | 25 | ||
| 29 | bool screenWorks = 0; | ||
| 30 | |||
| 31 | //13 characters max without re-writing the "Layer: " format in iota_gfx_task_user() | ||
| 32 | static char layer_lookup[][14] = {"Base","Function"}; | ||
| 33 | |||
| 34 | |||
| 35 | |||
| 36 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | 26 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
| 37 | /* Keymap BASE: (Base Layer) Default Layer | 27 | /* Keymap BASE: (Base Layer) Default Layer |
| 38 | * ,-------------------------------------------------------. ,-------------------. | 28 | * ,-------------------------------------------------------. ,-------------------. |
| @@ -71,72 +61,28 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 71 | ), | 61 | ), |
| 72 | }; | 62 | }; |
| 73 | 63 | ||
| 74 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | 64 | #ifdef OLED_DRIVER_ENABLE |
| 75 | return true; | 65 | void oled_task_user(void) { |
| 76 | } | 66 | oled_write_P(PSTR("TKC1800\n"),false); |
| 77 | 67 | // Host Keyboard Layer Status | |
| 78 | void led_set_user(uint8_t usb_led) { | 68 | oled_write_P(PSTR("Layer: "), false); |
| 79 | 69 | ||
| 80 | } | 70 | switch (get_highest_layer(layer_state)) { |
| 81 | 71 | case BASE: | |
| 82 | void matrix_init_user(void) { | 72 | oled_write_P(PSTR("Base\n"), false); |
| 83 | #ifdef USE_I2C | 73 | break; |
| 84 | i2c_master_init(); | 74 | case FUNCTION: |
| 85 | #ifdef SSD1306OLED | 75 | oled_write_P(PSTR("Function\n"), false); |
| 86 | // calls code for the SSD1306 OLED | 76 | break; |
| 87 | _delay_ms(400); | 77 | default: |
| 88 | TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000)); | 78 | // Or use the write_ln shortcut over adding '\n' to the end of your string |
| 89 | if ( iota_gfx_init() ) { // turns on the display | 79 | oled_write_ln_P(PSTR("Undefined"), false); |
| 90 | screenWorks = 1; | ||
| 91 | } | ||
| 92 | #endif | ||
| 93 | #endif | ||
| 94 | #ifdef AUDIO_ENABLE | ||
| 95 | startup_user(); | ||
| 96 | #endif | ||
| 97 | } | ||
| 98 | |||
| 99 | void matrix_scan_user(void) { | ||
| 100 | #ifdef SSD1306OLED | ||
| 101 | if ( screenWorks ) { | ||
| 102 | iota_gfx_task(); // this is what updates the display continuously | ||
| 103 | }; | ||
| 104 | #endif | ||
| 105 | } | ||
| 106 | |||
| 107 | void matrix_update(struct CharacterMatrix *dest, | ||
| 108 | const struct CharacterMatrix *source) { | ||
| 109 | if (memcmp(dest->display, source->display, sizeof(dest->display))) { | ||
| 110 | memcpy(dest->display, source->display, sizeof(dest->display)); | ||
| 111 | dest->dirty = true; | ||
| 112 | } | ||
| 113 | } | ||
| 114 | |||
| 115 | void iota_gfx_task_user(void) { | ||
| 116 | #if DEBUG_TO_SCREEN | ||
| 117 | if (debug_enable) { | ||
| 118 | return; | ||
| 119 | } | 80 | } |
| 120 | #endif | ||
| 121 | |||
| 122 | struct CharacterMatrix matrix; | ||
| 123 | |||
| 124 | matrix_clear(&matrix); | ||
| 125 | matrix_write_P(&matrix, PSTR("TKC1800")); | ||
| 126 | |||
| 127 | uint8_t layer = biton32(layer_state); | ||
| 128 | |||
| 129 | char buf[40]; | ||
| 130 | snprintf(buf,sizeof(buf), "Undef-%d", layer); | ||
| 131 | matrix_write_P(&matrix, PSTR("\nLayer: ")); | ||
| 132 | matrix_write(&matrix, layer_lookup[layer]); | ||
| 133 | 81 | ||
| 134 | // Host Keyboard LED Status | 82 | // Host Keyboard LED Status |
| 135 | char led[40]; | 83 | led_t led_state = host_keyboard_led_state(); |
| 136 | snprintf(led, sizeof(led), "\n\n%s %s %s", | 84 | oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false); |
| 137 | (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ", | 85 | oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false); |
| 138 | (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ", | 86 | oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false); |
| 139 | (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " "); | ||
| 140 | matrix_write(&matrix, led); | ||
| 141 | matrix_update(&display, &matrix); | ||
| 142 | } | 87 | } |
| 88 | #endif \ No newline at end of file | ||
diff --git a/keyboards/tkc1800/keymaps/yanfali/config.h b/keyboards/tkc1800/keymaps/yanfali/config.h deleted file mode 100644 index f1390cb03..000000000 --- a/keyboards/tkc1800/keymaps/yanfali/config.h +++ /dev/null | |||
| @@ -1,24 +0,0 @@ | |||
| 1 | /* Copyright 2017 Mathias Andersson <wraul@dbox.se> | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #pragma once | ||
| 18 | |||
| 19 | //#define USE_I2C | ||
| 20 | //#define SSD1306OLED | ||
| 21 | //#define OLED_ROTATE180 | ||
| 22 | #define SSD1306_ADDRESS 0x3C | ||
| 23 | |||
| 24 | // place overrides here | ||
diff --git a/keyboards/tkc1800/keymaps/yanfali/keymap.c b/keyboards/tkc1800/keymaps/yanfali/keymap.c index 8dad3446d..bbffc2d20 100644 --- a/keyboards/tkc1800/keymaps/yanfali/keymap.c +++ b/keyboards/tkc1800/keymaps/yanfali/keymap.c | |||
| @@ -13,11 +13,8 @@ | |||
| 13 | * You should have received a copy of the GNU General Public License | 13 | * You should have received a copy of the GNU General Public License |
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ | 15 | */ |
| 16 | |||
| 16 | #include QMK_KEYBOARD_H | 17 | #include QMK_KEYBOARD_H |
| 17 | #include "LUFA/Drivers/Peripheral/TWI.h" | ||
| 18 | #include "i2c.h" | ||
| 19 | #include "ssd1306.h" | ||
| 20 | |||
| 21 | 18 | ||
| 22 | //Layers | 19 | //Layers |
| 23 | 20 | ||
| @@ -26,11 +23,6 @@ enum { | |||
| 26 | FUNCTION, | 23 | FUNCTION, |
| 27 | }; | 24 | }; |
| 28 | 25 | ||
| 29 | //13 characters max without re-writing the "Layer: " format in iota_gfx_task_user() | ||
| 30 | static char layer_lookup[][14] = {"Base","Function"}; | ||
| 31 | |||
| 32 | |||
| 33 | |||
| 34 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | 26 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
| 35 | /* Keymap BASE: (Base Layer) Default Layer | 27 | /* Keymap BASE: (Base Layer) Default Layer |
| 36 | * ,-------------------------------------------------------. ,-------------------. | 28 | * ,-------------------------------------------------------. ,-------------------. |
| @@ -69,68 +61,28 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 69 | ), | 61 | ), |
| 70 | }; | 62 | }; |
| 71 | 63 | ||
| 72 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | 64 | #ifdef OLED_DRIVER_ENABLE |
| 73 | return true; | 65 | void oled_task_user(void) { |
| 74 | } | 66 | oled_write_P(PSTR("TKC1800\n"),false); |
| 75 | 67 | // Host Keyboard Layer Status | |
| 76 | void led_set_user(uint8_t usb_led) { | 68 | oled_write_P(PSTR("Layer: "), false); |
| 77 | 69 | ||
| 78 | } | 70 | switch (get_highest_layer(layer_state)) { |
| 79 | 71 | case BASE: | |
| 80 | void matrix_init_user(void) { | 72 | oled_write_P(PSTR("Base\n"), false); |
| 81 | #ifdef USE_I2C | 73 | break; |
| 82 | i2c_master_init(); | 74 | case FUNCTION: |
| 83 | #ifdef SSD1306OLED | 75 | oled_write_P(PSTR("Function\n"), false); |
| 84 | // calls code for the SSD1306 OLED | 76 | break; |
| 85 | _delay_ms(400); | 77 | default: |
| 86 | TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000)); | 78 | // Or use the write_ln shortcut over adding '\n' to the end of your string |
| 87 | iota_gfx_init(); // turns on the display | 79 | oled_write_ln_P(PSTR("Undefined"), false); |
| 88 | #endif | ||
| 89 | #endif | ||
| 90 | #ifdef AUDIO_ENABLE | ||
| 91 | startup_user(); | ||
| 92 | #endif | ||
| 93 | } | ||
| 94 | |||
| 95 | void matrix_scan_user(void) { | ||
| 96 | #ifdef SSD1306OLED | ||
| 97 | iota_gfx_task(); // this is what updates the display continuously | ||
| 98 | #endif | ||
| 99 | } | ||
| 100 | |||
| 101 | void matrix_update(struct CharacterMatrix *dest, | ||
| 102 | const struct CharacterMatrix *source) { | ||
| 103 | if (memcmp(dest->display, source->display, sizeof(dest->display))) { | ||
| 104 | memcpy(dest->display, source->display, sizeof(dest->display)); | ||
| 105 | dest->dirty = true; | ||
| 106 | } | ||
| 107 | } | ||
| 108 | |||
| 109 | void iota_gfx_task_user(void) { | ||
| 110 | #if DEBUG_TO_SCREEN | ||
| 111 | if (debug_enable) { | ||
| 112 | return; | ||
| 113 | } | 80 | } |
| 114 | #endif | ||
| 115 | |||
| 116 | struct CharacterMatrix matrix; | ||
| 117 | |||
| 118 | matrix_clear(&matrix); | ||
| 119 | matrix_write_P(&matrix, PSTR("TKC1800")); | ||
| 120 | |||
| 121 | uint8_t layer = biton32(layer_state); | ||
| 122 | |||
| 123 | char buf[40]; | ||
| 124 | snprintf(buf,sizeof(buf), "Undef-%d", layer); | ||
| 125 | matrix_write_P(&matrix, PSTR("\nLayer: ")); | ||
| 126 | matrix_write(&matrix, layer_lookup[layer]); | ||
| 127 | 81 | ||
| 128 | // Host Keyboard LED Status | 82 | // Host Keyboard LED Status |
| 129 | char led[40]; | 83 | led_t led_state = host_keyboard_led_state(); |
| 130 | snprintf(led, sizeof(led), "\n\n%s %s %s", | 84 | oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false); |
| 131 | (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ", | 85 | oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false); |
| 132 | (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ", | 86 | oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false); |
| 133 | (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " "); | ||
| 134 | matrix_write(&matrix, led); | ||
| 135 | matrix_update(&display, &matrix); | ||
| 136 | } | 87 | } |
| 88 | #endif \ No newline at end of file | ||
