diff options
Diffstat (limited to 'drivers/sensors/pimoroni_trackball.h')
| -rw-r--r-- | drivers/sensors/pimoroni_trackball.h | 48 |
1 files changed, 36 insertions, 12 deletions
diff --git a/drivers/sensors/pimoroni_trackball.h b/drivers/sensors/pimoroni_trackball.h index 6b2a41425..59ee8724b 100644 --- a/drivers/sensors/pimoroni_trackball.h +++ b/drivers/sensors/pimoroni_trackball.h | |||
| @@ -16,22 +16,46 @@ | |||
| 16 | */ | 16 | */ |
| 17 | #pragma once | 17 | #pragma once |
| 18 | 18 | ||
| 19 | #include "quantum.h" | 19 | #include <stdint.h> |
| 20 | #include "pointing_device.h" | 20 | #include "report.h" |
| 21 | #include "i2c_master.h" | ||
| 21 | 22 | ||
| 22 | typedef struct pimoroni_data { | 23 | #ifndef PIMORONI_TRACKBALL_ADDRESS |
| 24 | # define PIMORONI_TRACKBALL_ADDRESS 0x0A | ||
| 25 | #endif | ||
| 26 | #ifndef PIMORONI_TRACKBALL_INTERVAL_MS | ||
| 27 | # define PIMORONI_TRACKBALL_INTERVAL_MS 8 | ||
| 28 | #endif | ||
| 29 | #ifndef PIMORONI_TRACKBALL_SCALE | ||
| 30 | # define PIMORONI_TRACKBALL_SCALE 5 | ||
| 31 | #endif | ||
| 32 | #ifndef PIMORONI_TRACKBALL_DEBOUNCE_CYCLES | ||
| 33 | # define PIMORONI_TRACKBALL_DEBOUNCE_CYCLES 20 | ||
| 34 | #endif | ||
| 35 | #ifndef PIMORONI_TRACKBALL_ERROR_COUNT | ||
| 36 | # define PIMORONI_TRACKBALL_ERROR_COUNT 10 | ||
| 37 | #endif | ||
| 38 | |||
| 39 | #ifndef PIMORONI_TRACKBALL_TIMEOUT | ||
| 40 | # define PIMORONI_TRACKBALL_TIMEOUT 100 | ||
| 41 | #endif | ||
| 42 | |||
| 43 | #ifndef PIMORONI_TRACKBALL_DEBUG_INTERVAL | ||
| 44 | # define PIMORONI_TRACKBALL_DEBUG_INTERVAL 100 | ||
| 45 | #endif | ||
| 46 | |||
| 47 | typedef struct { | ||
| 23 | uint8_t left; | 48 | uint8_t left; |
| 24 | uint8_t right; | 49 | uint8_t right; |
| 25 | uint8_t up; | 50 | uint8_t up; |
| 26 | uint8_t down; | 51 | uint8_t down; |
| 27 | uint8_t click; | 52 | uint8_t click; |
| 28 | } pimoroni_data; | 53 | } pimoroni_data_t; |
| 29 | 54 | ||
| 30 | void trackball_set_rgbw(uint8_t red, uint8_t green, uint8_t blue, uint8_t white); | 55 | void pimironi_trackball_device_init(void); |
| 31 | void trackball_click(bool pressed, report_mouse_t* mouse); | 56 | void pimoroni_trackball_set_rgbw(uint8_t red, uint8_t green, uint8_t blue, uint8_t white); |
| 32 | int16_t trackball_get_offsets(uint8_t negative_dir, uint8_t positive_dir, uint8_t scale); | 57 | int16_t pimoroni_trackball_get_offsets(uint8_t negative_dir, uint8_t positive_dir, uint8_t scale); |
| 33 | void trackball_adapt_values(int8_t* mouse, int16_t* offset); | 58 | void pimoroni_trackball_adapt_values(int8_t* mouse, int16_t* offset); |
| 34 | float trackball_get_precision(void); | 59 | float pimoroni_trackball_get_precision(void); |
| 35 | void trackball_set_precision(float precision); | 60 | void pimoroni_trackball_set_precision(float precision); |
| 36 | bool trackball_is_scrolling(void); | 61 | i2c_status_t read_pimoroni_trackball(pimoroni_data_t* data); |
| 37 | void trackball_set_scrolling(bool scroll); | ||
