Skip to content

Commit

Permalink
cirque: cleanup and adapt to recent changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Kriechi committed Jun 25, 2022
1 parent afab84c commit dfb491b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
1 change: 0 additions & 1 deletion docs/feature_pointing_device.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ This supports the Cirque Pinnacle 1CA027 Touch Controller, which is used in the
|`CIRQUE_PINNACLE_TAPPING_TERM` | (Optional) Length of time that a touch can be to be considered a tap. | `TAPPING_TERM`/`200` |
|`CIRQUE_PINNACLE_TOUCH_DEBOUNCE` | (Optional) Length of time that a touch can be to be considered a tap. | `TAPPING_TERM`/`200` |
|`CIRQUE_PINNACLE_RESET_ON_INIT_WAIT` | (Optional) Wait time in milliseconds after sending reset during init. Use 0 to skip. | `30` |
|`CIRQUE_PINNACLE_POSITION_MODE` | (Optional) Absolute or Relative positioning mode. Use `CIRQUE_PINNACLE_{ABSOLUTE,RELATIVE}_MODE` | `CIRQUE_PINNACLE_ABSOLUTE_MODE` |

**`CIRQUE_PINNACLE_ATTENUATION`** is a measure of how much data is suppressed in regards to sensitivity. The higher the attenuation, the less sensitive the touchpad will be.

Expand Down
1 change: 0 additions & 1 deletion drivers/sensors/cirque_pinnacle.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
# define CIRQUE_PINNACLE_Y_RANGE (CIRQUE_PINNACLE_Y_UPPER - CIRQUE_PINNACLE_Y_LOWER)
#endif
#if !defined(POINTING_DEVICE_TASK_THROTTLE_MS)
# undef POINTING_DEVICE_TASK_THROTTLE_MS
# define POINTING_DEVICE_TASK_THROTTLE_MS 10 // Cirque Pinnacle in normal operation produces data every 10ms. Advanced configuration for pen/stylus usage might require lower values.
#endif
#if defined(POINTING_DEVICE_DRIVER_cirque_pinnacle_i2c)
Expand Down
2 changes: 1 addition & 1 deletion drivers/sensors/cirque_pinnacle_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void RAP_Write(uint8_t address, uint8_t data) {
if (touchpad_init) {
if (i2c_writeReg(CIRQUE_PINNACLE_ADDR << 1, cmdByte, &data, sizeof(data), CIRQUE_PINNACLE_TIMEOUT) != I2C_STATUS_SUCCESS) {
#ifdef CONSOLE_ENABLE
dprintf("error right touchpad\n");
dprintf("error cirque_pinnacle i2c_writeReg\n");
#endif
touchpad_init = false;
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/sensors/cirque_pinnacle_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void RAP_ReadBytes(uint8_t address, uint8_t* data, uint8_t count) {
}
} else {
#ifdef CONSOLE_ENABLE
dprintf("error cirque_pinnacle spi_start\n");
dprintf("error cirque_pinnacle spi_start read\n");
#endif
touchpad_init = false;
}
Expand All @@ -43,7 +43,7 @@ void RAP_Write(uint8_t address, uint8_t data) {
spi_write(data);
} else {
#ifdef CONSOLE_ENABLE
dprintf("error right touchpad\n");
dprintf("error cirque_pinnacle spi_start write\n");
#endif
touchpad_init = false;
}
Expand Down
13 changes: 7 additions & 6 deletions quantum/pointing_device_drivers.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,11 @@ const pointing_device_driver_t pointing_device_driver = {
# endif

report_mouse_t cirque_pinnacle_get_report(report_mouse_t mouse_report) {
pinnacle_data_t touchData = cirque_pinnacle_read_data();
static uint16_t x = 0, y = 0, mouse_timer = 0;
mouse_xy_report_t report_x = 0, report_y = 0;
static bool is_z_down = false;
pinnacle_data_t touchData = cirque_pinnacle_read_data();
mouse_xy_report_t report_x = 0, report_y = 0;
static mouse_xy_report_t x = 0, y = 0;
static uint16_t mouse_timer = 0;
static bool is_z_down = false;

# if !CIRQUE_PINNACLE_POSITION_MODE
# error Cirque Pinnacle with relative mode not implemented yet.
Expand All @@ -130,8 +131,8 @@ report_mouse_t cirque_pinnacle_get_report(report_mouse_t mouse_report) {
cirque_pinnacle_scale_data(&touchData, cirque_pinnacle_get_scale(), cirque_pinnacle_get_scale());

if (x && y && touchData.xValue && touchData.yValue) {
report_x = (int8_t)(touchData.xValue - x);
report_y = (int8_t)(touchData.yValue - y);
report_x = (mouse_xy_report_t)(touchData.xValue - x);
report_y = (mouse_xy_report_t)(touchData.yValue - y);
}
x = touchData.xValue;
y = touchData.yValue;
Expand Down

0 comments on commit dfb491b

Please sign in to comment.