diff options
| author | Mango The Fourth <40720523+MangoIV@users.noreply.github.com> | 2021-04-27 19:41:11 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-27 19:41:11 +0200 |
| commit | 3fe356e65c65f725e94f3ad32fd65cc24befb531 (patch) | |
| tree | 9bd576d8b6f695d54ded0fabee05ec4beba9b5ff /keyboards/draculad/keymaps | |
| parent | b95231c1e3bdc2bb617112f87d8dc6026d0d3ee8 (diff) | |
| download | qmk_firmware-3fe356e65c65f725e94f3ad32fd65cc24befb531.tar.gz qmk_firmware-3fe356e65c65f725e94f3ad32fd65cc24befb531.zip | |
Add Draculad keyboard (#12604)
Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
Co-authored-by: Erovia <Erovia@users.noreply.github.com>
Co-authored-by: mangoiv <mangoiv@outlook.com>
Diffstat (limited to 'keyboards/draculad/keymaps')
| -rw-r--r-- | keyboards/draculad/keymaps/default/keymap.c | 220 | ||||
| -rw-r--r-- | keyboards/draculad/keymaps/pimoroni/config.h | 25 | ||||
| -rw-r--r-- | keyboards/draculad/keymaps/pimoroni/keymap.c | 318 | ||||
| -rw-r--r-- | keyboards/draculad/keymaps/pimoroni/pimoroni_trackball.c | 177 | ||||
| -rw-r--r-- | keyboards/draculad/keymaps/pimoroni/pimoroni_trackball.h | 35 | ||||
| -rw-r--r-- | keyboards/draculad/keymaps/pimoroni/rules.mk | 6 |
6 files changed, 781 insertions, 0 deletions
diff --git a/keyboards/draculad/keymaps/default/keymap.c b/keyboards/draculad/keymaps/default/keymap.c new file mode 100644 index 000000000..b24cca932 --- /dev/null +++ b/keyboards/draculad/keymaps/default/keymap.c | |||
| @@ -0,0 +1,220 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2021 @mangoiv | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include QMK_KEYBOARD_H | ||
| 19 | |||
| 20 | |||
| 21 | enum layer_number { | ||
| 22 | _BASE, | ||
| 23 | _NUM, | ||
| 24 | _SYMB, | ||
| 25 | _MUS, | ||
| 26 | _ADJ | ||
| 27 | }; | ||
| 28 | |||
| 29 | |||
| 30 | char wpm_as_str[8]; | ||
| 31 | |||
| 32 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 33 | [_BASE] = LAYOUT( | ||
| 34 | KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, | ||
| 35 | KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K , KC_L , KC_SCLN, | ||
| 36 | LSFT_T(KC_Z), KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, RSFT_T(KC_SLSH), | ||
| 37 | KC_MUTE, KC_LCTL, LALT_T(KC_BSPC), LT(_MUS, KC_SPC), LT(_NUM,KC_DEL), LT(_SYMB, KC_ENT), KC_CAPS, TG(_ADJ) | ||
| 38 | ), | ||
| 39 | [_NUM] = LAYOUT( | ||
| 40 | KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, | ||
| 41 | KC_TAB, XXXXXXX, KC_VOLD, KC_VOLU, XXXXXXX, KC_LEFT, KC_DOWN, KC_UP , KC_RIGHT , KC_QUOT, | ||
| 42 | KC_LSFT, XXXXXXX, XXXXXXX, KC_MUTE, RESET, KC_HOME, KC_END, KC_PGUP, KC_PGDN, KC_RSFT, | ||
| 43 | XXXXXXX, XXXXXXX, KC_LALT, XXXXXXX, _______, KC_ENT, KC_NO, KC_NO | ||
| 44 | ), | ||
| 45 | [_SYMB] = LAYOUT( | ||
| 46 | KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, XXXXXXX, XXXXXXX, XXXXXXX, KC_EQL, KC_MINS, | ||
| 47 | XXXXXXX, KC_F5, KC_F6, KC_F7, KC_F8, KC_LBRC, KC_RBRC, XXXXXXX , KC_GRV , KC_BSLS, | ||
| 48 | KC_LSFT, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_RSFT, | ||
| 49 | XXXXXXX, KC_LALT, XXXXXXX, XXXXXXX, XXXXXXX, _______, KC_NO, KC_NO | ||
| 50 | ), | ||
| 51 | [_MUS] = LAYOUT( | ||
| 52 | KC_LCTL, XXXXXXX, XXXXXXX, XXXXXXX,XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, | ||
| 53 | KC_LALT, KC_BTN3, KC_BTN2, KC_BTN1 , XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX , XXXXXXX , XXXXXXX, | ||
| 54 | KC_LSFT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, | ||
| 55 | XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX | ||
| 56 | ), | ||
| 57 | [_ADJ] = LAYOUT( | ||
| 58 | RESET, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, | ||
| 59 | EEP_RST, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RGB_MOD, RGB_HUI, RGB_SAI , RGB_VAI , RGB_TOG, | ||
| 60 | XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RGB_RMOD, RGB_HUD, RGB_SAD, RGB_VAD, _______, | ||
| 61 | XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______ | ||
| 62 | ) | ||
| 63 | }; | ||
| 64 | |||
| 65 | #ifdef OLED_DRIVER_ENABLE | ||
| 66 | |||
| 67 | |||
| 68 | oled_rotation_t oled_init_user(oled_rotation_t rotation) { | ||
| 69 | |||
| 70 | if (is_keyboard_master()) { | ||
| 71 | if(is_keyboard_left()){ | ||
| 72 | return OLED_ROTATION_270; | ||
| 73 | } | ||
| 74 | else { | ||
| 75 | return OLED_ROTATION_90; | ||
| 76 | } | ||
| 77 | } else { | ||
| 78 | return OLED_ROTATION_0; | ||
| 79 | } | ||
| 80 | } | ||
| 81 | static void render_logo(void) { | ||
| 82 | static const char PROGMEM drac_logo[] = { | ||
| 83 | // drac_logo, 128x64px | ||
| 84 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 85 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 86 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 87 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, | ||
| 88 | 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 89 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 90 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 91 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 92 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 93 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 94 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x0c, 0x18, 0x78, 0xf0, 0xf0, 0xe0, 0xe0, 0xc0, | ||
| 95 | 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, | ||
| 96 | 0xff, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03, 0x07, 0x3e, 0xfc, 0xf0, 0x00, 0x00, 0x00, | ||
| 97 | 0xf0, 0xf0, 0x60, 0x30, 0x30, 0x30, 0x00, 0x00, 0xe0, 0xe0, 0x30, 0x30, 0x30, 0x30, 0x30, 0xe0, | ||
| 98 | 0xe0, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0x70, 0x30, 0x30, 0x30, 0x70, 0xe0, 0xc0, 0x00, 0x00, | ||
| 99 | 0xf0, 0xf0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 100 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0xe0, 0xe0, 0xe0, 0xc0, | ||
| 101 | 0x80, 0x00, 0x00, 0x00, 0x80, 0xe0, 0xf8, 0xf0, 0x80, 0xc0, 0xe0, 0xf0, 0x00, 0x00, 0x00, 0x00, | ||
| 102 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x3f, 0xff, 0xff, | ||
| 103 | 0xff, 0xff, 0xfe, 0xfc, 0xf8, 0xe0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, | ||
| 104 | 0xff, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xc0, 0xe0, 0x7c, 0x3f, 0x0f, 0x00, 0x00, 0x00, | ||
| 105 | 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xf8, 0xcc, 0x8c, 0x84, 0x86, 0x86, 0xc6, 0xff, | ||
| 106 | 0xff, 0x80, 0x80, 0x00, 0x3f, 0x7f, 0xe0, 0xc0, 0x80, 0x80, 0x80, 0xc0, 0xf0, 0x71, 0x00, 0x00, | ||
| 107 | 0x1f, 0xff, 0xff, 0x80, 0x80, 0x80, 0x80, 0xc0, 0xf8, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 108 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x03, 0x03, 0x07, 0x0f, 0x0f, 0x0f, 0x1f, | ||
| 109 | 0x7f, 0x7f, 0x3e, 0x3e, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xf8, 0xf8, 0xfc, | ||
| 110 | 0xfc, 0xfe, 0xfe, 0x7e, 0x7c, 0x78, 0xe0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, | ||
| 111 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, | ||
| 112 | 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 113 | 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, | ||
| 114 | 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, | ||
| 115 | 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 116 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, | ||
| 117 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, | ||
| 118 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfe, 0xff, 0xff, 0xff, | ||
| 119 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, | ||
| 120 | 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0x60, 0x60, | ||
| 121 | 0x60, 0x60, 0x60, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xe0, 0x60, 0x60, 0x60, 0xc0, | ||
| 122 | 0xc0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 123 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 124 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x07, | ||
| 125 | 0x0f, 0x3e, 0x7c, 0xfc, 0xf8, 0xf8, 0xf8, 0xf8, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf8, | ||
| 126 | 0xf8, 0xf8, 0xfc, 0xfc, 0xfc, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
| 127 | 0xff, 0x7f, 0x3f, 0x1f, 0x0f, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, | ||
| 128 | 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xf1, 0x99, 0x18, 0x08, | ||
| 129 | 0x0c, 0x0c, 0x8c, 0xff, 0xff, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xc1, 0x80, 0x00, 0x00, 0x00, 0x80, | ||
| 130 | 0xc3, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 131 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 132 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 133 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x07, 0x0f, 0x0f, 0x0f, 0x1f, 0x1f, 0x1f, 0x1f, | ||
| 134 | 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x0f, 0x0f, 0x07, 0x07, 0x03, 0x03, 0x01, | ||
| 135 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, | ||
| 136 | 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00, 0x01, 0x03, 0x03, 0x03, | ||
| 137 | 0x03, 0x03, 0x01, 0x01, 0x03, 0x03, 0x03, 0x00, 0x00, 0x01, 0x01, 0x03, 0x03, 0x03, 0x03, 0x01, | ||
| 138 | 0x01, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 139 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 140 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 141 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 142 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 143 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 144 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 145 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 146 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 147 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | ||
| 148 | }; | ||
| 149 | oled_write_raw_P(drac_logo, sizeof(drac_logo)); | ||
| 150 | } | ||
| 151 | |||
| 152 | static void render_status(void) { | ||
| 153 | oled_write_P(PSTR("This is\n~~~~~~~~~\nDracu\nLad\n~~~~~~~~~\nv1.0\n~~~~~~~~~\n"), false); | ||
| 154 | sprintf(wpm_as_str, "WPM %03d", get_current_wpm()); | ||
| 155 | oled_write(wpm_as_str,false); | ||
| 156 | led_t led_state = host_keyboard_led_state(); | ||
| 157 | oled_write_P(PSTR("\nCaps: "), false); | ||
| 158 | oled_write_P(led_state.caps_lock ? PSTR("on ") : PSTR("off"), false); | ||
| 159 | oled_write_P(PSTR("\n"),false); | ||
| 160 | switch (get_highest_layer(layer_state)) { | ||
| 161 | case _BASE: | ||
| 162 | oled_write_P(PSTR("Base "), false); | ||
| 163 | break; | ||
| 164 | case _NUM: | ||
| 165 | oled_write_P(PSTR("Numbers"), false); | ||
| 166 | break; | ||
| 167 | case _SYMB: | ||
| 168 | oled_write_P(PSTR("Symbols"), false); | ||
| 169 | break; | ||
| 170 | case _ADJ: | ||
| 171 | oled_write_P(PSTR("Adjust "), false); | ||
| 172 | break; | ||
| 173 | case _MUS: | ||
| 174 | oled_write_P(PSTR("Mouse "), false); | ||
| 175 | break; | ||
| 176 | default: | ||
| 177 | oled_write_P(PSTR("Unkn "), false); | ||
| 178 | break; | ||
| 179 | } | ||
| 180 | } | ||
| 181 | |||
| 182 | void oled_task_user(void) { | ||
| 183 | if (is_keyboard_master()) { | ||
| 184 | render_status(); // Renders the current keyboard state (layer, lock, caps, scroll, etc) | ||
| 185 | } else { | ||
| 186 | render_logo(); | ||
| 187 | } | ||
| 188 | } | ||
| 189 | |||
| 190 | #endif | ||
| 191 | |||
| 192 | #ifdef ENCODER_ENABLE | ||
| 193 | void encoder_update_user(uint8_t index, bool clockwise) { | ||
| 194 | if (index == 0) { | ||
| 195 | // Volume control | ||
| 196 | if (clockwise) { | ||
| 197 | tap_code(KC_VOLU); | ||
| 198 | } else { | ||
| 199 | tap_code(KC_VOLD); | ||
| 200 | } | ||
| 201 | } | ||
| 202 | else if (index == 2) { | ||
| 203 | if(clockwise) { | ||
| 204 | tap_code(KC_PGUP); | ||
| 205 | } | ||
| 206 | else{ | ||
| 207 | tap_code(KC_PGDN); | ||
| 208 | } | ||
| 209 | } | ||
| 210 | else if (index == 3 ) { | ||
| 211 | // Page up/Page down | ||
| 212 | if (clockwise) { | ||
| 213 | tap_code(KC_WH_U); | ||
| 214 | } else { | ||
| 215 | tap_code(KC_WH_D); | ||
| 216 | } | ||
| 217 | } | ||
| 218 | |||
| 219 | } | ||
| 220 | #endif | ||
diff --git a/keyboards/draculad/keymaps/pimoroni/config.h b/keyboards/draculad/keymaps/pimoroni/config.h new file mode 100644 index 000000000..c5f9df6f9 --- /dev/null +++ b/keyboards/draculad/keymaps/pimoroni/config.h | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2021 @mangoiv | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | //comment that out if your trackball is on the left side | ||
| 19 | #define TRACKBALL_RIGHT | ||
| 20 | |||
| 21 | #ifdef TRACKBALL_RIGHT | ||
| 22 | #define PIMORONI_TRACKBALL_INVERT_X | ||
| 23 | #define PIMORONI_TRACKBALL_INVERT_Y | ||
| 24 | #endif | ||
| 25 | |||
diff --git a/keyboards/draculad/keymaps/pimoroni/keymap.c b/keyboards/draculad/keymaps/pimoroni/keymap.c new file mode 100644 index 000000000..d3a8e1f79 --- /dev/null +++ b/keyboards/draculad/keymaps/pimoroni/keymap.c | |||
| @@ -0,0 +1,318 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2021 @mangoiv | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include QMK_KEYBOARD_H | ||
| 19 | #include "pimoroni_trackball.h" | ||
| 20 | #include "pointing_device.h" | ||
| 21 | |||
| 22 | |||
| 23 | enum layer_number { | ||
| 24 | _BASE, | ||
| 25 | _NUM, | ||
| 26 | _SYMB, | ||
| 27 | _MUS, | ||
| 28 | _ADJ | ||
| 29 | }; | ||
| 30 | |||
| 31 | enum custom_keycodes { | ||
| 32 | BALL_HUI,//cycles hue | ||
| 33 | BALL_WHT,//cycles white | ||
| 34 | BALL_DEC,//decreased color | ||
| 35 | BALL_SCR,//scrolls | ||
| 36 | BALL_NCL,//left click | ||
| 37 | BALL_RCL,//right click | ||
| 38 | BALL_MCL,//middle click | ||
| 39 | }; | ||
| 40 | |||
| 41 | |||
| 42 | char wpm_as_str[8]; | ||
| 43 | |||
| 44 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 45 | [_BASE] = LAYOUT( | ||
| 46 | KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, | ||
| 47 | KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K , KC_L , KC_SCLN, | ||
| 48 | LSFT_T(KC_Z), KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, RSFT_T(KC_SLSH), | ||
| 49 | KC_MUTE, KC_LCTL, LALT_T(KC_BSPC), LT(_MUS, KC_SPC), KC_NO, LT(_NUM,KC_ENT), LT(_SYMB, KC_DEL), TG(_ADJ) | ||
| 50 | ), | ||
| 51 | [_NUM] = LAYOUT( | ||
| 52 | KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, | ||
| 53 | KC_TAB, KC_MUTE, KC_VOLD, KC_VOLU, XXXXXXX, KC_LEFT, KC_DOWN, KC_UP , KC_RIGHT , KC_QUOT, | ||
| 54 | KC_LSFT, XXXXXXX, KC_MPRV, KC_MNXT, RESET, KC_HOME, KC_END, KC_PGUP, KC_PGDN, KC_RSFT, | ||
| 55 | XXXXXXX, KC_LCTL, KC_LALT, XXXXXXX, KC_NO, _______, KC_ENT, KC_NO | ||
| 56 | ), | ||
| 57 | [_SYMB] = LAYOUT( | ||
| 58 | KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, XXXXXXX, XXXXXXX, XXXXXXX, KC_EQL, KC_MINS, | ||
| 59 | XXXXXXX, KC_F5, KC_F6, KC_F7, KC_F8, KC_LBRC, KC_RBRC, XXXXXXX , KC_GRV , KC_BSLS, | ||
| 60 | KC_LSFT, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_RSFT, | ||
| 61 | XXXXXXX, KC_LALT, XXXXXXX, XXXXXXX, XXXXXXX, KC_NO, _______, KC_NO | ||
| 62 | ), | ||
| 63 | [_MUS] = LAYOUT( | ||
| 64 | KC_LCTL, XXXXXXX, XXXXXXX, XXXXXXX,XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, | ||
| 65 | KC_LALT, KC_BTN3, KC_BTN2, KC_BTN1 , BALL_SCR, XXXXXXX, XXXXXXX, XXXXXXX , XXXXXXX , XXXXXXX, | ||
| 66 | KC_LSFT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, | ||
| 67 | XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX | ||
| 68 | ), | ||
| 69 | [_ADJ] = LAYOUT( | ||
| 70 | RESET, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, BALL_HUI, BALL_WHT, BALL_DEC, XXXXXXX, XXXXXXX, | ||
| 71 | EEP_RST, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RGB_MOD, RGB_HUI, RGB_SAI , RGB_VAI , RGB_TOG, | ||
| 72 | XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RGB_RMOD, RGB_HUD, RGB_SAD, RGB_VAD, _______, | ||
| 73 | XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______ | ||
| 74 | ) | ||
| 75 | }; | ||
| 76 | |||
| 77 | |||
| 78 | #ifdef OLED_DRIVER_ENABLE | ||
| 79 | |||
| 80 | |||
| 81 | oled_rotation_t oled_init_user(oled_rotation_t rotation) { | ||
| 82 | |||
| 83 | if (is_keyboard_master()) { | ||
| 84 | if(is_keyboard_left()){ | ||
| 85 | return OLED_ROTATION_270; | ||
| 86 | } | ||
| 87 | else { | ||
| 88 | return OLED_ROTATION_90; | ||
| 89 | } | ||
| 90 | } else { | ||
| 91 | return OLED_ROTATION_0; | ||
| 92 | } | ||
| 93 | } | ||
| 94 | static void render_logo(void) { | ||
| 95 | static const char PROGMEM drac_logo[] = { | ||
| 96 | // drac_logo, 128x64px | ||
| 97 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 98 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 99 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 100 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, | ||
| 101 | 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 102 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 103 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 104 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 105 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 106 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 107 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x0c, 0x18, 0x78, 0xf0, 0xf0, 0xe0, 0xe0, 0xc0, | ||
| 108 | 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, | ||
| 109 | 0xff, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03, 0x07, 0x3e, 0xfc, 0xf0, 0x00, 0x00, 0x00, | ||
| 110 | 0xf0, 0xf0, 0x60, 0x30, 0x30, 0x30, 0x00, 0x00, 0xe0, 0xe0, 0x30, 0x30, 0x30, 0x30, 0x30, 0xe0, | ||
| 111 | 0xe0, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0x70, 0x30, 0x30, 0x30, 0x70, 0xe0, 0xc0, 0x00, 0x00, | ||
| 112 | 0xf0, 0xf0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 113 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0xe0, 0xe0, 0xe0, 0xc0, | ||
| 114 | 0x80, 0x00, 0x00, 0x00, 0x80, 0xe0, 0xf8, 0xf0, 0x80, 0xc0, 0xe0, 0xf0, 0x00, 0x00, 0x00, 0x00, | ||
| 115 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x3f, 0xff, 0xff, | ||
| 116 | 0xff, 0xff, 0xfe, 0xfc, 0xf8, 0xe0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, | ||
| 117 | 0xff, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xc0, 0xe0, 0x7c, 0x3f, 0x0f, 0x00, 0x00, 0x00, | ||
| 118 | 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xf8, 0xcc, 0x8c, 0x84, 0x86, 0x86, 0xc6, 0xff, | ||
| 119 | 0xff, 0x80, 0x80, 0x00, 0x3f, 0x7f, 0xe0, 0xc0, 0x80, 0x80, 0x80, 0xc0, 0xf0, 0x71, 0x00, 0x00, | ||
| 120 | 0x1f, 0xff, 0xff, 0x80, 0x80, 0x80, 0x80, 0xc0, 0xf8, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 121 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x03, 0x03, 0x07, 0x0f, 0x0f, 0x0f, 0x1f, | ||
| 122 | 0x7f, 0x7f, 0x3e, 0x3e, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xf8, 0xf8, 0xfc, | ||
| 123 | 0xfc, 0xfe, 0xfe, 0x7e, 0x7c, 0x78, 0xe0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, | ||
| 124 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, | ||
| 125 | 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 126 | 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, | ||
| 127 | 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, | ||
| 128 | 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 129 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, | ||
| 130 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, | ||
| 131 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfe, 0xff, 0xff, 0xff, | ||
| 132 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, | ||
| 133 | 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0x60, 0x60, | ||
| 134 | 0x60, 0x60, 0x60, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xe0, 0x60, 0x60, 0x60, 0xc0, | ||
| 135 | 0xc0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 136 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 137 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x07, | ||
| 138 | 0x0f, 0x3e, 0x7c, 0xfc, 0xf8, 0xf8, 0xf8, 0xf8, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf8, | ||
| 139 | 0xf8, 0xf8, 0xfc, 0xfc, 0xfc, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
| 140 | 0xff, 0x7f, 0x3f, 0x1f, 0x0f, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, | ||
| 141 | 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xf1, 0x99, 0x18, 0x08, | ||
| 142 | 0x0c, 0x0c, 0x8c, 0xff, 0xff, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xc1, 0x80, 0x00, 0x00, 0x00, 0x80, | ||
| 143 | 0xc3, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 144 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 145 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 146 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x07, 0x0f, 0x0f, 0x0f, 0x1f, 0x1f, 0x1f, 0x1f, | ||
| 147 | 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x0f, 0x0f, 0x07, 0x07, 0x03, 0x03, 0x01, | ||
| 148 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, | ||
| 149 | 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00, 0x01, 0x03, 0x03, 0x03, | ||
| 150 | 0x03, 0x03, 0x01, 0x01, 0x03, 0x03, 0x03, 0x00, 0x00, 0x01, 0x01, 0x03, 0x03, 0x03, 0x03, 0x01, | ||
| 151 | 0x01, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 152 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 153 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 154 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 155 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 156 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 157 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 158 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 159 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 160 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | ||
| 161 | }; | ||
| 162 | oled_write_raw_P(drac_logo, sizeof(drac_logo)); | ||
| 163 | } | ||
| 164 | |||
| 165 | static void render_status(void) { | ||
| 166 | oled_write_P(PSTR("This is\n~~~~~~~~~\nDracu\nLad\n~~~~~~~~~\nv1.0\n~~~~~~~~~\n"), false); | ||
| 167 | sprintf(wpm_as_str, "WPM %03d", get_current_wpm()); | ||
| 168 | oled_write(wpm_as_str,false); | ||
| 169 | led_t led_state = host_keyboard_led_state(); | ||
| 170 | oled_write_P(PSTR("\nCaps: "), false); | ||
| 171 | oled_write_P(led_state.caps_lock ? PSTR("on ") : PSTR("off"), false); | ||
| 172 | oled_write_P(PSTR("\n"),false); | ||
| 173 | switch (get_highest_layer(layer_state)) { | ||
| 174 | case _BASE: | ||
| 175 | oled_write_P(PSTR("Base "), false); | ||
| 176 | break; | ||
| 177 | case _NUM: | ||
| 178 | oled_write_P(PSTR("Numbers"), false); | ||
| 179 | break; | ||
| 180 | case _SYMB: | ||
| 181 | oled_write_P(PSTR("Symbols"), false); | ||
| 182 | break; | ||
| 183 | case _ADJ: | ||
| 184 | oled_write_P(PSTR("Adjust "), false); | ||
| 185 | break; | ||
| 186 | case _MUS: | ||
| 187 | oled_write_P(PSTR("Mouse "), false); | ||
| 188 | break; | ||
| 189 | default: | ||
| 190 | oled_write_P(PSTR("Unkn "), false); | ||
| 191 | break; | ||
| 192 | } | ||
| 193 | } | ||
| 194 | |||
| 195 | void oled_task_user(void) { | ||
| 196 | if (is_keyboard_master()) { | ||
| 197 | render_status(); // Renders the current keyboard state (layer, lock, caps, scroll, etc) | ||
| 198 | } else { | ||
| 199 | render_logo(); | ||
| 200 | } | ||
| 201 | } | ||
| 202 | |||
| 203 | #endif | ||
| 204 | |||
| 205 | uint8_t white = 0; | ||
| 206 | uint8_t red = 255; | ||
| 207 | uint8_t green = 0; | ||
| 208 | uint8_t blue = 0; | ||
| 209 | |||
| 210 | void ball_increase_hue(void){ | ||
| 211 | if(red!=255&&green!=255&&blue!=255){ | ||
| 212 | red =255; | ||
| 213 | } | ||
| 214 | if (red==255&&green<255&&blue==0){ | ||
| 215 | green += 15; | ||
| 216 | } else if(green==255&&blue==0&&red>0){ | ||
| 217 | red-=15; | ||
| 218 | } else if(red==0&&blue<255&&green==255){ | ||
| 219 | blue+=15; | ||
| 220 | } else if(blue==255&&green>0&&red==0){ | ||
| 221 | green -= 15; | ||
| 222 | } else if(green == 0&&blue==255&&red<255){ | ||
| 223 | red +=15; | ||
| 224 | } else if(green ==0&&blue>0&&red==255){ | ||
| 225 | blue -=15; | ||
| 226 | } | ||
| 227 | trackball_set_rgbw(red,green,blue,white); | ||
| 228 | } | ||
| 229 | |||
| 230 | void decrease_color(void){ | ||
| 231 | if (green>0){ | ||
| 232 | green-=15; | ||
| 233 | } | ||
| 234 | if (red>0){ | ||
| 235 | red-=15; | ||
| 236 | } | ||
| 237 | if (blue>0){ | ||
| 238 | blue-=15; | ||
| 239 | } | ||
| 240 | trackball_set_rgbw(red,green,blue,white); | ||
| 241 | } | ||
| 242 | |||
| 243 | void cycle_white(void){ | ||
| 244 | if (white<255){ | ||
| 245 | white +=15; | ||
| 246 | } else{ | ||
| 247 | white=0; | ||
| 248 | } | ||
| 249 | trackball_set_rgbw(red,green,blue,white); | ||
| 250 | } | ||
| 251 | |||
| 252 | bool process_record_user(uint16_t keycode, keyrecord_t *record){ | ||
| 253 | switch (keycode){ | ||
| 254 | case BALL_HUI: | ||
| 255 | if(record->event.pressed){ | ||
| 256 | ball_increase_hue(); | ||
| 257 | } | ||
| 258 | break; | ||
| 259 | |||
| 260 | case BALL_WHT: | ||
| 261 | if(record-> event.pressed){ | ||
| 262 | cycle_white(); | ||
| 263 | } | ||
| 264 | break; | ||
| 265 | |||
| 266 | case BALL_DEC: | ||
| 267 | if(record-> event.pressed){ | ||
| 268 | decrease_color(); | ||
| 269 | } | ||
| 270 | break; | ||
| 271 | |||
| 272 | case BALL_SCR: | ||
| 273 | if(record->event.pressed){ | ||
| 274 | trackball_set_scrolling(true); | ||
| 275 | } else{ | ||
| 276 | trackball_set_scrolling(false); | ||
| 277 | } | ||
| 278 | break; | ||
| 279 | |||
| 280 | case BALL_NCL: | ||
| 281 | record->event.pressed?register_code(KC_BTN1):unregister_code(KC_BTN1); | ||
| 282 | break; | ||
| 283 | case BALL_RCL: | ||
| 284 | record->event.pressed?register_code(KC_BTN2):unregister_code(KC_BTN2); | ||
| 285 | break; | ||
| 286 | case BALL_MCL: | ||
| 287 | record->event.pressed?register_code(KC_BTN3):unregister_code(KC_BTN3); | ||
| 288 | break; | ||
| 289 | } | ||
| 290 | return true; | ||
| 291 | } | ||
| 292 | #ifdef ENCODER_ENABLE | ||
| 293 | void encoder_update_user(uint8_t index, bool clockwise) { | ||
| 294 | if (index == 0) { | ||
| 295 | // Volume control | ||
| 296 | if (clockwise) { | ||
| 297 | tap_code(KC_VOLU); | ||
| 298 | } else { | ||
| 299 | tap_code(KC_VOLD); | ||
| 300 | } | ||
| 301 | } | ||
| 302 | else if (index == 2) { | ||
| 303 | switch (get_highest_layer(layer_state)) { | ||
| 304 | case _ADJ: | ||
| 305 | clockwise?ball_increase_hue():cycle_white(); | ||
| 306 | break; | ||
| 307 | case _MUS: | ||
| 308 | clockwise?tap_code(KC_WH_U):tap_code(KC_WH_D); | ||
| 309 | break; | ||
| 310 | default: | ||
| 311 | clockwise?tap_code(KC_PGUP):tap_code(KC_PGDN); | ||
| 312 | break; | ||
| 313 | } | ||
| 314 | } | ||
| 315 | // I only have 2 encoders on the the pimoroni example board, just add else ifs for your other encoders... | ||
| 316 | // the missing ones are encoder 1 on the right side and encoder 3 on the left side | ||
| 317 | } | ||
| 318 | #endif | ||
diff --git a/keyboards/draculad/keymaps/pimoroni/pimoroni_trackball.c b/keyboards/draculad/keymaps/pimoroni/pimoroni_trackball.c new file mode 100644 index 000000000..c4f4a0441 --- /dev/null +++ b/keyboards/draculad/keymaps/pimoroni/pimoroni_trackball.c | |||
| @@ -0,0 +1,177 @@ | |||
| 1 | /* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> | ||
| 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 | #include "pimoroni_trackball.h" | ||
| 18 | #include "i2c_master.h" | ||
| 19 | |||
| 20 | static uint8_t scrolling = 0; | ||
| 21 | static int16_t x_offset = 0; | ||
| 22 | static int16_t y_offset = 0; | ||
| 23 | static int16_t h_offset = 0; | ||
| 24 | static int16_t v_offset = 0; | ||
| 25 | static float precisionSpeed = 1; | ||
| 26 | |||
| 27 | static uint16_t i2c_timeout_timer; | ||
| 28 | |||
| 29 | #ifndef I2C_TIMEOUT | ||
| 30 | # define I2C_TIMEOUT 100 | ||
| 31 | #endif | ||
| 32 | #ifndef I2C_WAITCHECK | ||
| 33 | # define I2C_WAITCHECK 1000 | ||
| 34 | #endif | ||
| 35 | #ifndef MOUSE_DEBOUNCE | ||
| 36 | # define MOUSE_DEBOUNCE 5 | ||
| 37 | #endif | ||
| 38 | |||
| 39 | void trackball_set_rgbw(uint8_t red, uint8_t green, uint8_t blue, uint8_t white) { | ||
| 40 | uint8_t data[] = {0x00, red, green, blue, white}; | ||
| 41 | i2c_transmit(TRACKBALL_WRITE, data, sizeof(data), I2C_TIMEOUT); | ||
| 42 | } | ||
| 43 | |||
| 44 | int16_t mouse_offset(uint8_t positive, uint8_t negative, int16_t scale) { | ||
| 45 | int16_t offset = (int16_t)positive - (int16_t)negative; | ||
| 46 | int16_t magnitude = (int16_t)(scale * offset * offset * precisionSpeed); | ||
| 47 | return offset < 0 ? -magnitude : magnitude; | ||
| 48 | } | ||
| 49 | |||
| 50 | void update_member(int8_t* member, int16_t* offset) { | ||
| 51 | if (*offset > 127) { | ||
| 52 | *member = 127; | ||
| 53 | *offset -= 127; | ||
| 54 | } else if (*offset < -127) { | ||
| 55 | *member = -127; | ||
| 56 | *offset += 127; | ||
| 57 | } else { | ||
| 58 | *member = *offset; | ||
| 59 | *offset = 0; | ||
| 60 | } | ||
| 61 | } | ||
| 62 | |||
| 63 | __attribute__((weak)) void trackball_check_click(bool pressed, report_mouse_t* mouse) { | ||
| 64 | if (pressed) { | ||
| 65 | mouse->buttons |= MOUSE_BTN1; | ||
| 66 | } else { | ||
| 67 | mouse->buttons &= ~MOUSE_BTN1; | ||
| 68 | } | ||
| 69 | } | ||
| 70 | |||
| 71 | bool process_record_kb(uint16_t keycode, keyrecord_t* record) { | ||
| 72 | if (true) { | ||
| 73 | xprintf("KL: kc: %u, col: %u, row: %u, pressed: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed); | ||
| 74 | } | ||
| 75 | |||
| 76 | |||
| 77 | if (!process_record_user(keycode, record)) { return false; } | ||
| 78 | |||
| 79 | /* If Mousekeys is disabled, then use handle the mouse button | ||
| 80 | * keycodes. This makes things simpler, and allows usage of | ||
| 81 | * the keycodes in a consistent manner. But only do this if | ||
| 82 | * Mousekeys is not enable, so it's not handled twice. | ||
| 83 | */ | ||
| 84 | #ifndef MOUSEKEY_ENABLE | ||
| 85 | if (IS_MOUSEKEY_BUTTON(keycode)) { | ||
| 86 | report_mouse_t currentReport = pointing_device_get_report(); | ||
| 87 | if (record->event.pressed) { | ||
| 88 | currentReport.buttons |= 1 << (keycode - KC_MS_BTN1); | ||
| 89 | } else { | ||
| 90 | currentReport.buttons &= ~(1 << (keycode - KC_MS_BTN1)); | ||
| 91 | } | ||
| 92 | pointing_device_set_report(currentReport); | ||
| 93 | pointing_device_send(); | ||
| 94 | } | ||
| 95 | #endif | ||
| 96 | |||
| 97 | return true; | ||
| 98 | } | ||
| 99 | |||
| 100 | void trackball_register_button(bool pressed, enum mouse_buttons button) { | ||
| 101 | report_mouse_t currentReport = pointing_device_get_report(); | ||
| 102 | if (pressed) { | ||
| 103 | currentReport.buttons |= button; | ||
| 104 | } else { | ||
| 105 | currentReport.buttons &= ~button; | ||
| 106 | } | ||
| 107 | pointing_device_set_report(currentReport); | ||
| 108 | } | ||
| 109 | |||
| 110 | float trackball_get_precision(void) { return precisionSpeed; } | ||
| 111 | void trackball_set_precision(float precision) { precisionSpeed = precision; } | ||
| 112 | bool trackball_is_scrolling(void) { return scrolling; } | ||
| 113 | void trackball_set_scrolling(bool scroll) { scrolling = scroll; } | ||
| 114 | |||
| 115 | |||
| 116 | __attribute__((weak)) void pointing_device_init(void) { trackball_set_rgbw(0x80, 0x00, 0x00, 0x00); } | ||
| 117 | |||
| 118 | void pointing_device_task(void) { | ||
| 119 | static bool debounce; | ||
| 120 | static uint16_t debounce_timer; | ||
| 121 | uint8_t state[5] = {}; | ||
| 122 | if (timer_elapsed(i2c_timeout_timer) > I2C_WAITCHECK) { | ||
| 123 | if (i2c_readReg(TRACKBALL_WRITE, 0x04, state, 5, I2C_TIMEOUT) == I2C_STATUS_SUCCESS) { | ||
| 124 | if (!state[4] && !debounce) { | ||
| 125 | if (scrolling) { | ||
| 126 | #ifdef PIMORONI_TRACKBALL_INVERT_X | ||
| 127 | h_offset += mouse_offset(state[2], state[3], 1); | ||
| 128 | #else | ||
| 129 | h_offset -= mouse_offset(state[2], state[3], 1); | ||
| 130 | #endif | ||
| 131 | #ifdef PIMORONI_TRACKBALL_INVERT_Y | ||
| 132 | v_offset += mouse_offset(state[1], state[0], 1); | ||
| 133 | #else | ||
| 134 | v_offset -= mouse_offset(state[1], state[0], 1); | ||
| 135 | #endif | ||
| 136 | } else { | ||
| 137 | #ifdef PIMORONI_TRACKBALL_INVERT_X | ||
| 138 | x_offset -= mouse_offset(state[2], state[3], 5); | ||
| 139 | #else | ||
| 140 | x_offset += mouse_offset(state[2], state[3], 5); | ||
| 141 | #endif | ||
| 142 | #ifdef PIMORONI_TRACKBALL_INVERT_Y | ||
| 143 | y_offset -= mouse_offset(state[1], state[0], 5); | ||
| 144 | #else | ||
| 145 | y_offset += mouse_offset(state[1], state[0], 5); | ||
| 146 | #endif | ||
| 147 | } | ||
| 148 | } else { | ||
| 149 | if (state[4]) { | ||
| 150 | debounce = true; | ||
| 151 | debounce_timer = timer_read(); | ||
| 152 | } | ||
| 153 | } | ||
| 154 | } else { | ||
| 155 | i2c_timeout_timer = timer_read(); | ||
| 156 | } | ||
| 157 | } | ||
| 158 | |||
| 159 | if (timer_elapsed(debounce_timer) > MOUSE_DEBOUNCE) debounce = false; | ||
| 160 | |||
| 161 | report_mouse_t mouse = pointing_device_get_report(); | ||
| 162 | // trackball_check_click(state[4] & (1 << 7), &mouse); | ||
| 163 | |||
| 164 | #ifndef PIMORONI_TRACKBALL_ROTATE | ||
| 165 | update_member(&mouse.x, &x_offset); | ||
| 166 | update_member(&mouse.y, &y_offset); | ||
| 167 | update_member(&mouse.h, &h_offset); | ||
| 168 | update_member(&mouse.v, &v_offset); | ||
| 169 | #else | ||
| 170 | update_member(&mouse.x, &y_offset); | ||
| 171 | update_member(&mouse.y, &x_offset); | ||
| 172 | update_member(&mouse.h, &v_offset); | ||
| 173 | update_member(&mouse.v, &h_offset); | ||
| 174 | #endif | ||
| 175 | pointing_device_set_report(mouse); | ||
| 176 | pointing_device_send(); | ||
| 177 | } | ||
diff --git a/keyboards/draculad/keymaps/pimoroni/pimoroni_trackball.h b/keyboards/draculad/keymaps/pimoroni/pimoroni_trackball.h new file mode 100644 index 000000000..cfcd5a47a --- /dev/null +++ b/keyboards/draculad/keymaps/pimoroni/pimoroni_trackball.h | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | /* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> | ||
| 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 | #include "quantum.h" | ||
| 20 | #include "pointing_device.h" | ||
| 21 | |||
| 22 | #ifndef TRACKBALL_ADDRESS | ||
| 23 | # define TRACKBALL_ADDRESS 0x0A | ||
| 24 | #endif | ||
| 25 | #define TRACKBALL_WRITE ((TRACKBALL_ADDRESS << 1) | I2C_WRITE) | ||
| 26 | #define TRACKBALL_READ ((TRACKBALL_ADDRESS << 1) | I2C_READ) | ||
| 27 | |||
| 28 | void trackball_set_rgbw(uint8_t red, uint8_t green, uint8_t blue, uint8_t white); | ||
| 29 | void trackball_check_click(bool pressed, report_mouse_t *mouse); | ||
| 30 | void trackball_register_button(bool pressed, enum mouse_buttons button); | ||
| 31 | |||
| 32 | float trackball_get_precision(void); | ||
| 33 | void trackball_set_precision(float precision); | ||
| 34 | bool trackball_is_scrolling(void); | ||
| 35 | void trackball_set_scrolling(bool scroll); \ No newline at end of file | ||
diff --git a/keyboards/draculad/keymaps/pimoroni/rules.mk b/keyboards/draculad/keymaps/pimoroni/rules.mk new file mode 100644 index 000000000..547a02f26 --- /dev/null +++ b/keyboards/draculad/keymaps/pimoroni/rules.mk | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | # only uncomment on the side you have your trackball on | ||
| 2 | POINTING_DEVICE_ENABLE = yes | ||
| 3 | SRC += pimoroni_trackball.c | ||
| 4 | QUANTUM_LIB_SRC += i2c_master.c | ||
| 5 | OLED_DRIVER_ENABLE = yes | ||
| 6 | MOUSEKEY_ENABLE = no | ||
