Skip to content

Commit

Permalink
use set/get_auto_mouse_enable directly
Browse files Browse the repository at this point in the history
  • Loading branch information
koron committed Mar 23, 2024
1 parent 68b1dfb commit 724e199
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
13 changes: 4 additions & 9 deletions qmk_firmware/keyboards/keyball/lib/keyball/keyball.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ keyball_t keyball = {
.pressing_keys = {' ', ' ', ' ', 0},

#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE
.aml_enabled = 0,
.aml_timeout = 0,
#endif
};
Expand Down Expand Up @@ -468,7 +467,7 @@ void keyball_oled_render_amlinfo(void) {
// AML:o 5
//
oled_write_P(PSTR("AML:"), false);
oled_write_char((keyball.aml_enabled ? 'o' : 'x'), false);
oled_write_char((get_auto_mouse_enable() ? 'o' : 'x'), false);
oled_write_char(' ', false);
oled_write(format_4d(keyball.aml_timeout), false);
oled_write_P(PSTR(" "), false);
Expand Down Expand Up @@ -514,10 +513,6 @@ void keyball_set_cpi(uint8_t cpi) {
}

#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE
void keyball_set_aml_enabled(bool enabled) {
keyball.aml_enabled = enabled;
set_auto_mouse_enable(enabled);
}

// This method returns current timeout value.
// It will return 1 to 15.
Expand Down Expand Up @@ -567,7 +562,7 @@ void keyboard_post_init_kb(void) {
keyball_set_cpi(c.cpi);
keyball_set_scroll_div(c.sdiv);
#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE
keyball_set_aml_enabled(c.amle);
set_auto_mouse_enable(c.amle);
keyball_set_aml_timeout(c.amlto);
#endif
}
Expand Down Expand Up @@ -653,7 +648,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
.cpi = keyball.cpi_value,
.sdiv = keyball.scroll_div,
#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE
.amle = keyball.aml_enabled,
.amle = get_auto_mouse_enable(),
.amlto = keyball.aml_timeout,
#endif
};
Expand Down Expand Up @@ -685,7 +680,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {

#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE
case AML_TO:
keyball_set_aml_enabled(!keyball.aml_enabled);
set_auto_mouse_enable(!get_auto_mouse_enable());
break;
case AML_I50:
add_aml_timeout(1);
Expand Down
5 changes: 0 additions & 5 deletions qmk_firmware/keyboards/keyball/lib/keyball/keyball.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ typedef struct {
int8_t scroll_snap_tension_h;

#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE
bool aml_enabled;
uint8_t aml_timeout;
#endif

Expand Down Expand Up @@ -211,10 +210,6 @@ uint8_t keyball_get_cpi(void);
void keyball_set_cpi(uint8_t cpi);

#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE
// This function is used to enable or disable the automatic mouse layer (AML).
// When it is enabled (true), the mouse layer will be activated automatically based on a set timeout.
// When it is disabled (false), the user will need to manually activate the mouse layer.
void keyball_set_aml_enabled(bool enabled);

// This function is used to get the current timeout value for the automatic mouse layer (AML).
// The returned value is the number of milliseconds the system will wait before automatically activating the mouse layer.
Expand Down

0 comments on commit 724e199

Please sign in to comment.