diff options
| author | Naoki Katahira <kata0510.com@gmail.com> | 2018-10-23 03:39:26 +0900 |
|---|---|---|
| committer | Drashna Jaelre <drashna@live.com> | 2018-10-22 11:39:26 -0700 |
| commit | f69333a0e57ca767d49b3155a31fd6d30114dced (patch) | |
| tree | 89990b1c81ccfd60324c5bcffebd05802ca80505 | |
| parent | 4665e4ffffcdfc6fe6f498928963adc64f6fefd7 (diff) | |
| download | qmk_firmware-f69333a0e57ca767d49b3155a31fd6d30114dced.tar.gz qmk_firmware-f69333a0e57ca767d49b3155a31fd6d30114dced.zip | |
Lily58 default keymap fix / add keymap (#4190)
* keymap fix/add
* keymap fix
* file fix
* typo fix
| -rw-r--r-- | keyboards/lily58/keymaps/default/config.h | 2 | ||||
| -rw-r--r-- | keyboards/lily58/keymaps/default/keymap.c | 60 | ||||
| -rw-r--r-- | keyboards/lily58/keymaps/default/rules.mk | 1 | ||||
| -rw-r--r-- | keyboards/lily58/keymaps/yuchi/config.h | 39 | ||||
| -rw-r--r-- | keyboards/lily58/keymaps/yuchi/keymap.c | 148 | ||||
| -rw-r--r-- | keyboards/lily58/keymaps/yuchi/rules.mk | 22 | ||||
| -rw-r--r-- | keyboards/lily58/rev1/rev1.c | 12 | ||||
| -rw-r--r-- | keyboards/lily58/rules.mk | 4 | ||||
| -rw-r--r-- | keyboards/lily58/split_util.c | 3 | ||||
| -rw-r--r-- | keyboards/lily58/ssd1306.c | 330 | ||||
| -rw-r--r-- | keyboards/lily58/ssd1306.h | 94 |
11 files changed, 237 insertions, 478 deletions
diff --git a/keyboards/lily58/keymaps/default/config.h b/keyboards/lily58/keymaps/default/config.h index 3077c9463..fd0978559 100644 --- a/keyboards/lily58/keymaps/default/config.h +++ b/keyboards/lily58/keymaps/default/config.h | |||
| @@ -19,8 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 19 | */ | 19 | */ |
| 20 | #pragma once | 20 | #pragma once |
| 21 | 21 | ||
| 22 | #include "config.h" | ||
| 23 | |||
| 24 | /* Use I2C or Serial, not both */ | 22 | /* Use I2C or Serial, not both */ |
| 25 | 23 | ||
| 26 | #define USE_SERIAL | 24 | #define USE_SERIAL |
diff --git a/keyboards/lily58/keymaps/default/keymap.c b/keyboards/lily58/keymaps/default/keymap.c index 624ce210b..8d7705812 100644 --- a/keyboards/lily58/keymaps/default/keymap.c +++ b/keyboards/lily58/keymaps/default/keymap.c | |||
| @@ -19,7 +19,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 19 | 19 | ||
| 20 | /* QWERTY | 20 | /* QWERTY |
| 21 | * ,-----------------------------------------. ,-----------------------------------------. | 21 | * ,-----------------------------------------. ,-----------------------------------------. |
| 22 | * | ESC | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | ~ | | 22 | * | ESC | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | ` | |
| 23 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | 23 | * |------+------+------+------+------+------| |------+------+------+------+------+------| |
| 24 | * | Tab | Q | W | E | R | T | | Y | U | I | O | P | - | | 24 | * | Tab | Q | W | E | R | T | | Y | U | I | O | P | - | |
| 25 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | 25 | * |------+------+------+------+------+------| |------+------+------+------+------+------| |
| @@ -27,9 +27,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 27 | * |------+------+------+------+------+------| [ | | ] |------+------+------+------+------+------| | 27 | * |------+------+------+------+------+------| [ | | ] |------+------+------+------+------+------| |
| 28 | * |LShift| Z | X | C | V | B |-------| |-------| N | M | , | . | / |RShift| | 28 | * |LShift| Z | X | C | V | B |-------| |-------| N | M | , | . | / |RShift| |
| 29 | * `-----------------------------------------/ / \ \-----------------------------------------' | 29 | * `-----------------------------------------/ / \ \-----------------------------------------' |
| 30 | * |LOWER | LGUI | Alt | /Space / \Enter \ |BackSP| RGUI |RAISE | | 30 | * | LAlt | LGUI |LOWER | /Space / \Enter \ |RAISE |BackSP| RGUI | |
| 31 | * | | | |/ / \ \ | | | | | 31 | * | | | |/ / \ \ | | | | |
| 32 | * `-------------------''-------' '------''--------------------' | 32 | * `----------------------------' '------''--------------------' |
| 33 | */ | 33 | */ |
| 34 | 34 | ||
| 35 | [_QWERTY] = LAYOUT( \ | 35 | [_QWERTY] = LAYOUT( \ |
| @@ -37,53 +37,52 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 37 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_MINS, \ | 37 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_MINS, \ |
| 38 | KC_LCTRL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ | 38 | KC_LCTRL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ |
| 39 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_LBRC, KC_RBRC, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, \ | 39 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_LBRC, KC_RBRC, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, \ |
| 40 | LOWER,KC_LGUI, KC_LALT, KC_SPC, KC_ENT, KC_BSPC, KC_RGUI, RAISE \ | 40 | KC_LALT, KC_LGUI,LOWER, KC_SPC, KC_ENT, RAISE, KC_BSPC, KC_RGUI \ |
| 41 | ), | 41 | ), |
| 42 | /* LOWER | 42 | /* LOWER |
| 43 | * ,-----------------------------------------. ,-----------------------------------------. | 43 | * ,-----------------------------------------. ,-----------------------------------------. |
| 44 | * | F1 | F2 | F3 | F4 | F5 | F6 | | F7 | F8 | F9 | F10 | F11 | F12 | | 44 | * | | | | | | | | | | | | | | |
| 45 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | 45 | * |------+------+------+------+------+------| |------+------+------+------+------+------| |
| 46 | * | ~ | ! | @ | # | $ | % | | ^ | & | * | ( | ) | | | 46 | * | F1 | F2 | F3 | F4 | F5 | F6 | | F7 | F8 | F9 | F10 | F11 | F12 | |
| 47 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | 47 | * |------+------+------+------+------+------| |------+------+------+------+------+------| |
| 48 | * | | | | | | |-------. ,-------| | _ | + | | | | | 48 | * | ` | ! | @ | # | $ | % |-------. ,-------| ^ | & | * | ( | ) | - | |
| 49 | * |------+------+------+------+------+------| [ | | ] |------+------+------+------+------+------| | 49 | * |------+------+------+------+------+------| [ | | ] |------+------+------+------+------+------| |
| 50 | * | | | | | | |-------| |-------| |ISO ~ |ISO | | | | | | 50 | * | | | | | | |-------| |-------| | _ | + | { | } | | | |
| 51 | * `-----------------------------------------/ / \ \-----------------------------------------' | 51 | * `-----------------------------------------/ / \ \-----------------------------------------' |
| 52 | * |LOWER | LGUI | Alt | /Space / \Enter \ |BackSP| RGUI |RAISE | | 52 | * | LAlt | LGUI |LOWER | /Space / \Enter \ |RAISE |BackSP| RGUI | |
| 53 | * | | | |/ / \ \ | | | | | 53 | * | | | |/ / \ \ | | | | |
| 54 | * `-------------------''-------' '------''--------------------' | 54 | * `----------------------------' '------''--------------------' |
| 55 | */ | 55 | */ |
| 56 | [_LOWER] = LAYOUT( \ | 56 | [_LOWER] = LAYOUT( \ |
| 57 | KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \ | 57 | _______, _______, _______, _______, _______, _______, _______, _______, _______,_______, _______, _______,\ |
| 58 | KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, \ | 58 | KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \ |
| 59 | _______, _______, _______, _______, _______, _______, _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \ | 59 | KC_GRV, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_TILD, \ |
| 60 | _______, _______, _______, _______, _______, _______, _______, _______, _______,S(KC_NUHS),S(KC_NUBS),_______, _______, _______,\ | 60 | _______, _______, _______, _______, _______, _______, _______, _______, XXXXXXX, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \ |
| 61 | _______, _______, _______, _______, _______, _______, _______, _______\ | 61 | _______, _______, _______, _______, _______, _______, _______, _______\ |
| 62 | ), | 62 | ), |
| 63 | /* RAISE | 63 | /* RAISE |
| 64 | * ,-----------------------------------------. ,-----------------------------------------. | 64 | * ,-----------------------------------------. ,-----------------------------------------. |
| 65 | * | F1 | F2 | F3 | F4 | F5 | F6 | | F7 | F8 | F9 | F10 | F11 | F12 | | 65 | * | | | | | | | | | | | | | | |
| 66 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | 66 | * |------+------+------+------+------+------| |------+------+------+------+------+------| |
| 67 | * | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | | | 67 | * | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | | |
| 68 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | 68 | * |------+------+------+------+------+------| |------+------+------+------+------+------| |
| 69 | * | | | | | | |-------. ,-------| | Left | Down | Up |Right | | | 69 | * | F1 | F2 | F3 | F4 | F5 | F6 |-------. ,-------| | Left | Down | Up |Right | | |
| 70 | * |------+------+------+------+------+------| [ | | ] |------+------+------+------+------+------| | 70 | * |------+------+------+------+------+------| [ | | ] |------+------+------+------+------+------| |
| 71 | * | | | | | | |-------| |-------| + | - | = | [ | ] | \ | | 71 | * | F7 | F8 | F9 | F10 | F11 | F12 |-------| |-------| + | - | = | [ | ] | \ | |
| 72 | * `-----------------------------------------/ / \ \-----------------------------------------' | 72 | * `-----------------------------------------/ / \ \-----------------------------------------' |
| 73 | * |LOWER | LGUI | Alt | /Space / \Enter \ |BackSP| RGUI |RAISE | | 73 | * | LAlt | LGUI |LOWER | /Space / \Enter \ |RAISE |BackSP| RGUI | |
| 74 | * | | | |/ / \ \ | | | | | 74 | * | | | |/ / \ \ | | | | |
| 75 | * `-------------------''-------' '------''--------------------' | 75 | * `----------------------------' '------''--------------------' |
| 76 | */ | 76 | */ |
| 77 | 77 | ||
| 78 | [_RAISE] = LAYOUT( \ | 78 | [_RAISE] = LAYOUT( \ |
| 79 | KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \ | 79 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ |
| 80 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______, \ | 80 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______, \ |
| 81 | _______, _______, _______, _______, _______, _______, XXXXXXX, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, XXXXXXX, \ | 81 | KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, XXXXXXX, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, XXXXXXX, \ |
| 82 | _______, _______, _______, _______, _______, _______, _______, _______, KC_PLUS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \ | 82 | KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, KC_PLUS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \ |
| 83 | _______, _______, _______, _______, _______, _______, _______, _______ \ | 83 | _______, _______, _______, _______, _______, _______, _______, _______ \ |
| 84 | ), | 84 | ), |
| 85 | 85 | /* ADJUST | |
| 86 | /* ADJUST (Layers for Underglow) | ||
| 87 | * ,-----------------------------------------. ,-----------------------------------------. | 86 | * ,-----------------------------------------. ,-----------------------------------------. |
| 88 | * | | | | | | | | | | | | | | | 87 | * | | | | | | | | | | | | | | |
| 89 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | 88 | * |------+------+------+------+------+------| |------+------+------+------+------+------| |
| @@ -93,9 +92,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 93 | * |------+------+------+------+------+------| | | |------+------+------+------+------+------| | 92 | * |------+------+------+------+------+------| | | |------+------+------+------+------+------| |
| 94 | * | | | | | | |-------| |-------| | | | | | | | 93 | * | | | | | | |-------| |-------| | | | | | | |
| 95 | * `-----------------------------------------/ / \ \-----------------------------------------' | 94 | * `-----------------------------------------/ / \ \-----------------------------------------' |
| 96 | * |LOWER | LGUI | Alt | /Space / \Enter \ |BackSP| RGUI |RAISE | | 95 | * | LAlt | LGUI |LOWER | /Space / \Enter \ |RAISE |BackSP| RGUI | |
| 97 | * | | | |/ / \ \ | | | | | 96 | * | | | |/ / \ \ | | | | |
| 98 | * `-------------------''-------' '------''--------------------' | 97 | * `----------------------------' '------''--------------------' |
| 99 | */ | 98 | */ |
| 100 | [_ADJUST] = LAYOUT( \ | 99 | [_ADJUST] = LAYOUT( \ |
| 101 | XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ | 100 | XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ |
| @@ -107,17 +106,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 107 | }; | 106 | }; |
| 108 | 107 | ||
| 109 | 108 | ||
| 110 | |||
| 111 | void persistent_default_layer_set(uint16_t default_layer) { | ||
| 112 | eeconfig_update_default_layer(default_layer); | ||
| 113 | default_layer_set(default_layer); | ||
| 114 | } | ||
| 115 | |||
| 116 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | 109 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { |
| 117 | switch (keycode) { | 110 | switch (keycode) { |
| 118 | case QWERTY: | 111 | case QWERTY: |
| 119 | if (record->event.pressed) { | 112 | if (record->event.pressed) { |
| 120 | print("mode just switched to qwerty and this is a huge string\n"); | ||
| 121 | set_single_persistent_default_layer(_QWERTY); | 113 | set_single_persistent_default_layer(_QWERTY); |
| 122 | } | 114 | } |
| 123 | return false; | 115 | return false; |
diff --git a/keyboards/lily58/keymaps/default/rules.mk b/keyboards/lily58/keymaps/default/rules.mk index 73777a1b7..3d2d3c9e0 100644 --- a/keyboards/lily58/keymaps/default/rules.mk +++ b/keyboards/lily58/keymaps/default/rules.mk | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | # the appropriate keymap folder that will get included automatically | 4 | # the appropriate keymap folder that will get included automatically |
| 5 | # | 5 | # |
| 6 | 6 | ||
| 7 | OLED_ENABLE = no | ||
| 8 | RGBLIGHT_ENABLE = no | 7 | RGBLIGHT_ENABLE = no |
| 9 | 8 | ||
| 10 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) | 9 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) |
diff --git a/keyboards/lily58/keymaps/yuchi/config.h b/keyboards/lily58/keymaps/yuchi/config.h new file mode 100644 index 000000000..fd0978559 --- /dev/null +++ b/keyboards/lily58/keymaps/yuchi/config.h | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | /* | ||
| 2 | This is the c configuration file for the keymap | ||
| 3 | |||
| 4 | Copyright 2012 Jun Wako <wakojun@gmail.com> | ||
| 5 | Copyright 2015 Jack Humbert | ||
| 6 | |||
| 7 | This program is free software: you can redistribute it and/or modify | ||
| 8 | it under the terms of the GNU General Public License as published by | ||
| 9 | the Free Software Foundation, either version 2 of the License, or | ||
| 10 | (at your option) any later version. | ||
| 11 | |||
| 12 | This program is distributed in the hope that it will be useful, | ||
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | GNU General Public License for more details. | ||
| 16 | |||
| 17 | You should have received a copy of the GNU General Public License | ||
| 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 19 | */ | ||
| 20 | #pragma once | ||
| 21 | |||
| 22 | /* Use I2C or Serial, not both */ | ||
| 23 | |||
| 24 | #define USE_SERIAL | ||
| 25 | // #define USE_I2C | ||
| 26 | |||
| 27 | /* Select hand configuration */ | ||
| 28 | |||
| 29 | #define MASTER_LEFT | ||
| 30 | // #define MASTER_RIGHT | ||
| 31 | // #define EE_HANDS | ||
| 32 | |||
| 33 | // Underglow | ||
| 34 | /* | ||
| 35 | #undef RGBLED_NUM | ||
| 36 | #define RGBLED_NUM 14 // Number of LEDs | ||
| 37 | #define RGBLIGHT_ANIMATIONS | ||
| 38 | #define RGBLIGHT_SLEEP | ||
| 39 | */ \ No newline at end of file | ||
diff --git a/keyboards/lily58/keymaps/yuchi/keymap.c b/keyboards/lily58/keymaps/yuchi/keymap.c new file mode 100644 index 000000000..d708dbec7 --- /dev/null +++ b/keyboards/lily58/keymaps/yuchi/keymap.c | |||
| @@ -0,0 +1,148 @@ | |||
| 1 | #include QMK_KEYBOARD_H | ||
| 2 | |||
| 3 | extern keymap_config_t keymap_config; | ||
| 4 | |||
| 5 | #define _QWERTY 0 | ||
| 6 | #define _LOWER 1 | ||
| 7 | #define _RAISE 2 | ||
| 8 | #define _ADJUST 16 | ||
| 9 | |||
| 10 | enum custom_keycodes { | ||
| 11 | QWERTY = SAFE_RANGE, | ||
| 12 | LOWER, | ||
| 13 | RAISE, | ||
| 14 | ADJUST, | ||
| 15 | }; | ||
| 16 | |||
| 17 | |||
| 18 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 19 | |||
| 20 | /* QWERTY | ||
| 21 | * ,-----------------------------------------. ,-----------------------------------------. | ||
| 22 | * | ESC | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | ~ | | ||
| 23 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | ||
| 24 | * | Tab | Q | W | E | R | T | | Y | U | I | O | P | - | | ||
| 25 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | ||
| 26 | * |LCTRL | A | S | D | F | G |-------. ,-------| H | J | K | L | ; | ' | | ||
| 27 | * |------+------+------+------+------+------| [ | | ] |------+------+------+------+------+------| | ||
| 28 | * |LShift| Z | X | C | V | B |-------| |-------| N | M | , | . | / |RShift| | ||
| 29 | * `-----------------------------------------/ / \ \-----------------------------------------' | ||
| 30 | * |LOWER | LGUI | Alt | /Space / \Enter \ |BackSP| RGUI |RAISE | | ||
| 31 | * | | | |/ / \ \ | | | | | ||
| 32 | * `-------------------''-------' '------''--------------------' | ||
| 33 | */ | ||
| 34 | |||
| 35 | [_QWERTY] = LAYOUT( \ | ||
| 36 | KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_GRV, \ | ||
| 37 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_MINS, \ | ||
| 38 | KC_LCTRL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ | ||
| 39 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_LBRC, KC_RBRC, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, \ | ||
| 40 | LOWER,KC_LGUI, KC_LALT, KC_SPC, KC_ENT, KC_BSPC, KC_RGUI, RAISE \ | ||
| 41 | ), | ||
| 42 | /* LOWER | ||
| 43 | * ,-----------------------------------------. ,-----------------------------------------. | ||
| 44 | * | | | | | | | | | | | | | | | ||
| 45 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | ||
| 46 | * | F1 | F2 | F3 | F4 | F5 | F6 | | F7 | F8 | F9 | F10 | F11 | F12 | | ||
| 47 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | ||
| 48 | * | ~ | ! | @ | # | $ | % |-------. ,-------| ^ | & | * | ( | ) | - | | ||
| 49 | * |------+------+------+------+------+------| [ | | ] |------+------+------+------+------+------| | ||
| 50 | * | | | | | | |-------| |-------| | _ | + | { | } | | | | ||
| 51 | * `-----------------------------------------/ / \ \-----------------------------------------' | ||
| 52 | * |LOWER | LGUI | Alt | /Space / \Enter \ |BackSP| RGUI |RAISE | | ||
| 53 | * | | | |/ / \ \ | | | | | ||
| 54 | * `-------------------''-------' '------''--------------------' | ||
| 55 | */ | ||
| 56 | [_LOWER] = LAYOUT( \ | ||
| 57 | _______, _______, _______, _______, _______, _______, _______, _______, _______,_______, _______, _______,\ | ||
| 58 | KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \ | ||
| 59 | _______, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_TILD, \ | ||
| 60 | _______, _______, _______, _______, _______, _______, _______, _______, XXXXXXX, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \ | ||
| 61 | _______, _______, _______, _______, _______, _______, _______, _______\ | ||
| 62 | ), | ||
| 63 | /* RAISE | ||
| 64 | * ,-----------------------------------------. ,-----------------------------------------. | ||
| 65 | * | | | | | | | | | | | | | | | ||
| 66 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | ||
| 67 | * | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | | | ||
| 68 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | ||
| 69 | * | F1 | F2 | F3 | F4 | F5 | F6 |-------. ,-------| | Left | Down | Up |Right | | | ||
| 70 | * |------+------+------+------+------+------| [ | | ] |------+------+------+------+------+------| | ||
| 71 | * | F7 | F8 | F9 | F10 | F11 | F12 |-------| |-------| + | - | = | [ | ] | \ | | ||
| 72 | * `-----------------------------------------/ / \ \-----------------------------------------' | ||
| 73 | * |LOWER | LGUI | Alt | /Space / \Enter \ |BackSP| RGUI |RAISE | | ||
| 74 | * | | | |/ / \ \ | | | | | ||
| 75 | * `-------------------''-------' '------''--------------------' | ||
| 76 | */ | ||
| 77 | |||
| 78 | [_RAISE] = LAYOUT( \ | ||
| 79 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ | ||
| 80 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______, \ | ||
| 81 | KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, XXXXXXX, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, XXXXXXX, \ | ||
| 82 | KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, KC_PLUS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \ | ||
| 83 | _______, _______, _______, _______, _______, _______, _______, _______ \ | ||
| 84 | ), | ||
| 85 | |||
| 86 | /* ADJUST | ||
| 87 | * ,-----------------------------------------. ,-----------------------------------------. | ||
| 88 | * | | | | | | | | | | | | | | | ||
| 89 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | ||
| 90 | * | | | | | | | | | | | | | | | ||
| 91 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | ||
| 92 | * | | | | | | |-------. ,-------| | | | | | | | ||
| 93 | * |------+------+------+------+------+------| | | |------+------+------+------+------+------| | ||
| 94 | * | | | | | | |-------| |-------| | | | | | | | ||
| 95 | * `-----------------------------------------/ / \ \-----------------------------------------' | ||
| 96 | * |LOWER | LGUI | Alt | /Space / \Enter \ |BackSP| RGUI |RAISE | | ||
| 97 | * | | | |/ / \ \ | | | | | ||
| 98 | * `-------------------''-------' '------''--------------------' | ||
| 99 | */ | ||
| 100 | [_ADJUST] = LAYOUT( \ | ||
| 101 | XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ | ||
| 102 | XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ | ||
| 103 | XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ | ||
| 104 | XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,\ | ||
| 105 | _______, _______, _______, _______, _______, _______, _______, _______ \ | ||
| 106 | ) | ||
| 107 | }; | ||
| 108 | |||
| 109 | |||
| 110 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 111 | switch (keycode) { | ||
| 112 | case QWERTY: | ||
| 113 | if (record->event.pressed) { | ||
| 114 | set_single_persistent_default_layer(_QWERTY); | ||
| 115 | } | ||
| 116 | return false; | ||
| 117 | break; | ||
| 118 | case LOWER: | ||
| 119 | if (record->event.pressed) { | ||
| 120 | layer_on(_LOWER); | ||
| 121 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 122 | } else { | ||
| 123 | layer_off(_LOWER); | ||
| 124 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 125 | } | ||
| 126 | return false; | ||
| 127 | break; | ||
| 128 | case RAISE: | ||
| 129 | if (record->event.pressed) { | ||
| 130 | layer_on(_RAISE); | ||
| 131 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 132 | } else { | ||
| 133 | layer_off(_RAISE); | ||
| 134 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 135 | } | ||
| 136 | return false; | ||
| 137 | break; | ||
| 138 | case ADJUST: | ||
| 139 | if (record->event.pressed) { | ||
| 140 | layer_on(_ADJUST); | ||
| 141 | } else { | ||
| 142 | layer_off(_ADJUST); | ||
| 143 | } | ||
| 144 | return false; | ||
| 145 | break; | ||
| 146 | } | ||
| 147 | return true; | ||
| 148 | } \ No newline at end of file | ||
diff --git a/keyboards/lily58/keymaps/yuchi/rules.mk b/keyboards/lily58/keymaps/yuchi/rules.mk new file mode 100644 index 000000000..73777a1b7 --- /dev/null +++ b/keyboards/lily58/keymaps/yuchi/rules.mk | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | |||
| 2 | # Build Options | ||
| 3 | # change to "no" to disable the options, or define them in the Makefile in | ||
| 4 | # the appropriate keymap folder that will get included automatically | ||
| 5 | # | ||
| 6 | |||
| 7 | OLED_ENABLE = no | ||
| 8 | RGBLIGHT_ENABLE = no | ||
| 9 | |||
| 10 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) | ||
| 11 | MOUSEKEY_ENABLE = no # Mouse keys(+4700) | ||
| 12 | EXTRAKEY_ENABLE = no # Audio control and System control(+450) | ||
| 13 | CONSOLE_ENABLE = no # Console for debug(+400) | ||
| 14 | COMMAND_ENABLE = no # Commands for debug and configuration | ||
| 15 | NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
| 16 | MIDI_ENABLE = no # MIDI controls | ||
| 17 | AUDIO_ENABLE = no # Audio output on port C6 | ||
| 18 | UNICODE_ENABLE = no # Unicode | ||
| 19 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID | ||
| 20 | ONEHAND_ENABLE = no # Enable one-hand typing | ||
| 21 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | ||
| 22 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend \ No newline at end of file | ||
diff --git a/keyboards/lily58/rev1/rev1.c b/keyboards/lily58/rev1/rev1.c index 64dd084b2..4c54d7717 100644 --- a/keyboards/lily58/rev1/rev1.c +++ b/keyboards/lily58/rev1/rev1.c | |||
| @@ -1,14 +1,5 @@ | |||
| 1 | #include "lily58.h" | 1 | #include "lily58.h" |
| 2 | 2 | ||
| 3 | /* | ||
| 4 | #ifdef SSD1306OLED | ||
| 5 | void led_set_kb(uint8_t usb_led) { | ||
| 6 | // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here | ||
| 7 | led_set_user(usb_led); | ||
| 8 | } | ||
| 9 | #endif | ||
| 10 | */ | ||
| 11 | |||
| 12 | void matrix_init_kb(void) { | 3 | void matrix_init_kb(void) { |
| 13 | 4 | ||
| 14 | // // green led on | 5 | // // green led on |
| @@ -20,5 +11,4 @@ void matrix_init_kb(void) { | |||
| 20 | // PORTB &= ~(1<<0); | 11 | // PORTB &= ~(1<<0); |
| 21 | 12 | ||
| 22 | matrix_init_user(); | 13 | matrix_init_user(); |
| 23 | }; | 14 | }; \ No newline at end of file |
| 24 | |||
diff --git a/keyboards/lily58/rules.mk b/keyboards/lily58/rules.mk index 23527476a..72964fca1 100644 --- a/keyboards/lily58/rules.mk +++ b/keyboards/lily58/rules.mk | |||
| @@ -1,9 +1,7 @@ | |||
| 1 | SRC += matrix.c \ | 1 | SRC += matrix.c \ |
| 2 | i2c.c \ | 2 | i2c.c \ |
| 3 | split_util.c \ | 3 | split_util.c \ |
| 4 | serial.c \ | 4 | serial.c |
| 5 | ssd1306.c | ||
| 6 | |||
| 7 | # MCU name | 5 | # MCU name |
| 8 | #MCU = at90usb1287 | 6 | #MCU = at90usb1287 |
| 9 | MCU = atmega32u4 | 7 | MCU = atmega32u4 |
diff --git a/keyboards/lily58/split_util.c b/keyboards/lily58/split_util.c index ff069b7e2..49b065518 100644 --- a/keyboards/lily58/split_util.c +++ b/keyboards/lily58/split_util.c | |||
| @@ -34,9 +34,6 @@ static void setup_handedness(void) { | |||
| 34 | static void keyboard_master_setup(void) { | 34 | static void keyboard_master_setup(void) { |
| 35 | #ifdef USE_I2C | 35 | #ifdef USE_I2C |
| 36 | i2c_master_init(); | 36 | i2c_master_init(); |
| 37 | //#ifdef SSD1306OLED | ||
| 38 | // matrix_master_OLED_init (); | ||
| 39 | //#endif | ||
| 40 | #else | 37 | #else |
| 41 | serial_master_init(); | 38 | serial_master_init(); |
| 42 | #endif | 39 | #endif |
diff --git a/keyboards/lily58/ssd1306.c b/keyboards/lily58/ssd1306.c deleted file mode 100644 index d07900119..000000000 --- a/keyboards/lily58/ssd1306.c +++ /dev/null | |||
| @@ -1,330 +0,0 @@ | |||
| 1 | #ifdef SSD1306OLED | ||
| 2 | |||
| 3 | #include "ssd1306.h" | ||
| 4 | #include "i2c.h" | ||
| 5 | #include <string.h> | ||
| 6 | #include "print.h" | ||
| 7 | #include "glcdfont.c" | ||
| 8 | #ifdef ADAFRUIT_BLE_ENABLE | ||
| 9 | #include "adafruit_ble.h" | ||
| 10 | #endif | ||
| 11 | #ifdef PROTOCOL_LUFA | ||
| 12 | #include "lufa.h" | ||
| 13 | #endif | ||
| 14 | #include "sendchar.h" | ||
| 15 | #include "timer.h" | ||
| 16 | |||
| 17 | // Set this to 1 to help diagnose early startup problems | ||
| 18 | // when testing power-on with ble. Turn it off otherwise, | ||
| 19 | // as the latency of printing most of the debug info messes | ||
| 20 | // with the matrix scan, causing keys to drop. | ||
| 21 | #define DEBUG_TO_SCREEN 0 | ||
| 22 | |||
| 23 | //static uint16_t last_battery_update; | ||
| 24 | //static uint32_t vbat; | ||
| 25 | //#define BatteryUpdateInterval 10000 /* milliseconds */ | ||
| 26 | #define ScreenOffInterval 300000 /* milliseconds */ | ||
| 27 | #if DEBUG_TO_SCREEN | ||
| 28 | static uint8_t displaying; | ||
| 29 | #endif | ||
| 30 | static uint16_t last_flush; | ||
| 31 | |||
| 32 | // Write command sequence. | ||
| 33 | // Returns true on success. | ||
| 34 | static inline bool _send_cmd1(uint8_t cmd) { | ||
| 35 | bool res = false; | ||
| 36 | |||
| 37 | if (i2c_start_write(SSD1306_ADDRESS)) { | ||
| 38 | xprintf("failed to start write to %d\n", SSD1306_ADDRESS); | ||
| 39 | goto done; | ||
| 40 | } | ||
| 41 | |||
| 42 | if (i2c_master_write(0x0 /* command byte follows */)) { | ||
| 43 | print("failed to write control byte\n"); | ||
| 44 | |||
| 45 | goto done; | ||
| 46 | } | ||
| 47 | |||
| 48 | if (i2c_master_write(cmd)) { | ||
| 49 | xprintf("failed to write command %d\n", cmd); | ||
| 50 | goto done; | ||
| 51 | } | ||
| 52 | res = true; | ||
| 53 | done: | ||
| 54 | i2c_master_stop(); | ||
| 55 | return res; | ||
| 56 | } | ||
| 57 | |||
| 58 | // Write 2-byte command sequence. | ||
| 59 | // Returns true on success | ||
| 60 | static inline bool _send_cmd2(uint8_t cmd, uint8_t opr) { | ||
| 61 | if (!_send_cmd1(cmd)) { | ||
| 62 | return false; | ||
| 63 | } | ||
| 64 | return _send_cmd1(opr); | ||
| 65 | } | ||
| 66 | |||
| 67 | // Write 3-byte command sequence. | ||
| 68 | // Returns true on success | ||
| 69 | static inline bool _send_cmd3(uint8_t cmd, uint8_t opr1, uint8_t opr2) { | ||
| 70 | if (!_send_cmd1(cmd)) { | ||
| 71 | return false; | ||
| 72 | } | ||
| 73 | if (!_send_cmd1(opr1)) { | ||
| 74 | return false; | ||
| 75 | } | ||
| 76 | return _send_cmd1(opr2); | ||
| 77 | } | ||
| 78 | |||
| 79 | #define send_cmd1(c) if (!_send_cmd1(c)) {goto done;} | ||
| 80 | #define send_cmd2(c,o) if (!_send_cmd2(c,o)) {goto done;} | ||
| 81 | #define send_cmd3(c,o1,o2) if (!_send_cmd3(c,o1,o2)) {goto done;} | ||
| 82 | |||
| 83 | static void clear_display(void) { | ||
| 84 | matrix_clear(&display); | ||
| 85 | |||
| 86 | // Clear all of the display bits (there can be random noise | ||
| 87 | // in the RAM on startup) | ||
| 88 | send_cmd3(PageAddr, 0, (DisplayHeight / 8) - 1); | ||
| 89 | send_cmd3(ColumnAddr, 0, DisplayWidth - 1); | ||
| 90 | |||
| 91 | if (i2c_start_write(SSD1306_ADDRESS)) { | ||
| 92 | goto done; | ||
| 93 | } | ||
| 94 | if (i2c_master_write(0x40)) { | ||
| 95 | // Data mode | ||
| 96 | goto done; | ||
| 97 | } | ||
| 98 | for (uint8_t row = 0; row < MatrixRows; ++row) { | ||
| 99 | for (uint8_t col = 0; col < DisplayWidth; ++col) { | ||
| 100 | i2c_master_write(0); | ||
| 101 | } | ||
| 102 | } | ||
| 103 | |||
| 104 | display.dirty = false; | ||
| 105 | |||
| 106 | done: | ||
| 107 | i2c_master_stop(); | ||
| 108 | } | ||
| 109 | |||
| 110 | #if DEBUG_TO_SCREEN | ||
| 111 | #undef sendchar | ||
| 112 | static int8_t capture_sendchar(uint8_t c) { | ||
| 113 | sendchar(c); | ||
| 114 | iota_gfx_write_char(c); | ||
| 115 | |||
| 116 | if (!displaying) { | ||
| 117 | iota_gfx_flush(); | ||
| 118 | } | ||
| 119 | return 0; | ||
| 120 | } | ||
| 121 | #endif | ||
| 122 | |||
| 123 | bool iota_gfx_init(bool rotate) { | ||
| 124 | bool success = false; | ||
| 125 | |||
| 126 | send_cmd1(DisplayOff); | ||
| 127 | send_cmd2(SetDisplayClockDiv, 0x80); | ||
| 128 | send_cmd2(SetMultiPlex, DisplayHeight - 1); | ||
| 129 | |||
| 130 | send_cmd2(SetDisplayOffset, 0); | ||
| 131 | |||
| 132 | |||
| 133 | send_cmd1(SetStartLine | 0x0); | ||
| 134 | send_cmd2(SetChargePump, 0x14 /* Enable */); | ||
| 135 | send_cmd2(SetMemoryMode, 0 /* horizontal addressing */); | ||
| 136 | |||
| 137 | if(rotate){ | ||
| 138 | // the following Flip the display orientation 180 degrees | ||
| 139 | send_cmd1(SegRemap); | ||
| 140 | send_cmd1(ComScanInc); | ||
| 141 | }else{ | ||
| 142 | // Flips the display orientation 0 degrees | ||
| 143 | send_cmd1(SegRemap | 0x1); | ||
| 144 | send_cmd1(ComScanDec); | ||
| 145 | } | ||
| 146 | |||
| 147 | send_cmd2(SetComPins, 0x2); | ||
| 148 | send_cmd2(SetContrast, 0x8f); | ||
| 149 | send_cmd2(SetPreCharge, 0xf1); | ||
| 150 | send_cmd2(SetVComDetect, 0x40); | ||
| 151 | send_cmd1(DisplayAllOnResume); | ||
| 152 | send_cmd1(NormalDisplay); | ||
| 153 | send_cmd1(DeActivateScroll); | ||
| 154 | send_cmd1(DisplayOn); | ||
| 155 | |||
| 156 | send_cmd2(SetContrast, 0); // Dim | ||
| 157 | |||
| 158 | clear_display(); | ||
| 159 | |||
| 160 | success = true; | ||
| 161 | |||
| 162 | iota_gfx_flush(); | ||
| 163 | |||
| 164 | #if DEBUG_TO_SCREEN | ||
| 165 | print_set_sendchar(capture_sendchar); | ||
| 166 | #endif | ||
| 167 | |||
| 168 | done: | ||
| 169 | return success; | ||
| 170 | } | ||
| 171 | |||
| 172 | bool iota_gfx_off(void) { | ||
| 173 | bool success = false; | ||
| 174 | |||
| 175 | send_cmd1(DisplayOff); | ||
| 176 | success = true; | ||
| 177 | |||
| 178 | done: | ||
| 179 | return success; | ||
| 180 | } | ||
| 181 | |||
| 182 | bool iota_gfx_on(void) { | ||
| 183 | bool success = false; | ||
| 184 | |||
| 185 | send_cmd1(DisplayOn); | ||
| 186 | success = true; | ||
| 187 | |||
| 188 | done: | ||
| 189 | return success; | ||
| 190 | } | ||
| 191 | |||
| 192 | void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c) { | ||
| 193 | *matrix->cursor = c; | ||
| 194 | ++matrix->cursor; | ||
| 195 | |||
| 196 | if (matrix->cursor - &matrix->display[0][0] == sizeof(matrix->display)) { | ||
| 197 | // We went off the end; scroll the display upwards by one line | ||
| 198 | memmove(&matrix->display[0], &matrix->display[1], | ||
| 199 | MatrixCols * (MatrixRows - 1)); | ||
| 200 | matrix->cursor = &matrix->display[MatrixRows - 1][0]; | ||
| 201 | memset(matrix->cursor, ' ', MatrixCols); | ||
| 202 | } | ||
| 203 | } | ||
| 204 | |||
| 205 | void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c) { | ||
| 206 | matrix->dirty = true; | ||
| 207 | |||
| 208 | if (c == '\n') { | ||
| 209 | // Clear to end of line from the cursor and then move to the | ||
| 210 | // start of the next line | ||
| 211 | uint8_t cursor_col = (matrix->cursor - &matrix->display[0][0]) % MatrixCols; | ||
| 212 | |||
| 213 | while (cursor_col++ < MatrixCols) { | ||
| 214 | matrix_write_char_inner(matrix, ' '); | ||
| 215 | } | ||
| 216 | return; | ||
| 217 | } | ||
| 218 | |||
| 219 | matrix_write_char_inner(matrix, c); | ||
| 220 | } | ||
| 221 | |||
| 222 | void iota_gfx_write_char(uint8_t c) { | ||
| 223 | matrix_write_char(&display, c); | ||
| 224 | } | ||
| 225 | |||
| 226 | void matrix_write(struct CharacterMatrix *matrix, const char *data) { | ||
| 227 | const char *end = data + strlen(data); | ||
| 228 | while (data < end) { | ||
| 229 | matrix_write_char(matrix, *data); | ||
| 230 | ++data; | ||
| 231 | } | ||
| 232 | } | ||
| 233 | |||
| 234 | void matrix_write_ln(struct CharacterMatrix *matrix, const char *data) { | ||
| 235 | char data_ln[strlen(data)+2]; | ||
| 236 | snprintf(data_ln, sizeof(data_ln), "%s\n", data); | ||
| 237 | matrix_write(matrix, data_ln); | ||
| 238 | } | ||
| 239 | |||
| 240 | void iota_gfx_write(const char *data) { | ||
| 241 | matrix_write(&display, data); | ||
| 242 | } | ||
| 243 | |||
| 244 | void matrix_write_P(struct CharacterMatrix *matrix, const char *data) { | ||
| 245 | while (true) { | ||
| 246 | uint8_t c = pgm_read_byte(data); | ||
| 247 | if (c == 0) { | ||
| 248 | return; | ||
| 249 | } | ||
| 250 | matrix_write_char(matrix, c); | ||
| 251 | ++data; | ||
| 252 | } | ||
| 253 | } | ||
| 254 | |||
| 255 | void iota_gfx_write_P(const char *data) { | ||
| 256 | matrix_write_P(&display, data); | ||
| 257 | } | ||
| 258 | |||
| 259 | void matrix_clear(struct CharacterMatrix *matrix) { | ||
| 260 | memset(matrix->display, ' ', sizeof(matrix->display)); | ||
| 261 | matrix->cursor = &matrix->display[0][0]; | ||
| 262 | matrix->dirty = true; | ||
| 263 | } | ||
| 264 | |||
| 265 | void iota_gfx_clear_screen(void) { | ||
| 266 | matrix_clear(&display); | ||
| 267 | } | ||
| 268 | |||
| 269 | void matrix_render(struct CharacterMatrix *matrix) { | ||
| 270 | last_flush = timer_read(); | ||
| 271 | iota_gfx_on(); | ||
| 272 | #if DEBUG_TO_SCREEN | ||
| 273 | ++displaying; | ||
| 274 | #endif | ||
| 275 | |||
| 276 | // Move to the home position | ||
| 277 | send_cmd3(PageAddr, 0, MatrixRows - 1); | ||
| 278 | send_cmd3(ColumnAddr, 0, (MatrixCols * FontWidth) - 1); | ||
| 279 | |||
| 280 | if (i2c_start_write(SSD1306_ADDRESS)) { | ||
| 281 | goto done; | ||
| 282 | } | ||
| 283 | if (i2c_master_write(0x40)) { | ||
| 284 | // Data mode | ||
| 285 | goto done; | ||
| 286 | } | ||
| 287 | |||
| 288 | for (uint8_t row = 0; row < MatrixRows; ++row) { | ||
| 289 | for (uint8_t col = 0; col < MatrixCols; ++col) { | ||
| 290 | const uint8_t *glyph = font + (matrix->display[row][col] * FontWidth); | ||
| 291 | |||
| 292 | for (uint8_t glyphCol = 0; glyphCol < FontWidth; ++glyphCol) { | ||
| 293 | uint8_t colBits = pgm_read_byte(glyph + glyphCol); | ||
| 294 | i2c_master_write(colBits); | ||
| 295 | } | ||
| 296 | |||
| 297 | // 1 column of space between chars (it's not included in the glyph) | ||
| 298 | //i2c_master_write(0); | ||
| 299 | } | ||
| 300 | } | ||
| 301 | |||
| 302 | matrix->dirty = false; | ||
| 303 | |||
| 304 | done: | ||
| 305 | i2c_master_stop(); | ||
| 306 | #if DEBUG_TO_SCREEN | ||
| 307 | --displaying; | ||
| 308 | #endif | ||
| 309 | } | ||
| 310 | |||
| 311 | void iota_gfx_flush(void) { | ||
| 312 | matrix_render(&display); | ||
| 313 | } | ||
| 314 | |||
| 315 | __attribute__ ((weak)) | ||
| 316 | void iota_gfx_task_user(void) { | ||
| 317 | } | ||
| 318 | |||
| 319 | void iota_gfx_task(void) { | ||
| 320 | iota_gfx_task_user(); | ||
| 321 | |||
| 322 | if (display.dirty) { | ||
| 323 | iota_gfx_flush(); | ||
| 324 | } | ||
| 325 | |||
| 326 | if (timer_elapsed(last_flush) > ScreenOffInterval) { | ||
| 327 | iota_gfx_off(); | ||
| 328 | } | ||
| 329 | } | ||
| 330 | #endif | ||
diff --git a/keyboards/lily58/ssd1306.h b/keyboards/lily58/ssd1306.h deleted file mode 100644 index 59d31c9f3..000000000 --- a/keyboards/lily58/ssd1306.h +++ /dev/null | |||
| @@ -1,94 +0,0 @@ | |||
| 1 | #ifndef SSD1306_H | ||
| 2 | #define SSD1306_H | ||
| 3 | |||
| 4 | #include <stdbool.h> | ||
| 5 | #include <stdio.h> | ||
| 6 | #include "pincontrol.h" | ||
| 7 | #include "config.h" | ||
| 8 | |||
| 9 | enum ssd1306_cmds { | ||
| 10 | DisplayOff = 0xAE, | ||
| 11 | DisplayOn = 0xAF, | ||
| 12 | |||
| 13 | SetContrast = 0x81, | ||
| 14 | DisplayAllOnResume = 0xA4, | ||
| 15 | |||
| 16 | DisplayAllOn = 0xA5, | ||
| 17 | NormalDisplay = 0xA6, | ||
| 18 | InvertDisplay = 0xA7, | ||
| 19 | SetDisplayOffset = 0xD3, | ||
| 20 | SetComPins = 0xda, | ||
| 21 | SetVComDetect = 0xdb, | ||
| 22 | SetDisplayClockDiv = 0xD5, | ||
| 23 | SetPreCharge = 0xd9, | ||
| 24 | SetMultiPlex = 0xa8, | ||
| 25 | SetLowColumn = 0x00, | ||
| 26 | SetHighColumn = 0x10, | ||
| 27 | SetStartLine = 0x40, | ||
| 28 | |||
| 29 | SetMemoryMode = 0x20, | ||
| 30 | ColumnAddr = 0x21, | ||
| 31 | PageAddr = 0x22, | ||
| 32 | |||
| 33 | ComScanInc = 0xc0, | ||
| 34 | ComScanDec = 0xc8, | ||
| 35 | SegRemap = 0xa0, | ||
| 36 | SetChargePump = 0x8d, | ||
| 37 | ExternalVcc = 0x01, | ||
| 38 | SwitchCapVcc = 0x02, | ||
| 39 | |||
| 40 | ActivateScroll = 0x2f, | ||
| 41 | DeActivateScroll = 0x2e, | ||
| 42 | SetVerticalScrollArea = 0xa3, | ||
| 43 | RightHorizontalScroll = 0x26, | ||
| 44 | LeftHorizontalScroll = 0x27, | ||
| 45 | VerticalAndRightHorizontalScroll = 0x29, | ||
| 46 | VerticalAndLeftHorizontalScroll = 0x2a, | ||
| 47 | }; | ||
| 48 | |||
| 49 | // Controls the SSD1306 128x32 OLED display via i2c | ||
| 50 | |||
| 51 | #ifndef SSD1306_ADDRESS | ||
| 52 | #define SSD1306_ADDRESS 0x3C | ||
| 53 | #endif | ||
| 54 | |||
| 55 | #define DisplayHeight 32 | ||
| 56 | #define DisplayWidth 128 | ||
| 57 | |||
| 58 | #define FontHeight 8 | ||
| 59 | #define FontWidth 6 | ||
| 60 | |||
| 61 | #define MatrixRows (DisplayHeight / FontHeight) | ||
| 62 | #define MatrixCols (DisplayWidth / FontWidth) | ||
| 63 | |||
| 64 | struct CharacterMatrix { | ||
| 65 | uint8_t display[MatrixRows][MatrixCols]; | ||
| 66 | uint8_t *cursor; | ||
| 67 | bool dirty; | ||
| 68 | }; | ||
| 69 | |||
| 70 | struct CharacterMatrix display; | ||
| 71 | |||
| 72 | bool iota_gfx_init(bool rotate); | ||
| 73 | void iota_gfx_task(void); | ||
| 74 | bool iota_gfx_off(void); | ||
| 75 | bool iota_gfx_on(void); | ||
| 76 | void iota_gfx_flush(void); | ||
| 77 | void iota_gfx_write_char(uint8_t c); | ||
| 78 | void iota_gfx_write(const char *data); | ||
| 79 | void iota_gfx_write_P(const char *data); | ||
| 80 | void iota_gfx_clear_screen(void); | ||
| 81 | |||
| 82 | void iota_gfx_task_user(void); | ||
| 83 | |||
| 84 | void matrix_clear(struct CharacterMatrix *matrix); | ||
| 85 | void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c); | ||
| 86 | void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c); | ||
| 87 | void matrix_write(struct CharacterMatrix *matrix, const char *data); | ||
| 88 | void matrix_write_ln(struct CharacterMatrix *matrix, const char *data); | ||
| 89 | void matrix_write_P(struct CharacterMatrix *matrix, const char *data); | ||
| 90 | void matrix_render(struct CharacterMatrix *matrix); | ||
| 91 | |||
| 92 | |||
| 93 | |||
| 94 | #endif | ||
