mirror of
https://github.com/qmk/qmk_firmware.git
synced 2024-11-22 03:19:24 +00:00
update button state names to be clearer
This commit is contained in:
parent
4bc3014fa6
commit
d77f6dd6f3
@ -6,8 +6,8 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
bool state;
|
bool pressed;
|
||||||
bool set;
|
bool dirty;
|
||||||
} pd_button_state_t;
|
} pd_button_state_t;
|
||||||
|
|
||||||
typedef struct {
|
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) {
|
report_mouse_t pointing_device_driver_get_report(report_mouse_t mouse_report) {
|
||||||
for (uint8_t i = 0; i < 8; i++) {
|
for (uint8_t i = 0; i < 8; i++) {
|
||||||
if (pd_config.button_state[i].set) {
|
if (pd_config.button_state[i].dirty) {
|
||||||
pd_config.button_state[i].set = false;
|
pd_config.button_state[i].dirty = false;
|
||||||
if (pd_config.button_state[i].state) {
|
if (pd_config.button_state[i].pressed) {
|
||||||
mouse_report.buttons |= 1 << (i);
|
mouse_report.buttons |= 1 << (i);
|
||||||
} else {
|
} else {
|
||||||
mouse_report.buttons &= ~(1 << (i));
|
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) {
|
void pd_press_button(uint8_t btn) {
|
||||||
pd_config.button_state[btn].set = true;
|
pd_config.button_state[btn].dirty = true;
|
||||||
pd_config.button_state[btn].state = true;
|
pd_config.button_state[btn].pressed = true;
|
||||||
}
|
}
|
||||||
void pd_release_button(uint8_t btn) {
|
void pd_release_button(uint8_t btn) {
|
||||||
pd_config.button_state[btn].set = true;
|
pd_config.button_state[btn].dirty = true;
|
||||||
pd_config.button_state[btn].state = false;
|
pd_config.button_state[btn].pressed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void pd_clear_all_buttons(void) {
|
void pd_clear_all_buttons(void) {
|
||||||
for (uint8_t i = 0; i < 8; i++) {
|
for (uint8_t i = 0; i < 8; i++) {
|
||||||
pd_config.button_state[i].set = true;
|
pd_config.button_state[i].dirty = true;
|
||||||
pd_config.button_state[i].state = false;
|
pd_config.button_state[i].pressed = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user