keymap.c 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  1. #include QMK_KEYBOARD_H
  2. #include "bootloader.h"
  3. #ifdef PROTOCOL_LUFA
  4. #include "lufa.h"
  5. #include "split_util.h"
  6. #endif
  7. #ifdef AUDIO_ENABLE
  8. #include "audio.h"
  9. #endif
  10. #ifdef SSD1306OLED
  11. #include "ssd1306.h"
  12. #endif
  13. extern keymap_config_t keymap_config;
  14. #ifdef RGBLIGHT_ENABLE
  15. //Following line allows macro to read current RGB settings
  16. extern rgblight_config_t rgblight_config;
  17. #endif
  18. extern uint8_t is_master;
  19. #define DELAY_TIME 75
  20. static uint16_t key_timer;
  21. static uint16_t tap_timer;
  22. static uint16_t delay_registered_code;
  23. static uint8_t delay_mat_row;
  24. static uint8_t delay_mat_col;
  25. static bool delay_key_stat;
  26. static bool delay_key_pressed;
  27. static bool tapping_key;
  28. // Each layer gets a name for readability, which is then used in the keymap matrix below.
  29. // The underscores don't mean anything - you can have a layer called STUFF or any other name.
  30. // Layer names don't all need to be of the same length, obviously, and you can also skip them
  31. // entirely and just use numbers.
  32. #define _BASE 0
  33. #define _OPT 1
  34. #define _FUNC 2
  35. #define _SYM 3
  36. #define _NUM 4
  37. bool RGBAnimation = false; //Flag for LED Layer color Refresh.
  38. enum custom_keycodes {
  39. QWERTY = SAFE_RANGE,
  40. EISU,
  41. KANA,
  42. RGBRST,
  43. RGBOFF,
  44. RGB1,
  45. RGB2,
  46. RGB3,
  47. OPT_TAP_SP,
  48. DESKTOP,
  49. MAC,
  50. WIN,
  51. };
  52. enum macro_keycodes {
  53. KC_SAMPLEMACRO,
  54. };
  55. // Fillers to make layering more clear
  56. #define _______ KC_TRNS
  57. #define XXXXXXX KC_NO
  58. //Macros
  59. #define M_SAMPLE M(KC_SAMPLEMACRO)
  60. #if HELIX_ROWS == 5
  61. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  62. /* Base
  63. * ,-----------------------------------------. ,-----------------------------------------.
  64. * | C+z | ; | [ | ( | < | { | | | | | | | |
  65. * |------+------+------+------+------+------| |------+------+------+------+------+------|
  66. * | KANA | P | K | R | A | F | | | | | | | |
  67. * |------+------+------+------+------+------| |------+------+------+------+------+------|
  68. * | BS | D | T | H | E | O | | | | | | | |
  69. * |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
  70. * | Shift| Y | S | N | I | U |Space | | | | | | | |
  71. * |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
  72. * | Ctrl | Alt | win | Sym | Num | OPT | Ent | | | | | | | |
  73. * `-------------------------------------------------------------------------------------------------'
  74. */
  75. [_BASE] = LAYOUT( \
  76. LCTL(KC_Z), KC_SCLN, KC_LBRC, KC_LPRN, KC_LT, KC_LCBR, _______, _______, _______, _______, _______, _______, \
  77. KANA, KC_P, KC_K, KC_R, KC_A, KC_F, _______, _______, _______, _______, _______, _______, \
  78. KC_BSPC, KC_D, KC_T, KC_H, KC_E, KC_O, _______, _______, _______, _______, _______, _______, \
  79. OSM(MOD_LSFT), KC_Y, KC_S, KC_N, KC_I, KC_U, KC_SPC, _______, _______, _______, _______, _______, _______, _______, \
  80. OSM(MOD_LCTL), OSM(MOD_LALT), OSM(MOD_LGUI), MO(_SYM), MO(_NUM), OPT_TAP_SP, KC_ENT, _______, _______, _______, _______, _______, _______, _______ \
  81. ),
  82. /* Opt
  83. * ,-----------------------------------------. ,-----------------------------------------.
  84. * | Esc | : | ] | ) | > | } | | | | | | | |
  85. * |------+------+------+------+------+------| |------+------+------+------+------+------|
  86. * | EISU| J | M | B | ' | Tab | | | | | | | |
  87. * |------+------+------+------+------+------| |------+------+------+------+------+------|
  88. * | . | V | C | L | Z | Q | | | | | | | |
  89. * |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
  90. * | | X | G | W | - | Del | Esc | | | | | | | |
  91. * |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
  92. * | | | | , | DTOP | | | | | | | | | |
  93. * `-------------------------------------------------------------------------------------------------'
  94. */
  95. [_OPT] = LAYOUT( \
  96. KC_ESC, KC_COLN,KC_RBRC, KC_RPRN,KC_GT, KC_RCBR, _______, _______, _______, _______, _______, _______, \
  97. EISU, KC_J, KC_M, KC_B, KC_QUOT, KC_TAB, _______, _______, _______, _______, _______, _______, \
  98. KC_DOT, KC_V, KC_C, KC_L, KC_Z, KC_Q, _______, _______, _______, _______, _______, _______, \
  99. _______, KC_X, KC_G, KC_W, KC_MINUS, KC_DEL, KC_ESC, _______, _______, _______, _______, _______, _______, _______, \
  100. _______, _______,_______, KC_COMM,DESKTOP, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
  101. ),
  102. /* Func
  103. * ,-----------------------------------------. ,-----------------------------------------.
  104. * |RGBRST| Hue | | RST | Mac | Win | | | | | | | |
  105. * |------+------+------+------+------+------| |------+------+------+------+------+------|
  106. * | RGB1 | VAL+ | F7 | F8 | F9 | | | | | | | | |
  107. * |------+------+------+------+------+------| |------+------+------+------+------+------|
  108. * | RGB2 | VAL- | F4 | F5 | F6 | F12 | | | | | | | |
  109. * |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
  110. * | RGB3 | F10 | F1 | F2 | F3 | F11 | | | | | | | | |
  111. * |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
  112. * |RGBOFF| | | | | | | | | | | | | |
  113. * `-------------------------------------------------------------------------------------------------'
  114. */
  115. [_FUNC] = LAYOUT( \
  116. RGBRST,RGB_HUI, _______, RESET, MAC, WIN, _______, _______, _______, _______, _______, _______, \
  117. RGB1, RGB_VAI, KC_F7, KC_F8, KC_F9, _______, _______, _______, _______, _______, _______, _______, \
  118. RGB2, RGB_VAD, KC_F4, KC_F5, KC_F6, KC_F12, _______, _______, _______, _______, _______, _______, \
  119. RGB3, KC_F10, KC_F1, KC_F2, KC_F3, KC_F11, _______, _______, _______, _______, _______, _______, _______, _______, \
  120. RGBOFF,_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
  121. ),
  122. /* Sym
  123. * ,-----------------------------------------. ,-----------------------------------------.
  124. * | Ins | GRV | | PU | PD | ^ | | | | | | | |
  125. * |------+------+------+------+------+------| |------+------+------+------+------+------|
  126. * | | \ | # | = | ? | % | | | | | | | |
  127. * |------+------+------+------+------+------| |------+------+------+------+------+------|
  128. * | | $ | upA | @ | ! | | | | | | | | | |
  129. * |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
  130. * | CL | <- | dwA | -> | _ | & | | | | | | | | |
  131. * |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
  132. * | | | PS | | ~ | | | | | | | | | |
  133. * `-------------------------------------------------------------------------------------------------'
  134. */
  135. [_SYM] = LAYOUT( \
  136. KC_INS, KC_GRV, _______, KC_PGUP, KC_PGDN, KC_CIRC, _______, _______, _______, _______, _______, _______, \
  137. _______, KC_BSLS, KC_HASH, KC_EQL, KC_QUES, KC_PERC, _______, _______, _______, _______, _______, _______, \
  138. _______, KC_DLR, KC_UP, KC_AT, KC_EXLM, KC_PIPE, _______, _______, _______, _______, _______, _______, \
  139. KC_CAPS, KC_LEFT, KC_DOWN, KC_RIGHT,KC_UNDS, KC_AMPR, _______, _______, _______, _______, _______, _______, _______, _______, \
  140. _______, _______, KC_PSCR, _______, KC_TILD, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
  141. ),
  142. /* Raise
  143. * ,-----------------------------------------. ,-----------------------------------------.
  144. * | | | Func | home | End | | | | | | | | |
  145. * |------+------+------+------+------+------| |------+------+------+------+------+------|
  146. * | | * | 7 | 8 | 9 | - | | | | | | | |
  147. * |------+------+------+------+------+------| |------+------+------+------+------+------|
  148. * | . | / | 4 | 5 | 6 | + | | | | | | | |
  149. * |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
  150. * | LN | 0 | 1 | 2 | 3 |C+S+F1| | | | | | | | |
  151. * |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
  152. * | | | | , | | | | | | | | | | |
  153. * `-------------------------------------------------------------------------------------------------'
  154. */
  155. [_NUM] = LAYOUT( \
  156. _______, _______, OSL(_FUNC), KC_HOME, KC_END, _______, _______, _______, _______, _______, _______, _______, \
  157. _______, KC_ASTR, KC_P7, KC_P8, KC_P9, KC_MINS, _______, _______, _______, _______, _______, _______, \
  158. KC_PDOT, KC_SLSH, KC_P4, KC_P5, KC_P6, KC_PLUS, _______, _______, _______, _______, _______, _______, \
  159. KC_NLCK, KC_P0, KC_P1, KC_P2, KC_P3, LCTL(S(KC_F1)), _______, _______, _______, _______, _______, _______, _______, _______, \
  160. _______, _______, KC_PDOT, KC_COMM, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
  161. )
  162. };
  163. #else
  164. #error "undefined keymaps"
  165. #endif
  166. #ifdef AUDIO_ENABLE
  167. float tone_qwerty[][2] = SONG(QWERTY_SOUND);
  168. float tone_dvorak[][2] = SONG(DVORAK_SOUND);
  169. float tone_colemak[][2] = SONG(COLEMAK_SOUND);
  170. float tone_plover[][2] = SONG(PLOVER_SOUND);
  171. float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND);
  172. float music_scale[][2] = SONG(MUSIC_SCALE_SOUND);
  173. #endif
  174. // define variables for reactive RGB
  175. //bool TOG_STATUS = false;
  176. int RGB_current_mode;
  177. void persistent_default_layer_set(uint16_t default_layer) {
  178. eeconfig_update_default_layer(default_layer);
  179. default_layer_set(default_layer);
  180. }
  181. bool find_mairix(uint16_t keycode, uint8_t *row, uint8_t *col){
  182. for(uint8_t i=0; i<MATRIX_ROWS; i++){
  183. for(uint8_t j=0; j<MATRIX_COLS; j++){
  184. if( pgm_read_word(&(keymaps[_BASE][i][j]))==keycode){
  185. *row = i;
  186. *col = j;
  187. return true;
  188. }
  189. }
  190. }
  191. return false;
  192. }
  193. void unregister_delay_code(void){
  194. if(delay_registered_code){
  195. unregister_code(delay_registered_code);
  196. if (delay_registered_code & QK_LSFT){
  197. unregister_code(KC_LSFT);
  198. }
  199. if (delay_registered_code & QK_LCTL){
  200. unregister_code(KC_LCTL);
  201. }
  202. if (delay_registered_code & QK_LALT){
  203. unregister_code(KC_LALT);
  204. }
  205. if (delay_registered_code & QK_LGUI){
  206. unregister_code(KC_LGUI);
  207. }
  208. delay_registered_code=0;
  209. }
  210. }
  211. void register_delay_code(uint8_t layer){
  212. if(delay_key_stat){
  213. unregister_delay_code();
  214. uint16_t code = pgm_read_word(&(keymaps[layer][delay_mat_row][delay_mat_col]));
  215. if (code & QK_LSFT){
  216. register_code(KC_LSFT);
  217. }
  218. if (code & QK_LCTL){
  219. register_code(KC_LCTL);
  220. }
  221. if (code & QK_LALT){
  222. register_code(KC_LALT);
  223. }
  224. if (code & QK_LGUI){
  225. register_code(KC_LGUI);
  226. }
  227. register_code(code);
  228. delay_registered_code = code;
  229. delay_key_stat = false;
  230. tapping_key = true;
  231. }
  232. }
  233. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  234. if(tap_timer&&keycode!=OPT_TAP_SP){
  235. tapping_key = true;
  236. }
  237. if(keycode==delay_registered_code){
  238. if (!record->event.pressed){
  239. unregister_delay_code();
  240. }
  241. }
  242. switch (keycode) {
  243. case KC_SCLN:
  244. case KC_LBRC:
  245. case KC_LPRN:
  246. case KC_LT:
  247. case KC_LCBR:
  248. case KC_P:
  249. case KC_K:
  250. case KC_R:
  251. case KC_A:
  252. case KC_F:
  253. case KC_BSPC:
  254. case KC_D:
  255. case KC_T:
  256. case KC_H:
  257. case KC_E:
  258. case KC_O:
  259. case KC_Y:
  260. case KC_S:
  261. case KC_N:
  262. case KC_I:
  263. case KC_U:
  264. case LCTL(KC_Z):
  265. case KC_SPC:
  266. if (record->event.pressed) {
  267. register_delay_code(_BASE);
  268. if(find_mairix(keycode, &delay_mat_row, &delay_mat_col)){
  269. key_timer = timer_read();
  270. delay_key_stat = true;
  271. delay_key_pressed = true;
  272. }
  273. }else{
  274. delay_key_pressed = false;
  275. }
  276. return false;
  277. break;
  278. case OPT_TAP_SP:
  279. if (record->event.pressed) {
  280. tapping_key = false;
  281. register_delay_code(_OPT);
  282. layer_on(_OPT);
  283. tap_timer = timer_read();
  284. }else{
  285. layer_off(_OPT);
  286. if(tapping_key==false && timer_elapsed(tap_timer) < TAPPING_TERM){
  287. SEND_STRING(" ");
  288. }
  289. tap_timer = 0;
  290. }
  291. return false;
  292. break;
  293. case EISU:
  294. if (record->event.pressed) {
  295. if(keymap_config.swap_lalt_lgui==false){
  296. register_code(KC_LANG2);
  297. }else{
  298. SEND_STRING(SS_LALT("`"));
  299. }
  300. } else {
  301. unregister_code(KC_LANG2);
  302. }
  303. return false;
  304. break;
  305. case KANA:
  306. if (record->event.pressed) {
  307. if(keymap_config.swap_lalt_lgui==false){
  308. register_code(KC_LANG1);
  309. }else{
  310. SEND_STRING(SS_LALT("`"));
  311. }
  312. } else {
  313. unregister_code(KC_LANG1);
  314. }
  315. return false;
  316. break;
  317. case DESKTOP:
  318. if (record->event.pressed) {
  319. if(keymap_config.swap_lalt_lgui==false){
  320. register_code(KC_F11);
  321. }else{
  322. SEND_STRING(SS_LGUI("d"));
  323. }
  324. } else {
  325. unregister_code(KC_F11);
  326. }
  327. return false;
  328. break;
  329. case RGBRST:
  330. #ifdef RGBLIGHT_ENABLE
  331. if (record->event.pressed) {
  332. eeconfig_update_rgblight_default();
  333. rgblight_enable();
  334. RGB_current_mode = rgblight_config.mode;
  335. RGBAnimation = false;
  336. }
  337. #endif
  338. break;
  339. case RGBOFF:
  340. #ifdef RGBLIGHT_ENABLE
  341. if (record->event.pressed) {
  342. rgblight_disable();
  343. }
  344. #endif
  345. break;
  346. case RGB1:
  347. #ifdef RGBLIGHT_ENABLE
  348. if (record->event.pressed) {
  349. RGBAnimation = true;
  350. rgblight_mode(6);
  351. RGB_current_mode = rgblight_config.mode;
  352. }
  353. #endif
  354. break;
  355. case RGB2:
  356. #ifdef RGBLIGHT_ENABLE
  357. if (record->event.pressed) {
  358. RGBAnimation = true;
  359. rgblight_mode(10);
  360. RGB_current_mode = rgblight_config.mode;
  361. }
  362. #endif
  363. break;
  364. case RGB3:
  365. #ifdef RGBLIGHT_ENABLE
  366. if (record->event.pressed) {
  367. RGBAnimation = true;
  368. rgblight_mode(21);
  369. RGB_current_mode = rgblight_config.mode;
  370. }
  371. #endif
  372. break;
  373. case MAC:
  374. if (record->event.pressed) {
  375. keymap_config.swap_lalt_lgui = false;
  376. keymap_config.swap_ralt_rgui = false;
  377. #ifdef AUDIO_ENABLE
  378. PLAY_SONG(ag_norm_song);
  379. #endif
  380. }
  381. break;
  382. case WIN:
  383. if (record->event.pressed) {
  384. keymap_config.swap_lalt_lgui = true;
  385. keymap_config.swap_ralt_rgui = true;
  386. #ifdef AUDIO_ENABLE
  387. PLAY_SONG(ag_swap_song);
  388. #endif
  389. }
  390. break;
  391. }
  392. return true;
  393. }
  394. //keyboard start-up code. Runs once when the firmware starts up.
  395. void matrix_init_user(void) {
  396. #ifdef AUDIO_ENABLE
  397. startup_user();
  398. #endif
  399. #ifdef RGBLIGHT_ENABLE
  400. RGB_current_mode = rgblight_config.mode;
  401. #endif
  402. //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
  403. #ifdef SSD1306OLED
  404. iota_gfx_init(!has_usb()); // turns on the display
  405. #endif
  406. }
  407. #ifdef AUDIO_ENABLE
  408. void startup_user()
  409. {
  410. _delay_ms(20); // gets rid of tick
  411. }
  412. void shutdown_user()
  413. {
  414. _delay_ms(150);
  415. stop_all_notes();
  416. }
  417. void music_on_user(void)
  418. {
  419. music_scale_user();
  420. }
  421. void music_scale_user(void)
  422. {
  423. PLAY_SONG(music_scale);
  424. }
  425. #endif
  426. //assign the right code to your layers for OLED display
  427. #define L_BASE 0
  428. #define L_OPT 2
  429. #define L_FUNC 4
  430. #define L_SYM 8
  431. #define L_NUM 16
  432. #define L_FNLAYER 64
  433. #define L_NUMLAY 128
  434. #define L_NLOWER 136
  435. #define L_NFNLAYER 192
  436. #define L_MOUSECURSOR 256
  437. uint8_t layer_state_old;
  438. //runs every scan cycle (a lot)
  439. void matrix_scan_user(void) {
  440. #ifdef SSD1306OLED
  441. iota_gfx_task(); // this is what updates the display continuously
  442. #endif
  443. if(delay_key_stat && (timer_elapsed(key_timer) > DELAY_TIME)){
  444. register_delay_code(_BASE);
  445. if(!delay_key_pressed){
  446. unregister_delay_code();
  447. }
  448. }
  449. if(layer_state_old != layer_state){
  450. switch (layer_state) {
  451. case L_BASE:
  452. #ifdef RGBLIGHT_ENABLE
  453. if (!RGBAnimation){
  454. rgblight_sethsv(187,255,255);
  455. rgblight_mode(1);
  456. }else{
  457. rgblight_mode(RGB_current_mode);
  458. }
  459. #endif
  460. break;
  461. case L_OPT:
  462. register_delay_code(_OPT);
  463. break;
  464. case L_NUM:
  465. register_delay_code(_NUM);
  466. #ifdef RGBLIGHT_ENABLE
  467. rgblight_sethsv(25,255,255);
  468. rgblight_mode(1);
  469. #endif
  470. break;
  471. case L_SYM:
  472. register_delay_code(_SYM);
  473. #ifdef RGBLIGHT_ENABLE
  474. rgblight_sethsv(96,255,255);
  475. rgblight_mode(1);
  476. #endif
  477. break;
  478. case L_FUNC:
  479. register_delay_code(_FUNC);
  480. #ifdef RGBLIGHT_ENABLE
  481. rgblight_sethsv(331,255,255);
  482. rgblight_mode(1);
  483. #endif
  484. break;
  485. }
  486. layer_state_old = layer_state;
  487. }
  488. }
  489. //SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h
  490. #ifdef SSD1306OLED
  491. void matrix_update(struct CharacterMatrix *dest,
  492. const struct CharacterMatrix *source) {
  493. if (memcmp(dest->display, source->display, sizeof(dest->display))) {
  494. memcpy(dest->display, source->display, sizeof(dest->display));
  495. dest->dirty = true;
  496. }
  497. }
  498. // Render to OLED
  499. void render_status(struct CharacterMatrix *matrix) {
  500. // froggy logo
  501. static char logo[4][1][17]=
  502. {
  503. {
  504. {0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f,0x70,0x71,0x72,0x73,0x74,0}
  505. },
  506. {
  507. {0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,0}
  508. },
  509. {
  510. {0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4,0}
  511. },
  512. {
  513. {0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0}
  514. }
  515. };
  516. static char indctr[8][2][4]=
  517. {
  518. // white icon
  519. {
  520. {0x60,0x61,0x62,0},
  521. {0x63,0x64,0}
  522. },
  523. {
  524. {0x80,0x81,0x82,0},
  525. {0x83,0x84,0}
  526. },
  527. {
  528. {0xa0,0xa1,0xa2,0},
  529. {0xa3,0xa4,0}
  530. },
  531. {
  532. {0xc0,0xc1,0xc2,0},
  533. {0xc3,0xc4,0}
  534. },
  535. // Black icon
  536. {
  537. {0x75,0x76,0x77,0},
  538. {0x78,0x79,0}
  539. },
  540. {
  541. {0x95,0x96,0x97,0},
  542. {0x98,0x99,0}
  543. },
  544. {
  545. {0xb5,0xb6,0xb7,0},
  546. {0xb8,0xb9,0}
  547. },
  548. {
  549. {0xd5,0xd6,0xd7,0},
  550. {0xd8,0xd9,0}
  551. },
  552. };
  553. int rown = 0;
  554. int rowf = 0;
  555. int rowa = 0;
  556. int rows = 0;
  557. //Set Indicator icon
  558. if (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) { rown = 4; } else { rown = 0; }
  559. if (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) { rowa = 4; } else { rowa = 0; }
  560. if (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) { rows = 4; } else { rows = 0; }
  561. if (layer_state == L_FUNC) { rowf = 4; }
  562. matrix_write(matrix, indctr[rown] [0]);
  563. matrix_write(matrix, indctr[rowf] [1]);
  564. matrix_write(matrix, logo [0] [0]);
  565. matrix_write(matrix, indctr[rown+1][0]);
  566. matrix_write(matrix, indctr[rowf+1][1]);
  567. matrix_write(matrix, logo [1] [0]);
  568. matrix_write(matrix, indctr[rowa+2][0]);
  569. matrix_write(matrix, indctr[rows+2][1]);
  570. matrix_write(matrix, logo [2] [0]);
  571. matrix_write(matrix, indctr[rowa+3][0]);
  572. matrix_write(matrix, indctr[rows+3][1]);
  573. matrix_write(matrix, logo [3] [0]);
  574. }
  575. void iota_gfx_task_user(void) {
  576. struct CharacterMatrix matrix;
  577. #if DEBUG_TO_SCREEN
  578. if (debug_enable) {
  579. return;
  580. }
  581. #endif
  582. matrix_clear(&matrix);
  583. if(is_master){
  584. render_status(&matrix);
  585. }
  586. matrix_update(&display, &matrix);
  587. }
  588. #endif