Relocate matrix_init_quantum content (#15953)
* Relocate matrix_init_quantum content * Update include order * Fix cherry pick from 15722
This commit is contained in:
parent
8101a836a4
commit
a8700404f7
4 changed files with 45 additions and 41 deletions
|
@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "keyboard.h"
|
#include "keyboard.h"
|
||||||
#include "matrix.h"
|
#include "matrix.h"
|
||||||
#include "keymap.h"
|
#include "keymap.h"
|
||||||
|
#include "magic.h"
|
||||||
#include "host.h"
|
#include "host.h"
|
||||||
#include "led.h"
|
#include "led.h"
|
||||||
#include "keycode.h"
|
#include "keycode.h"
|
||||||
|
@ -101,6 +102,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#ifdef SLEEP_LED_ENABLE
|
#ifdef SLEEP_LED_ENABLE
|
||||||
# include "sleep_led.h"
|
# include "sleep_led.h"
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef SPLIT_KEYBOARD
|
||||||
|
# include "split_util.h"
|
||||||
|
#endif
|
||||||
|
#ifdef BLUETOOTH_ENABLE
|
||||||
|
# include "outputselect.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
static uint32_t last_input_modification_time = 0;
|
static uint32_t last_input_modification_time = 0;
|
||||||
uint32_t last_input_activity_time(void) { return last_input_modification_time; }
|
uint32_t last_input_activity_time(void) { return last_input_modification_time; }
|
||||||
|
@ -291,6 +298,36 @@ void housekeeping_task(void) {
|
||||||
housekeeping_task_user();
|
housekeeping_task_user();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** \brief Init tasks previously located in matrix_init_quantum
|
||||||
|
*
|
||||||
|
* TODO: rationalise against keyboard_init and current split role
|
||||||
|
*/
|
||||||
|
void quantum_init(void) {
|
||||||
|
magic();
|
||||||
|
led_init_ports();
|
||||||
|
#ifdef BACKLIGHT_ENABLE
|
||||||
|
backlight_init_ports();
|
||||||
|
#endif
|
||||||
|
#ifdef AUDIO_ENABLE
|
||||||
|
audio_init();
|
||||||
|
#endif
|
||||||
|
#ifdef LED_MATRIX_ENABLE
|
||||||
|
led_matrix_init();
|
||||||
|
#endif
|
||||||
|
#ifdef RGB_MATRIX_ENABLE
|
||||||
|
rgb_matrix_init();
|
||||||
|
#endif
|
||||||
|
#if defined(UNICODE_COMMON_ENABLE)
|
||||||
|
unicode_input_mode_init();
|
||||||
|
#endif
|
||||||
|
#ifdef HAPTIC_ENABLE
|
||||||
|
haptic_init();
|
||||||
|
#endif
|
||||||
|
#if defined(BLUETOOTH_ENABLE) && defined(OUTPUT_AUTO_ENABLE)
|
||||||
|
set_output(OUTPUT_AUTO);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/** \brief keyboard_init
|
/** \brief keyboard_init
|
||||||
*
|
*
|
||||||
* FIXME: needs doc
|
* FIXME: needs doc
|
||||||
|
@ -300,8 +337,12 @@ void keyboard_init(void) {
|
||||||
sync_timer_init();
|
sync_timer_init();
|
||||||
#ifdef VIA_ENABLE
|
#ifdef VIA_ENABLE
|
||||||
via_init();
|
via_init();
|
||||||
|
#endif
|
||||||
|
#ifdef SPLIT_KEYBOARD
|
||||||
|
split_pre_init();
|
||||||
#endif
|
#endif
|
||||||
matrix_init();
|
matrix_init();
|
||||||
|
quantum_init();
|
||||||
#if defined(CRC_ENABLE)
|
#if defined(CRC_ENABLE)
|
||||||
crc_init();
|
crc_init();
|
||||||
#endif
|
#endif
|
||||||
|
@ -342,6 +383,9 @@ void keyboard_init(void) {
|
||||||
#ifdef VIRTSER_ENABLE
|
#ifdef VIRTSER_ENABLE
|
||||||
virtser_init();
|
virtser_init();
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef SPLIT_KEYBOARD
|
||||||
|
split_post_init();
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(DEBUG_MATRIX_SCAN_RATE) && defined(CONSOLE_ENABLE)
|
#if defined(DEBUG_MATRIX_SCAN_RATE) && defined(CONSOLE_ENABLE)
|
||||||
debug_enable = true;
|
debug_enable = true;
|
||||||
|
|
|
@ -252,8 +252,6 @@ __attribute__((weak)) void matrix_read_rows_on_col(matrix_row_t current_matrix[]
|
||||||
|
|
||||||
void matrix_init(void) {
|
void matrix_init(void) {
|
||||||
#ifdef SPLIT_KEYBOARD
|
#ifdef SPLIT_KEYBOARD
|
||||||
split_pre_init();
|
|
||||||
|
|
||||||
// Set pinout for right half if pinout for that half is defined
|
// Set pinout for right half if pinout for that half is defined
|
||||||
if (!isLeftHand) {
|
if (!isLeftHand) {
|
||||||
# ifdef DIRECT_PINS_RIGHT
|
# ifdef DIRECT_PINS_RIGHT
|
||||||
|
@ -292,10 +290,6 @@ void matrix_init(void) {
|
||||||
debounce_init(ROWS_PER_HAND);
|
debounce_init(ROWS_PER_HAND);
|
||||||
|
|
||||||
matrix_init_quantum();
|
matrix_init_quantum();
|
||||||
|
|
||||||
#ifdef SPLIT_KEYBOARD
|
|
||||||
split_post_init();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SPLIT_KEYBOARD
|
#ifdef SPLIT_KEYBOARD
|
||||||
|
|
|
@ -139,8 +139,6 @@ __attribute__((weak)) void matrix_slave_scan_user(void) {}
|
||||||
|
|
||||||
__attribute__((weak)) void matrix_init(void) {
|
__attribute__((weak)) void matrix_init(void) {
|
||||||
#ifdef SPLIT_KEYBOARD
|
#ifdef SPLIT_KEYBOARD
|
||||||
split_pre_init();
|
|
||||||
|
|
||||||
thisHand = isLeftHand ? 0 : (ROWS_PER_HAND);
|
thisHand = isLeftHand ? 0 : (ROWS_PER_HAND);
|
||||||
thatHand = ROWS_PER_HAND - thisHand;
|
thatHand = ROWS_PER_HAND - thisHand;
|
||||||
#endif
|
#endif
|
||||||
|
@ -156,10 +154,6 @@ __attribute__((weak)) void matrix_init(void) {
|
||||||
debounce_init(ROWS_PER_HAND);
|
debounce_init(ROWS_PER_HAND);
|
||||||
|
|
||||||
matrix_init_quantum();
|
matrix_init_quantum();
|
||||||
|
|
||||||
#ifdef SPLIT_KEYBOARD
|
|
||||||
split_post_init();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__((weak)) uint8_t matrix_scan(void) {
|
__attribute__((weak)) uint8_t matrix_scan(void) {
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "quantum.h"
|
#include "quantum.h"
|
||||||
#include "magic.h"
|
|
||||||
|
|
||||||
#ifdef BLUETOOTH_ENABLE
|
#ifdef BLUETOOTH_ENABLE
|
||||||
# include "outputselect.h"
|
# include "outputselect.h"
|
||||||
|
@ -368,35 +367,8 @@ layer_state_t update_tri_layer_state(layer_state_t state, uint8_t layer1, uint8_
|
||||||
|
|
||||||
void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3) { layer_state_set(update_tri_layer_state(layer_state, layer1, layer2, layer3)); }
|
void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3) { layer_state_set(update_tri_layer_state(layer_state, layer1, layer2, layer3)); }
|
||||||
|
|
||||||
void matrix_init_quantum() {
|
|
||||||
magic();
|
|
||||||
led_init_ports();
|
|
||||||
#ifdef BACKLIGHT_ENABLE
|
|
||||||
backlight_init_ports();
|
|
||||||
#endif
|
|
||||||
#ifdef AUDIO_ENABLE
|
|
||||||
audio_init();
|
|
||||||
#endif
|
|
||||||
#ifdef LED_MATRIX_ENABLE
|
|
||||||
led_matrix_init();
|
|
||||||
#endif
|
|
||||||
#ifdef RGB_MATRIX_ENABLE
|
|
||||||
rgb_matrix_init();
|
|
||||||
#endif
|
|
||||||
#if defined(UNICODE_COMMON_ENABLE)
|
|
||||||
unicode_input_mode_init();
|
|
||||||
#endif
|
|
||||||
#ifdef HAPTIC_ENABLE
|
|
||||||
haptic_init();
|
|
||||||
#endif
|
|
||||||
#if defined(BLUETOOTH_ENABLE) && defined(OUTPUT_AUTO_ENABLE)
|
|
||||||
set_output(OUTPUT_AUTO);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
matrix_init_kb();
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: remove legacy api
|
// TODO: remove legacy api
|
||||||
|
void matrix_init_quantum() { matrix_init_kb(); }
|
||||||
void matrix_scan_quantum() { matrix_scan_kb(); }
|
void matrix_scan_quantum() { matrix_scan_kb(); }
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in a new issue