Refactor use of led_set_user within handwired/prime_exl (#19274)

This commit is contained in:
Joel Challis 2022-12-09 03:32:47 +00:00 committed by GitHub
parent 96cd333371
commit 89fdafc27d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 71 deletions

View File

@ -40,3 +40,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define LOCKING_SUPPORT_ENABLE #define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */ /* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE #define LOCKING_RESYNC_ENABLE
#define NUM_LOCK_LED_PIN B6
#define CAPS_LOCK_LED_PIN B5
#define SCROLL_LOCK_LED_PIN C6

View File

@ -94,45 +94,17 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true; return true;
} }
void matrix_init_user(void) { bool led_update_user(led_t led_state) {
// set CapsLock LED to output and low writePin(NUM_LOCK_LED_PIN, led_state.num_lock);
setPinOutput(C6); writePin(CAPS_LOCK_LED_PIN, led_state.caps_lock);
writePinHigh(C6); // writePin(SCROLL_LOCK_LED_PIN, led_state.scroll_lock);
// set NumLock LED to output and low return false;
setPinOutput(B6);
writePinHigh(B6);
// set ScrollLock LED to output and low
setPinOutput(B5);
writePinHigh(B5);
}
void led_set_user(uint8_t usb_led) {
if (IS_LED_ON(usb_led, USB_LED_NUM_LOCK)) {
writePinHigh(B6);
} else {
writePinLow(B6);
}
if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
writePinHigh(B5);
} else {
writePinLow(B5);
}
/*
if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) {
writePinHigh(C6);
} else {
writePinLow(C6);
}
*/
} }
//function for layer indicator LED //function for layer indicator LED
layer_state_t layer_state_set_user(layer_state_t state) layer_state_t layer_state_set_user(layer_state_t state)
{ {
if (get_highest_layer(state) == 2) { writePin(SCROLL_LOCK_LED_PIN, (get_highest_layer(state) == 1));
writePinHigh(C6);
} else {
writePinLow(C6);
}
return state; return state;
} }

View File

@ -51,46 +51,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
) )
}; };
bool led_update_user(led_t led_state) {
void matrix_init_user(void) { writePin(NUM_LOCK_LED_PIN, led_state.num_lock);
// set CapsLock LED to output and low writePin(CAPS_LOCK_LED_PIN, led_state.caps_lock);
setPinOutput(C6); // writePin(SCROLL_LOCK_LED_PIN, led_state.scroll_lock);
writePinHigh(C6); return false;
// set NumLock LED to output and low
setPinOutput(B6);
writePinHigh(B6);
// set ScrollLock LED to output and low
setPinOutput(B5);
writePinHigh(B5);
}
void led_set_user(uint8_t usb_led) {
if (IS_LED_ON(usb_led, USB_LED_NUM_LOCK)) {
writePinHigh(B6);
} else {
writePinLow(B6);
}
if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
writePinHigh(B5);
} else {
writePinLow(B5);
}
/*
if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) {
writePinHigh(C6);
} else {
writePinLow(C6);
}
*/
} }
//function for layer indicator LED //function for layer indicator LED
layer_state_t layer_state_set_user(layer_state_t state) layer_state_t layer_state_set_user(layer_state_t state)
{ {
if (get_highest_layer(state) == 1) { writePin(SCROLL_LOCK_LED_PIN, (get_highest_layer(state) == 1));
writePinHigh(C6);
} else {
writePinLow(C6);
}
return state; return state;
} }