From de3167d140221108b0d1b8be5c07237d561d28e4 Mon Sep 17 00:00:00 2001 From: vhaudiquet Date: Thu, 28 Sep 2023 14:43:51 +0200 Subject: [PATCH] Updated driver interface --- README.md | 38 +++++++++++++++++++++++++++++++++-- src/device/driver_interface.h | 36 +++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 src/device/driver_interface.h diff --git a/README.md b/README.md index 2f7a9c9..9065829 100644 --- a/README.md +++ b/README.md @@ -10,11 +10,45 @@ Drivers **must** expose the following symbols: ```c void driver_init(); // Initialization uint32_t driver_getkey(); // Calls to this function must return USB keys that this driver registers, until 0 -device_type_t driver_get_type(); // Returns device type +device_type_t driver_get_capacity(); // Returns device capacity (see below) char* driver_get_name(void* handle); // Returns peripheral name char* driver_get_image(void* handle); // Returns peripheral image -// Mouse drivers +/* +* Mouse drivers +* +* - DPI Levels: max levels, level info (dpi + led), level count, current level +* - Debounce time : possible values, current value +* - Motion sync +* - Lift off distance : possible values, current value +* - Angle snap +* - Polling rate : possible values, current value +* - LED (color/effect/status) +*/ +struct MOUSE_DPI_LEVELS +{ + unsigned int max_level_count; + unsigned int level_count; + unsigned int level_current; + bool led_available; + bool xy_available; + struct MOUSE_DPI_LEVEL + { + unsigned int dpi_x; + unsigned int dpi_y; + unsigned char r; + unsigned char g; + unsigned char b; + } level[]; +}; +struct MOUSE_DPI_LEVELS driver_mouse_dpi_get(void* handle); + +/* +* Wireless driver +* - Battery (state + amount) +* - Connection type (usb 2.4/bluetooth/wired) +*/ + ``` diff --git a/src/device/driver_interface.h b/src/device/driver_interface.h new file mode 100644 index 0000000..bc32dc5 --- /dev/null +++ b/src/device/driver_interface.h @@ -0,0 +1,36 @@ +#ifndef DRIVER_INTERFACE_H +#define DRIVER_INTERFACE_H + +enum device_capacity_t +{ + DEVICE_CAPACITY_MOUSE, + DEVICE_CAPACITY_WIRELESS, +}; + +void driver_init(); // Initialization +uint32_t driver_getkey(); // Calls to this function must return USB keys that this driver registers, until 0 + +device_capacity_t driver_get_capacity(void* handle); // Returns device capacity (see above) +char* driver_get_name(void* handle); // Returns peripheral name +char* driver_get_image(void* handle); // Returns peripheral image + +/* Mouse drivers */ +struct MOUSE_DPI_LEVELS +{ + unsigned int max_level_count; + unsigned int level_count; + unsigned int level_current; + bool led_available; + bool xy_available; + struct MOUSE_DPI_LEVEL + { + unsigned int dpi_x; + unsigned int dpi_y; + unsigned char r; + unsigned char g; + unsigned char b; + } level[]; +}; +struct MOUSE_DPI_LEVELS driver_mouse_dpi_get(void* handle); + +#endif \ No newline at end of file