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;

View file

@ -206,8 +206,8 @@ void max7219_init(void) {
wait_ms(1500);
dprintf("max7219_init()\n");
setPinOutput(MAX7219_LOAD);
writePinHigh(MAX7219_LOAD);
gpio_set_pin_output(MAX7219_LOAD);
gpio_write_pin_high(MAX7219_LOAD);
spi_init();
for (int i=0; i<MAX7219_CONTROLLERS; i++) {

View file

@ -2,23 +2,23 @@
void led_init_ports(void) {
// Set our LED pins as output
setPinOutput(B13); // LED1
writePinLow(B13);
setPinOutput(B14); // LED2
writePinLow(B14);
setPinOutput(A8); // LED3
writePinLow(A8);
setPinOutput(A0); // Capslock LED
writePinLow(A0);
gpio_set_pin_output(B13); // LED1
gpio_write_pin_low(B13);
gpio_set_pin_output(B14); // LED2
gpio_write_pin_low(B14);
gpio_set_pin_output(A8); // LED3
gpio_write_pin_low(A8);
gpio_set_pin_output(A0); // Capslock LED
gpio_write_pin_low(A0);
}
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if(res) {
writePin(B13, led_state.num_lock);
writePin(A0, led_state.caps_lock);
writePin(B14, led_state.caps_lock);
writePin(A8, led_state.scroll_lock);
gpio_write_pin(B13, led_state.num_lock);
gpio_write_pin(A0, led_state.caps_lock);
gpio_write_pin(B14, led_state.caps_lock);
gpio_write_pin(A8, led_state.scroll_lock);
}
return res;
}