Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions .github/workflows/build-firmware.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
jobs:
build:
runs-on: ubuntu-latest
container: ghcr.io/qmk/qmk_cli
container: ghcr.io/qmk/qmk_cli@sha256:2dc05fc9f32efebd6b05c2b8676ee548358bc7e151e9dbf4dac6b6eed4513b07

steps:
- name: Checkout code - Non PR
Expand Down Expand Up @@ -79,9 +79,8 @@ jobs:
shell: bash

- name: Release
uses: softprops/action-gh-release@v2
uses: ncipollo/release-action@v1.11.2
if: ${{ startsWith(github.ref, 'refs/tags/') }}
with:
files: |
${{ steps.move_file.outputs.file_name }}

allowUpdates: True
artifacts: "${{ steps.move_file.outputs.file_name }}"
62 changes: 59 additions & 3 deletions drivers/sensors/azoteq_iqs5xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
// SPDX-License-Identifier: GPL-2.0-or-later

#include "azoteq_iqs5xx.h"
#include "axis_scale.h"
#include "pointing_device_internal.h"
#include "timer.h"
#include "wait.h"

#ifndef AZOTEQ_IQS5XX_ADDRESS
Expand Down Expand Up @@ -78,6 +80,15 @@
#ifndef AZOTEQ_IQS5XX_ZOOM_CONSECUTIVE_DISTANCE
# define AZOTEQ_IQS5XX_ZOOM_CONSECUTIVE_DISTANCE 0x19
#endif
#ifndef AZOTEQ_IQS5XX_SCROLL_DIVISOR
# define AZOTEQ_IQS5XX_SCROLL_DIVISOR 1
#endif
#ifndef AZOTEQ_IQS5XX_TAP_DRAG_ENABLE
# define AZOTEQ_IQS5XX_TAP_DRAG_ENABLE false
#endif
#ifndef AZOTEQ_IQS5XX_TAP_DRAG_WINDOW_MS
# define AZOTEQ_IQS5XX_TAP_DRAG_WINDOW_MS 200
#endif
#ifndef AZOTEQ_IQS5XX_EVENT_MODE
// Event mode can't be used until the pointing code has changed (stuck buttons)
# define AZOTEQ_IQS5XX_EVENT_MODE false
Expand Down Expand Up @@ -351,6 +362,15 @@ void azoteq_iqs5xx_init(void) {
}
};

static axis_scale_t scroll_scale_h = { .mult = 1, .div = AZOTEQ_IQS5XX_SCROLL_DIVISOR, .remainder = 0 };
static axis_scale_t scroll_scale_v = { .mult = 1, .div = AZOTEQ_IQS5XX_SCROLL_DIVISOR, .remainder = 0 };

#if AZOTEQ_IQS5XX_TAP_DRAG_ENABLE
static bool tap_drag_armed = false;
static bool tap_drag_active = false;
static uint16_t tap_drag_timer = 0;
#endif

