logo

qmk_firmware

custom branch of QMK firmware git clone https://anongit.hacktivis.me/git/qmk_firmware.git

cirque_pinnacle.c (18091B)


  1. // Copyright (c) 2018 Cirque Corp. Restrictions apply. See: www.cirque.com/sw-license
  2. // based on https://github.com/cirque-corp/Cirque_Pinnacle_1CA027/tree/master/Circular_Trackpad
  3. // with modifications and changes for QMK
  4. // refer to documentation: Gen2 and Gen3 (Pinnacle ASIC) at https://www.cirque.com/documentation
  5. #include "cirque_pinnacle.h"
  6. #include "cirque_pinnacle_gestures.h"
  7. #include "wait.h"
  8. #include "timer.h"
  9. #include <stdlib.h>
  10. #ifndef CIRQUE_PINNACLE_ATTENUATION
  11. # ifdef CIRQUE_PINNACLE_CURVED_OVERLAY
  12. # define CIRQUE_PINNACLE_ATTENUATION EXTREG__TRACK_ADCCONFIG__ADC_ATTENUATE_2X
  13. # else
  14. # define CIRQUE_PINNACLE_ATTENUATION EXTREG__TRACK_ADCCONFIG__ADC_ATTENUATE_4X
  15. # endif
  16. #endif
  17. bool touchpad_init;
  18. uint16_t scale_data = CIRQUE_PINNACLE_DEFAULT_SCALE;
  19. void cirque_pinnacle_clear_flags(void);
  20. void cirque_pinnacle_enable_feed(bool feedEnable);
  21. void RAP_ReadBytes(uint8_t address, uint8_t* data, uint8_t count);
  22. void RAP_Write(uint8_t address, uint8_t data);
  23. #if CIRQUE_PINNACLE_POSITION_MODE
  24. /* Logical Scaling Functions */
  25. // Clips raw coordinates to "reachable" window of sensor
  26. // NOTE: values outside this window can only appear as a result of noise
  27. void ClipCoordinates(pinnacle_data_t* coordinates) {
  28. if (coordinates->xValue < CIRQUE_PINNACLE_X_LOWER) {
  29. coordinates->xValue = CIRQUE_PINNACLE_X_LOWER;
  30. } else if (coordinates->xValue > CIRQUE_PINNACLE_X_UPPER) {
  31. coordinates->xValue = CIRQUE_PINNACLE_X_UPPER;
  32. }
  33. if (coordinates->yValue < CIRQUE_PINNACLE_Y_LOWER) {
  34. coordinates->yValue = CIRQUE_PINNACLE_Y_LOWER;
  35. } else if (coordinates->yValue > CIRQUE_PINNACLE_Y_UPPER) {
  36. coordinates->yValue = CIRQUE_PINNACLE_Y_UPPER;
  37. }
  38. }
  39. #endif
  40. uint16_t cirque_pinnacle_get_scale(void) {
  41. return scale_data;
  42. }
  43. void cirque_pinnacle_set_scale(uint16_t scale) {
  44. scale_data = scale;
  45. }
  46. // Scales data to desired X & Y resolution
  47. void cirque_pinnacle_scale_data(pinnacle_data_t* coordinates, uint16_t xResolution, uint16_t yResolution) {
  48. #if CIRQUE_PINNACLE_POSITION_MODE
  49. uint32_t xTemp = 0;
  50. uint32_t yTemp = 0;
  51. ClipCoordinates(coordinates);
  52. xTemp = coordinates->xValue;
  53. yTemp = coordinates->yValue;
  54. // translate coordinates to (0, 0) reference by subtracting edge-offset
  55. xTemp -= CIRQUE_PINNACLE_X_LOWER;
  56. yTemp -= CIRQUE_PINNACLE_Y_LOWER;
  57. // scale coordinates to (xResolution, yResolution) range
  58. coordinates->xValue = (uint16_t)(xTemp * xResolution / CIRQUE_PINNACLE_X_RANGE);
  59. coordinates->yValue = (uint16_t)(yTemp * yResolution / CIRQUE_PINNACLE_Y_RANGE);
  60. #else
  61. int32_t xTemp = 0, yTemp = 0;
  62. ldiv_t temp;
  63. static int32_t xRemainder, yRemainder;
  64. temp = ldiv(((int32_t)coordinates->xDelta) * (int32_t)xResolution + xRemainder, (int32_t)CIRQUE_PINNACLE_X_RANGE);
  65. xTemp = temp.quot;
  66. xRemainder = temp.rem;
  67. temp = ldiv(((int32_t)coordinates->yDelta) * (int32_t)yResolution + yRemainder, (int32_t)CIRQUE_PINNACLE_Y_RANGE);
  68. yTemp = temp.quot;
  69. yRemainder = temp.rem;
  70. coordinates->xDelta = (int16_t)xTemp;
  71. coordinates->yDelta = (int16_t)yTemp;
  72. #endif
  73. }
  74. // Clears Status1 register flags (SW_CC and SW_DR)
  75. void cirque_pinnacle_clear_flags(void) {
  76. RAP_Write(HOSTREG__STATUS1, HOSTREG__STATUS1_DEFVAL & ~(HOSTREG__STATUS1__COMMAND_COMPLETE | HOSTREG__STATUS1__DATA_READY));
  77. wait_us(50);
  78. }
  79. // Enables/Disables the feed
  80. void cirque_pinnacle_enable_feed(bool feedEnable) {
  81. uint8_t feedconfig1;
  82. RAP_ReadBytes(HOSTREG__FEEDCONFIG1, &feedconfig1, 1);
  83. if (feedEnable) {
  84. feedconfig1 |= HOSTREG__FEEDCONFIG1__FEED_ENABLE;
  85. } else {
  86. feedconfig1 &= ~HOSTREG__FEEDCONFIG1__FEED_ENABLE;
  87. }
  88. RAP_Write(HOSTREG__FEEDCONFIG1, feedconfig1);
  89. }
  90. /* ERA (Extended Register Access) Functions */
  91. // Reads <count> bytes from an extended register at <address> (16-bit address),
  92. // stores values in <*data>
  93. void ERA_ReadBytes(uint16_t address, uint8_t* data, uint16_t count) {
  94. uint8_t ERAControlValue = 0xFF;
  95. uint16_t timeout_timer;
  96. cirque_pinnacle_enable_feed(false); // Disable feed
  97. RAP_Write(HOSTREG__EXT_REG_AXS_ADDR_HIGH, (uint8_t)(address >> 8)); // Send upper byte of ERA address
  98. RAP_Write(HOSTREG__EXT_REG_AXS_ADDR_LOW, (uint8_t)(address & 0x00FF)); // Send lower byte of ERA address
  99. for (uint16_t i = 0; i < count; i++) {
  100. RAP_Write(HOSTREG__EXT_REG_AXS_CTRL, HOSTREG__EREG_AXS__INC_ADDR_READ | HOSTREG__EREG_AXS__READ); // Signal ERA-read (auto-increment) to Pinnacle
  101. // Wait for status register 0x1E to clear
  102. timeout_timer = timer_read();
  103. do {
  104. RAP_ReadBytes(HOSTREG__EXT_REG_AXS_CTRL, &ERAControlValue, 1);
  105. } while ((ERAControlValue != 0x00) && (timer_elapsed(timeout_timer) <= CIRQUE_PINNACLE_TIMEOUT));
  106. RAP_ReadBytes(HOSTREG__EXT_REG_AXS_VALUE, data + i, 1);
  107. cirque_pinnacle_clear_flags();
  108. }
  109. }
  110. // Writes a byte, <data>, to an extended register at <address> (16-bit address)
  111. void ERA_WriteByte(uint16_t address, uint8_t data) {
  112. uint8_t ERAControlValue = 0xFF;
  113. uint16_t timeout_timer;
  114. cirque_pinnacle_enable_feed(false); // Disable feed
  115. RAP_Write(HOSTREG__EXT_REG_AXS_VALUE, data); // Send data byte to be written
  116. RAP_Write(HOSTREG__EXT_REG_AXS_ADDR_HIGH, (uint8_t)(address >> 8)); // Upper byte of ERA address
  117. RAP_Write(HOSTREG__EXT_REG_AXS_ADDR_LOW, (uint8_t)(address & 0x00FF)); // Lower byte of ERA address
  118. RAP_Write(HOSTREG__EXT_REG_AXS_CTRL, HOSTREG__EREG_AXS__WRITE); // Signal an ERA-write to Pinnacle
  119. // Wait for status register 0x1E to clear
  120. timeout_timer = timer_read();
  121. do {
  122. RAP_ReadBytes(HOSTREG__EXT_REG_AXS_CTRL, &ERAControlValue, 1);
  123. } while ((ERAControlValue != 0x00) && (timer_elapsed(timeout_timer) <= CIRQUE_PINNACLE_TIMEOUT));
  124. cirque_pinnacle_clear_flags();
  125. }
  126. bool cirque_pinnacle_set_adc_attenuation(uint8_t adcGain) {
  127. uint8_t adcconfig = 0x00;
  128. ERA_ReadBytes(EXTREG__TRACK_ADCCONFIG, &adcconfig, 1);
  129. adcGain &= EXTREG__TRACK_ADCCONFIG__ADC_ATTENUATE_MASK;
  130. if (adcGain == (adcconfig & EXTREG__TRACK_ADCCONFIG__ADC_ATTENUATE_MASK)) {
  131. return false;
  132. }
  133. adcconfig &= ~EXTREG__TRACK_ADCCONFIG__ADC_ATTENUATE_MASK;
  134. adcconfig |= adcGain;
  135. ERA_WriteByte(EXTREG__TRACK_ADCCONFIG, adcconfig);
  136. ERA_ReadBytes(EXTREG__TRACK_ADCCONFIG, &adcconfig, 1);
  137. return true;
  138. }
  139. // Changes thresholds to improve detection of fingers
  140. // Not needed for flat overlay?
  141. void cirque_pinnacle_tune_edge_sensitivity(void) {
  142. uint8_t widezmin = 0x00;
  143. ERA_ReadBytes(EXTREG__XAXIS_WIDEZMIN, &widezmin, 1);
  144. ERA_WriteByte(EXTREG__XAXIS_WIDEZMIN, 0x04); // magic number from Cirque sample code
  145. ERA_ReadBytes(EXTREG__XAXIS_WIDEZMIN, &widezmin, 1);
  146. ERA_ReadBytes(EXTREG__YAXIS_WIDEZMIN, &widezmin, 1);
  147. ERA_WriteByte(EXTREG__YAXIS_WIDEZMIN, 0x03); // magic number from Cirque sample code
  148. ERA_ReadBytes(EXTREG__YAXIS_WIDEZMIN, &widezmin, 1);
  149. }
  150. // Perform calibration
  151. void cirque_pinnacle_calibrate(void) {
  152. uint8_t calconfig;
  153. uint16_t timeout_timer;
  154. RAP_ReadBytes(HOSTREG__CALCONFIG1, &calconfig, 1);
  155. calconfig |= HOSTREG__CALCONFIG1__CALIBRATE;
  156. RAP_Write(HOSTREG__CALCONFIG1, calconfig);
  157. // Calibration takes ~100ms according to GT-AN-090624, doubling the timeout just to be safe
  158. timeout_timer = timer_read();
  159. do {
  160. RAP_ReadBytes(HOSTREG__CALCONFIG1, &calconfig, 1);
  161. } while ((calconfig & HOSTREG__CALCONFIG1__CALIBRATE) && (timer_elapsed(timeout_timer) <= 200));
  162. cirque_pinnacle_clear_flags();
  163. }
  164. // Enable/disable cursor smoothing, smoothing is enabled by default
  165. void cirque_pinnacle_cursor_smoothing(bool enable) {
  166. uint8_t feedconfig3;
  167. RAP_ReadBytes(HOSTREG__FEEDCONFIG3, &feedconfig3, 1);
  168. if (enable) {
  169. feedconfig3 &= ~HOSTREG__FEEDCONFIG3__DISABLE_CROSS_RATE_SMOOTHING;
  170. } else {
  171. feedconfig3 |= HOSTREG__FEEDCONFIG3__DISABLE_CROSS_RATE_SMOOTHING;
  172. }
  173. RAP_Write(HOSTREG__FEEDCONFIG3, feedconfig3);
  174. }
  175. // Check sensor is connected
  176. bool cirque_pinnacle_connected(void) {
  177. uint8_t current_zidle = 0;
  178. uint8_t temp_zidle = 0;
  179. RAP_ReadBytes(HOSTREG__ZIDLE, &current_zidle, 1);
  180. RAP_Write(HOSTREG__ZIDLE, HOSTREG__ZIDLE_DEFVAL);
  181. RAP_ReadBytes(HOSTREG__ZIDLE, &temp_zidle, 1);
  182. if (temp_zidle == HOSTREG__ZIDLE_DEFVAL) {
  183. RAP_Write(HOSTREG__ZIDLE, current_zidle);
  184. return true;
  185. }
  186. return false;
  187. }
  188. /* Pinnacle-based TM040040/TM035035/TM023023 Functions */
  189. void cirque_pinnacle_init(void) {
  190. #if defined(POINTING_DEVICE_DRIVER_cirque_pinnacle_spi)
  191. spi_init();
  192. #elif defined(POINTING_DEVICE_DRIVER_cirque_pinnacle_i2c)
  193. i2c_init();
  194. #endif
  195. touchpad_init = true;
  196. // send a RESET command now, in case QMK had a soft-reset without a power cycle
  197. RAP_Write(HOSTREG__SYSCONFIG1, HOSTREG__SYSCONFIG1__RESET);
  198. wait_ms(30); // Pinnacle needs 10-15ms to boot, so wait long enough before configuring
  199. RAP_Write(HOSTREG__SYSCONFIG1, HOSTREG__SYSCONFIG1_DEFVAL);
  200. wait_us(50);
  201. // Host clears SW_CC flag
  202. cirque_pinnacle_clear_flags();
  203. #if CIRQUE_PINNACLE_POSITION_MODE
  204. RAP_Write(HOSTREG__FEEDCONFIG2, HOSTREG__FEEDCONFIG2_DEFVAL);
  205. #else
  206. // FeedConfig2 (Feature flags for Relative Mode Only)
  207. uint8_t feedconfig2 = HOSTREG__FEEDCONFIG2__GLIDE_EXTEND_DISABLE | HOSTREG__FEEDCONFIG2__INTELLIMOUSE_MODE;
  208. # if !defined(CIRQUE_PINNACLE_TAP_ENABLE)
  209. feedconfig2 |= HOSTREG__FEEDCONFIG2__ALL_TAP_DISABLE;
  210. # endif
  211. # if !defined(CIRQUE_PINNACLE_SECONDARY_TAP_ENABLE)
  212. feedconfig2 |= HOSTREG__FEEDCONFIG2__SECONDARY_TAP_DISABLE;
  213. # elif !defined(CIRQUE_PINNACLE_TAP_ENABLE)
  214. # error CIRQUE_PINNACLE_TAP_ENABLE must be defined for CIRQUE_PINNACLE_SECONDARY_TAP_ENABLE to work
  215. # endif
  216. # if !defined(CIRQUE_PINNACLE_SIDE_SCROLL_ENABLE)
  217. feedconfig2 |= HOSTREG__FEEDCONFIG2__SCROLL_DISABLE;
  218. # endif
  219. RAP_Write(HOSTREG__FEEDCONFIG2, feedconfig2);
  220. #endif
  221. // FeedConfig1 (Data Output Flags)
  222. RAP_Write(HOSTREG__FEEDCONFIG1, CIRQUE_PINNACLE_POSITION_MODE ? HOSTREG__FEEDCONFIG1__DATA_TYPE__REL0_ABS1 : HOSTREG__FEEDCONFIG1_DEFVAL);
  223. #if CIRQUE_PINNACLE_POSITION_MODE
  224. // Host sets z-idle packet count to 5 (default is 0x1E/30)
  225. RAP_Write(HOSTREG__ZIDLE, 5);
  226. #endif
  227. bool calibrate = cirque_pinnacle_set_adc_attenuation(CIRQUE_PINNACLE_ATTENUATION);
  228. #ifdef CIRQUE_PINNACLE_CURVED_OVERLAY
  229. cirque_pinnacle_tune_edge_sensitivity();
  230. calibrate = true;
  231. #endif
  232. if (calibrate) {
  233. // Force a calibration after setting ADC attenuation
  234. cirque_pinnacle_calibrate();
  235. }
  236. cirque_pinnacle_enable_feed(true);
  237. #ifndef CIRQUE_PINNACLE_SKIP_SENSOR_CHECK
  238. touchpad_init = cirque_pinnacle_connected();
  239. #endif
  240. }
  241. pinnacle_data_t cirque_pinnacle_read_data(void) {
  242. uint8_t data_ready = 0;
  243. uint8_t data[6] = {0};
  244. pinnacle_data_t result = {0};
  245. // Check if there is valid data available
  246. RAP_ReadBytes(HOSTREG__STATUS1, &data_ready, 1);
  247. if ((data_ready & HOSTREG__STATUS1__DATA_READY) == 0) {
  248. // no data available yet
  249. result.valid = false; // be explicit
  250. return result;
  251. }
  252. // Read all data bytes
  253. RAP_ReadBytes(HOSTREG__PACKETBYTE_0, data, 6);
  254. // Get ready for the next data sample
  255. cirque_pinnacle_clear_flags();
  256. #if CIRQUE_PINNACLE_POSITION_MODE
  257. // Decode data for absolute mode
  258. // Register 0x13 is unused in this mode (palm detection area)
  259. result.buttonFlags = data[0] & 0x3F; // bit0 to bit5 are switch 0-5, only hardware button presses (from input pin on the Pinnacle chip)
  260. result.xValue = data[2] | ((data[4] & 0x0F) << 8); // merge high and low bits for X
  261. result.yValue = data[3] | ((data[4] & 0xF0) << 4); // merge high and low bits for Y
  262. result.zValue = data[5] & 0x3F; // Z is only lower 6 bits, upper 2 bits are reserved/unused
  263. result.touchDown = (result.xValue != 0 || result.yValue != 0); // (0,0) is a "magic coordinate" to indicate "finger touched down"
  264. #else
  265. // Decode data for relative mode
  266. // Registers 0x16 and 0x17 are unused in this mode
  267. result.buttons = data[0] & 0x07; // Only three buttons are supported
  268. if ((data[0] & 0x10) && data[1] != 0) {
  269. result.xDelta = -((int16_t)256 - (int16_t)(data[1]));
  270. } else {
  271. result.xDelta = data[1];
  272. }
  273. if ((data[0] & 0x20) && data[2] != 0) {
  274. result.yDelta = ((int16_t)256 - (int16_t)(data[2]));
  275. } else {
  276. result.yDelta = -((int16_t)data[2]);
  277. }
  278. result.wheelCount = ((int8_t*)data)[3];
  279. #endif
  280. #ifdef CIRQUE_PINNACLE_REACHABLE_CALIBRATION
  281. static uint16_t xMin = UINT16_MAX, yMin = UINT16_MAX, yMax = 0, xMax = 0;
  282. if (result.xValue < xMin) xMin = result.xValue;
  283. if (result.xValue > xMax) xMax = result.xValue;
  284. if (result.yValue < yMin) yMin = result.yValue;
  285. if (result.yValue > yMax) yMax = result.yValue;
  286. pd_dprintf("%s: xLo=%3d xHi=%3d yLo=%3d yHi=%3d\n", __FUNCTION__, xMin, xMax, yMin, yMax);
  287. #endif
  288. result.valid = true;
  289. return result;
  290. }
  291. #ifdef POINTING_DEVICE_GESTURES_CURSOR_GLIDE_ENABLE
  292. static bool cursor_glide_enable = true;
  293. static cursor_glide_context_t glide = {.config = {
  294. .coef = 102, /* Good default friction coef */
  295. .interval = 10, /* 100sps */
  296. .trigger_px = 10, /* Default threshold in case of hover, set to 0 if you'd like */
  297. }};
  298. void cirque_pinnacle_enable_cursor_glide(bool enable) {
  299. cursor_glide_enable = enable;
  300. }
  301. void cirque_pinnacle_configure_cursor_glide(float trigger_px) {
  302. glide.config.trigger_px = trigger_px;
  303. }
  304. #endif
  305. #if CIRQUE_PINNACLE_POSITION_MODE
  306. # ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE
  307. static bool is_touch_down;
  308. bool auto_mouse_activation(report_mouse_t mouse_report) {
  309. return is_touch_down || mouse_report.x != 0 || mouse_report.y != 0 || mouse_report.h != 0 || mouse_report.v != 0 || mouse_report.buttons;
  310. }
  311. # endif
  312. report_mouse_t cirque_pinnacle_get_report(report_mouse_t mouse_report) {
  313. uint16_t scale = cirque_pinnacle_get_scale();
  314. pinnacle_data_t touchData = cirque_pinnacle_read_data();
  315. mouse_xy_report_t report_x = 0, report_y = 0;
  316. static uint16_t x = 0, y = 0, last_scale = 0;
  317. # if defined(CIRQUE_PINNACLE_TAP_ENABLE)
  318. mouse_report.buttons = pointing_device_handle_buttons(mouse_report.buttons, false, POINTING_DEVICE_BUTTON1);
  319. # endif
  320. # ifdef POINTING_DEVICE_GESTURES_CURSOR_GLIDE_ENABLE
  321. cursor_glide_t glide_report = {0};
  322. if (cursor_glide_enable) {
  323. glide_report = cursor_glide_check(&glide);
  324. }
  325. # endif
  326. if (!touchData.valid) {
  327. # ifdef POINTING_DEVICE_GESTURES_CURSOR_GLIDE_ENABLE
  328. if (cursor_glide_enable && glide_report.valid) {
  329. report_x = glide_report.dx;
  330. report_y = glide_report.dy;
  331. goto mouse_report_update;
  332. }
  333. # endif
  334. return mouse_report;
  335. }
  336. if (touchData.touchDown) {
  337. pd_dprintf("cirque_pinnacle touchData x=%4d y=%4d z=%2d\n", touchData.xValue, touchData.yValue, touchData.zValue);
  338. }
  339. # ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE
  340. is_touch_down = touchData.touchDown;
  341. # endif
  342. // Scale coordinates to arbitrary X, Y resolution
  343. cirque_pinnacle_scale_data(&touchData, scale, scale);
  344. if (!cirque_pinnacle_gestures(&mouse_report, touchData)) {
  345. if (last_scale && scale == last_scale && x && y && touchData.xValue && touchData.yValue) {
  346. report_x = CONSTRAIN_HID_XY((int16_t)(touchData.xValue - x));
  347. report_y = CONSTRAIN_HID_XY((int16_t)(touchData.yValue - y));
  348. }
  349. x = touchData.xValue;
  350. y = touchData.yValue;
  351. last_scale = scale;
  352. # ifdef POINTING_DEVICE_GESTURES_CURSOR_GLIDE_ENABLE
  353. if (cursor_glide_enable) {
  354. if (touchData.touchDown) {
  355. cursor_glide_update(&glide, report_x, report_y, touchData.zValue);
  356. } else if (!glide_report.valid) {
  357. glide_report = cursor_glide_start(&glide);
  358. if (glide_report.valid) {
  359. report_x = glide_report.dx;
  360. report_y = glide_report.dy;
  361. }
  362. }
  363. }
  364. # endif
  365. }
  366. # ifdef POINTING_DEVICE_GESTURES_CURSOR_GLIDE_ENABLE
  367. mouse_report_update:
  368. # endif
  369. mouse_report.x = report_x;
  370. mouse_report.y = report_y;
  371. return mouse_report;
  372. }
  373. uint16_t cirque_pinnacle_get_cpi(void) {
  374. return CIRQUE_PINNACLE_PX_TO_INCH(cirque_pinnacle_get_scale());
  375. }
  376. void cirque_pinnacle_set_cpi(uint16_t cpi) {
  377. cirque_pinnacle_set_scale(CIRQUE_PINNACLE_INCH_TO_PX(cpi));
  378. }
  379. // clang-format off
  380. const pointing_device_driver_t cirque_pinnacle_pointing_device_driver = {
  381. .init = cirque_pinnacle_init,
  382. .get_report = cirque_pinnacle_get_report,
  383. .set_cpi = cirque_pinnacle_set_cpi,
  384. .get_cpi = cirque_pinnacle_get_cpi
  385. };
  386. // clang-format on
  387. #else
  388. report_mouse_t cirque_pinnacle_get_report(report_mouse_t mouse_report) {
  389. pinnacle_data_t touchData = cirque_pinnacle_read_data();
  390. // Scale coordinates to arbitrary X, Y resolution
  391. cirque_pinnacle_scale_data(&touchData, cirque_pinnacle_get_scale(), cirque_pinnacle_get_scale());
  392. if (touchData.valid) {
  393. mouse_report.buttons = touchData.buttons;
  394. mouse_report.x = CONSTRAIN_HID_XY(touchData.xDelta);
  395. mouse_report.y = CONSTRAIN_HID_XY(touchData.yDelta);
  396. mouse_report.v = touchData.wheelCount;
  397. }
  398. return mouse_report;
  399. }
  400. // clang-format off
  401. const pointing_device_driver_t cirque_pinnacle_pointing_device_driver = {
  402. .init = cirque_pinnacle_init,
  403. .get_report = cirque_pinnacle_get_report,
  404. .set_cpi = cirque_pinnacle_set_scale,
  405. .get_cpi = cirque_pinnacle_get_scale
  406. };
  407. // clang-format on
  408. #endif