Update GPIO API usage in keyboard code (#23361)
This commit is contained in:
@@ -18,14 +18,14 @@
|
||||
bool led_update_kb(led_t led_state) {
|
||||
bool res = led_update_user(led_state);
|
||||
if(res) {
|
||||
// writePin sets the pin high for 1 and low for 0.
|
||||
// gpio_write_pin sets the pin high for 1 and low for 0.
|
||||
// In this example the pins are inverted, setting
|
||||
// it low/0 turns it on, and high/1 turns the LED off.
|
||||
// This behavior depends on whether the LED is between the pin
|
||||
// and VCC or the pin and GND.
|
||||
writePin(F4, led_state.num_lock);
|
||||
writePin(F1, led_state.caps_lock);
|
||||
writePin(F5, led_state.scroll_lock);
|
||||
gpio_write_pin(F4, led_state.num_lock);
|
||||
gpio_write_pin(F1, led_state.caps_lock);
|
||||
gpio_write_pin(F5, led_state.scroll_lock);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -18,14 +18,14 @@
|
||||
bool led_update_kb(led_t led_state) {
|
||||
bool res = led_update_user(led_state);
|
||||
if(res) {
|
||||
// writePin sets the pin high for 1 and low for 0.
|
||||
// gpio_write_pin sets the pin high for 1 and low for 0.
|
||||
// In this example the pins are inverted, setting
|
||||
// it low/0 turns it on, and high/1 turns the LED off.
|
||||
// This behavior depends on whether the LED is between the pin
|
||||
// and VCC or the pin and GND.
|
||||
writePin(D3, led_state.num_lock);
|
||||
writePin(D5, led_state.caps_lock);
|
||||
writePin(D2, led_state.scroll_lock);
|
||||
gpio_write_pin(D3, led_state.num_lock);
|
||||
gpio_write_pin(D5, led_state.caps_lock);
|
||||
gpio_write_pin(D2, led_state.scroll_lock);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
#include "quantum.h"
|
||||
|
||||
void keyboard_pre_init_kb (void) {
|
||||
setPinOutput(B12);
|
||||
setPinOutput(B13);
|
||||
gpio_set_pin_output(B12);
|
||||
gpio_set_pin_output(B13);
|
||||
}
|
||||
|
||||
bool led_update_kb(led_t led_state) {
|
||||
bool res = led_update_user(led_state);
|
||||
if(res) {
|
||||
writePin(B13, led_state.caps_lock);
|
||||
gpio_write_pin(B13, led_state.caps_lock);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
__attribute__((weak)) layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
writePin(B12, layer_state_cmp(state, 1));
|
||||
gpio_write_pin(B12, layer_state_cmp(state, 1));
|
||||
return state;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user