report_mouse_t azoteq_iqs5xx_get_report(report_mouse_t mouse_report) {
report_mouse_t temp_report = {0};

Expand All @@ -365,7 +385,14 @@ report_mouse_t azoteq_iqs5xx_get_report(report_mouse_t mouse_report) {
pd_dprintf("IQS5XX - previous cycle time missed, took: %dms\n", base_data.previous_cycle_time);
}
#endif
if (base_data.gesture_events_0.single_tap || base_data.gesture_events_0.press_and_hold) {
#ifndef AZOTEQ_IQS5XX_PRESS_AND_HOLD_AS_CLICK
# define AZOTEQ_IQS5XX_PRESS_AND_HOLD_AS_CLICK AZOTEQ_IQS5XX_PRESS_AND_HOLD_ENABLE
#endif
if (base_data.gesture_events_0.single_tap
#if AZOTEQ_IQS5XX_PRESS_AND_HOLD_AS_CLICK
|| base_data.gesture_events_0.press_and_hold
#endif
) {
pd_dprintf("IQS5XX - Single tap/hold.\n");
temp_report.buttons = pointing_device_handle_buttons(temp_report.buttons, true, POINTING_DEVICE_BUTTON1);
} else if (base_data.gesture_events_1.two_finger_tap) {
Expand Down Expand Up @@ -397,9 +424,38 @@ report_mouse_t azoteq_iqs5xx_get_report(report_mouse_t mouse_report) {
}
} else if (base_data.gesture_events_1.scroll) {
pd_dprintf("IQS5XX - Scroll.\n");
temp_report.h = CONSTRAIN_HID(AZOTEQ_IQS5XX_COMBINE_H_L_BYTES(base_data.x.h, base_data.x.l));
temp_report.v = CONSTRAIN_HID(AZOTEQ_IQS5XX_COMBINE_H_L_BYTES(base_data.y.h, base_data.y.l));
temp_report.h = CONSTRAIN_HID_HV(add_to_axis(&scroll_scale_h, AZOTEQ_IQS5XX_COMBINE_H_L_BYTES(base_data.x.h, base_data.x.l)));
temp_report.v = CONSTRAIN_HID_HV(add_to_axis(&scroll_scale_v, -AZOTEQ_IQS5XX_COMBINE_H_L_BYTES(base_data.y.h, base_data.y.l)));
} else {
clear_remainder_axis(&scroll_scale_h);
clear_remainder_axis(&scroll_scale_v);
}
#if AZOTEQ_IQS5XX_TAP_DRAG_ENABLE
// Tap-to-drag: tap, lift, quickly touch again to drag.
// BUTTON1 is held throughout the drag window so macOS sees
// one continuous press (required for window dragging, etc.).
if (base_data.gesture_events_0.single_tap) {
tap_drag_armed = true;
tap_drag_active = false;
tap_drag_timer = timer_read();
} else if (tap_drag_active) {
if (base_data.number_of_fingers >= 1) {
temp_report.buttons = pointing_device_handle_buttons(temp_report.buttons, true, POINTING_DEVICE_BUTTON1);
} else {
tap_drag_active = false;
}
} else if (tap_drag_armed) {
// Keep BUTTON1 held during the window so there's no gap.
temp_report.buttons = pointing_device_handle_buttons(temp_report.buttons, true, POINTING_DEVICE_BUTTON1);
if (timer_elapsed(tap_drag_timer) >= AZOTEQ_IQS5XX_TAP_DRAG_WINDOW_MS) {
tap_drag_armed = false;
// Release — finger didn't come back in time.
} else if (base_data.number_of_fingers == 1) {
tap_drag_active = true;
tap_drag_armed = false;
}
}
#endif
if (base_data.number_of_fingers == 1 && !ignore_movement) {
temp_report.x = CONSTRAIN_HID_XY(AZOTEQ_IQS5XX_COMBINE_H_L_BYTES(base_data.x.h, base_data.x.l));
temp_report.y = CONSTRAIN_HID_XY(AZOTEQ_IQS5XX_COMBINE_H_L_BYTES(base_data.y.h, base_data.y.l));
Expand Down
17 changes: 15 additions & 2 deletions keyboards/svalboard/azoteq/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,22 @@

#define AZOTEQ_IQS5XX_TPS43
#define AZOTEQ_IQS5XX_TIMEOUT_MS 10
// Keep press_and_hold enabled in hardware to avoid gesture engine stalls,
// but don't act on it — see AZOTEQ_IQS5XX_PRESS_AND_HOLD_AS_CLICK below.
#define AZOTEQ_IQS5XX_PRESS_AND_HOLD_ENABLE true
//This decreases the required 'wait' time to activate dragging/selecting on a touchpad from default 300ms to 20ms. Big QoL.
#define AZOTEQ_IQS5XX_HOLD_TIME 20
#define AZOTEQ_IQS5XX_PRESS_AND_HOLD_AS_CLICK false

#define AZOTEQ_IQS5XX_TAP_DRAG_ENABLE true
#define AZOTEQ_IQS5XX_TAP_DRAG_WINDOW_MS 200

#define AZOTEQ_IQS5XX_SCROLL_DIVISOR 8

#define AZOTEQ_IQS5XX_TAP_TIME 200
// TAP_TIME default is 150ms. Raised since we no longer act on press_and_hold,
// so there's no need to keep TAP_TIME short to disambiguate the two.
#define AZOTEQ_IQS5XX_HOLD_TIME 300
// HOLD_TIME default is 300ms

//#define POINTING_DEVICE_MOTION_PIN GP18

#define SPLIT_POINTING_ENABLE
Expand Down
1 change: 1 addition & 0 deletions quantum/pointing_device/pointing_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ typedef int16_t hv_clamp_range_t;

#define CONSTRAIN_HID(amt) ((amt) < INT8_MIN ? INT8_MIN : ((amt) > INT8_MAX ? INT8_MAX : (amt)))
#define CONSTRAIN_HID_XY(amt) ((amt) < MOUSE_REPORT_XY_MIN ? MOUSE_REPORT_XY_MIN : ((amt) > MOUSE_REPORT_XY_MAX ? MOUSE_REPORT_XY_MAX : (amt)))
#define CONSTRAIN_HID_HV(amt) ((amt) < MOUSE_REPORT_HV_MIN ? MOUSE_REPORT_HV_MIN : ((amt) > MOUSE_REPORT_HV_MAX ? MOUSE_REPORT_HV_MAX : (amt)))

void pointing_device_init(void);
bool pointing_device_task(void);
Expand Down
Loading