Update GPIO API usage in keyboard code (#23361)

This commit is contained in:
Ryan 2024-05-03 15:21:29 +10:00 committed by GitHub
parent 5426a7a129
commit d09a06a1b3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
390 changed files with 3912 additions and 3913 deletions

View file

@ -17,14 +17,14 @@
void matrix_init_kb(void) {
// Set our LED pins as output
setPinOutput(D6);
setPinOutput(B4);
setPinOutput(B5);
setPinOutput(B6);
gpio_set_pin_output(D6);
gpio_set_pin_output(B4);
gpio_set_pin_output(B5);
gpio_set_pin_output(B6);
// Set our Tilt Sensor pins as input
setPinInputHigh(SHAKE_PIN_A);
setPinInputHigh(SHAKE_PIN_B);
gpio_set_pin_input_high(SHAKE_PIN_A);
gpio_set_pin_input_high(SHAKE_PIN_B);
// Run the keymap level init
matrix_init_user();
@ -43,12 +43,12 @@ void check_encoder_buttons(void) {
if (drawing_mode) {
dprintf("Turning drawing mode off.\n");
drawing_mode = false;
writePinLow(D6);
gpio_write_pin_low(D6);
unregister_code(KC_BTN1);
} else {
dprintf("Turning drawing mode on.\n");
drawing_mode = true;
writePinHigh(D6);
gpio_write_pin_high(D6);
register_code(KC_BTN1);
}
}
@ -65,7 +65,7 @@ void matrix_scan_kb(void) {
#ifdef SHAKE_ENABLE
// Read the current state of the tilt sensor. It is physically
// impossible for both pins to register a low state at the same time.
uint8_t tilt_read = (readPin(SHAKE_PIN_A) << 4) | readPin(SHAKE_PIN_B);
uint8_t tilt_read = (gpio_read_pin(SHAKE_PIN_A) << 4) | gpio_read_pin(SHAKE_PIN_B);
// Check to see if the tilt sensor has changed state since our last read
if (tilt_state != tilt_read) {
@ -136,9 +136,9 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if(res) {
writePin(B4, !led_state.num_lock);
writePin(B5, !led_state.caps_lock);
writePin(B6, !led_state.scroll_lock);
gpio_write_pin(B4, !led_state.num_lock);
gpio_write_pin(B5, !led_state.caps_lock);
gpio_write_pin(B6, !led_state.scroll_lock);
}
return res;