Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
koron committed Mar 21, 2024
1 parent 38efc58 commit 6e58d0c
Show file tree
Hide file tree
Showing 23 changed files with 175 additions and 14 deletions.
2 changes: 2 additions & 0 deletions keyboards/keyball/keyball39/keymaps/default/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#endif

#define TAP_CODE_DELAY 5

#define POINTING_DEVICE_AUTO_MOUSE_ENABLE
2 changes: 1 addition & 1 deletion keyboards/keyball/keyball39/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),

[3] = LAYOUT_universal(
RGB_TOG , _______ , _______ , _______ , _______ , RGB_M_P , RGB_M_B , RGB_M_R , RGB_M_SW , RGB_M_SN ,
RGB_TOG , AML_TO , AML_I50 , AML_D50 , _______ , RGB_M_P , RGB_M_B , RGB_M_R , RGB_M_SW , RGB_M_SN ,
RGB_MOD , RGB_HUI , RGB_SAI , RGB_VAI , SCRL_DVI , RGB_M_K , RGB_M_X , RGB_M_G , RGB_M_T , RGB_M_TW ,
RGB_RMOD , RGB_HUD , RGB_SAD , RGB_VAD , SCRL_DVD , CPI_D1K , CPI_D100 , CPI_I100 , CPI_I1K , KBC_SAVE ,
QK_BOOT , KBC_RST , _______ , _______ , _______ , _______ , _______ , _______ , _______ , _______ , KBC_RST , QK_BOOT
Expand Down
2 changes: 2 additions & 0 deletions keyboards/keyball/keyball39/keymaps/via/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#endif

#define TAP_CODE_DELAY 5

#define POINTING_DEVICE_AUTO_MOUSE_ENABLE
2 changes: 1 addition & 1 deletion keyboards/keyball/keyball39/keymaps/via/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),

[3] = LAYOUT_universal(
RGB_TOG , _______ , _______ , _______ , _______ , RGB_M_P , RGB_M_B , RGB_M_R , RGB_M_SW , RGB_M_SN ,
RGB_TOG , AML_TO , AML_I50 , AML_D50 , _______ , RGB_M_P , RGB_M_B , RGB_M_R , RGB_M_SW , RGB_M_SN ,
RGB_MOD , RGB_HUI , RGB_SAI , RGB_VAI , SCRL_DVI , RGB_M_K , RGB_M_X , RGB_M_G , RGB_M_T , RGB_M_TW ,
RGB_RMOD , RGB_HUD , RGB_SAD , RGB_VAD , SCRL_DVD , CPI_D1K , CPI_D100 , CPI_I100 , CPI_I1K , KBC_SAVE ,
QK_BOOT , KBC_RST , _______ , _______ , _______ , _______ , _______ , _______ , _______ , _______ , KBC_RST , QK_BOOT
Expand Down
2 changes: 2 additions & 0 deletions keyboards/keyball/keyball44/keymaps/default/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#endif

#define TAP_CODE_DELAY 5

#define POINTING_DEVICE_AUTO_MOUSE_ENABLE
2 changes: 1 addition & 1 deletion keyboards/keyball/keyball44/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),

[3] = LAYOUT_universal(
RGB_TOG , _______ , _______ , _______ , _______ , _______ , RGB_M_P , RGB_M_B , RGB_M_R , RGB_M_SW , RGB_M_SN , RGB_M_K ,
RGB_TOG , AML_TO , AML_I50 , AML_D50 , _______ , _______ , RGB_M_P , RGB_M_B , RGB_M_R , RGB_M_SW , RGB_M_SN , RGB_M_K ,
RGB_MOD , RGB_HUI , RGB_SAI , RGB_VAI , _______ , SCRL_DVI , RGB_M_X , RGB_M_G , RGB_M_T , RGB_M_TW , _______ , _______ ,
RGB_RMOD , RGB_HUD , RGB_SAD , RGB_VAD , _______ , SCRL_DVD , CPI_D1K , CPI_D100 , CPI_I100 , CPI_I1K , _______ , KBC_SAVE ,
QK_BOOT , KBC_RST , _______ , _______ , _______ , _______ , _______ , _______ , KBC_RST , QK_BOOT
Expand Down
2 changes: 2 additions & 0 deletions keyboards/keyball/keyball44/keymaps/via/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#endif

#define TAP_CODE_DELAY 5

#define POINTING_DEVICE_AUTO_MOUSE_ENABLE
2 changes: 1 addition & 1 deletion keyboards/keyball/keyball44/keymaps/via/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),

