mirror of
https://github.com/Keychron/qmk_firmware.git
synced 2024-11-24 01:17:07 +06:00
Update GPIO macros in keymaps (#23792)
This commit is contained in:
parent
8ff8e9eae5
commit
b8f29c3865
|
@ -20,11 +20,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
bool led_update_user(led_t led_state) {
|
||||
if (led_state.caps_lock) {
|
||||
setPinOutput(B2);
|
||||
writePinLow(B2);
|
||||
gpio_set_pin_output(B2);
|
||||
gpio_write_pin_low(B2);
|
||||
} else {
|
||||
setPinInput(B2);
|
||||
writePinLow(B2);
|
||||
gpio_set_pin_input(B2);
|
||||
gpio_write_pin_low(B2);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -20,11 +20,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
bool led_update_user(led_t led_state) {
|
||||
if (led_state.caps_lock) {
|
||||
setPinOutput(B2);
|
||||
writePinLow(B2);
|
||||
gpio_set_pin_output(B2);
|
||||
gpio_write_pin_low(B2);
|
||||
} else {
|
||||
setPinInput(B2);
|
||||
writePinLow(B2);
|
||||
gpio_set_pin_input(B2);
|
||||
gpio_write_pin_low(B2);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -20,11 +20,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
bool led_update_user(led_t led_state) {
|
||||
if (led_state.caps_lock) {
|
||||
setPinOutput(B2);
|
||||
writePinLow(B2);
|
||||
gpio_set_pin_output(B2);
|
||||
gpio_write_pin_low(B2);
|
||||
} else {
|
||||
setPinInput(B2);
|
||||
writePinLow(B2);
|
||||
gpio_set_pin_input(B2);
|
||||
gpio_write_pin_low(B2);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -90,9 +90,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
//function for layer indicator LED
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
writePin(D0, layer_state_cmp(state, 0));
|
||||
writePin(D1, layer_state_cmp(state, 1));
|
||||
writePin(D2, layer_state_cmp(state, 2));
|
||||
gpio_write_pin(D0, layer_state_cmp(state, 0));
|
||||
gpio_write_pin(D1, layer_state_cmp(state, 1));
|
||||
gpio_write_pin(D2, layer_state_cmp(state, 2));
|
||||
return state;
|
||||
}
|
||||
|
||||
|
|
|
@ -90,9 +90,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
//function for layer indicator LED
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
writePin(D0, layer_state_cmp(state, 0));
|
||||
writePin(D1, layer_state_cmp(state, 1));
|
||||
writePin(D2, layer_state_cmp(state, 2));
|
||||
gpio_write_pin(D0, layer_state_cmp(state, 0));
|
||||
gpio_write_pin(D1, layer_state_cmp(state, 1));
|
||||
gpio_write_pin(D2, layer_state_cmp(state, 2));
|
||||
return state;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,8 +37,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
/* Layer-specific lighting */
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
writePin(F4, !layer_state_cmp(state, _VC));
|
||||
writePin(F5, !layer_state_cmp(state, _VIM));
|
||||
gpio_write_pin(F4, !layer_state_cmp(state, _VC));
|
||||
gpio_write_pin(F5, !layer_state_cmp(state, _VIM));
|
||||
return state;
|
||||
};
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
};
|
||||
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
writePin(D0, IS_LAYER_ON_STATE(state, 1));
|
||||
gpio_write_pin(D0, IS_LAYER_ON_STATE(state, 1));
|
||||
|
||||
return state;
|
||||
}
|
||||
|
|
|
@ -46,11 +46,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
// C6 E6 D7
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
writePin(C6, layer_state_is(1));
|
||||
writePin(E6, layer_state_is(2));
|
||||
writePin(D7, layer_state_is(3));
|
||||
writePin(D4, layer_state_is(4));
|
||||
writePin(D0, layer_state_is(5));
|
||||
gpio_write_pin(C6, layer_state_is(1));
|
||||
gpio_write_pin(E6, layer_state_is(2));
|
||||
gpio_write_pin(D7, layer_state_is(3));
|
||||
gpio_write_pin(D4, layer_state_is(4));
|
||||
gpio_write_pin(D0, layer_state_is(5));
|
||||
if (is_alt_tab_active) {
|
||||
if (timer_elapsed(alt_tab_timer) > 1000) {
|
||||
unregister_code(KC_LWIN);
|
||||
|
|
|
@ -47,15 +47,15 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
}
|
||||
|
||||
void matrix_init_user(void) {
|
||||
setPinOutput(B0);
|
||||
writePinLow(B0);
|
||||
gpio_set_pin_output(B0);
|
||||
gpio_write_pin_low(B0);
|
||||
}
|
||||
|
||||
bool led_update_user(led_t led_state) {
|
||||
if (led_state.caps_lock) {
|
||||
writePinHigh(B0);
|
||||
gpio_write_pin_high(B0);
|
||||
} else {
|
||||
writePinLow(B0);
|
||||
gpio_write_pin_low(B0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -37,8 +37,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
void matrix_scan_user(void) {
|
||||
// escape LED on layer 1
|
||||
if (IS_LAYER_ON(1)) {
|
||||
writePinLow(B0);
|
||||
gpio_write_pin_low(B0);
|
||||
} else {
|
||||
writePinHigh(B0);
|
||||
gpio_write_pin_high(B0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,6 +73,6 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
|
|||
#endif
|
||||
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
writePin(C0, layer_state_cmp(state, 1));
|
||||
gpio_write_pin(C0, layer_state_cmp(state, 1));
|
||||
return state;
|
||||
};
|
||||
|
|
|
@ -73,6 +73,6 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
|
|||
#endif
|
||||
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
writePin(C0, layer_state_cmp(state, 1));
|
||||
gpio_write_pin(C0, layer_state_cmp(state, 1));
|
||||
return state;
|
||||
};
|
||||
|
|
|
@ -64,6 +64,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
};
|
||||
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
writePin(C0, layer_state_cmp(state, 1));
|
||||
gpio_write_pin(C0, layer_state_cmp(state, 1));
|
||||
return state;
|
||||
};
|
|
@ -64,6 +64,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
};
|
||||
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
writePin(C0, layer_state_cmp(state, 1));
|
||||
gpio_write_pin(C0, layer_state_cmp(state, 1));
|
||||
return state;
|
||||
};
|
||||
|
|
|
@ -51,10 +51,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
bool led_update_user(led_t led_state) {
|
||||
if (led_state.caps_lock) {
|
||||
rgblight_sethsv(HSV_CYAN);
|
||||
writePinHigh(D1);
|
||||
gpio_write_pin_high(D1);
|
||||
} else {
|
||||
rgblight_sethsv(HSV_GREEN);
|
||||
writePinLow(D1);
|
||||
gpio_write_pin_low(D1);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -215,18 +215,18 @@ led_config_t led_config;
|
|||
//Set leds to saved state during powerup
|
||||
void keyboard_post_init_user(void) {
|
||||
// set LED pin modes
|
||||
setPinOutput(LED_RED);
|
||||
setPinOutput(LED_GREEN);
|
||||
gpio_set_pin_output(LED_RED);
|
||||
gpio_set_pin_output(LED_GREEN);
|
||||
|
||||
// Call the post init code.
|
||||
led_config.raw = eeconfig_read_user();
|
||||
|
||||
if(led_config.red_mode == LEDMODE_ON) {
|
||||
writePinHigh(LED_RED);
|
||||
gpio_write_pin_high(LED_RED);
|
||||
}
|
||||
|
||||
if(led_config.green_mode == LEDMODE_ON) {
|
||||
writePinHigh(LED_GREEN);
|
||||
gpio_write_pin_high(LED_GREEN);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -248,10 +248,10 @@ void led_keypress_update(uint8_t led, uint8_t led_mode, uint16_t keycode, keyrec
|
|||
for (int i=0;i<ARRAY_SIZE(modifiers);i++) {
|
||||
if(keycode==modifiers[i]) {
|
||||
if (record->event.pressed) {
|
||||
writePinHigh(led);
|
||||
gpio_write_pin_high(led);
|
||||
}
|
||||
else {
|
||||
writePinLow(led);
|
||||
gpio_write_pin_low(led);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -260,30 +260,30 @@ void led_keypress_update(uint8_t led, uint8_t led_mode, uint16_t keycode, keyrec
|
|||
if (record->event.pressed) {
|
||||
if(rand() % 2 == 1) {
|
||||
if(rand() % 2 == 0) {
|
||||
writePinLow(led);
|
||||
gpio_write_pin_low(led);
|
||||
}
|
||||
else {
|
||||
writePinHigh(led);
|
||||
gpio_write_pin_high(led);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LEDMODE_KEY:
|
||||
if (record->event.pressed) {
|
||||
writePinHigh(led);
|
||||
gpio_write_pin_high(led);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
writePinLow(led);
|
||||
gpio_write_pin_low(led);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case LEDMODE_ENTER:
|
||||
if (keycode==KC_ENT) {
|
||||
writePinHigh(led);
|
||||
gpio_write_pin_high(led);
|
||||
}
|
||||
else {
|
||||
writePinLow(led);
|
||||
gpio_write_pin_low(led);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -345,11 +345,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
if (record->event.pressed) {
|
||||
if (led_config.red_mode==LEDMODE_ON) {
|
||||
led_config.red_mode=LEDMODE_OFF;
|
||||
writePinLow(LED_RED);
|
||||
gpio_write_pin_low(LED_RED);
|
||||
}
|
||||
else {
|
||||
led_config.red_mode=LEDMODE_ON;
|
||||
writePinHigh(LED_RED);
|
||||
gpio_write_pin_high(LED_RED);
|
||||
}
|
||||
}
|
||||
eeconfig_update_user(led_config.raw);
|
||||
|
@ -359,11 +359,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
if (record->event.pressed) {
|
||||
if (led_config.green_mode==LEDMODE_ON) {
|
||||
led_config.green_mode=LEDMODE_OFF;
|
||||
writePinLow(LED_GREEN);
|
||||
gpio_write_pin_low(LED_GREEN);
|
||||
}
|
||||
else {
|
||||
led_config.green_mode=LEDMODE_ON;
|
||||
writePinHigh(LED_GREEN);
|
||||
gpio_write_pin_high(LED_GREEN);
|
||||
}
|
||||
}
|
||||
eeconfig_update_user(led_config.raw);
|
||||
|
|
|
@ -95,7 +95,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
};
|
||||
bool led_update_user(led_t led_state) {
|
||||
writePin(LED_RED, led_state.caps_lock);
|
||||
writePin(LED_GREEN, led_state.scroll_lock);
|
||||
gpio_write_pin(LED_RED, led_state.caps_lock);
|
||||
gpio_write_pin(LED_GREEN, led_state.scroll_lock);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -66,6 +66,6 @@ bool rgb_matrix_indicators_user(void) {
|
|||
}
|
||||
|
||||
void keyboard_pre_init_user(void) {
|
||||
setPinOutput(B5);
|
||||
writePinLow(B5);
|
||||
gpio_set_pin_output(B5);
|
||||
gpio_write_pin_low(B5);
|
||||
}
|
||||
|
|
|
@ -48,9 +48,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
if (get_highest_layer(state) != 0) {
|
||||
writePinLow(C6);
|
||||
gpio_write_pin_low(C6);
|
||||
} else {
|
||||
writePinHigh(C6);
|
||||
gpio_write_pin_high(C6);
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
|
|
@ -48,9 +48,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
if (get_highest_layer(state) != 0) {
|
||||
writePinLow(C6);
|
||||
gpio_write_pin_low(C6);
|
||||
} else {
|
||||
writePinHigh(C6);
|
||||
gpio_write_pin_high(C6);
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
|
|
@ -48,9 +48,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
if (get_highest_layer(state) != 0) {
|
||||
writePinLow(C6);
|
||||
gpio_write_pin_low(C6);
|
||||
} else {
|
||||
writePinHigh(C6);
|
||||
gpio_write_pin_high(C6);
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
|
|
@ -56,13 +56,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
};
|
||||
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
setPinOutput(LOCK_LED_PIN);
|
||||
gpio_set_pin_output(LOCK_LED_PIN);
|
||||
switch (get_highest_layer(state)) {
|
||||
case _LOCK:
|
||||
writePin(LOCK_LED_PIN, 0);
|
||||
gpio_write_pin(LOCK_LED_PIN, 0);
|
||||
break;
|
||||
default: // for any other layers, or the default layer
|
||||
writePin(LOCK_LED_PIN, 1);
|
||||
gpio_write_pin(LOCK_LED_PIN, 1);
|
||||
break;
|
||||
}
|
||||
return state;
|
||||
|
|
|
@ -46,9 +46,9 @@ layer_state_t layer_state_set_user(layer_state_t state) {
|
|||
|
||||
// override kb level function
|
||||
bool led_update_user(led_t usb_led) {
|
||||
writePin(B1, !top);
|
||||
writePin(B2, !middle);
|
||||
writePin(B3, !bottom);
|
||||
gpio_write_pin(B1, !top);
|
||||
gpio_write_pin(B2, !middle);
|
||||
gpio_write_pin(B3, !bottom);
|
||||
return false; // we are using LEDs for something else override kb
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -95,15 +95,15 @@ void matrix_init_user(void) {
|
|||
// Call the keymap level matrix init.
|
||||
|
||||
// Set our LED pins as output
|
||||
setPinOutput(C4);
|
||||
setPinOutput(C5);
|
||||
setPinOutput(C6);
|
||||
gpio_set_pin_output(C4);
|
||||
gpio_set_pin_output(C5);
|
||||
gpio_set_pin_output(C6);
|
||||
}
|
||||
|
||||
bool led_update_user(led_t led_state) {
|
||||
writePin(C4, led_state.num_lock);
|
||||
writePin(C5, led_state.caps_lock);
|
||||
writePin(C6, led_state.scroll_lock);
|
||||
gpio_write_pin(C4, led_state.num_lock);
|
||||
gpio_write_pin(C5, led_state.caps_lock);
|
||||
gpio_write_pin(C6, led_state.scroll_lock);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -54,12 +54,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
/* Show "Fun Lock" layer state via the "Fun Lock" LED */
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
|
||||
setPinOutput(LED_FUN_LOCK_PIN);
|
||||
gpio_set_pin_output(LED_FUN_LOCK_PIN);
|
||||
|
||||
if (layer_state_cmp(state, _FUNCTION))
|
||||
writePinHigh(LED_FUN_LOCK_PIN);
|
||||
gpio_write_pin_high(LED_FUN_LOCK_PIN);
|
||||
else
|
||||
writePinLow(LED_FUN_LOCK_PIN);
|
||||
gpio_write_pin_low(LED_FUN_LOCK_PIN);
|
||||
|
||||
return state;
|
||||
}
|
||||
|
|
|
@ -25,15 +25,15 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
bool led_update_user(led_t led_state) {
|
||||
|
||||
if (led_state.caps_lock) {
|
||||
writePinHigh(F1);
|
||||
gpio_write_pin_high(F1);
|
||||
} else {
|
||||
writePinLow(F1);
|
||||
gpio_write_pin_low(F1);
|
||||
}
|
||||
|
||||
if (led_state.scroll_lock) {
|
||||
writePinHigh(F0);
|
||||
gpio_write_pin_high(F0);
|
||||
} else {
|
||||
writePinLow(F0);
|
||||
gpio_write_pin_low(F0);
|
||||
}
|
||||
|
||||
if (!led_state.num_lock) {
|
||||
|
@ -46,13 +46,13 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
if (record->event.pressed) {
|
||||
if (sysreq_led) {
|
||||
sysreq_led = false;
|
||||
writePinLow(F4);
|
||||
gpio_write_pin_low(F4);
|
||||
}
|
||||
else {
|
||||
switch(keycode) {
|
||||
case KC_SYSTEM_REQUEST:
|
||||
sysreq_led = true;
|
||||
writePinHigh(F4);
|
||||
gpio_write_pin_high(F4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,15 +25,15 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
bool led_update_user(led_t led_state) {
|
||||
|
||||
if (led_state.caps_lock) {
|
||||
writePinHigh(F1);
|
||||
gpio_write_pin_high(F1);
|
||||
} else {
|
||||
writePinLow(F1);
|
||||
gpio_write_pin_low(F1);
|
||||
}
|
||||
|
||||
if (led_state.scroll_lock) {
|
||||
writePinHigh(F0);
|
||||
gpio_write_pin_high(F0);
|
||||
} else {
|
||||
writePinLow(F0);
|
||||
gpio_write_pin_low(F0);
|
||||
}
|
||||
|
||||
if (!led_state.num_lock) {
|
||||
|
@ -46,13 +46,13 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
if (record->event.pressed) {
|
||||
if (sysreq_led) {
|
||||
sysreq_led = false;
|
||||
writePinLow(F4);
|
||||
gpio_write_pin_low(F4);
|
||||
}
|
||||
else {
|
||||
switch(keycode) {
|
||||
case KC_SYSTEM_REQUEST:
|
||||
sysreq_led = true;
|
||||
writePinHigh(F4);
|
||||
gpio_write_pin_high(F4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,16 +84,16 @@ layer_state_t layer_state_set_user(layer_state_t state) {
|
|||
#ifdef JOTANCK_LEDS
|
||||
switch (get_highest_layer(state)) {
|
||||
case _LOWER:
|
||||
writePinHigh(JOTANCK_LED1);
|
||||
writePinLow(JOTANCK_LED2);
|
||||
gpio_write_pin_high(JOTANCK_LED1);
|
||||
gpio_write_pin_low(JOTANCK_LED2);
|
||||
break;
|
||||
case _RAISE:
|
||||
writePinLow(JOTANCK_LED1);
|
||||
writePinHigh(JOTANCK_LED2);
|
||||
gpio_write_pin_low(JOTANCK_LED1);
|
||||
gpio_write_pin_high(JOTANCK_LED2);
|
||||
break;
|
||||
default:
|
||||
writePinLow(JOTANCK_LED1);
|
||||
writePinLow(JOTANCK_LED2);
|
||||
gpio_write_pin_low(JOTANCK_LED1);
|
||||
gpio_write_pin_low(JOTANCK_LED2);
|
||||
break;
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -76,15 +76,15 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
}
|
||||
|
||||
void matrix_init_user(void) {
|
||||
setPinOutput(C7);
|
||||
writePinLow(C7);
|
||||
gpio_set_pin_output(C7);
|
||||
gpio_write_pin_low(C7);
|
||||
}
|
||||
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
if (get_highest_layer(state)) {
|
||||
writePinHigh(C7);
|
||||
gpio_write_pin_high(C7);
|
||||
} else {
|
||||
writePinLow(C7);
|
||||
gpio_write_pin_low(C7);
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
case LEDCHANGE:
|
||||
if (record->event.pressed) {
|
||||
led_state = !led_state;
|
||||
writePin(F6, led_state);
|
||||
gpio_write_pin(F6, led_state);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -59,6 +59,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
}
|
||||
|
||||
void matrix_init_user(void) {
|
||||
setPinOutput(F6);
|
||||
writePinLow(F6);
|
||||
gpio_set_pin_output(F6);
|
||||
gpio_write_pin_low(F6);
|
||||
}
|
||||
|
|
|
@ -67,16 +67,16 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
};
|
||||
|
||||
bool led_update_user(led_t led_state) {
|
||||
writePin(NUM_LOCK_LED_PIN, led_state.num_lock);
|
||||
writePin(CAPS_LOCK_LED_PIN, led_state.caps_lock);
|
||||
// writePin(SCROLL_LOCK_LED_PIN, led_state.scroll_lock);
|
||||
gpio_write_pin(NUM_LOCK_LED_PIN, led_state.num_lock);
|
||||
gpio_write_pin(CAPS_LOCK_LED_PIN, led_state.caps_lock);
|
||||
// gpio_write_pin(SCROLL_LOCK_LED_PIN, led_state.scroll_lock);
|
||||
return false;
|
||||
}
|
||||
|
||||
//function for layer indicator LED
|
||||
layer_state_t layer_state_set_user(layer_state_t state)
|
||||
{
|
||||
writePin(SCROLL_LOCK_LED_PIN, (get_highest_layer(state) == 1));
|
||||
gpio_write_pin(SCROLL_LOCK_LED_PIN, (get_highest_layer(state) == 1));
|
||||
|
||||
return state;
|
||||
}
|
||||
|
|
|
@ -52,16 +52,16 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
};
|
||||
|
||||
bool led_update_user(led_t led_state) {
|
||||
writePin(NUM_LOCK_LED_PIN, led_state.num_lock);
|
||||
writePin(CAPS_LOCK_LED_PIN, led_state.caps_lock);
|
||||
// writePin(SCROLL_LOCK_LED_PIN, led_state.scroll_lock);
|
||||
gpio_write_pin(NUM_LOCK_LED_PIN, led_state.num_lock);
|
||||
gpio_write_pin(CAPS_LOCK_LED_PIN, led_state.caps_lock);
|
||||
// gpio_write_pin(SCROLL_LOCK_LED_PIN, led_state.scroll_lock);
|
||||
return false;
|
||||
}
|
||||
|
||||
//function for layer indicator LED
|
||||
layer_state_t layer_state_set_user(layer_state_t state)
|
||||
{
|
||||
writePin(SCROLL_LOCK_LED_PIN, (get_highest_layer(state) == 1));
|
||||
gpio_write_pin(SCROLL_LOCK_LED_PIN, (get_highest_layer(state) == 1));
|
||||
|
||||
return state;
|
||||
}
|
||||
|
|
|
@ -150,18 +150,18 @@ layer_state_t layer_state_set_user(layer_state_t state) {
|
|||
/* Use LED0 and 4 (Kana and KB Lock as layer indicators) */
|
||||
switch (get_highest_layer(state)) {
|
||||
case _FN:
|
||||
writePinLow(LED_KANA_PIN);
|
||||
gpio_write_pin_low(LED_KANA_PIN);
|
||||
break;
|
||||
case _MUS:
|
||||
writePinLow(LED_KB_LOCK_PIN);
|
||||
gpio_write_pin_low(LED_KB_LOCK_PIN);
|
||||
break;
|
||||
case _LOCK:
|
||||
writePinLow(LED_KANA_PIN);
|
||||
writePinLow(LED_KB_LOCK_PIN);
|
||||
gpio_write_pin_low(LED_KANA_PIN);
|
||||
gpio_write_pin_low(LED_KB_LOCK_PIN);
|
||||
break;
|
||||
default: // for any other layers, or the default layer
|
||||
writePinHigh(LED_KANA_PIN);
|
||||
writePinHigh(LED_KB_LOCK_PIN);
|
||||
gpio_write_pin_high(LED_KANA_PIN);
|
||||
gpio_write_pin_high(LED_KB_LOCK_PIN);
|
||||
break;
|
||||
}
|
||||
return state;
|
||||
|
|
|
@ -50,10 +50,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
writePin(A7, layer_state_is(1));
|
||||
gpio_write_pin(A7, layer_state_is(1));
|
||||
}
|
||||
|
||||
bool led_update_user(led_t led_state) {
|
||||
writePin(LED_CAPS_LOCK_PIN, led_state.caps_lock);
|
||||
gpio_write_pin(LED_CAPS_LOCK_PIN, led_state.caps_lock);
|
||||
return false;
|
||||
};
|
||||
|
|
|
@ -73,6 +73,6 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
|
|||
#endif
|
||||
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
writePin(C0, layer_state_cmp(state, 1));
|
||||
gpio_write_pin(C0, layer_state_cmp(state, 1));
|
||||
return state;
|
||||
};
|
||||
|
|
|
@ -73,6 +73,6 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
|
|||
#endif
|
||||
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
writePin(C0, layer_state_cmp(state, 1));
|
||||
gpio_write_pin(C0, layer_state_cmp(state, 1));
|
||||
return state;
|
||||
};
|
||||
|
|
|
@ -132,12 +132,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
}
|
||||
|
||||
bool led_update_user(led_t led_state) {
|
||||
writePin(B1, led_state.num_lock);
|
||||
gpio_write_pin(B1, led_state.num_lock);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
writePin(B3, !IS_LAYER_ON_STATE(state, 0));
|
||||
gpio_write_pin(B3, !IS_LAYER_ON_STATE(state, 0));
|
||||
return state;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ LAYOUT_ortho_4x4(
|
|||
// Only for Rev1 & Rev2
|
||||
#ifdef LED_RED
|
||||
void keyboard_post_init_user(void) {
|
||||
writePinHigh(LED_RED);
|
||||
gpio_write_pin_high(LED_RED);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
// Only for Rev1 & Rev2
|
||||
#ifdef LED_RED
|
||||
void keyboard_post_init_user(void) {
|
||||
writePinHigh(LED_RED);
|
||||
gpio_write_pin_high(LED_RED);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -99,13 +99,13 @@ void tk_finished(tap_dance_state_t *state, void *user_data){
|
|||
layer_off(_ML1);
|
||||
//turn off the indicator LED
|
||||
//set LED HI to turn it off
|
||||
writePinHigh(INDICATOR_LED);
|
||||
gpio_write_pin_high(INDICATOR_LED);
|
||||
} else {
|
||||
//turn on the media layer
|
||||
layer_on(_ML1);
|
||||
//turn on the indicator LED
|
||||
//set LED pin to LOW to turn it on
|
||||
writePinLow(INDICATOR_LED);
|
||||
gpio_write_pin_low(INDICATOR_LED);
|
||||
}
|
||||
break;
|
||||
case SINGLE_HOLD:
|
||||
|
|
|
@ -97,6 +97,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
writePin(LED4_PIN, layer_state_cmp(state, _NM));
|
||||
gpio_write_pin(LED4_PIN, layer_state_cmp(state, _NM));
|
||||
return state;
|
||||
}
|
||||
|
|
|
@ -111,11 +111,11 @@ KC_GRV,KC_LGUI,KC_ESC,MO(_NUMPAD), KC_LBRC,
|
|||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
//set LEDs which are triggered by a layer change
|
||||
#ifdef LED_COMPOSE_PIN
|
||||
writePin(LED_COMPOSE_PIN, !layer_state_cmp(state, _KEYPAD));
|
||||
gpio_write_pin(LED_COMPOSE_PIN, !layer_state_cmp(state, _KEYPAD));
|
||||
#endif
|
||||
|
||||
#ifdef LED_NUM_LOCK_PIN
|
||||
writePin(LED_NUM_LOCK_PIN, !layer_state_cmp(state, _NUMPAD));
|
||||
gpio_write_pin(LED_NUM_LOCK_PIN, !layer_state_cmp(state, _NUMPAD));
|
||||
#endif
|
||||
|
||||
return state;
|
||||
|
@ -123,11 +123,11 @@ layer_state_t layer_state_set_user(layer_state_t state) {
|
|||
|
||||
bool led_update_user(led_t led_state) {
|
||||
#ifdef LED_CAPS_LOCK_PIN
|
||||
writePin(LED_CAPS_LOCK_PIN, !led_state.caps_lock);
|
||||
gpio_write_pin(LED_CAPS_LOCK_PIN, !led_state.caps_lock);
|
||||
#endif
|
||||
|
||||
#ifdef LED_SCROLL_LOCK_PIN
|
||||
writePin(LED_SCROLL_LOCK_PIN, !led_state.scroll_lock);
|
||||
gpio_write_pin(LED_SCROLL_LOCK_PIN, !led_state.scroll_lock);
|
||||
#endif
|
||||
|
||||
//disable default processing of LEDs
|
||||
|
|
|
@ -41,9 +41,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
bool led_update_user(led_t led_state) {
|
||||
if (led_state.caps_lock) {
|
||||
writePinLow(B1);
|
||||
gpio_write_pin_low(B1);
|
||||
} else {
|
||||
writePinHigh(B1);
|
||||
gpio_write_pin_high(B1);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -173,8 +173,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
/* Joystick + Encoder fix */
|
||||
void keyboard_post_init_kb(void) {
|
||||
if (is_keyboard_master()) {
|
||||
writePinLow(JOYSTICK_X_PIN);
|
||||
writePinLow(JOYSTICK_Y_PIN);
|
||||
gpio_write_pin_low(JOYSTICK_X_PIN);
|
||||
gpio_write_pin_low(JOYSTICK_Y_PIN);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -60,9 +60,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
state = update_tri_layer_state(state, _4, X_PAUSE, X_PAUSE);
|
||||
writePin(IND_1, layer_state_cmp(state, 1));
|
||||
writePin(IND_2, layer_state_cmp(state, 2));
|
||||
writePin(IND_3, layer_state_cmp(state, 3));
|
||||
gpio_write_pin(IND_1, layer_state_cmp(state, 1));
|
||||
gpio_write_pin(IND_2, layer_state_cmp(state, 2));
|
||||
gpio_write_pin(IND_3, layer_state_cmp(state, 3));
|
||||
return state;
|
||||
}
|
||||
|
||||
|
@ -89,13 +89,13 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
|
||||
void matrix_init_user(void) {
|
||||
//init the Pro Micro on-board LEDs
|
||||
setPinOutput(IND_1);
|
||||
setPinOutput(IND_2);
|
||||
setPinOutput(IND_3);
|
||||
gpio_set_pin_output(IND_1);
|
||||
gpio_set_pin_output(IND_2);
|
||||
gpio_set_pin_output(IND_3);
|
||||
//set to off
|
||||
writePinHigh(IND_1);
|
||||
writePinHigh(IND_2);
|
||||
writePinHigh(IND_3);
|
||||
gpio_write_pin_high(IND_1);
|
||||
gpio_write_pin_high(IND_2);
|
||||
gpio_write_pin_high(IND_3);
|
||||
}
|
||||
|
||||
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||
|
|
|
@ -60,9 +60,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
state = update_tri_layer_state(state, _4, X_PAUSE, X_PAUSE);
|
||||
writePin(IND_1, layer_state_cmp(state, 1));
|
||||
writePin(IND_2, layer_state_cmp(state, 2));
|
||||
writePin(IND_3, layer_state_cmp(state, 3));
|
||||
gpio_write_pin(IND_1, layer_state_cmp(state, 1));
|
||||
gpio_write_pin(IND_2, layer_state_cmp(state, 2));
|
||||
gpio_write_pin(IND_3, layer_state_cmp(state, 3));
|
||||
return state;
|
||||
}
|
||||
|
||||
|
@ -89,13 +89,13 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
|
||||
void matrix_init_user(void) {
|
||||
//init the Pro Micro on-board LEDs
|
||||
setPinOutput(IND_1);
|
||||
setPinOutput(IND_2);
|
||||
setPinOutput(IND_3);
|
||||
gpio_set_pin_output(IND_1);
|
||||
gpio_set_pin_output(IND_2);
|
||||
gpio_set_pin_output(IND_3);
|
||||
//set to off
|
||||
writePinHigh(IND_1);
|
||||
writePinHigh(IND_2);
|
||||
writePinHigh(IND_3);
|
||||
gpio_write_pin_high(IND_1);
|
||||
gpio_write_pin_high(IND_2);
|
||||
gpio_write_pin_high(IND_3);
|
||||
}
|
||||
|
||||
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||
|
|
|
@ -156,7 +156,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
|
|||
|
||||
// for exsample customize of LED inducator
|
||||
// bool led_update_user(led_t led_state) {
|
||||
// writePin(D2, IS_LAYER_ON(_LOWER));
|
||||
// writePin(D1, IS_LAYER_ON(_RAISE));
|
||||
// gpio_write_pin(D2, IS_LAYER_ON(_LOWER));
|
||||
// gpio_write_pin(D1, IS_LAYER_ON(_RAISE));
|
||||
// return false;
|
||||
// }
|
||||
|
|
|
@ -156,7 +156,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
|
|||
|
||||
// for exsample customize of LED inducator
|
||||
// bool led_update_user(led_t led_state) {
|
||||
// writePin(D2, IS_LAYER_ON(_LOWER));
|
||||
// writePin(D1, IS_LAYER_ON(_RAISE));
|
||||
// gpio_write_pin(D2, IS_LAYER_ON(_LOWER));
|
||||
// gpio_write_pin(D1, IS_LAYER_ON(_RAISE));
|
||||
// return false;
|
||||
// }
|
||||
|
|
|
@ -36,12 +36,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
switch (keycode) {
|
||||
case LOGO_LED_ON:
|
||||
if (record->event.pressed) {
|
||||
writePinLow(D7);
|
||||
gpio_write_pin_low(D7);
|
||||
}
|
||||
break;
|
||||
case LOGO_LED_OFF:
|
||||
if (record->event.pressed) {
|
||||
writePinHigh(D7);
|
||||
gpio_write_pin_high(D7);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -59,12 +59,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
switch (keycode) {
|
||||
case LOGO_LED_ON:
|
||||
if (record->event.pressed) {
|
||||
writePinLow(D7);
|
||||
gpio_write_pin_low(D7);
|
||||
}
|
||||
break;
|
||||
case LOGO_LED_OFF:
|
||||
if (record->event.pressed) {
|
||||
writePinHigh(D7);
|
||||
gpio_write_pin_high(D7);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -32,12 +32,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
switch (keycode) {
|
||||
case BL_ON:
|
||||
if (record->event.pressed) {
|
||||
writePinHigh(B7);
|
||||
gpio_write_pin_high(B7);
|
||||
}
|
||||
break;
|
||||
case BL_OFF:
|
||||
if (record->event.pressed) {
|
||||
writePinLow(B7);
|
||||
gpio_write_pin_low(B7);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -57,12 +57,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
switch (keycode) {
|
||||
case LOGO_LED_ON:
|
||||
if (record->event.pressed) {
|
||||
writePinHigh(B7);
|
||||
gpio_write_pin_high(B7);
|
||||
}
|
||||
break;
|
||||
case LOGO_LED_OFF:
|
||||
if (record->event.pressed) {
|
||||
writePinLow(B7);
|
||||
gpio_write_pin_low(B7);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -30,32 +30,32 @@ static const pin_t row_pins[] = MATRIX_ROW_PINS;
|
|||
static const pin_t col_pins[] = MATRIX_COL_PINS;
|
||||
|
||||
static void select_row(uint8_t row) {
|
||||
setPinOutput(row_pins[row]);
|
||||
writePinLow(row_pins[row]);
|
||||
gpio_set_pin_output(row_pins[row]);
|
||||
gpio_write_pin_low(row_pins[row]);
|
||||
}
|
||||
|
||||
static void unselect_row(uint8_t row) {
|
||||
setPinInputHigh(row_pins[row]);
|
||||
gpio_set_pin_input_high(row_pins[row]);
|
||||
}
|
||||
|
||||
static void unselect_rows(void) {
|
||||
for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
|
||||
setPinInputHigh(row_pins[x]);
|
||||
gpio_set_pin_input_high(row_pins[x]);
|
||||
}
|
||||
}
|
||||
|
||||
static void select_col(uint8_t col) {
|
||||
setPinOutput(col_pins[col]);
|
||||
writePinLow(col_pins[col]);
|
||||
gpio_set_pin_output(col_pins[col]);
|
||||
gpio_write_pin_low(col_pins[col]);
|
||||
}
|
||||
|
||||
static void unselect_col(uint8_t col) {
|
||||
setPinInputHigh(col_pins[col]);
|
||||
gpio_set_pin_input_high(col_pins[col]);
|
||||
}
|
||||
|
||||
static void unselect_cols(void) {
|
||||
for (uint8_t x = 0; x < MATRIX_COLS/2; x++) {
|
||||
setPinInputHigh(col_pins[x*2]);
|
||||
gpio_set_pin_input_high(col_pins[x*2]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
|
|||
for (uint8_t col_index = 0; col_index < MATRIX_COLS / 2; col_index++) {
|
||||
uint16_t column_index_bitmask = ROW_SHIFTER << ((col_index * 2) + 1);
|
||||
// Check row pin state
|
||||
if (readPin(col_pins[col_index*2])) {
|
||||
if (gpio_read_pin(col_pins[col_index*2])) {
|
||||
// Pin HI, clear col bit
|
||||
current_matrix[current_row] &= ~column_index_bitmask;
|
||||
} else {
|
||||
|
@ -105,7 +105,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
|
|||
|
||||
uint16_t column_index_bitmask = ROW_SHIFTER << (current_col * 2);
|
||||
// Check row pin state
|
||||
if (readPin(row_pins[row_index])) {
|
||||
if (gpio_read_pin(row_pins[row_index])) {
|
||||
// Pin HI, clear col bit
|
||||
current_matrix[row_index] &= ~column_index_bitmask;
|
||||
} else {
|
||||
|
|
|
@ -54,11 +54,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
bool led_update_user(led_t led_state) {
|
||||
if (led_state.caps_lock) {
|
||||
setPinOutput(B6);
|
||||
writePinHigh(B6);
|
||||
gpio_set_pin_output(B6);
|
||||
gpio_write_pin_high(B6);
|
||||
} else {
|
||||
setPinInput(B6);
|
||||
writePinLow(B6);
|
||||
gpio_set_pin_input(B6);
|
||||
gpio_write_pin_low(B6);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -72,12 +72,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
bool led_update_user(led_t led_state) {
|
||||
if (led_state.caps_lock) {
|
||||
setPinOutput(B6);
|
||||
writePinHigh(B6);
|
||||
gpio_set_pin_output(B6);
|
||||
gpio_write_pin_high(B6);
|
||||
}
|
||||
else {
|
||||
setPinInput(B6);
|
||||
writePinLow(B6);
|
||||
gpio_set_pin_input(B6);
|
||||
gpio_write_pin_low(B6);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -54,11 +54,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
bool led_update_user(led_t led_state) {
|
||||
if (led_state.caps_lock) {
|
||||
setPinOutput(B6);
|
||||
writePinHigh(B6);
|
||||
gpio_set_pin_output(B6);
|
||||
gpio_write_pin_high(B6);
|
||||
} else {
|
||||
setPinInput(B6);
|
||||
writePinLow(B6);
|
||||
gpio_set_pin_input(B6);
|
||||
gpio_write_pin_low(B6);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -55,27 +55,27 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
bool led_update_user(led_t led_state) {
|
||||
|
||||
if (led_state.num_lock) {
|
||||
setPinOutput(B0);
|
||||
writePinLow(B0);
|
||||
gpio_set_pin_output(B0);
|
||||
gpio_write_pin_low(B0);
|
||||
} else {
|
||||
setPinInput(B0);
|
||||
writePinLow(B0);
|
||||
gpio_set_pin_input(B0);
|
||||
gpio_write_pin_low(B0);
|
||||
}
|
||||
|
||||
if (led_state.caps_lock) {
|
||||
setPinOutput(B1);
|
||||
writePinLow(B1);
|
||||
gpio_set_pin_output(B1);
|
||||
gpio_write_pin_low(B1);
|
||||
} else {
|
||||
setPinInput(B1);
|
||||
writePinLow(B1);
|
||||
gpio_set_pin_input(B1);
|
||||
gpio_write_pin_low(B1);
|
||||
}
|
||||
|
||||
if (led_state.scroll_lock) {
|
||||
setPinOutput(B2);
|
||||
writePinLow(B2);
|
||||
gpio_set_pin_output(B2);
|
||||
gpio_write_pin_low(B2);
|
||||
} else {
|
||||
setPinInput(B2);
|
||||
writePinLow(B2);
|
||||
gpio_set_pin_input(B2);
|
||||
gpio_write_pin_low(B2);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -50,23 +50,23 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
};
|
||||
|
||||
void keyboard_pre_init_user() {
|
||||
writePin(LED1, true);
|
||||
writePin(LED2, true);
|
||||
gpio_write_pin(LED1, true);
|
||||
gpio_write_pin(LED2, true);
|
||||
}
|
||||
|
||||
void keyboard_post_init_user() {
|
||||
writePin(LED1, false);
|
||||
writePin(LED2, false);
|
||||
gpio_write_pin(LED1, false);
|
||||
gpio_write_pin(LED2, false);
|
||||
}
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
writePin(LED1, record->event.pressed);
|
||||
gpio_write_pin(LED1, record->event.pressed);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
writePin(LED2, state);
|
||||
gpio_write_pin(LED2, state);
|
||||
|
||||
return state;
|
||||
}
|
||||
|
|
|
@ -210,12 +210,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
backlight_step();
|
||||
#endif
|
||||
#ifdef KEYBOARD_planck_rev5
|
||||
writePinLow(E6);
|
||||
gpio_write_pin_low(E6);
|
||||
#endif
|
||||
} else {
|
||||
unregister_code(KC_RSFT);
|
||||
#ifdef KEYBOARD_planck_rev5
|
||||
writePinHigh(E6);
|
||||
gpio_write_pin_high(E6);
|
||||
#endif
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -22,11 +22,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
bool led_update_user(led_t led_state) {
|
||||
if (led_state.caps_lock) {
|
||||
setPinOutput(F4);
|
||||
writePinLow(F4);
|
||||
gpio_set_pin_output(F4);
|
||||
gpio_write_pin_low(F4);
|
||||
} else {
|
||||
setPinInput(F4);
|
||||
writePinLow(F4);
|
||||
gpio_set_pin_input(F4);
|
||||
gpio_write_pin_low(F4);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -216,12 +216,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
rgblight_step();
|
||||
#endif
|
||||
#ifdef __AVR__
|
||||
writePinLow(E6);
|
||||
gpio_write_pin_low(E6);
|
||||
#endif
|
||||
} else {
|
||||
unregister_code(KC_RSFT);
|
||||
#ifdef __AVR__
|
||||
writePinHigh(E6);
|
||||
gpio_write_pin_high(E6);
|
||||
#endif
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -47,26 +47,26 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
void matrix_init_user(void) {
|
||||
// set CapsLock LED to output and low
|
||||
setPinOutput(B1);
|
||||
writePinLow(B1);
|
||||
gpio_set_pin_output(B1);
|
||||
gpio_write_pin_low(B1);
|
||||
// set NumLock LED to output and low
|
||||
setPinOutput(B2);
|
||||
writePinLow(B2);
|
||||
gpio_set_pin_output(B2);
|
||||
gpio_write_pin_low(B2);
|
||||
// set ScrollLock LED to output and low
|
||||
setPinOutput(B3);
|
||||
writePinLow(B3);
|
||||
gpio_set_pin_output(B3);
|
||||
gpio_write_pin_low(B3);
|
||||
}
|
||||
|
||||
bool led_update_user(led_t led_state) {
|
||||
if (led_state.num_lock) {
|
||||
writePinHigh(B2);
|
||||
gpio_write_pin_high(B2);
|
||||
} else {
|
||||
writePinLow(B2);
|
||||
gpio_write_pin_low(B2);
|
||||
}
|
||||
if (led_state.caps_lock) {
|
||||
writePinHigh(B1);
|
||||
gpio_write_pin_high(B1);
|
||||
} else {
|
||||
writePinLow(B1);
|
||||
gpio_write_pin_low(B1);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -75,9 +75,9 @@ bool led_update_user(led_t led_state) {
|
|||
layer_state_t layer_state_set_user(layer_state_t state)
|
||||
{
|
||||
if (get_highest_layer(state) == 1) {
|
||||
writePinHigh(B3);
|
||||
gpio_write_pin_high(B3);
|
||||
} else {
|
||||
writePinLow(B3);
|
||||
gpio_write_pin_low(B3);
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
|
|
@ -75,26 +75,26 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
void matrix_init_user(void) {
|
||||
// set CapsLock LED to output and low
|
||||
setPinOutput(B1);
|
||||
writePinLow(B1);
|
||||
gpio_set_pin_output(B1);
|
||||
gpio_write_pin_low(B1);
|
||||
// set NumLock LED to output and low
|
||||
setPinOutput(B2);
|
||||
writePinLow(B2);
|
||||
gpio_set_pin_output(B2);
|
||||
gpio_write_pin_low(B2);
|
||||
// set ScrollLock LED to output and low
|
||||
setPinOutput(B3);
|
||||
writePinLow(B3);
|
||||
gpio_set_pin_output(B3);
|
||||
gpio_write_pin_low(B3);
|
||||
}
|
||||
|
||||
bool led_update_user(led_t led_state) {
|
||||
if (led_state.num_lock) {
|
||||
writePinHigh(B2);
|
||||
gpio_write_pin_high(B2);
|
||||
} else {
|
||||
writePinLow(B2);
|
||||
gpio_write_pin_low(B2);
|
||||
}
|
||||
if (led_state.caps_lock) {
|
||||
writePinHigh(B1);
|
||||
gpio_write_pin_high(B1);
|
||||
} else {
|
||||
writePinLow(B1);
|
||||
gpio_write_pin_low(B1);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -103,9 +103,9 @@ bool led_update_user(led_t led_state) {
|
|||
layer_state_t layer_state_set_user(layer_state_t state)
|
||||
{
|
||||
if (get_highest_layer(state) == 1) {
|
||||
writePinHigh(B3);
|
||||
gpio_write_pin_high(B3);
|
||||
} else {
|
||||
writePinLow(B3);
|
||||
gpio_write_pin_low(B3);
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
void led_keypress_update(pin_t led_pin, uint16_t keycode, keyrecord_t *record) {
|
||||
// When a key is pressed turn on the LED, when released turn it off
|
||||
writePin(led_pin, record->event.pressed);
|
||||
gpio_write_pin(led_pin, record->event.pressed);
|
||||
}
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
|
|
|
@ -64,7 +64,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
void led_keypress_update(pin_t led_pin, uint16_t keycode, keyrecord_t *record) {
|
||||
// When a key is pressed turn on the LED, when released turn it off
|
||||
writePin(led_pin, record->event.pressed);
|
||||
gpio_write_pin(led_pin, record->event.pressed);
|
||||
}
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
|
|
|
@ -51,20 +51,20 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
|
|||
|
||||
void matrix_init_user(void) {
|
||||
// set top LED to output and off (active low)
|
||||
setPinOutput(D5);
|
||||
writePinHigh(D5);
|
||||
gpio_set_pin_output(D5);
|
||||
gpio_write_pin_high(D5);
|
||||
// set middle LED to output and off (active low)
|
||||
setPinOutput(D4);
|
||||
writePinHigh(D4);
|
||||
gpio_set_pin_output(D4);
|
||||
gpio_write_pin_high(D4);
|
||||
// set bottom LED to output and off (active low)
|
||||
setPinOutput(D3);
|
||||
writePinHigh(D3);
|
||||
gpio_set_pin_output(D3);
|
||||
gpio_write_pin_high(D3);
|
||||
}
|
||||
|
||||
// write to above indicators in a binary fashion based on current layer
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
writePin(D5, get_highest_layer(state));
|
||||
writePin(D4, !layer_state_cmp(state, 1));
|
||||
writePin(D3, !layer_state_cmp(state, 2));
|
||||
gpio_write_pin(D5, get_highest_layer(state));
|
||||
gpio_write_pin(D4, !layer_state_cmp(state, 1));
|
||||
gpio_write_pin(D3, !layer_state_cmp(state, 2));
|
||||
return state;
|
||||
}
|
||||
|
|
|
@ -51,20 +51,20 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
|
|||
|
||||
void matrix_init_user(void) {
|
||||
// set top LED to output and off (active low)
|
||||
setPinOutput(D5);
|
||||
writePinHigh(D5);
|
||||
gpio_set_pin_output(D5);
|
||||
gpio_write_pin_high(D5);
|
||||
// set middle LED to output and off (active low)
|
||||
setPinOutput(D4);
|
||||
writePinHigh(D4);
|
||||
gpio_set_pin_output(D4);
|
||||
gpio_write_pin_high(D4);
|
||||
// set bottom LED to output and off (active low)
|
||||
setPinOutput(D3);
|
||||
writePinHigh(D3);
|
||||
gpio_set_pin_output(D3);
|
||||
gpio_write_pin_high(D3);
|
||||
}
|
||||
|
||||
// write to above indicators in a binary fashion based on current layer
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
writePin(D5, get_highest_layer(state));
|
||||
writePin(D4, !layer_state_cmp(state, 1));
|
||||
writePin(D3, !layer_state_cmp(state, 2));
|
||||
gpio_write_pin(D5, get_highest_layer(state));
|
||||
gpio_write_pin(D4, !layer_state_cmp(state, 1));
|
||||
gpio_write_pin(D3, !layer_state_cmp(state, 2));
|
||||
return state;
|
||||
}
|
||||
|
|
|
@ -77,11 +77,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
bool led_update_user(led_t led_state) {
|
||||
if (led_state.caps_lock) {
|
||||
setPinOutput(A3);
|
||||
writePinHigh(A3);
|
||||
gpio_set_pin_output(A3);
|
||||
gpio_write_pin_high(A3);
|
||||
} else {
|
||||
setPinInput(A3);
|
||||
writePinLow(A3);
|
||||
gpio_set_pin_input(A3);
|
||||
gpio_write_pin_low(A3);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -20,26 +20,26 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
};
|
||||
|
||||
bool led_update_user(led_t led_state) {
|
||||
setPinOutput(B4);
|
||||
setPinOutput(D6);
|
||||
setPinOutput(D7);
|
||||
gpio_set_pin_output(B4);
|
||||
gpio_set_pin_output(D6);
|
||||
gpio_set_pin_output(D7);
|
||||
|
||||
if (led_state.num_lock) {
|
||||
writePinHigh(D7);
|
||||
gpio_write_pin_high(D7);
|
||||
} else {
|
||||
writePinLow(D7);
|
||||
gpio_write_pin_low(D7);
|
||||
}
|
||||
|
||||
if (led_state.caps_lock) {
|
||||
writePinHigh(B4);
|
||||
gpio_write_pin_high(B4);
|
||||
} else {
|
||||
writePinLow(B4);
|
||||
gpio_write_pin_low(B4);
|
||||
}
|
||||
|
||||
if (led_state.scroll_lock) {
|
||||
writePinHigh(D6);
|
||||
gpio_write_pin_high(D6);
|
||||
} else {
|
||||
writePinLow(D6);
|
||||
gpio_write_pin_low(D6);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -75,30 +75,30 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
};
|
||||
|
||||
void keyboard_pre_init_user(void) {
|
||||
setPinOutput(F5); // initialize F5 for LED
|
||||
setPinOutput(F6); // initialize F6 for LED
|
||||
setPinOutput(F7); // initialize F7 for LED
|
||||
gpio_set_pin_output(F5); // initialize F5 for LED
|
||||
gpio_set_pin_output(F6); // initialize F6 for LED
|
||||
gpio_set_pin_output(F7); // initialize F7 for LED
|
||||
|
||||
}
|
||||
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
writePinLow(F5);
|
||||
writePinLow(F6);
|
||||
writePinLow(F7);
|
||||
gpio_write_pin_low(F5);
|
||||
gpio_write_pin_low(F6);
|
||||
gpio_write_pin_low(F7);
|
||||
switch (get_highest_layer(state)) {
|
||||
case _FN1:
|
||||
writePinHigh(F5);
|
||||
gpio_write_pin_high(F5);
|
||||
break;
|
||||
case _FN2:
|
||||
writePinHigh(F6);
|
||||
gpio_write_pin_high(F6);
|
||||
break;
|
||||
case _FN3: // replace 'XXXX' with the layer or function name
|
||||
writePinHigh(F7);
|
||||
gpio_write_pin_high(F7);
|
||||
break;
|
||||
case KC_F24:
|
||||
writePinHigh(F7);
|
||||
writePinHigh(F5);
|
||||
writePinHigh(F6);
|
||||
gpio_write_pin_high(F7);
|
||||
gpio_write_pin_high(F5);
|
||||
gpio_write_pin_high(F6);
|
||||
break;
|
||||
}
|
||||
return state;
|
||||
|
|
|
@ -75,38 +75,38 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
};
|
||||
|
||||
void keyboard_pre_init_user(void) {
|
||||
setPinOutput(F5); // initialize F5 for LED
|
||||
setPinOutput(F6); // initialize F6 for LED
|
||||
setPinOutput(F7); // initialize F7 for LED
|
||||
gpio_set_pin_output(F5); // initialize F5 for LED
|
||||
gpio_set_pin_output(F6); // initialize F6 for LED
|
||||
gpio_set_pin_output(F7); // initialize F7 for LED
|
||||
|
||||
}
|
||||
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
switch (get_highest_layer(state)) {
|
||||
case _FN1:
|
||||
writePinHigh(F5);
|
||||
writePinLow(F6);
|
||||
writePinLow(F7);
|
||||
gpio_write_pin_high(F5);
|
||||
gpio_write_pin_low(F6);
|
||||
gpio_write_pin_low(F7);
|
||||
break;
|
||||
case _FN2:
|
||||
writePinHigh(F6);
|
||||
writePinLow(F5);
|
||||
writePinLow(F7);
|
||||
gpio_write_pin_high(F6);
|
||||
gpio_write_pin_low(F5);
|
||||
gpio_write_pin_low(F7);
|
||||
break;
|
||||
case _FN3: // replace 'XXXX' with the layer or function name
|
||||
writePinHigh(F7);
|
||||
writePinLow(F5);
|
||||
writePinLow(F6);
|
||||
gpio_write_pin_high(F7);
|
||||
gpio_write_pin_low(F5);
|
||||
gpio_write_pin_low(F6);
|
||||
break;
|
||||
case KC_F24:
|
||||
writePinHigh(F7);
|
||||
writePinHigh(F5);
|
||||
writePinHigh(F6);
|
||||
gpio_write_pin_high(F7);
|
||||
gpio_write_pin_high(F5);
|
||||
gpio_write_pin_high(F6);
|
||||
break;
|
||||
default:
|
||||
writePinLow(F5);
|
||||
writePinLow(F6);
|
||||
writePinLow(F7);
|
||||
gpio_write_pin_low(F5);
|
||||
gpio_write_pin_low(F6);
|
||||
gpio_write_pin_low(F7);
|
||||
break;
|
||||
}
|
||||
return state;
|
||||
|
|
|
@ -49,38 +49,38 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
//Initialize indicator LEDs
|
||||
void matrix_init_user(void) {
|
||||
setPinOutput(B5);
|
||||
writePinLow(B5);
|
||||
setPinOutput(B6);
|
||||
writePinLow(B6);
|
||||
setPinOutput(B7);
|
||||
writePinLow(B7);
|
||||
gpio_set_pin_output(B5);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_set_pin_output(B6);
|
||||
gpio_write_pin_low(B6);
|
||||
gpio_set_pin_output(B7);
|
||||
gpio_write_pin_low(B7);
|
||||
}
|
||||
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
switch (get_highest_layer(state)) {
|
||||
case 1:
|
||||
writePinHigh(B7);
|
||||
writePinLow(B6);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_low(B6);
|
||||
break;
|
||||
case 2:
|
||||
writePinLow(B7);
|
||||
writePinHigh(B6);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_high(B6);
|
||||
break;
|
||||
case 3:
|
||||
writePinHigh(B7);
|
||||
writePinHigh(B6);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_high(B6);
|
||||
break;
|
||||
default:
|
||||
writePinLow(B7);
|
||||
writePinLow(B6);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_low(B6);
|
||||
break;
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
bool led_update_user(led_t led_state) {
|
||||
writePin(B5, led_state.caps_lock);
|
||||
gpio_write_pin(B5, led_state.caps_lock);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -49,34 +49,34 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
//Initialize indicator LEDs
|
||||
void matrix_init_user(void) {
|
||||
setPinOutput(B5);
|
||||
writePinLow(B5);
|
||||
setPinOutput(B6);
|
||||
writePinLow(B6);
|
||||
setPinOutput(B7);
|
||||
writePinLow(B7);
|
||||
gpio_set_pin_output(B5);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_set_pin_output(B6);
|
||||
gpio_write_pin_low(B6);
|
||||
gpio_set_pin_output(B7);
|
||||
gpio_write_pin_low(B7);
|
||||
}
|
||||
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
writePinLow(B7);
|
||||
writePinLow(B6);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_low(B6);
|
||||
switch (get_highest_layer(state)) {
|
||||
case 1:
|
||||
writePinHigh(B7);
|
||||
gpio_write_pin_high(B7);
|
||||
break;
|
||||
case 2:
|
||||
writePinHigh(B6);
|
||||
gpio_write_pin_high(B6);
|
||||
break;
|
||||
case 3:
|
||||
writePinHigh(B7);
|
||||
writePinHigh(B6);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_high(B6);
|
||||
break;
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
bool led_update_user(led_t led_state) {
|
||||
writePin(B5, led_state.caps_lock);
|
||||
gpio_write_pin(B5, led_state.caps_lock);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -49,38 +49,38 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
//Initialize indicator LEDs
|
||||
void matrix_init_user(void) {
|
||||
setPinOutput(B5);
|
||||
writePinLow(B5);
|
||||
setPinOutput(B6);
|
||||
writePinLow(B6);
|
||||
setPinOutput(B7);
|
||||
writePinLow(B7);
|
||||
gpio_set_pin_output(B5);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_set_pin_output(B6);
|
||||
gpio_write_pin_low(B6);
|
||||
gpio_set_pin_output(B7);
|
||||
gpio_write_pin_low(B7);
|
||||
}
|
||||
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
switch (get_highest_layer(state)) {
|
||||
case 1:
|
||||
writePinHigh(B7);
|
||||
writePinLow(B6);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_low(B6);
|
||||
break;
|
||||
case 2:
|
||||
writePinLow(B7);
|
||||
writePinHigh(B6);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_high(B6);
|
||||
break;
|
||||
case 3:
|
||||
writePinHigh(B7);
|
||||
writePinHigh(B6);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_high(B6);
|
||||
break;
|
||||
default:
|
||||
writePinLow(B7);
|
||||
writePinLow(B6);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_low(B6);
|
||||
break;
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
bool led_update_user(led_t led_state) {
|
||||
writePin(B5, led_state.caps_lock);
|
||||
gpio_write_pin(B5, led_state.caps_lock);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -54,13 +54,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
bool led_update_user(led_t led_state) {
|
||||
// Insert custom handling for CAPS_LOCK, NUM_LOCK, SCROLL_LOCK here
|
||||
if (led_state.num_lock) {
|
||||
writePinHigh(F4);
|
||||
writePinHigh(F1);
|
||||
writePinHigh(F5);
|
||||
gpio_write_pin_high(F4);
|
||||
gpio_write_pin_high(F1);
|
||||
gpio_write_pin_high(F5);
|
||||
} else {
|
||||
writePinLow(F4);
|
||||
writePinLow(F1);
|
||||
writePinLow(F5);
|
||||
gpio_write_pin_low(F4);
|
||||
gpio_write_pin_low(F1);
|
||||
gpio_write_pin_low(F5);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -114,20 +114,20 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
}
|
||||
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
writePinLow(B2);
|
||||
writePinLow(B3);
|
||||
writePinLow(B7);
|
||||
gpio_write_pin_low(B2);
|
||||
gpio_write_pin_low(B3);
|
||||
gpio_write_pin_low(B7);
|
||||
|
||||
if (work_louder_config.led_level) {
|
||||
switch (get_highest_layer(state)) {
|
||||
case 1:
|
||||
writePinHigh(B2);
|
||||
gpio_write_pin_high(B2);
|
||||
break;
|
||||
case 2:
|
||||
writePinHigh(B3);
|
||||
gpio_write_pin_high(B3);
|
||||
break;
|
||||
case 3:
|
||||
writePinHigh(B7);
|
||||
gpio_write_pin_high(B7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,26 +56,26 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
switch (get_highest_layer(state)) {
|
||||
case _FN:
|
||||
writePinHigh(D3);
|
||||
writePinLow(D2);
|
||||
gpio_write_pin_high(D3);
|
||||
gpio_write_pin_low(D2);
|
||||
break;
|
||||
case _FNCHAR:
|
||||
writePinLow(D3);
|
||||
writePinHigh(D2);
|
||||
gpio_write_pin_low(D3);
|
||||
gpio_write_pin_high(D2);
|
||||
break;
|
||||
case _FKEYS:
|
||||
writePinHigh(D3);
|
||||
writePinHigh(D2);
|
||||
gpio_write_pin_high(D3);
|
||||
gpio_write_pin_high(D2);
|
||||
break;
|
||||
default: // for any other layers, or the default layer
|
||||
writePinLow(D3);
|
||||
writePinLow(D2);
|
||||
gpio_write_pin_low(D3);
|
||||
gpio_write_pin_low(D2);
|
||||
break;
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
bool led_update_user(led_t led_state) {
|
||||
writePin(D0, led_state.caps_lock);
|
||||
gpio_write_pin(D0, led_state.caps_lock);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -32,21 +32,21 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
void matrix_init_user(void) {
|
||||
// set CapsLock LED to output and low
|
||||
setPinOutput(F6);
|
||||
writePinLow(F6);
|
||||
gpio_set_pin_output(F6);
|
||||
gpio_write_pin_low(F6);
|
||||
// set NumLock LED to output and low
|
||||
setPinOutput(F5);
|
||||
writePinLow(F5);
|
||||
gpio_set_pin_output(F5);
|
||||
gpio_write_pin_low(F5);
|
||||
// set ScrollLock LED to output and low
|
||||
setPinOutput(F4);
|
||||
writePinLow(F4);
|
||||
gpio_set_pin_output(F4);
|
||||
gpio_write_pin_low(F4);
|
||||
}
|
||||
|
||||
layer_state_t layer_state_set_user(layer_state_t state)
|
||||
{
|
||||
writePin(F4, (state & 0x1));
|
||||
writePin(F5, (state & 0x2));
|
||||
writePin(F6, (state & 0x4));
|
||||
gpio_write_pin(F4, (state & 0x1));
|
||||
gpio_write_pin(F5, (state & 0x2));
|
||||
gpio_write_pin(F6, (state & 0x4));
|
||||
return state;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,22 +42,22 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
void matrix_init_user(void) {
|
||||
// set CapsLock LED to output and off (active low)
|
||||
setPinOutput(F5);
|
||||
writePinHigh(F5);
|
||||
gpio_set_pin_output(F5);
|
||||
gpio_write_pin_high(F5);
|
||||
// set NumLock LED to output and off (active low)
|
||||
setPinOutput(F6);
|
||||
writePinHigh(F6);
|
||||
gpio_set_pin_output(F6);
|
||||
gpio_write_pin_high(F6);
|
||||
// set ScrollLock LED to output and off (active low)
|
||||
setPinOutput(F7);
|
||||
writePinHigh(F7);
|
||||
gpio_set_pin_output(F7);
|
||||
gpio_write_pin_high(F7);
|
||||
}
|
||||
|
||||
// write to above indicators in a binary fashion based on current layer
|
||||
layer_state_t layer_state_set_user(layer_state_t state)
|
||||
{
|
||||
writePin(F5, (state & 0x1));
|
||||
writePin(F6, (state & 0x2));
|
||||
writePin(F7, (state & 0x4));
|
||||
gpio_write_pin(F5, (state & 0x1));
|
||||
gpio_write_pin(F6, (state & 0x2));
|
||||
gpio_write_pin(F7, (state & 0x4));
|
||||
return state;
|
||||
}
|
||||
|
||||
|
|
|
@ -59,18 +59,18 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
void matrix_init_user(void) {
|
||||
// set CapsLock LED to output and off (active high)
|
||||
setPinOutput(F5);
|
||||
gpio_set_pin_output(F5);
|
||||
// set NumLock LED to output and off (active high)
|
||||
setPinOutput(F6);
|
||||
gpio_set_pin_output(F6);
|
||||
// set ScrollLock LED to output and off (active high)
|
||||
setPinOutput(F7);
|
||||
gpio_set_pin_output(F7);
|
||||
}
|
||||
|
||||
// write to above indicators in a binary fashion based on current layer
|
||||
layer_state_t layer_state_set_user(layer_state_t state)
|
||||
{
|
||||
writePin(F5, (state & 0x1));
|
||||
writePin(F6, (state & 0x2));
|
||||
writePin(F7, (state & 0x4));
|
||||
gpio_write_pin(F5, (state & 0x1));
|
||||
gpio_write_pin(F6, (state & 0x2));
|
||||
gpio_write_pin(F7, (state & 0x4));
|
||||
return state;
|
||||
}
|
||||
|
|
|
@ -39,27 +39,27 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
|
||||
void matrix_init_user(void) {
|
||||
// set CapsLock LED to output and low
|
||||
setPinOutput(B2);
|
||||
writePinLow(B2);
|
||||
gpio_set_pin_output(B2);
|
||||
gpio_write_pin_low(B2);
|
||||
// set NumLock LED to output and low
|
||||
setPinOutput(B6);
|
||||
writePinLow(B6);
|
||||
gpio_set_pin_output(B6);
|
||||
gpio_write_pin_low(B6);
|
||||
|
||||
}
|
||||
|
||||
layer_state_t layer_state_set_user(layer_state_t state)
|
||||
{
|
||||
if (layer_state_cmp(state, 1)) {
|
||||
writePinHigh(B2);
|
||||
gpio_write_pin_high(B2);
|
||||
} else if (state & (1<<2)) {
|
||||
writePinLow(B2);
|
||||
writePinHigh(B6);
|
||||
gpio_write_pin_low(B2);
|
||||
gpio_write_pin_high(B6);
|
||||
} else if (state & (1<<3)) {
|
||||
writePinHigh(B2);
|
||||
writePinHigh(B6);
|
||||
gpio_write_pin_high(B2);
|
||||
gpio_write_pin_high(B6);
|
||||
} else {
|
||||
writePinLow(B2);
|
||||
writePinLow(B6);
|
||||
gpio_write_pin_low(B2);
|
||||
gpio_write_pin_low(B6);
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
|
|
@ -116,7 +116,7 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) {
|
|||
matrix_io_delay();
|
||||
}
|
||||
// read col data
|
||||
data = ((readPin(A0) << 0) | (readPin(A1) << 1) | (readPin(A2) << 2) | (readPin(A3) << 3) | (readPin(A6) << 4) | (readPin(A7) << 5) | (readPin(B0) << 6));
|
||||
data = ((gpio_read_pin(A0) << 0) | (gpio_read_pin(A1) << 1) | (gpio_read_pin(A2) << 2) | (gpio_read_pin(A3) << 3) | (gpio_read_pin(A6) << 4) | (gpio_read_pin(A7) << 5) | (gpio_read_pin(B0) << 6));
|
||||
// unstrobe row
|
||||
switch (row) {
|
||||
case 0:
|
||||
|
|
Loading…
Reference in New Issue
Block a user