@@ -21,7 +21,6 @@ const pointing_device_driver_t navigator_trackpad_pointing_device_driver = {.ini
2121
2222deferred_token callback_token = 0 ;
2323uint16_t current_cpi = DEFAULT_CPI_TICK ;
24- uint32_t gpio_offset_addr ;
2524uint8_t has_motion = 0 ;
2625extern bool set_scrolling ;
2726bool trackpad_init ;
@@ -234,16 +233,11 @@ uint8_t cirque_gen6_enable_logical_scaling(bool set) {
234233 if (set ) {
235234 xy_config &= ~0x08 ;
236235 } else {
237- xy_config |= ~ 0x08 ;
236+ xy_config |= 0x08 ;
238237 }
239238 return cirque_gen6_write_reg (CGEN6_XY_CONFIG , xy_config );
240239}
241240
242- bool cirque_gen6_get_gpio_state (uint8_t num ) {
243- uint32_t gpio_states = cirque_gen6_read_reg_32 (0x43000000 + gpio_offset_addr + 0x0004 );
244- return ((gpio_states >> num ) & 0x000000001 );
245- }
246-
247241void cirque_gen_6_read_report (void ) {
248242 uint8_t packet [CGEN6_MAX_PACKET_SIZE ];
249243 if (cirque_gen6_read_report (packet , CGEN6_MAX_PACKET_SIZE ) != I2C_STATUS_SUCCESS ) {
@@ -253,19 +247,13 @@ void cirque_gen_6_read_report(void) {
253247 uint8_t report_id = packet [2 ];
254248#if defined(NAVIGATOR_TRACKPAD_PTP_MODE )
255249 if (report_id == CGEN6_PTP_REPORT_ID ) {
256- ptp_report .fingers [0 ].id = (packet [3 ] & 0xFC ) >> 2 ;
257- ptp_report .fingers [0 ].confidence = packet [3 ] & 0x01 ;
258- ptp_report .fingers [0 ].tip = (packet [3 ] & 0x02 ) >> 1 ;
259- ptp_report .fingers [0 ].x = packet [5 ] << 8 | packet [4 ];
260- ptp_report .fingers [0 ].y = packet [7 ] << 8 | packet [6 ];
261- ptp_report .fingers [1 ].id = (packet [8 ] & 0xFC ) >> 2 ;
262- ptp_report .fingers [1 ].confidence = packet [8 ] & 0x01 ;
263- ptp_report .fingers [1 ].tip = (packet [8 ] & 0x02 ) >> 1 ;
264- ptp_report .fingers [1 ].x = packet [10 ] << 8 | packet [9 ];
265- ptp_report .fingers [1 ].y = packet [12 ] << 8 | packet [11 ];
266- ptp_report .ts = packet [14 ] << 8 | packet [13 ];
267- ptp_report .contact_count = packet [15 ];
268- ptp_report .buttons = packet [16 ];
250+ ptp_report .fingers [0 ].tip = (packet [3 ] & 0x02 ) >> 1 ;
251+ ptp_report .fingers [0 ].x = packet [5 ] << 8 | packet [4 ];
252+ ptp_report .fingers [0 ].y = packet [7 ] << 8 | packet [6 ];
253+ ptp_report .fingers [1 ].tip = (packet [8 ] & 0x02 ) >> 1 ;
254+ ptp_report .fingers [1 ].x = packet [10 ] << 8 | packet [9 ];
255+ ptp_report .fingers [1 ].y = packet [12 ] << 8 | packet [11 ];
256+ ptp_report .buttons = packet [16 ];
269257 }
270258#endif
271259#if defined(NAVIGATOR_TRACKPAD_RELATIVE_MODE )
@@ -281,26 +269,6 @@ void cirque_gen_6_read_report(void) {
281269#endif
282270}
283271
284- void dump_ptp_report (void ) {
285- #if defined(NAVIGATOR_TRACKPAD_PTP_MODE )
286- printf ("PTP Report:\n" );
287- printf (" ID finger 1: %d\n" , ptp_report .fingers [0 ].id );
288- printf (" Confidence finger 1: %d\n" , ptp_report .fingers [0 ].confidence );
289- printf (" Tip finger 1: %d\n" , ptp_report .fingers [0 ].tip );
290- printf (" X finger 1: %d\n" , ptp_report .fingers [0 ].x );
291- printf (" Y finger 1: %d\n" , ptp_report .fingers [0 ].y );
292- printf (" ID finger 2: %d\n" , ptp_report .fingers [1 ].id );
293- printf (" Confidence finger 2: %d\n" , ptp_report .fingers [1 ].confidence );
294- printf (" Tip finger 2: %d\n" , ptp_report .fingers [1 ].tip );
295- printf (" X finger 2: %d\n" , ptp_report .fingers [1 ].x );
296- printf (" Y finger 2: %d\n" , ptp_report .fingers [1 ].y );
297- printf (" Timestamp: %d\n" , ptp_report .ts );
298- printf (" Contact Count: %d\n" , ptp_report .contact_count );
299- printf (" Buttons: %d\n" , ptp_report .buttons );
300- printf (" Fingers: %d\n" , finger_count (& ptp_report ));
301- #endif
302- }
303-
304272// Check if the DR pin is asserted, if it is there is motion data to sample.
305273uint8_t cirque_gen6_has_motion (void ) {
306274 return cirque_gen6_read_reg (CGEN6_I2C_DR , true);
@@ -327,11 +295,12 @@ void navigator_trackpad_device_init(void) {
327295 }
328296 cirque_gen6_clear ();
329297 wait_ms (50 );
298+
299+ uint8_t res = CGEN6_SUCCESS ;
330300#if defined(NAVIGATOR_TRACKPAD_PTP_MODE )
331- uint8_t res = cirque_gen6_set_ptp_mode ();
332- #endif
333- #if defined(NAVIGATOR_TRACKPAD_RELATIVE_MODE )
334- uint8_t res = cirque_gen6_set_relative_mode ();
301+ res = cirque_gen6_set_ptp_mode ();
302+ #elif defined(NAVIGATOR_TRACKPAD_RELATIVE_MODE )
303+ res = cirque_gen6_set_relative_mode ();
335304#endif
336305
337306 if (res != CGEN6_SUCCESS ) {
@@ -468,12 +437,12 @@ report_mouse_t navigator_trackpad_get_report(report_mouse_t mouse_report) {
468437 bool is_tap = (duration <= NAVIGATOR_TRACKPAD_TAP_TIMEOUT ) &&
469438 (dist_sq <= NAVIGATOR_TRACKPAD_TAP_MOVE_THRESHOLD );
470439
471- // Don't trigger taps if we were scrolling (two fingers detected )
472- // Also suppress taps that happen shortly after a scroll ends (within 100ms)
440+ // Don't trigger single-finger taps that happen shortly after a scroll ends (within 100ms )
441+ // But allow two-finger taps (right-click) even after scrolling
473442# ifdef NAVIGATOR_TRACKPAD_SCROLL_WITH_TWO_FINGERS
474- if (is_tap && ( gesture .max_finger_count >= 2 ||
475- timer_elapsed (gesture .last_scroll_end ) < 100 ) ) {
476- is_tap = false; // Suppress tap after scrolling
443+ if (is_tap && gesture .max_finger_count == 1 &&
444+ timer_elapsed (gesture .last_scroll_end ) < 100 ) {
445+ is_tap = false; // Suppress single-finger tap after scrolling
477446 }
478447# endif
479448
0 commit comments