[3] = LAYOUT_universal(
RGB_TOG , _______ , _______ , _______ , _______ , _______ , RGB_M_P , RGB_M_B , RGB_M_R , RGB_M_SW , RGB_M_SN , RGB_M_K ,
RGB_TOG , AML_TO , AML_I50 , AML_D50 , _______ , _______ , RGB_M_P , RGB_M_B , RGB_M_R , RGB_M_SW , RGB_M_SN , RGB_M_K ,
RGB_MOD , RGB_HUI , RGB_SAI , RGB_VAI , _______ , SCRL_DVI , RGB_M_X , RGB_M_G , RGB_M_T , RGB_M_TW , _______ , _______ ,
RGB_RMOD , RGB_HUD , RGB_SAD , RGB_VAD , _______ , SCRL_DVD , CPI_D1K , CPI_D100 , CPI_I100 , CPI_I1K , _______ , KBC_SAVE ,
QK_BOOT , KBC_RST , _______ , _______ , _______ , _______ , _______ , _______ , KBC_RST , QK_BOOT
Expand Down
2 changes: 2 additions & 0 deletions keyboards/keyball/keyball46/keymaps/default/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define PRODUCT_ID 0x0005

#define TAP_CODE_DELAY 5

#define POINTING_DEVICE_AUTO_MOUSE_ENABLE
2 changes: 1 addition & 1 deletion keyboards/keyball/keyball46/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

[_BALL] = LAYOUT_right_ball(
//,-----------------------------------------------------. ,-----------------------------------------------------.
RGB_TOG, _______, _______, _______, _______, _______, RGB_M_P, RGB_M_B, RGB_M_R,RGB_M_SW,RGB_M_SN, RGB_M_K,
RGB_TOG, AML_TO , AML_I50, AML_D50, _______, _______, RGB_M_P, RGB_M_B, RGB_M_R,RGB_M_SW,RGB_M_SN, RGB_M_K,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, _______, _______, RGB_M_X, RGB_M_G, RGB_M_T,RGB_M_TW, _______, _______,
//|--------+--------+--------+--------+--------+--------' |--------+--------+--------+--------+--------+--------|
Expand Down
2 changes: 2 additions & 0 deletions keyboards/keyball/keyball46/keymaps/via/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#endif

#define TAP_CODE_DELAY 5

#define POINTING_DEVICE_AUTO_MOUSE_ENABLE
2 changes: 1 addition & 1 deletion keyboards/keyball/keyball46/keymaps/via/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

[_BALL] = LAYOUT_right_ball(
//,-----------------------------------------------------. ,-----------------------------------------------------.
RGB_TOG, _______, _______, _______, _______, _______, RGB_M_P, RGB_M_B, RGB_M_R,RGB_M_SW,RGB_M_SN, RGB_M_K,
RGB_TOG, AML_TO , AML_I50, AML_D50, _______, _______, RGB_M_P, RGB_M_B, RGB_M_R,RGB_M_SW,RGB_M_SN, RGB_M_K,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, _______, _______, RGB_M_X, RGB_M_G, RGB_M_T,RGB_M_TW, _______, _______,
//|--------+--------+--------+--------+--------+--------' |--------+--------+--------+--------+--------+--------|
Expand Down
2 changes: 2 additions & 0 deletions keyboards/keyball/keyball46/keymaps/via_Both/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define PRODUCT_ID 0x0003

#define TAP_CODE_DELAY 5

#define POINTING_DEVICE_AUTO_MOUSE_ENABLE
2 changes: 1 addition & 1 deletion keyboards/keyball/keyball46/keymaps/via_Both/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

[_BALL] = LAYOUT_double_balls(
//,-----------------------------------------------------. ,-----------------------------------------------------.
RGB_TOG, _______, _______, _______, _______, _______, RGB_M_P, RGB_M_B, RGB_M_R,RGB_M_SW,RGB_M_SN, RGB_M_K,
RGB_TOG, AML_TO , AML_I50, AML_D50, _______, _______, RGB_M_P, RGB_M_B, RGB_M_R,RGB_M_SW,RGB_M_SN, RGB_M_K,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, _______, _______, RGB_M_X, RGB_M_G, RGB_M_T,RGB_M_TW, _______, _______,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
Expand Down
2 changes: 2 additions & 0 deletions keyboards/keyball/keyball46/keymaps/via_Left/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define PRODUCT_ID 0x0002

#define TAP_CODE_DELAY 5

#define POINTING_DEVICE_AUTO_MOUSE_ENABLE
2 changes: 1 addition & 1 deletion keyboards/keyball/keyball46/keymaps/via_Left/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

[_BALL] = LAYOUT_left_ball(
//,-----------------------------------------------------. ,-----------------------------------------------------.
RGB_TOG, _______, _______, _______, _______, _______, RGB_M_P, RGB_M_B, RGB_M_R,RGB_M_SW,RGB_M_SN, RGB_M_K,
RGB_TOG, AML_TO , AML_I50, AML_D50, _______, _______, RGB_M_P, RGB_M_B, RGB_M_R,RGB_M_SW,RGB_M_SN, RGB_M_K,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, _______, _______, RGB_M_X, RGB_M_G, RGB_M_T,RGB_M_TW, _______, _______,
//|--------+--------+--------+--------+--------+--------| `--------+--------+--------+--------+--------+--------|
Expand Down
2 changes: 2 additions & 0 deletions keyboards/keyball/keyball61/keymaps/default/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#endif

#define TAP_CODE_DELAY 5

#define POINTING_DEVICE_AUTO_MOUSE_ENABLE
2 changes: 1 addition & 1 deletion keyboards/keyball/keyball61/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),

[3] = LAYOUT_universal(
RGB_TOG , _______ , _______ , _______ , _______ , _______ , RGB_M_P , RGB_M_B , RGB_M_R , RGB_M_SW , RGB_M_SN , RGB_M_K ,
RGB_TOG , AML_TO , AML_I50 , AML_D50 , _______ , _______ , RGB_M_P , RGB_M_B , RGB_M_R , RGB_M_SW , RGB_M_SN , RGB_M_K ,
RGB_MOD , RGB_HUI , RGB_SAI , RGB_VAI , _______ , _______ , RGB_M_X , RGB_M_G , RGB_M_T , RGB_M_TW , _______ , _______ ,
RGB_RMOD , RGB_HUD , RGB_SAD , RGB_VAD , _______ , _______ , CPI_D1K , CPI_D100 , CPI_I100 , CPI_I1K , KBC_SAVE , KBC_RST ,
_______ , _______ , SCRL_DVD , SCRL_DVI , SCRL_MO , SCRL_TO , EE_CLR , EE_CLR , KC_HOME , KC_PGDN , KC_PGUP , KC_END , _______ , _______ ,
Expand Down
4 changes: 3 additions & 1 deletion keyboards/keyball/keyball61/keymaps/via/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
# define RGBLIGHT_EFFECT_RAINBOW_MOOD
# define RGBLIGHT_EFFECT_RAINBOW_SWIRL
//# define RGBLIGHT_EFFECT_SNAKE
# define RGBLIGHT_EFFECT_KNIGHT
//# define RGBLIGHT_EFFECT_KNIGHT
//# define RGBLIGHT_EFFECT_CHRISTMAS
# define RGBLIGHT_EFFECT_STATIC_GRADIENT
//# define RGBLIGHT_EFFECT_RGB_TEST
Expand All @@ -34,3 +34,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#endif

#define TAP_CODE_DELAY 5

#define POINTING_DEVICE_AUTO_MOUSE_ENABLE
2 changes: 1 addition & 1 deletion keyboards/keyball/keyball61/keymaps/via/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),

[3] = LAYOUT_universal(
RGB_TOG , _______ , _______ , _______ , _______ , _______ , RGB_M_P , RGB_M_B , RGB_M_R , RGB_M_SW , RGB_M_SN , RGB_M_K ,
RGB_TOG , AML_TO , AML_I50 , AML_D50 , _______ , _______ , RGB_M_P , RGB_M_B , RGB_M_R , RGB_M_SW , RGB_M_SN , RGB_M_K ,
RGB_MOD , RGB_HUI , RGB_SAI , RGB_VAI , _______ , _______ , RGB_M_X , RGB_M_G , RGB_M_T , RGB_M_TW , _______ , _______ ,
RGB_RMOD , RGB_HUD , RGB_SAD , RGB_VAD , _______ , _______ , CPI_D1K , CPI_D100 , CPI_I100 , CPI_I1K , KBC_SAVE , KBC_RST ,
_______ , _______ , SCRL_DVD , SCRL_DVI , SCRL_MO , SCRL_TO , EE_CLR , EE_CLR , KC_HOME , KC_PGDN , KC_PGUP , KC_END , _______ , _______ ,
Expand Down
100 changes: 98 additions & 2 deletions keyboards/keyball/lib/keyball/keyball.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
const uint8_t CPI_DEFAULT = KEYBALL_CPI_DEFAULT / 100;
const uint8_t CPI_MAX = pmw3360_MAXCPI + 1;
const uint8_t SCROLL_DIV_MAX = 7;
#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE
const uint16_t AML_TIMEOUT_DEFAULT = 9;
const uint16_t AML_TIMEOUT_MAX = 15;
#endif

keyball_t keyball = {
.this_have_ball = false,
Expand All @@ -44,6 +48,11 @@ keyball_t keyball = {
.scroll_div = 0,

.pressing_keys = {' ', ' ', ' ', 0},

#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE
.aml_enabled = 0,
.aml_timeout = 0,
#endif
};

//////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -122,6 +131,15 @@ static void add_scroll_div(int8_t delta) {
keyball_set_scroll_div(v < 1 ? 1 : v);
}


#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE
static void add_aml_timeout(int8_t delta) {
int8_t v = keyball_get_aml_timeout() + delta;
keyball_set_aml_timeout(v < 1 ? 1 : v);
}
#endif


//////////////////////////////////////////////////////////////////////////////
// Pointing device driver

Expand All @@ -147,6 +165,11 @@ void pointing_device_driver_init(void) {
# endif
#endif
pmw3360_cpi_set(CPI_DEFAULT - 1);
pmw3360_reg_write(pmw3360_Motion_Burst, 0);

#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE
set_auto_mouse_layer(1);
#endif
}
}

Expand Down Expand Up @@ -441,6 +464,24 @@ void keyball_oled_render_layerinfo(void) {
#endif
}

#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE
void keyball_oled_render_amlinfo(void) {
#ifdef OLED_ENABLE
// Format: `AML:{AML state} {AML timeout}`
//
// Output example:
//
// AML:o 5
//
oled_write_P(PSTR("AML:"), false);
oled_write_char((keyball.aml_enabled ? 'o' : 'x'), false);
oled_write_char(' ', false);
oled_write(format_4d(keyball.aml_timeout), false);
oled_write_P(PSTR(" "), false);
#endif
}
#endif

//////////////////////////////////////////////////////////////////////////////
// Public API functions

Expand Down Expand Up @@ -478,6 +519,41 @@ 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.
//
// 1=( 1-1)*50+250=250ms
// 2=( 2-1)*50+250=300ms
// ...
// 9=( 9-1)*50+250=650ms
// 10=(10-1)*50+250=700ms
// 11=(11-1)*50+250=750ms
// 12=(12-1)*50+250=800ms
// 13=(13-1)*50+250=850ms
// 14=(14-1)*50+250=900ms
// 15=(15-1)*50+250=950ms
uint8_t keyball_get_aml_timeout(void) {
return keyball.aml_timeout == 0 ? AML_TIMEOUT_DEFAULT : keyball.aml_timeout;
}

void keyball_set_aml_timeout(uint8_t timeout) {
if (timeout > AML_TIMEOUT_MAX) {
timeout = AML_TIMEOUT_MAX;
}
keyball.aml_timeout = timeout;
if (timeout == 0) {
timeout = AML_TIMEOUT_DEFAULT;
}
set_auto_mouse_timeout((timeout-1)*50+250);
}
#endif

//////////////////////////////////////////////////////////////////////////////
// Keyboard hooks

Expand All @@ -496,6 +572,10 @@ void keyboard_post_init_kb(void) {
keyball_config_t c = {.raw = eeconfig_read_kb()};
keyball_set_cpi(c.cpi);
keyball_set_scroll_div(c.sdiv);
#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE
keyball_set_aml_enabled(c.amle);
keyball_set_aml_timeout(c.amlto);
#endif
}

keyball_on_adjust_layout(KEYBALL_ADJUST_PENDING);
Expand Down Expand Up @@ -576,8 +656,12 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
break;
case KBC_SAVE: {
keyball_config_t c = {
.cpi = keyball.cpi_value,
.sdiv = keyball.scroll_div,
.cpi = keyball.cpi_value,
.sdiv = keyball.scroll_div,
#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE
.amle = keyball.aml_enabled,
.amlto = keyball.aml_timeout,
#endif
};
eeconfig_update_kb(c.raw);
} break;
Expand Down Expand Up @@ -605,6 +689,18 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
add_scroll_div(-1);
break;

#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE
case AML_TO:
keyball_set_aml_enabled(!keyball.aml_enabled);
break;
case AML_I50:
add_aml_timeout(1);
break;
case AML_D50:
add_aml_timeout(-1);
break;
#endif

default:
return true;
}
Expand Down
40 changes: 39 additions & 1 deletion keyboards/keyball/lib/keyball/keyball.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ enum keyball_keycodes {
SCRL_DVI = QK_KB_8, // Increment scroll divider
SCRL_DVD = QK_KB_9, // Decrement scroll divider

#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE
AML_TO = QK_KB_10, // Toggle automatic mouse layer
AML_I50 = QK_KB_11, // Increment automatic mouse layer timeout
AML_D50 = QK_KB_12, // Decrement automatic mouse layer timeout
#endif

// User customizable 32 keycodes.
KEYBALL_SAFE_RANGE = QK_USER_0,
};
Expand All @@ -103,7 +109,11 @@ typedef union {
uint32_t raw;
struct {
uint8_t cpi : 7;
uint8_t sdiv : 3; // scroll divider
uint8_t sdiv : 3; // scroll divider
#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE
uint8_t amle : 1; // automatic mouse layer enabled
uint8_t amlto : 4; // automatic mouse layer timeout
#endif
};
} keyball_config_t;

Expand Down Expand Up @@ -136,6 +146,11 @@ typedef struct {
uint32_t scroll_snap_last;
int8_t scroll_snap_tension_h;

#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE
bool aml_enabled;
uint8_t aml_timeout;
#endif

uint16_t last_kc;
keypos_t last_pos;
report_mouse_t last_mouse;
Expand Down Expand Up @@ -171,6 +186,12 @@ void keyball_oled_render_keyinfo(void);
/// inactive layers.
void keyball_oled_render_layerinfo(void);

#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE
/// keyball_oled_render_amlinfo renders automatic mouse layer information to
/// OLED.
void keyball_oled_render_amlinfo(void);
#endif

/// keyball_get_scroll_mode gets current scroll mode.
bool keyball_get_scroll_mode(void);

Expand All @@ -188,3 +209,20 @@ uint8_t keyball_get_cpi(void);

// TODO: document
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.
// The return value is a number between 0 and 15, which corresponds to a range between 250ms and 950ms in intervals of 50ms.
uint8_t keyball_get_aml_timeout(void);

// This function is used to set the automatic mouse layer (AML) timeout value.
// The argument is a number between 0 and 15, which corresponds to a range between 250ms and 950ms in intervals of 50ms.
// This value sets how long (in milliseconds) the system should wait before automatically activating the mouse layer when a key is pressed.
void keyball_set_aml_timeout(uint8_t timeout);
#endif
Loading

0 comments on commit 6e58d0c

Please sign in to comment.