瀏覽代碼

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

Nick Brassel 4 年之前
父節點
當前提交
d65db68f9f
共有 7 個文件被更改,包括 30 次插入2 次删除
  1. 2 0
      common_features.mk
  2. 1 0
      docs/feature_rgblight.md
  3. 2 0
      docs/newbs_getting_started.md
  4. 11 0
      quantum/rgblight.c
  5. 3 0
      quantum/rgblight.h
  6. 9 2
      tmk_core/common/keyboard.c
  7. 2 0
      tmk_core/common/keyboard.h

+ 2 - 0
common_features.mk

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

+ 1 - 0
docs/feature_rgblight.md

@@ -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_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_reload_from_eeprom()`             |Reload the effect configuration (enabled, mode and color) from EEPROM |
 
 #### effects mode disable/enable
 |Function                                    |Description  |

+ 2 - 0
docs/newbs_getting_started.md

@@ -168,6 +168,8 @@ Once that completes, re-run `qmk setup` to complete the setup and checks.
 
 <!-- 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.
 
 ## 4. Test Your Build Environment

+ 11 - 0
quantum/rgblight.c

@@ -237,6 +237,17 @@ void rgblight_init(void) {
     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; }
 
 void rgblight_update_dword(uint32_t dword) {

+ 3 - 0
quantum/rgblight.h

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

+ 9 - 2
tmk_core/common/keyboard.c

@@ -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(); }
 
 // 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_scan_count = 0;
+static uint32_t last_matrix_scan_count = 0;
 
 void matrix_scan_perf_task(void) {
     matrix_scan_count++;
 
     uint32_t timer_now = timer_read32();
     if (TIMER_DIFF_32(timer_now, matrix_timer) > 1000) {
+#    if defined(CONSOLE_ENABLE)
         dprintf("matrix scan frequency: %d\n", matrix_scan_count);
-
+#    endif
+        last_matrix_scan_count = matrix_scan_count;
         matrix_timer      = timer_now;
         matrix_scan_count = 0;
     }
 }
+
+uint32_t get_matrix_scan_rate(void) {
+    return last_matrix_scan_count;
+}
 #else
 #    define matrix_scan_perf_task()
 #endif

+ 2 - 0
tmk_core/common/keyboard.h

@@ -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_elapsed(void);  // Number of milliseconds since the last encoder activity
 
+uint32_t get_matrix_scan_rate(void);
+
 #ifdef __cplusplus
 }
 #endif