mirror of
https://github.com/qmk/qmk_userspace.git
synced 2025-05-04 14:44:16 -04:00
Update GPIO macros in keymaps (#23792)
This commit is contained in:
parent
612f8fb853
commit
d4e88f81ae
21 changed files with 108 additions and 108 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue