aboutsummaryrefslogtreecommitdiff
path: root/keyboards/draculad
diff options
context:
space:
mode:
authorMango The Fourth <40720523+MangoIV@users.noreply.github.com>2021-04-27 19:41:11 +0200
committerGitHub <noreply@github.com>2021-04-27 19:41:11 +0200
commit3fe356e65c65f725e94f3ad32fd65cc24befb531 (patch)
tree9bd576d8b6f695d54ded0fabee05ec4beba9b5ff /keyboards/draculad
parentb95231c1e3bdc2bb617112f87d8dc6026d0d3ee8 (diff)
downloadqmk_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')
-rw-r--r--keyboards/draculad/config.h67
-rw-r--r--keyboards/draculad/draculad.c18
-rw-r--r--keyboards/draculad/draculad.h39
-rw-r--r--keyboards/draculad/keymaps/default/keymap.c220
-rw-r--r--keyboards/draculad/keymaps/pimoroni/config.h25
-rw-r--r--keyboards/draculad/keymaps/pimoroni/keymap.c318
-rw-r--r--keyboards/draculad/keymaps/pimoroni/pimoroni_trackball.c177
-rw-r--r--keyboards/draculad/keymaps/pimoroni/pimoroni_trackball.h35
-rw-r--r--keyboards/draculad/keymaps/pimoroni/rules.mk6
-rw-r--r--keyboards/draculad/readme.md33
-rw-r--r--keyboards/draculad/rules.mk27
11 files changed, 965 insertions, 0 deletions
diff --git a/keyboards/draculad/config.h b/keyboards/draculad/config.h
new file mode 100644
index 000000000..8a27fdea4
--- /dev/null
+++ b/keyboards/draculad/config.h
@@ -0,0 +1,67 @@
1/*
2Copyright 2021 @mangoiv
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#pragma once
19
20#include "config_common.h"
21
22#define VENDOR_ID 0xFEED
23#define PRODUCT_ID 0x1B1E
24#define DEVICE_VER 0x0001
25#define MANUFACTURER mangoiv
26#define PRODUCT draculad
27
28#define MATRIX_ROWS 8
29#define MATRIX_COLS 5
30
31#define MATRIX_ROW_PINS {D4, C6, D7, E6}
32#define MATRIX_COL_PINS {F4, F5,F6, F7, B1}
33
34#define DIODE_DIRECTION COL2ROW
35
36#define DEBOUNCE 5
37
38
39#define USE_SERIAL
40#define SOFT_SERIAL_PIN D2
41
42#ifdef OLED_DRIVER_ENABLE
43 #define OLED_DISPLAY_128X64
44 #define OLED_TIMEOUT 30000
45#endif
46
47#define RGB_DI_PIN D3
48#ifdef RGB_DI_PIN
49#define RGBLIGHT_EFFECT_RAINBOW_SWIRL
50#define RGBLIGHT_EFFECT_RAINBOW_MOOD
51#define RGBLIGHT_EFFECT_STATIC_GRADIENT
52#define RGBLIGHT_EFFECT_BREATHING
53#define RGBLED_NUM 10
54#define RGBLIGHT_SPLIT
55#define RGBLIGHT_HUE_STEP 8
56#define RGBLIGHT_SAT_STEP 8
57#define RGBLIGHT_VAL_STEP 8
58#define RGBLIGHT_SLEEP
59#endif
60
61#define ENCODERS_PAD_A {B2 , B4}
62#define ENCODERS_PAD_B {B6 , B5}
63
64#define ENCODER_RESOLUTIONS { 4, 4, 4, 1}
65#define UNUSED_PINS
66
67#define EE_HANDS
diff --git a/keyboards/draculad/draculad.c b/keyboards/draculad/draculad.c
new file mode 100644
index 000000000..04a83ef2e
--- /dev/null
+++ b/keyboards/draculad/draculad.c
@@ -0,0 +1,18 @@
1/*
2Copyright 2021 @mangoiv
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include "draculad.h" \ No newline at end of file
diff --git a/keyboards/draculad/draculad.h b/keyboards/draculad/draculad.h
new file mode 100644
index 000000000..47d4b2143
--- /dev/null
+++ b/keyboards/draculad/draculad.h
@@ -0,0 +1,39 @@
1/*
2Copyright 2021 @mangoiv
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#pragma once
19
20#include "quantum.h"
21
22#define XXX KC_NO
23
24#define LAYOUT( \
25 L00, L01, L02, L03, L04, R00, R01, R02, R03, R04, \
26 L10, L11, L12, L13, L14, R10, R11, R12, R13, R14, \
27 L20, L21, L22, L23, L24, R20, R21, R22, R23, R24, \
28 L30, L31, L32, L33, R30, R31, R32, R33 \
29 ) \
30 { \
31 { L00, L01, L02, L03, L04 }, \
32 { L10, L11, L12, L13, L14 }, \
33 { L20, L21, L22, L23, L24 }, \
34 { XXX, L30, L31, L32, L33 }, \
35 { R04, R03, R02, R01, R00 }, \
36 { R14, R13, R12, R11, R10 }, \
37 { R24, R23, R22, R21, R20 }, \
38 { XXX, R33, R32, R31, R30 } \
39 }
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/*
2Copyright 2021 @mangoiv
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include QMK_KEYBOARD_H
19
20
21enum layer_number {
22 _BASE,
23 _NUM,
24 _SYMB,
25 _MUS,
26 _ADJ
27};
28
29
30char wpm_as_str[8];
31
32const 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
68oled_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}
81static 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
152static 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
182void 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
193void 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/*
2Copyright 2021 @mangoiv
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along 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/*
2Copyright 2021 @mangoiv
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along 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
23enum layer_number {
24 _BASE,
25 _NUM,
26 _SYMB,
27 _MUS,
28 _ADJ
29};
30
31enum 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
42char wpm_as_str[8];
43
44const 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
81oled_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}
94static 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
165static 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
195void 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
205uint8_t white = 0;
206uint8_t red = 255;
207uint8_t green = 0;
208uint8_t blue = 0;
209
210void 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
230void 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
243void 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
252bool 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
293void 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
20static uint8_t scrolling = 0;
21static int16_t x_offset = 0;
22static int16_t y_offset = 0;
23static int16_t h_offset = 0;
24static int16_t v_offset = 0;
25static float precisionSpeed = 1;
26
27static 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
39void 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
44int16_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
50void 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
71bool 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
100void 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
110float trackball_get_precision(void) { return precisionSpeed; }
111void trackball_set_precision(float precision) { precisionSpeed = precision; }
112bool trackball_is_scrolling(void) { return scrolling; }
113void 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
118void 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
28void trackball_set_rgbw(uint8_t red, uint8_t green, uint8_t blue, uint8_t white);
29void trackball_check_click(bool pressed, report_mouse_t *mouse);
30void trackball_register_button(bool pressed, enum mouse_buttons button);
31
32float trackball_get_precision(void);
33void trackball_set_precision(float precision);
34bool trackball_is_scrolling(void);
35void 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
2POINTING_DEVICE_ENABLE = yes
3SRC += pimoroni_trackball.c
4QUANTUM_LIB_SRC += i2c_master.c
5OLED_DRIVER_ENABLE = yes
6MOUSEKEY_ENABLE = no
diff --git a/keyboards/draculad/readme.md b/keyboards/draculad/readme.md
new file mode 100644
index 000000000..f1fd546cd
--- /dev/null
+++ b/keyboards/draculad/readme.md
@@ -0,0 +1,33 @@
1# DracuLad
2
3![DracuLad](https://github.com/mangoiv/draculad/blob/master/pictures/rev1/both_sides_showcase.jpg?raw=true)
4
5*A 34-36 key split keyboard*
6- 36 keys, two of them can be replaced by rotary encoders making it support 34-36 keys and 2-4 encoders.
7- bright RGB Underglow with ws2812b LEDs
8- one ssd1306 OLED per side
9- aggressive pinky stagger similar to the kyria but with an alternative thumb cluster to raise comfort for large hands
10- support for mx and choc switches
11
12* keyboard Maintainer: [MangoIV](https://github.com/MangoIV)
13* Hardware Supported: [DracuLad PCBs and cases](https://github.com/MangoIV/dracuLad), [the pimoroni trackball](https://shop.pimoroni.com/products/trackball-breakout)
14* Hardware availability: [check my github](https://github.com/MangoIV)
15
16Make example for this keyboard (after setting up your build env):
17
18 make draculad:default
19
20or for the version using the pimoroni trackball
21
22 make draculad:pimoroni
23
24Flashing example for dfu and catarina respectively (replace default with the name of your keymap)
25
26 make draculad:default:dfu
27
28 make draculad:default:flash
29
30
31When flashing the first time using handedness by eeprom, use the [qmk guide for that topic](https://docs.qmk.fm/#/feature_split_keyboard?id=handedness-by-eeprom)
32
33See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
diff --git a/keyboards/draculad/rules.mk b/keyboards/draculad/rules.mk
new file mode 100644
index 000000000..d8596006c
--- /dev/null
+++ b/keyboards/draculad/rules.mk
@@ -0,0 +1,27 @@
1# MCU name
2MCU = atmega32u4
3
4# Bootloader selection
5BOOTLOADER = caterina
6
7# Build Options
8# change yes to no to disable
9#
10BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration
11MOUSEKEY_ENABLE = yes # Mouse keys
12EXTRAKEY_ENABLE = yes # Audio control and System control
13CONSOLE_ENABLE = no # Console for debug
14COMMAND_ENABLE = no # Commands for debug and configuration
15# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
16SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
17# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
18NKRO_ENABLE = yes # USB Nkey Rollover
19BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
20RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
21BLUETOOTH_ENABLE = no # Enable Bluetooth
22AUDIO_ENABLE = no # Audio output
23SPLIT_KEYBOARD = yes
24OLED_DRIVER_ENABLE = yes
25WPM_ENABLE = yes
26ENCODER_ENABLE = yes
27LTO_ENABLE = yes