diff options
-rw-r--r-- | keyboards/draculad/keymaps/pimoroni/config.h | 8 | ||||
-rw-r--r-- | keyboards/draculad/keymaps/pimoroni/keymap.c | 43 | ||||
-rw-r--r-- | keyboards/draculad/keymaps/pimoroni/rules.mk | 5 |
3 files changed, 32 insertions, 24 deletions
diff --git a/keyboards/draculad/keymaps/pimoroni/config.h b/keyboards/draculad/keymaps/pimoroni/config.h index c5f9df6f9..378b9b892 100644 --- a/keyboards/draculad/keymaps/pimoroni/config.h +++ b/keyboards/draculad/keymaps/pimoroni/config.h | |||
@@ -15,11 +15,13 @@ 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/>. | 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #define POINTING_DEVICE_ROTATION_90 | ||
19 | |||
18 | //comment that out if your trackball is on the left side | 20 | //comment that out if your trackball is on the left side |
19 | #define TRACKBALL_RIGHT | 21 | #define TRACKBALL_RIGHT |
20 | 22 | ||
21 | #ifdef TRACKBALL_RIGHT | 23 | #ifdef TRACKBALL_RIGHT |
22 | #define PIMORONI_TRACKBALL_INVERT_X | 24 | #define POINTING_DEVICE_INVERT_X |
23 | #define PIMORONI_TRACKBALL_INVERT_Y | 25 | #define POINTING_DEVICE_INVERT_Y |
24 | #endif | 26 | #endif |
25 | 27 | ||
diff --git a/keyboards/draculad/keymaps/pimoroni/keymap.c b/keyboards/draculad/keymaps/pimoroni/keymap.c index b70184dbc..5c20c69af 100644 --- a/keyboards/draculad/keymaps/pimoroni/keymap.c +++ b/keyboards/draculad/keymaps/pimoroni/keymap.c | |||
@@ -16,8 +16,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include QMK_KEYBOARD_H | 18 | #include QMK_KEYBOARD_H |
19 | #include "drivers/sensors/pimoroni_trackball.h" | ||
20 | #include "pointing_device.h" | ||
21 | 19 | ||
22 | 20 | ||
23 | enum layer_number { | 21 | enum layer_number { |
@@ -29,13 +27,13 @@ enum layer_number { | |||
29 | }; | 27 | }; |
30 | 28 | ||
31 | enum custom_keycodes { | 29 | enum custom_keycodes { |
32 | BALL_HUI,//cycles hue | 30 | BALL_HUI = SAFE_RANGE, //cycles hue |
33 | BALL_WHT,//cycles white | 31 | BALL_WHT, //cycles white |
34 | BALL_DEC,//decreased color | 32 | BALL_DEC, //decreased color |
35 | BALL_SCR,//scrolls | 33 | BALL_SCR, //scrolls |
36 | BALL_NCL,//left click | 34 | BALL_NCL, //left click |
37 | BALL_RCL,//right click | 35 | BALL_RCL, //right click |
38 | BALL_MCL,//middle click | 36 | BALL_MCL, //middle click |
39 | }; | 37 | }; |
40 | 38 | ||
41 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | 39 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
@@ -78,8 +76,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
78 | 76 | ||
79 | 77 | ||
80 | #ifdef OLED_ENABLE | 78 | #ifdef OLED_ENABLE |
81 | |||
82 | |||
83 | oled_rotation_t oled_init_user(oled_rotation_t rotation) { | 79 | oled_rotation_t oled_init_user(oled_rotation_t rotation) { |
84 | 80 | ||
85 | if (is_keyboard_master()) { | 81 | if (is_keyboard_master()) { |
@@ -209,13 +205,23 @@ bool oled_task_user(void) { | |||
209 | return false; | 205 | return false; |
210 | } | 206 | } |
211 | 207 | ||
212 | #endif | 208 | #endif //OLED_ENABLE |
213 | 209 | ||
214 | uint8_t white = 0; | 210 | uint8_t white = 0; |
215 | uint8_t red = 255; | 211 | uint8_t red = 255; |
216 | uint8_t green = 0; | 212 | uint8_t green = 0; |
217 | uint8_t blue = 0; | 213 | uint8_t blue = 0; |
218 | 214 | ||
215 | bool set_scrolling = false; | ||
216 | report_mouse_t pointing_device_task_user(report_mouse_t mouse_report) { | ||
217 | if (set_scrolling) { | ||
218 | mouse_report.h = mouse_report.x; | ||
219 | mouse_report.v = mouse_report.y; | ||
220 | mouse_report.x = mouse_report.y = 0; | ||
221 | } | ||
222 | return mouse_report; | ||
223 | } | ||
224 | |||
219 | void ball_increase_hue(void){ | 225 | void ball_increase_hue(void){ |
220 | if(red!=255&&green!=255&&blue!=255){ | 226 | if(red!=255&&green!=255&&blue!=255){ |
221 | red =255; | 227 | red =255; |
@@ -233,7 +239,7 @@ void ball_increase_hue(void){ | |||
233 | } else if(green ==0&&blue>0&&red==255){ | 239 | } else if(green ==0&&blue>0&&red==255){ |
234 | blue -=15; | 240 | blue -=15; |
235 | } | 241 | } |
236 | trackball_set_rgbw(red,green,blue,white); | 242 | pimoroni_trackball_set_rgbw(red,green,blue,white); |
237 | } | 243 | } |
238 | 244 | ||
239 | void decrease_color(void){ | 245 | void decrease_color(void){ |
@@ -246,7 +252,7 @@ void decrease_color(void){ | |||
246 | if (blue>0){ | 252 | if (blue>0){ |
247 | blue-=15; | 253 | blue-=15; |
248 | } | 254 | } |
249 | trackball_set_rgbw(red,green,blue,white); | 255 | pimoroni_trackball_set_rgbw(red,green,blue,white); |
250 | } | 256 | } |
251 | 257 | ||
252 | void cycle_white(void){ | 258 | void cycle_white(void){ |
@@ -255,7 +261,7 @@ void cycle_white(void){ | |||
255 | } else{ | 261 | } else{ |
256 | white=0; | 262 | white=0; |
257 | } | 263 | } |
258 | trackball_set_rgbw(red,green,blue,white); | 264 | pimoroni_trackball_set_rgbw(red,green,blue,white); |
259 | } | 265 | } |
260 | 266 | ||
261 | bool process_record_user(uint16_t keycode, keyrecord_t *record){ | 267 | bool process_record_user(uint16_t keycode, keyrecord_t *record){ |
@@ -280,9 +286,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record){ | |||
280 | 286 | ||
281 | case BALL_SCR: | 287 | case BALL_SCR: |
282 | if(record->event.pressed){ | 288 | if(record->event.pressed){ |
283 | trackball_set_scrolling(true); | 289 | set_scrolling = true; |
284 | } else{ | 290 | } else{ |
285 | trackball_set_scrolling(false); | 291 | set_scrolling = false; |
286 | } | 292 | } |
287 | break; | 293 | break; |
288 | 294 | ||
@@ -298,6 +304,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record){ | |||
298 | } | 304 | } |
299 | return true; | 305 | return true; |
300 | } | 306 | } |
307 | |||
301 | #ifdef ENCODER_ENABLE | 308 | #ifdef ENCODER_ENABLE |
302 | bool encoder_update_user(uint8_t index, bool clockwise) { | 309 | bool encoder_update_user(uint8_t index, bool clockwise) { |
303 | if (index == 0) { | 310 | if (index == 0) { |
@@ -325,4 +332,4 @@ bool encoder_update_user(uint8_t index, bool clockwise) { | |||
325 | // the missing ones are encoder 1 on the right side and encoder 3 on the left side | 332 | // the missing ones are encoder 1 on the right side and encoder 3 on the left side |
326 | return true; | 333 | return true; |
327 | } | 334 | } |
328 | #endif | 335 | #endif // ENCODER_ENABLE |
diff --git a/keyboards/draculad/keymaps/pimoroni/rules.mk b/keyboards/draculad/keymaps/pimoroni/rules.mk index 704aad070..66d3bf0e4 100644 --- a/keyboards/draculad/keymaps/pimoroni/rules.mk +++ b/keyboards/draculad/keymaps/pimoroni/rules.mk | |||
@@ -1,7 +1,6 @@ | |||
1 | # only uncomment on the side you have your trackball on | 1 | # only uncomment on the side you have your trackball on |
2 | POINTING_DEVICE_ENABLE = yes | 2 | POINTING_DEVICE_ENABLE = yes |
3 | SRC += drivers/sensors/pimoroni_trackball.c | 3 | POINTING_DEVICE_DRIVER = pimoroni_trackball |
4 | QUANTUM_LIB_SRC += i2c_master.c | ||
5 | OLED_ENABLE = yes | 4 | OLED_ENABLE = yes |
6 | OLED_DRIVER = SSD1306 | 5 | OLED_DRIVER = SSD1306 |
7 | MOUSEKEY_ENABLE = no | 6 | MOUSEKEY_ENABLE = yes |