From d77f6dd6f393efa8db2fe3d9a6fdea2eb8e5254c Mon Sep 17 00:00:00 2001 From: Dasky <32983009+daskygit@users.noreply.github.com> Date: Fri, 25 Oct 2024 15:24:04 +0100 Subject: [PATCH] update button state names to be clearer --- tests/test_common/pointing_device_driver.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/test_common/pointing_device_driver.c b/tests/test_common/pointing_device_driver.c index e05a2be8ce4..b64dbad5063 100644 --- a/tests/test_common/pointing_device_driver.c +++ b/tests/test_common/pointing_device_driver.c @@ -6,8 +6,8 @@ #include typedef struct { - bool state; - bool set; + bool pressed; + bool dirty; } pd_button_state_t; typedef struct { @@ -28,9 +28,9 @@ void pointing_device_driver_init(void) { report_mouse_t pointing_device_driver_get_report(report_mouse_t mouse_report) { for (uint8_t i = 0; i < 8; i++) { - if (pd_config.button_state[i].set) { - pd_config.button_state[i].set = false; - if (pd_config.button_state[i].state) { + if (pd_config.button_state[i].dirty) { + pd_config.button_state[i].dirty = false; + if (pd_config.button_state[i].pressed) { mouse_report.buttons |= 1 << (i); } else { mouse_report.buttons &= ~(1 << (i)); @@ -53,18 +53,18 @@ __attribute__((weak)) void pointing_device_driver_set_cpi(uint16_t cpi) { } void pd_press_button(uint8_t btn) { - pd_config.button_state[btn].set = true; - pd_config.button_state[btn].state = true; + pd_config.button_state[btn].dirty = true; + pd_config.button_state[btn].pressed = true; } void pd_release_button(uint8_t btn) { - pd_config.button_state[btn].set = true; - pd_config.button_state[btn].state = false; + pd_config.button_state[btn].dirty = true; + pd_config.button_state[btn].pressed = false; } void pd_clear_all_buttons(void) { for (uint8_t i = 0; i < 8; i++) { - pd_config.button_state[i].set = true; - pd_config.button_state[i].state = false; + pd_config.button_state[i].dirty = true; + pd_config.button_state[i].pressed = false; } }