bad_kb_funcs1

This commit is contained in:
zvecr 2024-07-11 11:03:11 +01:00
parent 494af672ce
commit b066c86e43
22 changed files with 55 additions and 9 deletions

View file

@ -19,6 +19,8 @@
void matrix_init_kb(void) { void matrix_init_kb(void) {
uart_init(9600); uart_init(9600);
matrix_init_user();
} }
#endif #endif

View file

@ -24,6 +24,8 @@ void board_init(void) {
void keyboard_post_init_kb(void){ void keyboard_post_init_kb(void){
// Defining the backlight pin (A6) as an floating (no pullup or pulldown resistor) opendrain output pin // Defining the backlight pin (A6) as an floating (no pullup or pulldown resistor) opendrain output pin
palSetLineMode(BACKLIGHT_PIN, PAL_MODE_ALTERNATE(2) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_OSPEED_HIGHEST | PAL_STM32_PUPDR_FLOATING); palSetLineMode(BACKLIGHT_PIN, PAL_MODE_ALTERNATE(2) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_OSPEED_HIGHEST | PAL_STM32_PUPDR_FLOATING);
keyboard_post_init_user();
} }
void led_init_ports(void) { void led_init_ports(void) {

View file

@ -74,4 +74,6 @@ layer_state_t layer_state_set_kb(layer_state_t state) {
// Since the keyboard starts at layer 0, the init function starts LED4 as lit up. // Since the keyboard starts at layer 0, the init function starts LED4 as lit up.
void keyboard_post_init_kb(void){ void keyboard_post_init_kb(void){
gpio_write_pin(LED4_PIN, 0); gpio_write_pin(LED4_PIN, 0);
keyboard_post_init_user();
} }

View file

@ -90,6 +90,8 @@ void matrix_init_kb(void) {
#elif defined(DRAWING_TOY_MODE) #elif defined(DRAWING_TOY_MODE)
max7219_set_led(0, 0, true); max7219_set_led(0, 0, true);
#endif #endif
matrix_init_user();
} }
__attribute__ ((weak)) __attribute__ ((weak))

View file

@ -10,5 +10,7 @@ void keyboard_post_init_kb(void) {
debug_enable=true; debug_enable=true;
debug_matrix=true; debug_matrix=true;
debug_keyboard=true; debug_keyboard=true;
keyboard_post_init_user();
} }
#endif #endif

View file

@ -87,4 +87,6 @@ void keyboard_pre_init_kb(void) {
bootloader_jump(); bootloader_jump();
} }
#endif #endif
keyboard_pre_init_user();
} }

View file

@ -87,4 +87,6 @@ void keyboard_pre_init_kb(void) {
bootloader_jump(); bootloader_jump();
} }
#endif #endif
keyboard_pre_init_user();
} }

View file

@ -19,4 +19,6 @@ void keyboard_pre_init_kb(void) {
// Enable top LED // Enable top LED
gpio_set_pin_output(B3); gpio_set_pin_output(B3);
gpio_write_pin_low(B3); gpio_write_pin_low(B3);
keyboard_pre_init_user();
} }

View file

@ -16,21 +16,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "quantum.h" #include "quantum.h"
/* void keyboard_pre_init_kb(void) {
* Hardware function pre initialisation.
* See https://docs.qmk.fm/#/custom_quantum_functions?id=example-keyboard_pre_init_user-implementation
*/
void keyboard_pre_init_user(void) {
// Call the keyboard pre init code.
// Set our LED pins as output // Set our LED pins as output
gpio_set_pin_output(C3); gpio_set_pin_output(C3);
keyboard_pre_init_user();
} }
void matrix_init_kb(void) { void matrix_init_kb(void) {
// Flash the led 1 sec on startup. // Flash the led 1 sec on startup.
gpio_write_pin_high(C3); gpio_write_pin_high(C3);
wait_ms(1000); wait_ms(1000);
gpio_write_pin_low(C3); gpio_write_pin_low(C3);
matrix_init_user();
} }

View file

@ -19,4 +19,6 @@
/* joystick button code (thumbstick pressed) */ /* joystick button code (thumbstick pressed) */
void keyboard_pre_init_kb(void) { void keyboard_pre_init_kb(void) {
gpio_set_pin_input_high(F6); gpio_set_pin_input_high(F6);
keyboard_pre_init_user();
} }

View file

@ -114,6 +114,8 @@ void keyboard_pre_init_kb(void) {
gpio_set_pin_output(SR_CLK_PIN); gpio_set_pin_output(SR_CLK_PIN);
gpio_set_pin_output(SR_DOUT_PIN); // MOSI - unused gpio_set_pin_output(SR_DOUT_PIN); // MOSI - unused
gpio_write_pin_low(SR_CLK_PIN); gpio_write_pin_low(SR_CLK_PIN);
keyboard_pre_init_user();
} }
#ifdef KEYBOARD_ibm_model_m_mschwingen_led_ws2812 #ifdef KEYBOARD_ibm_model_m_mschwingen_led_ws2812

View file

@ -3,6 +3,8 @@
void keyboard_pre_init_kb(void) { void keyboard_pre_init_kb(void) {
gpio_set_pin_output(C4); gpio_set_pin_output(C4);
gpio_set_pin_output(C5); gpio_set_pin_output(C5);
keyboard_pre_init_user();
} }
inline void _idb_60_caps_led_on(void) { inline void _idb_60_caps_led_on(void) {

View file

@ -18,4 +18,6 @@
void keyboard_pre_init_kb(void) { void keyboard_pre_init_kb(void) {
gpio_set_pin_output(D4); gpio_set_pin_output(D4);
keyboard_pre_init_user();
} }

View file

@ -25,4 +25,5 @@ void matrix_init_kb(void)
gpio_set_pin_output(LED_POWER_PIN); gpio_set_pin_output(LED_POWER_PIN);
gpio_write_pin_high(LED_POWER_PIN); gpio_write_pin_high(LED_POWER_PIN);
matrix_init_user();
} }

