Merge remote-tracking branch 'upstream/master' into develop

This commit is contained in:
Nick Brassel 2021-01-28 10:52:59 +11:00
commit d65db68f9f
7 changed files with 30 additions and 2 deletions

View File

@ -24,6 +24,8 @@ QUANTUM_SRC += \
ifeq ($(strip $(DEBUG_MATRIX_SCAN_RATE_ENABLE)), yes) ifeq ($(strip $(DEBUG_MATRIX_SCAN_RATE_ENABLE)), yes)
OPT_DEFS += -DDEBUG_MATRIX_SCAN_RATE OPT_DEFS += -DDEBUG_MATRIX_SCAN_RATE
CONSOLE_ENABLE = yes CONSOLE_ENABLE = yes
else ifeq ($(strip $(DEBUG_MATRIX_SCAN_RATE_ENABLE)), api)
OPT_DEFS += -DDEBUG_MATRIX_SCAN_RATE
endif endif
ifeq ($(strip $(API_SYSEX_ENABLE)), yes) ifeq ($(strip $(API_SYSEX_ENABLE)), yes)

View File

@ -370,6 +370,7 @@ rgblight_sethsv(HSV_GREEN, 2); // led 2
|`rgblight_step_noeeprom()` |Change the mode to the next RGB animation in the list of enabled RGB animations (not written to EEPROM) | |`rgblight_step_noeeprom()` |Change the mode to the next RGB animation in the list of enabled RGB animations (not written to EEPROM) |
|`rgblight_step_reverse()` |Change the mode to the previous RGB animation in the list of enabled RGB animations | |`rgblight_step_reverse()` |Change the mode to the previous RGB animation in the list of enabled RGB animations |
|`rgblight_step_reverse_noeeprom()` |Change the mode to the previous RGB animation in the list of enabled RGB animations (not written to EEPROM) | |`rgblight_step_reverse_noeeprom()` |Change the mode to the previous RGB animation in the list of enabled RGB animations (not written to EEPROM) |
|`rgblight_reload_from_eeprom()` |Reload the effect configuration (enabled, mode and color) from EEPROM |
#### effects mode disable/enable #### effects mode disable/enable
|Function |Description | |Function |Description |

View File

@ -168,6 +168,8 @@ Once that completes, re-run `qmk setup` to complete the setup and checks.
<!-- tabs:end --> <!-- tabs:end -->
?> The qmk home folder can be specified at setup with `qmk setup -H <path>`, and modified afterwards using the [cli configuration](cli_configuration.md?id=single-key-example) and the variable `user.qmk_home`. For all available options run `qmk setup --help`.
?> If you already know [how to use GitHub](getting_started_github.md), we recommend that you create your own fork and use `qmk setup <github_username>/qmk_firmware` to clone your personal fork. If you don't know what that means you can safely ignore this message. ?> If you already know [how to use GitHub](getting_started_github.md), we recommend that you create your own fork and use `qmk setup <github_username>/qmk_firmware` to clone your personal fork. If you don't know what that means you can safely ignore this message.
## 4. Test Your Build Environment ## 4. Test Your Build Environment

View File

@ -237,6 +237,17 @@ void rgblight_init(void) {
is_rgblight_initialized = true; is_rgblight_initialized = true;
} }
void rgblight_reload_from_eeprom(void) {
/* Reset back to what we have in eeprom */
rgblight_config.raw = eeconfig_read_rgblight();
RGBLIGHT_SPLIT_SET_CHANGE_MODEHSVS;
rgblight_check_config();
eeconfig_debug_rgblight(); // display current eeprom values
if (rgblight_config.enable) {
rgblight_mode_noeeprom(rgblight_config.mode);
}
}
uint32_t rgblight_read_dword(void) { return rgblight_config.raw; } uint32_t rgblight_read_dword(void) { return rgblight_config.raw; }
void rgblight_update_dword(uint32_t dword) { void rgblight_update_dword(uint32_t dword) {

View File

@ -347,6 +347,9 @@ uint8_t rgblight_get_speed(void);
void rgblight_set_speed(uint8_t speed); void rgblight_set_speed(uint8_t speed);
void rgblight_set_speed_noeeprom(uint8_t speed); void rgblight_set_speed_noeeprom(uint8_t speed);
/* reset */
void rgblight_reload_from_eeprom(void);
/* query */ /* query */
uint8_t rgblight_get_mode(void); uint8_t rgblight_get_mode(void);
uint8_t rgblight_get_hue(void); uint8_t rgblight_get_hue(void);

View File

@ -112,21 +112,28 @@ uint32_t last_encoder_activity_elapsed(void) { return timer_elapsed32(las
void last_encoder_activity_trigger(void) { last_encoder_modification_time = last_input_modification_time = timer_read32(); } void last_encoder_activity_trigger(void) { last_encoder_modification_time = last_input_modification_time = timer_read32(); }
// Only enable this if console is enabled to print to // Only enable this if console is enabled to print to
#if defined(DEBUG_MATRIX_SCAN_RATE) && defined(CONSOLE_ENABLE) #if defined(DEBUG_MATRIX_SCAN_RATE)
static uint32_t matrix_timer = 0; static uint32_t matrix_timer = 0;
static uint32_t matrix_scan_count = 0; static uint32_t matrix_scan_count = 0;
static uint32_t last_matrix_scan_count = 0;
void matrix_scan_perf_task(void) { void matrix_scan_perf_task(void) {
matrix_scan_count++; matrix_scan_count++;
uint32_t timer_now = timer_read32(); uint32_t timer_now = timer_read32();
if (TIMER_DIFF_32(timer_now, matrix_timer) > 1000) { if (TIMER_DIFF_32(timer_now, matrix_timer) > 1000) {
# if defined(CONSOLE_ENABLE)
dprintf("matrix scan frequency: %d\n", matrix_scan_count); dprintf("matrix scan frequency: %d\n", matrix_scan_count);
# endif
last_matrix_scan_count = matrix_scan_count;
matrix_timer = timer_now; matrix_timer = timer_now;
matrix_scan_count = 0; matrix_scan_count = 0;
} }
} }
uint32_t get_matrix_scan_rate(void) {
return last_matrix_scan_count;
}
#else #else
# define matrix_scan_perf_task() # define matrix_scan_perf_task()
#endif #endif

View File

@ -82,6 +82,8 @@ uint32_t last_matrix_activity_elapsed(void); // Number of milliseconds since th
uint32_t last_encoder_activity_time(void); // Timestamp of the last encoder activity uint32_t last_encoder_activity_time(void); // Timestamp of the last encoder activity
uint32_t last_encoder_activity_elapsed(void); // Number of milliseconds since the last encoder activity uint32_t last_encoder_activity_elapsed(void); // Number of milliseconds since the last encoder activity
uint32_t get_matrix_scan_rate(void);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif