aboutsummaryrefslogtreecommitdiff
path: root/keyboards/tkc1800/keymaps/smt/keymap.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/tkc1800/keymaps/smt/keymap.c')
-rw-r--r--keyboards/tkc1800/keymaps/smt/keymap.c95
1 files changed, 29 insertions, 66 deletions
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()
36static char layer_lookup[][14] = {"Qwerty","Dvorak","Function"};
37
38
39
40const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 33const 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
154void led_set_user(uint8_t usb_led) { 147#ifdef OLED_DRIVER_ENABLE
155 148void oled_task_user(void) {
156} 149 oled_write_P(PSTR("TKC1800\n"),false);
157 150 // Host Keyboard Layer Status
158void 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;
173void 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
179void 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
187void 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