View file

@ -27,9 +27,13 @@ RGBLIGHT_LAYERS_LIST(
my_numlock_layer, my_numlock_layer,
my_scroll_layer my_scroll_layer
); );
void keyboard_post_init_kb(void) { void keyboard_post_init_kb(void) {
rgblight_layers = my_rgb_layers; rgblight_layers = my_rgb_layers;
keyboard_post_init_user();
} }
// Activate rgb layer for caps when capslock is enabled // Activate rgb layer for caps when capslock is enabled
bool led_update_kb(led_t led_state) { bool led_update_kb(led_t led_state) {
rgblight_set_layer_state(0, led_state.caps_lock); rgblight_set_layer_state(0, led_state.caps_lock);

View file

@ -140,6 +140,8 @@ void matrix_init_kb(void) {
gpio_write_pin_low(LED_MAC_OS_PIN); gpio_write_pin_low(LED_MAC_OS_PIN);
gpio_set_pin_output(LED_WIN_LOCK_PIN); // LED3 Win Lock gpio_set_pin_output(LED_WIN_LOCK_PIN); // LED3 Win Lock
gpio_write_pin_low(LED_WIN_LOCK_PIN); gpio_write_pin_low(LED_WIN_LOCK_PIN);
matrix_init_user();
} }
void housekeeping_task_kb(void){ void housekeeping_task_kb(void){

View file

@ -139,6 +139,8 @@ void matrix_init_kb(void) {
} }
system76_ec_rgb_layer(layer_state); system76_ec_rgb_layer(layer_state);
matrix_init_user();
} }
void matrix_scan_kb(void) { void matrix_scan_kb(void) {
@ -238,9 +240,11 @@ layer_state_t layer_state_set_kb(layer_state_t layer_state) {
} }
#ifdef CONSOLE_ENABLE #ifdef CONSOLE_ENABLE
void keyboard_post_init_user(void) { void keyboard_post_init_kb(void) {
debug_enable = true; debug_enable = true;
debug_matrix = false; debug_matrix = false;
debug_keyboard = false; debug_keyboard = false;
keyboard_post_init_user();
} }
#endif // CONSOLE_ENABLE #endif // CONSOLE_ENABLE

View file

@ -23,6 +23,8 @@ void keyboard_post_init_kb(void)
gpio_set_pin_output(C11); // middle led, always off on Spacesaver M gpio_set_pin_output(C11); // middle led, always off on Spacesaver M
gpio_write_pin(C11, 0); gpio_write_pin(C11, 0);
gpio_set_pin_output(C10); // right-most led, normally Scroll Lock, but on Spacesaver M indicates function layer gpio_set_pin_output(C10); // right-most led, normally Scroll Lock, but on Spacesaver M indicates function layer
keyboard_post_init_user();
} }

View file

@ -23,6 +23,8 @@ void keyboard_post_init_kb(void)
gpio_set_pin_output(C11); // middle led, always off on Spacesaver M gpio_set_pin_output(C11); // middle led, always off on Spacesaver M
gpio_write_pin(C11, 0); gpio_write_pin(C11, 0);
gpio_set_pin_output(C10); // right-most led, normally Scroll Lock, but on Spacesaver M indicates function layer gpio_set_pin_output(C10); // right-most led, normally Scroll Lock, but on Spacesaver M indicates function layer
keyboard_post_init_user();
} }
layer_state_t layer_state_set_kb(layer_state_t state) { layer_state_t layer_state_set_kb(layer_state_t state) {

View file

@ -42,6 +42,8 @@ void keyboard_post_init_kb(void) {
if ( g_first_execution ) { if ( g_first_execution ) {
rgblight_mode(RGBLIGHT_MODE_RGB_TEST); rgblight_mode(RGBLIGHT_MODE_RGB_TEST);
} }
keyboard_post_init_user();
} }
#endif // VIA_ENABLE #endif // VIA_ENABLE

View file

@ -84,10 +84,14 @@ bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) {
void eeconfig_init_kb(void) { void eeconfig_init_kb(void) {
kb_cums.raw = 0; kb_cums.raw = 0;
eeconfig_update_kb(kb_cums.raw); eeconfig_update_kb(kb_cums.raw);
eeconfig_init_user();
} }
void keyboard_post_init_kb(void) { void keyboard_post_init_kb(void) {
kb_cums.underground_rgb_sw = eeconfig_read_kb(); kb_cums.underground_rgb_sw = eeconfig_read_kb();
keyboard_post_init_user();
} }
#endif #endif

View file

@ -85,10 +85,14 @@ bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) {
void eeconfig_init_kb(void) { void eeconfig_init_kb(void) {
kb_cums.raw = 0; kb_cums.raw = 0;
eeconfig_update_kb(kb_cums.raw); eeconfig_update_kb(kb_cums.raw);
eeconfig_init_user();
} }
void keyboard_post_init_kb(void) { void keyboard_post_init_kb(void) {
kb_cums.underground_rgb_sw = eeconfig_read_kb(); kb_cums.underground_rgb_sw = eeconfig_read_kb();
keyboard_post_init_user();
} }
#endif #endif