Add last activity functions for pointing device (#20079)
This commit is contained in:
parent
8686c527f7
commit
297779385f
6 changed files with 61 additions and 40 deletions
|
@ -139,10 +139,22 @@ void last_encoder_activity_trigger(void) {
|
|||
last_encoder_modification_time = last_input_modification_time = sync_timer_read32();
|
||||
}
|
||||
|
||||
void set_activity_timestamps(uint32_t matrix_timestamp, uint32_t encoder_timestamp) {
|
||||
last_matrix_modification_time = matrix_timestamp;
|
||||
last_encoder_modification_time = encoder_timestamp;
|
||||
last_input_modification_time = MAX(matrix_timestamp, encoder_timestamp);
|
||||
static uint32_t last_pointing_device_modification_time = 0;
|
||||
uint32_t last_pointing_device_activity_time(void) {
|
||||
return last_pointing_device_modification_time;
|
||||
}
|
||||
uint32_t last_pointing_device_activity_elapsed(void) {
|
||||
return sync_timer_elapsed32(last_pointing_device_modification_time);
|
||||
}
|
||||
void last_pointing_device_activity_trigger(void) {
|
||||
last_pointing_device_modification_time = last_input_modification_time = sync_timer_read32();
|
||||
}
|
||||
|
||||
void set_activity_timestamps(uint32_t matrix_timestamp, uint32_t encoder_timestamp, uint32_t pointing_device_timestamp) {
|
||||
last_matrix_modification_time = matrix_timestamp;
|
||||
last_encoder_modification_time = encoder_timestamp;
|
||||
last_pointing_device_modification_time = pointing_device_timestamp;
|
||||
last_input_modification_time = MAX(matrix_timestamp, MAX(encoder_timestamp, pointing_device_timestamp));
|
||||
}
|
||||
|
||||
// Only enable this if console is enabled to print to
|
||||
|
@ -598,9 +610,10 @@ void quantum_task(void) {
|
|||
|
||||
/** \brief Main task that is repeatedly called as fast as possible. */
|
||||
void keyboard_task(void) {
|
||||
const bool matrix_changed = matrix_task();
|
||||
if (matrix_changed) {
|
||||
__attribute__((unused)) bool activity_has_occurred = false;
|
||||
if (matrix_task()) {
|
||||
last_matrix_activity_trigger();
|
||||
activity_has_occurred = true;
|
||||
}
|
||||
|
||||
quantum_task();
|
||||
|
@ -627,9 +640,16 @@ void keyboard_task(void) {
|
|||
#endif
|
||||
|
||||
#ifdef ENCODER_ENABLE
|
||||
const bool encoders_changed = encoder_read();
|
||||
if (encoders_changed) {
|
||||
if (encoder_read()) {
|
||||
last_encoder_activity_trigger();
|
||||
activity_has_occurred = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef POINTING_DEVICE_ENABLE
|
||||
if (pointing_device_task()) {
|
||||
last_pointing_device_activity_trigger();
|
||||
activity_has_occurred = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -637,11 +657,7 @@ void keyboard_task(void) {
|
|||
oled_task();
|
||||
# if OLED_TIMEOUT > 0
|
||||
// Wake up oled if user is using those fabulous keys or spinning those encoders!
|
||||
# ifdef ENCODER_ENABLE
|
||||
if (matrix_changed || encoders_changed) oled_on();
|
||||
# else
|
||||
if (matrix_changed) oled_on();
|
||||
# endif
|
||||
if (activity_has_occurred) oled_on();
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
@ -649,11 +665,7 @@ void keyboard_task(void) {
|
|||
st7565_task();
|
||||
# if ST7565_TIMEOUT > 0
|
||||
// Wake up display if user is using those fabulous keys or spinning those encoders!
|
||||
# ifdef ENCODER_ENABLE
|
||||
if (matrix_changed || encoders_changed) st7565_on();
|
||||
# else
|
||||
if (matrix_changed) st7565_on();
|
||||
# endif
|
||||
if (activity_has_occurred) st7565_on();
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
@ -666,10 +678,6 @@ void keyboard_task(void) {
|
|||
ps2_mouse_task();
|
||||
#endif
|
||||
|
||||
#ifdef POINTING_DEVICE_ENABLE
|
||||
pointing_device_task();
|
||||
#endif
|
||||
|
||||
#ifdef MIDI_ENABLE
|
||||
midi_task();
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue