diff --git a/keyboards/3w6/rev1/matrix.c b/keyboards/3w6/rev1/matrix.c index aa3e43fbe0..0c06a743a1 100644 --- a/keyboards/3w6/rev1/matrix.c +++ b/keyboards/3w6/rev1/matrix.c @@ -165,8 +165,8 @@ static void init_cols(void) { pin_t matrix_col_pins_mcu[MATRIX_COLS_PER_SIDE] = MATRIX_COL_PINS_L; for (int pin_index = 0; pin_index < MATRIX_COLS_PER_SIDE; pin_index++) { pin_t pin = matrix_col_pins_mcu[pin_index]; - setPinInput(pin); - writePinHigh(pin); + gpio_set_pin_input(pin); + gpio_write_pin_high(pin); } } @@ -177,7 +177,7 @@ static matrix_row_t read_cols(uint8_t row) { // For each col... for (uint8_t col_index = 0; col_index < MATRIX_COLS_PER_SIDE; col_index++) { // Select the col pin to read (active low) - uint8_t pin_state = readPin(matrix_col_pins_mcu[col_index]); + uint8_t pin_state = gpio_read_pin(matrix_col_pins_mcu[col_index]); // Populate the matrix row with the state of the col pin current_row_value |= pin_state ? 0 : (MATRIX_ROW_SHIFTER << col_index); @@ -223,8 +223,8 @@ static void unselect_rows(void) { pin_t matrix_row_pins_mcu[MATRIX_ROWS_PER_SIDE] = MATRIX_ROW_PINS_L; for (int pin_index = 0; pin_index < MATRIX_ROWS_PER_SIDE; pin_index++) { pin_t pin = matrix_row_pins_mcu[pin_index]; - setPinInput(pin); - writePinLow(pin); + gpio_set_pin_input(pin); + gpio_write_pin_low(pin); } } @@ -236,8 +236,8 @@ static void select_row(uint8_t row) { // select on atmega32u4 pin_t matrix_row_pins_mcu[MATRIX_ROWS_PER_SIDE] = MATRIX_ROW_PINS_L; pin_t pin = matrix_row_pins_mcu[row]; - setPinOutput(pin); - writePinLow(pin); + gpio_set_pin_output(pin); + gpio_write_pin_low(pin); } else { // select on tca9555 if (tca9555_status) { // if there was an error diff --git a/keyboards/3w6/rev2/matrix.c b/keyboards/3w6/rev2/matrix.c index da7a5344e5..8c628215aa 100644 --- a/keyboards/3w6/rev2/matrix.c +++ b/keyboards/3w6/rev2/matrix.c @@ -165,8 +165,8 @@ static void init_cols(void) { pin_t matrix_col_pins_mcu[MATRIX_COLS_PER_SIDE] = MATRIX_COL_PINS_L; for (int pin_index = 0; pin_index < MATRIX_COLS_PER_SIDE; pin_index++) { pin_t pin = matrix_col_pins_mcu[pin_index]; - setPinInput(pin); - writePinHigh(pin); + gpio_set_pin_input(pin); + gpio_write_pin_high(pin); } } @@ -177,7 +177,7 @@ static matrix_row_t read_cols(uint8_t row) { // For each col... for (uint8_t col_index = 0; col_index < MATRIX_COLS_PER_SIDE; col_index++) { // Select the col pin to read (active low) - uint8_t pin_state = readPin(matrix_col_pins_mcu[col_index]); + uint8_t pin_state = gpio_read_pin(matrix_col_pins_mcu[col_index]); // Populate the matrix row with the state of the col pin current_row_value |= pin_state ? 0 : (MATRIX_ROW_SHIFTER << col_index); @@ -221,8 +221,8 @@ static void unselect_rows(void) { pin_t matrix_row_pins_mcu[MATRIX_ROWS_PER_SIDE] = MATRIX_ROW_PINS_L; for (int pin_index = 0; pin_index < MATRIX_ROWS_PER_SIDE; pin_index++) { pin_t pin = matrix_row_pins_mcu[pin_index]; - setPinInput(pin); - writePinLow(pin); + gpio_set_pin_input(pin); + gpio_write_pin_low(pin); } } @@ -233,8 +233,8 @@ static void select_row(uint8_t row) { // select on atmega32u4 pin_t matrix_row_pins_mcu[MATRIX_ROWS_PER_SIDE] = MATRIX_ROW_PINS_L; pin_t pin = matrix_row_pins_mcu[row]; - setPinOutput(pin); - writePinLow(pin); + gpio_set_pin_output(pin); + gpio_write_pin_low(pin); } else { // select on tca9555 if (tca9555_status) { // if there was an error diff --git a/keyboards/40percentclub/4pack/4pack.c b/keyboards/40percentclub/4pack/4pack.c index bd2efa5620..044ce45681 100644 --- a/keyboards/40percentclub/4pack/4pack.c +++ b/keyboards/40percentclub/4pack/4pack.c @@ -23,8 +23,8 @@ void matrix_init_kb(void) { // put your keyboard start-up code here // runs once when the firmware starts up - setPinOutput(F4); // cathodes - setPinOutput(F5); // cathodes + gpio_set_pin_output(F4); // cathodes + gpio_set_pin_output(F5); // cathodes // Do the rest matrix_init_user(); diff --git a/keyboards/40percentclub/sixpack/sixpack.c b/keyboards/40percentclub/sixpack/sixpack.c index c8c7bad444..fa7609c97f 100644 --- a/keyboards/40percentclub/sixpack/sixpack.c +++ b/keyboards/40percentclub/sixpack/sixpack.c @@ -16,9 +16,9 @@ #include "quantum.h" void matrix_init_kb(void) { - setPinOutput(B6); // Backlight cathodes Col.3 - setPinOutput(F6); // Backlight cathodes Col.2 - setPinOutput(F7); // Backlight cathodes Col.1 + gpio_set_pin_output(B6); // Backlight cathodes Col.3 + gpio_set_pin_output(F6); // Backlight cathodes Col.2 + gpio_set_pin_output(F7); // Backlight cathodes Col.1 matrix_init_user(); } diff --git a/keyboards/4pplet/eagle_viper_rep/rev_a/rev_a.c b/keyboards/4pplet/eagle_viper_rep/rev_a/rev_a.c index 2971460bd2..4586044a94 100644 --- a/keyboards/4pplet/eagle_viper_rep/rev_a/rev_a.c +++ b/keyboards/4pplet/eagle_viper_rep/rev_a/rev_a.c @@ -17,9 +17,9 @@ along with this program. If not, see . #include "rev_a.h" void board_init(void) { - setPinInputHigh(CAPS_PIN); - setPinInputHigh(SCROLL_PIN); - setPinInputHigh(NUM_PIN); + gpio_set_pin_input_high(CAPS_PIN); + gpio_set_pin_input_high(SCROLL_PIN); + gpio_set_pin_input_high(NUM_PIN); } /* Set indicator leds to indicate lock states */ @@ -27,23 +27,23 @@ bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if(res && LOCK_LIGHTS) { if(led_state.caps_lock){ - setPinOutput(CAPS_PIN); - writePin(CAPS_PIN, 0); + gpio_set_pin_output(CAPS_PIN); + gpio_write_pin(CAPS_PIN, 0); } else - setPinInputHigh(CAPS_PIN); + gpio_set_pin_input_high(CAPS_PIN); if(led_state.scroll_lock){ - setPinOutput(SCROLL_PIN); - writePin(SCROLL_PIN, 0); + gpio_set_pin_output(SCROLL_PIN); + gpio_write_pin(SCROLL_PIN, 0); } else - setPinInputHigh(SCROLL_PIN); + gpio_set_pin_input_high(SCROLL_PIN); if(led_state.num_lock){ - setPinOutput(NUM_PIN); - writePin(NUM_PIN, 0); + gpio_set_pin_output(NUM_PIN); + gpio_write_pin(NUM_PIN, 0); } else - setPinInputHigh(NUM_PIN); + gpio_set_pin_input_high(NUM_PIN); } return res; } @@ -59,50 +59,50 @@ layer_state_t layer_state_set_kb(layer_state_t state) { void setLayerLed(layer_state_t state){ switch(get_highest_layer(state)){ case 0 : - setPinOutput(LAYER_1); - writePin(LAYER_1, 0); - setPinInputHigh(LAYER_2); - setPinInputHigh(LAYER_3); - setPinInputHigh(LAYER_4); - setPinInputHigh(LAYER_5); + gpio_set_pin_output(LAYER_1); + gpio_write_pin(LAYER_1, 0); + gpio_set_pin_input_high(LAYER_2); + gpio_set_pin_input_high(LAYER_3); + gpio_set_pin_input_high(LAYER_4); + gpio_set_pin_input_high(LAYER_5); break; case 1 : - setPinOutput(LAYER_2); - writePin(LAYER_2, 0); - setPinInputHigh(LAYER_1); - setPinInputHigh(LAYER_3); - setPinInputHigh(LAYER_4); - setPinInputHigh(LAYER_5); + gpio_set_pin_output(LAYER_2); + gpio_write_pin(LAYER_2, 0); + gpio_set_pin_input_high(LAYER_1); + gpio_set_pin_input_high(LAYER_3); + gpio_set_pin_input_high(LAYER_4); + gpio_set_pin_input_high(LAYER_5); break; case 2 : - setPinOutput(LAYER_3); - writePin(LAYER_3, 0); - setPinInputHigh(LAYER_1); - setPinInputHigh(LAYER_2); - setPinInputHigh(LAYER_4); - setPinInputHigh(LAYER_5); + gpio_set_pin_output(LAYER_3); + gpio_write_pin(LAYER_3, 0); + gpio_set_pin_input_high(LAYER_1); + gpio_set_pin_input_high(LAYER_2); + gpio_set_pin_input_high(LAYER_4); + gpio_set_pin_input_high(LAYER_5); break; case 3 : - writePin(LAYER_4, 0); - setPinInputHigh(LAYER_5); - setPinInputHigh(LAYER_1); - setPinInputHigh(LAYER_2); - setPinInputHigh(LAYER_3); - setPinOutput(LAYER_4); + gpio_write_pin(LAYER_4, 0); + gpio_set_pin_input_high(LAYER_5); + gpio_set_pin_input_high(LAYER_1); + gpio_set_pin_input_high(LAYER_2); + gpio_set_pin_input_high(LAYER_3); + gpio_set_pin_output(LAYER_4); break; case 4 : - setPinOutput(LAYER_5); - writePin(LAYER_5, 0); - setPinInputHigh(LAYER_1); - setPinInputHigh(LAYER_2); - setPinInputHigh(LAYER_3); - setPinInputHigh(LAYER_4); + gpio_set_pin_output(LAYER_5); + gpio_write_pin(LAYER_5, 0); + gpio_set_pin_input_high(LAYER_1); + gpio_set_pin_input_high(LAYER_2); + gpio_set_pin_input_high(LAYER_3); + gpio_set_pin_input_high(LAYER_4); break; default : - setPinInputHigh(LAYER_1); - setPinInputHigh(LAYER_2); - setPinInputHigh(LAYER_3); - setPinInputHigh(LAYER_4); - setPinInputHigh(LAYER_5); + gpio_set_pin_input_high(LAYER_1); + gpio_set_pin_input_high(LAYER_2); + gpio_set_pin_input_high(LAYER_3); + gpio_set_pin_input_high(LAYER_4); + gpio_set_pin_input_high(LAYER_5); } } diff --git a/keyboards/4pplet/eagle_viper_rep/rev_b/rev_b.c b/keyboards/4pplet/eagle_viper_rep/rev_b/rev_b.c index 2e71e34a26..ab052790c3 100644 --- a/keyboards/4pplet/eagle_viper_rep/rev_b/rev_b.c +++ b/keyboards/4pplet/eagle_viper_rep/rev_b/rev_b.c @@ -17,11 +17,11 @@ along with this program. If not, see . #include "rev_b.h" void keyboard_pre_init_kb(void) { - setPinOutput(LAYER_1); - setPinOutput(LAYER_2); - setPinOutput(LAYER_3); - setPinOutput(LAYER_4); - setPinOutput(LAYER_5); + gpio_set_pin_output(LAYER_1); + gpio_set_pin_output(LAYER_2); + gpio_set_pin_output(LAYER_3); + gpio_set_pin_output(LAYER_4); + gpio_set_pin_output(LAYER_5); keyboard_pre_init_user(); } @@ -32,26 +32,26 @@ layer_state_t layer_state_set_kb(layer_state_t state) { } /* Set indicator leds to indicate which layer is active */ void setLayerLed(layer_state_t state){ - writePinLow(LAYER_1); - writePinLow(LAYER_2); - writePinLow(LAYER_3); - writePinLow(LAYER_4); - writePinLow(LAYER_5); + gpio_write_pin_low(LAYER_1); + gpio_write_pin_low(LAYER_2); + gpio_write_pin_low(LAYER_3); + gpio_write_pin_low(LAYER_4); + gpio_write_pin_low(LAYER_5); switch (get_highest_layer(state)) { case 0: - writePinHigh(LAYER_1); + gpio_write_pin_high(LAYER_1); break; case 1: - writePinHigh(LAYER_2); + gpio_write_pin_high(LAYER_2); break; case 2: - writePinHigh(LAYER_3); + gpio_write_pin_high(LAYER_3); break; case 3: - writePinHigh(LAYER_4); + gpio_write_pin_high(LAYER_4); break; case 4: - writePinHigh(LAYER_5); + gpio_write_pin_high(LAYER_5); break; } } diff --git a/keyboards/acheron/apollo/87h/delta/delta.c b/keyboards/acheron/apollo/87h/delta/delta.c index 1e79584a9c..b17fce5c3a 100644 --- a/keyboards/acheron/apollo/87h/delta/delta.c +++ b/keyboards/acheron/apollo/87h/delta/delta.c @@ -18,8 +18,8 @@ along with this program. If not, see . #include "quantum.h" void board_init(void) { - setPinInput(B9); - setPinInput(B10); + gpio_set_pin_input(B9); + gpio_set_pin_input(B10); } led_config_t g_led_config = { { diff --git a/keyboards/acheron/apollo/87htsc/87htsc.c b/keyboards/acheron/apollo/87htsc/87htsc.c index de66897f72..4225c34971 100644 --- a/keyboards/acheron/apollo/87htsc/87htsc.c +++ b/keyboards/acheron/apollo/87htsc/87htsc.c @@ -18,8 +18,8 @@ along with this program. If not, see . #include "quantum.h" void board_init(void) { - setPinInput(B9); - setPinInput(B10); + gpio_set_pin_input(B9); + gpio_set_pin_input(B10); } led_config_t g_led_config = { { diff --git a/keyboards/acheron/athena/alpha/alpha.c b/keyboards/acheron/athena/alpha/alpha.c index 9e4f82f7ad..8fe47eff82 100644 --- a/keyboards/acheron/athena/alpha/alpha.c +++ b/keyboards/acheron/athena/alpha/alpha.c @@ -17,8 +17,8 @@ #include "quantum.h" void board_init(void) { - setPinInput(B6); - setPinInput(B7); + gpio_set_pin_input(B6); + gpio_set_pin_input(B7); } void keyboard_post_init_kb(void){ @@ -34,10 +34,10 @@ bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); #ifdef CAPSLOCK_INDICATOR if(res) { - writePin(LED_CAPS_LOCK_PIN, !led_state.caps_lock); + gpio_write_pin(LED_CAPS_LOCK_PIN, !led_state.caps_lock); } #else - writePin(LED_CAPS_LOCK_PIN, 0); + gpio_write_pin(LED_CAPS_LOCK_PIN, 0); #endif return res; } diff --git a/keyboards/acheron/athena/beta/beta.c b/keyboards/acheron/athena/beta/beta.c index 9ad9c71cc8..fe22128437 100644 --- a/keyboards/acheron/athena/beta/beta.c +++ b/keyboards/acheron/athena/beta/beta.c @@ -17,18 +17,18 @@ #include "quantum.h" void board_init(void) { - setPinInput(B6); - setPinInput(B7); + gpio_set_pin_input(B6); + gpio_set_pin_input(B7); } bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); #ifdef CAPSLOCK_INDICATOR if(res) { - writePin(LED_CAPS_LOCK_PIN, led_state.caps_lock); + gpio_write_pin(LED_CAPS_LOCK_PIN, led_state.caps_lock); } #else - writePin(LED_CAPS_LOCK_PIN, 0); + gpio_write_pin(LED_CAPS_LOCK_PIN, 0); #endif return res; } diff --git a/keyboards/acheron/austin/austin.c b/keyboards/acheron/austin/austin.c index 5c0a4f642d..9a69d1c086 100644 --- a/keyboards/acheron/austin/austin.c +++ b/keyboards/acheron/austin/austin.c @@ -1,18 +1,18 @@ #include "quantum.h" void keyboard_pre_init_kb(void) { - setPinOutput(A0); - setPinOutput(A1); - setPinOutput(A2); + gpio_set_pin_output(A0); + gpio_set_pin_output(A1); + gpio_set_pin_output(A2); keyboard_pre_init_user(); } bool led_update_kb(led_t led_state) { if (led_update_user(led_state)) { - writePin(A2, led_state.num_lock); - writePin(A0, led_state.caps_lock); - writePin(A1, led_state.scroll_lock); + gpio_write_pin(A2, led_state.num_lock); + gpio_write_pin(A0, led_state.caps_lock); + gpio_write_pin(A1, led_state.scroll_lock); } return true; } diff --git a/keyboards/acheron/elongate/delta/delta.c b/keyboards/acheron/elongate/delta/delta.c index e621b4495b..98b60bae61 100755 --- a/keyboards/acheron/elongate/delta/delta.c +++ b/keyboards/acheron/elongate/delta/delta.c @@ -30,18 +30,18 @@ void led_init_ports(void) { bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if(res) { - writePin(LED1_PIN, !led_state.num_lock); - writePin(LED2_PIN, !led_state.caps_lock); - writePin(LED3_PIN, !led_state.scroll_lock); + gpio_write_pin(LED1_PIN, !led_state.num_lock); + gpio_write_pin(LED2_PIN, !led_state.caps_lock); + gpio_write_pin(LED3_PIN, !led_state.scroll_lock); } return res; } // Turns off all bottom LEDs void turn_off_bottom_leds(void){ - writePin(LED4_PIN, 1); - writePin(LED5_PIN, 1); - writePin(LED6_PIN, 1); + gpio_write_pin(LED4_PIN, 1); + gpio_write_pin(LED5_PIN, 1); + gpio_write_pin(LED6_PIN, 1); } /* @@ -53,19 +53,19 @@ layer_state_t layer_state_set_kb(layer_state_t state) { switch (get_highest_layer(state)) { // The base layer, or layer zero, will be handled by the default case. case 1: - writePin(LED4_PIN, 1); - writePin(LED5_PIN, 0); - writePin(LED6_PIN, 1); + gpio_write_pin(LED4_PIN, 1); + gpio_write_pin(LED5_PIN, 0); + gpio_write_pin(LED6_PIN, 1); break; case 2: - writePin(LED4_PIN, 1); - writePin(LED5_PIN, 1); - writePin(LED6_PIN, 0); + gpio_write_pin(LED4_PIN, 1); + gpio_write_pin(LED5_PIN, 1); + gpio_write_pin(LED6_PIN, 0); break; default: - writePin(LED4_PIN, 0); - writePin(LED5_PIN, 1); - writePin(LED6_PIN, 1); + gpio_write_pin(LED4_PIN, 0); + gpio_write_pin(LED5_PIN, 1); + gpio_write_pin(LED6_PIN, 1); break; } return state; @@ -73,5 +73,5 @@ layer_state_t layer_state_set_kb(layer_state_t state) { // Since the keyboard starts at layer 0, the init function starts LED4 as lit up. void keyboard_post_init_kb(void){ - writePin(LED4_PIN, 0); + gpio_write_pin(LED4_PIN, 0); } diff --git a/keyboards/acheron/shark/beta/beta.c b/keyboards/acheron/shark/beta/beta.c index 5592353ad7..647dac60b7 100644 --- a/keyboards/acheron/shark/beta/beta.c +++ b/keyboards/acheron/shark/beta/beta.c @@ -17,6 +17,6 @@ #include "quantum.h" void board_init(void) { - setPinInput(B6); - setPinInput(B7); + gpio_set_pin_input(B6); + gpio_set_pin_input(B7); } diff --git a/keyboards/aeboards/ext65/rev1/rev1.c b/keyboards/aeboards/ext65/rev1/rev1.c index adbae94816..344a2bcb32 100644 --- a/keyboards/aeboards/ext65/rev1/rev1.c +++ b/keyboards/aeboards/ext65/rev1/rev1.c @@ -19,18 +19,18 @@ void keyboard_pre_init_user(void) { // Call the keyboard pre init code. // Set our LED pins as output - setPinOutput(D5); - setPinOutput(D3); - setPinOutput(D2); - setPinOutput(D1); + gpio_set_pin_output(D5); + gpio_set_pin_output(D3); + gpio_set_pin_output(D2); + gpio_set_pin_output(D1); } bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if(res) { - writePin(D5, led_state.num_lock); - writePin(D3, led_state.caps_lock); - writePin(D2, led_state.scroll_lock); + gpio_write_pin(D5, led_state.num_lock); + gpio_write_pin(D3, led_state.caps_lock); + gpio_write_pin(D2, led_state.scroll_lock); } return res; } @@ -38,10 +38,10 @@ bool led_update_kb(led_t led_state) { layer_state_t layer_state_set_kb(layer_state_t state) { switch (get_highest_layer(state)) { case 1: - writePinHigh(D1); + gpio_write_pin_high(D1); break; default: // for any other layers, or the default layer - writePinLow(D1); + gpio_write_pin_low(D1); break; } return layer_state_set_user(state); diff --git a/keyboards/aeboards/ext65/rev2/rev2.c b/keyboards/aeboards/ext65/rev2/rev2.c index 934553abcf..5922b601cd 100644 --- a/keyboards/aeboards/ext65/rev2/rev2.c +++ b/keyboards/aeboards/ext65/rev2/rev2.c @@ -71,10 +71,10 @@ bool oled_task_kb(void) { void keyboard_pre_init_kb(void) { // Call the keyboard pre init code. // Set our LED pins as output - setPinOutput(B4); - setPinOutput(B3); - setPinOutput(A15); - setPinOutput(A14); + gpio_set_pin_output(B4); + gpio_set_pin_output(B3); + gpio_set_pin_output(A15); + gpio_set_pin_output(A14); keyboard_pre_init_user(); } @@ -82,9 +82,9 @@ void keyboard_pre_init_kb(void) { bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if (res) { - writePin(B4, led_state.num_lock); - writePin(B3, led_state.caps_lock); - writePin(A15, led_state.scroll_lock); + gpio_write_pin(B4, led_state.num_lock); + gpio_write_pin(B3, led_state.caps_lock); + gpio_write_pin(A15, led_state.scroll_lock); } return res; } @@ -92,10 +92,10 @@ bool led_update_kb(led_t led_state) { layer_state_t layer_state_set_kb(layer_state_t state) { switch (get_highest_layer(state)) { case 1: - writePinHigh(A14); + gpio_write_pin_high(A14); break; default: // for any other layers, or the default layer - writePinLow(A14); + gpio_write_pin_low(A14); break; } return layer_state_set_user(state); diff --git a/keyboards/aeboards/ext65/rev3/rev3.c b/keyboards/aeboards/ext65/rev3/rev3.c index b5e27756ec..f8fc2ef502 100644 --- a/keyboards/aeboards/ext65/rev3/rev3.c +++ b/keyboards/aeboards/ext65/rev3/rev3.c @@ -22,16 +22,16 @@ void matrix_io_delay(void) { __asm__ volatile("nop\nnop\nnop\n"); } void keyboard_pre_init_user(void) { // Call the keyboard pre init code. // Set our LED pins as output - setPinOutput(LED_LAYERS_PIN); + gpio_set_pin_output(LED_LAYERS_PIN); } layer_state_t layer_state_set_kb(layer_state_t state) { switch (get_highest_layer(state)) { case 1: - writePinHigh(LED_LAYERS_PIN); + gpio_write_pin_high(LED_LAYERS_PIN); break; default: // for any other layers, or the default layer - writePinLow(LED_LAYERS_PIN); + gpio_write_pin_low(LED_LAYERS_PIN); break; } return layer_state_set_user(state); diff --git a/keyboards/ai03/orbit/orbit.c b/keyboards/ai03/orbit/orbit.c index 5097f9cd90..0c1e0dc32e 100644 --- a/keyboards/ai03/orbit/orbit.c +++ b/keyboards/ai03/orbit/orbit.c @@ -19,13 +19,13 @@ void led_init_ports(void) { // Initialize indicator LEDs to output if (isLeftHand) { - setPinOutput(C6); - setPinOutput(B6); - setPinOutput(B5); + gpio_set_pin_output(C6); + gpio_set_pin_output(B6); + gpio_set_pin_output(B5); } else { - setPinOutput(F6); - setPinOutput(F7); - setPinOutput(C7); + gpio_set_pin_output(F6); + gpio_set_pin_output(F7); + gpio_set_pin_output(C7); } set_layer_indicators(0); @@ -40,15 +40,15 @@ void led_toggle(uint8_t id, bool on) { switch (id) { case 0: // Left hand C6 - writePin(C6, on); + gpio_write_pin(C6, on); break; case 1: // Left hand B6 - writePin(B6, on); + gpio_write_pin(B6, on); break; case 2: // Left hand B5 - writePin(B5, on); + gpio_write_pin(B5, on); break; default: break; @@ -57,15 +57,15 @@ void led_toggle(uint8_t id, bool on) { switch (id) { case 3: // Right hand F6 - writePin(F6, on); + gpio_write_pin(F6, on); break; case 4: // Right hand F7 - writePin(F7, on); + gpio_write_pin(F7, on); break; case 5: // Right hand C7 - writePin(C7, on); + gpio_write_pin(C7, on); break; default: break; diff --git a/keyboards/ai03/vega/vega.c b/keyboards/ai03/vega/vega.c index 6ed1651e50..44ded2c85c 100644 --- a/keyboards/ai03/vega/vega.c +++ b/keyboards/ai03/vega/vega.c @@ -19,8 +19,8 @@ void matrix_init_kb(void) { // Initialize indicator LEDs to output - setPinOutput(B7); // Caps - setPinOutput(A5); // Slck + gpio_set_pin_output(B7); // Caps + gpio_set_pin_output(A5); // Slck matrix_init_user(); } @@ -30,8 +30,8 @@ bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if(res) { - writePin(B7, !led_state.caps_lock); - writePin(A5, !led_state.scroll_lock); + gpio_write_pin(B7, !led_state.caps_lock); + gpio_write_pin(A5, !led_state.scroll_lock); } return res; } \ No newline at end of file diff --git a/keyboards/akko/5087/5087.c b/keyboards/akko/5087/5087.c index 7dd614b456..746a9a7816 100644 --- a/keyboards/akko/5087/5087.c +++ b/keyboards/akko/5087/5087.c @@ -137,17 +137,17 @@ enum __layers { // clang-format on void matrix_init_kb(void) { - setPinOutput(LED_MAC_OS_PIN); // LDE2 MAC\WIN - writePinLow(LED_MAC_OS_PIN); - setPinOutput(LED_WIN_LOCK_PIN); // LED3 Win Lock - writePinLow(LED_WIN_LOCK_PIN); + gpio_set_pin_output(LED_MAC_OS_PIN); // LDE2 MAC\WIN + gpio_write_pin_low(LED_MAC_OS_PIN); + gpio_set_pin_output(LED_WIN_LOCK_PIN); // LED3 Win Lock + gpio_write_pin_low(LED_WIN_LOCK_PIN); matrix_init_user(); } void housekeeping_task_kb(void){ - writePin(LED_MAC_OS_PIN, (get_highest_layer(default_layer_state) == 3)); - writePin(LED_WIN_LOCK_PIN, keymap_config.no_gui); + gpio_write_pin(LED_MAC_OS_PIN, (get_highest_layer(default_layer_state) == 3)); + gpio_write_pin(LED_WIN_LOCK_PIN, keymap_config.no_gui); } bool process_record_kb(uint16_t keycode, keyrecord_t* record) { diff --git a/keyboards/akko/5108/5108.c b/keyboards/akko/5108/5108.c index 91526289b6..7330707f45 100644 --- a/keyboards/akko/5108/5108.c +++ b/keyboards/akko/5108/5108.c @@ -148,15 +148,15 @@ const snled27351_led_t PROGMEM g_snled27351_leds[SNLED27351_LED_COUNT] = { #endif void keyboard_pre_init_kb(void) { - setPinOutput(LED_WIN_LOCK_PIN); // LED3 Win Lock - writePinLow(LED_WIN_LOCK_PIN); + gpio_set_pin_output(LED_WIN_LOCK_PIN); // LED3 Win Lock + gpio_write_pin_low(LED_WIN_LOCK_PIN); keyboard_pre_init_user(); } bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if (res) { - writePin(LED_WIN_LOCK_PIN, keymap_config.no_gui); + gpio_write_pin(LED_WIN_LOCK_PIN, keymap_config.no_gui); } return res; } diff --git a/keyboards/al1/matrix.c b/keyboards/al1/matrix.c index e3d7971f1c..508a2b5ea9 100644 --- a/keyboards/al1/matrix.c +++ b/keyboards/al1/matrix.c @@ -48,7 +48,7 @@ static void select_col(uint8_t col) { static void init_pins(void) { for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } } @@ -65,7 +65,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) matrix_row_t last_row_value = current_matrix[row_index]; // Check row pin state - if (readPin(row_pins[row_index]) == 0) { + if (gpio_read_pin(row_pins[row_index]) == 0) { // Pin LO, set col bit current_matrix[row_index] |= (MATRIX_ROW_SHIFTER << current_col); } else { diff --git a/keyboards/anavi/knob1/knob1.c b/keyboards/anavi/knob1/knob1.c index bb6f1e38bf..5e63ef4f32 100644 --- a/keyboards/anavi/knob1/knob1.c +++ b/keyboards/anavi/knob1/knob1.c @@ -6,8 +6,8 @@ void keyboard_post_init_kb(void) { // Enable RGB LED - setPinOutput(GP11); - writePinHigh(GP11); + gpio_set_pin_output(GP11); + gpio_write_pin_high(GP11); rgblight_enable(); // Offload to the user func diff --git a/keyboards/anavi/knobs3/knobs3.c b/keyboards/anavi/knobs3/knobs3.c index efae010163..01b3b60c6f 100644 --- a/keyboards/anavi/knobs3/knobs3.c +++ b/keyboards/anavi/knobs3/knobs3.c @@ -6,8 +6,8 @@ void keyboard_post_init_kb(void) { // Enable RGB LED - setPinOutput(GP11); - writePinHigh(GP11); + gpio_set_pin_output(GP11); + gpio_write_pin_high(GP11); rgblight_enable(); // Offload to the user func diff --git a/keyboards/argyle/matrix.c b/keyboards/argyle/matrix.c index d723392a01..d435b368c2 100644 --- a/keyboards/argyle/matrix.c +++ b/keyboards/argyle/matrix.c @@ -26,27 +26,27 @@ static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; static inline void setPinOutput_writeLow(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinLow(pin); + gpio_set_pin_output(pin); + gpio_write_pin_low(pin); } } static inline void setPinOutput_writeHigh(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinHigh(pin); + gpio_set_pin_output(pin); + gpio_write_pin_high(pin); } } static inline void setPinInputHigh_atomic(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinInputHigh(pin); + gpio_set_pin_input_high(pin); } } static inline uint8_t readMatrixPin(pin_t pin) { if (pin != NO_PIN) { - return (readPin(pin) == 0) ? 0 : 1; + return (gpio_read_pin(pin) == 0) ? 0 : 1; } else { return 1; } diff --git a/keyboards/artifact/lvl/rev_hs01/rev_hs01.c b/keyboards/artifact/lvl/rev_hs01/rev_hs01.c index 6266ef69ad..fdbfa8f272 100755 --- a/keyboards/artifact/lvl/rev_hs01/rev_hs01.c +++ b/keyboards/artifact/lvl/rev_hs01/rev_hs01.c @@ -17,5 +17,5 @@ void led_init_ports(void) { // Set our LED pins as open drain outputs - setPinOutputOpenDrain(LED_CAPS_LOCK_PIN); + gpio_set_pin_output_open_drain(LED_CAPS_LOCK_PIN); } diff --git a/keyboards/atlantis/ps17/ps17.c b/keyboards/atlantis/ps17/ps17.c index d660bdee6a..8caf8a2e8f 100644 --- a/keyboards/atlantis/ps17/ps17.c +++ b/keyboards/atlantis/ps17/ps17.c @@ -5,26 +5,26 @@ layer_state_t layer_state_set_kb(layer_state_t state) { /* Display current layer using indicator LEDs */ - writePin(LED_INDICATOR_0_PIN, !IS_LAYER_ON_STATE(state, 1)); - writePin(LED_INDICATOR_1_PIN, !IS_LAYER_ON_STATE(state, 2)); - writePin(LED_INDICATOR_2_PIN, !IS_LAYER_ON_STATE(state, 3)); + gpio_write_pin(LED_INDICATOR_0_PIN, !IS_LAYER_ON_STATE(state, 1)); + gpio_write_pin(LED_INDICATOR_1_PIN, !IS_LAYER_ON_STATE(state, 2)); + gpio_write_pin(LED_INDICATOR_2_PIN, !IS_LAYER_ON_STATE(state, 3)); return layer_state_set_user(state); } void keyboard_pre_init_kb(void) { /* Set indicator LEDs as outputs */ - setPinOutput(LED_INDICATOR_0_PIN); - setPinOutput(LED_INDICATOR_1_PIN); - setPinOutput(LED_INDICATOR_2_PIN); + gpio_set_pin_output(LED_INDICATOR_0_PIN); + gpio_set_pin_output(LED_INDICATOR_1_PIN); + gpio_set_pin_output(LED_INDICATOR_2_PIN); keyboard_pre_init_user(); } #ifdef RGB_MATRIX_ENABLE void suspend_power_down_kb(void) { /* Disable indicator LEDs when going to sleep */ - writePin(LED_INDICATOR_0_PIN, 1); - writePin(LED_INDICATOR_1_PIN, 1); - writePin(LED_INDICATOR_2_PIN, 1); + gpio_write_pin(LED_INDICATOR_0_PIN, 1); + gpio_write_pin(LED_INDICATOR_1_PIN, 1); + gpio_write_pin(LED_INDICATOR_2_PIN, 1); suspend_power_down_user(); } diff --git a/keyboards/atomic/atomic.c b/keyboards/atomic/atomic.c index 68f3ce9764..8bfe706da0 100644 --- a/keyboards/atomic/atomic.c +++ b/keyboards/atomic/atomic.c @@ -21,8 +21,8 @@ void matrix_init_kb(void) { // runs once when the firmware starts up // Turn status LED on - setPinOutput(E6); - writePinHigh(E6); + gpio_set_pin_output(E6); + gpio_write_pin_high(E6); matrix_init_user(); } diff --git a/keyboards/bajjak/bajjak.h b/keyboards/bajjak/bajjak.h index c2d2d77ef6..cd4ae50053 100644 --- a/keyboards/bajjak/bajjak.h +++ b/keyboards/bajjak/bajjak.h @@ -53,17 +53,17 @@ uint8_t bajjak_left_leds_update(void); #endif -inline void bajjak_board_led_on(void) { setPinOutput(D6); writePinHigh(D6); } -inline void bajjak_right_led_1_on(void) { setPinOutput(B5); writePinHigh(B5); } -inline void bajjak_right_led_2_on(void) { setPinOutput(B6); writePinHigh(B6); } -inline void bajjak_right_led_3_on(void) { setPinOutput(B7); writePinHigh(B7); } -inline void bajjak_right_led_on(uint8_t led) { setPinOutput(led+4); writePinHigh(led+4); } +inline void bajjak_board_led_on(void) { gpio_set_pin_output(D6); gpio_write_pin_high(D6); } +inline void bajjak_right_led_1_on(void) { gpio_set_pin_output(B5); gpio_write_pin_high(B5); } +inline void bajjak_right_led_2_on(void) { gpio_set_pin_output(B6); gpio_write_pin_high(B6); } +inline void bajjak_right_led_3_on(void) { gpio_set_pin_output(B7); gpio_write_pin_high(B7); } +inline void bajjak_right_led_on(uint8_t led) { gpio_set_pin_output(led+4); gpio_write_pin_high(led+4); } -inline void bajjak_board_led_off(void) { setPinInput(D6); writePinLow(D6); } -inline void bajjak_right_led_1_off(void) { setPinInput(B5); writePinLow(B5); } -inline void bajjak_right_led_2_off(void) { setPinInput(B6); writePinLow(B6); } -inline void bajjak_right_led_3_off(void) { setPinInput(B7); writePinLow(B7); } -inline void bajjak_right_led_off(uint8_t led) { setPinInput(led+4); writePinLow(led+4); } +inline void bajjak_board_led_off(void) { gpio_set_pin_input(D6); gpio_write_pin_low(D6); } +inline void bajjak_right_led_1_off(void) { gpio_set_pin_input(B5); gpio_write_pin_low(B5); } +inline void bajjak_right_led_2_off(void) { gpio_set_pin_input(B6); gpio_write_pin_low(B6); } +inline void bajjak_right_led_3_off(void) { gpio_set_pin_input(B7); gpio_write_pin_low(B7); } +inline void bajjak_right_led_off(uint8_t led) { gpio_set_pin_input(led+4); gpio_write_pin_low(led+4); } #ifdef LEFT_LEDS bool bajjak_left_led_1; diff --git a/keyboards/bajjak/matrix.c b/keyboards/bajjak/matrix.c index b0d1ab531f..5451bf787d 100644 --- a/keyboards/bajjak/matrix.c +++ b/keyboards/bajjak/matrix.c @@ -128,13 +128,13 @@ static void init_cols(void) { // not needed, already done as part of init_mcp23018() // init on teensy - setPinInputHigh(F0); - setPinInputHigh(F1); - setPinInputHigh(F4); - setPinInputHigh(F5); - setPinInputHigh(F6); - setPinInputHigh(F7); - setPinInputHigh(D7); + gpio_set_pin_input_high(F0); + gpio_set_pin_input_high(F1); + gpio_set_pin_input_high(F4); + gpio_set_pin_input_high(F5); + gpio_set_pin_input_high(F6); + gpio_set_pin_input_high(F7); + gpio_set_pin_input_high(D7); } static matrix_row_t read_cols(uint8_t row) { @@ -175,13 +175,13 @@ static void unselect_rows(void) { // direction // unselect on teensy - setPinInput(B0); - setPinInput(B1); - setPinInput(B2); - setPinInput(B3); - setPinInput(D2); - setPinInput(D3); - setPinInput(C6); + gpio_set_pin_input(B0); + gpio_set_pin_input(B1); + gpio_set_pin_input(B2); + gpio_set_pin_input(B3); + gpio_set_pin_input(D2); + gpio_set_pin_input(D3); + gpio_set_pin_input(C6); } static void select_row(uint8_t row) { @@ -200,32 +200,32 @@ static void select_row(uint8_t row) { // Output low(DDR:1, PORT:0) to select switch (row) { case 7: - setPinOutput(B0); - writePinLow(B0); + gpio_set_pin_output(B0); + gpio_write_pin_low(B0); break; case 8: - setPinOutput(B1); - writePinLow(B1); + gpio_set_pin_output(B1); + gpio_write_pin_low(B1); break; case 9: - setPinOutput(B2); - writePinLow(B2); + gpio_set_pin_output(B2); + gpio_write_pin_low(B2); break; case 10: - setPinOutput(B3); - writePinLow(B3); + gpio_set_pin_output(B3); + gpio_write_pin_low(B3); break; case 11: - setPinOutput(D2); - writePinLow(D2); + gpio_set_pin_output(D2); + gpio_write_pin_low(D2); break; case 12: - setPinOutput(D3); - writePinLow(D3); + gpio_set_pin_output(D3); + gpio_write_pin_low(D3); break; case 13: - setPinOutput(C6); - writePinLow(C6); + gpio_set_pin_output(C6); + gpio_write_pin_low(C6); break; } } diff --git a/keyboards/bandominedoni/bandominedoni.c b/keyboards/bandominedoni/bandominedoni.c index 2884e41c9c..76d9e6cb3b 100644 --- a/keyboards/bandominedoni/bandominedoni.c +++ b/keyboards/bandominedoni/bandominedoni.c @@ -70,14 +70,14 @@ led_config_t g_led_config = { #if defined(SPLIT_HAND_MATRIX_GRID) static uint8_t peek_matrix_intersection(pin_t out_pin, pin_t in_pin) { - setPinInputHigh(in_pin); - setPinOutput(out_pin); - writePinLow(out_pin); + gpio_set_pin_input_high(in_pin); + gpio_set_pin_output(out_pin); + gpio_write_pin_low(out_pin); // It's almost unnecessary, but wait until it's down to low, just in case. wait_us(1); - uint8_t pin_state = readPin(in_pin); + uint8_t pin_state = gpio_read_pin(in_pin); // Set out_pin to a setting that is less susceptible to noise. - setPinInputHigh(out_pin); + gpio_set_pin_input_high(out_pin); matrix_io_delay(); // Wait for the pull-up to go HIGH. return pin_state; } @@ -93,8 +93,8 @@ static enum { UNKNOWN, LEFT, RIGHT } hand_side = UNKNOWN; if (hand_side == UNKNOWN) { #if defined(SPLIT_HAND_PIN) // Test pin SPLIT_HAND_PIN for High/Low, if low it's right hand - setPinInput(SPLIT_HAND_PIN); - hand_side = readPin(SPLIT_HAND_PIN) ? LEFT : RIGHT; + gpio_set_pin_input(SPLIT_HAND_PIN); + hand_side = gpio_read_pin(SPLIT_HAND_PIN) ? LEFT : RIGHT; return (hand_side == LEFT); #elif defined(SPLIT_HAND_MATRIX_GRID) # ifdef SPLIT_HAND_MATRIX_GRID_LOW_IS_LEFT diff --git a/keyboards/barleycorn_smd/matrix.c b/keyboards/barleycorn_smd/matrix.c index d8880364b6..f64e8fcd7f 100644 --- a/keyboards/barleycorn_smd/matrix.c +++ b/keyboards/barleycorn_smd/matrix.c @@ -23,17 +23,17 @@ static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; static void unselect_rows(void) { for(uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } } static void select_row(uint8_t row) { - setPinOutput(row_pins[row]); - writePinLow(row_pins[row]); + gpio_set_pin_output(row_pins[row]); + gpio_write_pin_low(row_pins[row]); } static void unselect_row(uint8_t row) { - setPinInputHigh(row_pins[row]); + gpio_set_pin_input_high(row_pins[row]); } static void init_pins(void) { @@ -46,7 +46,7 @@ static void init_pins(void) { for (uint8_t x = 0; x < MATRIX_COLS; x++) { if ( x < 8 ) { - setPinInputHigh(col_pins[x]); + gpio_set_pin_input_high(col_pins[x]); } } } @@ -111,7 +111,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) pin_state = port_expander_col_buffer[1] & (1 << 1); break; default : - pin_state = readPin(col_pins[col_index]); + pin_state = gpio_read_pin(col_pins[col_index]); } // Populate the matrix row with the state of the col pin diff --git a/keyboards/bastardkb/charybdis/charybdis.c b/keyboards/bastardkb/charybdis/charybdis.c index c9f0e63172..0ee5c3eed9 100644 --- a/keyboards/bastardkb/charybdis/charybdis.c +++ b/keyboards/bastardkb/charybdis/charybdis.c @@ -371,12 +371,12 @@ void housekeeping_task_kb(void) { #if defined(KEYBOARD_bastardkb_charybdis_3x5_blackpill) || defined(KEYBOARD_bastardkb_charybdis_4x6_blackpill) void keyboard_pre_init_kb(void) { - setPinInputHigh(A0); + gpio_set_pin_input_high(A0); keyboard_pre_init_user(); } void matrix_scan_kb(void) { - if (!readPin(A0)) { + if (!gpio_read_pin(A0)) { reset_keyboard(); } matrix_scan_user(); diff --git a/keyboards/bear_face/v1/v1.c b/keyboards/bear_face/v1/v1.c index f4960d9178..b64a63f0b4 100644 --- a/keyboards/bear_face/v1/v1.c +++ b/keyboards/bear_face/v1/v1.c @@ -19,7 +19,7 @@ along with this program. If not, see . void keyboard_pre_init_kb(void) { //Sets LED pin as output - setPinOutput(F7); + gpio_set_pin_output(F7); keyboard_pre_init_user(); } @@ -28,7 +28,7 @@ bool led_update_kb(led_t led_state) { // Caps Lock LED indicator toggling code here bool res = led_update_user(led_state); if(res) { - writePin(F7, led_state.caps_lock); + gpio_write_pin(F7, led_state.caps_lock); } return res; } diff --git a/keyboards/bear_face/v2/v2.c b/keyboards/bear_face/v2/v2.c index f4960d9178..b64a63f0b4 100644 --- a/keyboards/bear_face/v2/v2.c +++ b/keyboards/bear_face/v2/v2.c @@ -19,7 +19,7 @@ along with this program. If not, see . void keyboard_pre_init_kb(void) { //Sets LED pin as output - setPinOutput(F7); + gpio_set_pin_output(F7); keyboard_pre_init_user(); } @@ -28,7 +28,7 @@ bool led_update_kb(led_t led_state) { // Caps Lock LED indicator toggling code here bool res = led_update_user(led_state); if(res) { - writePin(F7, led_state.caps_lock); + gpio_write_pin(F7, led_state.caps_lock); } return res; } diff --git a/keyboards/bioi/g60/g60.c b/keyboards/bioi/g60/g60.c index 3b387b8760..3fdfef8897 100644 --- a/keyboards/bioi/g60/g60.c +++ b/keyboards/bioi/g60/g60.c @@ -15,14 +15,14 @@ along with this program. If not, see . #include "quantum.h" void keyboard_pre_init_kb(void) { - setPinOutput(F0); - writePinHigh(F0); + gpio_set_pin_output(F0); + gpio_write_pin_high(F0); keyboard_pre_init_user(); } bool led_update_kb(led_t led_state) { if (led_update_user(led_state)) { - writePin(F0, !led_state.caps_lock); + gpio_write_pin(F0, !led_state.caps_lock); } return true; } diff --git a/keyboards/bioi/morgan65/morgan65.c b/keyboards/bioi/morgan65/morgan65.c index 3b387b8760..3fdfef8897 100644 --- a/keyboards/bioi/morgan65/morgan65.c +++ b/keyboards/bioi/morgan65/morgan65.c @@ -15,14 +15,14 @@ along with this program. If not, see . #include "quantum.h" void keyboard_pre_init_kb(void) { - setPinOutput(F0); - writePinHigh(F0); + gpio_set_pin_output(F0); + gpio_write_pin_high(F0); keyboard_pre_init_user(); } bool led_update_kb(led_t led_state) { if (led_update_user(led_state)) { - writePin(F0, !led_state.caps_lock); + gpio_write_pin(F0, !led_state.caps_lock); } return true; } diff --git a/keyboards/bioi/s65/s65.c b/keyboards/bioi/s65/s65.c index 1bd6b84347..e632f31eeb 100644 --- a/keyboards/bioi/s65/s65.c +++ b/keyboards/bioi/s65/s65.c @@ -14,14 +14,14 @@ along with this program. If not, see . #include "quantum.h" void keyboard_pre_init_kb(void) { - setPinOutput(F0); - writePinHigh(F0); + gpio_set_pin_output(F0); + gpio_write_pin_high(F0); keyboard_pre_init_user(); } bool led_update_kb(led_t led_state) { if (led_update_user(led_state)) { - writePin(F0, !led_state.caps_lock); + gpio_write_pin(F0, !led_state.caps_lock); } return true; } diff --git a/keyboards/blu/vimclutch/vimclutch.c b/keyboards/blu/vimclutch/vimclutch.c index 5add11ee4f..6dc8cf765e 100644 --- a/keyboards/blu/vimclutch/vimclutch.c +++ b/keyboards/blu/vimclutch/vimclutch.c @@ -18,8 +18,8 @@ along with this program. If not, see . void keyboard_pre_init_kb(void) { - setPinOutput(F4); - setPinOutput(F5); + gpio_set_pin_output(F4); + gpio_set_pin_output(F5); keyboard_pre_init_user(); }; diff --git a/keyboards/bobpad/bobpad.c b/keyboards/bobpad/bobpad.c index 67b124ace2..83b4dbaad0 100644 --- a/keyboards/bobpad/bobpad.c +++ b/keyboards/bobpad/bobpad.c @@ -19,7 +19,7 @@ bool led_update_kb(led_t led_state) { if (!led_update_user(led_state)) { return false; } - writePin(LED_CAPS_LOCK_PIN, led_state.caps_lock); + gpio_write_pin(LED_CAPS_LOCK_PIN, led_state.caps_lock); return true; }; diff --git a/keyboards/bpiphany/ghost_squid/ghost_squid.c b/keyboards/bpiphany/ghost_squid/ghost_squid.c index 3ecac66f7a..8ecced34e7 100644 --- a/keyboards/bpiphany/ghost_squid/ghost_squid.c +++ b/keyboards/bpiphany/ghost_squid/ghost_squid.c @@ -18,8 +18,8 @@ along with this program. If not, see . #include "ghost_squid.h" void keyboard_pre_init_kb(void) { - setPinOutput(D0); - writePinLow(D0); + gpio_set_pin_output(D0); + gpio_write_pin_low(D0); fn_led_off(); keyboard_pre_init_user(); diff --git a/keyboards/bpiphany/ghost_squid/ghost_squid.h b/keyboards/bpiphany/ghost_squid/ghost_squid.h index 63d3ea0d5e..a227a87602 100644 --- a/keyboards/bpiphany/ghost_squid/ghost_squid.h +++ b/keyboards/bpiphany/ghost_squid/ghost_squid.h @@ -19,5 +19,5 @@ along with this program. If not, see . #include "quantum.h" -#define fn_led_on() writePinLow(D0) -#define fn_led_off() writePinHigh(D0) +#define fn_led_on() gpio_write_pin_low(D0) +#define fn_led_off() gpio_write_pin_high(D0) diff --git a/keyboards/bpiphany/ghost_squid/matrix.c b/keyboards/bpiphany/ghost_squid/matrix.c index 802d365cb8..ae48f5fc94 100644 --- a/keyboards/bpiphany/ghost_squid/matrix.c +++ b/keyboards/bpiphany/ghost_squid/matrix.c @@ -55,22 +55,22 @@ void select_col(uint8_t col) { void matrix_init_custom(void) { /* Column output pins */ - setPinOutput(D1); - setPinOutput(D2); - setPinOutput(D3); - setPinOutput(D4); - setPinOutput(D5); - setPinOutput(D6); + gpio_set_pin_output(D1); + gpio_set_pin_output(D2); + gpio_set_pin_output(D3); + gpio_set_pin_output(D4); + gpio_set_pin_output(D5); + gpio_set_pin_output(D6); /* Row input pins */ - writePinHigh(B0); - writePinHigh(B1); - writePinHigh(B2); - writePinHigh(B3); - writePinHigh(B4); - writePinHigh(B5); - writePinHigh(B6); - writePinHigh(C2); + gpio_write_pin_high(B0); + gpio_write_pin_high(B1); + gpio_write_pin_high(B2); + gpio_write_pin_high(B3); + gpio_write_pin_high(B4); + gpio_write_pin_high(B5); + gpio_write_pin_high(B6); + gpio_write_pin_high(C2); } bool matrix_scan_custom(matrix_row_t current_matrix[]) { diff --git a/keyboards/capsunlocked/cu75/cu75.c b/keyboards/capsunlocked/cu75/cu75.c index f980b0d9e1..e04dd74bc8 100644 --- a/keyboards/capsunlocked/cu75/cu75.c +++ b/keyboards/capsunlocked/cu75/cu75.c @@ -20,12 +20,12 @@ void matrix_init_kb(void) audio_init(); PLAY_SONG(test_sound); // Fix port B5 - setPinInput(B5); - writePinHigh(B5); + gpio_set_pin_input(B5); + gpio_write_pin_high(B5); #else // If we're not using the audio pin, drive it low - setPinOutput(C6); - writePinLow(C6); + gpio_set_pin_output(C6); + gpio_write_pin_low(C6); #endif } diff --git a/keyboards/capsunlocked/cu80/v2/v2.c b/keyboards/capsunlocked/cu80/v2/v2.c index e450082ba2..4e0e8cad76 100644 --- a/keyboards/capsunlocked/cu80/v2/v2.c +++ b/keyboards/capsunlocked/cu80/v2/v2.c @@ -3,7 +3,7 @@ #include "quantum.h" void matrix_init_kb(void) { - setPinOutput(E6); + gpio_set_pin_output(E6); matrix_init_user(); } diff --git a/keyboards/centromere/centromere.c b/keyboards/centromere/centromere.c index 8d46520e38..61b9e073f3 100644 --- a/keyboards/centromere/centromere.c +++ b/keyboards/centromere/centromere.c @@ -2,23 +2,23 @@ void led_init(void) { #if MCU == atmega32u2 - setPinOutput(C4); // Set red LED pin as output - setPinOutput(C5); // Set blue LED pin as output - setPinOutput(D1); // Set green LED pin as output + gpio_set_pin_output(C4); // Set red LED pin as output + gpio_set_pin_output(C5); // Set blue LED pin as output + gpio_set_pin_output(D1); // Set green LED pin as output - writePinHigh(C4); // Turn off red LED pin - writePinHigh(C5); // Turn off blue LED pin - writePinHigh(D1); // Turn off green LED pin + gpio_write_pin_high(C4); // Turn off red LED pin + gpio_write_pin_high(C5); // Turn off blue LED pin + gpio_write_pin_high(D1); // Turn off green LED pin #else - setPinOutput(F4); // Set red LED pin as output - setPinOutput(F5); // Set blue LED pin as output - setPinOutput(D1); // Set green LED pin as output + gpio_set_pin_output(F4); // Set red LED pin as output + gpio_set_pin_output(F5); // Set blue LED pin as output + gpio_set_pin_output(D1); // Set green LED pin as output - writePinHigh(F4); // Turn off red LED pin - writePinHigh(F5); // Turn off blue LED pin - writePinHigh(D1); // Turn off green LED pin + gpio_write_pin_high(F4); // Turn off red LED pin + gpio_write_pin_high(F5); // Turn off blue LED pin + gpio_write_pin_high(D1); // Turn off green LED pin #endif diff --git a/keyboards/centromere/centromere.h b/keyboards/centromere/centromere.h index 078cdca07f..32c2ae6e16 100644 --- a/keyboards/centromere/centromere.h +++ b/keyboards/centromere/centromere.h @@ -3,21 +3,21 @@ #include "quantum.h" #if MCU == atmega32u2 -#define red_led_off writePinHigh(C5) -#define red_led_on writePinLow(C5) -#define blu_led_off writePinHigh(C4) -#define blu_led_on writePinLow(C4) +#define red_led_off gpio_write_pin_high(C5) +#define red_led_on gpio_write_pin_low(C5) +#define blu_led_off gpio_write_pin_high(C4) +#define blu_led_on gpio_write_pin_low(C4) #else -#define red_led_off writePinHigh(F5) -#define red_led_on writePinLow(F5) -#define blu_led_off writePinHigh(F4) -#define blu_led_on writePinLow(F4) +#define red_led_off gpio_write_pin_high(F5) +#define red_led_on gpio_write_pin_low(F5) +#define blu_led_off gpio_write_pin_high(F4) +#define blu_led_on gpio_write_pin_low(F4) #endif -#define grn_led_off writePinHigh(D1) -#define grn_led_on writePinLow(D1) +#define grn_led_off gpio_write_pin_high(D1) +#define grn_led_on gpio_write_pin_low(D1) #define set_led_off red_led_off; blu_led_off #define set_led_red red_led_on; grn_led_off; blu_led_off diff --git a/keyboards/cheshire/curiosity/curiosity.c b/keyboards/cheshire/curiosity/curiosity.c index 9db2651e94..2813cff9b4 100644 --- a/keyboards/cheshire/curiosity/curiosity.c +++ b/keyboards/cheshire/curiosity/curiosity.c @@ -1,17 +1,17 @@ #include "quantum.h" void matrix_init_board(void){ - setPinOutput(A8); - setPinOutput(A9); - setPinOutput(A10); + gpio_set_pin_output(A8); + gpio_set_pin_output(A9); + gpio_set_pin_output(A10); } bool led_update_kb(led_t led_state) { bool runDefault = led_update_user(led_state); if (runDefault) { - writePin(A8, !led_state.num_lock); - writePin(A9, !led_state.caps_lock); - writePin(A10, !led_state.scroll_lock); + gpio_write_pin(A8, !led_state.num_lock); + gpio_write_pin(A9, !led_state.caps_lock); + gpio_write_pin(A10, !led_state.scroll_lock); } return runDefault; } diff --git a/keyboards/cipulot/common/ec_switch_matrix.c b/keyboards/cipulot/common/ec_switch_matrix.c index 845ef99d22..33123bd236 100644 --- a/keyboards/cipulot/common/ec_switch_matrix.c +++ b/keyboards/cipulot/common/ec_switch_matrix.c @@ -54,19 +54,19 @@ static adc_mux adcMux; void init_row(void) { // Set all row pins as output and low for (uint8_t idx = 0; idx < MATRIX_ROWS; idx++) { - setPinOutput(row_pins[idx]); - writePinLow(row_pins[idx]); + gpio_set_pin_output(row_pins[idx]); + gpio_write_pin_low(row_pins[idx]); } } // Initialize the multiplexers void init_amux(void) { for (uint8_t idx = 0; idx < AMUX_COUNT; idx++) { - setPinOutput(amux_en_pins[idx]); - writePinLow(amux_en_pins[idx]); + gpio_set_pin_output(amux_en_pins[idx]); + gpio_write_pin_low(amux_en_pins[idx]); } for (uint8_t idx = 0; idx < AMUX_SEL_PINS_COUNT; idx++) { - setPinOutput(amux_sel_pins[idx]); + gpio_set_pin_output(amux_sel_pins[idx]); } } @@ -75,13 +75,13 @@ void select_amux_channel(uint8_t channel, uint8_t col) { // Get the channel for the specified multiplexer uint8_t ch = amux_n_col_channels[channel][col]; // momentarily disable specified multiplexer - writePinHigh(amux_en_pins[channel]); + gpio_write_pin_high(amux_en_pins[channel]); // Select the multiplexer channel for (uint8_t i = 0; i < AMUX_SEL_PINS_COUNT; i++) { - writePin(amux_sel_pins[i], ch & (1 << i)); + gpio_write_pin(amux_sel_pins[i], ch & (1 << i)); } // re enable specified multiplexer - writePinLow(amux_en_pins[channel]); + gpio_write_pin_low(amux_en_pins[channel]); } // Disable all the unused multiplexers @@ -89,28 +89,28 @@ void disable_unused_amux(uint8_t channel) { // disable all the other multiplexers apart from the current selected one for (uint8_t idx = 0; idx < AMUX_COUNT; idx++) { if (idx != channel) { - writePinHigh(amux_en_pins[idx]); + gpio_write_pin_high(amux_en_pins[idx]); } } } // Discharge the peak hold capacitor void discharge_capacitor(void) { #ifdef OPEN_DRAIN_SUPPORT - writePinLow(DISCHARGE_PIN); + gpio_write_pin_low(DISCHARGE_PIN); #else - writePinLow(DISCHARGE_PIN); - setPinOutput(DISCHARGE_PIN); + gpio_write_pin_low(DISCHARGE_PIN); + gpio_set_pin_output(DISCHARGE_PIN); #endif } // Charge the peak hold capacitor void charge_capacitor(uint8_t row) { #ifdef OPEN_DRAIN_SUPPORT - writePinHigh(DISCHARGE_PIN); + gpio_write_pin_high(DISCHARGE_PIN); #else - setPinInput(DISCHARGE_PIN); + gpio_set_pin_input(DISCHARGE_PIN); #endif - writePinHigh(row_pins[row]); + gpio_write_pin_high(row_pins[row]); } // Initialize the peripherals pins @@ -123,11 +123,11 @@ int ec_init(void) { adc_read(adcMux); // Initialize discharge pin as discharge mode - writePinLow(DISCHARGE_PIN); + gpio_write_pin_low(DISCHARGE_PIN); #ifdef OPEN_DRAIN_SUPPORT - setPinOutputOpenDrain(DISCHARGE_PIN); + gpio_set_pin_output_open_drain(DISCHARGE_PIN); #else - setPinOutput(DISCHARGE_PIN); + gpio_set_pin_output(DISCHARGE_PIN); #endif // Initialize drive lines @@ -212,7 +212,7 @@ uint16_t ec_readkey_raw(uint8_t channel, uint8_t row, uint8_t col) { select_amux_channel(channel, col); // Set the row pin to low state to avoid ghosting - writePinLow(row_pins[row]); + gpio_write_pin_low(row_pins[row]); ATOMIC_BLOCK_FORCEON { // Set the row pin to high state and have capacitor charge diff --git a/keyboards/clueboard/2x1800/2019/2019.c b/keyboards/clueboard/2x1800/2019/2019.c index 40032cd669..8b0ba6a71e 100644 --- a/keyboards/clueboard/2x1800/2019/2019.c +++ b/keyboards/clueboard/2x1800/2019/2019.c @@ -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; diff --git a/keyboards/clueboard/2x1800/2021/max7219.c b/keyboards/clueboard/2x1800/2021/max7219.c index 81d26b9a51..849889a52e 100644 --- a/keyboards/clueboard/2x1800/2021/max7219.c +++ b/keyboards/clueboard/2x1800/2021/max7219.c @@ -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. /* hard reset: low pulse for 500ms and after that HiZ for safety */ #define XT_RESET() do { \ - writePinLow(XT_RST_PIN); \ - setPinOutput(XT_RST_PIN); \ + gpio_write_pin_low(XT_RST_PIN); \ + gpio_set_pin_output(XT_RST_PIN); \ wait_ms(500); \ - setPinInput(XT_RST_PIN); \ + gpio_set_pin_input(XT_RST_PIN); \ } while (0) /* INT1 for falling edge of clock line */ diff --git a/keyboards/converter/xt_usb/xt.h b/keyboards/converter/xt_usb/xt.h index e9c1c7751d..09363d75b3 100644 --- a/keyboards/converter/xt_usb/xt.h +++ b/keyboards/converter/xt_usb/xt.h @@ -43,30 +43,30 @@ POSSIBILITY OF SUCH DAMAGE. #define XT_DATA_IN() \ do { \ - setPinInput(XT_DATA_PIN); \ - writePinHigh(XT_DATA_PIN); \ + gpio_set_pin_input(XT_DATA_PIN); \ + gpio_write_pin_high(XT_DATA_PIN); \ } while (0) -#define XT_DATA_READ() readPin(XT_DATA_PIN) +#define XT_DATA_READ() gpio_read_pin(XT_DATA_PIN) #define XT_DATA_LO() \ do { \ - writePinLow(XT_DATA_PIN); \ - setPinOutput(XT_DATA_PIN); \ + gpio_write_pin_low(XT_DATA_PIN); \ + gpio_set_pin_output(XT_DATA_PIN); \ } while (0) #define XT_CLOCK_IN() \ do { \ - setPinInput(XT_CLOCK_PIN); \ - writePinHigh(XT_CLOCK_PIN); \ + gpio_set_pin_input(XT_CLOCK_PIN); \ + gpio_write_pin_high(XT_CLOCK_PIN); \ } while (0) -#define XT_CLOCK_READ() readPin(XT_CLOCK_PIN) +#define XT_CLOCK_READ() gpio_read_pin(XT_CLOCK_PIN) #define XT_CLOCK_LO() \ do { \ - writePinLow(XT_CLOCK_PIN); \ - setPinOutput(XT_CLOCK_PIN); \ + gpio_write_pin_low(XT_CLOCK_PIN); \ + gpio_set_pin_output(XT_CLOCK_PIN); \ } while (0) void xt_host_init(void); diff --git a/keyboards/custommk/evo70_r2/matrix.c b/keyboards/custommk/evo70_r2/matrix.c index 99c3428d80..5ee93a5c7d 100644 --- a/keyboards/custommk/evo70_r2/matrix.c +++ b/keyboards/custommk/evo70_r2/matrix.c @@ -10,7 +10,7 @@ void matrix_wait_for_pin(pin_t pin, uint8_t target_state) { rtcnt_t start = chSysGetRealtimeCounterX(); rtcnt_t end = start + 5000; while (chSysIsCounterWithinX(chSysGetRealtimeCounterX(), start, end)) { - if (readPin(pin) == target_state) { + if (gpio_read_pin(pin) == target_state) { break; } } @@ -27,22 +27,22 @@ void matrix_wait_for_port(stm32_gpio_t *port, uint32_t target_bitmask) { } void shift_pulse_clock(void) { - writePinHigh(COL_SHIFT_CLK_PIN); + gpio_write_pin_high(COL_SHIFT_CLK_PIN); matrix_wait_for_pin(COL_SHIFT_CLK_PIN, 1); - writePinLow(COL_SHIFT_CLK_PIN); + gpio_write_pin_low(COL_SHIFT_CLK_PIN); } void matrix_init_custom(void) { //set all row pins as input with pullups for (int i = 0; i < MATRIX_ROWS; ++i) { - writePinHigh(row_pins[i]); - setPinInputHigh(row_pins[i]); + gpio_write_pin_high(row_pins[i]); + gpio_set_pin_input_high(row_pins[i]); } //set all column pins high in ROW2COL matrix - setPinOutput(COL_SHIFT_IN_PIN); - setPinOutput(COL_SHIFT_CLK_PIN); - writePinHigh(COL_SHIFT_IN_PIN); + gpio_set_pin_output(COL_SHIFT_IN_PIN); + gpio_set_pin_output(COL_SHIFT_CLK_PIN); + gpio_write_pin_high(COL_SHIFT_IN_PIN); matrix_wait_for_pin(COL_SHIFT_IN_PIN, 1); for (int i = 0; i < MATRIX_COLS; ++i) { @@ -54,13 +54,13 @@ void matrix_init_custom(void) { bool matrix_scan_custom(matrix_row_t current_matrix[]) { static matrix_row_t temp_matrix[MATRIX_ROWS] = {0}; - writePinLow(COL_SHIFT_IN_PIN); + gpio_write_pin_low(COL_SHIFT_IN_PIN); matrix_wait_for_pin(COL_SHIFT_IN_PIN, 0); // Setup the output column pin shift_pulse_clock(); - writePinHigh(COL_SHIFT_IN_PIN); + gpio_write_pin_high(COL_SHIFT_IN_PIN); for (int current_col = 0; current_col < MATRIX_COLS; ++current_col) { // Read the column ports diff --git a/keyboards/cutie_club/wraith/wraith.c b/keyboards/cutie_club/wraith/wraith.c index 799ac318e6..799648846c 100644 --- a/keyboards/cutie_club/wraith/wraith.c +++ b/keyboards/cutie_club/wraith/wraith.c @@ -16,7 +16,7 @@ #include "quantum.h" void matrix_init_kb(void) { - setPinOutput(B0); + gpio_set_pin_output(B0); matrix_init_user(); } diff --git a/keyboards/dark/magnum_ergo_1/magnum_ergo_1.c b/keyboards/dark/magnum_ergo_1/magnum_ergo_1.c index 9125410df0..879d73e0f9 100644 --- a/keyboards/dark/magnum_ergo_1/magnum_ergo_1.c +++ b/keyboards/dark/magnum_ergo_1/magnum_ergo_1.c @@ -17,34 +17,34 @@ #include "quantum.h" void keyoard_post_init_kb(void) { - setPinOutput(LED_CAPS_LOCK_PIN); - setPinOutput(LED_INDICATOR_1); - setPinOutput(LED_INDICATOR_2); - setPinOutput(LED_INDICATOR_3); - setPinOutput(LED_INDICATOR_4); - setPinOutput(LED_INDICATOR_5); + gpio_set_pin_output(LED_CAPS_LOCK_PIN); + gpio_set_pin_output(LED_INDICATOR_1); + gpio_set_pin_output(LED_INDICATOR_2); + gpio_set_pin_output(LED_INDICATOR_3); + gpio_set_pin_output(LED_INDICATOR_4); + gpio_set_pin_output(LED_INDICATOR_5); #ifndef LED_CAPS_LOCK_PIN - writePin(LED_CAPS_LOCK_PIN, 0); + gpio_write_pin(LED_CAPS_LOCK_PIN, 0); #endif #ifndef LED_INDICATOR_1 - writePin(LED_INDICATOR_1, 0); + gpio_write_pin(LED_INDICATOR_1, 0); #endif #ifndef LED_INDICATOR_2 - writePin(LED_INDICATOR_2, 0); + gpio_write_pin(LED_INDICATOR_2, 0); #endif #ifndef LED_INDICATOR_3 - writePin(LED_INDICATOR_3, 0); + gpio_write_pin(LED_INDICATOR_3, 0); #endif #ifndef LED_INDICATOR_4 - writePin(LED_INDICATOR_4, 0); + gpio_write_pin(LED_INDICATOR_4, 0); #endif #ifndef LED_INDICATOR_5 - writePin(LED_INDICATOR_5, 0); + gpio_write_pin(LED_INDICATOR_5, 0); #endif keyboard_post_init_user(); } @@ -53,39 +53,39 @@ layer_state_t layer_state_set_kb(layer_state_t state) { switch (get_highest_layer(state)) { case 1: #ifdef LED_INDICATOR_4 - writePin(LED_INDICATOR_4, 1); + gpio_write_pin(LED_INDICATOR_4, 1); #endif #ifdef LED_INDICATOR_5 - writePin(LED_INDICATOR_5, 1); + gpio_write_pin(LED_INDICATOR_5, 1); #endif break; case 2: #ifdef LED_INDICATOR_1 - writePin(LED_INDICATOR_1, 1); + gpio_write_pin(LED_INDICATOR_1, 1); #endif #ifdef LED_INDICATOR_2 - writePin(LED_INDICATOR_2, 1); + gpio_write_pin(LED_INDICATOR_2, 1); #endif #ifdef LED_INDICATOR_3 - writePin(LED_INDICATOR_3, 1); + gpio_write_pin(LED_INDICATOR_3, 1); #endif break; default: #ifdef LED_INDICATOR_1 - writePin(LED_INDICATOR_1, 0); + gpio_write_pin(LED_INDICATOR_1, 0); #endif #ifdef LED_INDICATOR_2 - writePin(LED_INDICATOR_2, 0); + gpio_write_pin(LED_INDICATOR_2, 0); #endif #ifdef LED_INDICATOR_3 - writePin(LED_INDICATOR_3, 0); + gpio_write_pin(LED_INDICATOR_3, 0); #endif #ifdef LED_INDICATOR_4 - writePin(LED_INDICATOR_4, 0); + gpio_write_pin(LED_INDICATOR_4, 0); #endif #ifdef LED_INDICATOR_5 - writePin(LED_INDICATOR_5, 0); + gpio_write_pin(LED_INDICATOR_5, 0); #endif break; } diff --git a/keyboards/darkproject/kd83a_bfg_edition/kd83a_bfg_edition.c b/keyboards/darkproject/kd83a_bfg_edition/kd83a_bfg_edition.c index f21aeeb38d..00521bc2be 100644 --- a/keyboards/darkproject/kd83a_bfg_edition/kd83a_bfg_edition.c +++ b/keyboards/darkproject/kd83a_bfg_edition/kd83a_bfg_edition.c @@ -132,9 +132,9 @@ void spi_init(void) { is_initialised = true; // Try releasing special pins for a short time - setPinInput(SPI_SCK_PIN); - setPinInput(SPI_MOSI_PIN); - setPinInput(SPI_MISO_PIN); + gpio_set_pin_input(SPI_SCK_PIN); + gpio_set_pin_input(SPI_MOSI_PIN); + gpio_set_pin_input(SPI_MISO_PIN); chThdSleepMilliseconds(10); @@ -147,12 +147,12 @@ void spi_init(void) { #endif void keyboard_pre_init_kb(void) { - setPinOutput(C0); - setPinOutput(C15); + gpio_set_pin_output(C0); + gpio_set_pin_output(C15); keyboard_pre_init_user(); }; void housekeeping_task_kb(void) { - writePin(C15, keymap_config.no_gui); + gpio_write_pin(C15, keymap_config.no_gui); }; bool process_record_kb(uint16_t keycode, keyrecord_t *record) { diff --git a/keyboards/darkproject/kd87a_bfg_edition/kd87a_bfg_edition.c b/keyboards/darkproject/kd87a_bfg_edition/kd87a_bfg_edition.c index 20a46e343e..05c2be542b 100644 --- a/keyboards/darkproject/kd87a_bfg_edition/kd87a_bfg_edition.c +++ b/keyboards/darkproject/kd87a_bfg_edition/kd87a_bfg_edition.c @@ -133,9 +133,9 @@ void spi_init(void) { is_initialised = true; // Try releasing special pins for a short time - setPinInput(SPI_SCK_PIN); - setPinInput(SPI_MOSI_PIN); - setPinInput(SPI_MISO_PIN); + gpio_set_pin_input(SPI_SCK_PIN); + gpio_set_pin_input(SPI_MOSI_PIN); + gpio_set_pin_input(SPI_MISO_PIN); chThdSleepMilliseconds(10); @@ -148,12 +148,12 @@ void spi_init(void) { #endif void keyboard_pre_init_kb(void) { - setPinOutput(C0); - setPinOutput(C15); + gpio_set_pin_output(C0); + gpio_set_pin_output(C15); keyboard_pre_init_user(); }; void housekeeping_task_kb(void) { - writePin(C15, keymap_config.no_gui); + gpio_write_pin(C15, keymap_config.no_gui); }; bool process_record_kb(uint16_t keycode, keyrecord_t *record) { diff --git a/keyboards/dekunukem/duckypad/duckypad.c b/keyboards/dekunukem/duckypad/duckypad.c index 7e486c4550..b56f2d12e9 100644 --- a/keyboards/dekunukem/duckypad/duckypad.c +++ b/keyboards/dekunukem/duckypad/duckypad.c @@ -21,11 +21,11 @@ along with this program. If not, see . #include "quantum.h" void keyboard_pre_init_kb(void) { - setPinOutput(A0); - writePinHigh(A0); - writePinLow(A0); + gpio_set_pin_output(A0); + gpio_write_pin_high(A0); + gpio_write_pin_low(A0); wait_ms(10); - writePinHigh(A0); + gpio_write_pin_high(A0); keyboard_pre_init_user(); } diff --git a/keyboards/dichotomy/dichotomy.c b/keyboards/dichotomy/dichotomy.c index 4301d9b67d..584151fdd3 100755 --- a/keyboards/dichotomy/dichotomy.c +++ b/keyboards/dichotomy/dichotomy.c @@ -60,13 +60,13 @@ bool pointing_device_task(void){ } void led_init(void) { - setPinOutput(D1); - setPinOutput(F5); - setPinOutput(F6); + gpio_set_pin_output(D1); + gpio_set_pin_output(F5); + gpio_set_pin_output(F6); - writePinHigh(D1); - writePinHigh(F5); - writePinHigh(F6); + gpio_write_pin_high(D1); + gpio_write_pin_high(F5); + gpio_write_pin_high(F6); } diff --git a/keyboards/dichotomy/dichotomy.h b/keyboards/dichotomy/dichotomy.h index f62ed49aa0..5783bd637b 100755 --- a/keyboards/dichotomy/dichotomy.h +++ b/keyboards/dichotomy/dichotomy.h @@ -4,12 +4,12 @@ #include "pointing_device.h" #include "quantum.h" -#define red_led_off() writePinHigh(F6) -#define red_led_on() writePinLow(F6) -#define blu_led_off() writePinHigh(F5) -#define blu_led_on() writePinLow(F5) -#define grn_led_off() writePinHigh(D1) -#define grn_led_on() writePinLow(D1) +#define red_led_off() gpio_write_pin_high(F6) +#define red_led_on() gpio_write_pin_low(F6) +#define blu_led_off() gpio_write_pin_high(F5) +#define blu_led_on() gpio_write_pin_low(F5) +#define grn_led_off() gpio_write_pin_high(D1) +#define grn_led_on() gpio_write_pin_low(D1) #define red_led(flag) if (flag) red_led_on(); else red_led_off() #define blu_led(flag) if (flag) blu_led_on(); else blu_led_off() diff --git a/keyboards/dinofizz/fnrow/v1/v1.c b/keyboards/dinofizz/fnrow/v1/v1.c index d2a5cd7120..546051acfc 100644 --- a/keyboards/dinofizz/fnrow/v1/v1.c +++ b/keyboards/dinofizz/fnrow/v1/v1.c @@ -17,8 +17,8 @@ void keyboard_pre_init_kb(void) { // Immediately set the LED pin as an output and set it ON - setPinOutput(A15); - writePinHigh(A15); + gpio_set_pin_output(A15); + gpio_write_pin_high(A15); keyboard_pre_init_user(); } @@ -26,11 +26,11 @@ void keyboard_pre_init_kb(void) { void keyboard_post_init_kb(void) { // Blink the LED so we know everything is running OK // Finish with LED OFF - writePinLow(A15); + gpio_write_pin_low(A15); wait_ms(100); - writePinHigh(A15); + gpio_write_pin_high(A15); wait_ms(100); - writePinLow(A15); + gpio_write_pin_low(A15); keyboard_post_init_user(); } diff --git a/keyboards/dk60/dk60.c b/keyboards/dk60/dk60.c index 382404c032..5bc9d5cd5c 100644 --- a/keyboards/dk60/dk60.c +++ b/keyboards/dk60/dk60.c @@ -40,8 +40,8 @@ void matrix_init_kb(void) { } void led_init_ports(void) { - setPinOutput(E6); - setPinOutput(F0); + gpio_set_pin_output(E6); + gpio_set_pin_output(F0); } void led_update_ports(led_t led_state) { diff --git a/keyboards/dk60/dk60.h b/keyboards/dk60/dk60.h index 05e790d525..e240687661 100644 --- a/keyboards/dk60/dk60.h +++ b/keyboards/dk60/dk60.h @@ -19,11 +19,11 @@ along with this program. If not, see . #include "quantum.h" -inline void dk60_caps_led_on(void) { writePinHigh(E6); } -inline void dk60_esc_led_on(void) { writePinHigh(F0); } +inline void dk60_caps_led_on(void) { gpio_write_pin_high(E6); } +inline void dk60_esc_led_on(void) { gpio_write_pin_high(F0); } -inline void dk60_caps_led_off(void) { writePinLow(E6); } -inline void dk60_esc_led_off(void) { writePinLow(F0); } +inline void dk60_caps_led_off(void) { gpio_write_pin_low(E6); } +inline void dk60_esc_led_off(void) { gpio_write_pin_low(F0); } inline void dk60_led_all_on(void) { dk60_caps_led_on(); diff --git a/keyboards/dm9records/lain/lain.c b/keyboards/dm9records/lain/lain.c index cb8354e5c2..bdea60f90f 100644 --- a/keyboards/dm9records/lain/lain.c +++ b/keyboards/dm9records/lain/lain.c @@ -12,7 +12,7 @@ void lain_eeconfig_update_kb(void) { eeconfig_update_kb(lain_config.raw); } void lain_set_led(uint8_t no, bool flag) { led_states[no] = flag; - writePin(leds[no], lain_config.led_enabled ? flag : false); + gpio_write_pin(leds[no], lain_config.led_enabled ? flag : false); } void lain_enable_leds(bool flag) { @@ -20,7 +20,7 @@ void lain_enable_leds(bool flag) { lain_eeconfig_update_kb(); for (int i = 0; i < LED_NUM; i++) { - writePin(leds[i], lain_config.led_enabled ? led_states[i] : false); + gpio_write_pin(leds[i], lain_config.led_enabled ? led_states[i] : false); } } @@ -28,7 +28,7 @@ void lain_enable_leds_toggle(void) { lain_enable_leds(!lain_config.led_enabled); void led_init_ports(void) { for (uint8_t i = 0; i < LED_NUM; i++) { - setPinOutput(leds[i]); + gpio_set_pin_output(leds[i]); lain_set_led(leds[i], 0); } } diff --git a/keyboards/doppelganger/doppelganger.c b/keyboards/doppelganger/doppelganger.c index 9a9fc0679f..4a62fdf45f 100644 --- a/keyboards/doppelganger/doppelganger.c +++ b/keyboards/doppelganger/doppelganger.c @@ -16,30 +16,30 @@ #include "quantum.h" void keyboard_pre_init_kb(void) { - setPinOutput(C6); - setPinOutput(B0); + gpio_set_pin_output(C6); + gpio_set_pin_output(B0); } 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(C6, !led_state.caps_lock); + gpio_write_pin(C6, !led_state.caps_lock); } return res; } __attribute__((weak)) layer_state_t layer_state_set_user(layer_state_t state) { - writePin(B0, !(state & (1UL << 1))); + gpio_write_pin(B0, !(state & (1UL << 1))); return state; } // Override core logic as we reuse SPLIT_HAND_PIN within matrix pins bool is_keyboard_left(void) { - setPinInput(SPLIT_HAND_PIN); - return readPin(SPLIT_HAND_PIN); + gpio_set_pin_input(SPLIT_HAND_PIN); + return gpio_read_pin(SPLIT_HAND_PIN); } diff --git a/keyboards/dp60/matrix.c b/keyboards/dp60/matrix.c index 22156745f1..998efd59fe 100644 --- a/keyboards/dp60/matrix.c +++ b/keyboards/dp60/matrix.c @@ -54,10 +54,10 @@ void matrix_scan_user(void) {} void matrix_init(void) { - //setPinOutput(F0); - //writePinHigh(F0); - setPinOutput(B4); - writePinLow(B4); + //gpio_set_pin_output(F0); + //gpio_write_pin_high(F0); + gpio_set_pin_output(B4); + gpio_write_pin_low(B4); init_cols(); init_rows(); @@ -123,20 +123,20 @@ void matrix_print(void) */ static void init_rows(void) { - setPinInputHigh(E6); - setPinInputHigh(F6); - setPinInputHigh(F7); - setPinInputHigh(B7); - setPinInputHigh(D4); + gpio_set_pin_input_high(E6); + gpio_set_pin_input_high(F6); + gpio_set_pin_input_high(F7); + gpio_set_pin_input_high(B7); + gpio_set_pin_input_high(D4); } static uint8_t read_rows(void) { - return ((readPin(E6) ? 0 : (1 << 0)) | - (readPin(F6) ? 0 : (1 << 1)) | - (readPin(F7) ? 0 : (1 << 2)) | - (readPin(B7) ? 0 : (1 << 3)) | - (readPin(D4) ? 0 : (1 << 4))); + return ((gpio_read_pin(E6) ? 0 : (1 << 0)) | + (gpio_read_pin(F6) ? 0 : (1 << 1)) | + (gpio_read_pin(F7) ? 0 : (1 << 2)) | + (gpio_read_pin(B7) ? 0 : (1 << 3)) | + (gpio_read_pin(D4) ? 0 : (1 << 4))); } /* @@ -164,104 +164,104 @@ static uint8_t read_rows(void) */ static void init_cols(void) { - setPinOutput(F0); - setPinOutput(F1); - setPinOutput(F4); - setPinOutput(F5); + gpio_set_pin_output(F0); + gpio_set_pin_output(F1); + gpio_set_pin_output(F4); + gpio_set_pin_output(F5); - setPinOutput(D2); - setPinOutput(D3); - setPinOutput(D5); - setPinOutput(D6); + gpio_set_pin_output(D2); + gpio_set_pin_output(D3); + gpio_set_pin_output(D5); + gpio_set_pin_output(D6); unselect_cols(); } static void unselect_cols(void) { - writePinHigh(F0); - writePinHigh(F1); - writePinHigh(F4); - writePinHigh(F5); + gpio_write_pin_high(F0); + gpio_write_pin_high(F1); + gpio_write_pin_high(F4); + gpio_write_pin_high(F5); - writePinHigh(D2); - writePinHigh(D3); - writePinHigh(D5); - writePinHigh(D6); + gpio_write_pin_high(D2); + gpio_write_pin_high(D3); + gpio_write_pin_high(D5); + gpio_write_pin_high(D6); } static void select_col(uint8_t col) { switch (col) { case 0: - writePinLow(F0); - writePinLow(F1); - writePinLow(F4); + gpio_write_pin_low(F0); + gpio_write_pin_low(F1); + gpio_write_pin_low(F4); break; case 1: - writePinHigh(F0); - writePinLow(F1); - writePinLow(F4); + gpio_write_pin_high(F0); + gpio_write_pin_low(F1); + gpio_write_pin_low(F4); break; case 2: - writePinLow(F0); - writePinHigh(F1); - writePinLow(F4); + gpio_write_pin_low(F0); + gpio_write_pin_high(F1); + gpio_write_pin_low(F4); break; case 3: - writePinHigh(F0); - writePinHigh(F1); - writePinLow(F4); + gpio_write_pin_high(F0); + gpio_write_pin_high(F1); + gpio_write_pin_low(F4); break; case 4: - writePinLow(F0); - writePinLow(F1); - writePinHigh(F4); + gpio_write_pin_low(F0); + gpio_write_pin_low(F1); + gpio_write_pin_high(F4); break; case 5: - writePinHigh(F0); - writePinLow(F1); - writePinHigh(F4); + gpio_write_pin_high(F0); + gpio_write_pin_low(F1); + gpio_write_pin_high(F4); break; case 6: - writePinLow(F0); - writePinHigh(F1); - writePinHigh(F4); + gpio_write_pin_low(F0); + gpio_write_pin_high(F1); + gpio_write_pin_high(F4); break; case 7: - writePinLow(D2); - writePinLow(D3); - writePinLow(D5); + gpio_write_pin_low(D2); + gpio_write_pin_low(D3); + gpio_write_pin_low(D5); break; case 8: - writePinHigh(D2); - writePinLow(D3); - writePinLow(D5); + gpio_write_pin_high(D2); + gpio_write_pin_low(D3); + gpio_write_pin_low(D5); break; case 9: - writePinLow(D2); - writePinHigh(D3); - writePinLow(D5); + gpio_write_pin_low(D2); + gpio_write_pin_high(D3); + gpio_write_pin_low(D5); break; case 10: - writePinHigh(D2); - writePinHigh(D3); - writePinLow(D5); + gpio_write_pin_high(D2); + gpio_write_pin_high(D3); + gpio_write_pin_low(D5); break; case 11: - writePinLow(D2); - writePinLow(D3); - writePinHigh(D5); + gpio_write_pin_low(D2); + gpio_write_pin_low(D3); + gpio_write_pin_high(D5); break; case 12: - writePinHigh(D2); - writePinLow(D3); - writePinHigh(D5); + gpio_write_pin_high(D2); + gpio_write_pin_low(D3); + gpio_write_pin_high(D5); break; case 13: - writePinLow(D2); - writePinHigh(D3); - writePinHigh(D5); + gpio_write_pin_low(D2); + gpio_write_pin_high(D3); + gpio_write_pin_high(D5); break; } } diff --git a/keyboards/drop/lib/mux.c b/keyboards/drop/lib/mux.c index 85a657544f..3941552686 100644 --- a/keyboards/drop/lib/mux.c +++ b/keyboards/drop/lib/mux.c @@ -22,8 +22,8 @@ #define C2_B5_SENSE B0 static inline void digital_write(pin_t pin, uint8_t level) { - setPinOutput(pin); - writePin(pin, level); + gpio_set_pin_output(pin); + gpio_write_pin(pin, level); } uint16_t v_con_1 = 0; @@ -42,10 +42,10 @@ void keyboard_USB_enable(void) { digital_write(SRC_1, 1); digital_write(SRC_2, 1); - setPinInput(C1_A5_SENSE); - setPinInput(C1_B5_SENSE); - setPinInput(C2_A5_SENSE); - setPinInput(C2_B5_SENSE); + gpio_set_pin_input(C1_A5_SENSE); + gpio_set_pin_input(C1_B5_SENSE); + gpio_set_pin_input(C2_A5_SENSE); + gpio_set_pin_input(C2_B5_SENSE); // reset hub digital_write(HUB_RESET_N, 0); diff --git a/keyboards/duck/orion/v3/matrix.c b/keyboards/duck/orion/v3/matrix.c index f392b9b190..1dd07a6567 100644 --- a/keyboards/duck/orion/v3/matrix.c +++ b/keyboards/duck/orion/v3/matrix.c @@ -56,13 +56,13 @@ void matrix_scan_user(void) { void indicator_init_ports(void) { // Num LED - setPinOutput(B4); + gpio_set_pin_output(B4); // Caps Lock - setPinOutput(B0); + gpio_set_pin_output(B0); // Scroll Lock - setPinOutput(D7); + gpio_set_pin_output(D7); } void matrix_init(void) { diff --git a/keyboards/duck/orion/v3/v3.c b/keyboards/duck/orion/v3/v3.c index 87e3cc0f37..c0ca9ddd06 100644 --- a/keyboards/duck/orion/v3/v3.c +++ b/keyboards/duck/orion/v3/v3.c @@ -31,9 +31,9 @@ // of the Escape key. bool led_update_kb(led_t led_state) { if(led_update_user(led_state)) { - writePin(B0, !led_state.caps_lock); - writePin(B4, !led_state.num_lock); - writePin(D7, !led_state.scroll_lock); + gpio_write_pin(B0, !led_state.caps_lock); + gpio_write_pin(B4, !led_state.num_lock); + gpio_write_pin(D7, !led_state.scroll_lock); } return true; } diff --git a/keyboards/dumbpad/v0x/v0x.c b/keyboards/dumbpad/v0x/v0x.c index d7e3841d76..8625bb12c2 100644 --- a/keyboards/dumbpad/v0x/v0x.c +++ b/keyboards/dumbpad/v0x/v0x.c @@ -17,8 +17,8 @@ void keyboard_pre_init_kb(void) { // Set LED IO as outputs - setPinOutput(LED_00); - setPinOutput(LED_01); + gpio_set_pin_output(LED_00); + gpio_set_pin_output(LED_01); keyboard_pre_init_user(); } @@ -27,16 +27,16 @@ bool shutdown_kb(bool jump_to_bootloader) { return false; } // Shutdown LEDs - writePinLow(LED_00); - writePinLow(LED_01); + gpio_write_pin_low(LED_00); + gpio_write_pin_low(LED_01); return true; } layer_state_t layer_state_set_kb(layer_state_t state) { // Layer LEDs act as binary indication of current layer uint8_t layer = get_highest_layer(state); - writePin(LED_00, layer & 0b1); - writePin(LED_01, (layer >> 1) & 0b1); + gpio_write_pin(LED_00, layer & 0b1); + gpio_write_pin(LED_01, (layer >> 1) & 0b1); return layer_state_set_user(state); } @@ -49,11 +49,11 @@ void matrix_init_kb(void) { // runs once when the firmware starts up uint8_t led_delay_ms = 80; for (int i = 0; i < 2; i++) { - writePinHigh(LED_00); - writePinHigh(LED_01); + gpio_write_pin_high(LED_00); + gpio_write_pin_high(LED_01); wait_ms(led_delay_ms); - writePinLow(LED_00); - writePinLow(LED_01); + gpio_write_pin_low(LED_00); + gpio_write_pin_low(LED_01); if (i < 1) { wait_ms(led_delay_ms); } diff --git a/keyboards/dumbpad/v0x_dualencoder/v0x_dualencoder.c b/keyboards/dumbpad/v0x_dualencoder/v0x_dualencoder.c index d7e3841d76..8625bb12c2 100644 --- a/keyboards/dumbpad/v0x_dualencoder/v0x_dualencoder.c +++ b/keyboards/dumbpad/v0x_dualencoder/v0x_dualencoder.c @@ -17,8 +17,8 @@ void keyboard_pre_init_kb(void) { // Set LED IO as outputs - setPinOutput(LED_00); - setPinOutput(LED_01); + gpio_set_pin_output(LED_00); + gpio_set_pin_output(LED_01); keyboard_pre_init_user(); } @@ -27,16 +27,16 @@ bool shutdown_kb(bool jump_to_bootloader) { return false; } // Shutdown LEDs - writePinLow(LED_00); - writePinLow(LED_01); + gpio_write_pin_low(LED_00); + gpio_write_pin_low(LED_01); return true; } layer_state_t layer_state_set_kb(layer_state_t state) { // Layer LEDs act as binary indication of current layer uint8_t layer = get_highest_layer(state); - writePin(LED_00, layer & 0b1); - writePin(LED_01, (layer >> 1) & 0b1); + gpio_write_pin(LED_00, layer & 0b1); + gpio_write_pin(LED_01, (layer >> 1) & 0b1); return layer_state_set_user(state); } @@ -49,11 +49,11 @@ void matrix_init_kb(void) { // runs once when the firmware starts up uint8_t led_delay_ms = 80; for (int i = 0; i < 2; i++) { - writePinHigh(LED_00); - writePinHigh(LED_01); + gpio_write_pin_high(LED_00); + gpio_write_pin_high(LED_01); wait_ms(led_delay_ms); - writePinLow(LED_00); - writePinLow(LED_01); + gpio_write_pin_low(LED_00); + gpio_write_pin_low(LED_01); if (i < 1) { wait_ms(led_delay_ms); } diff --git a/keyboards/dumbpad/v0x_right/v0x_right.c b/keyboards/dumbpad/v0x_right/v0x_right.c index d7e3841d76..8625bb12c2 100644 --- a/keyboards/dumbpad/v0x_right/v0x_right.c +++ b/keyboards/dumbpad/v0x_right/v0x_right.c @@ -17,8 +17,8 @@ void keyboard_pre_init_kb(void) { // Set LED IO as outputs - setPinOutput(LED_00); - setPinOutput(LED_01); + gpio_set_pin_output(LED_00); + gpio_set_pin_output(LED_01); keyboard_pre_init_user(); } @@ -27,16 +27,16 @@ bool shutdown_kb(bool jump_to_bootloader) { return false; } // Shutdown LEDs - writePinLow(LED_00); - writePinLow(LED_01); + gpio_write_pin_low(LED_00); + gpio_write_pin_low(LED_01); return true; } layer_state_t layer_state_set_kb(layer_state_t state) { // Layer LEDs act as binary indication of current layer uint8_t layer = get_highest_layer(state); - writePin(LED_00, layer & 0b1); - writePin(LED_01, (layer >> 1) & 0b1); + gpio_write_pin(LED_00, layer & 0b1); + gpio_write_pin(LED_01, (layer >> 1) & 0b1); return layer_state_set_user(state); } @@ -49,11 +49,11 @@ void matrix_init_kb(void) { // runs once when the firmware starts up uint8_t led_delay_ms = 80; for (int i = 0; i < 2; i++) { - writePinHigh(LED_00); - writePinHigh(LED_01); + gpio_write_pin_high(LED_00); + gpio_write_pin_high(LED_01); wait_ms(led_delay_ms); - writePinLow(LED_00); - writePinLow(LED_01); + gpio_write_pin_low(LED_00); + gpio_write_pin_low(LED_01); if (i < 1) { wait_ms(led_delay_ms); } diff --git a/keyboards/dumbpad/v1x/v1x.c b/keyboards/dumbpad/v1x/v1x.c index 1022ad0605..cdbaff54aa 100644 --- a/keyboards/dumbpad/v1x/v1x.c +++ b/keyboards/dumbpad/v1x/v1x.c @@ -17,9 +17,9 @@ void keyboard_pre_init_kb(void) { // Set LED IO as outputs - setPinOutput(LED_00); - setPinOutput(LED_01); - setPinOutput(LED_02); + gpio_set_pin_output(LED_00); + gpio_set_pin_output(LED_01); + gpio_set_pin_output(LED_02); keyboard_pre_init_user(); } @@ -28,17 +28,17 @@ bool shutdown_kb(bool jump_to_bootloader) { return false; } // Shutdown LEDs - writePinLow(LED_00); - writePinLow(LED_01); - writePinLow(LED_02); + gpio_write_pin_low(LED_00); + gpio_write_pin_low(LED_01); + gpio_write_pin_low(LED_02); return true; } layer_state_t layer_state_set_kb(layer_state_t state) { // Layer LEDs act as binary indication of current layer uint8_t layer = get_highest_layer(state); - writePin(LED_00, layer & 0b1); - writePin(LED_01, (layer >> 1) & 0b1); + gpio_write_pin(LED_00, layer & 0b1); + gpio_write_pin(LED_01, (layer >> 1) & 0b1); return layer_state_set_user(state); } @@ -51,13 +51,13 @@ void matrix_init_kb(void) { // runs once when the firmware starts up uint8_t led_delay_ms = 80; for (int i = 0; i < 2; i++) { - writePinHigh(LED_00); - writePinHigh(LED_01); - writePinHigh(LED_02); + gpio_write_pin_high(LED_00); + gpio_write_pin_high(LED_01); + gpio_write_pin_high(LED_02); wait_ms(led_delay_ms); - writePinLow(LED_00); - writePinLow(LED_01); - writePinLow(LED_02); + gpio_write_pin_low(LED_00); + gpio_write_pin_low(LED_01); + gpio_write_pin_low(LED_02); if (i < 1) { wait_ms(led_delay_ms); } @@ -69,7 +69,7 @@ void matrix_init_kb(void) { bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if(res) { - writePin(LED_02, !led_state.num_lock); + gpio_write_pin(LED_02, !led_state.num_lock); } return res; } diff --git a/keyboards/dumbpad/v1x_dualencoder/v1x_dualencoder.c b/keyboards/dumbpad/v1x_dualencoder/v1x_dualencoder.c index 1022ad0605..cdbaff54aa 100644 --- a/keyboards/dumbpad/v1x_dualencoder/v1x_dualencoder.c +++ b/keyboards/dumbpad/v1x_dualencoder/v1x_dualencoder.c @@ -17,9 +17,9 @@ void keyboard_pre_init_kb(void) { // Set LED IO as outputs - setPinOutput(LED_00); - setPinOutput(LED_01); - setPinOutput(LED_02); + gpio_set_pin_output(LED_00); + gpio_set_pin_output(LED_01); + gpio_set_pin_output(LED_02); keyboard_pre_init_user(); } @@ -28,17 +28,17 @@ bool shutdown_kb(bool jump_to_bootloader) { return false; } // Shutdown LEDs - writePinLow(LED_00); - writePinLow(LED_01); - writePinLow(LED_02); + gpio_write_pin_low(LED_00); + gpio_write_pin_low(LED_01); + gpio_write_pin_low(LED_02); return true; } layer_state_t layer_state_set_kb(layer_state_t state) { // Layer LEDs act as binary indication of current layer uint8_t layer = get_highest_layer(state); - writePin(LED_00, layer & 0b1); - writePin(LED_01, (layer >> 1) & 0b1); + gpio_write_pin(LED_00, layer & 0b1); + gpio_write_pin(LED_01, (layer >> 1) & 0b1); return layer_state_set_user(state); } @@ -51,13 +51,13 @@ void matrix_init_kb(void) { // runs once when the firmware starts up uint8_t led_delay_ms = 80; for (int i = 0; i < 2; i++) { - writePinHigh(LED_00); - writePinHigh(LED_01); - writePinHigh(LED_02); + gpio_write_pin_high(LED_00); + gpio_write_pin_high(LED_01); + gpio_write_pin_high(LED_02); wait_ms(led_delay_ms); - writePinLow(LED_00); - writePinLow(LED_01); - writePinLow(LED_02); + gpio_write_pin_low(LED_00); + gpio_write_pin_low(LED_01); + gpio_write_pin_low(LED_02); if (i < 1) { wait_ms(led_delay_ms); } @@ -69,7 +69,7 @@ void matrix_init_kb(void) { bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if(res) { - writePin(LED_02, !led_state.num_lock); + gpio_write_pin(LED_02, !led_state.num_lock); } return res; } diff --git a/keyboards/dumbpad/v1x_right/v1x_right.c b/keyboards/dumbpad/v1x_right/v1x_right.c index 1022ad0605..cdbaff54aa 100644 --- a/keyboards/dumbpad/v1x_right/v1x_right.c +++ b/keyboards/dumbpad/v1x_right/v1x_right.c @@ -17,9 +17,9 @@ void keyboard_pre_init_kb(void) { // Set LED IO as outputs - setPinOutput(LED_00); - setPinOutput(LED_01); - setPinOutput(LED_02); + gpio_set_pin_output(LED_00); + gpio_set_pin_output(LED_01); + gpio_set_pin_output(LED_02); keyboard_pre_init_user(); } @@ -28,17 +28,17 @@ bool shutdown_kb(bool jump_to_bootloader) { return false; } // Shutdown LEDs - writePinLow(LED_00); - writePinLow(LED_01); - writePinLow(LED_02); + gpio_write_pin_low(LED_00); + gpio_write_pin_low(LED_01); + gpio_write_pin_low(LED_02); return true; } layer_state_t layer_state_set_kb(layer_state_t state) { // Layer LEDs act as binary indication of current layer uint8_t layer = get_highest_layer(state); - writePin(LED_00, layer & 0b1); - writePin(LED_01, (layer >> 1) & 0b1); + gpio_write_pin(LED_00, layer & 0b1); + gpio_write_pin(LED_01, (layer >> 1) & 0b1); return layer_state_set_user(state); } @@ -51,13 +51,13 @@ void matrix_init_kb(void) { // runs once when the firmware starts up uint8_t led_delay_ms = 80; for (int i = 0; i < 2; i++) { - writePinHigh(LED_00); - writePinHigh(LED_01); - writePinHigh(LED_02); + gpio_write_pin_high(LED_00); + gpio_write_pin_high(LED_01); + gpio_write_pin_high(LED_02); wait_ms(led_delay_ms); - writePinLow(LED_00); - writePinLow(LED_01); - writePinLow(LED_02); + gpio_write_pin_low(LED_00); + gpio_write_pin_low(LED_01); + gpio_write_pin_low(LED_02); if (i < 1) { wait_ms(led_delay_ms); } @@ -69,7 +69,7 @@ void matrix_init_kb(void) { bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if(res) { - writePin(LED_02, !led_state.num_lock); + gpio_write_pin(LED_02, !led_state.num_lock); } return res; } diff --git a/keyboards/dumbpad/v3x/v3x.c b/keyboards/dumbpad/v3x/v3x.c index 89f13684f2..181e9d4a0d 100644 --- a/keyboards/dumbpad/v3x/v3x.c +++ b/keyboards/dumbpad/v3x/v3x.c @@ -48,9 +48,9 @@ led_config_t g_led_config = {{// Key Matrix to LED Index void keyboard_pre_init_kb(void) { // Set LED IO as outputs - setPinOutput(LED_00); - setPinOutput(LED_01); - setPinOutput(LED_02); + gpio_set_pin_output(LED_00); + gpio_set_pin_output(LED_01); + gpio_set_pin_output(LED_02); keyboard_pre_init_user(); } @@ -59,17 +59,17 @@ bool shutdown_kb(bool jump_to_bootloader) { return false; } // Shutdown LEDs - writePinLow(LED_00); - writePinLow(LED_01); - writePinLow(LED_02); + gpio_write_pin_low(LED_00); + gpio_write_pin_low(LED_01); + gpio_write_pin_low(LED_02); return true; } layer_state_t layer_state_set_kb(layer_state_t state) { // Layer LEDs act as binary indication of current layer uint8_t layer = get_highest_layer(state); - writePin(LED_00, layer & 0b1); - writePin(LED_01, (layer >> 1) & 0b1); + gpio_write_pin(LED_00, layer & 0b1); + gpio_write_pin(LED_01, (layer >> 1) & 0b1); uprintf("%d string", layer); return layer_state_set_user(state); } @@ -83,13 +83,13 @@ void matrix_init_kb(void) { // runs once when the firmware starts up uint8_t led_delay_ms = 80; for (int i = 0; i < 2; i++) { - writePinHigh(LED_00); - writePinHigh(LED_01); - writePinHigh(LED_02); + gpio_write_pin_high(LED_00); + gpio_write_pin_high(LED_01); + gpio_write_pin_high(LED_02); wait_ms(led_delay_ms); - writePinLow(LED_00); - writePinLow(LED_01); - writePinLow(LED_02); + gpio_write_pin_low(LED_00); + gpio_write_pin_low(LED_01); + gpio_write_pin_low(LED_02); if (i < 1) { wait_ms(led_delay_ms); } @@ -101,6 +101,6 @@ void matrix_init_kb(void) { bool led_update_kb(led_t led_state) { if (!led_update_user(led_state)) return false; // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here - writePin(LED_02, !led_state.num_lock); + gpio_write_pin(LED_02, !led_state.num_lock); return true; } diff --git a/keyboards/durgod/dgk6x/dgk6x.c b/keyboards/durgod/dgk6x/dgk6x.c index b7f1da778d..4db54859de 100644 --- a/keyboards/durgod/dgk6x/dgk6x.c +++ b/keyboards/durgod/dgk6x/dgk6x.c @@ -18,22 +18,22 @@ /* Private Functions */ void off_all_leds(void) { - writePinHigh(LED_CAPS_LOCK_PIN); - writePinHigh(LED_WIN_LOCK_PIN); - writePinHigh(LED_MR_LOCK_PIN); + gpio_write_pin_high(LED_CAPS_LOCK_PIN); + gpio_write_pin_high(LED_WIN_LOCK_PIN); + gpio_write_pin_high(LED_MR_LOCK_PIN); } void on_all_leds(void) { - writePinLow(LED_CAPS_LOCK_PIN); - writePinLow(LED_WIN_LOCK_PIN); - writePinLow(LED_MR_LOCK_PIN); + gpio_write_pin_low(LED_CAPS_LOCK_PIN); + gpio_write_pin_low(LED_WIN_LOCK_PIN); + gpio_write_pin_low(LED_MR_LOCK_PIN); } /* WinLock and MR LEDs are non-standard. Need to override led init */ void led_init_ports(void) { - setPinOutput(LED_CAPS_LOCK_PIN); - setPinOutput(LED_WIN_LOCK_PIN); - setPinOutput(LED_MR_LOCK_PIN); + gpio_set_pin_output(LED_CAPS_LOCK_PIN); + gpio_set_pin_output(LED_WIN_LOCK_PIN); + gpio_set_pin_output(LED_MR_LOCK_PIN); off_all_leds(); } @@ -44,7 +44,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { case GU_TOGG: if (record->event.pressed) { // Toggle LED on key press - togglePin(LED_WIN_LOCK_PIN); + gpio_toggle_pin(LED_WIN_LOCK_PIN); } break; } diff --git a/keyboards/durgod/k310/k310.c b/keyboards/durgod/k310/k310.c index a88100be20..7879b13f4e 100644 --- a/keyboards/durgod/k310/k310.c +++ b/keyboards/durgod/k310/k310.c @@ -22,33 +22,33 @@ /* Private Functions */ void off_all_leds(void) { #ifdef LED_NUM_LOCK_PIN - writePinHigh(LED_NUM_LOCK_PIN); + gpio_write_pin_high(LED_NUM_LOCK_PIN); #endif - writePinHigh(LED_CAPS_LOCK_PIN); - writePinHigh(LED_SCROLL_LOCK_PIN); - writePinHigh(LED_WIN_LOCK_PIN); - writePinHigh(LED_MR_LOCK_PIN); + gpio_write_pin_high(LED_CAPS_LOCK_PIN); + gpio_write_pin_high(LED_SCROLL_LOCK_PIN); + gpio_write_pin_high(LED_WIN_LOCK_PIN); + gpio_write_pin_high(LED_MR_LOCK_PIN); } void on_all_leds(void) { #ifdef LED_NUM_LOCK_PIN - writePinLow(LED_NUM_LOCK_PIN); + gpio_write_pin_low(LED_NUM_LOCK_PIN); #endif - writePinLow(LED_CAPS_LOCK_PIN); - writePinLow(LED_SCROLL_LOCK_PIN); - writePinLow(LED_WIN_LOCK_PIN); - writePinLow(LED_MR_LOCK_PIN); + gpio_write_pin_low(LED_CAPS_LOCK_PIN); + gpio_write_pin_low(LED_SCROLL_LOCK_PIN); + gpio_write_pin_low(LED_WIN_LOCK_PIN); + gpio_write_pin_low(LED_MR_LOCK_PIN); } /* WinLock and MR LEDs are non-standard. Need to override led init */ void led_init_ports(void) { #ifdef LED_NUM_LOCK_PIN - setPinOutput(LED_NUM_LOCK_PIN); + gpio_set_pin_output(LED_NUM_LOCK_PIN); #endif - setPinOutput(LED_CAPS_LOCK_PIN); - setPinOutput(LED_SCROLL_LOCK_PIN); - setPinOutput(LED_WIN_LOCK_PIN); - setPinOutput(LED_MR_LOCK_PIN); + gpio_set_pin_output(LED_CAPS_LOCK_PIN); + gpio_set_pin_output(LED_SCROLL_LOCK_PIN); + gpio_set_pin_output(LED_WIN_LOCK_PIN); + gpio_set_pin_output(LED_MR_LOCK_PIN); off_all_leds(); } @@ -58,7 +58,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { case GU_TOGG: if (record->event.pressed) { // Toggle LED on key press - togglePin(LED_WIN_LOCK_PIN); + gpio_toggle_pin(LED_WIN_LOCK_PIN); } break; } @@ -75,7 +75,7 @@ static void hardware_reset_cb(void *arg) { #endif void keyboard_pre_init_kb(void) { - setPinInputHigh(HARDWARE_RESET_PIN); + gpio_set_pin_input_high(HARDWARE_RESET_PIN); #ifndef HW_RESET_PIN_DISABLED /* Jump to bootloader when the hardware reset button is pressed */ @@ -83,7 +83,7 @@ void keyboard_pre_init_kb(void) { palSetPadCallback(PAL_PORT(HARDWARE_RESET_PIN), PAL_PAD(HARDWARE_RESET_PIN), hardware_reset_cb, NULL); /* The interrupt is edge-triggered so check that it's not already pressed */ - if (!readPin(HARDWARE_RESET_PIN)) { + if (!gpio_read_pin(HARDWARE_RESET_PIN)) { bootloader_jump(); } #endif diff --git a/keyboards/durgod/k320/k320.c b/keyboards/durgod/k320/k320.c index c1b9701d7b..0a544fe318 100644 --- a/keyboards/durgod/k320/k320.c +++ b/keyboards/durgod/k320/k320.c @@ -22,33 +22,33 @@ /* Private Functions */ void off_all_leds(void) { #ifdef LED_NUM_LOCK_PIN - writePinHigh(LED_NUM_LOCK_PIN); + gpio_write_pin_high(LED_NUM_LOCK_PIN); #endif - writePinHigh(LED_CAPS_LOCK_PIN); - writePinHigh(LED_SCROLL_LOCK_PIN); - writePinHigh(LED_WIN_LOCK_PIN); - writePinHigh(LED_MR_LOCK_PIN); + gpio_write_pin_high(LED_CAPS_LOCK_PIN); + gpio_write_pin_high(LED_SCROLL_LOCK_PIN); + gpio_write_pin_high(LED_WIN_LOCK_PIN); + gpio_write_pin_high(LED_MR_LOCK_PIN); } void on_all_leds(void) { #ifdef LED_NUM_LOCK_PIN - writePinLow(LED_NUM_LOCK_PIN); + gpio_write_pin_low(LED_NUM_LOCK_PIN); #endif - writePinLow(LED_CAPS_LOCK_PIN); - writePinLow(LED_SCROLL_LOCK_PIN); - writePinLow(LED_WIN_LOCK_PIN); - writePinLow(LED_MR_LOCK_PIN); + gpio_write_pin_low(LED_CAPS_LOCK_PIN); + gpio_write_pin_low(LED_SCROLL_LOCK_PIN); + gpio_write_pin_low(LED_WIN_LOCK_PIN); + gpio_write_pin_low(LED_MR_LOCK_PIN); } /* WinLock and MR LEDs are non-standard. Need to override led init */ void led_init_ports(void) { #ifdef LED_NUM_LOCK_PIN - setPinOutput(LED_NUM_LOCK_PIN); + gpio_set_pin_output(LED_NUM_LOCK_PIN); #endif - setPinOutput(LED_CAPS_LOCK_PIN); - setPinOutput(LED_SCROLL_LOCK_PIN); - setPinOutput(LED_WIN_LOCK_PIN); - setPinOutput(LED_MR_LOCK_PIN); + gpio_set_pin_output(LED_CAPS_LOCK_PIN); + gpio_set_pin_output(LED_SCROLL_LOCK_PIN); + gpio_set_pin_output(LED_WIN_LOCK_PIN); + gpio_set_pin_output(LED_MR_LOCK_PIN); off_all_leds(); } @@ -58,7 +58,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { case GU_TOGG: if (record->event.pressed) { // Toggle LED on key press - togglePin(LED_WIN_LOCK_PIN); + gpio_toggle_pin(LED_WIN_LOCK_PIN); } break; } @@ -75,7 +75,7 @@ static void hardware_reset_cb(void *arg) { #endif void keyboard_pre_init_kb(void) { - setPinInputHigh(HARDWARE_RESET_PIN); + gpio_set_pin_input_high(HARDWARE_RESET_PIN); #ifndef HW_RESET_PIN_DISABLED /* Jump to bootloader when the hardware reset button is pressed */ @@ -83,7 +83,7 @@ void keyboard_pre_init_kb(void) { palSetPadCallback(PAL_PORT(HARDWARE_RESET_PIN), PAL_PAD(HARDWARE_RESET_PIN), hardware_reset_cb, NULL); /* The interrupt is edge-triggered so check that it's not already pressed */ - if (!readPin(HARDWARE_RESET_PIN)) { + if (!gpio_read_pin(HARDWARE_RESET_PIN)) { bootloader_jump(); } #endif diff --git a/keyboards/dztech/bocc/bocc.c b/keyboards/dztech/bocc/bocc.c index fc2eb8d6eb..646a7861f8 100644 --- a/keyboards/dztech/bocc/bocc.c +++ b/keyboards/dztech/bocc/bocc.c @@ -16,14 +16,14 @@ #include "quantum.h" void matrix_init_kb(void) { - setPinOutput(E6); + gpio_set_pin_output(E6); matrix_init_user(); } bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if(res) { - writePin(E6, !led_state.caps_lock); + gpio_write_pin(E6, !led_state.caps_lock); } return res; } diff --git a/keyboards/ealdin/quadrant/quadrant.c b/keyboards/ealdin/quadrant/quadrant.c index f98cafd750..23be00b96f 100644 --- a/keyboards/ealdin/quadrant/quadrant.c +++ b/keyboards/ealdin/quadrant/quadrant.c @@ -54,14 +54,14 @@ bool encoder_update_kb(uint8_t index, bool clockwise) { } void keyboard_pre_init_kb(void) { - setPinOutput(F0); + gpio_set_pin_output(F0); keyboard_pre_init_user(); } bool led_update_kb(led_t led_state) { if (led_update_user(led_state)) { - writePin(F0, led_state.caps_lock); + gpio_write_pin(F0, led_state.caps_lock); } return true; } diff --git a/keyboards/edda/edda.c b/keyboards/edda/edda.c index 38d1d5ddab..b5f169abe6 100644 --- a/keyboards/edda/edda.c +++ b/keyboards/edda/edda.c @@ -18,32 +18,32 @@ void keyboard_pre_init_kb(void) { keyboard_pre_init_user(); // Set our LED pins as output - setPinOutput(B2); - setPinOutput(B1); - setPinOutput(B0); + gpio_set_pin_output(B2); + gpio_set_pin_output(B1); + gpio_set_pin_output(B0); } __attribute__((weak)) layer_state_t layer_state_set_user(layer_state_t state) { switch (get_highest_layer(state)) { case 1: - writePin(B2, 1); - writePin(B1, 0); - writePin(B0, 0); + gpio_write_pin(B2, 1); + gpio_write_pin(B1, 0); + gpio_write_pin(B0, 0); break; case 2: - writePin(B2, 1); - writePin(B1, 1); - writePin(B0, 0); + gpio_write_pin(B2, 1); + gpio_write_pin(B1, 1); + gpio_write_pin(B0, 0); break; case 3: - writePin(B2, 1); - writePin(B1, 1); - writePin(B0, 1); + gpio_write_pin(B2, 1); + gpio_write_pin(B1, 1); + gpio_write_pin(B0, 1); break; default: // for any other layers, or the default layer - writePin(B2, 0); - writePin(B1, 0); - writePin(B0, 0); + gpio_write_pin(B2, 0); + gpio_write_pin(B1, 0); + gpio_write_pin(B0, 0); break; } return state; diff --git a/keyboards/enviousdesign/commissions/mini1800/mini1800.c b/keyboards/enviousdesign/commissions/mini1800/mini1800.c index f35be22d13..86757dab8a 100644 --- a/keyboards/enviousdesign/commissions/mini1800/mini1800.c +++ b/keyboards/enviousdesign/commissions/mini1800/mini1800.c @@ -3,15 +3,15 @@ #include "quantum.h" void matrix_init_user(void) { - setPinOutput(GP9); //init gpio - writePinLow(GP9); - setPinOutput(GP11); //init and turn off inverted power led - writePinHigh(GP11); + gpio_set_pin_output(GP9); //init gpio + gpio_write_pin_low(GP9); + gpio_set_pin_output(GP11); //init and turn off inverted power led + gpio_write_pin_high(GP11); } //layer, capslock and numlock layer_state_t layer_state_set_user(layer_state_t state) { - writePin(GP9, layer_state_cmp(state, 1)); + gpio_write_pin(GP9, layer_state_cmp(state, 1)); return state; } diff --git a/keyboards/ergodox_ez/matrix.c b/keyboards/ergodox_ez/matrix.c index 9013c0785f..4d1645943b 100644 --- a/keyboards/ergodox_ez/matrix.c +++ b/keyboards/ergodox_ez/matrix.c @@ -130,12 +130,12 @@ static void init_cols(void) { // not needed, already done as part of init_mcp23018() // init on teensy - setPinInputHigh(F0); - setPinInputHigh(F1); - setPinInputHigh(F4); - setPinInputHigh(F5); - setPinInputHigh(F6); - setPinInputHigh(F7); + gpio_set_pin_input_high(F0); + gpio_set_pin_input_high(F1); + gpio_set_pin_input_high(F4); + gpio_set_pin_input_high(F5); + gpio_set_pin_input_high(F6); + gpio_set_pin_input_high(F7); } static matrix_row_t read_cols(uint8_t row) { @@ -176,13 +176,13 @@ static void unselect_rows(void) { // direction // unselect on teensy - setPinInput(B0); - setPinInput(B1); - setPinInput(B2); - setPinInput(B3); - setPinInput(D2); - setPinInput(D3); - setPinInput(C6); + gpio_set_pin_input(B0); + gpio_set_pin_input(B1); + gpio_set_pin_input(B2); + gpio_set_pin_input(B3); + gpio_set_pin_input(D2); + gpio_set_pin_input(D3); + gpio_set_pin_input(C6); } static void select_row(uint8_t row) { @@ -200,32 +200,32 @@ static void select_row(uint8_t row) { // Output low(DDR:1, PORT:0) to select switch (row) { case 7: - setPinOutput(B0); - writePinLow(B0); + gpio_set_pin_output(B0); + gpio_write_pin_low(B0); break; case 8: - setPinOutput(B1); - writePinLow(B1); + gpio_set_pin_output(B1); + gpio_write_pin_low(B1); break; case 9: - setPinOutput(B2); - writePinLow(B2); + gpio_set_pin_output(B2); + gpio_write_pin_low(B2); break; case 10: - setPinOutput(B3); - writePinLow(B3); + gpio_set_pin_output(B3); + gpio_write_pin_low(B3); break; case 11: - setPinOutput(D2); - writePinLow(D2); + gpio_set_pin_output(D2); + gpio_write_pin_low(D2); break; case 12: - setPinOutput(D3); - writePinLow(D3); + gpio_set_pin_output(D3); + gpio_write_pin_low(D3); break; case 13: - setPinOutput(C6); - writePinLow(C6); + gpio_set_pin_output(C6); + gpio_write_pin_low(C6); break; } } diff --git a/keyboards/evyd13/gh80_3700/gh80_3700.c b/keyboards/evyd13/gh80_3700/gh80_3700.c index 617de50d5d..6d903e48e1 100644 --- a/keyboards/evyd13/gh80_3700/gh80_3700.c +++ b/keyboards/evyd13/gh80_3700/gh80_3700.c @@ -16,22 +16,22 @@ #include "quantum.h" void led_init_ports(void) { - setPinOutput(E6); - setPinOutput(B1); - setPinOutput(D0); - setPinOutput(D1); - setPinOutput(F0); + gpio_set_pin_output(E6); + gpio_set_pin_output(B1); + gpio_set_pin_output(D0); + gpio_set_pin_output(D1); + gpio_set_pin_output(F0); - writePinHigh(E6); - writePinHigh(B1); - writePinHigh(D0); - writePinHigh(D1); - writePinHigh(F0); + gpio_write_pin_high(E6); + gpio_write_pin_high(B1); + gpio_write_pin_high(D0); + gpio_write_pin_high(D1); + gpio_write_pin_high(F0); } bool led_update_kb(led_t led_state) { if(led_update_user(led_state)) { - writePin(E6, !led_state.num_lock); + gpio_write_pin(E6, !led_state.num_lock); } return true; diff --git a/keyboards/evyd13/gud70/gud70.c b/keyboards/evyd13/gud70/gud70.c index f9b5050ea7..5c40045521 100644 --- a/keyboards/evyd13/gud70/gud70.c +++ b/keyboards/evyd13/gud70/gud70.c @@ -17,6 +17,6 @@ void keyboard_pre_init_kb(void) { // Enable top LED - setPinOutput(B3); - writePinLow(B3); + gpio_set_pin_output(B3); + gpio_write_pin_low(B3); } diff --git a/keyboards/evyd13/pockettype/pockettype.c b/keyboards/evyd13/pockettype/pockettype.c index b9aee69496..7e372363fa 100644 --- a/keyboards/evyd13/pockettype/pockettype.c +++ b/keyboards/evyd13/pockettype/pockettype.c @@ -17,20 +17,20 @@ void led_init_ports(void) { // * Enable LED anodes (Vbus pin is replaced by B0 on some boards) - setPinOutput(B0); - writePinHigh(B0); + gpio_set_pin_output(B0); + gpio_write_pin_high(B0); // * Set our LED pins as output and high - setPinOutput(F5); - writePinHigh(F5); + gpio_set_pin_output(F5); + gpio_write_pin_high(F5); - setPinOutput(F4); - writePinLow(F4); + gpio_set_pin_output(F4); + gpio_write_pin_low(F4); } bool led_update_kb(led_t led_state) { if(led_update_user(led_state)) { - writePin(F5, !led_state.caps_lock); + gpio_write_pin(F5, !led_state.caps_lock); } return true; diff --git a/keyboards/evyd13/wasdat/matrix.c b/keyboards/evyd13/wasdat/matrix.c index ae4bb6cb3a..b83f2b900a 100644 --- a/keyboards/evyd13/wasdat/matrix.c +++ b/keyboards/evyd13/wasdat/matrix.c @@ -46,7 +46,7 @@ static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; */ static void select_col(uint8_t col) { if (col_pins[col] != NO_PIN) { - writePinLow(col_pins[col]); + gpio_write_pin_low(col_pins[col]); } else { sn74x138_set_addr(13 - col); } @@ -54,8 +54,8 @@ static void select_col(uint8_t col) { static void unselect_col(uint8_t col) { if (col_pins[col] != NO_PIN) { - setPinOutput(col_pins[col]); - writePinHigh(col_pins[col]); + gpio_set_pin_output(col_pins[col]); + gpio_write_pin_high(col_pins[col]); } else { sn74x138_set_addr(0); } @@ -65,8 +65,8 @@ static void unselect_cols(void) { // Native for (uint8_t x = 0; x < MATRIX_COLS; x++) { if (col_pins[x] != NO_PIN) { - setPinOutput(col_pins[x]); - writePinHigh(col_pins[x]); + gpio_set_pin_output(col_pins[x]); + gpio_write_pin_high(col_pins[x]); } } @@ -77,7 +77,7 @@ static void unselect_cols(void) { static void init_pins(void) { unselect_cols(); for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } } @@ -94,7 +94,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) matrix_row_t last_row_value = current_matrix[row_index]; // Check row pin state - if (readPin(row_pins[row_index]) == 0) { + if (gpio_read_pin(row_pins[row_index]) == 0) { // Pin LO, set col bit current_matrix[row_index] |= (MATRIX_ROW_SHIFTER << current_col); } else { diff --git a/keyboards/evyd13/wasdat_code/matrix.c b/keyboards/evyd13/wasdat_code/matrix.c index d392a31d7c..5c3f119158 100644 --- a/keyboards/evyd13/wasdat_code/matrix.c +++ b/keyboards/evyd13/wasdat_code/matrix.c @@ -48,7 +48,7 @@ static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; */ static void select_col(uint8_t col) { if (col_pins[col] != NO_PIN) { - writePinLow(col_pins[col]); + gpio_write_pin_low(col_pins[col]); } else { sn74x138_set_addr((col == 6) ? 7 : 15 - col); sn74x138_set_enabled(true); @@ -57,8 +57,8 @@ static void select_col(uint8_t col) { static void unselect_col(uint8_t col) { if (col_pins[col] != NO_PIN) { - setPinOutput(col_pins[col]); - writePinHigh(col_pins[col]); + gpio_set_pin_output(col_pins[col]); + gpio_write_pin_high(col_pins[col]); } else { sn74x138_set_enabled(false); } @@ -68,8 +68,8 @@ static void unselect_cols(void) { // Native for (uint8_t x = 0; x < MATRIX_COLS; x++) { if (col_pins[x] != NO_PIN) { - setPinOutput(col_pins[x]); - writePinHigh(col_pins[x]); + gpio_set_pin_output(col_pins[x]); + gpio_write_pin_high(col_pins[x]); } } @@ -80,7 +80,7 @@ static void unselect_cols(void) { static void init_pins(void) { unselect_cols(); for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } } @@ -97,7 +97,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) matrix_row_t last_row_value = current_matrix[row_index]; // Check row pin state - if (readPin(row_pins[row_index]) == 0) { + if (gpio_read_pin(row_pins[row_index]) == 0) { // Pin LO, set col bit current_matrix[row_index] |= (MATRIX_ROW_SHIFTER << current_col); } else { diff --git a/keyboards/exclusive/e6v2/oe/oe.c b/keyboards/exclusive/e6v2/oe/oe.c index 6869a52c97..b15fa32ab0 100644 --- a/keyboards/exclusive/e6v2/oe/oe.c +++ b/keyboards/exclusive/e6v2/oe/oe.c @@ -1,15 +1,15 @@ #include "quantum.h" void led_init_ports(void) { - setPinOutput(B2); - setPinOutput(B6); + gpio_set_pin_output(B2); + gpio_set_pin_output(B6); } bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if(res) { - writePin(B2, !led_state.caps_lock); - writePin(B6, led_state.raw == 0); + gpio_write_pin(B2, !led_state.caps_lock); + gpio_write_pin(B6, led_state.raw == 0); } return res; } diff --git a/keyboards/exclusive/e85/hotswap/hotswap.c b/keyboards/exclusive/e85/hotswap/hotswap.c index a6d50b1f77..18ca30b44c 100644 --- a/keyboards/exclusive/e85/hotswap/hotswap.c +++ b/keyboards/exclusive/e85/hotswap/hotswap.c @@ -17,16 +17,16 @@ #include "quantum.h" void keyboard_pre_init_kb(void) { - setPinOutput(C7); - setPinOutput(B5); + gpio_set_pin_output(C7); + gpio_set_pin_output(B5); keyboard_pre_init_user(); } bool led_update_kb(led_t led_state) { if (led_update_user(led_state)) { - writePin(C7, led_state.caps_lock); - writePin(B5, led_state.scroll_lock); + gpio_write_pin(C7, led_state.caps_lock); + gpio_write_pin(B5, led_state.scroll_lock); } return true; } diff --git a/keyboards/exclusive/e85/soldered/soldered.c b/keyboards/exclusive/e85/soldered/soldered.c index 81ae1f00ce..bdee95c26c 100644 --- a/keyboards/exclusive/e85/soldered/soldered.c +++ b/keyboards/exclusive/e85/soldered/soldered.c @@ -17,16 +17,16 @@ #include "quantum.h" void keyboard_pre_init_kb(void) { - setPinOutput(C7); - setPinOutput(B5); + gpio_set_pin_output(C7); + gpio_set_pin_output(B5); keyboard_pre_init_user(); } bool led_update_kb(led_t led_state) { if (led_update_user(led_state)) { - writePin(C7, led_state.caps_lock); - writePin(B5, led_state.scroll_lock); + gpio_write_pin(C7, led_state.caps_lock); + gpio_write_pin(B5, led_state.scroll_lock); } return true; } diff --git a/keyboards/ferris/0_1/matrix.c b/keyboards/ferris/0_1/matrix.c index 154a275d7a..a3e2bebba6 100644 --- a/keyboards/ferris/0_1/matrix.c +++ b/keyboards/ferris/0_1/matrix.c @@ -182,8 +182,8 @@ static void init_cols(void) { pin_t matrix_col_pins_mcu[MATRIX_COLS_PER_SIDE] = MATRIX_COL_PINS_MCU; for (int pin_index = 0; pin_index < MATRIX_COLS_PER_SIDE; pin_index++) { pin_t pin = matrix_col_pins_mcu[pin_index]; - setPinInput(pin); - writePinHigh(pin); + gpio_set_pin_input(pin); + gpio_write_pin_high(pin); } } @@ -194,7 +194,7 @@ static matrix_row_t read_cols(uint8_t row) { // For each col... for (uint8_t col_index = 0; col_index < MATRIX_COLS_PER_SIDE; col_index++) { // Select the col pin to read (active low) - uint8_t pin_state = readPin(matrix_col_pins_mcu[col_index]); + uint8_t pin_state = gpio_read_pin(matrix_col_pins_mcu[col_index]); // Populate the matrix row with the state of the col pin current_row_value |= pin_state ? 0 : (MATRIX_ROW_SHIFTER << col_index); @@ -229,8 +229,8 @@ static void unselect_rows(void) { pin_t matrix_row_pins_mcu[MATRIX_ROWS_PER_SIDE] = MATRIX_ROW_PINS_MCU; for (int pin_index = 0; pin_index < MATRIX_ROWS_PER_SIDE; pin_index++) { pin_t pin = matrix_row_pins_mcu[pin_index]; - setPinInput(pin); - writePinLow(pin); + gpio_set_pin_input(pin); + gpio_write_pin_low(pin); } } @@ -239,8 +239,8 @@ static void select_row(uint8_t row) { // select on atmega32u4 pin_t matrix_row_pins_mcu[MATRIX_ROWS_PER_SIDE] = MATRIX_ROW_PINS_MCU; pin_t pin = matrix_row_pins_mcu[row]; - setPinOutput(pin); - writePinLow(pin); + gpio_set_pin_output(pin); + gpio_write_pin_low(pin); } else { // select on mcp23017 if (mcp23017_status) { // if there was an error diff --git a/keyboards/ferris/0_2/matrix.c b/keyboards/ferris/0_2/matrix.c index 41b100b659..74fab717a1 100644 --- a/keyboards/ferris/0_2/matrix.c +++ b/keyboards/ferris/0_2/matrix.c @@ -173,7 +173,7 @@ static matrix_row_t read_cols(uint8_t row) { // For each col... for (uint8_t col_index = 0; col_index < MATRIX_COLS_PER_SIDE; col_index++) { // Select the col pin to read (active low) - uint8_t pin_state = readPin(matrix_col_pins_mcu[col_index]); + uint8_t pin_state = gpio_read_pin(matrix_col_pins_mcu[col_index]); // Populate the matrix row with the state of the col pin current_row_value |= pin_state ? 0 : (MATRIX_ROW_SHIFTER << col_index); @@ -199,7 +199,7 @@ static matrix_row_t read_cols(uint8_t row) { static void unselect_row(uint8_t row) { pin_t matrix_row_pins_mcu[MATRIX_ROWS_PER_SIDE] = MATRIX_ROW_PINS_MCU; - setPinInputHigh(matrix_row_pins_mcu[row]); + gpio_set_pin_input_high(matrix_row_pins_mcu[row]); } static void unselect_rows(void) { @@ -211,14 +211,14 @@ static void unselect_rows(void) { pin_t matrix_row_pins_mcu[MATRIX_ROWS_PER_SIDE] = MATRIX_ROW_PINS_MCU; for (int pin_index = 0; pin_index < MATRIX_ROWS_PER_SIDE; pin_index++) { pin_t pin = matrix_row_pins_mcu[pin_index]; - setPinInputHigh(pin); + gpio_set_pin_input_high(pin); } } static void unselect_cols(void) { pin_t matrix_col_pins_mcu[MATRIX_COLS_PER_SIDE] = MATRIX_COL_PINS_MCU; for (int pin_index = 0; pin_index < MATRIX_COLS_PER_SIDE; pin_index++) { pin_t pin = matrix_col_pins_mcu[pin_index]; - setPinInputHigh(pin); + gpio_set_pin_input_high(pin); } } @@ -227,8 +227,8 @@ static void select_row(uint8_t row) { // select on MCU pin_t matrix_row_pins_mcu[MATRIX_ROWS_PER_SIDE] = MATRIX_ROW_PINS_MCU; pin_t pin = matrix_row_pins_mcu[row]; - setPinOutput(pin); - writePinLow(pin); + gpio_set_pin_output(pin); + gpio_write_pin_low(pin); } else { // select on mcp23017 if (mcp23017_status) { // if there was an error diff --git a/keyboards/fjlabs/bolsa65/bolsa65.c b/keyboards/fjlabs/bolsa65/bolsa65.c index 1c65ca1a3d..669404192c 100644 --- a/keyboards/fjlabs/bolsa65/bolsa65.c +++ b/keyboards/fjlabs/bolsa65/bolsa65.c @@ -15,14 +15,14 @@ along with this program. If not, see . void matrix_init_kb(void) { // Initialize indicator LEDs to output - setPinOutput(F7); // Caps + gpio_set_pin_output(F7); // Caps matrix_init_user(); } bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if(res) { - writePin(F7, led_state.caps_lock); + gpio_write_pin(F7, led_state.caps_lock); } return res; } diff --git a/keyboards/flx/virgo/virgo.c b/keyboards/flx/virgo/virgo.c index 5260e15322..2f875531d0 100644 --- a/keyboards/flx/virgo/virgo.c +++ b/keyboards/flx/virgo/virgo.c @@ -20,15 +20,15 @@ void matrix_init_kb(void) { // put your keyboard start-up code here // runs once when the firmware starts up - setPinOutput(E6); - setPinOutput(B2); + gpio_set_pin_output(E6); + gpio_set_pin_output(B2); matrix_init_user(); } bool led_update_kb(led_t led_state) { if(led_update_user(led_state)) { - writePin(E6, !led_state.caps_lock); - writePin(B2, !led_state.scroll_lock); + gpio_write_pin(E6, !led_state.caps_lock); + gpio_write_pin(B2, !led_state.scroll_lock); } return true; } diff --git a/keyboards/gboards/gergoplex/matrix.c b/keyboards/gboards/gergoplex/matrix.c index 9abe9a83b3..3ea6a13385 100644 --- a/keyboards/gboards/gergoplex/matrix.c +++ b/keyboards/gboards/gergoplex/matrix.c @@ -168,7 +168,7 @@ void matrix_print(void) { // Remember this means ROWS static void init_cols(void) { for (uint8_t col = 0; col < MATRIX_COLS; col++) { - setPinInputHigh(col_pins[col]); + gpio_set_pin_input_high(col_pins[col]); } } @@ -195,8 +195,8 @@ static void unselect_rows(void) { // the other row bits high, and it's not changing to a different direction for (uint8_t row = 0; row < MATRIX_ROWS_PER_SIDE; row++) { - setPinInput(row_pins[row]); - writePinLow(row_pins[row]); + gpio_set_pin_input(row_pins[row]); + gpio_write_pin_low(row_pins[row]); } } @@ -211,7 +211,7 @@ static void select_row(uint8_t row) { } } else { - setPinOutput(row_pins[row - MATRIX_ROWS_PER_SIDE]); - writePinLow(row_pins[row - MATRIX_ROWS_PER_SIDE]); + gpio_set_pin_output(row_pins[row - MATRIX_ROWS_PER_SIDE]); + gpio_write_pin_low(row_pins[row - MATRIX_ROWS_PER_SIDE]); } } diff --git a/keyboards/geistmaschine/macropod/matrix.c b/keyboards/geistmaschine/macropod/matrix.c index 98796133f1..5cd35b47d4 100644 --- a/keyboards/geistmaschine/macropod/matrix.c +++ b/keyboards/geistmaschine/macropod/matrix.c @@ -38,7 +38,7 @@ void pca9555_setup(void) { void matrix_init_custom(void) { // Encoder pushbutton on the MCU is connected to PD2 - setPinInputHigh(D2); + gpio_set_pin_input_high(D2); pca9555_setup(); } @@ -79,7 +79,7 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { } // Shift pin states by 1 to make room for the switch connected to the MCU, then OR them together and invert (as QMK uses inverted logic compared to the electrical levels) - matrix_row_t data = ~(pin_states << 1 | readPin(D2)); + matrix_row_t data = ~(pin_states << 1 | gpio_read_pin(D2)); bool changed = current_matrix[0] != data; current_matrix[0] = data; diff --git a/keyboards/geonworks/ee_at/ee_at.c b/keyboards/geonworks/ee_at/ee_at.c index b2e6320851..099fbf315d 100644 --- a/keyboards/geonworks/ee_at/ee_at.c +++ b/keyboards/geonworks/ee_at/ee_at.c @@ -17,14 +17,14 @@ void led_init_ports(void) { // Set our LED pins as open drain outputs - setPinOutputOpenDrain(LED_CAPS_LOCK_PIN); - setPinOutputOpenDrain(LED_NUM_LOCK_PIN); - setPinOutputOpenDrain(LED_SCROLL_LOCK_PIN); - setPinOutputOpenDrain(LED_KANA_PIN); - setPinOutputOpenDrain(A14); + gpio_set_pin_output_open_drain(LED_CAPS_LOCK_PIN); + gpio_set_pin_output_open_drain(LED_NUM_LOCK_PIN); + gpio_set_pin_output_open_drain(LED_SCROLL_LOCK_PIN); + gpio_set_pin_output_open_drain(LED_KANA_PIN); + gpio_set_pin_output_open_drain(A14); } layer_state_t layer_state_set_kb(layer_state_t state) { - writePin(A14, !layer_state_cmp(state, 1)); + gpio_write_pin(A14, !layer_state_cmp(state, 1)); return layer_state_set_user(state); } diff --git a/keyboards/geonworks/w1_at/w1_at.c b/keyboards/geonworks/w1_at/w1_at.c index 9858561bc5..114574455b 100644 --- a/keyboards/geonworks/w1_at/w1_at.c +++ b/keyboards/geonworks/w1_at/w1_at.c @@ -17,14 +17,14 @@ void led_init_ports(void) { // Set our LED pins as open drain outputs - setPinOutputOpenDrain(LED_CAPS_LOCK_PIN); - setPinOutputOpenDrain(LED_NUM_LOCK_PIN); - setPinOutputOpenDrain(LED_SCROLL_LOCK_PIN); - setPinOutputOpenDrain(LED_KANA_PIN); - setPinOutputOpenDrain(A14); + gpio_set_pin_output_open_drain(LED_CAPS_LOCK_PIN); + gpio_set_pin_output_open_drain(LED_NUM_LOCK_PIN); + gpio_set_pin_output_open_drain(LED_SCROLL_LOCK_PIN); + gpio_set_pin_output_open_drain(LED_KANA_PIN); + gpio_set_pin_output_open_drain(A14); } layer_state_t layer_state_set_kb(layer_state_t state) { - writePin(A14, !layer_state_cmp(state, 1)); + gpio_write_pin(A14, !layer_state_cmp(state, 1)); return layer_state_set_user(state); } diff --git a/keyboards/gh60/revc/revc.h b/keyboards/gh60/revc/revc.h index 0ddc9aa344..e42c370562 100644 --- a/keyboards/gh60/revc/revc.h +++ b/keyboards/gh60/revc/revc.h @@ -12,14 +12,14 @@ * B2 Capslock LED * B0 not connected */ -static inline void gh60_caps_led_on(void) { setPinOutput(B2); writePinLow(B2); } -static inline void gh60_poker_leds_on(void) { setPinOutput(F4); writePinLow(F4); } -static inline void gh60_fn_led_on(void) { setPinOutput(F5); writePinLow(F5); } -static inline void gh60_esc_led_on(void) { setPinOutput(F6); writePinLow(F6); } -static inline void gh60_wasd_leds_on(void) { setPinOutput(F7); writePinLow(F7); } +static inline void gh60_caps_led_on(void) { gpio_set_pin_output(B2); gpio_write_pin_low(B2); } +static inline void gh60_poker_leds_on(void) { gpio_set_pin_output(F4); gpio_write_pin_low(F4); } +static inline void gh60_fn_led_on(void) { gpio_set_pin_output(F5); gpio_write_pin_low(F5); } +static inline void gh60_esc_led_on(void) { gpio_set_pin_output(F6); gpio_write_pin_low(F6); } +static inline void gh60_wasd_leds_on(void) { gpio_set_pin_output(F7); gpio_write_pin_low(F7); } -static inline void gh60_caps_led_off(void) { setPinInput(B2); } -static inline void gh60_poker_leds_off(void) { setPinInput(F4); } -static inline void gh60_fn_led_off(void) { setPinInput(F5); } -static inline void gh60_esc_led_off(void) { setPinInput(F6); } -static inline void gh60_wasd_leds_off(void) { setPinInput(F7); } +static inline void gh60_caps_led_off(void) { gpio_set_pin_input(B2); } +static inline void gh60_poker_leds_off(void) { gpio_set_pin_input(F4); } +static inline void gh60_fn_led_off(void) { gpio_set_pin_input(F5); } +static inline void gh60_esc_led_off(void) { gpio_set_pin_input(F6); } +static inline void gh60_wasd_leds_off(void) { gpio_set_pin_input(F7); } diff --git a/keyboards/ghs/rar/rar.c b/keyboards/ghs/rar/rar.c index 481a2a0c41..591932c99c 100644 --- a/keyboards/ghs/rar/rar.c +++ b/keyboards/ghs/rar/rar.c @@ -18,8 +18,8 @@ void keyboard_pre_init_kb(void) { // Set our LED pins as output. - setPinOutput(B1); - setPinOutput(B3); + gpio_set_pin_output(B1); + gpio_set_pin_output(B3); keyboard_pre_init_user(); } @@ -28,8 +28,8 @@ bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if (res) { - writePin(B1, led_state.caps_lock); - writePin(B3, led_state.scroll_lock); + gpio_write_pin(B1, led_state.caps_lock); + gpio_write_pin(B3, led_state.scroll_lock); } return res; diff --git a/keyboards/gl516/a52gl/matrix.c b/keyboards/gl516/a52gl/matrix.c index af13768b08..1e2948f716 100644 --- a/keyboards/gl516/a52gl/matrix.c +++ b/keyboards/gl516/a52gl/matrix.c @@ -21,37 +21,37 @@ static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; static void select_row(uint8_t row) { - setPinOutput(row_pins[row]); - writePinLow(row_pins[row]); + gpio_set_pin_output(row_pins[row]); + gpio_write_pin_low(row_pins[row]); } static void unselect_row(uint8_t row) { - setPinInputHigh(row_pins[row]); + gpio_set_pin_input_high(row_pins[row]); } static void unselect_rows(void) { for(uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } } static void select_col(uint8_t col) { - setPinOutput(col_pins[col]); - writePinLow(col_pins[col]); + gpio_set_pin_output(col_pins[col]); + gpio_write_pin_low(col_pins[col]); } static void unselect_col(uint8_t col) { - setPinInputHigh(col_pins[col]); + gpio_set_pin_input_high(col_pins[col]); } static void unselect_cols(void) { for(uint8_t x = 0; x < MATRIX_COLS; x++) { - setPinInputHigh(col_pins[x]); + gpio_set_pin_input_high(col_pins[x]); } } @@ -59,10 +59,10 @@ static void init_pins(void) { unselect_rows(); unselect_cols(); for (uint8_t x = 0; x < MATRIX_COLS; x++) { - setPinInputHigh(col_pins[x]); + gpio_set_pin_input_high(col_pins[x]); } for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } } @@ -82,7 +82,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) for(uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { // Select the col pin to read (active low) - uint8_t pin_state = readPin(col_pins[col_index]); + uint8_t pin_state = gpio_read_pin(col_pins[col_index]); // Populate the matrix row with the state of the col pin current_matrix[current_row] |= pin_state ? 0 : (MATRIX_ROW_SHIFTER << col_index); @@ -110,7 +110,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) matrix_row_t last_row_value = current_matrix[tmp]; // Check row pin state - if (readPin(row_pins[row_index]) == 0) + if (gpio_read_pin(row_pins[row_index]) == 0) { // Pin LO, set col bit current_matrix[tmp] |= (MATRIX_ROW_SHIFTER << current_col); diff --git a/keyboards/gl516/j73gl/matrix.c b/keyboards/gl516/j73gl/matrix.c index af13768b08..1e2948f716 100644 --- a/keyboards/gl516/j73gl/matrix.c +++ b/keyboards/gl516/j73gl/matrix.c @@ -21,37 +21,37 @@ static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; static void select_row(uint8_t row) { - setPinOutput(row_pins[row]); - writePinLow(row_pins[row]); + gpio_set_pin_output(row_pins[row]); + gpio_write_pin_low(row_pins[row]); } static void unselect_row(uint8_t row) { - setPinInputHigh(row_pins[row]); + gpio_set_pin_input_high(row_pins[row]); } static void unselect_rows(void) { for(uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } } static void select_col(uint8_t col) { - setPinOutput(col_pins[col]); - writePinLow(col_pins[col]); + gpio_set_pin_output(col_pins[col]); + gpio_write_pin_low(col_pins[col]); } static void unselect_col(uint8_t col) { - setPinInputHigh(col_pins[col]); + gpio_set_pin_input_high(col_pins[col]); } static void unselect_cols(void) { for(uint8_t x = 0; x < MATRIX_COLS; x++) { - setPinInputHigh(col_pins[x]); + gpio_set_pin_input_high(col_pins[x]); } } @@ -59,10 +59,10 @@ static void init_pins(void) { unselect_rows(); unselect_cols(); for (uint8_t x = 0; x < MATRIX_COLS; x++) { - setPinInputHigh(col_pins[x]); + gpio_set_pin_input_high(col_pins[x]); } for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } } @@ -82,7 +82,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) for(uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { // Select the col pin to read (active low) - uint8_t pin_state = readPin(col_pins[col_index]); + uint8_t pin_state = gpio_read_pin(col_pins[col_index]); // Populate the matrix row with the state of the col pin current_matrix[current_row] |= pin_state ? 0 : (MATRIX_ROW_SHIFTER << col_index); @@ -110,7 +110,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) matrix_row_t last_row_value = current_matrix[tmp]; // Check row pin state - if (readPin(row_pins[row_index]) == 0) + if (gpio_read_pin(row_pins[row_index]) == 0) { // Pin LO, set col bit current_matrix[tmp] |= (MATRIX_ROW_SHIFTER << current_col); diff --git a/keyboards/gl516/n51gl/matrix.c b/keyboards/gl516/n51gl/matrix.c index af13768b08..1e2948f716 100644 --- a/keyboards/gl516/n51gl/matrix.c +++ b/keyboards/gl516/n51gl/matrix.c @@ -21,37 +21,37 @@ static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; static void select_row(uint8_t row) { - setPinOutput(row_pins[row]); - writePinLow(row_pins[row]); + gpio_set_pin_output(row_pins[row]); + gpio_write_pin_low(row_pins[row]); } static void unselect_row(uint8_t row) { - setPinInputHigh(row_pins[row]); + gpio_set_pin_input_high(row_pins[row]); } static void unselect_rows(void) { for(uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } } static void select_col(uint8_t col) { - setPinOutput(col_pins[col]); - writePinLow(col_pins[col]); + gpio_set_pin_output(col_pins[col]); + gpio_write_pin_low(col_pins[col]); } static void unselect_col(uint8_t col) { - setPinInputHigh(col_pins[col]); + gpio_set_pin_input_high(col_pins[col]); } static void unselect_cols(void) { for(uint8_t x = 0; x < MATRIX_COLS; x++) { - setPinInputHigh(col_pins[x]); + gpio_set_pin_input_high(col_pins[x]); } } @@ -59,10 +59,10 @@ static void init_pins(void) { unselect_rows(); unselect_cols(); for (uint8_t x = 0; x < MATRIX_COLS; x++) { - setPinInputHigh(col_pins[x]); + gpio_set_pin_input_high(col_pins[x]); } for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } } @@ -82,7 +82,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) for(uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { // Select the col pin to read (active low) - uint8_t pin_state = readPin(col_pins[col_index]); + uint8_t pin_state = gpio_read_pin(col_pins[col_index]); // Populate the matrix row with the state of the col pin current_matrix[current_row] |= pin_state ? 0 : (MATRIX_ROW_SHIFTER << col_index); @@ -110,7 +110,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) matrix_row_t last_row_value = current_matrix[tmp]; // Check row pin state - if (readPin(row_pins[row_index]) == 0) + if (gpio_read_pin(row_pins[row_index]) == 0) { // Pin LO, set col bit current_matrix[tmp] |= (MATRIX_ROW_SHIFTER << current_col); diff --git a/keyboards/glenpickle/chimera_ortho_plus/chimera_ortho_plus.c b/keyboards/glenpickle/chimera_ortho_plus/chimera_ortho_plus.c index 6f32d1fb55..b75fff9634 100644 --- a/keyboards/glenpickle/chimera_ortho_plus/chimera_ortho_plus.c +++ b/keyboards/glenpickle/chimera_ortho_plus/chimera_ortho_plus.c @@ -9,7 +9,6 @@ void led_init(void) { gpio_write_pin_high(CHIMERA_ORTHO_PLUS_RED_LED_PIN); } - void matrix_init_kb(void) { // put your keyboard start-up code here // runs once when the firmware starts up diff --git a/keyboards/gmmk/gmmk2/p96/ansi/ansi.c b/keyboards/gmmk/gmmk2/p96/ansi/ansi.c index d60b9e2254..5b2b5893f7 100644 --- a/keyboards/gmmk/gmmk2/p96/ansi/ansi.c +++ b/keyboards/gmmk/gmmk2/p96/ansi/ansi.c @@ -317,9 +317,9 @@ void spi_init(void) { is_initialised = true; // Try releasing special pins for a short time - setPinInput(SPI_SCK_PIN); - setPinInput(SPI_MOSI_PIN); - setPinInput(SPI_MISO_PIN); + gpio_set_pin_input(SPI_SCK_PIN); + gpio_set_pin_input(SPI_MOSI_PIN); + gpio_set_pin_input(SPI_MISO_PIN); chThdSleepMilliseconds(10); diff --git a/keyboards/gmmk/gmmk2/p96/iso/iso.c b/keyboards/gmmk/gmmk2/p96/iso/iso.c index af2ee17c4a..9a5c357307 100644 --- a/keyboards/gmmk/gmmk2/p96/iso/iso.c +++ b/keyboards/gmmk/gmmk2/p96/iso/iso.c @@ -313,9 +313,9 @@ void spi_init(void) { is_initialised = true; // Try releasing special pins for a short time - setPinInput(SPI_SCK_PIN); - setPinInput(SPI_MOSI_PIN); - setPinInput(SPI_MISO_PIN); + gpio_set_pin_input(SPI_SCK_PIN); + gpio_set_pin_input(SPI_MOSI_PIN); + gpio_set_pin_input(SPI_MISO_PIN); chThdSleepMilliseconds(10); diff --git a/keyboards/gmmk/numpad/matrix.c b/keyboards/gmmk/numpad/matrix.c index 68d4ab6524..4ec41bdb73 100644 --- a/keyboards/gmmk/numpad/matrix.c +++ b/keyboards/gmmk/numpad/matrix.c @@ -21,27 +21,27 @@ static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; static inline void setPinOutput_writeLow(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinLow(pin); + gpio_set_pin_output(pin); + gpio_write_pin_low(pin); } } static inline void setPinOutput_writeHigh(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinHigh(pin); + gpio_set_pin_output(pin); + gpio_write_pin_high(pin); } } static inline void setPinInputHigh_atomic(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinInputHigh(pin); + gpio_set_pin_input_high(pin); } } static inline uint8_t readMatrixPin(pin_t pin) { if (pin != NO_PIN) { - return readPin(pin); + return gpio_read_pin(pin); } else { return 1; } diff --git a/keyboards/gmmk/numpad/numpad.c b/keyboards/gmmk/numpad/numpad.c index 5a2bbdb1f6..cdbc4b871a 100644 --- a/keyboards/gmmk/numpad/numpad.c +++ b/keyboards/gmmk/numpad/numpad.c @@ -111,8 +111,8 @@ led_config_t g_led_config = {{ void keyboard_pre_init_user(void) { wait_ms(2000); - setPinOutput(AW20216S_PW_EN_PIN); - writePinHigh(AW20216S_PW_EN_PIN); + gpio_set_pin_output(AW20216S_PW_EN_PIN); + gpio_write_pin_high(AW20216S_PW_EN_PIN); } # endif diff --git a/keyboards/gray_studio/think65/solder/solder.c b/keyboards/gray_studio/think65/solder/solder.c index f97a005218..84267b9db0 100644 --- a/keyboards/gray_studio/think65/solder/solder.c +++ b/keyboards/gray_studio/think65/solder/solder.c @@ -24,13 +24,13 @@ void matrix_init_kb(void) { // put your keyboard start-up code here // runs once when the firmware starts up - setPinOutput(C7); + gpio_set_pin_output(C7); matrix_init_user(); } bool led_update_kb(led_t led_state) { if(led_update_user(led_state)) { - writePin(C7, !led_state.caps_lock); + gpio_write_pin(C7, !led_state.caps_lock); } return true; } diff --git a/keyboards/halfcliff/matrix.c b/keyboards/halfcliff/matrix.c index 99598dc1b7..ad3ad6ba09 100644 --- a/keyboards/halfcliff/matrix.c +++ b/keyboards/halfcliff/matrix.c @@ -52,13 +52,13 @@ void matrix_print(void) {} static inline void setPinOutput_writeLow(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinLow(pin); + gpio_set_pin_output(pin); + gpio_write_pin_low(pin); } } static inline void setPinInputHigh_atomic(pin_t pin) { - ATOMIC_BLOCK_FORCEON { setPinInputHigh(pin); } + ATOMIC_BLOCK_FORCEON { gpio_set_pin_input_high(pin); } } // matrix code @@ -83,7 +83,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) // For each col... for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { // Select the col pin to read (active low) - uint8_t pin_state = readPin(col_pins[col_index]); + uint8_t pin_state = gpio_read_pin(col_pins[col_index]); // Populate the matrix row with the state of the col pin current_row_value |= pin_state ? 0 : (MATRIX_ROW_SHIFTER << col_index); @@ -138,7 +138,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) matrix_row_t current_row_value = last_row_value; // Check row pin state - if (readPin(row_pins[row_index]) == 0) { + if (gpio_read_pin(row_pins[row_index]) == 0) { // Pin LO, set col bit current_row_value |= (MATRIX_ROW_SHIFTER << current_col); } else { diff --git a/keyboards/handwired/2x5keypad/2x5keypad.c b/keyboards/handwired/2x5keypad/2x5keypad.c index 873c579a17..cbd4c519b0 100644 --- a/keyboards/handwired/2x5keypad/2x5keypad.c +++ b/keyboards/handwired/2x5keypad/2x5keypad.c @@ -5,21 +5,21 @@ void matrix_init_kb(void) { matrix_init_user(); - setPinOutput(RED_LED); - setPinOutput(BLUE_LED); - setPinOutput(GREEN_LED); + gpio_set_pin_output(RED_LED); + gpio_set_pin_output(BLUE_LED); + gpio_set_pin_output(GREEN_LED); } void turn_off_leds(void) { - writePinLow(RED_LED); - writePinLow(BLUE_LED); - writePinLow(GREEN_LED); + gpio_write_pin_low(RED_LED); + gpio_write_pin_low(BLUE_LED); + gpio_write_pin_low(GREEN_LED); } void turn_on_led(pin_t pin) { - writePinHigh(pin); + gpio_write_pin_high(pin); } diff --git a/keyboards/handwired/aek64/aek64.c b/keyboards/handwired/aek64/aek64.c index 0646d308d0..130d014616 100644 --- a/keyboards/handwired/aek64/aek64.c +++ b/keyboards/handwired/aek64/aek64.c @@ -24,13 +24,13 @@ void keyboard_pre_init_user(void) { // Call the keyboard pre init code. // Set our LED pins as output - setPinOutput(C3); + gpio_set_pin_output(C3); } void matrix_init_kb(void) { // Flash the led 1 sec on startup. - writePinHigh(C3); + gpio_write_pin_high(C3); wait_ms(1000); - writePinLow(C3); + gpio_write_pin_low(C3); } diff --git a/keyboards/handwired/battleship_gamepad/battleship_gamepad.c b/keyboards/handwired/battleship_gamepad/battleship_gamepad.c index 048500da8c..cccc03a287 100644 --- a/keyboards/handwired/battleship_gamepad/battleship_gamepad.c +++ b/keyboards/handwired/battleship_gamepad/battleship_gamepad.c @@ -24,5 +24,5 @@ joystick_config_t joystick_axes[JOYSTICK_AXIS_COUNT] = { /* joystick button code (thumbstick pressed) */ void keyboard_pre_init_kb(void) { - setPinInputHigh(F6); + gpio_set_pin_input_high(F6); } diff --git a/keyboards/handwired/colorlice/colorlice.c b/keyboards/handwired/colorlice/colorlice.c index 736db8d465..ede3fba82f 100644 --- a/keyboards/handwired/colorlice/colorlice.c +++ b/keyboards/handwired/colorlice/colorlice.c @@ -55,14 +55,14 @@ void suspend_wakeup_init_kb(void) 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(B2, !led_state.num_lock); - writePin(C6, !led_state.caps_lock); - writePin(B7, !led_state.scroll_lock); + gpio_write_pin(B2, !led_state.num_lock); + gpio_write_pin(C6, !led_state.caps_lock); + gpio_write_pin(B7, !led_state.scroll_lock); } return res; } diff --git a/keyboards/handwired/dqz11n1g/matrix.c b/keyboards/handwired/dqz11n1g/matrix.c index 398f961aa5..49b3c2da81 100644 --- a/keyboards/handwired/dqz11n1g/matrix.c +++ b/keyboards/handwired/dqz11n1g/matrix.c @@ -25,7 +25,7 @@ static void unselect_rows(void); void matrix_init_custom(void) { /* initialize row pins */ for (uint8_t row = 0; row < MATRIX_ROWS; row++) { - setPinOutput(row_pins[row]); + gpio_set_pin_output(row_pins[row]); } unselect_rows(); @@ -47,20 +47,20 @@ void matrix_init_custom(void) { spi_start(slavePin, lsbFirst, mode, divisor); /* Initialize pin controlling the shift register's SH/~LD pin */ - setPinOutput(ROW_SHIFT_PIN); + gpio_set_pin_output(ROW_SHIFT_PIN); } static void select_row(uint8_t row) { pin_t pin = row_pins[row]; if (pin != NO_PIN) { - writePinHigh(pin); + gpio_write_pin_high(pin); } } static void unselect_row(uint8_t row) { pin_t pin = row_pins[row]; if (pin != NO_PIN) { - writePinLow(pin); + gpio_write_pin_low(pin); } } @@ -75,12 +75,12 @@ bool matrix_read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) matrix_row_t current_row_value = 0; /* Set shift register SH/~LD pin to "load" mode */ - writePinLow(ROW_SHIFT_PIN); + gpio_write_pin_low(ROW_SHIFT_PIN); select_row(current_row); matrix_output_select_delay(); /* Set shift register SH/~LD pin to "shift" mode */ - writePinHigh(ROW_SHIFT_PIN); + gpio_write_pin_high(ROW_SHIFT_PIN); /* For each octet of columns... */ for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index += 8) { diff --git a/keyboards/handwired/evk/v1_3/v1_3.c b/keyboards/handwired/evk/v1_3/v1_3.c index 7c68893968..a568ba3f86 100644 --- a/keyboards/handwired/evk/v1_3/v1_3.c +++ b/keyboards/handwired/evk/v1_3/v1_3.c @@ -23,22 +23,22 @@ along with this program. If not, see . // runs once when the firmware starts up void matrix_init_kb(void) { // Set the LEDs pins - setPinOutput(D5); // Layer 1 Status LED + gpio_set_pin_output(D5); // Layer 1 Status LED matrix_init_user(); } // Set LED based on layer __attribute__((weak)) layer_state_t layer_state_set_user(layer_state_t state) { - writePin(D5, layer_state_cmp(state, 1)); + gpio_write_pin(D5, layer_state_cmp(state, 1)); return state; } 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. - writePin(D4, led_state.caps_lock); + // gpio_write_pin sets the pin high for 1 and low for 0. + gpio_write_pin(D4, led_state.caps_lock); } return res; } diff --git a/keyboards/handwired/jopr/jopr.c b/keyboards/handwired/jopr/jopr.c index e6d6f05dd2..cb155ecb4b 100644 --- a/keyboards/handwired/jopr/jopr.c +++ b/keyboards/handwired/jopr/jopr.c @@ -1,7 +1,7 @@ #include "quantum.h" void led_init_ports(void) { - setPinOutput(F0); - setPinOutput(F1); - setPinOutput(F4); + gpio_set_pin_output(F0); + gpio_set_pin_output(F1); + gpio_set_pin_output(F4); } \ No newline at end of file diff --git a/keyboards/handwired/jotanck/jotanck.c b/keyboards/handwired/jotanck/jotanck.c index c0b54bb64d..6a982d2fcf 100644 --- a/keyboards/handwired/jotanck/jotanck.c +++ b/keyboards/handwired/jotanck/jotanck.c @@ -17,8 +17,8 @@ #include "quantum.h" void keyboard_pre_init_kb(void) { - setPinOutput(JOTANCK_LED1); - setPinOutput(JOTANCK_LED2); + gpio_set_pin_output(JOTANCK_LED1); + gpio_set_pin_output(JOTANCK_LED2); keyboard_pre_init_user(); } diff --git a/keyboards/handwired/jotpad16/jotpad16.c b/keyboards/handwired/jotpad16/jotpad16.c index 02b4daafd6..7acb31b0df 100644 --- a/keyboards/handwired/jotpad16/jotpad16.c +++ b/keyboards/handwired/jotpad16/jotpad16.c @@ -1,8 +1,8 @@ #include "quantum.h" void keyboard_pre_init_kb(void) { - setPinOutput(JOTPAD16_LED1); - setPinOutput(JOTPAD16_LED2); + gpio_set_pin_output(JOTPAD16_LED1); + gpio_set_pin_output(JOTPAD16_LED2); keyboard_pre_init_user(); } diff --git a/keyboards/handwired/jtallbean/split_65/split_65.c b/keyboards/handwired/jtallbean/split_65/split_65.c index d408f5577b..b75b12137f 100644 --- a/keyboards/handwired/jtallbean/split_65/split_65.c +++ b/keyboards/handwired/jtallbean/split_65/split_65.c @@ -25,8 +25,8 @@ void matrix_init_kb(void) { // runs once when the firmware starts up // Set our LED pins as output - setPinOutput(B0); - writePinLow(B0); + gpio_set_pin_output(B0); + gpio_write_pin_low(B0); matrix_init_user(); } @@ -36,8 +36,8 @@ 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. - writePin(B0, led_state.caps_lock); + // gpio_write_pin sets the pin high for 1 and low for 0. + gpio_write_pin(B0, led_state.caps_lock); } return res; } diff --git a/keyboards/handwired/lagrange/lagrange.c b/keyboards/handwired/lagrange/lagrange.c index 0c76512c57..4b80752518 100644 --- a/keyboards/handwired/lagrange/lagrange.c +++ b/keyboards/handwired/lagrange/lagrange.c @@ -35,7 +35,7 @@ bool is_keyboard_master(void) { static int8_t is_master = -1; if (is_master < 0) { - while (readPin(SPI_SS_PIN)) { + while (gpio_read_pin(SPI_SS_PIN)) { if (USB_Device_IsAddressSet()) { is_master = 1; return is_master; @@ -53,7 +53,7 @@ bool is_keyboard_master(void) { } void keyboard_pre_init_kb(void) { - setPinInputHigh(SPI_SS_PIN); + gpio_set_pin_input_high(SPI_SS_PIN); keyboard_pre_init_user(); } diff --git a/keyboards/handwired/lagrange/transport.c b/keyboards/handwired/lagrange/transport.c index ec91cff306..3ff2e9f409 100644 --- a/keyboards/handwired/lagrange/transport.c +++ b/keyboards/handwired/lagrange/transport.c @@ -53,7 +53,7 @@ bool shake_hands(bool master) { * alignment. */ if (master) { - writePinLow(SPI_SS_PIN); + gpio_write_pin_low(SPI_SS_PIN); } for (i = 0 ; i < 8 ; i += 1) { @@ -64,7 +64,7 @@ bool shake_hands(bool master) { } if (master) { - writePinHigh(SPI_SS_PIN); + gpio_write_pin_high(SPI_SS_PIN); } } while (i < 8); @@ -176,8 +176,8 @@ void transport_master_init(void) { * above depends on it and the SPI master driver won't do it * before we call spi_start(). */ - writePinHigh(SPI_SS_PIN); - setPinOutput(SPI_SS_PIN); + gpio_write_pin_high(SPI_SS_PIN); + gpio_set_pin_output(SPI_SS_PIN); spi_init(); @@ -195,10 +195,10 @@ void transport_slave_init(void) { * they're asserted making the MISO pin an output on both ends and * leading to potential shorts. */ - setPinInputHigh(SPI_SS_PIN); - setPinInput(SPI_SCK_PIN); - setPinInput(SPI_MOSI_PIN); - setPinOutput(SPI_MISO_PIN); + gpio_set_pin_input_high(SPI_SS_PIN); + gpio_set_pin_input(SPI_SCK_PIN); + gpio_set_pin_input(SPI_MOSI_PIN); + gpio_set_pin_output(SPI_MISO_PIN); SPCR = _BV(SPE); diff --git a/keyboards/handwired/owlet60/matrix.c b/keyboards/handwired/owlet60/matrix.c index b233dd7a52..43895468e9 100644 --- a/keyboards/handwired/owlet60/matrix.c +++ b/keyboards/handwired/owlet60/matrix.c @@ -129,19 +129,19 @@ void matrix_print(void) // uses standard row code static void select_row(uint8_t row) { - setPinOutput(row_pins[row]); - writePinLow(row_pins[row]); + gpio_set_pin_output(row_pins[row]); + gpio_write_pin_low(row_pins[row]); } static void unselect_row(uint8_t row) { - setPinInputHigh(row_pins[row]); + gpio_set_pin_input_high(row_pins[row]); } static void unselect_rows(void) { for(uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } } @@ -149,10 +149,10 @@ static void init_pins(void) { // still need some fixing, this might not work unselect_rows(); // with the loop /* for (uint8_t x = 0; x < MATRIX_COLS; x++) { - setPinInputHigh(col_pins[x]); + gpio_set_pin_input_high(col_pins[x]); } */ - setPinInputHigh(dat_pin); + gpio_set_pin_input_high(dat_pin); } static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) @@ -173,7 +173,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) // Select the col pin to read (active low) select_col_analog(col_index); wait_us(30); - uint8_t pin_state = readPin(dat_pin); + uint8_t pin_state = gpio_read_pin(dat_pin); // Populate the matrix row with the state of the col pin current_matrix[current_row] |= pin_state ? 0 : (ROW_SHIFTER << col_index); @@ -201,8 +201,8 @@ void matrix_init(void) { matrix_init_kb(); - setPinInput(D5); - setPinInput(B0); + gpio_set_pin_input(D5); + gpio_set_pin_input(B0); } // modified for per col read matrix scan @@ -273,27 +273,27 @@ static void select_col_analog(uint8_t col) { static void mux_pin_control(const uint8_t binary[]) { // set pin0 - setPinOutput(col_select_pins[0]); + gpio_set_pin_output(col_select_pins[0]); if(binary[2] == 0) { - writePinLow(col_select_pins[0]); + gpio_write_pin_low(col_select_pins[0]); } else { - writePinHigh(col_select_pins[0]); + gpio_write_pin_high(col_select_pins[0]); } // set pin1 - setPinOutput(col_select_pins[1]); + gpio_set_pin_output(col_select_pins[1]); if(binary[1] == 0) { - writePinLow(col_select_pins[1]); + gpio_write_pin_low(col_select_pins[1]); } else { - writePinHigh(col_select_pins[1]); + gpio_write_pin_high(col_select_pins[1]); } // set pin2 - setPinOutput(col_select_pins[2]); + gpio_set_pin_output(col_select_pins[2]); if(binary[0] == 0) { - writePinLow(col_select_pins[2]); + gpio_write_pin_low(col_select_pins[2]); } else { - writePinHigh(col_select_pins[2]); + gpio_write_pin_high(col_select_pins[2]); } } diff --git a/keyboards/handwired/prime_exl_plus/prime_exl_plus.c b/keyboards/handwired/prime_exl_plus/prime_exl_plus.c index cc7f5de31e..1865b6c502 100644 --- a/keyboards/handwired/prime_exl_plus/prime_exl_plus.c +++ b/keyboards/handwired/prime_exl_plus/prime_exl_plus.c @@ -17,22 +17,22 @@ void matrix_init_kb(void) { // set CapsLock LED to output and low - setPinOutput(B0); - writePinLow(B0); + gpio_set_pin_output(B0); + gpio_write_pin_low(B0); // set NumLock LED to output and low - setPinOutput(B1); - writePinLow(B1); + gpio_set_pin_output(B1); + gpio_write_pin_low(B1); // set ScrollLock LED to output and low - setPinOutput(B2); - writePinLow(B2); + gpio_set_pin_output(B2); + gpio_write_pin_low(B2); } bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if(res) { - writePin(B1, led_state.num_lock); - writePin(B0, led_state.caps_lock); - //writePin(B2, led_state.scroll_lock); + gpio_write_pin(B1, led_state.num_lock); + gpio_write_pin(B0, led_state.caps_lock); + //gpio_write_pin(B2, led_state.scroll_lock); } return res; } @@ -41,9 +41,9 @@ bool led_update_kb(led_t led_state) { layer_state_t layer_state_set_kb(layer_state_t state) { if (get_highest_layer(state) == 1) { - writePinHigh(B2); + gpio_write_pin_high(B2); } else { - writePinLow(B2); + gpio_write_pin_low(B2); } return layer_state_set_user(state); } diff --git a/keyboards/handwired/retro_refit/retro_refit.c b/keyboards/handwired/retro_refit/retro_refit.c index f23ef1fd40..b62d94d741 100644 --- a/keyboards/handwired/retro_refit/retro_refit.c +++ b/keyboards/handwired/retro_refit/retro_refit.c @@ -15,9 +15,9 @@ void matrix_init_kb(void) { bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if(res) { - writePin(D0, !led_state.caps_lock); - writePin(D1, !led_state.num_lock); - writePin(C6, !led_state.scroll_lock); + gpio_write_pin(D0, !led_state.caps_lock); + gpio_write_pin(D1, !led_state.num_lock); + gpio_write_pin(C6, !led_state.scroll_lock); } return res; diff --git a/keyboards/handwired/selene/selene.c b/keyboards/handwired/selene/selene.c index a3702ce02e..b0924c06f4 100644 --- a/keyboards/handwired/selene/selene.c +++ b/keyboards/handwired/selene/selene.c @@ -18,9 +18,9 @@ #include "selene.h" void matrix_init_kb(void){ - setPinOutput(NUM_LOCK_PIN); - setPinOutput(CAPS_LOCK_PIN); - setPinOutput(SCROLL_LOCK_PIN); + gpio_set_pin_output(NUM_LOCK_PIN); + gpio_set_pin_output(CAPS_LOCK_PIN); + gpio_set_pin_output(SCROLL_LOCK_PIN); } void keyboard_post_init_user(void) { @@ -30,9 +30,9 @@ void keyboard_post_init_user(void) { bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if(res) { - writePin(NUM_LOCK_PIN, led_state.num_lock); - writePin(CAPS_LOCK_PIN, led_state.caps_lock); - writePin(SCROLL_LOCK_PIN, led_state.scroll_lock); + gpio_write_pin(NUM_LOCK_PIN, led_state.num_lock); + gpio_write_pin(CAPS_LOCK_PIN, led_state.caps_lock); + gpio_write_pin(SCROLL_LOCK_PIN, led_state.scroll_lock); } return res; } diff --git a/keyboards/handwired/sono1/sono1.c b/keyboards/handwired/sono1/sono1.c index d19f188a19..449289a1e9 100644 --- a/keyboards/handwired/sono1/sono1.c +++ b/keyboards/handwired/sono1/sono1.c @@ -18,17 +18,17 @@ void matrix_init_kb(void) { /* LED pins setup */ - setPinOutput(LED_KANA_PIN); - setPinOutput(LED_CAPS_LOCK_PIN); - setPinOutput(LED_CTRL_XFER_PIN); - setPinOutput(LED_NUM_LOCK_PIN); - setPinOutput(LED_KB_LOCK_PIN); + gpio_set_pin_output(LED_KANA_PIN); + gpio_set_pin_output(LED_CAPS_LOCK_PIN); + gpio_set_pin_output(LED_CTRL_XFER_PIN); + gpio_set_pin_output(LED_NUM_LOCK_PIN); + gpio_set_pin_output(LED_KB_LOCK_PIN); - writePinHigh(LED_KANA_PIN); - writePinHigh(LED_CAPS_LOCK_PIN); - writePinHigh(LED_CTRL_XFER_PIN); - writePinHigh(LED_NUM_LOCK_PIN); - writePinHigh(LED_KB_LOCK_PIN); + gpio_write_pin_high(LED_KANA_PIN); + gpio_write_pin_high(LED_CAPS_LOCK_PIN); + gpio_write_pin_high(LED_CTRL_XFER_PIN); + gpio_write_pin_high(LED_NUM_LOCK_PIN); + gpio_write_pin_high(LED_KB_LOCK_PIN); matrix_init_user(); } @@ -36,9 +36,9 @@ void matrix_init_kb(void) { bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if(res) { - writePin(LED_NUM_LOCK_PIN, !led_state.num_lock); - writePin(LED_CAPS_LOCK_PIN, !led_state.caps_lock); - writePin(LED_CTRL_XFER_PIN, !led_state.scroll_lock); + gpio_write_pin(LED_NUM_LOCK_PIN, !led_state.num_lock); + gpio_write_pin(LED_CAPS_LOCK_PIN, !led_state.caps_lock); + gpio_write_pin(LED_CTRL_XFER_PIN, !led_state.scroll_lock); } return res; } diff --git a/keyboards/handwired/symmetric70_proto/debug_config.h b/keyboards/handwired/symmetric70_proto/debug_config.h index cba99e402f..5a575eb479 100644 --- a/keyboards/handwired/symmetric70_proto/debug_config.h +++ b/keyboards/handwired/symmetric70_proto/debug_config.h @@ -8,23 +8,23 @@ #include static inline void setDebugPinOutput_Low(void) { - setPinOutput(MATRIX_DEBUG_PIN); - writePinLow(MATRIX_DEBUG_PIN); + gpio_set_pin_output(MATRIX_DEBUG_PIN); + gpio_write_pin_low(MATRIX_DEBUG_PIN); } #define MATRIX_DEBUG_PIN_INIT() setDebugPinOutput_Low() #ifdef MATRIX_DEBUG_SCAN -# define MATRIX_DEBUG_SCAN_START() writePinHigh(MATRIX_DEBUG_PIN) -# define MATRIX_DEBUG_SCAN_END() writePinLow(MATRIX_DEBUG_PIN) +# define MATRIX_DEBUG_SCAN_START() gpio_write_pin_high(MATRIX_DEBUG_PIN) +# define MATRIX_DEBUG_SCAN_END() gpio_write_pin_low(MATRIX_DEBUG_PIN) #else # define MATRIX_DEBUG_SCAN_START() # define MATRIX_DEBUG_SCAN_END() #endif #ifdef MATRIX_DEBUG_DELAY -# define MATRIX_DEBUG_DELAY_START() writePinHigh(MATRIX_DEBUG_PIN) -# define MATRIX_DEBUG_DELAY_END() writePinLow(MATRIX_DEBUG_PIN) +# define MATRIX_DEBUG_DELAY_START() gpio_write_pin_high(MATRIX_DEBUG_PIN) +# define MATRIX_DEBUG_DELAY_END() gpio_write_pin_low(MATRIX_DEBUG_PIN) #else # define MATRIX_DEBUG_DELAY_START() # define MATRIX_DEBUG_DELAY_END() diff --git a/keyboards/handwired/symmetric70_proto/matrix_debug/matrix.c b/keyboards/handwired/symmetric70_proto/matrix_debug/matrix.c index d6fcb0f793..786c1b4a73 100644 --- a/keyboards/handwired/symmetric70_proto/matrix_debug/matrix.c +++ b/keyboards/handwired/symmetric70_proto/matrix_debug/matrix.c @@ -62,13 +62,13 @@ extern matrix_row_t matrix[MATRIX_ROWS]; // debounced values static inline void setPinOutput_writeLow(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinLow(pin); + gpio_set_pin_output(pin); + gpio_write_pin_low(pin); } } static inline void setPinInputHigh_atomic(pin_t pin) { - ATOMIC_BLOCK_FORCEON { setPinInputHigh(pin); } + ATOMIC_BLOCK_FORCEON { gpio_set_pin_input_high(pin); } } // matrix code @@ -80,7 +80,7 @@ static void init_pins(void) { for (int col = 0; col < MATRIX_COLS; col++) { pin_t pin = direct_pins[row][col]; if (pin != NO_PIN) { - setPinInputHigh(pin); + gpio_set_pin_input_high(pin); } } } @@ -93,7 +93,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { pin_t pin = direct_pins[current_row][col_index]; if (pin != NO_PIN) { - current_row_value |= readPin(pin) ? 0 : (MATRIX_ROW_SHIFTER << col_index); + current_row_value |= gpio_read_pin(pin) ? 0 : (MATRIX_ROW_SHIFTER << col_index); } } @@ -120,8 +120,8 @@ static void unselect_rows(void) { static void init_pins(void) { # ifdef MATRIX_MUL_SELECT - setPinOutput(MATRIX_MUL_SELECT); - writePinLow(MATRIX_MUL_SELECT); + gpio_set_pin_output(MATRIX_MUL_SELECT); + gpio_write_pin_low(MATRIX_MUL_SELECT); # endif unselect_rows(); for (uint8_t x = 0; x < MATRIX_COLS; x++) { @@ -141,10 +141,10 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { // Select the col pin to read (active low) # ifdef MATRIX_MUL_SELECT - writePin(MATRIX_MUL_SELECT, col_sel[col_index]); + gpio_write_pin(MATRIX_MUL_SELECT, col_sel[col_index]); waitInputPinDelay(); # endif - uint8_t pin_state = readPin(col_pins[col_index]); + uint8_t pin_state = gpio_read_pin(col_pins[col_index]); // Populate the matrix row with the state of the col pin current_row_value |= pin_state ? 0 : (MATRIX_ROW_SHIFTER << col_index); @@ -160,7 +160,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) is_pressed = false; for (uint8_t i = 0; i < ARRAY_SIZE(delay_ports); i++) { # ifdef MATRIX_IO_DELAY_MULSEL - writePin(MATRIX_MUL_SELECT, delay_sel[i]); + gpio_write_pin(MATRIX_MUL_SELECT, delay_sel[i]); waitInputPinDelay(); # endif is_pressed |= ((readPort(delay_ports[i]) & delay_masks[i]) != delay_masks[i]); @@ -174,10 +174,10 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { MATRIX_DEBUG_DELAY_START(); # ifdef MATRIX_MUL_SELECT - writePin(MATRIX_MUL_SELECT, col_sel[col_index]); + gpio_write_pin(MATRIX_MUL_SELECT, col_sel[col_index]); waitInputPinDelay(); # endif - while (readPin(col_pins[col_index]) == 0) { + while (gpio_read_pin(col_pins[col_index]) == 0) { } MATRIX_DEBUG_DELAY_END(); } @@ -193,10 +193,10 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) MATRIX_DEBUG_DELAY_END(); MATRIX_DEBUG_DELAY_START(); # ifdef MATRIX_MUL_SELECT - writePin(MATRIX_MUL_SELECT, col_sel[col_index]); + gpio_write_pin(MATRIX_MUL_SELECT, col_sel[col_index]); waitInputPinDelay(); # endif - state |= (readPin(col_pins[col_index]) == 0); + state |= (gpio_read_pin(col_pins[col_index]) == 0); } MATRIX_DEBUG_DELAY_END(); } while (state); @@ -250,7 +250,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) matrix_row_t current_row_value = last_row_value; // Check row pin state - if (readPin(row_pins[row_index]) == 0) { + if (gpio_read_pin(row_pins[row_index]) == 0) { // Pin LO, set col bit current_row_value |= (MATRIX_ROW_SHIFTER << current_col); key_pressed = true; diff --git a/keyboards/handwired/symmetric70_proto/matrix_fast/matrix_extension_74hc15x.c b/keyboards/handwired/symmetric70_proto/matrix_fast/matrix_extension_74hc15x.c index 202454a221..25ecc668e5 100644 --- a/keyboards/handwired/symmetric70_proto/matrix_fast/matrix_extension_74hc15x.c +++ b/keyboards/handwired/symmetric70_proto/matrix_fast/matrix_extension_74hc15x.c @@ -51,9 +51,9 @@ static const pin_t sel_pins[] = { MATRIX_EXT_74HC15x }; LOCAL_FUNC ALWAYS_INLINE void select74HC15x(uint8_t devid); LOCAL_FUNC void select74HC15x(uint8_t devid) { - writePin(sel_pins[0], devid&1); + gpio_write_pin(sel_pins[0], devid&1); #if defined(MATRIX_EXTENSION_74HC153) - writePin(sel_pins[1], devid&2); + gpio_write_pin(sel_pins[1], devid&2); #endif } @@ -67,7 +67,7 @@ LOCAL_FUNC port_width_t readPortMultiplexer(uint8_t devid, pin_t port) { #define readMatrixPort(dev, port) \ ((dev) == MCU_GPIO)? readPort(port): (IS_74HC15x(dev))? readPortMultiplexer((dev)-MCU_GPIOa, port):0 -#define INIT_74HC15X(x) setPinOutput(x); writePinLow(x); +#define INIT_74HC15X(x) gpio_set_pin_output(x); gpio_write_pin_low(x); LOCAL_FUNC void init_74hc15x(void) { MAP(INIT_74HC15X, MATRIX_EXT_74HC15x) diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/f411/f411.c b/keyboards/handwired/tractyl_manuform/5x6_right/f411/f411.c index 24263fa832..dbacb1685c 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/f411/f411.c +++ b/keyboards/handwired/tractyl_manuform/5x6_right/f411/f411.c @@ -16,10 +16,10 @@ #include "tractyl_manuform.h" -void keyboard_pre_init_sub(void) { setPinInputHigh(A0); } +void keyboard_pre_init_sub(void) { gpio_set_pin_input_high(A0); } void matrix_scan_sub_kb(void) { - if (!readPin(A0)) { + if (!gpio_read_pin(A0)) { reset_keyboard(); } } @@ -44,7 +44,7 @@ __attribute__((weak)) void bootmagic_scan(void) { } #endif - if (matrix_get_row(row) & (1 << col) || !readPin(A0)) { + if (matrix_get_row(row) & (1 << col) || !gpio_read_pin(A0)) { eeconfig_disable(); bootloader_jump(); } @@ -53,9 +53,9 @@ __attribute__((weak)) void bootmagic_scan(void) { #ifdef USB_VBUS_PIN bool usb_vbus_state(void) { - setPinInputLow(USB_VBUS_PIN); + gpio_set_pin_input_low(USB_VBUS_PIN); wait_us(5); - return readPin(USB_VBUS_PIN); + return gpio_read_pin(USB_VBUS_PIN); } #endif diff --git a/keyboards/handwired/traveller/traveller.c b/keyboards/handwired/traveller/traveller.c index 91c6f603b1..f18a64ca86 100644 --- a/keyboards/handwired/traveller/traveller.c +++ b/keyboards/handwired/traveller/traveller.c @@ -11,8 +11,8 @@ void matrix_init_kb(void) { #endif // Turn status LED on - setPinOutput(C7); - writePinHigh(C7); + gpio_set_pin_output(C7); + gpio_write_pin_high(C7); matrix_init_user(); } diff --git a/keyboards/handwired/woodpad/woodpad.c b/keyboards/handwired/woodpad/woodpad.c index 71bc0ba71e..92b3131e7b 100644 --- a/keyboards/handwired/woodpad/woodpad.c +++ b/keyboards/handwired/woodpad/woodpad.c @@ -17,14 +17,14 @@ #include "woodpad.h" void keyboard_pre_init_kb(void) { - setPinOutput(F7); + gpio_set_pin_output(F7); keyboard_pre_init_user(); } inline void numlock_led_on(void) { - writePinHigh(F7); + gpio_write_pin_high(F7); } inline void numlock_led_off(void) { - writePinLow(F7); + gpio_write_pin_low(F7); } diff --git a/keyboards/handwired/z150/z150.c b/keyboards/handwired/z150/z150.c index a887a95bfd..ab6709eed7 100644 --- a/keyboards/handwired/z150/z150.c +++ b/keyboards/handwired/z150/z150.c @@ -17,13 +17,13 @@ #include "quantum.h" void matrix_init_kb(void) { - setPinOutput(NUM_LOCK_LED_PIN); - setPinOutput(CAPS_LOCK_LED_PIN); - setPinOutput(SCROLL_LOCK_LED_PIN); + gpio_set_pin_output(NUM_LOCK_LED_PIN); + gpio_set_pin_output(CAPS_LOCK_LED_PIN); + gpio_set_pin_output(SCROLL_LOCK_LED_PIN); - writePinLow(NUM_LOCK_LED_PIN); - writePinLow(CAPS_LOCK_LED_PIN); - writePinLow(SCROLL_LOCK_LED_PIN); + gpio_write_pin_low(NUM_LOCK_LED_PIN); + gpio_write_pin_low(CAPS_LOCK_LED_PIN); + gpio_write_pin_low(SCROLL_LOCK_LED_PIN); matrix_init_user(); } @@ -31,9 +31,9 @@ void matrix_init_kb(void) { bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if(res) { - 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 res; } diff --git a/keyboards/hardwareabstraction/handwire/handwire.c b/keyboards/hardwareabstraction/handwire/handwire.c index 4981e703e4..d5ebd6ac13 100644 --- a/keyboards/hardwareabstraction/handwire/handwire.c +++ b/keyboards/hardwareabstraction/handwire/handwire.c @@ -28,7 +28,7 @@ enum custom_keycodes{ // Documentation: custom_quantum_functions.md void keyboard_post_init_kb(void){ - setPinOutput(BUZZER_PIN); + gpio_set_pin_output(BUZZER_PIN); keyboard_post_init_user(); } @@ -36,7 +36,7 @@ void housekeeping_task_kb(void){ if(buzzer_on){ if(buzzer_active && timer_elapsed(buzzer_timer) > buzzer_dwell){ buzzer_active = false; - writePinLow(BUZZER_PIN); + gpio_write_pin_low(BUZZER_PIN); } } housekeeping_task_user(); @@ -50,7 +50,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { if(!buzzer_active){ buzzer_active = true; buzzer_timer = timer_read(); - writePinHigh(BUZZER_PIN); + gpio_write_pin_high(BUZZER_PIN); } } @@ -94,10 +94,10 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { if(buzzer_on == true){ buzzer_active = true; buzzer_timer = timer_read(); - writePinHigh(BUZZER_PIN); + gpio_write_pin_high(BUZZER_PIN); } else{ - writePinLow(BUZZER_PIN); + gpio_write_pin_low(BUZZER_PIN); } break; diff --git a/keyboards/hazel/bad_wings/matrix.c b/keyboards/hazel/bad_wings/matrix.c index 8a56a927c1..4a05e132f7 100644 --- a/keyboards/hazel/bad_wings/matrix.c +++ b/keyboards/hazel/bad_wings/matrix.c @@ -48,11 +48,11 @@ bool sr_74hc595_spi_start(void) { bool sr_74hc595_spi_send_byte(uint8_t data) { sr_74hc595_spi_start(); - writePinLow(SHIFTREG_MATRIX_COL_CS); + gpio_write_pin_low(SHIFTREG_MATRIX_COL_CS); matrix_io_delay(); spi_write(data); matrix_io_delay(); - writePinHigh(SHIFTREG_MATRIX_COL_CS); + gpio_write_pin_high(SHIFTREG_MATRIX_COL_CS); sr_74hc595_spi_stop(); return true; } @@ -82,12 +82,12 @@ void matrix_init_custom(void) { // Set up the initial states for all the row pins for (int r = 0; r < SHIFTREG_ROWS; r++) { // Note: This needs to use the internal pull down resistors, and atmegas do *not* support that - setPinInputLow(rowPinsSR[r]); + gpio_set_pin_input_low(rowPinsSR[r]); } // Set the CS to low by default, and specify as an output pin - writePinHigh(SHIFTREG_MATRIX_COL_CS); // should be high when using SPI? - setPinOutput(SHIFTREG_MATRIX_COL_CS); + gpio_write_pin_high(SHIFTREG_MATRIX_COL_CS); // should be high when using SPI? + gpio_set_pin_output(SHIFTREG_MATRIX_COL_CS); // Since it's the init, deactivate all the columns. We'll activate once we get to the matrix scan clearColumns(); @@ -116,7 +116,7 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { matrix_io_delay(); for (int r = 0; r < SHIFTREG_ROWS; r++) { - current_matrix[r] |= ((readPin(rowPinsSR[r]) ? 1 : 0) << c); + current_matrix[r] |= ((gpio_read_pin(rowPinsSR[r]) ? 1 : 0) << c); } } diff --git a/keyboards/heliar/wm1_hotswap/wm1_hotswap.c b/keyboards/heliar/wm1_hotswap/wm1_hotswap.c index 846729a3f0..d2d10b0b1f 100644 --- a/keyboards/heliar/wm1_hotswap/wm1_hotswap.c +++ b/keyboards/heliar/wm1_hotswap/wm1_hotswap.c @@ -19,20 +19,20 @@ void keyboard_pre_init_kb(void) { - setPinOutput(D7); - writePinHigh(D7); - setPinOutput(D6); - writePinHigh(D6); - setPinOutput(D4); - writePinHigh(D4); + gpio_set_pin_output(D7); + gpio_write_pin_high(D7); + gpio_set_pin_output(D6); + gpio_write_pin_high(D6); + gpio_set_pin_output(D4); + gpio_write_pin_high(D4); } bool led_update_kb(led_t led_state) { if (led_update_user(led_state)){ - writePin(D7, !led_state.num_lock); - writePin(D6, !led_state.caps_lock); - writePin(D4, !led_state.scroll_lock); + gpio_write_pin(D7, !led_state.num_lock); + gpio_write_pin(D6, !led_state.caps_lock); + gpio_write_pin(D4, !led_state.scroll_lock); } return true; diff --git a/keyboards/hhkb/yang/matrix.c b/keyboards/hhkb/yang/matrix.c index c82c77bed3..d82aaf5a0c 100644 --- a/keyboards/hhkb/yang/matrix.c +++ b/keyboards/hhkb/yang/matrix.c @@ -34,12 +34,12 @@ uint8_t power_save_level; static uint32_t matrix_last_modified = 0; -static inline void key_strobe_high(void) { writePinLow(B6); } -static inline void key_strobe_low(void) { writePinHigh(B6); } -static inline bool key_state(void) { return readPin(D7); } -static inline void key_prev_on(void) { writePinHigh(B7); } -static inline void key_prev_off(void) { writePinLow(B7); } -static inline bool key_power_state(void) { return !readPin(D6); } +static inline void key_strobe_high(void) { gpio_write_pin_low(B6); } +static inline void key_strobe_low(void) { gpio_write_pin_high(B6); } +static inline bool key_state(void) { return gpio_read_pin(D7); } +static inline void key_prev_on(void) { gpio_write_pin_high(B7); } +static inline void key_prev_off(void) { gpio_write_pin_low(B7); } +static inline bool key_power_state(void) { return !gpio_read_pin(D6); } static inline void suspend_power_down_longer(void) { uint8_t times = 60; @@ -52,8 +52,8 @@ void matrix_power_up(void) { DDRB = 0xFF; PORTB = 0x40; // switch MOS FET on - setPinOutput(D6); - writePinLow(D6); + gpio_set_pin_output(D6); + gpio_write_pin_low(D6); } void matrix_power_down(void) { @@ -62,8 +62,8 @@ void matrix_power_down(void) { DDRB = 0x00; PORTB = 0xFF; // switch MOS FET off - setPinOutput(D6); - writePinHigh(D6); + gpio_set_pin_output(D6); + gpio_write_pin_high(D6); } static inline void key_select_row(uint8_t row) { PORTB = (PORTB & 0b11111000) | ((row)&0b111); } diff --git a/keyboards/hhkb/yang/yang.c b/keyboards/hhkb/yang/yang.c index 548f0dd734..3aba711b1f 100644 --- a/keyboards/hhkb/yang/yang.c +++ b/keyboards/hhkb/yang/yang.c @@ -21,13 +21,13 @@ extern uint8_t power_save_level; void hhkb_led_on(uint8_t led) { switch (led) { case 1: - writePinHigh(F4); + gpio_write_pin_high(F4); break; case 2: - writePinHigh(F2); + gpio_write_pin_high(F2); break; case 3: - writePinHigh(F0); + gpio_write_pin_high(F0); break; } } @@ -35,55 +35,55 @@ void hhkb_led_on(uint8_t led) { void hhkb_led_off(uint8_t led) { switch (led) { case 1: - writePinLow(F4); + gpio_write_pin_low(F4); break; case 2: - writePinLow(F2); + gpio_write_pin_low(F2); break; case 3: - writePinLow(F0); + gpio_write_pin_low(F0); break; } } void keyboard_pre_init_kb(void) { // BT power up - setPinOutput(D5); - writePinLow(D5); + gpio_set_pin_output(D5); + gpio_write_pin_low(D5); // Row selectors - setPinOutput(B0); - setPinOutput(B1); - setPinOutput(B2); + gpio_set_pin_output(B0); + gpio_set_pin_output(B1); + gpio_set_pin_output(B2); // Col selectors - setPinOutput(B3); - setPinOutput(B4); - setPinOutput(B5); + gpio_set_pin_output(B3); + gpio_set_pin_output(B4); + gpio_set_pin_output(B5); // Key strobe - setPinOutput(B6); - writePinHigh(B6); + gpio_set_pin_output(B6); + gpio_write_pin_high(B6); // Key: input with pull-up - setPinInputHigh(D7); + gpio_set_pin_input_high(D7); // Unused pins on Pro2 ANSI // Input with pull up to save power - setPinInputHigh(C6); - setPinInputHigh(C7); + gpio_set_pin_input_high(C6); + gpio_set_pin_input_high(C7); // LED pin configuration - setPinOutput(F0); - setPinOutput(F1); - setPinOutput(F4); - writePinLow(F0); - writePinLow(F1); - writePinLow(F4); + gpio_set_pin_output(F0); + gpio_set_pin_output(F1); + gpio_set_pin_output(F4); + gpio_write_pin_low(F0); + gpio_write_pin_low(F1); + gpio_write_pin_low(F4); // Turn on switch PCB - setPinOutput(D6); - writePinLow(D6); + gpio_set_pin_output(D6); + gpio_write_pin_low(D6); keyboard_pre_init_user(); } @@ -93,7 +93,7 @@ void suspend_power_down_kb(void) { // Disable UART TX to avoid current leakage UCSR1B &= ~_BV(TXEN1); // Power down BLE module - writePinHigh(D5); + gpio_write_pin_high(D5); } suspend_power_down_user(); @@ -101,7 +101,7 @@ void suspend_power_down_kb(void) { void suspend_wakeup_init_kb(void) { // Power up BLE module - writePinLow(D5); + gpio_write_pin_low(D5); // Enable UART TX UCSR1B |= _BV(TXEN1); @@ -111,8 +111,8 @@ void suspend_wakeup_init_kb(void) { layer_state_t layer_state_set_kb(layer_state_t state) { state = layer_state_set_user(state); - writePin(F1, IS_LAYER_ON_STATE(state, 1)); - writePin(F0, IS_LAYER_ON_STATE(state, 2)); + gpio_write_pin(F1, IS_LAYER_ON_STATE(state, 1)); + gpio_write_pin(F0, IS_LAYER_ON_STATE(state, 2)); return state; } diff --git a/keyboards/hineybush/h10/h10.c b/keyboards/hineybush/h10/h10.c index 81f5bdfbf2..2170a8b2d7 100644 --- a/keyboards/hineybush/h10/h10.c +++ b/keyboards/hineybush/h10/h10.c @@ -23,12 +23,12 @@ void matrix_init_kb(void) { // put your keyboard start-up code here // runs once when the firmware starts up - setPinOutput(F7); + gpio_set_pin_output(F7); } bool led_update_kb(led_t led_state) { if(led_update_user(led_state)) { - writePin(F7, !led_state.num_lock); + gpio_write_pin(F7, !led_state.num_lock); } return true; } diff --git a/keyboards/hineybush/h60/h60.c b/keyboards/hineybush/h60/h60.c index 4373157996..472b99d8ba 100644 --- a/keyboards/hineybush/h60/h60.c +++ b/keyboards/hineybush/h60/h60.c @@ -19,12 +19,12 @@ void matrix_init_kb(void) { // put your keyboard start-up code here // runs once when the firmware starts up - setPinOutput(C6); + gpio_set_pin_output(C6); } bool led_update_kb(led_t led_state) { if(led_update_user(led_state)) { - writePin(C6, !led_state.caps_lock); + gpio_write_pin(C6, !led_state.caps_lock); } return true; } diff --git a/keyboards/hineybush/h87a/h87a.c b/keyboards/hineybush/h87a/h87a.c index bf4213a200..f2d0c62813 100644 --- a/keyboards/hineybush/h87a/h87a.c +++ b/keyboards/hineybush/h87a/h87a.c @@ -18,15 +18,15 @@ void matrix_init_kb(void) { // put your keyboard start-up code here // runs once when the firmware starts up - setPinOutput(D5); - setPinOutput(E6); + gpio_set_pin_output(D5); + gpio_set_pin_output(E6); matrix_init_user(); } bool led_update_kb(led_t led_state) { if(led_update_user(led_state)) { - writePin(D5, !led_state.caps_lock); - writePin(E6, !led_state.scroll_lock); + gpio_write_pin(D5, !led_state.caps_lock); + gpio_write_pin(E6, !led_state.scroll_lock); } return true; } diff --git a/keyboards/hineybush/h88/h88.c b/keyboards/hineybush/h88/h88.c index 9abeccd1d5..a916609d75 100644 --- a/keyboards/hineybush/h88/h88.c +++ b/keyboards/hineybush/h88/h88.c @@ -18,15 +18,15 @@ void matrix_init_kb(void) { // put your keyboard start-up code here // runs once when the firmware starts up - setPinOutput(D5); - setPinOutput(E6); + gpio_set_pin_output(D5); + gpio_set_pin_output(E6); matrix_init_user(); } bool led_update_kb(led_t led_state) { if(led_update_user(led_state)) { - writePin(D5, !led_state.caps_lock); - writePin(E6, !led_state.scroll_lock); + gpio_write_pin(D5, !led_state.caps_lock); + gpio_write_pin(E6, !led_state.scroll_lock); } return true; } diff --git a/keyboards/hineybush/hbcp/matrix.c b/keyboards/hineybush/hbcp/matrix.c index 69ae6ab7b7..c4cfc9edb3 100644 --- a/keyboards/hineybush/hbcp/matrix.c +++ b/keyboards/hineybush/hbcp/matrix.c @@ -27,11 +27,11 @@ static matrix_row_t last_matrix[MATRIX_ROWS]; // raw values of last scan // matrix code void select_row(uint8_t row) { - setPinOutput(row_pins[row]); - writePinLow(row_pins[row]); + gpio_set_pin_output(row_pins[row]); + gpio_write_pin_low(row_pins[row]); } - void unselect_row(uint8_t row) { setPinInputHigh(row_pins[row]); } + void unselect_row(uint8_t row) { gpio_set_pin_input_high(row_pins[row]); } bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) { // Store last value of row prior to reading @@ -47,7 +47,7 @@ static matrix_row_t last_matrix[MATRIX_ROWS]; // raw values of last scan // For each col... for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { // Select the col pin to read (active low) - uint8_t pin_state = readPin(col_pins[col_index]); + uint8_t pin_state = gpio_read_pin(col_pins[col_index]); // Populate the matrix row with the state of the col pin current_matrix[current_row] |= pin_state ? 0 : (MATRIX_ROW_SHIFTER << col_index); @@ -60,11 +60,11 @@ static matrix_row_t last_matrix[MATRIX_ROWS]; // raw values of last scan } void select_col(uint8_t col) { - setPinOutput(col_pins[col]); - writePinLow(col_pins[col]); + gpio_set_pin_output(col_pins[col]); + gpio_write_pin_low(col_pins[col]); } - void unselect_col(uint8_t col) { setPinInputHigh(col_pins[col]); } + void unselect_col(uint8_t col) { gpio_set_pin_input_high(col_pins[col]); } bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) { bool matrix_changed = false; @@ -79,7 +79,7 @@ static matrix_row_t last_matrix[MATRIX_ROWS]; // raw values of last scan matrix_row_t last_row_value = current_matrix[row_index]; // Check row pin state - if (readPin(row_pins[row_index]) == 0) { + if (gpio_read_pin(row_pins[row_index]) == 0) { // Pin LO, set col bit current_matrix[row_index] |= (MATRIX_ROW_SHIFTER << current_col); } @@ -98,13 +98,13 @@ static matrix_row_t last_matrix[MATRIX_ROWS]; // raw values of last scan void unselect_rows(void) { for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } } void unselect_cols(void) { for (uint8_t x = 0; x < MATRIX_COLS; x++) { - setPinInputHigh(col_pins[x]); + gpio_set_pin_input_high(col_pins[x]); } } diff --git a/keyboards/hineybush/physix/physix.c b/keyboards/hineybush/physix/physix.c index c118b30d2e..cd920a72b3 100644 --- a/keyboards/hineybush/physix/physix.c +++ b/keyboards/hineybush/physix/physix.c @@ -24,8 +24,8 @@ void matrix_init_kb(void) { // put your keyboard start-up code here // runs once when the firmware starts up - setPinOutput(D3); - setPinOutput(D5); + gpio_set_pin_output(D3); + gpio_set_pin_output(D5); matrix_init_user(); } @@ -33,13 +33,13 @@ bool led_update_kb(led_t led_state) { // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here 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.caps_lock); - writePin(D5, led_state.scroll_lock); + gpio_write_pin(D3, led_state.caps_lock); + gpio_write_pin(D5, led_state.scroll_lock); } return res; return led_update_user(led_state); diff --git a/keyboards/ibm/model_m/ashpil_usbc/ashpil_usbc.c b/keyboards/ibm/model_m/ashpil_usbc/ashpil_usbc.c index 92b577635c..8bdcfe070a 100644 --- a/keyboards/ibm/model_m/ashpil_usbc/ashpil_usbc.c +++ b/keyboards/ibm/model_m/ashpil_usbc/ashpil_usbc.c @@ -18,19 +18,19 @@ void keyboard_pre_init_kb(void) { /* Setting status LEDs pins to output and +5V (off) */ - setPinOutput(D5); - setPinOutput(D6); - setPinOutput(D7); - writePinHigh(D5); - writePinHigh(D6); - writePinHigh(D7); + gpio_set_pin_output(D5); + gpio_set_pin_output(D6); + gpio_set_pin_output(D7); + gpio_write_pin_high(D5); + gpio_write_pin_high(D6); + gpio_write_pin_high(D7); } bool led_update_kb(led_t led_state) { if(led_update_user(led_state)) { - writePin(D5, !led_state.num_lock); - writePin(D6, !led_state.caps_lock); - writePin(D7, !led_state.scroll_lock); + gpio_write_pin(D5, !led_state.num_lock); + gpio_write_pin(D6, !led_state.caps_lock); + gpio_write_pin(D7, !led_state.scroll_lock); } return true; } diff --git a/keyboards/ibm/model_m/modelh/modelh.c b/keyboards/ibm/model_m/modelh/modelh.c index 5384b37338..4bf3d12e6a 100644 --- a/keyboards/ibm/model_m/modelh/modelh.c +++ b/keyboards/ibm/model_m/modelh/modelh.c @@ -18,8 +18,8 @@ void keyboard_pre_init_kb(void) { - setPinOutput(MODELH_STATUS_LED); - writePin(MODELH_STATUS_LED, 0); + gpio_set_pin_output(MODELH_STATUS_LED); + gpio_write_pin(MODELH_STATUS_LED, 0); keyboard_pre_init_user(); } diff --git a/keyboards/ibm/model_m/mschwingen/matrix.c b/keyboards/ibm/model_m/mschwingen/matrix.c index 85df5e5d6f..ae032a00a0 100644 --- a/keyboards/ibm/model_m/mschwingen/matrix.c +++ b/keyboards/ibm/model_m/mschwingen/matrix.c @@ -31,15 +31,15 @@ static uint16_t row_bits[MATRIX_ROWS] = { static const pin_t col_pins[MATRIX_COLS] = {D1, D4, D7, B4, F7, F6, F5, F4}; static void select_col(uint8_t col) { - setPinOutput(col_pins[col]); - writePinLow(col_pins[col]); + gpio_set_pin_output(col_pins[col]); + gpio_write_pin_low(col_pins[col]); } -static void unselect_col(uint8_t col) { setPinInputHigh(col_pins[col]); } +static void unselect_col(uint8_t col) { gpio_set_pin_input_high(col_pins[col]); } static void unselect_cols(void) { for (uint8_t x = 0; x < MATRIX_COLS; x++) { - setPinInputHigh(col_pins[x]); + gpio_set_pin_input_high(col_pins[x]); } } @@ -51,8 +51,8 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) select_col(current_col); matrix_io_delay(); - writePinLow(SR_LOAD_PIN); - writePinHigh(SR_LOAD_PIN); + gpio_write_pin_low(SR_LOAD_PIN); + gpio_write_pin_high(SR_LOAD_PIN); row_data = spi_read() << 8; row_data |= spi_read(); diff --git a/keyboards/ibm/model_m/mschwingen/mschwingen.c b/keyboards/ibm/model_m/mschwingen/mschwingen.c index 6a8a0ec8fc..7112ab63a5 100644 --- a/keyboards/ibm/model_m/mschwingen/mschwingen.c +++ b/keyboards/ibm/model_m/mschwingen/mschwingen.c @@ -74,12 +74,12 @@ void sleep_led_toggle(void) {} void sleep_led_disable(void) { suspend_active = false; - writePinHigh(MODELM_STATUS_LED); + gpio_write_pin_high(MODELM_STATUS_LED); } void sleep_led_enable(void) { suspend_active = true; - writePinLow(MODELM_STATUS_LED); + gpio_write_pin_low(MODELM_STATUS_LED); #ifdef KEYBOARD_ibm_model_m_mschwingen_led_ws2812 led[0] = black; led[1] = black; @@ -94,15 +94,15 @@ void keyboard_pre_init_kb(void) { ws2812_setleds(led, RGBLIGHT_LED_COUNT); #else /* Set status LEDs pins to output and Low (on) */ - setPinOutput(MODELM_LED_CAPSLOCK); - setPinOutput(MODELM_LED_SCROLLOCK); - setPinOutput(MODELM_LED_NUMLOCK); - writePinLow(MODELM_LED_CAPSLOCK); - writePinLow(MODELM_LED_SCROLLOCK); - writePinLow(MODELM_LED_NUMLOCK); + gpio_set_pin_output(MODELM_LED_CAPSLOCK); + gpio_set_pin_output(MODELM_LED_SCROLLOCK); + gpio_set_pin_output(MODELM_LED_NUMLOCK); + gpio_write_pin_low(MODELM_LED_CAPSLOCK); + gpio_write_pin_low(MODELM_LED_SCROLLOCK); + gpio_write_pin_low(MODELM_LED_NUMLOCK); #endif - setPinOutput(MODELM_STATUS_LED); - writePinHigh(MODELM_STATUS_LED); + gpio_set_pin_output(MODELM_STATUS_LED); + gpio_write_pin_high(MODELM_STATUS_LED); _delay_ms(50); #ifdef UART_DEBUG uart_init(115200); @@ -110,10 +110,10 @@ void keyboard_pre_init_kb(void) { uprintf("\r\nHello world!\r\n"); #endif - setPinOutput(SR_LOAD_PIN); - setPinOutput(SR_CLK_PIN); - setPinOutput(SR_DOUT_PIN); // MOSI - unused - writePinLow(SR_CLK_PIN); + gpio_set_pin_output(SR_LOAD_PIN); + gpio_set_pin_output(SR_CLK_PIN); + gpio_set_pin_output(SR_DOUT_PIN); // MOSI - unused + gpio_write_pin_low(SR_CLK_PIN); } #ifdef KEYBOARD_ibm_model_m_mschwingen_led_ws2812 @@ -187,9 +187,9 @@ bool led_update_kb(led_t led_state) { dprintf("LED Update: %d %d %d", led_state.num_lock, led_state.caps_lock, led_state.scroll_lock); if (led_update_user(led_state)) { - if (!isRecording) writePin(MODELM_LED_NUMLOCK, !led_state.num_lock); - writePin(MODELM_LED_CAPSLOCK, !led_state.caps_lock); - writePin(MODELM_LED_SCROLLOCK, !led_state.scroll_lock); + if (!isRecording) gpio_write_pin(MODELM_LED_NUMLOCK, !led_state.num_lock); + gpio_write_pin(MODELM_LED_CAPSLOCK, !led_state.caps_lock); + gpio_write_pin(MODELM_LED_SCROLLOCK, !led_state.scroll_lock); } return true; } @@ -198,7 +198,7 @@ void update_layer_leds(void) { if (isRecording && timer_elapsed(blink_cycle_timer) > 150) { blink_state = !blink_state; blink_cycle_timer = timer_read(); - writePin(MODELM_LED_NUMLOCK, blink_state); + gpio_write_pin(MODELM_LED_NUMLOCK, blink_state); } } diff --git a/keyboards/ibm/model_m/teensypp/teensypp.c b/keyboards/ibm/model_m/teensypp/teensypp.c index fa8669dc81..aac85424bf 100644 --- a/keyboards/ibm/model_m/teensypp/teensypp.c +++ b/keyboards/ibm/model_m/teensypp/teensypp.c @@ -17,20 +17,20 @@ void led_init_ports(void) { /* Setting status LEDs pins to output and +5V (off) */ - setPinOutput(B4); - setPinOutput(B5); - setPinOutput(B6); - writePinHigh(B4); - writePinHigh(B5); - writePinHigh(B6); + gpio_set_pin_output(B4); + gpio_set_pin_output(B5); + gpio_set_pin_output(B6); + gpio_write_pin_high(B4); + gpio_write_pin_high(B5); + gpio_write_pin_high(B6); } bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if(res) { - writePin(B4, !led_state.num_lock); - writePin(B6, !led_state.caps_lock); - writePin(B5, !led_state.scroll_lock); + gpio_write_pin(B4, !led_state.num_lock); + gpio_write_pin(B6, !led_state.caps_lock); + gpio_write_pin(B5, !led_state.scroll_lock); } return res; } diff --git a/keyboards/ibm/model_m/yugo_m/yugo_m.c b/keyboards/ibm/model_m/yugo_m/yugo_m.c index 542043d5dc..a725a3657b 100644 --- a/keyboards/ibm/model_m/yugo_m/yugo_m.c +++ b/keyboards/ibm/model_m/yugo_m/yugo_m.c @@ -17,9 +17,9 @@ void keyboard_pre_init_kb(void) { // Set our LED pins as output - setPinOutput(A2); - setPinOutput(A1); - setPinOutput(A0); + gpio_set_pin_output(A2); + gpio_set_pin_output(A1); + gpio_set_pin_output(A0); keyboard_pre_init_user(); } @@ -27,9 +27,9 @@ void keyboard_pre_init_kb(void) { bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if(res) { - writePin(A2, !led_state.num_lock); - writePin(A1, !led_state.caps_lock); - writePin(A0, !led_state.scroll_lock); + gpio_write_pin(A2, !led_state.num_lock); + gpio_write_pin(A1, !led_state.caps_lock); + gpio_write_pin(A0, !led_state.scroll_lock); } return res; } diff --git a/keyboards/idb/idb_60/idb_60.c b/keyboards/idb/idb_60/idb_60.c index 1ca4b8796f..77485a4273 100644 --- a/keyboards/idb/idb_60/idb_60.c +++ b/keyboards/idb/idb_60/idb_60.c @@ -1,24 +1,24 @@ #include "idb_60.h" void keyboard_pre_init_kb(void) { - setPinOutput(C4); - setPinOutput(C5); + gpio_set_pin_output(C4); + gpio_set_pin_output(C5); } inline void _idb_60_caps_led_on(void) { - writePinLow(C5); + gpio_write_pin_low(C5); } inline void _idb_60_fn_led_on(void) { - writePinLow(C4); + gpio_write_pin_low(C4); } inline void _idb_60_caps_led_off(void) { - writePinHigh(C5); + gpio_write_pin_high(C5); } inline void _idb_60_fn_led_off(void) { - writePinHigh(C4); + gpio_write_pin_high(C4); } // Capslock LED indicator diff --git a/keyboards/ilumkb/volcano660/volcano660.c b/keyboards/ilumkb/volcano660/volcano660.c index d6c004987e..5e6d67c9ba 100644 --- a/keyboards/ilumkb/volcano660/volcano660.c +++ b/keyboards/ilumkb/volcano660/volcano660.c @@ -16,18 +16,18 @@ #include "quantum.h" void matrix_init_kb(void) { - setPinOutput(D0); - setPinOutput(D1); - setPinOutput(D2); + gpio_set_pin_output(D0); + gpio_set_pin_output(D1); + gpio_set_pin_output(D2); matrix_init_user(); } bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if(res) { - writePin(D0, !led_state.num_lock); - writePin(D2, !led_state.caps_lock); - writePin(D1, !led_state.scroll_lock); + gpio_write_pin(D0, !led_state.num_lock); + gpio_write_pin(D2, !led_state.caps_lock); + gpio_write_pin(D1, !led_state.scroll_lock); } return res; diff --git a/keyboards/ingrained/matrix.c b/keyboards/ingrained/matrix.c index 3ba9d8dcf3..92b024cdc2 100644 --- a/keyboards/ingrained/matrix.c +++ b/keyboards/ingrained/matrix.c @@ -180,8 +180,8 @@ static void init_cols(void) { pin_t matrix_col_pins_mcu[MATRIX_COLS_PER_SIDE] = MATRIX_COL_PINS_MCU; for (int pin_index = 0; pin_index < MATRIX_COLS_PER_SIDE; pin_index++) { pin_t pin = matrix_col_pins_mcu[pin_index]; - setPinInput(pin); - writePinHigh(pin); + gpio_set_pin_input(pin); + gpio_write_pin_high(pin); } } @@ -192,7 +192,7 @@ static matrix_row_t read_cols(uint8_t row) { // For each col... for (uint8_t col_index = 0; col_index < MATRIX_COLS_PER_SIDE; col_index++) { // Select the col pin to read (active low) - uint8_t pin_state = readPin(matrix_col_pins_mcu[col_index]); + uint8_t pin_state = gpio_read_pin(matrix_col_pins_mcu[col_index]); // Populate the matrix row with the state of the col pin current_row_value |= pin_state ? 0 : (MATRIX_ROW_SHIFTER << col_index); @@ -227,8 +227,8 @@ static void unselect_rows(void) { pin_t matrix_row_pins_mcu[MATRIX_ROWS_PER_SIDE] = MATRIX_ROW_PINS_MCU; for (int pin_index = 0; pin_index < MATRIX_ROWS_PER_SIDE; pin_index++) { pin_t pin = matrix_row_pins_mcu[pin_index]; - setPinInput(pin); - writePinLow(pin); + gpio_set_pin_input(pin); + gpio_write_pin_low(pin); } } @@ -237,8 +237,8 @@ static void select_row(uint8_t row) { // select on atmega32u4 pin_t matrix_row_pins_mcu[MATRIX_ROWS_PER_SIDE] = MATRIX_ROW_PINS_MCU; pin_t pin = matrix_row_pins_mcu[row]; - setPinOutput(pin); - writePinLow(pin); + gpio_set_pin_output(pin); + gpio_write_pin_low(pin); } else { // select on mcp23017 if (mcp23017_status) { // if there was an error diff --git a/keyboards/input_club/k_type/is31fl3733-dual.c b/keyboards/input_club/k_type/is31fl3733-dual.c index 9e1e6b57f7..fab898dce4 100644 --- a/keyboards/input_club/k_type/is31fl3733-dual.c +++ b/keyboards/input_club/k_type/is31fl3733-dual.c @@ -128,8 +128,8 @@ void is31fl3733_write_pwm_buffer(uint8_t bus, uint8_t index) { void is31fl3733_init_drivers(void) { #if defined(IS31FL3733_SDB_PIN) - setPinOutput(IS31FL3733_SDB_PIN); - writePinHigh(IS31FL3733_SDB_PIN); + gpio_set_pin_output(IS31FL3733_SDB_PIN); + gpio_write_pin_high(IS31FL3733_SDB_PIN); #endif i2c_init(&I2CD1, I2C1_SCL_PIN, I2C1_SDA_PIN); diff --git a/keyboards/jae/j01/j01.c b/keyboards/jae/j01/j01.c index 95f3e9b042..4d3f8ced46 100644 --- a/keyboards/jae/j01/j01.c +++ b/keyboards/jae/j01/j01.c @@ -26,12 +26,12 @@ void matrix_init_kb(void) { // runs once when the firmware starts up matrix_init_user(); - setPinOutput(E6); + gpio_set_pin_output(E6); } bool led_update_kb(led_t led_state) { if(led_update_user(led_state)) { - writePin(E6, !led_state.caps_lock); + gpio_write_pin(E6, !led_state.caps_lock); } return true; diff --git a/keyboards/jels/jels88/jels88.c b/keyboards/jels/jels88/jels88.c index 8e9c12aced..ceb187ab17 100644 --- a/keyboards/jels/jels88/jels88.c +++ b/keyboards/jels/jels88/jels88.c @@ -23,16 +23,16 @@ #define SCROLL_LED D4 void keyboard_pre_init_kb(void) { - setPinOutput(CAPS_LED); - setPinOutput(SCROLL_LED); + gpio_set_pin_output(CAPS_LED); + gpio_set_pin_output(SCROLL_LED); keyboard_pre_init_user(); } bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if (res) { - writePin(CAPS_LED, led_state.caps_lock); - writePin(SCROLL_LED, led_state.scroll_lock); + gpio_write_pin(CAPS_LED, led_state.caps_lock); + gpio_write_pin(SCROLL_LED, led_state.scroll_lock); } return res; } diff --git a/keyboards/jian/nsrev2/config.h b/keyboards/jian/nsrev2/config.h index 7df400367f..48d76bd8a3 100644 --- a/keyboards/jian/nsrev2/config.h +++ b/keyboards/jian/nsrev2/config.h @@ -57,33 +57,33 @@ along with this program. If not, see . // (Doesn't work on mac. There is no num lock, so it will be always off and lit) #ifdef NUM_NMOSFET -#define RESET_NUM_LOCK_LED() writePinLow(NUM_LOCK_LED_PIN) +#define RESET_NUM_LOCK_LED() gpio_write_pin_low(NUM_LOCK_LED_PIN) #ifdef NUM_INVERT -#define UPDATE_NUM_LOCK_LED() writePin(NUM_LOCK_LED_PIN, !led_state.num_lock) +#define UPDATE_NUM_LOCK_LED() gpio_write_pin(NUM_LOCK_LED_PIN, !led_state.num_lock) #else -#define UPDATE_NUM_LOCK_LED() writePin(NUM_LOCK_LED_PIN, led_state.num_lock) +#define UPDATE_NUM_LOCK_LED() gpio_write_pin(NUM_LOCK_LED_PIN, led_state.num_lock) #endif // NUM_INVERT #else -#define RESET_NUM_LOCK_LED() writePinHigh(NUM_LOCK_LED_PIN) +#define RESET_NUM_LOCK_LED() gpio_write_pin_high(NUM_LOCK_LED_PIN) #ifdef NUM_INVERT -#define UPDATE_NUM_LOCK_LED() writePin(NUM_LOCK_LED_PIN, led_state.num_lock) +#define UPDATE_NUM_LOCK_LED() gpio_write_pin(NUM_LOCK_LED_PIN, led_state.num_lock) #else -#define UPDATE_NUM_LOCK_LED() writePin(NUM_LOCK_LED_PIN, !led_state.num_lock) +#define UPDATE_NUM_LOCK_LED() gpio_write_pin(NUM_LOCK_LED_PIN, !led_state.num_lock) #endif // NUM_INVERT #endif // NUM_NMOSFET #ifdef CAPS_NMOSFET -#define RESET_CAPS_LOCK_LED() writePinLow(CAPS_LOCK_LED_PIN) -#define UPDATE_CAPS_LOCK_LED() writePin(CAPS_LOCK_LED_PIN, led_state.caps_lock) +#define RESET_CAPS_LOCK_LED() gpio_write_pin_low(CAPS_LOCK_LED_PIN) +#define UPDATE_CAPS_LOCK_LED() gpio_write_pin(CAPS_LOCK_LED_PIN, led_state.caps_lock) #else -#define RESET_CAPS_LOCK_LED() writePinHigh(CAPS_LOCK_LED_PIN) -#define UPDATE_CAPS_LOCK_LED() writePin(CAPS_LOCK_LED_PIN, !led_state.caps_lock) +#define RESET_CAPS_LOCK_LED() gpio_write_pin_high(CAPS_LOCK_LED_PIN) +#define UPDATE_CAPS_LOCK_LED() gpio_write_pin(CAPS_LOCK_LED_PIN, !led_state.caps_lock) #endif // CAPS_NMOSFET #ifdef SCROLL_NMOSFET -#define RESET_SCROLL_LOCK_LED() writePinLow(SCROLL_LOCK_LED_PIN) -#define UPDATE_SCROLL_LOCK_LED() writePin(SCROLL_LOCK_LED_PIN, led_state.scroll_lock) +#define RESET_SCROLL_LOCK_LED() gpio_write_pin_low(SCROLL_LOCK_LED_PIN) +#define UPDATE_SCROLL_LOCK_LED() gpio_write_pin(SCROLL_LOCK_LED_PIN, led_state.scroll_lock) #else -#define RESET_SCROLL_LOCK_LED() writePinHigh(SCROLL_LOCK_LED_PIN) -#define UPDATE_SCROLL_LOCK_LED() writePin(SCROLL_LOCK_LED_PIN, !led_state.scroll_lock) +#define RESET_SCROLL_LOCK_LED() gpio_write_pin_high(SCROLL_LOCK_LED_PIN) +#define UPDATE_SCROLL_LOCK_LED() gpio_write_pin(SCROLL_LOCK_LED_PIN, !led_state.scroll_lock) #endif // SCROLL_NMOSFET diff --git a/keyboards/jian/nsrev2/nsrev2.c b/keyboards/jian/nsrev2/nsrev2.c index 1b65d4f016..50883ff211 100644 --- a/keyboards/jian/nsrev2/nsrev2.c +++ b/keyboards/jian/nsrev2/nsrev2.c @@ -36,15 +36,15 @@ void suspend_wakeup_init_kb(void) { void led_init_kb(void) { #ifdef NUM_LOCK_LED_PIN - setPinOutput(NUM_LOCK_LED_PIN); + gpio_set_pin_output(NUM_LOCK_LED_PIN); RESET_NUM_LOCK_LED(); #endif // NUM_LOCK_LED_PIN #ifdef CAPS_LOCK_LED_PIN - setPinOutput(CAPS_LOCK_LED_PIN); + gpio_set_pin_output(CAPS_LOCK_LED_PIN); RESET_CAPS_LOCK_LED(); #endif // CAPS_LOCK_LED_PIN #ifdef SCROLL_LOCK_LED_PIN - setPinOutput(SCROLL_LOCK_LED_PIN); + gpio_set_pin_output(SCROLL_LOCK_LED_PIN); RESET_SCROLL_LOCK_LED(); #endif // SCROLL_LOCK_LED_PIN } diff --git a/keyboards/jian/rev1/config.h b/keyboards/jian/rev1/config.h index fcdf59f044..7ee2effd51 100644 --- a/keyboards/jian/rev1/config.h +++ b/keyboards/jian/rev1/config.h @@ -39,35 +39,35 @@ along with this program. If not, see . // (Doesn't work on mac. There is no num lock, so it will be always off and lit) #ifdef NUM_NMOSFET -#define RESET_NUM_LOCK_LED() writePinLow(NUM_LOCK_LED_PIN) +#define RESET_NUM_LOCK_LED() gpio_write_pin_low(NUM_LOCK_LED_PIN) #ifdef NUM_INVERT -#define UPDATE_NUM_LOCK_LED() writePin(NUM_LOCK_LED_PIN, !led_state.num_lock) +#define UPDATE_NUM_LOCK_LED() gpio_write_pin(NUM_LOCK_LED_PIN, !led_state.num_lock) #else -#define UPDATE_NUM_LOCK_LED() writePin(NUM_LOCK_LED_PIN, led_state.num_lock) +#define UPDATE_NUM_LOCK_LED() gpio_write_pin(NUM_LOCK_LED_PIN, led_state.num_lock) #endif // NUM_INVERT #else -#define RESET_NUM_LOCK_LED() writePinHigh(NUM_LOCK_LED_PIN) +#define RESET_NUM_LOCK_LED() gpio_write_pin_high(NUM_LOCK_LED_PIN) #ifdef NUM_INVERT -#define UPDATE_NUM_LOCK_LED() writePin(NUM_LOCK_LED_PIN, led_state.num_lock) +#define UPDATE_NUM_LOCK_LED() gpio_write_pin(NUM_LOCK_LED_PIN, led_state.num_lock) #else -#define UPDATE_NUM_LOCK_LED() writePin(NUM_LOCK_LED_PIN, !led_state.num_lock) +#define UPDATE_NUM_LOCK_LED() gpio_write_pin(NUM_LOCK_LED_PIN, !led_state.num_lock) #endif // NUM_INVERT #endif // NUM_NMOSFET #ifdef CAPS_NMOSFET -#define RESET_CAPS_LOCK_LED() writePinLow(CAPS_LOCK_LED_PIN) -#define UPDATE_CAPS_LOCK_LED() writePin(CAPS_LOCK_LED_PIN, led_state.caps_lock) +#define RESET_CAPS_LOCK_LED() gpio_write_pin_low(CAPS_LOCK_LED_PIN) +#define UPDATE_CAPS_LOCK_LED() gpio_write_pin(CAPS_LOCK_LED_PIN, led_state.caps_lock) #else -#define RESET_CAPS_LOCK_LED() writePinHigh(CAPS_LOCK_LED_PIN) -#define UPDATE_CAPS_LOCK_LED() writePin(CAPS_LOCK_LED_PIN, !led_state.caps_lock) +#define RESET_CAPS_LOCK_LED() gpio_write_pin_high(CAPS_LOCK_LED_PIN) +#define UPDATE_CAPS_LOCK_LED() gpio_write_pin(CAPS_LOCK_LED_PIN, !led_state.caps_lock) #endif // CAPS_NMOSFET #ifdef SCROLL_NMOSFET -#define RESET_SCROLL_LOCK_LED() writePinLow(SCROLL_LOCK_LED_PIN) -#define UPDATE_SCROLL_LOCK_LED() writePin(SCROLL_LOCK_LED_PIN, led_state.scroll_lock) +#define RESET_SCROLL_LOCK_LED() gpio_write_pin_low(SCROLL_LOCK_LED_PIN) +#define UPDATE_SCROLL_LOCK_LED() gpio_write_pin(SCROLL_LOCK_LED_PIN, led_state.scroll_lock) #else -#define RESET_SCROLL_LOCK_LED() writePinHigh(SCROLL_LOCK_LED_PIN) -#define UPDATE_SCROLL_LOCK_LED() writePin(SCROLL_LOCK_LED_PIN, !led_state.scroll_lock) +#define RESET_SCROLL_LOCK_LED() gpio_write_pin_high(SCROLL_LOCK_LED_PIN) +#define UPDATE_SCROLL_LOCK_LED() gpio_write_pin(SCROLL_LOCK_LED_PIN, !led_state.scroll_lock) #endif // SCROLL_NMOSFET #define RGBLIGHT_TIMER diff --git a/keyboards/jian/rev1/rev1.c b/keyboards/jian/rev1/rev1.c index 1b77aa53c4..1563c40916 100644 --- a/keyboards/jian/rev1/rev1.c +++ b/keyboards/jian/rev1/rev1.c @@ -36,15 +36,15 @@ void suspend_wakeup_init_kb(void) { void led_init_kb(void) { #ifdef NUM_LOCK_LED_PIN - setPinOutput(NUM_LOCK_LED_PIN); + gpio_set_pin_output(NUM_LOCK_LED_PIN); RESET_NUM_LOCK_LED(); #endif // NUM_LOCK_LED_PIN #ifdef CAPS_LOCK_LED_PIN - setPinOutput(CAPS_LOCK_LED_PIN); + gpio_set_pin_output(CAPS_LOCK_LED_PIN); RESET_CAPS_LOCK_LED(); #endif // CAPS_LOCK_LED_PIN #ifdef SCROLL_LOCK_LED_PIN - setPinOutput(SCROLL_LOCK_LED_PIN); + gpio_set_pin_output(SCROLL_LOCK_LED_PIN); RESET_SCROLL_LOCK_LED(); #endif // SCROLL_LOCK_LED_PIN } diff --git a/keyboards/jian/rev2/config.h b/keyboards/jian/rev2/config.h index 091605665e..33ba0ecbc5 100644 --- a/keyboards/jian/rev2/config.h +++ b/keyboards/jian/rev2/config.h @@ -45,33 +45,33 @@ along with this program. If not, see . // (Doesn't work on mac. There is no num lock, so it will be always off and lit) #ifdef NUM_NMOSFET -#define RESET_NUM_LOCK_LED() writePinLow(NUM_LOCK_LED_PIN) +#define RESET_NUM_LOCK_LED() gpio_write_pin_low(NUM_LOCK_LED_PIN) #ifdef NUM_INVERT -#define UPDATE_NUM_LOCK_LED() writePin(NUM_LOCK_LED_PIN, !led_state.num_lock) +#define UPDATE_NUM_LOCK_LED() gpio_write_pin(NUM_LOCK_LED_PIN, !led_state.num_lock) #else -#define UPDATE_NUM_LOCK_LED() writePin(NUM_LOCK_LED_PIN, led_state.num_lock) +#define UPDATE_NUM_LOCK_LED() gpio_write_pin(NUM_LOCK_LED_PIN, led_state.num_lock) #endif // NUM_INVERT #else -#define RESET_NUM_LOCK_LED() writePinHigh(NUM_LOCK_LED_PIN) +#define RESET_NUM_LOCK_LED() gpio_write_pin_high(NUM_LOCK_LED_PIN) #ifdef NUM_INVERT -#define UPDATE_NUM_LOCK_LED() writePin(NUM_LOCK_LED_PIN, led_state.num_lock) +#define UPDATE_NUM_LOCK_LED() gpio_write_pin(NUM_LOCK_LED_PIN, led_state.num_lock) #else -#define UPDATE_NUM_LOCK_LED() writePin(NUM_LOCK_LED_PIN, !led_state.num_lock) +#define UPDATE_NUM_LOCK_LED() gpio_write_pin(NUM_LOCK_LED_PIN, !led_state.num_lock) #endif // NUM_INVERT #endif // NUM_NMOSFET #ifdef CAPS_NMOSFET -#define RESET_CAPS_LOCK_LED() writePinLow(CAPS_LOCK_LED_PIN) -#define UPDATE_CAPS_LOCK_LED() writePin(CAPS_LOCK_LED_PIN, led_state.caps_lock) +#define RESET_CAPS_LOCK_LED() gpio_write_pin_low(CAPS_LOCK_LED_PIN) +#define UPDATE_CAPS_LOCK_LED() gpio_write_pin(CAPS_LOCK_LED_PIN, led_state.caps_lock) #else -#define RESET_CAPS_LOCK_LED() writePinHigh(CAPS_LOCK_LED_PIN) -#define UPDATE_CAPS_LOCK_LED() writePin(CAPS_LOCK_LED_PIN, !led_state.caps_lock) +#define RESET_CAPS_LOCK_LED() gpio_write_pin_high(CAPS_LOCK_LED_PIN) +#define UPDATE_CAPS_LOCK_LED() gpio_write_pin(CAPS_LOCK_LED_PIN, !led_state.caps_lock) #endif // CAPS_NMOSFET #ifdef SCROLL_NMOSFET -#define RESET_SCROLL_LOCK_LED() writePinLow(SCROLL_LOCK_LED_PIN) -#define UPDATE_SCROLL_LOCK_LED() writePin(SCROLL_LOCK_LED_PIN, led_state.scroll_lock) +#define RESET_SCROLL_LOCK_LED() gpio_write_pin_low(SCROLL_LOCK_LED_PIN) +#define UPDATE_SCROLL_LOCK_LED() gpio_write_pin(SCROLL_LOCK_LED_PIN, led_state.scroll_lock) #else -#define RESET_SCROLL_LOCK_LED() writePinHigh(SCROLL_LOCK_LED_PIN) -#define UPDATE_SCROLL_LOCK_LED() writePin(SCROLL_LOCK_LED_PIN, !led_state.scroll_lock) +#define RESET_SCROLL_LOCK_LED() gpio_write_pin_high(SCROLL_LOCK_LED_PIN) +#define UPDATE_SCROLL_LOCK_LED() gpio_write_pin(SCROLL_LOCK_LED_PIN, !led_state.scroll_lock) #endif // SCROLL_NMOSFET diff --git a/keyboards/jian/rev2/rev2.c b/keyboards/jian/rev2/rev2.c index 1b65d4f016..50883ff211 100644 --- a/keyboards/jian/rev2/rev2.c +++ b/keyboards/jian/rev2/rev2.c @@ -36,15 +36,15 @@ void suspend_wakeup_init_kb(void) { void led_init_kb(void) { #ifdef NUM_LOCK_LED_PIN - setPinOutput(NUM_LOCK_LED_PIN); + gpio_set_pin_output(NUM_LOCK_LED_PIN); RESET_NUM_LOCK_LED(); #endif // NUM_LOCK_LED_PIN #ifdef CAPS_LOCK_LED_PIN - setPinOutput(CAPS_LOCK_LED_PIN); + gpio_set_pin_output(CAPS_LOCK_LED_PIN); RESET_CAPS_LOCK_LED(); #endif // CAPS_LOCK_LED_PIN #ifdef SCROLL_LOCK_LED_PIN - setPinOutput(SCROLL_LOCK_LED_PIN); + gpio_set_pin_output(SCROLL_LOCK_LED_PIN); RESET_SCROLL_LOCK_LED(); #endif // SCROLL_LOCK_LED_PIN } diff --git a/keyboards/jones/v03/matrix.c b/keyboards/jones/v03/matrix.c index 445c1acdc0..5663f1a8fc 100644 --- a/keyboards/jones/v03/matrix.c +++ b/keyboards/jones/v03/matrix.c @@ -22,24 +22,24 @@ static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; static void select_row(uint8_t row) { - setPinOutput(row_pins[row]); - writePinLow(row_pins[row]); + gpio_set_pin_output(row_pins[row]); + gpio_write_pin_low(row_pins[row]); } static void unselect_row(uint8_t row) { - setPinInputHigh(row_pins[row]); + gpio_set_pin_input_high(row_pins[row]); } static void unselect_rows(void) { for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } } static void init_pins(void) { unselect_rows(); for (uint8_t x = 0; x < MATRIX_COLS; x++) { - setPinInputHigh(col_pins[x]); + gpio_set_pin_input_high(col_pins[x]); } } @@ -60,7 +60,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) // skip reading when index equals (= pin itself) if (col_index != current_row) { // Check col pin pin_state - if (readPin(col_pins[col_index]) == 0) { + if (gpio_read_pin(col_pins[col_index]) == 0) { // Pin LO, set col bit current_matrix[current_row] |= (ROW_SHIFTER << col_index); } else { diff --git a/keyboards/jones/v03_1/matrix.c b/keyboards/jones/v03_1/matrix.c index 445c1acdc0..5663f1a8fc 100644 --- a/keyboards/jones/v03_1/matrix.c +++ b/keyboards/jones/v03_1/matrix.c @@ -22,24 +22,24 @@ static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; static void select_row(uint8_t row) { - setPinOutput(row_pins[row]); - writePinLow(row_pins[row]); + gpio_set_pin_output(row_pins[row]); + gpio_write_pin_low(row_pins[row]); } static void unselect_row(uint8_t row) { - setPinInputHigh(row_pins[row]); + gpio_set_pin_input_high(row_pins[row]); } static void unselect_rows(void) { for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } } static void init_pins(void) { unselect_rows(); for (uint8_t x = 0; x < MATRIX_COLS; x++) { - setPinInputHigh(col_pins[x]); + gpio_set_pin_input_high(col_pins[x]); } } @@ -60,7 +60,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) // skip reading when index equals (= pin itself) if (col_index != current_row) { // Check col pin pin_state - if (readPin(col_pins[col_index]) == 0) { + if (gpio_read_pin(col_pins[col_index]) == 0) { // Pin LO, set col bit current_matrix[current_row] |= (ROW_SHIFTER << col_index); } else { diff --git a/keyboards/joshajohnson/hub16/matrix.c b/keyboards/joshajohnson/hub16/matrix.c index 0fe1d41dad..26222cf15a 100644 --- a/keyboards/joshajohnson/hub16/matrix.c +++ b/keyboards/joshajohnson/hub16/matrix.c @@ -31,22 +31,22 @@ extern matrix_row_t raw_matrix[MATRIX_ROWS]; // raw values extern matrix_row_t matrix[MATRIX_ROWS]; // debounced values static void select_row(uint8_t row) { - setPinOutput(row_pins[row]); - writePinLow(row_pins[row]); + gpio_set_pin_output(row_pins[row]); + gpio_write_pin_low(row_pins[row]); } -static void unselect_row(uint8_t row) { setPinInputHigh(row_pins[row]); } +static void unselect_row(uint8_t row) { gpio_set_pin_input_high(row_pins[row]); } static void unselect_rows(void) { for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } } static void init_pins(void) { unselect_rows(); for (uint8_t x = 0; x < MATRIX_COLS; x++) { - setPinInputHigh(col_pins[x]); + gpio_set_pin_input_high(col_pins[x]); } } @@ -64,7 +64,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) // For each col... for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { // Select the col pin to read (active low) - uint8_t pin_state = readPin(col_pins[col_index]); + uint8_t pin_state = gpio_read_pin(col_pins[col_index]); // Populate the matrix row with the state of the col pin current_matrix[current_row] |= pin_state ? 0 : (MATRIX_ROW_SHIFTER << col_index); @@ -79,8 +79,8 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) void matrix_init_custom(void) { // initialize key pins - setPinInput(SWITCH_1); - setPinInput(SWITCH_2); + gpio_set_pin_input(SWITCH_1); + gpio_set_pin_input(SWITCH_2); init_pins(); } @@ -112,8 +112,8 @@ static bool read_encoder_switches(matrix_row_t current_matrix[], uint8_t current bool btn_2_rise = 0; btn_1_array <<= 1; btn_2_array <<= 1; - btn_1_array |= readPin(SWITCH_1); - btn_2_array |= readPin(SWITCH_2); + btn_1_array |= gpio_read_pin(SWITCH_1); + btn_2_array |= gpio_read_pin(SWITCH_2); (btn_1_array == 0b01111111) ? (btn_1_rise = 1) : (btn_1_rise = 0); (btn_2_array == 0b01111111) ? (btn_2_rise = 1) : (btn_2_rise = 0); diff --git a/keyboards/jukaie/jk01/jk01.c b/keyboards/jukaie/jk01/jk01.c index 913e77a55e..3c6daabf02 100644 --- a/keyboards/jukaie/jk01/jk01.c +++ b/keyboards/jukaie/jk01/jk01.c @@ -132,9 +132,9 @@ void spi_init(void) { is_initialised = true; // Try releasing special pins for a short time - setPinInput(SPI_SCK_PIN); - setPinInput(SPI_MOSI_PIN); - setPinInput(SPI_MISO_PIN); + gpio_set_pin_input(SPI_SCK_PIN); + gpio_set_pin_input(SPI_MOSI_PIN); + gpio_set_pin_input(SPI_MISO_PIN); chThdSleepMilliseconds(10); @@ -147,12 +147,12 @@ void spi_init(void) { #endif void keyboard_pre_init_kb(void) { - setPinOutput(C0); - setPinOutput(C15); + gpio_set_pin_output(C0); + gpio_set_pin_output(C15); keyboard_pre_init_user(); }; void housekeeping_task_kb(void) { - writePin(C15, keymap_config.no_gui); + gpio_write_pin(C15, keymap_config.no_gui); }; bool process_record_user(uint16_t keycode, keyrecord_t *record) { diff --git a/keyboards/kabedon/kabedon980/kabedon980.c b/keyboards/kabedon/kabedon980/kabedon980.c index 0614972f5e..7024a2eaa9 100644 --- a/keyboards/kabedon/kabedon980/kabedon980.c +++ b/keyboards/kabedon/kabedon980/kabedon980.c @@ -2,7 +2,7 @@ bool led_update_kb(led_t led_state) { if (led_update_user(led_state)) { - writePin(E6, !led_state.caps_lock); + gpio_write_pin(E6, !led_state.caps_lock); } return true; } diff --git a/keyboards/kagizaraya/chidori/board.c b/keyboards/kagizaraya/chidori/board.c index 2834f7625b..07bdcf165e 100644 --- a/keyboards/kagizaraya/chidori/board.c +++ b/keyboards/kagizaraya/chidori/board.c @@ -60,8 +60,8 @@ static board_interface_t* get_interface(board_info_t* board) { static void board_set_master_led(board_info_t* board, uint8_t led_index, bool status) { pin_t pin = board->led_pins[led_index]; board->led_status[led_index] = status; - setPinOutput(pin); - status ? writePinHigh(pin) : writePinLow(pin); + gpio_set_pin_output(pin); + status ? gpio_write_pin_high(pin) : gpio_write_pin_low(pin); } static void board_set_slave_led(board_info_t* board, uint8_t led_index, bool status) { @@ -254,18 +254,18 @@ static bool board_read_cols_on_slave_row(board_info_t* board, matrix_row_t curre // Functions for master board // static void board_select_master_row(board_info_t* board, uint8_t board_row) { - setPinOutput(board->row_pins[board_row]); - writePinLow(board->row_pins[board_row]); + gpio_set_pin_output(board->row_pins[board_row]); + gpio_write_pin_low(board->row_pins[board_row]); } -static void board_unselect_master_row(board_info_t* board, uint8_t board_row) { setPinInputHigh(board->row_pins[board_row]); } +static void board_unselect_master_row(board_info_t* board, uint8_t board_row) { gpio_set_pin_input_high(board->row_pins[board_row]); } static void board_unselect_master_rows(board_info_t* board) { if (!board) { return; } for (uint8_t x = 0; x < NUM_ROWS; x++) { - setPinInput(board->row_pins[x]); + gpio_set_pin_input(board->row_pins[x]); } } @@ -281,7 +281,7 @@ static bool board_read_cols_on_master_row(board_info_t* board, matrix_row_t curr wait_us(30); for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { - uint8_t pin_state = readPin(board->col_pins[col_index]); + uint8_t pin_state = gpio_read_pin(board->col_pins[col_index]); current_matrix[row] |= pin_state ? 0 : (1 << col_index); } board_unselect_master_row(board, board_row); @@ -295,7 +295,7 @@ static void board_master_init(void) { return; } for (uint8_t x = 0; x < NUM_COLS; x++) { - setPinInputHigh(board->col_pins[x]); + gpio_set_pin_input_high(board->col_pins[x]); } board->initialized = true; } diff --git a/keyboards/kakunpc/angel64/alpha/matrix.c b/keyboards/kakunpc/angel64/alpha/matrix.c index 5d731b1068..ff2b8a801e 100644 --- a/keyboards/kakunpc/angel64/alpha/matrix.c +++ b/keyboards/kakunpc/angel64/alpha/matrix.c @@ -105,37 +105,37 @@ void matrix_print(void) static void select_row(uint8_t row) { - setPinOutput(row_pins[row]); - writePinLow(row_pins[row]); + gpio_set_pin_output(row_pins[row]); + gpio_write_pin_low(row_pins[row]); } static void unselect_row(uint8_t row) { - setPinInputHigh(row_pins[row]); + gpio_set_pin_input_high(row_pins[row]); } static void unselect_rows(void) { for(uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } } static void select_col(uint8_t col) { - setPinOutput(col_pins[col]); - writePinLow(col_pins[col]); + gpio_set_pin_output(col_pins[col]); + gpio_write_pin_low(col_pins[col]); } static void unselect_col(uint8_t col) { - setPinInputHigh(col_pins[col]); + gpio_set_pin_input_high(col_pins[col]); } static void unselect_cols(void) { for(uint8_t x = 0; x < MATRIX_COLS; x++) { - setPinInputHigh(col_pins[x]); + gpio_set_pin_input_high(col_pins[x]); } } @@ -143,10 +143,10 @@ static void init_pins(void) { unselect_rows(); unselect_cols(); for (uint8_t x = 0; x < MATRIX_COLS; x++) { - setPinInputHigh(col_pins[x]); + gpio_set_pin_input_high(col_pins[x]); } for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } } @@ -166,7 +166,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) for(uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { // Select the col pin to read (active low) - uint8_t pin_state = readPin(col_pins[col_index]); + uint8_t pin_state = gpio_read_pin(col_pins[col_index]); // Populate the matrix row with the state of the col pin current_matrix[current_row] |= pin_state ? 0 : (ROW_SHIFTER << col_index); @@ -194,7 +194,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) matrix_row_t last_row_value = current_matrix[tmp]; // Check row pin state - if (readPin(row_pins[row_index]) == 0) + if (gpio_read_pin(row_pins[row_index]) == 0) { // Pin LO, set col bit current_matrix[tmp] |= (ROW_SHIFTER << current_col); diff --git a/keyboards/kakunpc/angel64/rev1/matrix.c b/keyboards/kakunpc/angel64/rev1/matrix.c index 5d731b1068..ff2b8a801e 100644 --- a/keyboards/kakunpc/angel64/rev1/matrix.c +++ b/keyboards/kakunpc/angel64/rev1/matrix.c @@ -105,37 +105,37 @@ void matrix_print(void) static void select_row(uint8_t row) { - setPinOutput(row_pins[row]); - writePinLow(row_pins[row]); + gpio_set_pin_output(row_pins[row]); + gpio_write_pin_low(row_pins[row]); } static void unselect_row(uint8_t row) { - setPinInputHigh(row_pins[row]); + gpio_set_pin_input_high(row_pins[row]); } static void unselect_rows(void) { for(uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } } static void select_col(uint8_t col) { - setPinOutput(col_pins[col]); - writePinLow(col_pins[col]); + gpio_set_pin_output(col_pins[col]); + gpio_write_pin_low(col_pins[col]); } static void unselect_col(uint8_t col) { - setPinInputHigh(col_pins[col]); + gpio_set_pin_input_high(col_pins[col]); } static void unselect_cols(void) { for(uint8_t x = 0; x < MATRIX_COLS; x++) { - setPinInputHigh(col_pins[x]); + gpio_set_pin_input_high(col_pins[x]); } } @@ -143,10 +143,10 @@ static void init_pins(void) { unselect_rows(); unselect_cols(); for (uint8_t x = 0; x < MATRIX_COLS; x++) { - setPinInputHigh(col_pins[x]); + gpio_set_pin_input_high(col_pins[x]); } for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } } @@ -166,7 +166,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) for(uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { // Select the col pin to read (active low) - uint8_t pin_state = readPin(col_pins[col_index]); + uint8_t pin_state = gpio_read_pin(col_pins[col_index]); // Populate the matrix row with the state of the col pin current_matrix[current_row] |= pin_state ? 0 : (ROW_SHIFTER << col_index); @@ -194,7 +194,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) matrix_row_t last_row_value = current_matrix[tmp]; // Check row pin state - if (readPin(row_pins[row_index]) == 0) + if (gpio_read_pin(row_pins[row_index]) == 0) { // Pin LO, set col bit current_matrix[tmp] |= (ROW_SHIFTER << current_col); diff --git a/keyboards/kakunpc/choc_taro/matrix.c b/keyboards/kakunpc/choc_taro/matrix.c index 4547f1a047..20cdf9de85 100644 --- a/keyboards/kakunpc/choc_taro/matrix.c +++ b/keyboards/kakunpc/choc_taro/matrix.c @@ -28,32 +28,32 @@ static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; static void select_row(uint8_t row) { - setPinOutput(row_pins[row]); - writePinLow(row_pins[row]); + gpio_set_pin_output(row_pins[row]); + gpio_write_pin_low(row_pins[row]); } static void unselect_row(uint8_t row) { - setPinInputHigh(row_pins[row]); + gpio_set_pin_input_high(row_pins[row]); } static void unselect_rows(void) { for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } } static void select_col(uint8_t col) { - setPinOutput(col_pins[col]); - writePinLow(col_pins[col]); + gpio_set_pin_output(col_pins[col]); + gpio_write_pin_low(col_pins[col]); } static void unselect_col(uint8_t col) { - setPinInputHigh(col_pins[col]); + gpio_set_pin_input_high(col_pins[col]); } static void unselect_cols(void) { for (uint8_t x = 0; x < MATRIX_COLS; x++) { - setPinInputHigh(col_pins[x]); + gpio_set_pin_input_high(col_pins[x]); } } @@ -62,11 +62,11 @@ static void init_pins(void) { unselect_cols(); for (uint8_t x = 0; x < MATRIX_COLS; x++) { - setPinInputHigh(col_pins[x]); + gpio_set_pin_input_high(col_pins[x]); } for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } } @@ -85,7 +85,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) for(uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { // Select the col pin to read (active low) - uint8_t pin_state = readPin(col_pins[col_index]); + uint8_t pin_state = gpio_read_pin(col_pins[col_index]); // Populate the matrix row with the state of the col pin current_matrix[current_row] |= pin_state ? 0 : (ROW_SHIFTER << col_index); @@ -111,7 +111,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) matrix_row_t last_row_value = current_matrix[tmp]; // Check row pin state - if (readPin(row_pins[row_index]) == 0) { + if (gpio_read_pin(row_pins[row_index]) == 0) { // Pin LO, set col bit current_matrix[tmp] |= (ROW_SHIFTER << current_col); } else { diff --git a/keyboards/kakunpc/thedogkeyboard/matrix.c b/keyboards/kakunpc/thedogkeyboard/matrix.c index 5d731b1068..ff2b8a801e 100644 --- a/keyboards/kakunpc/thedogkeyboard/matrix.c +++ b/keyboards/kakunpc/thedogkeyboard/matrix.c @@ -105,37 +105,37 @@ void matrix_print(void) static void select_row(uint8_t row) { - setPinOutput(row_pins[row]); - writePinLow(row_pins[row]); + gpio_set_pin_output(row_pins[row]); + gpio_write_pin_low(row_pins[row]); } static void unselect_row(uint8_t row) { - setPinInputHigh(row_pins[row]); + gpio_set_pin_input_high(row_pins[row]); } static void unselect_rows(void) { for(uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } } static void select_col(uint8_t col) { - setPinOutput(col_pins[col]); - writePinLow(col_pins[col]); + gpio_set_pin_output(col_pins[col]); + gpio_write_pin_low(col_pins[col]); } static void unselect_col(uint8_t col) { - setPinInputHigh(col_pins[col]); + gpio_set_pin_input_high(col_pins[col]); } static void unselect_cols(void) { for(uint8_t x = 0; x < MATRIX_COLS; x++) { - setPinInputHigh(col_pins[x]); + gpio_set_pin_input_high(col_pins[x]); } } @@ -143,10 +143,10 @@ static void init_pins(void) { unselect_rows(); unselect_cols(); for (uint8_t x = 0; x < MATRIX_COLS; x++) { - setPinInputHigh(col_pins[x]); + gpio_set_pin_input_high(col_pins[x]); } for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } } @@ -166,7 +166,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) for(uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { // Select the col pin to read (active low) - uint8_t pin_state = readPin(col_pins[col_index]); + uint8_t pin_state = gpio_read_pin(col_pins[col_index]); // Populate the matrix row with the state of the col pin current_matrix[current_row] |= pin_state ? 0 : (ROW_SHIFTER << col_index); @@ -194,7 +194,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) matrix_row_t last_row_value = current_matrix[tmp]; // Check row pin state - if (readPin(row_pins[row_index]) == 0) + if (gpio_read_pin(row_pins[row_index]) == 0) { // Pin LO, set col bit current_matrix[tmp] |= (ROW_SHIFTER << current_col); diff --git a/keyboards/kbdfans/bella/soldered/soldered.c b/keyboards/kbdfans/bella/soldered/soldered.c index 65809c3c2f..bfe9f8f5d4 100755 --- a/keyboards/kbdfans/bella/soldered/soldered.c +++ b/keyboards/kbdfans/bella/soldered/soldered.c @@ -15,14 +15,14 @@ */ #include "quantum.h" void matrix_init_kb(void) { - setPinOutput(E6); + gpio_set_pin_output(E6); matrix_init_user(); } bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if(res) { - writePin(E6, !led_state.caps_lock); + gpio_write_pin(E6, !led_state.caps_lock); } return res; } diff --git a/keyboards/kbdfans/kbd19x/kbd19x.h b/keyboards/kbdfans/kbd19x/kbd19x.h index 33bebeb882..e4453f438d 100644 --- a/keyboards/kbdfans/kbd19x/kbd19x.h +++ b/keyboards/kbdfans/kbd19x/kbd19x.h @@ -20,11 +20,11 @@ along with this program. If not, see . #include "quantum.h" #include "led.h" -inline void kbd19x_caps_led_on(void) { writePinHigh(LED_CAPS_LOCK_PIN); } -inline void kbd19x_caps_led_off(void) { writePinLow(LED_CAPS_LOCK_PIN); } +inline void kbd19x_caps_led_on(void) { gpio_write_pin_high(LED_CAPS_LOCK_PIN); } +inline void kbd19x_caps_led_off(void) { gpio_write_pin_low(LED_CAPS_LOCK_PIN); } -inline void kbd19x_sclk_led_on(void) { writePinHigh(LED_SCROLL_LOCK_PIN); } -inline void kbd19x_sclk_led_off(void) { writePinLow(LED_SCROLL_LOCK_PIN); } +inline void kbd19x_sclk_led_on(void) { gpio_write_pin_high(LED_SCROLL_LOCK_PIN); } +inline void kbd19x_sclk_led_off(void) { gpio_write_pin_low(LED_SCROLL_LOCK_PIN); } -inline void kbd19x_nmlk_led_on(void) { writePinHigh(LED_NUM_LOCK_PIN); } -inline void kbd19x_nmlk_led_off(void) { writePinLow(LED_NUM_LOCK_PIN); } +inline void kbd19x_nmlk_led_on(void) { gpio_write_pin_high(LED_NUM_LOCK_PIN); } +inline void kbd19x_nmlk_led_off(void) { gpio_write_pin_low(LED_NUM_LOCK_PIN); } diff --git a/keyboards/kbdfans/kbd8x/kbd8x.h b/keyboards/kbdfans/kbd8x/kbd8x.h index a0a1ac7390..a7d72904cb 100644 --- a/keyboards/kbdfans/kbd8x/kbd8x.h +++ b/keyboards/kbdfans/kbd8x/kbd8x.h @@ -19,11 +19,11 @@ #include "led.h" // Functions for setting LEDs on toggle keys -inline void caps_led_on(void) { writePinHigh(LED_CAPS_LOCK_PIN); } -inline void caps_led_off(void) { writePinLow(LED_CAPS_LOCK_PIN); } +inline void caps_led_on(void) { gpio_write_pin_high(LED_CAPS_LOCK_PIN); } +inline void caps_led_off(void) { gpio_write_pin_low(LED_CAPS_LOCK_PIN); } -inline void num_led_on(void) { writePinHigh(LED_NUM_LOCK_PIN); } -inline void num_led_off(void) { writePinLow(LED_NUM_LOCK_PIN); } +inline void num_led_on(void) { gpio_write_pin_high(LED_NUM_LOCK_PIN); } +inline void num_led_off(void) { gpio_write_pin_low(LED_NUM_LOCK_PIN); } -inline void scroll_led_on(void) { writePinHigh(LED_SCROLL_LOCK_PIN); } -inline void scroll_led_off(void) { writePinLow(LED_SCROLL_LOCK_PIN); } +inline void scroll_led_on(void) { gpio_write_pin_high(LED_SCROLL_LOCK_PIN); } +inline void scroll_led_off(void) { gpio_write_pin_low(LED_SCROLL_LOCK_PIN); } diff --git a/keyboards/kbdfans/maja_soldered/maja_soldered.c b/keyboards/kbdfans/maja_soldered/maja_soldered.c index c774027780..41d80e2cc8 100755 --- a/keyboards/kbdfans/maja_soldered/maja_soldered.c +++ b/keyboards/kbdfans/maja_soldered/maja_soldered.c @@ -16,14 +16,14 @@ #include "quantum.h" void matrix_init_kb(void) { - setPinOutput(D4); + gpio_set_pin_output(D4); matrix_init_user(); } bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if(res) { - writePin(D4, !led_state.caps_lock); + gpio_write_pin(D4, !led_state.caps_lock); } return res; } diff --git a/keyboards/kbdfans/niu_mini/niu_mini.c b/keyboards/kbdfans/niu_mini/niu_mini.c index 02b2ca6590..1bde1ba5d0 100644 --- a/keyboards/kbdfans/niu_mini/niu_mini.c +++ b/keyboards/kbdfans/niu_mini/niu_mini.c @@ -12,8 +12,8 @@ const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = { void matrix_init_kb(void) { // Turn status LED on - setPinOutput(E6); - writePinHigh(E6); + gpio_set_pin_output(E6); + gpio_write_pin_high(E6); matrix_init_user(); } diff --git a/keyboards/kbdfans/phaseone/phaseone.c b/keyboards/kbdfans/phaseone/phaseone.c index ded75ac8ed..a44e501109 100644 --- a/keyboards/kbdfans/phaseone/phaseone.c +++ b/keyboards/kbdfans/phaseone/phaseone.c @@ -17,5 +17,5 @@ #include "quantum.h" void keyboard_pre_init_kb(void) { - setPinOutput(D4); + gpio_set_pin_output(D4); } diff --git a/keyboards/kbdmania/kmac/kmac.c b/keyboards/kbdmania/kmac/kmac.c index 29f7091084..c3f06349d8 100644 --- a/keyboards/kbdmania/kmac/kmac.c +++ b/keyboards/kbdmania/kmac/kmac.c @@ -19,11 +19,11 @@ #define WASD_MASK 0b10 void backlight_init_ports(void) { - setPinOutput(B1); - setPinOutput(B2); - setPinOutput(B3); - setPinOutput(B4); - setPinOutput(D7); + gpio_set_pin_output(B1); + gpio_set_pin_output(B2); + gpio_set_pin_output(B3); + gpio_set_pin_output(B4); + gpio_set_pin_output(D7); } /* Backlight pin configuration @@ -36,21 +36,21 @@ void backlight_init_ports(void) { void backlight_set(uint8_t level) { // F-row if (level & F_ROW_MASK) { - writePinHigh(B1); + gpio_write_pin_high(B1); } else { - writePinLow(B1); + gpio_write_pin_low(B1); } // WASD if (level & WASD_MASK) { - writePinLow(B2); - writePinLow(B3); - writePinLow(B4); - writePinLow(D7); + gpio_write_pin_low(B2); + gpio_write_pin_low(B3); + gpio_write_pin_low(B4); + gpio_write_pin_low(D7); } else { - writePinHigh(B2); - writePinHigh(B3); - writePinHigh(B4); - writePinHigh(D7); + gpio_write_pin_high(B2); + gpio_write_pin_high(B3); + gpio_write_pin_high(B4); + gpio_write_pin_high(D7); } } diff --git a/keyboards/kbdmania/kmac/matrix.c b/keyboards/kbdmania/kmac/matrix.c index 1843d19fd2..ea149c49ad 100644 --- a/keyboards/kbdmania/kmac/matrix.c +++ b/keyboards/kbdmania/kmac/matrix.c @@ -94,8 +94,8 @@ void matrix_print(void) { */ static void unselect_cols(void) { for (uint8_t x = 0; x < 6; x++) { - setPinOutput(col_pins[x]); - writePinLow(col_pins[x]); + gpio_set_pin_output(col_pins[x]); + gpio_write_pin_low(col_pins[x]); } } @@ -103,13 +103,13 @@ static void select_col(uint8_t col) { if (col < 16) { uint8_t c = col + 8; - writePin(B6, c & 0b10000); - writePin(C6, c & 0b01000); - writePin(C7, c & 0b00100); - writePin(F1, c & 0b00010); - writePin(F0, c & 0b00001); + gpio_write_pin(B6, c & 0b10000); + gpio_write_pin(C6, c & 0b01000); + gpio_write_pin(C7, c & 0b00100); + gpio_write_pin(F1, c & 0b00010); + gpio_write_pin(F0, c & 0b00001); } else { - writePinHigh(B5); + gpio_write_pin_high(B5); } } @@ -122,10 +122,10 @@ static void select_col(uint8_t col) { static void init_pins(void) { unselect_cols(); for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } - setPinInputHigh(E2); + gpio_set_pin_input_high(E2); } static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) { @@ -143,7 +143,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) // Check row pin state // Use the otherwise unused row: 3, col: 0 for caps lock if (row_index == 3 && current_col == 0) { - if (readPin(E2) == 0) { + if (gpio_read_pin(E2) == 0) { // Pin LO, set col bit current_matrix[row_index] |= (ROW_SHIFTER << current_col); } else { @@ -151,7 +151,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) current_matrix[row_index] &= ~(ROW_SHIFTER << current_col); } } else { - if (readPin(row_pins[row_index]) == 0) { + if (gpio_read_pin(row_pins[row_index]) == 0) { // Pin HI, clear col bit current_matrix[row_index] &= ~(ROW_SHIFTER << current_col); } else { diff --git a/keyboards/kbdmania/kmac_pad/kmac_pad.c b/keyboards/kbdmania/kmac_pad/kmac_pad.c index 3de2cb711e..064502710f 100644 --- a/keyboards/kbdmania/kmac_pad/kmac_pad.c +++ b/keyboards/kbdmania/kmac_pad/kmac_pad.c @@ -23,7 +23,7 @@ void keyboard_pre_init_kb(void) { * FN Pin PB3 * PAD Pin PB1 */ - setPinOutput(B3); - setPinOutput(B1); + gpio_set_pin_output(B3); + gpio_set_pin_output(B1); keyboard_pre_init_user(); } diff --git a/keyboards/kbdmania/kmac_pad/matrix.c b/keyboards/kbdmania/kmac_pad/matrix.c index ad7919e33c..1fe0502311 100644 --- a/keyboards/kbdmania/kmac_pad/matrix.c +++ b/keyboards/kbdmania/kmac_pad/matrix.c @@ -30,13 +30,13 @@ static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; */ static void unselect_cols(void) { for (uint8_t col = 0; col < MATRIX_COLS; col++) { - setPinOutput(col_pins[col]); - writePinLow(col_pins[col]); + gpio_set_pin_output(col_pins[col]); + gpio_write_pin_low(col_pins[col]); } } static void select_col(uint8_t col) { - writePinHigh(col_pins[col]); + gpio_write_pin_high(col_pins[col]); } static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) { @@ -50,7 +50,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) if (current_col == 0) { matrix_row_t last_row_value = current_matrix[0]; - if (readPin(row_pins[0]) == 0) { + if (gpio_read_pin(row_pins[0]) == 0) { // Pin LO, set col bit current_matrix[0] |= (1 << current_col); } else { @@ -68,7 +68,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) for (uint8_t row_index = 1; row_index < MATRIX_ROWS; row_index++) { matrix_row_t last_row_value = current_matrix[row_index]; - if (readPin(row_pins[row_index]) == 0) { + if (gpio_read_pin(row_pins[row_index]) == 0) { // Pin HI, clear col bit current_matrix[row_index] &= ~(1 << current_col); } else { @@ -95,7 +95,7 @@ void matrix_init_custom(void) { // initialize key pins for (uint8_t row_index = 0; row_index < MATRIX_ROWS; row_index++) { - setPinInputHigh(row_pins[row_index]); + gpio_set_pin_input_high(row_pins[row_index]); } } diff --git a/keyboards/kc60/kc60.c b/keyboards/kc60/kc60.c index 22ce217b52..143148a224 100644 --- a/keyboards/kc60/kc60.c +++ b/keyboards/kc60/kc60.c @@ -2,8 +2,8 @@ void led_update_ports(led_t led_state) { if (led_state.caps_lock) { - setPinOutput(B2); + gpio_set_pin_output(B2); } else { - setPinInput(B2); + gpio_set_pin_input(B2); } } diff --git a/keyboards/kc60se/kc60se.c b/keyboards/kc60se/kc60se.c index 660b9201b3..a7d60079b2 100644 --- a/keyboards/kc60se/kc60se.c +++ b/keyboards/kc60se/kc60se.c @@ -17,13 +17,13 @@ #include "quantum.h" void matrix_init_kb(void){ - setPinOutput(B2); + gpio_set_pin_output(B2); } bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if(res) { - writePin(B2, !led_state.caps_lock); + gpio_write_pin(B2, !led_state.caps_lock); } return res; } diff --git a/keyboards/keebio/kbo5000/rev1/rev1.c b/keyboards/keebio/kbo5000/rev1/rev1.c index 45443becbe..8aa227deba 100644 --- a/keyboards/keebio/kbo5000/rev1/rev1.c +++ b/keyboards/keebio/kbo5000/rev1/rev1.c @@ -2,14 +2,14 @@ #include "split_util.h" void matrix_init_kb(void) { - setPinOutput(CAPS_LOCK_LED_PIN); + gpio_set_pin_output(CAPS_LOCK_LED_PIN); matrix_init_user(); } bool led_update_kb(led_t led_state) { // Only update if left half if (isLeftHand && led_update_user(led_state)) { - writePin(CAPS_LOCK_LED_PIN, !led_state.caps_lock); + gpio_write_pin(CAPS_LOCK_LED_PIN, !led_state.caps_lock); } return true; } diff --git a/keyboards/keebio/quefrency/rev2/rev2.c b/keyboards/keebio/quefrency/rev2/rev2.c index a3bc2ca1ef..f0320597f7 100644 --- a/keyboards/keebio/quefrency/rev2/rev2.c +++ b/keyboards/keebio/quefrency/rev2/rev2.c @@ -2,14 +2,14 @@ #include "split_util.h" void matrix_init_kb(void) { - setPinOutput(CAPS_LOCK_LED_PIN); + gpio_set_pin_output(CAPS_LOCK_LED_PIN); matrix_init_user(); } bool led_update_kb(led_t led_state) { // Only update if left half if (isLeftHand && led_update_user(led_state)) { - writePin(CAPS_LOCK_LED_PIN, !led_state.caps_lock); + gpio_write_pin(CAPS_LOCK_LED_PIN, !led_state.caps_lock); } return true; } diff --git a/keyboards/keebio/quefrency/rev3/rev3.c b/keyboards/keebio/quefrency/rev3/rev3.c index d3ada3076f..74d68723f5 100644 --- a/keyboards/keebio/quefrency/rev3/rev3.c +++ b/keyboards/keebio/quefrency/rev3/rev3.c @@ -18,14 +18,14 @@ along with this program. If not, see . #include "split_util.h" void matrix_init_kb(void) { - setPinOutput(CAPS_LOCK_LED_PIN); + gpio_set_pin_output(CAPS_LOCK_LED_PIN); matrix_init_user(); } bool led_update_kb(led_t led_state) { // Only update if left half if (led_update_user(led_state) && isLeftHand) { - writePin(CAPS_LOCK_LED_PIN, !led_state.caps_lock); + gpio_write_pin(CAPS_LOCK_LED_PIN, !led_state.caps_lock); } return true; } diff --git a/keyboards/keebio/sinc/sinc.c b/keyboards/keebio/sinc/sinc.c index d50eb82019..c1ebd1a206 100644 --- a/keyboards/keebio/sinc/sinc.c +++ b/keyboards/keebio/sinc/sinc.c @@ -22,7 +22,7 @@ bool led_update_kb(led_t led_state) { if (!led_update_user(led_state)) { return false; } // Only update if left half if (isLeftHand && led_update_user(led_state)) { - writePin(LED_CAPS_LOCK_PIN, !led_state.caps_lock); + gpio_write_pin(LED_CAPS_LOCK_PIN, !led_state.caps_lock); } return true; } diff --git a/keyboards/keychron/c2_pro/matrix.c b/keyboards/keychron/c2_pro/matrix.c index 8c954c73d0..7d5b3e4e79 100644 --- a/keyboards/keychron/c2_pro/matrix.c +++ b/keyboards/keychron/c2_pro/matrix.c @@ -43,27 +43,27 @@ pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; static inline void setPinOutput_writeLow(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinLow(pin); + gpio_set_pin_output(pin); + gpio_write_pin_low(pin); } } static inline void setPinOutput_writeHigh(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinHigh(pin); + gpio_set_pin_output(pin); + gpio_write_pin_high(pin); } } static inline void setPinInput_high(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinInputHigh(pin); + gpio_set_pin_input_high(pin); } } static inline uint8_t readMatrixPin(pin_t pin) { if (pin != NO_PIN) { - return readPin(pin); + return gpio_read_pin(pin); } else { return 1; } @@ -81,13 +81,13 @@ static void HC595_output(SIZE_T data, uint8_t bit) { ATOMIC_BLOCK_FORCEON { for (uint8_t i = 0; i < (SHIFT_COL_END - SHIFT_COL_START + 1); i++) { if (data & 0x1) { - writePinHigh(HC595_DS); + gpio_write_pin_high(HC595_DS); } else { - writePinLow(HC595_DS); + gpio_write_pin_low(HC595_DS); } - writePinHigh(HC595_SHCP); + gpio_write_pin_high(HC595_SHCP); HC595_delay(n); - writePinLow(HC595_SHCP); + gpio_write_pin_low(HC595_SHCP); HC595_delay(n); if (bit) { break; @@ -95,9 +95,9 @@ static void HC595_output(SIZE_T data, uint8_t bit) { data = data >> 1; } } - writePinHigh(HC595_STCP); + gpio_write_pin_high(HC595_STCP); HC595_delay(n); - writePinLow(HC595_STCP); + gpio_write_pin_low(HC595_STCP); HC595_delay(n); } } @@ -175,9 +175,9 @@ static void matrix_read_rows_on_col(matrix_row_t current_matrix[], uint8_t curre } void matrix_init_custom(void) { - setPinOutput(HC595_DS); - setPinOutput(HC595_STCP); - setPinOutput(HC595_SHCP); + gpio_set_pin_output(HC595_DS); + gpio_set_pin_output(HC595_STCP); + gpio_set_pin_output(HC595_SHCP); for (uint8_t x = 0; x < MATRIX_ROWS; x++) { if (row_pins[x] != NO_PIN) { diff --git a/keyboards/keychron/q10/matrix.c b/keyboards/keychron/q10/matrix.c index 2c2d2ccc37..b772fd7889 100644 --- a/keyboards/keychron/q10/matrix.c +++ b/keyboards/keychron/q10/matrix.c @@ -36,27 +36,27 @@ static pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; static inline void setPinOutput_writeLow(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinLow(pin); + gpio_set_pin_output(pin); + gpio_write_pin_low(pin); } } static inline void setPinOutput_writeHigh(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinHigh(pin); + gpio_set_pin_output(pin); + gpio_write_pin_high(pin); } } static inline void setPinInputHigh_atomic(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinInputHigh(pin); + gpio_set_pin_input_high(pin); } } static inline uint8_t readMatrixPin(pin_t pin) { if (pin != NO_PIN) { - return readPin(pin); + return gpio_read_pin(pin); } else { return 1; } diff --git a/keyboards/keychron/q11/q11.c b/keyboards/keychron/q11/q11.c index f643113ea3..8d018e2a63 100755 --- a/keyboards/keychron/q11/q11.c +++ b/keyboards/keychron/q11/q11.c @@ -130,12 +130,12 @@ void keyboard_post_init_kb(void) { // and disable USB connectivity when the ADC value exceeds 1000, // to avoid affecting the serial usart communication between the left hand and the right hand. if (is_keyboard_left()) { - setPinOutput(A0); - writePinHigh(A0); + gpio_set_pin_output(A0); + gpio_write_pin_high(A0); } else { if ((analogReadPin_my(B0) > 1000) || (analogReadPin_my(B1) > 1000)) { - setPinInput(A11); - setPinInput(A12); + gpio_set_pin_input(A11); + gpio_set_pin_input(A12); } } diff --git a/keyboards/keychron/q12/matrix.c b/keyboards/keychron/q12/matrix.c index cf8361bd23..9d5e9c4d39 100644 --- a/keyboards/keychron/q12/matrix.c +++ b/keyboards/keychron/q12/matrix.c @@ -36,27 +36,27 @@ static pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; static inline void setPinOutput_writeLow(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinLow(pin); + gpio_set_pin_output(pin); + gpio_write_pin_low(pin); } } static inline void setPinOutput_writeHigh(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinHigh(pin); + gpio_set_pin_output(pin); + gpio_write_pin_high(pin); } } static inline void setPinInputHigh_atomic(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinInputHigh(pin); + gpio_set_pin_input_high(pin); } } static inline uint8_t readMatrixPin(pin_t pin) { if (pin != NO_PIN) { - return readPin(pin); + return gpio_read_pin(pin); } else { return 1; } diff --git a/keyboards/keychron/q1v2/matrix.c b/keyboards/keychron/q1v2/matrix.c index 2bdf4bdec7..8e01bdb73e 100644 --- a/keyboards/keychron/q1v2/matrix.c +++ b/keyboards/keychron/q1v2/matrix.c @@ -36,27 +36,27 @@ static pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; static inline void setPinOutput_writeLow(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinLow(pin); + gpio_set_pin_output(pin); + gpio_write_pin_low(pin); } } static inline void setPinOutput_writeHigh(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinHigh(pin); + gpio_set_pin_output(pin); + gpio_write_pin_high(pin); } } static inline void setPinInputHigh_atomic(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinInputHigh(pin); + gpio_set_pin_input_high(pin); } } static inline uint8_t readMatrixPin(pin_t pin) { if (pin != NO_PIN) { - return readPin(pin); + return gpio_read_pin(pin); } else { return 1; } diff --git a/keyboards/keychron/q3/matrix.c b/keyboards/keychron/q3/matrix.c index 188156789b..25b3f6ed4e 100644 --- a/keyboards/keychron/q3/matrix.c +++ b/keyboards/keychron/q3/matrix.c @@ -36,27 +36,27 @@ static pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; static inline void setPinOutput_writeLow(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinLow(pin); + gpio_set_pin_output(pin); + gpio_write_pin_low(pin); } } static inline void setPinOutput_writeHigh(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinHigh(pin); + gpio_set_pin_output(pin); + gpio_write_pin_high(pin); } } static inline void setPinInputHigh_atomic(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinInputHigh(pin); + gpio_set_pin_input_high(pin); } } static inline uint8_t readMatrixPin(pin_t pin) { if (pin != NO_PIN) { - return readPin(pin); + return gpio_read_pin(pin); } else { return 1; } diff --git a/keyboards/keychron/q5/matrix.c b/keyboards/keychron/q5/matrix.c index 4809b20677..e7f69d9821 100644 --- a/keyboards/keychron/q5/matrix.c +++ b/keyboards/keychron/q5/matrix.c @@ -36,27 +36,27 @@ static pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; static inline void setPinOutput_writeLow(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinLow(pin); + gpio_set_pin_output(pin); + gpio_write_pin_low(pin); } } static inline void setPinOutput_writeHigh(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinHigh(pin); + gpio_set_pin_output(pin); + gpio_write_pin_high(pin); } } static inline void setPinInputHigh_atomic(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinInputHigh(pin); + gpio_set_pin_input_high(pin); } } static inline uint8_t readMatrixPin(pin_t pin) { if (pin != NO_PIN) { - return readPin(pin); + return gpio_read_pin(pin); } else { return 1; } diff --git a/keyboards/keychron/q6/matrix.c b/keyboards/keychron/q6/matrix.c index c59b229cfa..95e00405b4 100644 --- a/keyboards/keychron/q6/matrix.c +++ b/keyboards/keychron/q6/matrix.c @@ -48,27 +48,27 @@ static pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; static inline void setPinOutput_writeLow(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinLow(pin); + gpio_set_pin_output(pin); + gpio_write_pin_low(pin); } } static inline void setPinOutput_writeHigh(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinHigh(pin); + gpio_set_pin_output(pin); + gpio_write_pin_high(pin); } } static inline void setPinInputHigh_atomic(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinInputHigh(pin); + gpio_set_pin_input_high(pin); } } static inline uint8_t readMatrixPin(pin_t pin) { if (pin != NO_PIN) { - return readPin(pin); + return gpio_read_pin(pin); } else { return 1; } diff --git a/keyboards/keychron/q65/matrix.c b/keyboards/keychron/q65/matrix.c index 206e301226..c9f9888689 100644 --- a/keyboards/keychron/q65/matrix.c +++ b/keyboards/keychron/q65/matrix.c @@ -36,32 +36,32 @@ static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; static inline void writePinLow_atomic(pin_t pin) { ATOMIC_BLOCK_FORCEON { - writePinLow(pin); + gpio_write_pin_low(pin); } } static inline void writePinHigh_atomic(pin_t pin) { ATOMIC_BLOCK_FORCEON { - writePinHigh(pin); + gpio_write_pin_high(pin); } } static inline void setPinOutput_writeLow(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinLow(pin); + gpio_set_pin_output(pin); + gpio_write_pin_low(pin); } } static inline void setPinInputHigh_atomic(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinInputHigh(pin); + gpio_set_pin_input_high(pin); } } static inline uint8_t readMatrixPin(pin_t pin) { if (pin != NO_PIN) { - return readPin(pin); + return gpio_read_pin(pin); } else { return 1; } @@ -76,20 +76,20 @@ static void shiftOut(uint8_t dataOut) { for (uint8_t i = 0; i < 8; i++) { compiler_barrier(); if (dataOut & 0x1) { - writePinHigh(DATA_PIN); + gpio_write_pin_high(DATA_PIN); } else { - writePinLow(DATA_PIN); + gpio_write_pin_low(DATA_PIN); } dataOut = dataOut >> 1; compiler_barrier(); - writePinHigh(CLOCK_PIN); + gpio_write_pin_high(CLOCK_PIN); small_delay(); - writePinLow(CLOCK_PIN); + gpio_write_pin_low(CLOCK_PIN); } compiler_barrier(); - writePinHigh(LATCH_PIN); + gpio_write_pin_high(LATCH_PIN); small_delay(); - writePinLow(LATCH_PIN); + gpio_write_pin_low(LATCH_PIN); compiler_barrier(); } } @@ -98,18 +98,18 @@ static void shiftout_single(uint8_t data) { ATOMIC_BLOCK_FORCEON { compiler_barrier(); if (data & 0x1) { - writePinHigh(DATA_PIN); + gpio_write_pin_high(DATA_PIN); } else { - writePinLow(DATA_PIN); + gpio_write_pin_low(DATA_PIN); } compiler_barrier(); - writePinHigh(CLOCK_PIN); + gpio_write_pin_high(CLOCK_PIN); small_delay(); - writePinLow(CLOCK_PIN); + gpio_write_pin_low(CLOCK_PIN); compiler_barrier(); - writePinHigh(LATCH_PIN); + gpio_write_pin_high(LATCH_PIN); small_delay(); - writePinLow(LATCH_PIN); + gpio_write_pin_low(LATCH_PIN); compiler_barrier(); } } @@ -165,13 +165,13 @@ static void unselect_cols(void) { } static void matrix_init_pins(void) { - setPinOutput(DATA_PIN); - setPinOutput(CLOCK_PIN); - setPinOutput(LATCH_PIN); + gpio_set_pin_output(DATA_PIN); + gpio_set_pin_output(CLOCK_PIN); + gpio_set_pin_output(LATCH_PIN); #ifdef MATRIX_UNSELECT_DRIVE_HIGH for (uint8_t x = 0; x < MATRIX_COLS; x++) { if (col_pins[x] != NO_PIN) { - setPinOutput(col_pins[x]); + gpio_set_pin_output(col_pins[x]); } } #endif diff --git a/keyboards/keychron/v1/matrix.c b/keyboards/keychron/v1/matrix.c index 7b9136d490..32d9cfdbb0 100644 --- a/keyboards/keychron/v1/matrix.c +++ b/keyboards/keychron/v1/matrix.c @@ -36,27 +36,27 @@ static pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; static inline void setPinOutput_writeLow(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinLow(pin); + gpio_set_pin_output(pin); + gpio_write_pin_low(pin); } } static inline void setPinOutput_writeHigh(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinHigh(pin); + gpio_set_pin_output(pin); + gpio_write_pin_high(pin); } } static inline void setPinInputHigh_atomic(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinInputHigh(pin); + gpio_set_pin_input_high(pin); } } static inline uint8_t readMatrixPin(pin_t pin) { if (pin != NO_PIN) { - return readPin(pin); + return gpio_read_pin(pin); } else { return 1; } @@ -71,20 +71,20 @@ static void shiftOut(uint8_t dataOut) { for (uint8_t i = 0; i < 8; i++) { compiler_barrier(); if (dataOut & 0x1) { - writePinHigh(DATA_PIN); + gpio_write_pin_high(DATA_PIN); } else { - writePinLow(DATA_PIN); + gpio_write_pin_low(DATA_PIN); } dataOut = dataOut >> 1; compiler_barrier(); - writePinHigh(CLOCK_PIN); + gpio_write_pin_high(CLOCK_PIN); small_delay(); - writePinLow(CLOCK_PIN); + gpio_write_pin_low(CLOCK_PIN); } compiler_barrier(); - writePinHigh(LATCH_PIN); + gpio_write_pin_high(LATCH_PIN); small_delay(); - writePinLow(LATCH_PIN); + gpio_write_pin_low(LATCH_PIN); compiler_barrier(); } } @@ -93,18 +93,18 @@ static void shiftOut_single(uint8_t data) { ATOMIC_BLOCK_FORCEON { compiler_barrier(); if (data & 0x1) { - writePinHigh(DATA_PIN); + gpio_write_pin_high(DATA_PIN); } else { - writePinLow(DATA_PIN); + gpio_write_pin_low(DATA_PIN); } compiler_barrier(); - writePinHigh(CLOCK_PIN); + gpio_write_pin_high(CLOCK_PIN); small_delay(); - writePinLow(CLOCK_PIN); + gpio_write_pin_low(CLOCK_PIN); compiler_barrier(); - writePinHigh(LATCH_PIN); + gpio_write_pin_high(LATCH_PIN); small_delay(); - writePinLow(LATCH_PIN); + gpio_write_pin_low(LATCH_PIN); compiler_barrier(); } } @@ -156,13 +156,13 @@ static void unselect_cols(void) { } static void matrix_init_pins(void) { - setPinOutput(DATA_PIN); - setPinOutput(CLOCK_PIN); - setPinOutput(LATCH_PIN); + gpio_set_pin_output(DATA_PIN); + gpio_set_pin_output(CLOCK_PIN); + gpio_set_pin_output(LATCH_PIN); #ifdef MATRIX_UNSELECT_DRIVE_HIGH for (uint8_t x = 0; x < MATRIX_COLS; x++) { if (col_pins[x] != NO_PIN) { - setPinOutput(col_pins[x]); + gpio_set_pin_output(col_pins[x]); } } #endif diff --git a/keyboards/keychron/v10/matrix.c b/keyboards/keychron/v10/matrix.c index 87cda1774a..bb6504fa78 100644 --- a/keyboards/keychron/v10/matrix.c +++ b/keyboards/keychron/v10/matrix.c @@ -36,27 +36,27 @@ static pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; static inline void setPinOutput_writeLow(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinLow(pin); + gpio_set_pin_output(pin); + gpio_write_pin_low(pin); } } static inline void setPinOutput_writeHigh(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinHigh(pin); + gpio_set_pin_output(pin); + gpio_write_pin_high(pin); } } static inline void setPinInputHigh_atomic(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinInputHigh(pin); + gpio_set_pin_input_high(pin); } } static inline uint8_t readMatrixPin(pin_t pin) { if (pin != NO_PIN) { - return readPin(pin); + return gpio_read_pin(pin); } else { return 1; } @@ -70,34 +70,34 @@ static void shiftOut(uint16_t dataOut) { ATOMIC_BLOCK_FORCEON { for (uint8_t i = 0; i < PIN_USED_74HC595; i++) { if (dataOut & 0x1) { - writePinHigh(DATA_PIN_74HC595); + gpio_write_pin_high(DATA_PIN_74HC595); } else { - writePinLow(DATA_PIN_74HC595); + gpio_write_pin_low(DATA_PIN_74HC595); } dataOut = dataOut >> 1; - writePinHigh(CLOCK_PIN_74HC595); + gpio_write_pin_high(CLOCK_PIN_74HC595); small_delay(2); - writePinLow(CLOCK_PIN_74HC595); + gpio_write_pin_low(CLOCK_PIN_74HC595); } - writePinHigh(LATCH_PIN_74HC595); + gpio_write_pin_high(LATCH_PIN_74HC595); small_delay(2); - writePinLow(LATCH_PIN_74HC595); + gpio_write_pin_low(LATCH_PIN_74HC595); } } static void shiftOut_single(uint8_t data) { ATOMIC_BLOCK_FORCEON { if (data & 0x1) { - writePinHigh(DATA_PIN_74HC595); + gpio_write_pin_high(DATA_PIN_74HC595); } else { - writePinLow(DATA_PIN_74HC595); + gpio_write_pin_low(DATA_PIN_74HC595); } - writePinHigh(CLOCK_PIN_74HC595); + gpio_write_pin_high(CLOCK_PIN_74HC595); small_delay(2); - writePinLow(CLOCK_PIN_74HC595); - writePinHigh(LATCH_PIN_74HC595); + gpio_write_pin_low(CLOCK_PIN_74HC595); + gpio_write_pin_high(LATCH_PIN_74HC595); small_delay(2); - writePinLow(LATCH_PIN_74HC595); + gpio_write_pin_low(LATCH_PIN_74HC595); } } @@ -149,13 +149,13 @@ static void unselect_cols(void) { } static void matrix_init_pins(void) { - setPinOutput(DATA_PIN_74HC595); - setPinOutput(CLOCK_PIN_74HC595); - setPinOutput(LATCH_PIN_74HC595); + gpio_set_pin_output(DATA_PIN_74HC595); + gpio_set_pin_output(CLOCK_PIN_74HC595); + gpio_set_pin_output(LATCH_PIN_74HC595); #ifdef MATRIX_UNSELECT_DRIVE_HIGH for (uint8_t x = 0; x < MATRIX_COLS; x++) { if (col_pins[x] != NO_PIN) { - setPinOutput(col_pins[x]); + gpio_set_pin_output(col_pins[x]); } } #endif diff --git a/keyboards/keychron/v3/matrix.c b/keyboards/keychron/v3/matrix.c index c0c39d5b5f..5ee860afd2 100644 --- a/keyboards/keychron/v3/matrix.c +++ b/keyboards/keychron/v3/matrix.c @@ -36,27 +36,27 @@ static pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; static inline void setPinOutput_writeLow(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinLow(pin); + gpio_set_pin_output(pin); + gpio_write_pin_low(pin); } } static inline void setPinOutput_writeHigh(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinHigh(pin); + gpio_set_pin_output(pin); + gpio_write_pin_high(pin); } } static inline void setPinInputHigh_atomic(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinInputHigh(pin); + gpio_set_pin_input_high(pin); } } static inline uint8_t readMatrixPin(pin_t pin) { if (pin != NO_PIN) { - return readPin(pin); + return gpio_read_pin(pin); } else { return 1; } @@ -71,20 +71,20 @@ static void shiftOut(uint8_t dataOut) { for (uint8_t i = 0; i < 8; i++) { compiler_barrier(); if (dataOut & 0x1) { - writePinHigh(DATA_PIN); + gpio_write_pin_high(DATA_PIN); } else { - writePinLow(DATA_PIN); + gpio_write_pin_low(DATA_PIN); } dataOut = dataOut >> 1; compiler_barrier(); - writePinHigh(CLOCK_PIN); + gpio_write_pin_high(CLOCK_PIN); small_delay(); - writePinLow(CLOCK_PIN); + gpio_write_pin_low(CLOCK_PIN); } compiler_barrier(); - writePinHigh(LATCH_PIN); + gpio_write_pin_high(LATCH_PIN); small_delay(); - writePinLow(LATCH_PIN); + gpio_write_pin_low(LATCH_PIN); compiler_barrier(); } } @@ -93,18 +93,18 @@ static void shiftOut_single(uint8_t data) { ATOMIC_BLOCK_FORCEON { compiler_barrier(); if (data & 0x1) { - writePinHigh(DATA_PIN); + gpio_write_pin_high(DATA_PIN); } else { - writePinLow(DATA_PIN); + gpio_write_pin_low(DATA_PIN); } compiler_barrier(); - writePinHigh(CLOCK_PIN); + gpio_write_pin_high(CLOCK_PIN); small_delay(); - writePinLow(CLOCK_PIN); + gpio_write_pin_low(CLOCK_PIN); compiler_barrier(); - writePinHigh(LATCH_PIN); + gpio_write_pin_high(LATCH_PIN); small_delay(); - writePinLow(LATCH_PIN); + gpio_write_pin_low(LATCH_PIN); compiler_barrier(); } } @@ -156,13 +156,13 @@ static void unselect_cols(void) { } static void matrix_init_pins(void) { - setPinOutput(DATA_PIN); - setPinOutput(CLOCK_PIN); - setPinOutput(LATCH_PIN); + gpio_set_pin_output(DATA_PIN); + gpio_set_pin_output(CLOCK_PIN); + gpio_set_pin_output(LATCH_PIN); #ifdef MATRIX_UNSELECT_DRIVE_HIGH for (uint8_t x = 0; x < MATRIX_COLS; x++) { if (col_pins[x] != NO_PIN) { - setPinOutput(col_pins[x]); + gpio_set_pin_output(col_pins[x]); } } #endif diff --git a/keyboards/keychron/v5/matrix.c b/keyboards/keychron/v5/matrix.c index fc3a1c4c2c..255201af12 100644 --- a/keyboards/keychron/v5/matrix.c +++ b/keyboards/keychron/v5/matrix.c @@ -36,27 +36,27 @@ static pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; static inline void setPinOutput_writeLow(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinLow(pin); + gpio_set_pin_output(pin); + gpio_write_pin_low(pin); } } static inline void setPinOutput_writeHigh(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinHigh(pin); + gpio_set_pin_output(pin); + gpio_write_pin_high(pin); } } static inline void setPinInputHigh_atomic(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinInputHigh(pin); + gpio_set_pin_input_high(pin); } } static inline uint8_t readMatrixPin(pin_t pin) { if (pin != NO_PIN) { - return readPin(pin); + return gpio_read_pin(pin); } else { return 1; } @@ -71,20 +71,20 @@ static void shiftOut(uint8_t dataOut) { for (uint8_t i = 0; i < 8; i++) { compiler_barrier(); if (dataOut & 0x1) { - writePinHigh(DATA_PIN); + gpio_write_pin_high(DATA_PIN); } else { - writePinLow(DATA_PIN); + gpio_write_pin_low(DATA_PIN); } dataOut = dataOut >> 1; compiler_barrier(); - writePinHigh(CLOCK_PIN); + gpio_write_pin_high(CLOCK_PIN); small_delay(); - writePinLow(CLOCK_PIN); + gpio_write_pin_low(CLOCK_PIN); } compiler_barrier(); - writePinHigh(LATCH_PIN); + gpio_write_pin_high(LATCH_PIN); small_delay(); - writePinLow(LATCH_PIN); + gpio_write_pin_low(LATCH_PIN); compiler_barrier(); } } @@ -93,18 +93,18 @@ static void shiftOut_single(uint8_t data) { ATOMIC_BLOCK_FORCEON { compiler_barrier(); if (data & 0x1) { - writePinHigh(DATA_PIN); + gpio_write_pin_high(DATA_PIN); } else { - writePinLow(DATA_PIN); + gpio_write_pin_low(DATA_PIN); } compiler_barrier(); - writePinHigh(CLOCK_PIN); + gpio_write_pin_high(CLOCK_PIN); small_delay(); - writePinLow(CLOCK_PIN); + gpio_write_pin_low(CLOCK_PIN); compiler_barrier(); - writePinHigh(LATCH_PIN); + gpio_write_pin_high(LATCH_PIN); small_delay(); - writePinLow(LATCH_PIN); + gpio_write_pin_low(LATCH_PIN); compiler_barrier(); } } @@ -156,13 +156,13 @@ static void unselect_cols(void) { } static void matrix_init_pins(void) { - setPinOutput(DATA_PIN); - setPinOutput(CLOCK_PIN); - setPinOutput(LATCH_PIN); + gpio_set_pin_output(DATA_PIN); + gpio_set_pin_output(CLOCK_PIN); + gpio_set_pin_output(LATCH_PIN); #ifdef MATRIX_UNSELECT_DRIVE_HIGH for (uint8_t x = 0; x < MATRIX_COLS; x++) { if (col_pins[x] != NO_PIN) { - setPinOutput(col_pins[x]); + gpio_set_pin_output(col_pins[x]); } } #endif diff --git a/keyboards/keychron/v6/matrix.c b/keyboards/keychron/v6/matrix.c index 87cda1774a..bb6504fa78 100644 --- a/keyboards/keychron/v6/matrix.c +++ b/keyboards/keychron/v6/matrix.c @@ -36,27 +36,27 @@ static pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; static inline void setPinOutput_writeLow(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinLow(pin); + gpio_set_pin_output(pin); + gpio_write_pin_low(pin); } } static inline void setPinOutput_writeHigh(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinHigh(pin); + gpio_set_pin_output(pin); + gpio_write_pin_high(pin); } } static inline void setPinInputHigh_atomic(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinInputHigh(pin); + gpio_set_pin_input_high(pin); } } static inline uint8_t readMatrixPin(pin_t pin) { if (pin != NO_PIN) { - return readPin(pin); + return gpio_read_pin(pin); } else { return 1; } @@ -70,34 +70,34 @@ static void shiftOut(uint16_t dataOut) { ATOMIC_BLOCK_FORCEON { for (uint8_t i = 0; i < PIN_USED_74HC595; i++) { if (dataOut & 0x1) { - writePinHigh(DATA_PIN_74HC595); + gpio_write_pin_high(DATA_PIN_74HC595); } else { - writePinLow(DATA_PIN_74HC595); + gpio_write_pin_low(DATA_PIN_74HC595); } dataOut = dataOut >> 1; - writePinHigh(CLOCK_PIN_74HC595); + gpio_write_pin_high(CLOCK_PIN_74HC595); small_delay(2); - writePinLow(CLOCK_PIN_74HC595); + gpio_write_pin_low(CLOCK_PIN_74HC595); } - writePinHigh(LATCH_PIN_74HC595); + gpio_write_pin_high(LATCH_PIN_74HC595); small_delay(2); - writePinLow(LATCH_PIN_74HC595); + gpio_write_pin_low(LATCH_PIN_74HC595); } } static void shiftOut_single(uint8_t data) { ATOMIC_BLOCK_FORCEON { if (data & 0x1) { - writePinHigh(DATA_PIN_74HC595); + gpio_write_pin_high(DATA_PIN_74HC595); } else { - writePinLow(DATA_PIN_74HC595); + gpio_write_pin_low(DATA_PIN_74HC595); } - writePinHigh(CLOCK_PIN_74HC595); + gpio_write_pin_high(CLOCK_PIN_74HC595); small_delay(2); - writePinLow(CLOCK_PIN_74HC595); - writePinHigh(LATCH_PIN_74HC595); + gpio_write_pin_low(CLOCK_PIN_74HC595); + gpio_write_pin_high(LATCH_PIN_74HC595); small_delay(2); - writePinLow(LATCH_PIN_74HC595); + gpio_write_pin_low(LATCH_PIN_74HC595); } } @@ -149,13 +149,13 @@ static void unselect_cols(void) { } static void matrix_init_pins(void) { - setPinOutput(DATA_PIN_74HC595); - setPinOutput(CLOCK_PIN_74HC595); - setPinOutput(LATCH_PIN_74HC595); + gpio_set_pin_output(DATA_PIN_74HC595); + gpio_set_pin_output(CLOCK_PIN_74HC595); + gpio_set_pin_output(LATCH_PIN_74HC595); #ifdef MATRIX_UNSELECT_DRIVE_HIGH for (uint8_t x = 0; x < MATRIX_COLS; x++) { if (col_pins[x] != NO_PIN) { - setPinOutput(col_pins[x]); + gpio_set_pin_output(col_pins[x]); } } #endif diff --git a/keyboards/keyhive/honeycomb/honeycomb.c b/keyboards/keyhive/honeycomb/honeycomb.c index 6acc649e0d..b890ee08bf 100755 --- a/keyboards/keyhive/honeycomb/honeycomb.c +++ b/keyboards/keyhive/honeycomb/honeycomb.c @@ -60,12 +60,12 @@ bool pointing_device_task(void){ } void led_init(void) { - setPinOutput(D1); - writePinHigh(D1); - setPinOutput(F4); - writePinHigh(F4); - setPinOutput(F5); - writePinHigh(F5); + gpio_set_pin_output(D1); + gpio_write_pin_high(D1); + gpio_set_pin_output(F4); + gpio_write_pin_high(F4); + gpio_set_pin_output(F5); + gpio_write_pin_high(F5); } void matrix_init_kb(void) { diff --git a/keyboards/keyhive/honeycomb/honeycomb.h b/keyboards/keyhive/honeycomb/honeycomb.h index 0418dee767..3551e4a3af 100755 --- a/keyboards/keyhive/honeycomb/honeycomb.h +++ b/keyboards/keyhive/honeycomb/honeycomb.h @@ -2,12 +2,12 @@ #include "quantum.h" -#define RED_LED_OFF() writePinHigh(F6) -#define RED_LED_ON() writePinLow(F6) -#define BLU_LED_OFF() writePinHigh(F5) -#define BLU_LED_ON() writePinLow(F5) -#define GRN_LED_OFF() writePinHigh(D1) -#define GRN_LED_ON() writePinLow(D1) +#define RED_LED_OFF() gpio_write_pin_high(F6) +#define RED_LED_ON() gpio_write_pin_low(F6) +#define BLU_LED_OFF() gpio_write_pin_high(F5) +#define BLU_LED_ON() gpio_write_pin_low(F5) +#define GRN_LED_OFF() gpio_write_pin_high(D1) +#define GRN_LED_ON() gpio_write_pin_low(D1) #define SET_LED_OFF (RED_LED_OFF(); GRN_LED_OFF(); BLU_LED_OFF(); ) #define SET_LED_RED (RED_LED_ON(); GRN_LED_OFF(); BLU_LED_OFF(); ) diff --git a/keyboards/keyhive/lattice60/lattice60.c b/keyboards/keyhive/lattice60/lattice60.c index 7a5450a678..ab5f1880d5 100644 --- a/keyboards/keyhive/lattice60/lattice60.c +++ b/keyboards/keyhive/lattice60/lattice60.c @@ -21,8 +21,8 @@ void keyboard_pre_init_kb(void){ //init the LED pins as outputs - setPinOutput(LED1_PIN); - setPinOutput(LED2_PIN); + gpio_set_pin_output(LED1_PIN); + gpio_set_pin_output(LED2_PIN); //call any user initialization code keyboard_pre_init_user(); } @@ -31,7 +31,7 @@ bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if(res){ //write the CAPS LOCK state on LED1 - writePin(LED1_PIN, led_state.caps_lock); + gpio_write_pin(LED1_PIN, led_state.caps_lock); } return res; } diff --git a/keyboards/keyhive/navi10/rev0/rev0.c b/keyboards/keyhive/navi10/rev0/rev0.c index 1eefa5cd91..d8c0e81348 100644 --- a/keyboards/keyhive/navi10/rev0/rev0.c +++ b/keyboards/keyhive/navi10/rev0/rev0.c @@ -20,9 +20,9 @@ void matrix_init_kb(void) { // runs once when the firmware starts up //set the indicator LED pin to Output - setPinOutput(B5); + gpio_set_pin_output(B5); //set HIGH for off. - writePinHigh(B5); + gpio_write_pin_high(B5); //call any user functions matrix_init_user(); diff --git a/keyboards/keyhive/navi10/rev2/rev2.c b/keyboards/keyhive/navi10/rev2/rev2.c index 1eefa5cd91..d8c0e81348 100644 --- a/keyboards/keyhive/navi10/rev2/rev2.c +++ b/keyboards/keyhive/navi10/rev2/rev2.c @@ -20,9 +20,9 @@ void matrix_init_kb(void) { // runs once when the firmware starts up //set the indicator LED pin to Output - setPinOutput(B5); + gpio_set_pin_output(B5); //set HIGH for off. - writePinHigh(B5); + gpio_write_pin_high(B5); //call any user functions matrix_init_user(); diff --git a/keyboards/keyhive/navi10/rev3/rev3.c b/keyboards/keyhive/navi10/rev3/rev3.c index 1eefa5cd91..d8c0e81348 100644 --- a/keyboards/keyhive/navi10/rev3/rev3.c +++ b/keyboards/keyhive/navi10/rev3/rev3.c @@ -20,9 +20,9 @@ void matrix_init_kb(void) { // runs once when the firmware starts up //set the indicator LED pin to Output - setPinOutput(B5); + gpio_set_pin_output(B5); //set HIGH for off. - writePinHigh(B5); + gpio_write_pin_high(B5); //call any user functions matrix_init_user(); diff --git a/keyboards/kin80/blackpill103/blackpill103.c b/keyboards/kin80/blackpill103/blackpill103.c index e06ad44748..b532a72869 100644 --- a/keyboards/kin80/blackpill103/blackpill103.c +++ b/keyboards/kin80/blackpill103/blackpill103.c @@ -18,8 +18,8 @@ void matrix_init_kb(void) { /* LED pins setup */ - setPinOutput(LED4_PIN); - writePinLow(LED4_PIN); + gpio_set_pin_output(LED4_PIN); + gpio_write_pin_low(LED4_PIN); matrix_init_user(); } diff --git a/keyboards/kin80/blackpill401/blackpill401.c b/keyboards/kin80/blackpill401/blackpill401.c index e06ad44748..b532a72869 100644 --- a/keyboards/kin80/blackpill401/blackpill401.c +++ b/keyboards/kin80/blackpill401/blackpill401.c @@ -18,8 +18,8 @@ void matrix_init_kb(void) { /* LED pins setup */ - setPinOutput(LED4_PIN); - writePinLow(LED4_PIN); + gpio_set_pin_output(LED4_PIN); + gpio_write_pin_low(LED4_PIN); matrix_init_user(); } diff --git a/keyboards/kin80/blackpill411/blackpill411.c b/keyboards/kin80/blackpill411/blackpill411.c index 012a434e41..21e4b91705 100644 --- a/keyboards/kin80/blackpill411/blackpill411.c +++ b/keyboards/kin80/blackpill411/blackpill411.c @@ -18,8 +18,8 @@ void matrix_init_kb(void) { /* LED pins setup */ - setPinOutput(LED4_PIN); - writePinLow(LED4_PIN); + gpio_set_pin_output(LED4_PIN); + gpio_write_pin_low(LED4_PIN); matrix_init_user(); } diff --git a/keyboards/kin80/micro/micro.c b/keyboards/kin80/micro/micro.c index e06ad44748..b532a72869 100644 --- a/keyboards/kin80/micro/micro.c +++ b/keyboards/kin80/micro/micro.c @@ -18,8 +18,8 @@ void matrix_init_kb(void) { /* LED pins setup */ - setPinOutput(LED4_PIN); - writePinLow(LED4_PIN); + gpio_set_pin_output(LED4_PIN); + gpio_write_pin_low(LED4_PIN); matrix_init_user(); } diff --git a/keyboards/kinesis/kint36/kint36.c b/keyboards/kinesis/kint36/kint36.c index b3ae9b570c..c6f399d6dc 100644 --- a/keyboards/kinesis/kint36/kint36.c +++ b/keyboards/kinesis/kint36/kint36.c @@ -22,6 +22,6 @@ void matrix_init_kb(void) { matrix_init_user(); // Turn on the Teensy 3.6 Power LED: - setPinOutput(LED_POWER); - writePinHigh(LED_POWER); + gpio_set_pin_output(LED_POWER); + gpio_write_pin_high(LED_POWER); } diff --git a/keyboards/kinesis/kint41/kint41.c b/keyboards/kinesis/kint41/kint41.c index 6d339497ee..8f8f7dfc59 100644 --- a/keyboards/kinesis/kint41/kint41.c +++ b/keyboards/kinesis/kint41/kint41.c @@ -22,8 +22,8 @@ void matrix_init_kb(void) { matrix_init_user(); // Turn on the Teensy 4.x Power LED: - setPinOutput(LED_POWER); - writePinHigh(LED_POWER); + gpio_set_pin_output(LED_POWER); + gpio_write_pin_high(LED_POWER); } // delay_inline sleeps for |cycles| (e.g. sleeping for F_CPU will sleep 1s). diff --git a/keyboards/kinesis/kintlc/kintlc.c b/keyboards/kinesis/kintlc/kintlc.c index 9623d04fe0..6904adc6ad 100644 --- a/keyboards/kinesis/kintlc/kintlc.c +++ b/keyboards/kinesis/kintlc/kintlc.c @@ -22,6 +22,6 @@ void matrix_init_kb(void) { matrix_init_user(); // Turn on the Teensy LC Power LED: - setPinOutput(LED_POWER); - writePinHigh(LED_POWER); + gpio_set_pin_output(LED_POWER); + gpio_write_pin_high(LED_POWER); } diff --git a/keyboards/kinesis/kintwin/kintwin.c b/keyboards/kinesis/kintwin/kintwin.c index 0e2e7a5792..e0c3ab4880 100644 --- a/keyboards/kinesis/kintwin/kintwin.c +++ b/keyboards/kinesis/kintwin/kintwin.c @@ -8,22 +8,22 @@ void matrix_init_kb(void) { uint8_t led_delay_ms = 80; /* LED pins setup */ - setPinOutput(LED_CAPS_LOCK_PIN); - writePinLow(LED_CAPS_LOCK_PIN); + gpio_set_pin_output(LED_CAPS_LOCK_PIN); + gpio_write_pin_low(LED_CAPS_LOCK_PIN); wait_ms(led_delay_ms); - setPinOutput(LED_NUM_LOCK_PIN); - writePinLow(LED_NUM_LOCK_PIN); + gpio_set_pin_output(LED_NUM_LOCK_PIN); + gpio_write_pin_low(LED_NUM_LOCK_PIN); wait_ms(led_delay_ms); - setPinOutput(LED_SCROLL_LOCK_PIN); - writePinLow(LED_SCROLL_LOCK_PIN); + gpio_set_pin_output(LED_SCROLL_LOCK_PIN); + gpio_write_pin_low(LED_SCROLL_LOCK_PIN); wait_ms(led_delay_ms); - setPinOutput(LED_COMPOSE_PIN); - writePinLow(LED_COMPOSE_PIN); + gpio_set_pin_output(LED_COMPOSE_PIN); + gpio_write_pin_low(LED_COMPOSE_PIN); wait_ms(led_delay_ms); - writePinHigh(LED_COMPOSE_PIN); + gpio_write_pin_high(LED_COMPOSE_PIN); matrix_init_user(); } \ No newline at end of file diff --git a/keyboards/kinesis/nguyenvietyen/matrix.c b/keyboards/kinesis/nguyenvietyen/matrix.c index 4e4ca6f55c..06b57c7c0b 100644 --- a/keyboards/kinesis/nguyenvietyen/matrix.c +++ b/keyboards/kinesis/nguyenvietyen/matrix.c @@ -8,10 +8,10 @@ static matrix_row_t read_row(uint8_t row) { // keypad and program buttons if (row == 12) { - return ~(readPin(B4) | (readPin(B5) << 1) | 0b11111100); + return ~(gpio_read_pin(B4) | (gpio_read_pin(B5) << 1) | 0b11111100); } - return ~(readPin(B6) | readPin(B2) << 1 | readPin(B3) << 2 | readPin(B1) << 3 | readPin(F7) << 4 | readPin(F6) << 5 | readPin(F5) << 6 | readPin(F4) << 7); + return ~(gpio_read_pin(B6) | gpio_read_pin(B2) << 1 | gpio_read_pin(B3) << 2 | gpio_read_pin(B1) << 3 | gpio_read_pin(F7) << 4 | gpio_read_pin(F6) << 5 | gpio_read_pin(F5) << 6 | gpio_read_pin(F4) << 7); } static void unselect_rows(void) { @@ -26,24 +26,24 @@ static void select_rows(uint8_t row) { void matrix_init_custom(void) { // output low (multiplexers) - setPinOutput(D0); - setPinOutput(D1); - setPinOutput(D2); - setPinOutput(D3); + gpio_set_pin_output(D0); + gpio_set_pin_output(D1); + gpio_set_pin_output(D2); + gpio_set_pin_output(D3); // input with pullup (matrix) - setPinInputHigh(B6); - setPinInputHigh(B2); - setPinInputHigh(B3); - setPinInputHigh(B1); - setPinInputHigh(F7); - setPinInputHigh(F6); - setPinInputHigh(F5); - setPinInputHigh(F4); + gpio_set_pin_input_high(B6); + gpio_set_pin_input_high(B2); + gpio_set_pin_input_high(B3); + gpio_set_pin_input_high(B1); + gpio_set_pin_input_high(F7); + gpio_set_pin_input_high(F6); + gpio_set_pin_input_high(F5); + gpio_set_pin_input_high(F4); // input with pullup (program and keypad buttons) - setPinInputHigh(B4); - setPinInputHigh(B5); + gpio_set_pin_input_high(B4); + gpio_set_pin_input_high(B5); // initialize row and col unselect_rows(); diff --git a/keyboards/kkatano/wallaby/wallaby.c b/keyboards/kkatano/wallaby/wallaby.c index 4d619bec8e..de2583903b 100644 --- a/keyboards/kkatano/wallaby/wallaby.c +++ b/keyboards/kkatano/wallaby/wallaby.c @@ -18,8 +18,8 @@ bool led_update_kb(led_t led_state) { if (led_update_user(led_state)) { - writePin(B6, led_state.caps_lock); - writePin(B7, led_state.scroll_lock); + gpio_write_pin(B6, led_state.caps_lock); + gpio_write_pin(B7, led_state.scroll_lock); } return true; } diff --git a/keyboards/kkatano/yurei/yurei.c b/keyboards/kkatano/yurei/yurei.c index 457a6ce48c..283726a884 100644 --- a/keyboards/kkatano/yurei/yurei.c +++ b/keyboards/kkatano/yurei/yurei.c @@ -18,8 +18,8 @@ bool led_update_kb(led_t led_state) { if (led_update_user(led_state)) { - writePin(B6, led_state.caps_lock); - writePin(B7, led_state.scroll_lock); + gpio_write_pin(B6, led_state.caps_lock); + gpio_write_pin(B7, led_state.scroll_lock); } return true; } diff --git a/keyboards/kopibeng/mnk88/mnk88.c b/keyboards/kopibeng/mnk88/mnk88.c index cb53d31579..efe32f8bfd 100644 --- a/keyboards/kopibeng/mnk88/mnk88.c +++ b/keyboards/kopibeng/mnk88/mnk88.c @@ -18,8 +18,8 @@ void matrix_init_kb(void) { - setPinOutput(LED_CAPS_LOCK_PIN); - setPinOutput(LED_SCROLL_LOCK_PIN); + gpio_set_pin_output(LED_CAPS_LOCK_PIN); + gpio_set_pin_output(LED_SCROLL_LOCK_PIN); matrix_init_user(); } @@ -29,8 +29,8 @@ bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if(res) { - writePin(LED_CAPS_LOCK_PIN, led_state.caps_lock); - writePin(LED_SCROLL_LOCK_PIN, led_state.scroll_lock); + gpio_write_pin(LED_CAPS_LOCK_PIN, led_state.caps_lock); + gpio_write_pin(LED_SCROLL_LOCK_PIN, led_state.scroll_lock); } return res; } diff --git a/keyboards/kopibeng/typ65/typ65.c b/keyboards/kopibeng/typ65/typ65.c index 246a8c13af..53af0ba97d 100644 --- a/keyboards/kopibeng/typ65/typ65.c +++ b/keyboards/kopibeng/typ65/typ65.c @@ -17,9 +17,9 @@ #include "quantum.h" void keyboard_pre_init_kb (void) { - setPinOutput(INDICATOR_0); - setPinOutput(INDICATOR_1); - setPinOutput(INDICATOR_2); + gpio_set_pin_output(INDICATOR_0); + gpio_set_pin_output(INDICATOR_1); + gpio_set_pin_output(INDICATOR_2); keyboard_pre_init_user(); } @@ -27,41 +27,41 @@ void keyboard_pre_init_kb (void) { __attribute__((weak)) layer_state_t layer_state_set_user(layer_state_t state) { switch (get_highest_layer(state)) { case 1: - writePinHigh(INDICATOR_0); - writePinLow(INDICATOR_1); - writePinLow(INDICATOR_2); + gpio_write_pin_high(INDICATOR_0); + gpio_write_pin_low(INDICATOR_1); + gpio_write_pin_low(INDICATOR_2); break; case 2: - writePinLow(INDICATOR_0); - writePinHigh(INDICATOR_1); - writePinLow(INDICATOR_2); + gpio_write_pin_low(INDICATOR_0); + gpio_write_pin_high(INDICATOR_1); + gpio_write_pin_low(INDICATOR_2); break; case 3: - writePinLow(INDICATOR_0); - writePinLow(INDICATOR_1); - writePinHigh(INDICATOR_2); + gpio_write_pin_low(INDICATOR_0); + gpio_write_pin_low(INDICATOR_1); + gpio_write_pin_high(INDICATOR_2); break; default: - writePinHigh(INDICATOR_0); - writePinHigh(INDICATOR_1); - writePinHigh(INDICATOR_2); + gpio_write_pin_high(INDICATOR_0); + gpio_write_pin_high(INDICATOR_1); + gpio_write_pin_high(INDICATOR_2); break; } return state; } void suspend_power_down_kb(void) { - writePinLow(INDICATOR_0); - writePinLow(INDICATOR_1); - writePinLow(INDICATOR_2); + gpio_write_pin_low(INDICATOR_0); + gpio_write_pin_low(INDICATOR_1); + gpio_write_pin_low(INDICATOR_2); suspend_power_down_user(); } void suspend_wakeup_init_kb(void) { - writePinHigh(INDICATOR_0); - writePinHigh(INDICATOR_1); - writePinHigh(INDICATOR_2); + gpio_write_pin_high(INDICATOR_0); + gpio_write_pin_high(INDICATOR_1); + gpio_write_pin_high(INDICATOR_2); suspend_wakeup_init_user(); } \ No newline at end of file diff --git a/keyboards/kopibeng/xt8x/xt8x.c b/keyboards/kopibeng/xt8x/xt8x.c index 870a075e5b..2c4f246b6a 100644 --- a/keyboards/kopibeng/xt8x/xt8x.c +++ b/keyboards/kopibeng/xt8x/xt8x.c @@ -19,9 +19,9 @@ void matrix_init_kb(void) { // Initialize indicator LEDs to output - setPinOutput(LED_CAPS_LOCK_PIN); // Caps - setPinOutput(LED_SCROLL_LOCK_PIN); // Scroll lock - setPinOutput(INDICATOR_PIN_0); // Layer indicator on F13 + gpio_set_pin_output(LED_CAPS_LOCK_PIN); // Caps + gpio_set_pin_output(LED_SCROLL_LOCK_PIN); // Scroll lock + gpio_set_pin_output(INDICATOR_PIN_0); // Layer indicator on F13 matrix_init_user(); } @@ -31,13 +31,13 @@ bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if(res) { - writePin(LED_CAPS_LOCK_PIN, led_state.caps_lock); - writePin(LED_SCROLL_LOCK_PIN, led_state.scroll_lock); + gpio_write_pin(LED_CAPS_LOCK_PIN, led_state.caps_lock); + gpio_write_pin(LED_SCROLL_LOCK_PIN, led_state.scroll_lock); } return res; } __attribute__((weak)) layer_state_t layer_state_set_user(layer_state_t state) { - writePin(INDICATOR_PIN_0, layer_state_cmp(state, 1)); + gpio_write_pin(INDICATOR_PIN_0, layer_state_cmp(state, 1)); return state; } diff --git a/keyboards/ktec/ergodone/ergodox_compat.h b/keyboards/ktec/ergodone/ergodox_compat.h index de6ee4a211..b566e6cc94 100644 --- a/keyboards/ktec/ergodone/ergodox_compat.h +++ b/keyboards/ktec/ergodone/ergodox_compat.h @@ -15,12 +15,12 @@ #endif #define LED_BRIGHTNESS_LO 15 #define LED_BRIGHTNESS_HI 255 -static inline void ergodox_right_led_1_off(void) { setPinOutput(LED_NUM_LOCK_PIN); writePin(LED_NUM_LOCK_PIN, 0); } -static inline void ergodox_right_led_1_on(void) { setPinOutput(LED_NUM_LOCK_PIN); writePin(LED_NUM_LOCK_PIN, 1); } -static inline void ergodox_right_led_2_off(void) { setPinOutput(LED_CAPS_LOCK_PIN); writePin(LED_CAPS_LOCK_PIN, 0); } -static inline void ergodox_right_led_2_on(void) { setPinOutput(LED_CAPS_LOCK_PIN); writePin(LED_CAPS_LOCK_PIN, 1); } -static inline void ergodox_right_led_3_off(void) { setPinOutput(LED_SCROLL_LOCK_PIN); writePin(LED_SCROLL_LOCK_PIN, 0); } -static inline void ergodox_right_led_3_on(void) { setPinOutput(LED_SCROLL_LOCK_PIN); writePin(LED_SCROLL_LOCK_PIN, 1); } +static inline void ergodox_right_led_1_off(void) { gpio_set_pin_output(LED_NUM_LOCK_PIN); gpio_write_pin(LED_NUM_LOCK_PIN, 0); } +static inline void ergodox_right_led_1_on(void) { gpio_set_pin_output(LED_NUM_LOCK_PIN); gpio_write_pin(LED_NUM_LOCK_PIN, 1); } +static inline void ergodox_right_led_2_off(void) { gpio_set_pin_output(LED_CAPS_LOCK_PIN); gpio_write_pin(LED_CAPS_LOCK_PIN, 0); } +static inline void ergodox_right_led_2_on(void) { gpio_set_pin_output(LED_CAPS_LOCK_PIN); gpio_write_pin(LED_CAPS_LOCK_PIN, 1); } +static inline void ergodox_right_led_3_off(void) { gpio_set_pin_output(LED_SCROLL_LOCK_PIN); gpio_write_pin(LED_SCROLL_LOCK_PIN, 0); } +static inline void ergodox_right_led_3_on(void) { gpio_set_pin_output(LED_SCROLL_LOCK_PIN); gpio_write_pin(LED_SCROLL_LOCK_PIN, 1); } static inline void ergodox_right_led_on(uint8_t l) { switch (l) { case 1: @@ -51,8 +51,8 @@ static inline void ergodox_right_led_off(uint8_t l) { break; } } -static inline void ergodox_board_led_off(void) { setPinOutput(D5); writePin(D5, !ERGODOX_BOARD_LED_ON_STATE); } -static inline void ergodox_board_led_on(void) { setPinOutput(D5); writePin(D5, ERGODOX_BOARD_LED_ON_STATE); } +static inline void ergodox_board_led_off(void) { gpio_set_pin_output(D5); gpio_write_pin(D5, !ERGODOX_BOARD_LED_ON_STATE); } +static inline void ergodox_board_led_on(void) { gpio_set_pin_output(D5); gpio_write_pin(D5, ERGODOX_BOARD_LED_ON_STATE); } static inline void ergodox_led_all_on(void) { ergodox_right_led_1_on(); ergodox_right_led_2_on(); diff --git a/keyboards/ktec/ergodone/matrix.c b/keyboards/ktec/ergodone/matrix.c index a9a517f2f1..f034e1f2db 100644 --- a/keyboards/ktec/ergodone/matrix.c +++ b/keyboards/ktec/ergodone/matrix.c @@ -82,13 +82,13 @@ static void expander_scan(void) { */ static void init_cols(void) { // Pro Micro - setPinInputHigh(E6); - setPinInputHigh(D2); - setPinInputHigh(D3); - setPinInputHigh(D4); - setPinInputHigh(D7); - setPinInputHigh(C6); - setPinInputHigh(B4); + gpio_set_pin_input_high(E6); + gpio_set_pin_input_high(D2); + gpio_set_pin_input_high(D3); + gpio_set_pin_input_high(D4); + gpio_set_pin_input_high(D7); + gpio_set_pin_input_high(C6); + gpio_set_pin_input_high(B4); // Expander expander_init_cols(); @@ -97,13 +97,13 @@ static void init_cols(void) { static matrix_row_t read_cols(void) { // clang-format off return expander_read_row() | - (readPin(D3) ? 0 : (1<<6)) | - (readPin(D2) ? 0 : (1<<5)) | - (readPin(D4) ? 0 : (1<<4)) | - (readPin(C6) ? 0 : (1<<3)) | - (readPin(D7) ? 0 : (1<<2)) | - (readPin(E6) ? 0 : (1<<1)) | - (readPin(B4) ? 0 : (1<<0)) ; + (gpio_read_pin(D3) ? 0 : (1<<6)) | + (gpio_read_pin(D2) ? 0 : (1<<5)) | + (gpio_read_pin(D4) ? 0 : (1<<4)) | + (gpio_read_pin(C6) ? 0 : (1<<3)) | + (gpio_read_pin(D7) ? 0 : (1<<2)) | + (gpio_read_pin(E6) ? 0 : (1<<1)) | + (gpio_read_pin(B4) ? 0 : (1<<0)) ; // clang-format on } @@ -116,18 +116,18 @@ static matrix_row_t read_cols(void) { */ static void unselect_rows(void) { // Pro Micro - setPinInput(B1); - setPinInput(B2); - setPinInput(F4); - setPinInput(F5); - setPinInput(F6); - setPinInput(F7); - writePinLow(B1); - writePinLow(B2); - writePinLow(F4); - writePinLow(F5); - writePinLow(F6); - writePinLow(F7); + gpio_set_pin_input(B1); + gpio_set_pin_input(B2); + gpio_set_pin_input(F4); + gpio_set_pin_input(F5); + gpio_set_pin_input(F6); + gpio_set_pin_input(F7); + gpio_write_pin_low(B1); + gpio_write_pin_low(B2); + gpio_write_pin_low(F4); + gpio_write_pin_low(F5); + gpio_write_pin_low(F6); + gpio_write_pin_low(F7); // Expander expander_unselect_rows(); @@ -137,28 +137,28 @@ static void unselect_row(uint8_t row) { // Pro Micro switch (row) { case 0: - setPinInput(F4); - writePinLow(F4); + gpio_set_pin_input(F4); + gpio_write_pin_low(F4); break; case 1: - setPinInput(F5); - writePinLow(F5); + gpio_set_pin_input(F5); + gpio_write_pin_low(F5); break; case 2: - setPinInput(F6); - writePinLow(F6); + gpio_set_pin_input(F6); + gpio_write_pin_low(F6); break; case 3: - setPinInput(F7); - writePinLow(F7); + gpio_set_pin_input(F7); + gpio_write_pin_low(F7); break; case 4: - setPinInput(B1); - writePinLow(B1); + gpio_set_pin_input(B1); + gpio_write_pin_low(B1); break; case 5: - setPinInput(B2); - writePinLow(B2); + gpio_set_pin_input(B2); + gpio_write_pin_low(B2); break; } @@ -170,28 +170,28 @@ static void select_row(uint8_t row) { // Pro Micro switch (row) { case 0: - setPinOutput(F4); - writePinLow(F4); + gpio_set_pin_output(F4); + gpio_write_pin_low(F4); break; case 1: - setPinOutput(F5); - writePinLow(F5); + gpio_set_pin_output(F5); + gpio_write_pin_low(F5); break; case 2: - setPinOutput(F6); - writePinLow(F6); + gpio_set_pin_output(F6); + gpio_write_pin_low(F6); break; case 3: - setPinOutput(F7); - writePinLow(F7); + gpio_set_pin_output(F7); + gpio_write_pin_low(F7); break; case 4: - setPinOutput(B1); - writePinLow(B1); + gpio_set_pin_output(B1); + gpio_write_pin_low(B1); break; case 5: - setPinOutput(B2); - writePinLow(B2); + gpio_set_pin_output(B2); + gpio_write_pin_low(B2); break; } diff --git a/keyboards/ktec/staryu/backlight_staryu.h b/keyboards/ktec/staryu/backlight_staryu.h index 34511da5c1..aa0092c3c1 100644 --- a/keyboards/ktec/staryu/backlight_staryu.h +++ b/keyboards/ktec/staryu/backlight_staryu.h @@ -20,9 +20,9 @@ along with this program. If not, see . static inline void backlight_set_value(uint8_t index, uint8_t level) { static const uint8_t backlight_pins[] = BACKLIGHT_PINS; if (level) { - setPinOutput(backlight_pins[index]); + gpio_set_pin_output(backlight_pins[index]); } else { - setPinInput(backlight_pins[index]); + gpio_set_pin_input(backlight_pins[index]); } } diff --git a/keyboards/kv/revt/revt.c b/keyboards/kv/revt/revt.c index fba4582c26..df74ca626b 100644 --- a/keyboards/kv/revt/revt.c +++ b/keyboards/kv/revt/revt.c @@ -18,8 +18,8 @@ void matrix_init_kb(void) { // Turn status LED on - setPinOutput(C14); - writePinHigh(C14); + gpio_set_pin_output(C14); + gpio_write_pin_high(C14); matrix_init_user(); } diff --git a/keyboards/lazydesigners/dimple/staggered/staggered.c b/keyboards/lazydesigners/dimple/staggered/staggered.c index b871868afa..c354283780 100644 --- a/keyboards/lazydesigners/dimple/staggered/staggered.c +++ b/keyboards/lazydesigners/dimple/staggered/staggered.c @@ -15,9 +15,9 @@ */ #include "staggered.h" void dimple_led_on(void) { - writePinLow(E6); + gpio_write_pin_low(E6); } void dimple_led_off(void) { - writePinHigh(E6); + gpio_write_pin_high(E6); } diff --git a/keyboards/lfkeyboards/lfk78/lfk78.c b/keyboards/lfkeyboards/lfk78/lfk78.c index 50f1505050..3bf7c40d15 100644 --- a/keyboards/lfkeyboards/lfk78/lfk78.c +++ b/keyboards/lfkeyboards/lfk78/lfk78.c @@ -10,8 +10,8 @@ void matrix_init_kb(void) { #ifndef AUDIO_ENABLE // If we're not using the audio pin, drive it low - setPinOutput(C6); - writePinLow(C6); + gpio_set_pin_output(C6); + gpio_write_pin_low(C6); #endif #ifdef WATCHDOG_ENABLE diff --git a/keyboards/lfkeyboards/lfk87/lfk87.c b/keyboards/lfkeyboards/lfk87/lfk87.c index 849f0ebcc5..480a44ea84 100644 --- a/keyboards/lfkeyboards/lfk87/lfk87.c +++ b/keyboards/lfkeyboards/lfk87/lfk87.c @@ -12,8 +12,8 @@ void matrix_init_kb(void) matrix_init_user(); #ifndef AUDIO_ENABLE // If we're not using the audio pin, drive it low - setPinOutput(C6); - writePinLow(C6); + gpio_set_pin_output(C6); + gpio_write_pin_low(C6); #endif #ifdef WATCHDOG_ENABLE // This is done after turning the layer LED red, if we're caught in a loop diff --git a/keyboards/lfkeyboards/mini1800/mini1800.c b/keyboards/lfkeyboards/mini1800/mini1800.c index 2ca87cfdb6..6ac615f871 100644 --- a/keyboards/lfkeyboards/mini1800/mini1800.c +++ b/keyboards/lfkeyboards/mini1800/mini1800.c @@ -13,8 +13,8 @@ void matrix_init_kb(void) matrix_init_user(); #ifndef AUDIO_ENABLE // If we're not using the audio pin, drive it low - setPinOutput(C6); - writePinLow(C6); + gpio_set_pin_output(C6); + gpio_write_pin_low(C6); #endif _delay_ms(500); #ifdef WATCHDOG_ENABLE diff --git a/keyboards/lfkeyboards/smk65/revb/revb.c b/keyboards/lfkeyboards/smk65/revb/revb.c index 8eb9b9afe2..f519b413b5 100644 --- a/keyboards/lfkeyboards/smk65/revb/revb.c +++ b/keyboards/lfkeyboards/smk65/revb/revb.c @@ -27,12 +27,12 @@ void matrix_init_kb(void) #ifdef AUDIO_ENABLE // audio_init() sets PB5 to output and drives it low, which breaks our matrix // so reset PB5 to input - setPinInput(B5); - writePinHigh(B5); + gpio_set_pin_input(B5); + gpio_write_pin_high(B5); #else // If we're not using the audio pin, drive it low - setPinOutput(C6); - writePinLow(C6); + gpio_set_pin_output(C6); + gpio_write_pin_low(C6); #endif } diff --git a/keyboards/lz/erghost/matrix.c b/keyboards/lz/erghost/matrix.c index 6b7d091cb7..dd9bb1e1ba 100644 --- a/keyboards/lz/erghost/matrix.c +++ b/keyboards/lz/erghost/matrix.c @@ -63,103 +63,103 @@ static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; static void select_col(uint8_t col) { switch (col) { case 0: - writePinLow(B5); - writePinLow(B7); - writePinLow(F0); - writePinHigh(B0); + gpio_write_pin_low(B5); + gpio_write_pin_low(B7); + gpio_write_pin_low(F0); + gpio_write_pin_high(B0); break; case 1: - writePinLow(B5); - writePinLow(B7); - writePinHigh(F0); - writePinHigh(B0); + gpio_write_pin_low(B5); + gpio_write_pin_low(B7); + gpio_write_pin_high(F0); + gpio_write_pin_high(B0); break; case 2: - writePinLow(B5); - writePinHigh(B7); - writePinLow(F0); - writePinHigh(B0); + gpio_write_pin_low(B5); + gpio_write_pin_high(B7); + gpio_write_pin_low(F0); + gpio_write_pin_high(B0); break; case 3: - writePinLow(B5); - writePinHigh(B7); - writePinHigh(F0); - writePinHigh(B0); + gpio_write_pin_low(B5); + gpio_write_pin_high(B7); + gpio_write_pin_high(F0); + gpio_write_pin_high(B0); break; case 4: - writePinHigh(B5); - writePinLow(B7); - writePinLow(F0); - writePinHigh(B0); + gpio_write_pin_high(B5); + gpio_write_pin_low(B7); + gpio_write_pin_low(F0); + gpio_write_pin_high(B0); break; case 5: - writePinHigh(B5); - writePinLow(B7); - writePinHigh(F0); - writePinHigh(B0); + gpio_write_pin_high(B5); + gpio_write_pin_low(B7); + gpio_write_pin_high(F0); + gpio_write_pin_high(B0); break; case 6: - writePinHigh(B5); - writePinHigh(B7); - writePinLow(F0); - writePinHigh(B0); + gpio_write_pin_high(B5); + gpio_write_pin_high(B7); + gpio_write_pin_low(F0); + gpio_write_pin_high(B0); break; case 7: - writePinHigh(B5); - writePinHigh(B7); - writePinHigh(F0); - writePinHigh(B0); + gpio_write_pin_high(B5); + gpio_write_pin_high(B7); + gpio_write_pin_high(F0); + gpio_write_pin_high(B0); break; case 8: - writePinLow(B5); - writePinLow(B7); - writePinLow(F0); - writePinHigh(F1); + gpio_write_pin_low(B5); + gpio_write_pin_low(B7); + gpio_write_pin_low(F0); + gpio_write_pin_high(F1); break; case 9: - writePinLow(B5); - writePinLow(B7); - writePinHigh(F0); - writePinHigh(F1); + gpio_write_pin_low(B5); + gpio_write_pin_low(B7); + gpio_write_pin_high(F0); + gpio_write_pin_high(F1); break; case 10: - writePinLow(B5); - writePinHigh(B7); - writePinLow(F0); - writePinHigh(F1); + gpio_write_pin_low(B5); + gpio_write_pin_high(B7); + gpio_write_pin_low(F0); + gpio_write_pin_high(F1); break; case 11: - writePinLow(B5); - writePinHigh(B7); - writePinHigh(F0); - writePinHigh(F1); + gpio_write_pin_low(B5); + gpio_write_pin_high(B7); + gpio_write_pin_high(F0); + gpio_write_pin_high(F1); break; case 12: - writePinHigh(B5); - writePinLow(B7); - writePinLow(F0); - writePinHigh(F1); + gpio_write_pin_high(B5); + gpio_write_pin_low(B7); + gpio_write_pin_low(F0); + gpio_write_pin_high(F1); break; case 13: - writePinHigh(B5); - writePinLow(B7); - writePinHigh(F0); - writePinHigh(F1); + gpio_write_pin_high(B5); + gpio_write_pin_low(B7); + gpio_write_pin_high(F0); + gpio_write_pin_high(F1); break; case 14: - writePinHigh(B5); - writePinHigh(B7); - writePinHigh(F0); - writePinHigh(F1); + gpio_write_pin_high(B5); + gpio_write_pin_high(B7); + gpio_write_pin_high(F0); + gpio_write_pin_high(F1); break; case 15: - writePinHigh(B5); - writePinHigh(B7); - writePinLow(F0); - writePinHigh(F1); + gpio_write_pin_high(B5); + gpio_write_pin_high(B7); + gpio_write_pin_low(F0); + gpio_write_pin_high(F1); break; case 16: - writePinLow(E6); + gpio_write_pin_low(E6); break; } } @@ -167,130 +167,130 @@ static void select_col(uint8_t col) { static void unselect_col(uint8_t col) { switch (col) { case 0: - writePinHigh(B5); - writePinHigh(B7); - writePinHigh(F0); - writePinLow(B0); + gpio_write_pin_high(B5); + gpio_write_pin_high(B7); + gpio_write_pin_high(F0); + gpio_write_pin_low(B0); break; case 1: - writePinHigh(B5); - writePinHigh(B7); - writePinLow(F0); - writePinLow(B0); + gpio_write_pin_high(B5); + gpio_write_pin_high(B7); + gpio_write_pin_low(F0); + gpio_write_pin_low(B0); break; case 2: - writePinHigh(B5); - writePinLow(B7); - writePinHigh(F0); - writePinLow(B0); + gpio_write_pin_high(B5); + gpio_write_pin_low(B7); + gpio_write_pin_high(F0); + gpio_write_pin_low(B0); break; case 3: - writePinHigh(B5); - writePinLow(B7); - writePinLow(F0); - writePinLow(B0); + gpio_write_pin_high(B5); + gpio_write_pin_low(B7); + gpio_write_pin_low(F0); + gpio_write_pin_low(B0); break; case 4: - writePinLow(B5); - writePinHigh(B7); - writePinHigh(F0); - writePinLow(B0); + gpio_write_pin_low(B5); + gpio_write_pin_high(B7); + gpio_write_pin_high(F0); + gpio_write_pin_low(B0); break; case 5: - writePinLow(B5); - writePinHigh(B7); - writePinLow(F0); - writePinLow(B0); + gpio_write_pin_low(B5); + gpio_write_pin_high(B7); + gpio_write_pin_low(F0); + gpio_write_pin_low(B0); break; case 6: - writePinLow(B5); - writePinLow(B7); - writePinHigh(F0); - writePinLow(B0); + gpio_write_pin_low(B5); + gpio_write_pin_low(B7); + gpio_write_pin_high(F0); + gpio_write_pin_low(B0); break; case 7: - writePinLow(B5); - writePinLow(B7); - writePinLow(F0); - writePinLow(B0); + gpio_write_pin_low(B5); + gpio_write_pin_low(B7); + gpio_write_pin_low(F0); + gpio_write_pin_low(B0); break; case 8: - writePinHigh(B5); - writePinHigh(B7); - writePinHigh(F0); - writePinLow(F1); + gpio_write_pin_high(B5); + gpio_write_pin_high(B7); + gpio_write_pin_high(F0); + gpio_write_pin_low(F1); break; case 9: - writePinHigh(B5); - writePinHigh(B7); - writePinLow(F0); - writePinLow(F1); + gpio_write_pin_high(B5); + gpio_write_pin_high(B7); + gpio_write_pin_low(F0); + gpio_write_pin_low(F1); break; case 10: - writePinHigh(B5); - writePinLow(B7); - writePinHigh(F0); - writePinLow(F1); + gpio_write_pin_high(B5); + gpio_write_pin_low(B7); + gpio_write_pin_high(F0); + gpio_write_pin_low(F1); break; case 11: - writePinHigh(B5); - writePinLow(B7); - writePinLow(F0); - writePinLow(F1); + gpio_write_pin_high(B5); + gpio_write_pin_low(B7); + gpio_write_pin_low(F0); + gpio_write_pin_low(F1); break; case 12: - writePinLow(B5); - writePinHigh(B7); - writePinHigh(F0); - writePinLow(F1); + gpio_write_pin_low(B5); + gpio_write_pin_high(B7); + gpio_write_pin_high(F0); + gpio_write_pin_low(F1); break; case 13: - writePinLow(B5); - writePinHigh(B7); - writePinLow(F0); - writePinLow(F1); + gpio_write_pin_low(B5); + gpio_write_pin_high(B7); + gpio_write_pin_low(F0); + gpio_write_pin_low(F1); break; case 14: - writePinLow(B5); - writePinLow(B7); - writePinLow(F0); - writePinLow(F1); + gpio_write_pin_low(B5); + gpio_write_pin_low(B7); + gpio_write_pin_low(F0); + gpio_write_pin_low(F1); break; case 15: - writePinLow(B5); - writePinLow(B7); - writePinHigh(F0); - writePinLow(F1); + gpio_write_pin_low(B5); + gpio_write_pin_low(B7); + gpio_write_pin_high(F0); + gpio_write_pin_low(F1); break; case 16: - writePinHigh(E6); + gpio_write_pin_high(E6); break; } } static void unselect_cols(void) { //Native - writePinHigh(E6); + gpio_write_pin_high(E6); //Demultiplexer - writePinLow(B0); - writePinLow(F1); - writePinHigh(B5); - writePinHigh(B7); - writePinHigh(F0); + gpio_write_pin_low(B0); + gpio_write_pin_low(F1); + gpio_write_pin_high(B5); + gpio_write_pin_high(B7); + gpio_write_pin_high(F0); } static void init_pins(void) { unselect_cols(); for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } - setPinOutput(B5); - setPinOutput(B7); - setPinOutput(F0); - setPinOutput(B0); - setPinOutput(F1); - setPinOutput(E6); + gpio_set_pin_output(B5); + gpio_set_pin_output(B7); + gpio_set_pin_output(F0); + gpio_set_pin_output(B0); + gpio_set_pin_output(F1); + gpio_set_pin_output(E6); } static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) { @@ -306,7 +306,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) matrix_row_t last_row_value = current_matrix[row_index]; // Check row pin state - if (readPin(row_pins[row_index]) == 0) { + if (gpio_read_pin(row_pins[row_index]) == 0) { // Pin LO, set col bit current_matrix[row_index] |= (MATRIX_ROW_SHIFTER << current_col); } else { diff --git a/keyboards/machkeyboards/mach3/mach3.c b/keyboards/machkeyboards/mach3/mach3.c index 2a417b0a02..948df5a066 100644 --- a/keyboards/machkeyboards/mach3/mach3.c +++ b/keyboards/machkeyboards/mach3/mach3.c @@ -35,8 +35,8 @@ led_config_t g_led_config = { { #endif void keyboard_pre_init_kb(void) { - setPinOutput(F5); - writePinHigh(F5); + gpio_set_pin_output(F5); + gpio_write_pin_high(F5); keyboard_pre_init_user(); } diff --git a/keyboards/macrocat/macrocat.c b/keyboards/macrocat/macrocat.c index f00bb01410..0369a130dc 100644 --- a/keyboards/macrocat/macrocat.c +++ b/keyboards/macrocat/macrocat.c @@ -129,11 +129,11 @@ void encoder_triple_click(void) { void matrix_init_kb(void) { matrix_init_user(); - setPinInputHigh(ENCODER_SWITCH); + gpio_set_pin_input_high(ENCODER_SWITCH); } void matrix_scan_kb(void) { matrix_scan_user(); - if (readPin(ENCODER_SWITCH)) { + if (gpio_read_pin(ENCODER_SWITCH)) { if (encoder_pressed) { // release switch encoder_pressed = 0; encoder_press_combo += 1; diff --git a/keyboards/makeymakey/makeymakey.c b/keyboards/makeymakey/makeymakey.c index 5b8edd4655..bfc8788375 100644 --- a/keyboards/makeymakey/makeymakey.c +++ b/keyboards/makeymakey/makeymakey.c @@ -26,7 +26,7 @@ void keyboard_post_init_kb(void) { { for(uint8_t col = 0; col < MATRIX_COLS; col++) { - writePinLow(pins[row][col]); //Disable internal pull-up resistors + gpio_write_pin_low(pins[row][col]); //Disable internal pull-up resistors } } @@ -35,8 +35,8 @@ void keyboard_post_init_kb(void) { void cycle_leds(void) { for(uint8_t i = 0; i < 3; i++) { - setPinInput(led_pins[i]); - writePinLow(led_pins[i]); + gpio_set_pin_input(led_pins[i]); + gpio_write_pin_low(led_pins[i]); } led_cycle_counter++; @@ -45,62 +45,62 @@ void cycle_leds(void) { switch (led_cycle_counter) { case 0: if (led_state[0]) { // Up Arrow - setPinInput(led_pins[0]); - writePinLow(led_pins[0]); - setPinOutput(led_pins[1]); - writePinHigh(led_pins[1]); - setPinOutput(led_pins[2]); - writePinLow(led_pins[2]); + gpio_set_pin_input(led_pins[0]); + gpio_write_pin_low(led_pins[0]); + gpio_set_pin_output(led_pins[1]); + gpio_write_pin_high(led_pins[1]); + gpio_set_pin_output(led_pins[2]); + gpio_write_pin_low(led_pins[2]); } break; case 1: if (led_state[1]) { // Down Arrow - setPinOutput(led_pins[0]); - writePinHigh(led_pins[0]); - setPinOutput(led_pins[1]); - writePinLow(led_pins[1]); - setPinInput(led_pins[2]); - writePinLow(led_pins[2]); + gpio_set_pin_output(led_pins[0]); + gpio_write_pin_high(led_pins[0]); + gpio_set_pin_output(led_pins[1]); + gpio_write_pin_low(led_pins[1]); + gpio_set_pin_input(led_pins[2]); + gpio_write_pin_low(led_pins[2]); } break; case 2: if (led_state[2]) { // Left Arrow - setPinOutput(led_pins[0]); - writePinLow(led_pins[0]); - setPinOutput(led_pins[1]); - writePinHigh(led_pins[1]); - setPinInput(led_pins[2]); - writePinLow(led_pins[2]); + gpio_set_pin_output(led_pins[0]); + gpio_write_pin_low(led_pins[0]); + gpio_set_pin_output(led_pins[1]); + gpio_write_pin_high(led_pins[1]); + gpio_set_pin_input(led_pins[2]); + gpio_write_pin_low(led_pins[2]); } break; case 3: if (led_state[3]) { // Right Arrow - setPinInput(led_pins[0]); - writePinLow(led_pins[0]); - setPinOutput(led_pins[1]); - writePinLow(led_pins[1]); - setPinOutput(led_pins[2]); - writePinHigh(led_pins[2]); + gpio_set_pin_input(led_pins[0]); + gpio_write_pin_low(led_pins[0]); + gpio_set_pin_output(led_pins[1]); + gpio_write_pin_low(led_pins[1]); + gpio_set_pin_output(led_pins[2]); + gpio_write_pin_high(led_pins[2]); } break; case 4: if (led_state[4]) { // Space - setPinOutput(led_pins[0]); - writePinLow(led_pins[0]); - setPinInput(led_pins[1]); - writePinLow(led_pins[1]); - setPinOutput(led_pins[2]); - writePinHigh(led_pins[2]); + gpio_set_pin_output(led_pins[0]); + gpio_write_pin_low(led_pins[0]); + gpio_set_pin_input(led_pins[1]); + gpio_write_pin_low(led_pins[1]); + gpio_set_pin_output(led_pins[2]); + gpio_write_pin_high(led_pins[2]); } break; case 5: if (led_state[5]) { // Right Click - setPinOutput(led_pins[0]); - writePinHigh(led_pins[0]); - setPinInput(led_pins[1]); - writePinLow(led_pins[1]); - setPinOutput(led_pins[2]); - writePinLow(led_pins[2]); + gpio_set_pin_output(led_pins[0]); + gpio_write_pin_high(led_pins[0]); + gpio_set_pin_input(led_pins[1]); + gpio_write_pin_low(led_pins[1]); + gpio_set_pin_output(led_pins[2]); + gpio_write_pin_low(led_pins[2]); } break; default: diff --git a/keyboards/mariorion_v25/mariorion_v25.c b/keyboards/mariorion_v25/mariorion_v25.c index 7c57c29dfd..07a1999915 100644 --- a/keyboards/mariorion_v25/mariorion_v25.c +++ b/keyboards/mariorion_v25/mariorion_v25.c @@ -23,50 +23,50 @@ void matrix_init_kb(void) { // put your keyboard start-up code here // runs once when the firmware starts up - setPinOutput(INDICATOR_0); - setPinOutput(INDICATOR_1); - setPinOutput(INDICATOR_2); + gpio_set_pin_output(INDICATOR_0); + gpio_set_pin_output(INDICATOR_1); + gpio_set_pin_output(INDICATOR_2); matrix_init_user(); } layer_state_t layer_state_set_kb(layer_state_t state) { switch (get_highest_layer(state)) { case 1: - writePinHigh(INDICATOR_0); - writePinLow(INDICATOR_1); - writePinLow(INDICATOR_2); + gpio_write_pin_high(INDICATOR_0); + gpio_write_pin_low(INDICATOR_1); + gpio_write_pin_low(INDICATOR_2); break; case 2: - writePinLow(INDICATOR_0); - writePinHigh(INDICATOR_1); - writePinLow(INDICATOR_2); + gpio_write_pin_low(INDICATOR_0); + gpio_write_pin_high(INDICATOR_1); + gpio_write_pin_low(INDICATOR_2); break; case 3: - writePinLow(INDICATOR_0); - writePinLow(INDICATOR_1); - writePinHigh(INDICATOR_2); + gpio_write_pin_low(INDICATOR_0); + gpio_write_pin_low(INDICATOR_1); + gpio_write_pin_high(INDICATOR_2); break; default: - writePinHigh(INDICATOR_0); - writePinHigh(INDICATOR_1); - writePinHigh(INDICATOR_2); + gpio_write_pin_high(INDICATOR_0); + gpio_write_pin_high(INDICATOR_1); + gpio_write_pin_high(INDICATOR_2); break; } return layer_state_set_user(state); } void suspend_power_down_kb(void) { - writePinLow(INDICATOR_0); - writePinLow(INDICATOR_1); - writePinLow(INDICATOR_2); + gpio_write_pin_low(INDICATOR_0); + gpio_write_pin_low(INDICATOR_1); + gpio_write_pin_low(INDICATOR_2); suspend_power_down_user(); } void suspend_wakeup_init_kb(void) { - writePinHigh(INDICATOR_0); - writePinHigh(INDICATOR_1); - writePinHigh(INDICATOR_2); + gpio_write_pin_high(INDICATOR_0); + gpio_write_pin_high(INDICATOR_1); + gpio_write_pin_high(INDICATOR_2); suspend_wakeup_init_user(); } diff --git a/keyboards/marksard/leftover30/leftover30.c b/keyboards/marksard/leftover30/leftover30.c index 6d8b64cd90..cea0de703a 100644 --- a/keyboards/marksard/leftover30/leftover30.c +++ b/keyboards/marksard/leftover30/leftover30.c @@ -22,16 +22,16 @@ void keyboard_pre_init_user(void) { /* Set CAPSLOCK indicator pin as output */ - setPinOutput(D1); + gpio_set_pin_output(D1); /* Set NUMLOCK indicator pin as output */ - setPinOutput(D2); + gpio_set_pin_output(D2); } bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if(res) { - writePin(D2, led_state.num_lock); - writePin(D1, led_state.caps_lock); + gpio_write_pin(D2, led_state.num_lock); + gpio_write_pin(D1, led_state.caps_lock); } return res; } diff --git a/keyboards/masterworks/classy_tkl/rev_a/rev_a.c b/keyboards/masterworks/classy_tkl/rev_a/rev_a.c index 3a3446d7ae..6e01c217d2 100644 --- a/keyboards/masterworks/classy_tkl/rev_a/rev_a.c +++ b/keyboards/masterworks/classy_tkl/rev_a/rev_a.c @@ -26,8 +26,8 @@ void matrix_init_kb(void) { // put your keyboard start-up code here // runs once when the firmware starts up - setPinOutput(CAPS_PIN); - setPinOutput(SCROLL_PIN); + gpio_set_pin_output(CAPS_PIN); + gpio_set_pin_output(SCROLL_PIN); matrix_init_user(); } @@ -35,8 +35,8 @@ void matrix_init_kb(void) { bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if(res) { - writePin(CAPS_PIN, led_state.caps_lock); - writePin(SCROLL_PIN, led_state.scroll_lock); + gpio_write_pin(CAPS_PIN, led_state.caps_lock); + gpio_write_pin(SCROLL_PIN, led_state.scroll_lock); } return res; } diff --git a/keyboards/matrix/cain_re/cain_re.c b/keyboards/matrix/cain_re/cain_re.c index 5151f021ba..6dc24f2292 100644 --- a/keyboards/matrix/cain_re/cain_re.c +++ b/keyboards/matrix/cain_re/cain_re.c @@ -21,9 +21,9 @@ void matrix_init_kb(void) { - setPinOutput(NUM_PIN); - setPinOutput(CAPS_PIN); - setPinOutput(SCROLL_PIN); + gpio_set_pin_output(NUM_PIN); + gpio_set_pin_output(CAPS_PIN); + gpio_set_pin_output(SCROLL_PIN); matrix_init_user(); } @@ -32,9 +32,9 @@ bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if (res) { - writePin(NUM_PIN, led_state.num_lock); - writePin(CAPS_PIN, led_state.caps_lock); - writePin(SCROLL_PIN, led_state.scroll_lock); + gpio_write_pin(NUM_PIN, led_state.num_lock); + gpio_write_pin(CAPS_PIN, led_state.caps_lock); + gpio_write_pin(SCROLL_PIN, led_state.scroll_lock); } return res; } diff --git a/keyboards/matrix/falcon/falcon.c b/keyboards/matrix/falcon/falcon.c index 33d05a8a29..74677ab0d1 100644 --- a/keyboards/matrix/falcon/falcon.c +++ b/keyboards/matrix/falcon/falcon.c @@ -18,11 +18,11 @@ void matrix_init_kb(void) { // enable charge - setPinOutput(CHG_EN_PIN); - writePinHigh(CHG_EN_PIN); + gpio_set_pin_output(CHG_EN_PIN); + gpio_write_pin_high(CHG_EN_PIN); // enable led power - setPinOutput(LED_POWER_PIN); - writePinHigh(LED_POWER_PIN); + gpio_set_pin_output(LED_POWER_PIN); + gpio_write_pin_high(LED_POWER_PIN); } diff --git a/keyboards/matrix/m12og/rev1/matrix.c b/keyboards/matrix/m12og/rev1/matrix.c index c127aa35b9..3317abbe29 100644 --- a/keyboards/matrix/m12og/rev1/matrix.c +++ b/keyboards/matrix/m12og/rev1/matrix.c @@ -22,22 +22,22 @@ static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; static void select_col(uint8_t col) { - setPinOutput(col_pins[col]); - writePinHigh(col_pins[col]); + gpio_set_pin_output(col_pins[col]); + gpio_write_pin_high(col_pins[col]); } -static void unselect_col(uint8_t col) { setPinInputLow(col_pins[col]); } +static void unselect_col(uint8_t col) { gpio_set_pin_input_low(col_pins[col]); } static void unselect_cols(void) { for (uint8_t x = 0; x < MATRIX_COLS; x++) { - setPinInputLow(col_pins[x]); + gpio_set_pin_input_low(col_pins[x]); } } static void init_pins(void) { unselect_cols(); for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputLow(row_pins[x]); + gpio_set_pin_input_low(row_pins[x]); } } @@ -55,7 +55,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) matrix_row_t current_row_value = last_row_value; // Check row pin state - if (readPin(row_pins[row_index]) != 0) { + if (gpio_read_pin(row_pins[row_index]) != 0) { // Pin LO, set col bit current_row_value |= (MATRIX_ROW_SHIFTER << current_col); } else { diff --git a/keyboards/matrix/m12og/rev1/rev1.c b/keyboards/matrix/m12og/rev1/rev1.c index f517703c60..7506edc8e9 100644 --- a/keyboards/matrix/m12og/rev1/rev1.c +++ b/keyboards/matrix/m12og/rev1/rev1.c @@ -17,7 +17,7 @@ #include "quantum.h" void board_init(void) { - writePinLow(A8); + gpio_write_pin_low(A8); } void bootloader_jump(void) { diff --git a/keyboards/matrix/m12og/rev2/rev2.c b/keyboards/matrix/m12og/rev2/rev2.c index fb424b164f..bf6129c806 100644 --- a/keyboards/matrix/m12og/rev2/rev2.c +++ b/keyboards/matrix/m12og/rev2/rev2.c @@ -4,20 +4,20 @@ #include "quantum.h" -void matrix_init_kb(void) { - setPinOutput(C6); - setPinOutput(B2); - setPinOutput(B1); - - matrix_init_user(); +void matrix_init_user(void) { + gpio_set_pin_output(C6); + gpio_set_pin_output(B2); + gpio_set_pin_output(B1); + + matrix_init_user(); } bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if (res) { - writePin(B1, !led_state.num_lock); - writePin(C6, !led_state.caps_lock); - writePin(B2, !led_state.scroll_lock); + gpio_write_pin(B1, !led_state.num_lock); + gpio_write_pin(C6, !led_state.caps_lock); + gpio_write_pin(B2, !led_state.scroll_lock); } return res; } diff --git a/keyboards/mc_76k/mc_76k.c b/keyboards/mc_76k/mc_76k.c index 51e9d55406..44d2374b1c 100644 --- a/keyboards/mc_76k/mc_76k.c +++ b/keyboards/mc_76k/mc_76k.c @@ -17,18 +17,18 @@ #include "quantum.h" void keyboard_pre_init_kb (void) { - setPinOutput(D2); + gpio_set_pin_output(D2); } 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(D2, !led_state.caps_lock); + gpio_write_pin(D2, !led_state.caps_lock); } return res; } diff --git a/keyboards/mechlovin/adelais/standard_led/avr/rev1/matrix.c b/keyboards/mechlovin/adelais/standard_led/avr/rev1/matrix.c index 864de5e660..c7807bbc90 100644 --- a/keyboards/mechlovin/adelais/standard_led/avr/rev1/matrix.c +++ b/keyboards/mechlovin/adelais/standard_led/avr/rev1/matrix.c @@ -37,7 +37,7 @@ static void init_pins(void) { for (int col = 0; col < MATRIX_COLS; col++) { pin_t pin = direct_pins[row][col]; if (pin != NO_PIN) { - setPinInputHigh(pin); + gpio_set_pin_input_high(pin); } } } @@ -50,7 +50,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { pin_t pin = direct_pins[current_row][col_index]; if (pin != NO_PIN) { - current_matrix[current_row] |= readPin(pin) ? 0 : (MATRIX_ROW_SHIFTER << col_index); + current_matrix[current_row] |= gpio_read_pin(pin) ? 0 : (MATRIX_ROW_SHIFTER << col_index); } } @@ -97,94 +97,94 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) static void select_col(uint8_t col) { switch (col) { case 0: - writePinLow(F4); - writePinLow(F1); - writePinHigh(F0); - writePinHigh(F5); + gpio_write_pin_low(F4); + gpio_write_pin_low(F1); + gpio_write_pin_high(F0); + gpio_write_pin_high(F5); break; case 1: - writePinLow(F4); - writePinHigh(F1); - writePinLow(F0); - writePinHigh(F5); + gpio_write_pin_low(F4); + gpio_write_pin_high(F1); + gpio_write_pin_low(F0); + gpio_write_pin_high(F5); break; case 2: - writePinLow(F4); - writePinHigh(F1); - writePinHigh(F0); - writePinHigh(F5); + gpio_write_pin_low(F4); + gpio_write_pin_high(F1); + gpio_write_pin_high(F0); + gpio_write_pin_high(F5); break; case 3: - writePinHigh(F4); - writePinLow(F1); - writePinLow(F0); - writePinHigh(F5); + gpio_write_pin_high(F4); + gpio_write_pin_low(F1); + gpio_write_pin_low(F0); + gpio_write_pin_high(F5); break; case 4: - writePinHigh(F4); - writePinLow(F1); - writePinHigh(F0); - writePinHigh(F5); + gpio_write_pin_high(F4); + gpio_write_pin_low(F1); + gpio_write_pin_high(F0); + gpio_write_pin_high(F5); break; case 5: - writePinHigh(F4); - writePinHigh(F1); - writePinHigh(F0); - writePinHigh(F5); + gpio_write_pin_high(F4); + gpio_write_pin_high(F1); + gpio_write_pin_high(F0); + gpio_write_pin_high(F5); break; case 6: - writePinHigh(F4); - writePinHigh(F1); - writePinHigh(F0); - writePinHigh(F6); + gpio_write_pin_high(F4); + gpio_write_pin_high(F1); + gpio_write_pin_high(F0); + gpio_write_pin_high(F6); break; case 7: - writePinLow(F4); - writePinLow(F1); - writePinLow(F0); - writePinHigh(F6); + gpio_write_pin_low(F4); + gpio_write_pin_low(F1); + gpio_write_pin_low(F0); + gpio_write_pin_high(F6); break; case 8: - writePinLow(F4); - writePinLow(F1); - writePinHigh(F0); - writePinHigh(F6); + gpio_write_pin_low(F4); + gpio_write_pin_low(F1); + gpio_write_pin_high(F0); + gpio_write_pin_high(F6); break; case 9: - writePinLow(F4); - writePinHigh(F1); - writePinLow(F0); - writePinHigh(F6); + gpio_write_pin_low(F4); + gpio_write_pin_high(F1); + gpio_write_pin_low(F0); + gpio_write_pin_high(F6); break; case 10: - writePinLow(F4); - writePinHigh(F1); - writePinHigh(F0); - writePinHigh(F6); + gpio_write_pin_low(F4); + gpio_write_pin_high(F1); + gpio_write_pin_high(F0); + gpio_write_pin_high(F6); break; case 11: - writePinHigh(F4); - writePinLow(F1); - writePinLow(F0); - writePinHigh(F6); + gpio_write_pin_high(F4); + gpio_write_pin_low(F1); + gpio_write_pin_low(F0); + gpio_write_pin_high(F6); break; case 12: - writePinHigh(F4); - writePinLow(F1); - writePinHigh(F0); - writePinHigh(F6); + gpio_write_pin_high(F4); + gpio_write_pin_low(F1); + gpio_write_pin_high(F0); + gpio_write_pin_high(F6); break; case 13: - writePinHigh(F4); - writePinHigh(F1); - writePinLow(F0); - writePinHigh(F6); + gpio_write_pin_high(F4); + gpio_write_pin_high(F1); + gpio_write_pin_low(F0); + gpio_write_pin_high(F6); break; case 14: - writePinLow(F4); - writePinLow(F1); - writePinLow(F0); - writePinHigh(F5); + gpio_write_pin_low(F4); + gpio_write_pin_low(F1); + gpio_write_pin_low(F0); + gpio_write_pin_high(F5); break; } } @@ -192,94 +192,94 @@ static void select_col(uint8_t col) { static void unselect_col(uint8_t col) { switch (col) { case 0: - writePinHigh(F4); - writePinHigh(F1); - writePinLow(F0); - writePinLow(F5); + gpio_write_pin_high(F4); + gpio_write_pin_high(F1); + gpio_write_pin_low(F0); + gpio_write_pin_low(F5); break; case 1: - writePinHigh(F4); - writePinLow(F1); - writePinHigh(F0); - writePinLow(F5); + gpio_write_pin_high(F4); + gpio_write_pin_low(F1); + gpio_write_pin_high(F0); + gpio_write_pin_low(F5); break; case 2: - writePinHigh(F4); - writePinLow(F1); - writePinLow(F0); - writePinLow(F5); + gpio_write_pin_high(F4); + gpio_write_pin_low(F1); + gpio_write_pin_low(F0); + gpio_write_pin_low(F5); break; case 3: - writePinLow(F4); - writePinHigh(F1); - writePinHigh(F0); - writePinLow(F5); + gpio_write_pin_low(F4); + gpio_write_pin_high(F1); + gpio_write_pin_high(F0); + gpio_write_pin_low(F5); break; case 4: - writePinLow(F4); - writePinHigh(F1); - writePinLow(F0); - writePinLow(F5); + gpio_write_pin_low(F4); + gpio_write_pin_high(F1); + gpio_write_pin_low(F0); + gpio_write_pin_low(F5); break; case 5: - writePinLow(F4); - writePinLow(F1); - writePinLow(F0); - writePinLow(F5); + gpio_write_pin_low(F4); + gpio_write_pin_low(F1); + gpio_write_pin_low(F0); + gpio_write_pin_low(F5); break; case 6: - writePinLow(F4); - writePinLow(F1); - writePinLow(F0); - writePinLow(F6); + gpio_write_pin_low(F4); + gpio_write_pin_low(F1); + gpio_write_pin_low(F0); + gpio_write_pin_low(F6); break; case 7: - writePinHigh(F4); - writePinHigh(F1); - writePinHigh(F0); - writePinLow(F6); + gpio_write_pin_high(F4); + gpio_write_pin_high(F1); + gpio_write_pin_high(F0); + gpio_write_pin_low(F6); break; case 8: - writePinHigh(F4); - writePinHigh(F1); - writePinLow(F0); - writePinLow(F6); + gpio_write_pin_high(F4); + gpio_write_pin_high(F1); + gpio_write_pin_low(F0); + gpio_write_pin_low(F6); break; case 9: - writePinHigh(F4); - writePinLow(F1); - writePinHigh(F0); - writePinLow(F6); + gpio_write_pin_high(F4); + gpio_write_pin_low(F1); + gpio_write_pin_high(F0); + gpio_write_pin_low(F6); break; case 10: - writePinHigh(F4); - writePinLow(F1); - writePinLow(F0); - writePinLow(F6); + gpio_write_pin_high(F4); + gpio_write_pin_low(F1); + gpio_write_pin_low(F0); + gpio_write_pin_low(F6); break; case 11: - writePinLow(F4); - writePinHigh(F1); - writePinHigh(F0); - writePinLow(F6); + gpio_write_pin_low(F4); + gpio_write_pin_high(F1); + gpio_write_pin_high(F0); + gpio_write_pin_low(F6); break; case 12: - writePinLow(F4); - writePinHigh(F1); - writePinLow(F0); - writePinLow(F6); + gpio_write_pin_low(F4); + gpio_write_pin_high(F1); + gpio_write_pin_low(F0); + gpio_write_pin_low(F6); break; case 13: - writePinLow(F4); - writePinLow(F1); - writePinHigh(F0); - writePinLow(F6); + gpio_write_pin_low(F4); + gpio_write_pin_low(F1); + gpio_write_pin_high(F0); + gpio_write_pin_low(F6); break; case 14: - writePinHigh(F4); - writePinHigh(F1); - writePinHigh(F0); - writePinLow(F5); + gpio_write_pin_high(F4); + gpio_write_pin_high(F1); + gpio_write_pin_high(F0); + gpio_write_pin_low(F5); break; } } @@ -287,23 +287,23 @@ static void unselect_col(uint8_t col) { static void unselect_cols(void) { //Demultiplexer - writePinHigh(F0); - writePinHigh(F1); - writePinHigh(F4); - writePinLow(F5); - writePinLow(F6); + gpio_write_pin_high(F0); + gpio_write_pin_high(F1); + gpio_write_pin_high(F4); + gpio_write_pin_low(F5); + gpio_write_pin_low(F6); } static void init_pins(void) { unselect_cols(); for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } - setPinOutput(F0); - setPinOutput(F1); - setPinOutput(F4); - setPinOutput(F5); - setPinOutput(F6); + gpio_set_pin_output(F0); + gpio_set_pin_output(F1); + gpio_set_pin_output(F4); + gpio_set_pin_output(F5); + gpio_set_pin_output(F6); } static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) { @@ -319,7 +319,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) matrix_row_t last_row_value = current_matrix[row_index]; // Check row pin state - if (readPin(row_pins[row_index]) == 0) { + if (gpio_read_pin(row_pins[row_index]) == 0) { // Pin LO, set col bit current_matrix[row_index] |= (MATRIX_ROW_SHIFTER << current_col); } else { diff --git a/keyboards/mechlovin/hannah910/hannah910.c b/keyboards/mechlovin/hannah910/hannah910.c index 0208e16348..c372c98ce0 100644 --- a/keyboards/mechlovin/hannah910/hannah910.c +++ b/keyboards/mechlovin/hannah910/hannah910.c @@ -16,17 +16,17 @@ #include "quantum.h" void led_init_ports(void) { - setPinOutput(B2); - setPinOutput(D0); - setPinOutput(D1); - setPinOutput(D2); + gpio_set_pin_output(B2); + gpio_set_pin_output(D0); + gpio_set_pin_output(D1); + gpio_set_pin_output(D2); } bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if(res) { - writePin(B2, led_state.caps_lock); + gpio_write_pin(B2, led_state.caps_lock); } return res; } @@ -35,22 +35,22 @@ layer_state_t layer_state_set_user(layer_state_t state) { // if on layer 1, turn on D2 LED, otherwise off. if (get_highest_layer(state) == 1) { - writePinHigh(D2); + gpio_write_pin_high(D2); } else { - writePinLow(D2); + gpio_write_pin_low(D2); } // if on layer 2, turn on D1 LED, otherwise off. if (get_highest_layer(state) == 2) { - writePinHigh(D1); + gpio_write_pin_high(D1); } else { - writePinLow(D1); + gpio_write_pin_low(D1); } // if on layer 3, turn on D0 LED, otherwise off. if (get_highest_layer(state) == 3) { - writePinHigh(D0); + gpio_write_pin_high(D0); } else { - writePinLow(D0); + gpio_write_pin_low(D0); } return state; diff --git a/keyboards/mechlovin/infinity87/rev2/matrix.c b/keyboards/mechlovin/infinity87/rev2/matrix.c index 62a56f687c..16bee61ad0 100644 --- a/keyboards/mechlovin/infinity87/rev2/matrix.c +++ b/keyboards/mechlovin/infinity87/rev2/matrix.c @@ -37,7 +37,7 @@ static void init_pins(void) { for (int col = 0; col < MATRIX_COLS; col++) { pin_t pin = direct_pins[row][col]; if (pin != NO_PIN) { - setPinInputHigh(pin); + gpio_set_pin_input_high(pin); } } } @@ -50,7 +50,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { pin_t pin = direct_pins[current_row][col_index]; if (pin != NO_PIN) { - current_matrix[current_row] |= readPin(pin) ? 0 : (MATRIX_ROW_SHIFTER << col_index); + current_matrix[current_row] |= gpio_read_pin(pin) ? 0 : (MATRIX_ROW_SHIFTER << col_index); } } @@ -101,103 +101,103 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) static void select_col(uint8_t col) { switch (col) { case 0: - writePinLow(B5); - writePinLow(B7); - writePinLow(F0); - writePinHigh(B0); + gpio_write_pin_low(B5); + gpio_write_pin_low(B7); + gpio_write_pin_low(F0); + gpio_write_pin_high(B0); break; case 1: - writePinLow(B5); - writePinLow(B7); - writePinHigh(F0); - writePinHigh(B0); + gpio_write_pin_low(B5); + gpio_write_pin_low(B7); + gpio_write_pin_high(F0); + gpio_write_pin_high(B0); break; case 2: - writePinLow(B5); - writePinHigh(B7); - writePinLow(F0); - writePinHigh(B0); + gpio_write_pin_low(B5); + gpio_write_pin_high(B7); + gpio_write_pin_low(F0); + gpio_write_pin_high(B0); break; case 3: - writePinLow(B5); - writePinHigh(B7); - writePinHigh(F0); - writePinHigh(B0); + gpio_write_pin_low(B5); + gpio_write_pin_high(B7); + gpio_write_pin_high(F0); + gpio_write_pin_high(B0); break; case 4: - writePinHigh(B5); - writePinLow(B7); - writePinLow(F0); - writePinHigh(B0); + gpio_write_pin_high(B5); + gpio_write_pin_low(B7); + gpio_write_pin_low(F0); + gpio_write_pin_high(B0); break; case 5: - writePinHigh(B5); - writePinLow(B7); - writePinHigh(F0); - writePinHigh(B0); + gpio_write_pin_high(B5); + gpio_write_pin_low(B7); + gpio_write_pin_high(F0); + gpio_write_pin_high(B0); break; case 6: - writePinHigh(B5); - writePinHigh(B7); - writePinLow(F0); - writePinHigh(B0); + gpio_write_pin_high(B5); + gpio_write_pin_high(B7); + gpio_write_pin_low(F0); + gpio_write_pin_high(B0); break; case 7: - writePinHigh(B5); - writePinHigh(B7); - writePinHigh(F0); - writePinHigh(B0); + gpio_write_pin_high(B5); + gpio_write_pin_high(B7); + gpio_write_pin_high(F0); + gpio_write_pin_high(B0); break; case 8: - writePinLow(B5); - writePinLow(B7); - writePinLow(F0); - writePinHigh(F1); + gpio_write_pin_low(B5); + gpio_write_pin_low(B7); + gpio_write_pin_low(F0); + gpio_write_pin_high(F1); break; case 9: - writePinLow(B5); - writePinLow(B7); - writePinHigh(F0); - writePinHigh(F1); + gpio_write_pin_low(B5); + gpio_write_pin_low(B7); + gpio_write_pin_high(F0); + gpio_write_pin_high(F1); break; case 10: - writePinLow(B5); - writePinHigh(B7); - writePinLow(F0); - writePinHigh(F1); + gpio_write_pin_low(B5); + gpio_write_pin_high(B7); + gpio_write_pin_low(F0); + gpio_write_pin_high(F1); break; case 11: - writePinLow(B5); - writePinHigh(B7); - writePinHigh(F0); - writePinHigh(F1); + gpio_write_pin_low(B5); + gpio_write_pin_high(B7); + gpio_write_pin_high(F0); + gpio_write_pin_high(F1); break; case 12: - writePinHigh(B5); - writePinLow(B7); - writePinLow(F0); - writePinHigh(F1); + gpio_write_pin_high(B5); + gpio_write_pin_low(B7); + gpio_write_pin_low(F0); + gpio_write_pin_high(F1); break; case 13: - writePinHigh(B5); - writePinLow(B7); - writePinHigh(F0); - writePinHigh(F1); + gpio_write_pin_high(B5); + gpio_write_pin_low(B7); + gpio_write_pin_high(F0); + gpio_write_pin_high(F1); break; case 14: - writePinHigh(B5); - writePinHigh(B7); - writePinHigh(F0); - writePinHigh(F1); + gpio_write_pin_high(B5); + gpio_write_pin_high(B7); + gpio_write_pin_high(F0); + gpio_write_pin_high(F1); break; case 15: - writePinHigh(B5); - writePinHigh(B7); - writePinLow(F0); - writePinHigh(F1); + gpio_write_pin_high(B5); + gpio_write_pin_high(B7); + gpio_write_pin_low(F0); + gpio_write_pin_high(F1); break; case 16: - writePinLow(E6); + gpio_write_pin_low(E6); break; } } @@ -205,130 +205,130 @@ static void select_col(uint8_t col) { static void unselect_col(uint8_t col) { switch (col) { case 0: - writePinHigh(B5); - writePinHigh(B7); - writePinHigh(F0); - writePinLow(B0); + gpio_write_pin_high(B5); + gpio_write_pin_high(B7); + gpio_write_pin_high(F0); + gpio_write_pin_low(B0); break; case 1: - writePinHigh(B5); - writePinHigh(B7); - writePinLow(F0); - writePinLow(B0); + gpio_write_pin_high(B5); + gpio_write_pin_high(B7); + gpio_write_pin_low(F0); + gpio_write_pin_low(B0); break; case 2: - writePinHigh(B5); - writePinLow(B7); - writePinHigh(F0); - writePinLow(B0); + gpio_write_pin_high(B5); + gpio_write_pin_low(B7); + gpio_write_pin_high(F0); + gpio_write_pin_low(B0); break; case 3: - writePinHigh(B5); - writePinLow(B7); - writePinLow(F0); - writePinLow(B0); + gpio_write_pin_high(B5); + gpio_write_pin_low(B7); + gpio_write_pin_low(F0); + gpio_write_pin_low(B0); break; case 4: - writePinLow(B5); - writePinHigh(B7); - writePinHigh(F0); - writePinLow(B0); + gpio_write_pin_low(B5); + gpio_write_pin_high(B7); + gpio_write_pin_high(F0); + gpio_write_pin_low(B0); break; case 5: - writePinLow(B5); - writePinHigh(B7); - writePinLow(F0); - writePinLow(B0); + gpio_write_pin_low(B5); + gpio_write_pin_high(B7); + gpio_write_pin_low(F0); + gpio_write_pin_low(B0); break; case 6: - writePinLow(B5); - writePinLow(B7); - writePinHigh(F0); - writePinLow(B0); + gpio_write_pin_low(B5); + gpio_write_pin_low(B7); + gpio_write_pin_high(F0); + gpio_write_pin_low(B0); break; case 7: - writePinLow(B5); - writePinLow(B7); - writePinLow(F0); - writePinLow(B0); + gpio_write_pin_low(B5); + gpio_write_pin_low(B7); + gpio_write_pin_low(F0); + gpio_write_pin_low(B0); break; case 8: - writePinHigh(B5); - writePinHigh(B7); - writePinHigh(F0); - writePinLow(F1); + gpio_write_pin_high(B5); + gpio_write_pin_high(B7); + gpio_write_pin_high(F0); + gpio_write_pin_low(F1); break; case 9: - writePinHigh(B5); - writePinHigh(B7); - writePinLow(F0); - writePinLow(F1); + gpio_write_pin_high(B5); + gpio_write_pin_high(B7); + gpio_write_pin_low(F0); + gpio_write_pin_low(F1); break; case 10: - writePinHigh(B5); - writePinLow(B7); - writePinHigh(F0); - writePinLow(F1); + gpio_write_pin_high(B5); + gpio_write_pin_low(B7); + gpio_write_pin_high(F0); + gpio_write_pin_low(F1); break; case 11: - writePinHigh(B5); - writePinLow(B7); - writePinLow(F0); - writePinLow(F1); + gpio_write_pin_high(B5); + gpio_write_pin_low(B7); + gpio_write_pin_low(F0); + gpio_write_pin_low(F1); break; case 12: - writePinLow(B5); - writePinHigh(B7); - writePinHigh(F0); - writePinLow(F1); + gpio_write_pin_low(B5); + gpio_write_pin_high(B7); + gpio_write_pin_high(F0); + gpio_write_pin_low(F1); break; case 13: - writePinLow(B5); - writePinHigh(B7); - writePinLow(F0); - writePinLow(F1); + gpio_write_pin_low(B5); + gpio_write_pin_high(B7); + gpio_write_pin_low(F0); + gpio_write_pin_low(F1); break; case 14: - writePinLow(B5); - writePinLow(B7); - writePinLow(F0); - writePinLow(F1); + gpio_write_pin_low(B5); + gpio_write_pin_low(B7); + gpio_write_pin_low(F0); + gpio_write_pin_low(F1); break; case 15: - writePinLow(B5); - writePinLow(B7); - writePinHigh(F0); - writePinLow(F1); + gpio_write_pin_low(B5); + gpio_write_pin_low(B7); + gpio_write_pin_high(F0); + gpio_write_pin_low(F1); break; case 16: - writePinHigh(E6); + gpio_write_pin_high(E6); break; } } static void unselect_cols(void) { //Native - writePinHigh(E6); + gpio_write_pin_high(E6); //Demultiplexer - writePinLow(B0); - writePinLow(F1); - writePinHigh(B5); - writePinHigh(B7); - writePinHigh(F0); + gpio_write_pin_low(B0); + gpio_write_pin_low(F1); + gpio_write_pin_high(B5); + gpio_write_pin_high(B7); + gpio_write_pin_high(F0); } static void init_pins(void) { unselect_cols(); for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } - setPinOutput(B5); - setPinOutput(B7); - setPinOutput(F0); - setPinOutput(B0); - setPinOutput(F1); - setPinOutput(E6); + gpio_set_pin_output(B5); + gpio_set_pin_output(B7); + gpio_set_pin_output(F0); + gpio_set_pin_output(B0); + gpio_set_pin_output(F1); + gpio_set_pin_output(E6); } static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) { @@ -344,7 +344,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) matrix_row_t last_row_value = current_matrix[row_index]; // Check row pin state - if (readPin(row_pins[row_index]) == 0) { + if (gpio_read_pin(row_pins[row_index]) == 0) { // Pin LO, set col bit current_matrix[row_index] |= (MATRIX_ROW_SHIFTER << current_col); } else { diff --git a/keyboards/mechlovin/infinity875/matrix.c b/keyboards/mechlovin/infinity875/matrix.c index 62a56f687c..16bee61ad0 100644 --- a/keyboards/mechlovin/infinity875/matrix.c +++ b/keyboards/mechlovin/infinity875/matrix.c @@ -37,7 +37,7 @@ static void init_pins(void) { for (int col = 0; col < MATRIX_COLS; col++) { pin_t pin = direct_pins[row][col]; if (pin != NO_PIN) { - setPinInputHigh(pin); + gpio_set_pin_input_high(pin); } } } @@ -50,7 +50,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { pin_t pin = direct_pins[current_row][col_index]; if (pin != NO_PIN) { - current_matrix[current_row] |= readPin(pin) ? 0 : (MATRIX_ROW_SHIFTER << col_index); + current_matrix[current_row] |= gpio_read_pin(pin) ? 0 : (MATRIX_ROW_SHIFTER << col_index); } } @@ -101,103 +101,103 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) static void select_col(uint8_t col) { switch (col) { case 0: - writePinLow(B5); - writePinLow(B7); - writePinLow(F0); - writePinHigh(B0); + gpio_write_pin_low(B5); + gpio_write_pin_low(B7); + gpio_write_pin_low(F0); + gpio_write_pin_high(B0); break; case 1: - writePinLow(B5); - writePinLow(B7); - writePinHigh(F0); - writePinHigh(B0); + gpio_write_pin_low(B5); + gpio_write_pin_low(B7); + gpio_write_pin_high(F0); + gpio_write_pin_high(B0); break; case 2: - writePinLow(B5); - writePinHigh(B7); - writePinLow(F0); - writePinHigh(B0); + gpio_write_pin_low(B5); + gpio_write_pin_high(B7); + gpio_write_pin_low(F0); + gpio_write_pin_high(B0); break; case 3: - writePinLow(B5); - writePinHigh(B7); - writePinHigh(F0); - writePinHigh(B0); + gpio_write_pin_low(B5); + gpio_write_pin_high(B7); + gpio_write_pin_high(F0); + gpio_write_pin_high(B0); break; case 4: - writePinHigh(B5); - writePinLow(B7); - writePinLow(F0); - writePinHigh(B0); + gpio_write_pin_high(B5); + gpio_write_pin_low(B7); + gpio_write_pin_low(F0); + gpio_write_pin_high(B0); break; case 5: - writePinHigh(B5); - writePinLow(B7); - writePinHigh(F0); - writePinHigh(B0); + gpio_write_pin_high(B5); + gpio_write_pin_low(B7); + gpio_write_pin_high(F0); + gpio_write_pin_high(B0); break; case 6: - writePinHigh(B5); - writePinHigh(B7); - writePinLow(F0); - writePinHigh(B0); + gpio_write_pin_high(B5); + gpio_write_pin_high(B7); + gpio_write_pin_low(F0); + gpio_write_pin_high(B0); break; case 7: - writePinHigh(B5); - writePinHigh(B7); - writePinHigh(F0); - writePinHigh(B0); + gpio_write_pin_high(B5); + gpio_write_pin_high(B7); + gpio_write_pin_high(F0); + gpio_write_pin_high(B0); break; case 8: - writePinLow(B5); - writePinLow(B7); - writePinLow(F0); - writePinHigh(F1); + gpio_write_pin_low(B5); + gpio_write_pin_low(B7); + gpio_write_pin_low(F0); + gpio_write_pin_high(F1); break; case 9: - writePinLow(B5); - writePinLow(B7); - writePinHigh(F0); - writePinHigh(F1); + gpio_write_pin_low(B5); + gpio_write_pin_low(B7); + gpio_write_pin_high(F0); + gpio_write_pin_high(F1); break; case 10: - writePinLow(B5); - writePinHigh(B7); - writePinLow(F0); - writePinHigh(F1); + gpio_write_pin_low(B5); + gpio_write_pin_high(B7); + gpio_write_pin_low(F0); + gpio_write_pin_high(F1); break; case 11: - writePinLow(B5); - writePinHigh(B7); - writePinHigh(F0); - writePinHigh(F1); + gpio_write_pin_low(B5); + gpio_write_pin_high(B7); + gpio_write_pin_high(F0); + gpio_write_pin_high(F1); break; case 12: - writePinHigh(B5); - writePinLow(B7); - writePinLow(F0); - writePinHigh(F1); + gpio_write_pin_high(B5); + gpio_write_pin_low(B7); + gpio_write_pin_low(F0); + gpio_write_pin_high(F1); break; case 13: - writePinHigh(B5); - writePinLow(B7); - writePinHigh(F0); - writePinHigh(F1); + gpio_write_pin_high(B5); + gpio_write_pin_low(B7); + gpio_write_pin_high(F0); + gpio_write_pin_high(F1); break; case 14: - writePinHigh(B5); - writePinHigh(B7); - writePinHigh(F0); - writePinHigh(F1); + gpio_write_pin_high(B5); + gpio_write_pin_high(B7); + gpio_write_pin_high(F0); + gpio_write_pin_high(F1); break; case 15: - writePinHigh(B5); - writePinHigh(B7); - writePinLow(F0); - writePinHigh(F1); + gpio_write_pin_high(B5); + gpio_write_pin_high(B7); + gpio_write_pin_low(F0); + gpio_write_pin_high(F1); break; case 16: - writePinLow(E6); + gpio_write_pin_low(E6); break; } } @@ -205,130 +205,130 @@ static void select_col(uint8_t col) { static void unselect_col(uint8_t col) { switch (col) { case 0: - writePinHigh(B5); - writePinHigh(B7); - writePinHigh(F0); - writePinLow(B0); + gpio_write_pin_high(B5); + gpio_write_pin_high(B7); + gpio_write_pin_high(F0); + gpio_write_pin_low(B0); break; case 1: - writePinHigh(B5); - writePinHigh(B7); - writePinLow(F0); - writePinLow(B0); + gpio_write_pin_high(B5); + gpio_write_pin_high(B7); + gpio_write_pin_low(F0); + gpio_write_pin_low(B0); break; case 2: - writePinHigh(B5); - writePinLow(B7); - writePinHigh(F0); - writePinLow(B0); + gpio_write_pin_high(B5); + gpio_write_pin_low(B7); + gpio_write_pin_high(F0); + gpio_write_pin_low(B0); break; case 3: - writePinHigh(B5); - writePinLow(B7); - writePinLow(F0); - writePinLow(B0); + gpio_write_pin_high(B5); + gpio_write_pin_low(B7); + gpio_write_pin_low(F0); + gpio_write_pin_low(B0); break; case 4: - writePinLow(B5); - writePinHigh(B7); - writePinHigh(F0); - writePinLow(B0); + gpio_write_pin_low(B5); + gpio_write_pin_high(B7); + gpio_write_pin_high(F0); + gpio_write_pin_low(B0); break; case 5: - writePinLow(B5); - writePinHigh(B7); - writePinLow(F0); - writePinLow(B0); + gpio_write_pin_low(B5); + gpio_write_pin_high(B7); + gpio_write_pin_low(F0); + gpio_write_pin_low(B0); break; case 6: - writePinLow(B5); - writePinLow(B7); - writePinHigh(F0); - writePinLow(B0); + gpio_write_pin_low(B5); + gpio_write_pin_low(B7); + gpio_write_pin_high(F0); + gpio_write_pin_low(B0); break; case 7: - writePinLow(B5); - writePinLow(B7); - writePinLow(F0); - writePinLow(B0); + gpio_write_pin_low(B5); + gpio_write_pin_low(B7); + gpio_write_pin_low(F0); + gpio_write_pin_low(B0); break; case 8: - writePinHigh(B5); - writePinHigh(B7); - writePinHigh(F0); - writePinLow(F1); + gpio_write_pin_high(B5); + gpio_write_pin_high(B7); + gpio_write_pin_high(F0); + gpio_write_pin_low(F1); break; case 9: - writePinHigh(B5); - writePinHigh(B7); - writePinLow(F0); - writePinLow(F1); + gpio_write_pin_high(B5); + gpio_write_pin_high(B7); + gpio_write_pin_low(F0); + gpio_write_pin_low(F1); break; case 10: - writePinHigh(B5); - writePinLow(B7); - writePinHigh(F0); - writePinLow(F1); + gpio_write_pin_high(B5); + gpio_write_pin_low(B7); + gpio_write_pin_high(F0); + gpio_write_pin_low(F1); break; case 11: - writePinHigh(B5); - writePinLow(B7); - writePinLow(F0); - writePinLow(F1); + gpio_write_pin_high(B5); + gpio_write_pin_low(B7); + gpio_write_pin_low(F0); + gpio_write_pin_low(F1); break; case 12: - writePinLow(B5); - writePinHigh(B7); - writePinHigh(F0); - writePinLow(F1); + gpio_write_pin_low(B5); + gpio_write_pin_high(B7); + gpio_write_pin_high(F0); + gpio_write_pin_low(F1); break; case 13: - writePinLow(B5); - writePinHigh(B7); - writePinLow(F0); - writePinLow(F1); + gpio_write_pin_low(B5); + gpio_write_pin_high(B7); + gpio_write_pin_low(F0); + gpio_write_pin_low(F1); break; case 14: - writePinLow(B5); - writePinLow(B7); - writePinLow(F0); - writePinLow(F1); + gpio_write_pin_low(B5); + gpio_write_pin_low(B7); + gpio_write_pin_low(F0); + gpio_write_pin_low(F1); break; case 15: - writePinLow(B5); - writePinLow(B7); - writePinHigh(F0); - writePinLow(F1); + gpio_write_pin_low(B5); + gpio_write_pin_low(B7); + gpio_write_pin_high(F0); + gpio_write_pin_low(F1); break; case 16: - writePinHigh(E6); + gpio_write_pin_high(E6); break; } } static void unselect_cols(void) { //Native - writePinHigh(E6); + gpio_write_pin_high(E6); //Demultiplexer - writePinLow(B0); - writePinLow(F1); - writePinHigh(B5); - writePinHigh(B7); - writePinHigh(F0); + gpio_write_pin_low(B0); + gpio_write_pin_low(F1); + gpio_write_pin_high(B5); + gpio_write_pin_high(B7); + gpio_write_pin_high(F0); } static void init_pins(void) { unselect_cols(); for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } - setPinOutput(B5); - setPinOutput(B7); - setPinOutput(F0); - setPinOutput(B0); - setPinOutput(F1); - setPinOutput(E6); + gpio_set_pin_output(B5); + gpio_set_pin_output(B7); + gpio_set_pin_output(F0); + gpio_set_pin_output(B0); + gpio_set_pin_output(F1); + gpio_set_pin_output(E6); } static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) { @@ -344,7 +344,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) matrix_row_t last_row_value = current_matrix[row_index]; // Check row pin state - if (readPin(row_pins[row_index]) == 0) { + if (gpio_read_pin(row_pins[row_index]) == 0) { // Pin LO, set col bit current_matrix[row_index] |= (MATRIX_ROW_SHIFTER << current_col); } else { diff --git a/keyboards/mechlovin/infinityce/infinityce.c b/keyboards/mechlovin/infinityce/infinityce.c index 36f533fc2a..f1a9181a96 100644 --- a/keyboards/mechlovin/infinityce/infinityce.c +++ b/keyboards/mechlovin/infinityce/infinityce.c @@ -18,12 +18,12 @@ void led_init_ports(void) { // * Set our LED pins as output - setPinOutput(B3); + gpio_set_pin_output(B3); } bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if(res) { - writePin(B3, led_state.caps_lock); + gpio_write_pin(B3, led_state.caps_lock); rgblight_set_effect_range(1, 30); if (led_state.scroll_lock) { rgblight_setrgb_at(255, 255, 255, 0); diff --git a/keyboards/mechlovin/kanu/kanu.c b/keyboards/mechlovin/kanu/kanu.c index 67bf8f88fb..8622a38a22 100644 --- a/keyboards/mechlovin/kanu/kanu.c +++ b/keyboards/mechlovin/kanu/kanu.c @@ -17,15 +17,15 @@ #include "quantum.h" void led_init_ports(void) { - setPinOutput(B2); - setPinOutput(D0); - setPinOutput(D1); - setPinOutput(D2); + gpio_set_pin_output(B2); + gpio_set_pin_output(D0); + gpio_set_pin_output(D1); + gpio_set_pin_output(D2); } bool led_update_kb(led_t led_state) { if(led_update_user(led_state)) { - writePin(B2, led_state.caps_lock); + gpio_write_pin(B2, led_state.caps_lock); } return true; @@ -34,10 +34,10 @@ bool led_update_kb(led_t led_state) { __attribute__((weak)) layer_state_t layer_state_set_user(layer_state_t state) { // if on layer 1, turn on D2 LED, otherwise off. - writePin(D2, get_highest_layer(state) == 1); + gpio_write_pin(D2, get_highest_layer(state) == 1); // if on layer 2, turn on D1 LED, otherwise off. - writePin(D1, get_highest_layer(state) == 2); + gpio_write_pin(D1, get_highest_layer(state) == 2); // if on layer 3, turn on D0 LED, otherwise off. - writePin(D0, get_highest_layer(state) == 3); + gpio_write_pin(D0, get_highest_layer(state) == 3); return state; } diff --git a/keyboards/mechlovin/kay65/kay65.c b/keyboards/mechlovin/kay65/kay65.c index 591c618c6c..f59f23e13d 100644 --- a/keyboards/mechlovin/kay65/kay65.c +++ b/keyboards/mechlovin/kay65/kay65.c @@ -21,5 +21,5 @@ void keyboard_pre_init_user(void) { // Call the keyboard pre init code. // Set our LED pins as output - setPinOutput(D7); + gpio_set_pin_output(D7); } diff --git a/keyboards/mechlovin/olly/bb/bb.c b/keyboards/mechlovin/olly/bb/bb.c index dac77ff623..f9dcf211a1 100644 --- a/keyboards/mechlovin/olly/bb/bb.c +++ b/keyboards/mechlovin/olly/bb/bb.c @@ -17,19 +17,19 @@ #include "quantum.h" void led_init_ports(void) { - setPinOutput(C0); - setPinOutput(D0); - setPinOutput(D1); - setPinOutput(C1); - setPinOutput(C6); + gpio_set_pin_output(C0); + gpio_set_pin_output(D0); + gpio_set_pin_output(D1); + gpio_set_pin_output(C1); + gpio_set_pin_output(C6); } __attribute__((weak)) layer_state_t layer_state_set_user(layer_state_t state) { - writePin(D1, layer_state_cmp(state, 1)); - writePin(D0, layer_state_cmp(state, 2)); - writePin(C1, layer_state_cmp(state, 3)); - writePin(C0, layer_state_cmp(state, 4)); - writePin(C6, layer_state_cmp(state, 5)); + gpio_write_pin(D1, layer_state_cmp(state, 1)); + gpio_write_pin(D0, layer_state_cmp(state, 2)); + gpio_write_pin(C1, layer_state_cmp(state, 3)); + gpio_write_pin(C0, layer_state_cmp(state, 4)); + gpio_write_pin(C6, layer_state_cmp(state, 5)); return state; } diff --git a/keyboards/mechlovin/olly/bb/matrix.c b/keyboards/mechlovin/olly/bb/matrix.c index e045299bae..ecb6cf9e74 100644 --- a/keyboards/mechlovin/olly/bb/matrix.c +++ b/keyboards/mechlovin/olly/bb/matrix.c @@ -67,109 +67,109 @@ static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; static void select_col(uint8_t col) { switch (col) { case 0: - writePinLow(A0); - writePinLow(A1); - writePinLow(A2); - writePinHigh(B4); + gpio_write_pin_low(A0); + gpio_write_pin_low(A1); + gpio_write_pin_low(A2); + gpio_write_pin_high(B4); break; case 1: - writePinLow(A0); - writePinLow(A1); - writePinHigh(A2); - writePinHigh(B4); + gpio_write_pin_low(A0); + gpio_write_pin_low(A1); + gpio_write_pin_high(A2); + gpio_write_pin_high(B4); break; case 2: - writePinLow(A0); - writePinHigh(A1); - writePinLow(A2); - writePinHigh(B4); + gpio_write_pin_low(A0); + gpio_write_pin_high(A1); + gpio_write_pin_low(A2); + gpio_write_pin_high(B4); break; case 3: - writePinLow(A0); - writePinHigh(A1); - writePinHigh(A2); - writePinHigh(B4); + gpio_write_pin_low(A0); + gpio_write_pin_high(A1); + gpio_write_pin_high(A2); + gpio_write_pin_high(B4); break; case 4: - writePinHigh(A0); - writePinLow(A1); - writePinLow(A2); - writePinHigh(B4); + gpio_write_pin_high(A0); + gpio_write_pin_low(A1); + gpio_write_pin_low(A2); + gpio_write_pin_high(B4); break; case 5: - writePinHigh(A0); - writePinLow(A1); - writePinHigh(A2); - writePinHigh(B4); + gpio_write_pin_high(A0); + gpio_write_pin_low(A1); + gpio_write_pin_high(A2); + gpio_write_pin_high(B4); break; case 6: - writePinHigh(A0); - writePinHigh(A1); - writePinLow(A2); - writePinHigh(B4); + gpio_write_pin_high(A0); + gpio_write_pin_high(A1); + gpio_write_pin_low(A2); + gpio_write_pin_high(B4); break; case 7: - writePinHigh(A0); - writePinHigh(A1); - writePinHigh(A2); - writePinHigh(B4); + gpio_write_pin_high(A0); + gpio_write_pin_high(A1); + gpio_write_pin_high(A2); + gpio_write_pin_high(B4); break; case 8: - writePinHigh(A0); - writePinHigh(A1); - writePinHigh(A2); - writePinHigh(C7); + gpio_write_pin_high(A0); + gpio_write_pin_high(A1); + gpio_write_pin_high(A2); + gpio_write_pin_high(C7); break; case 9: - writePinLow(A0); - writePinLow(A1); - writePinLow(A2); - writePinHigh(C7); + gpio_write_pin_low(A0); + gpio_write_pin_low(A1); + gpio_write_pin_low(A2); + gpio_write_pin_high(C7); break; case 10: - writePinLow(A0); - writePinLow(A1); - writePinHigh(A2); - writePinHigh(C7); + gpio_write_pin_low(A0); + gpio_write_pin_low(A1); + gpio_write_pin_high(A2); + gpio_write_pin_high(C7); break; case 11: - writePinLow(A0); - writePinHigh(A1); - writePinLow(A2); - writePinHigh(C7); + gpio_write_pin_low(A0); + gpio_write_pin_high(A1); + gpio_write_pin_low(A2); + gpio_write_pin_high(C7); break; case 12: - writePinLow(A0); - writePinHigh(A1); - writePinHigh(A2); - writePinHigh(C7); + gpio_write_pin_low(A0); + gpio_write_pin_high(A1); + gpio_write_pin_high(A2); + gpio_write_pin_high(C7); break; case 13: - writePinHigh(A0); - writePinLow(A1); - writePinLow(A2); - writePinHigh(C7); + gpio_write_pin_high(A0); + gpio_write_pin_low(A1); + gpio_write_pin_low(A2); + gpio_write_pin_high(C7); break; case 14: - writePinHigh(A0); - writePinLow(A1); - writePinHigh(A2); - writePinHigh(C7); + gpio_write_pin_high(A0); + gpio_write_pin_low(A1); + gpio_write_pin_high(A2); + gpio_write_pin_high(C7); break; case 15: - writePinHigh(A0); - writePinHigh(A1); - writePinLow(A2); - writePinHigh(C7); + gpio_write_pin_high(A0); + gpio_write_pin_high(A1); + gpio_write_pin_low(A2); + gpio_write_pin_high(C7); break; case 16: - writePinLow(C2); + gpio_write_pin_low(C2); break; case 17: - writePinLow(C3); + gpio_write_pin_low(C3); break; case 18: - writePinLow(C5); + gpio_write_pin_low(C5); break; } } @@ -177,140 +177,140 @@ static void select_col(uint8_t col) { static void unselect_col(uint8_t col) { switch (col) { case 0: - writePinHigh(A0); - writePinHigh(A1); - writePinHigh(A2); - writePinLow(B4); + gpio_write_pin_high(A0); + gpio_write_pin_high(A1); + gpio_write_pin_high(A2); + gpio_write_pin_low(B4); break; case 1: - writePinHigh(A0); - writePinHigh(A1); - writePinLow(A2); - writePinLow(B4); + gpio_write_pin_high(A0); + gpio_write_pin_high(A1); + gpio_write_pin_low(A2); + gpio_write_pin_low(B4); break; case 2: - writePinHigh(A0); - writePinLow(A1); - writePinHigh(A2); - writePinLow(B4); + gpio_write_pin_high(A0); + gpio_write_pin_low(A1); + gpio_write_pin_high(A2); + gpio_write_pin_low(B4); break; case 3: - writePinHigh(A0); - writePinLow(A1); - writePinLow(A2); - writePinLow(B4); + gpio_write_pin_high(A0); + gpio_write_pin_low(A1); + gpio_write_pin_low(A2); + gpio_write_pin_low(B4); break; case 4: - writePinLow(A0); - writePinHigh(A1); - writePinHigh(A2); - writePinLow(B4); + gpio_write_pin_low(A0); + gpio_write_pin_high(A1); + gpio_write_pin_high(A2); + gpio_write_pin_low(B4); break; case 5: - writePinLow(A0); - writePinHigh(A1); - writePinLow(A2); - writePinLow(B4); + gpio_write_pin_low(A0); + gpio_write_pin_high(A1); + gpio_write_pin_low(A2); + gpio_write_pin_low(B4); break; case 6: - writePinLow(A0); - writePinLow(A1); - writePinHigh(A2); - writePinLow(B4); + gpio_write_pin_low(A0); + gpio_write_pin_low(A1); + gpio_write_pin_high(A2); + gpio_write_pin_low(B4); break; case 7: - writePinLow(A0); - writePinLow(A1); - writePinLow(A2); - writePinLow(B4); + gpio_write_pin_low(A0); + gpio_write_pin_low(A1); + gpio_write_pin_low(A2); + gpio_write_pin_low(B4); break; case 8: - writePinLow(A0); - writePinLow(A1); - writePinLow(A2); - writePinLow(C7); + gpio_write_pin_low(A0); + gpio_write_pin_low(A1); + gpio_write_pin_low(A2); + gpio_write_pin_low(C7); break; case 9: - writePinHigh(A0); - writePinHigh(A1); - writePinHigh(A2); - writePinLow(C7); + gpio_write_pin_high(A0); + gpio_write_pin_high(A1); + gpio_write_pin_high(A2); + gpio_write_pin_low(C7); break; case 10: - writePinHigh(A0); - writePinHigh(A1); - writePinLow(A2); - writePinLow(C7); + gpio_write_pin_high(A0); + gpio_write_pin_high(A1); + gpio_write_pin_low(A2); + gpio_write_pin_low(C7); break; case 11: - writePinHigh(A0); - writePinLow(A1); - writePinHigh(A2); - writePinLow(C7); + gpio_write_pin_high(A0); + gpio_write_pin_low(A1); + gpio_write_pin_high(A2); + gpio_write_pin_low(C7); break; case 12: - writePinHigh(A0); - writePinLow(A1); - writePinLow(A2); - writePinLow(C7); + gpio_write_pin_high(A0); + gpio_write_pin_low(A1); + gpio_write_pin_low(A2); + gpio_write_pin_low(C7); break; case 13: - writePinLow(A0); - writePinHigh(A1); - writePinHigh(A2); - writePinLow(C7); + gpio_write_pin_low(A0); + gpio_write_pin_high(A1); + gpio_write_pin_high(A2); + gpio_write_pin_low(C7); break; case 14: - writePinLow(A0); - writePinHigh(A1); - writePinLow(A2); - writePinLow(C7); + gpio_write_pin_low(A0); + gpio_write_pin_high(A1); + gpio_write_pin_low(A2); + gpio_write_pin_low(C7); break; case 15: - writePinLow(A0); - writePinLow(A1); - writePinHigh(A2); - writePinLow(C7); + gpio_write_pin_low(A0); + gpio_write_pin_low(A1); + gpio_write_pin_high(A2); + gpio_write_pin_low(C7); break; case 16: - writePinHigh(C2); + gpio_write_pin_high(C2); break; case 17: - writePinHigh(C3); + gpio_write_pin_high(C3); break; case 18: - writePinHigh(C5); + gpio_write_pin_high(C5); break; } } static void unselect_cols(void) { //Native - writePinHigh(C2); - writePinHigh(C3); - writePinHigh(C5); + gpio_write_pin_high(C2); + gpio_write_pin_high(C3); + gpio_write_pin_high(C5); //Demultiplexer - writePinLow(B4); - writePinLow(C7); - writePinHigh(A0); - writePinHigh(A1); - writePinHigh(A2); + gpio_write_pin_low(B4); + gpio_write_pin_low(C7); + gpio_write_pin_high(A0); + gpio_write_pin_high(A1); + gpio_write_pin_high(A2); } static void init_pins(void) { unselect_cols(); for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } - setPinOutput(A0); - setPinOutput(A1); - setPinOutput(A2); - setPinOutput(B4); - setPinOutput(C7); - setPinOutput(C2); - setPinOutput(C3); - setPinOutput(C5); + gpio_set_pin_output(A0); + gpio_set_pin_output(A1); + gpio_set_pin_output(A2); + gpio_set_pin_output(B4); + gpio_set_pin_output(C7); + gpio_set_pin_output(C2); + gpio_set_pin_output(C3); + gpio_set_pin_output(C5); } static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) { @@ -326,7 +326,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) matrix_row_t last_row_value = current_matrix[row_index]; // Check row pin state - if (readPin(row_pins[row_index]) == 0) { + if (gpio_read_pin(row_pins[row_index]) == 0) { // Pin LO, set col bit current_matrix[row_index] |= (MATRIX_ROW_SHIFTER << current_col); } else { diff --git a/keyboards/mechlovin/olly/jf/rev1/matrix.c b/keyboards/mechlovin/olly/jf/rev1/matrix.c index 2abda55d0e..8d1f80ea71 100644 --- a/keyboards/mechlovin/olly/jf/rev1/matrix.c +++ b/keyboards/mechlovin/olly/jf/rev1/matrix.c @@ -37,7 +37,7 @@ static void init_pins(void) { for (int col = 0; col < MATRIX_COLS; col++) { pin_t pin = direct_pins[row][col]; if (pin != NO_PIN) { - setPinInputHigh(pin); + gpio_set_pin_input_high(pin); } } } @@ -50,7 +50,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { pin_t pin = direct_pins[current_row][col_index]; if (pin != NO_PIN) { - current_matrix[current_row] |= readPin(pin) ? 0 : (MATRIX_ROW_SHIFTER << col_index); + current_matrix[current_row] |= gpio_read_pin(pin) ? 0 : (MATRIX_ROW_SHIFTER << col_index); } } @@ -60,22 +60,22 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) #elif (DIODE_DIRECTION == COL2ROW) static void select_row(uint8_t row) { - setPinOutput(row_pins[row]); - writePinLow(row_pins[row]); + gpio_set_pin_output(row_pins[row]); + gpio_write_pin_low(row_pins[row]); } -static void unselect_row(uint8_t row) { setPinInputHigh(row_pins[row]); } +static void unselect_row(uint8_t row) { gpio_set_pin_input_high(row_pins[row]); } static void unselect_rows(void) { for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } } static void init_pins(void) { unselect_rows(); for (uint8_t x = 0; x < MATRIX_COLS; x++) { - setPinInputHigh(col_pins[x]); + gpio_set_pin_input_high(col_pins[x]); } } @@ -94,7 +94,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { // Select the col pin to read (active low) - uint8_t pin_state = readPin(col_pins[col_index]); + uint8_t pin_state = gpio_read_pin(col_pins[col_index]); // Populate the matrix row with the state of the col pin current_matrix[current_row] |= pin_state ? 0 : (MATRIX_ROW_SHIFTER << col_index); @@ -154,109 +154,109 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) static void select_col(uint8_t col) { switch (col) { case 0: - writePinLow(A0); - writePinLow(A1); - writePinLow(A2); - writePinHigh(B4); + gpio_write_pin_low(A0); + gpio_write_pin_low(A1); + gpio_write_pin_low(A2); + gpio_write_pin_high(B4); break; case 1: - writePinLow(A0); - writePinLow(A1); - writePinHigh(A2); - writePinHigh(B4); + gpio_write_pin_low(A0); + gpio_write_pin_low(A1); + gpio_write_pin_high(A2); + gpio_write_pin_high(B4); break; case 2: - writePinLow(A0); - writePinHigh(A1); - writePinLow(A2); - writePinHigh(B4); + gpio_write_pin_low(A0); + gpio_write_pin_high(A1); + gpio_write_pin_low(A2); + gpio_write_pin_high(B4); break; case 3: - writePinLow(A0); - writePinHigh(A1); - writePinHigh(A2); - writePinHigh(B4); + gpio_write_pin_low(A0); + gpio_write_pin_high(A1); + gpio_write_pin_high(A2); + gpio_write_pin_high(B4); break; case 4: - writePinHigh(A0); - writePinLow(A1); - writePinLow(A2); - writePinHigh(B4); + gpio_write_pin_high(A0); + gpio_write_pin_low(A1); + gpio_write_pin_low(A2); + gpio_write_pin_high(B4); break; case 5: - writePinHigh(A0); - writePinLow(A1); - writePinHigh(A2); - writePinHigh(B4); + gpio_write_pin_high(A0); + gpio_write_pin_low(A1); + gpio_write_pin_high(A2); + gpio_write_pin_high(B4); break; case 6: - writePinHigh(A0); - writePinHigh(A1); - writePinLow(A2); - writePinHigh(B4); + gpio_write_pin_high(A0); + gpio_write_pin_high(A1); + gpio_write_pin_low(A2); + gpio_write_pin_high(B4); break; case 7: - writePinHigh(A0); - writePinHigh(A1); - writePinHigh(A2); - writePinHigh(B4); + gpio_write_pin_high(A0); + gpio_write_pin_high(A1); + gpio_write_pin_high(A2); + gpio_write_pin_high(B4); break; case 8: - writePinHigh(A0); - writePinHigh(A1); - writePinHigh(A2); - writePinHigh(C7); + gpio_write_pin_high(A0); + gpio_write_pin_high(A1); + gpio_write_pin_high(A2); + gpio_write_pin_high(C7); break; case 9: - writePinLow(A0); - writePinLow(A1); - writePinLow(A2); - writePinHigh(C7); + gpio_write_pin_low(A0); + gpio_write_pin_low(A1); + gpio_write_pin_low(A2); + gpio_write_pin_high(C7); break; case 10: - writePinLow(A0); - writePinLow(A1); - writePinHigh(A2); - writePinHigh(C7); + gpio_write_pin_low(A0); + gpio_write_pin_low(A1); + gpio_write_pin_high(A2); + gpio_write_pin_high(C7); break; case 11: - writePinLow(A0); - writePinHigh(A1); - writePinLow(A2); - writePinHigh(C7); + gpio_write_pin_low(A0); + gpio_write_pin_high(A1); + gpio_write_pin_low(A2); + gpio_write_pin_high(C7); break; case 12: - writePinLow(A0); - writePinHigh(A1); - writePinHigh(A2); - writePinHigh(C7); + gpio_write_pin_low(A0); + gpio_write_pin_high(A1); + gpio_write_pin_high(A2); + gpio_write_pin_high(C7); break; case 13: - writePinHigh(A0); - writePinLow(A1); - writePinLow(A2); - writePinHigh(C7); + gpio_write_pin_high(A0); + gpio_write_pin_low(A1); + gpio_write_pin_low(A2); + gpio_write_pin_high(C7); break; case 14: - writePinHigh(A0); - writePinLow(A1); - writePinHigh(A2); - writePinHigh(C7); + gpio_write_pin_high(A0); + gpio_write_pin_low(A1); + gpio_write_pin_high(A2); + gpio_write_pin_high(C7); break; case 15: - writePinHigh(A0); - writePinHigh(A1); - writePinLow(A2); - writePinHigh(C7); + gpio_write_pin_high(A0); + gpio_write_pin_high(A1); + gpio_write_pin_low(A2); + gpio_write_pin_high(C7); break; case 16: - writePinLow(C2); + gpio_write_pin_low(C2); break; case 17: - writePinLow(C3); + gpio_write_pin_low(C3); break; case 18: - writePinLow(C5); + gpio_write_pin_low(C5); break; } } @@ -264,140 +264,140 @@ static void select_col(uint8_t col) { static void unselect_col(uint8_t col) { switch (col) { case 0: - writePinHigh(A0); - writePinHigh(A1); - writePinHigh(A2); - writePinLow(B4); + gpio_write_pin_high(A0); + gpio_write_pin_high(A1); + gpio_write_pin_high(A2); + gpio_write_pin_low(B4); break; case 1: - writePinHigh(A0); - writePinHigh(A1); - writePinLow(A2); - writePinLow(B4); + gpio_write_pin_high(A0); + gpio_write_pin_high(A1); + gpio_write_pin_low(A2); + gpio_write_pin_low(B4); break; case 2: - writePinHigh(A0); - writePinLow(A1); - writePinHigh(A2); - writePinLow(B4); + gpio_write_pin_high(A0); + gpio_write_pin_low(A1); + gpio_write_pin_high(A2); + gpio_write_pin_low(B4); break; case 3: - writePinHigh(A0); - writePinLow(A1); - writePinLow(A2); - writePinLow(B4); + gpio_write_pin_high(A0); + gpio_write_pin_low(A1); + gpio_write_pin_low(A2); + gpio_write_pin_low(B4); break; case 4: - writePinLow(A0); - writePinHigh(A1); - writePinHigh(A2); - writePinLow(B4); + gpio_write_pin_low(A0); + gpio_write_pin_high(A1); + gpio_write_pin_high(A2); + gpio_write_pin_low(B4); break; case 5: - writePinLow(A0); - writePinHigh(A1); - writePinLow(A2); - writePinLow(B4); + gpio_write_pin_low(A0); + gpio_write_pin_high(A1); + gpio_write_pin_low(A2); + gpio_write_pin_low(B4); break; case 6: - writePinLow(A0); - writePinLow(A1); - writePinHigh(A2); - writePinLow(B4); + gpio_write_pin_low(A0); + gpio_write_pin_low(A1); + gpio_write_pin_high(A2); + gpio_write_pin_low(B4); break; case 7: - writePinLow(A0); - writePinLow(A1); - writePinLow(A2); - writePinLow(B4); + gpio_write_pin_low(A0); + gpio_write_pin_low(A1); + gpio_write_pin_low(A2); + gpio_write_pin_low(B4); break; case 8: - writePinLow(A0); - writePinLow(A1); - writePinLow(A2); - writePinLow(C7); + gpio_write_pin_low(A0); + gpio_write_pin_low(A1); + gpio_write_pin_low(A2); + gpio_write_pin_low(C7); break; case 9: - writePinHigh(A0); - writePinHigh(A1); - writePinHigh(A2); - writePinLow(C7); + gpio_write_pin_high(A0); + gpio_write_pin_high(A1); + gpio_write_pin_high(A2); + gpio_write_pin_low(C7); break; case 10: - writePinHigh(A0); - writePinHigh(A1); - writePinLow(A2); - writePinLow(C7); + gpio_write_pin_high(A0); + gpio_write_pin_high(A1); + gpio_write_pin_low(A2); + gpio_write_pin_low(C7); break; case 11: - writePinHigh(A0); - writePinLow(A1); - writePinHigh(A2); - writePinLow(C7); + gpio_write_pin_high(A0); + gpio_write_pin_low(A1); + gpio_write_pin_high(A2); + gpio_write_pin_low(C7); break; case 12: - writePinHigh(A0); - writePinLow(A1); - writePinLow(A2); - writePinLow(C7); + gpio_write_pin_high(A0); + gpio_write_pin_low(A1); + gpio_write_pin_low(A2); + gpio_write_pin_low(C7); break; case 13: - writePinLow(A0); - writePinHigh(A1); - writePinHigh(A2); - writePinLow(C7); + gpio_write_pin_low(A0); + gpio_write_pin_high(A1); + gpio_write_pin_high(A2); + gpio_write_pin_low(C7); break; case 14: - writePinLow(A0); - writePinHigh(A1); - writePinLow(A2); - writePinLow(C7); + gpio_write_pin_low(A0); + gpio_write_pin_high(A1); + gpio_write_pin_low(A2); + gpio_write_pin_low(C7); break; case 15: - writePinLow(A0); - writePinLow(A1); - writePinHigh(A2); - writePinLow(C7); + gpio_write_pin_low(A0); + gpio_write_pin_low(A1); + gpio_write_pin_high(A2); + gpio_write_pin_low(C7); break; case 16: - writePinHigh(C2); + gpio_write_pin_high(C2); break; case 17: - writePinHigh(C3); + gpio_write_pin_high(C3); break; case 18: - writePinHigh(C5); + gpio_write_pin_high(C5); break; } } static void unselect_cols(void) { //Native - writePinHigh(C2); - writePinHigh(C3); - writePinHigh(C5); + gpio_write_pin_high(C2); + gpio_write_pin_high(C3); + gpio_write_pin_high(C5); //Demultiplexer - writePinLow(B4); - writePinLow(C7); - writePinHigh(A0); - writePinHigh(A1); - writePinHigh(A2); + gpio_write_pin_low(B4); + gpio_write_pin_low(C7); + gpio_write_pin_high(A0); + gpio_write_pin_high(A1); + gpio_write_pin_high(A2); } static void init_pins(void) { unselect_cols(); for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } - setPinOutput(A0); - setPinOutput(A1); - setPinOutput(A2); - setPinOutput(B4); - setPinOutput(C7); - setPinOutput(C2); - setPinOutput(C3); - setPinOutput(C5); + gpio_set_pin_output(A0); + gpio_set_pin_output(A1); + gpio_set_pin_output(A2); + gpio_set_pin_output(B4); + gpio_set_pin_output(C7); + gpio_set_pin_output(C2); + gpio_set_pin_output(C3); + gpio_set_pin_output(C5); } static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) { @@ -413,7 +413,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) matrix_row_t last_row_value = current_matrix[row_index]; // Check row pin state - if (readPin(row_pins[row_index]) == 0) { + if (gpio_read_pin(row_pins[row_index]) == 0) { // Pin LO, set col bit current_matrix[row_index] |= (MATRIX_ROW_SHIFTER << current_col); } else { diff --git a/keyboards/mechlovin/olly/jf/rev1/rev1.c b/keyboards/mechlovin/olly/jf/rev1/rev1.c index 3d18d7bb5a..591c28dd44 100644 --- a/keyboards/mechlovin/olly/jf/rev1/rev1.c +++ b/keyboards/mechlovin/olly/jf/rev1/rev1.c @@ -18,22 +18,22 @@ void led_init_ports(void) { - setPinOutput(C0); - setPinOutput(D0); - setPinOutput(D1); - setPinOutput(C1); - setPinOutput(C6); - setPinOutput(B0); - setPinOutput(B1); - setPinOutput(B2); + gpio_set_pin_output(C0); + gpio_set_pin_output(D0); + gpio_set_pin_output(D1); + gpio_set_pin_output(C1); + gpio_set_pin_output(C6); + gpio_set_pin_output(B0); + gpio_set_pin_output(B1); + gpio_set_pin_output(B2); } layer_state_t layer_state_set_user(layer_state_t state) { - writePin(D1, layer_state_cmp(state, 1)); - writePin(D0, layer_state_cmp(state, 2)); - writePin(C1, layer_state_cmp(state, 3)); - writePin(C0, layer_state_cmp(state, 4)); - writePin(C6, layer_state_cmp(state, 5)); + gpio_write_pin(D1, layer_state_cmp(state, 1)); + gpio_write_pin(D0, layer_state_cmp(state, 2)); + gpio_write_pin(C1, layer_state_cmp(state, 3)); + gpio_write_pin(C0, layer_state_cmp(state, 4)); + gpio_write_pin(C6, layer_state_cmp(state, 5)); return state; } diff --git a/keyboards/mechlovin/olly/orion/orion.c b/keyboards/mechlovin/olly/orion/orion.c index 9fc89a6d02..4dcc15cf77 100644 --- a/keyboards/mechlovin/olly/orion/orion.c +++ b/keyboards/mechlovin/olly/orion/orion.c @@ -22,20 +22,20 @@ void board_init(void) { } void keyboard_pre_init_kb(void) { - setPinOutput(B5); - setPinOutput(B6); - setPinOutput(B7); - setPinOutput(B8); - setPinOutput(B9); + gpio_set_pin_output(B5); + gpio_set_pin_output(B6); + gpio_set_pin_output(B7); + gpio_set_pin_output(B8); + gpio_set_pin_output(B9); keyboard_pre_init_user(); } layer_state_t layer_state_set_kb(layer_state_t state) { state = layer_state_set_user(state); - writePin(B7, layer_state_cmp(state, 0)); - writePin(B6, layer_state_cmp(state, 1)); - writePin(B5, layer_state_cmp(state, 2)); - writePin(B8, layer_state_cmp(state, 3)); - writePin(B9, layer_state_cmp(state, 4)); + gpio_write_pin(B7, layer_state_cmp(state, 0)); + gpio_write_pin(B6, layer_state_cmp(state, 1)); + gpio_write_pin(B5, layer_state_cmp(state, 2)); + gpio_write_pin(B8, layer_state_cmp(state, 3)); + gpio_write_pin(B9, layer_state_cmp(state, 4)); return state; } diff --git a/keyboards/mechlovin/serratus/matrix.c b/keyboards/mechlovin/serratus/matrix.c index 62a56f687c..16bee61ad0 100644 --- a/keyboards/mechlovin/serratus/matrix.c +++ b/keyboards/mechlovin/serratus/matrix.c @@ -37,7 +37,7 @@ static void init_pins(void) { for (int col = 0; col < MATRIX_COLS; col++) { pin_t pin = direct_pins[row][col]; if (pin != NO_PIN) { - setPinInputHigh(pin); + gpio_set_pin_input_high(pin); } } } @@ -50,7 +50,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { pin_t pin = direct_pins[current_row][col_index]; if (pin != NO_PIN) { - current_matrix[current_row] |= readPin(pin) ? 0 : (MATRIX_ROW_SHIFTER << col_index); + current_matrix[current_row] |= gpio_read_pin(pin) ? 0 : (MATRIX_ROW_SHIFTER << col_index); } } @@ -101,103 +101,103 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) static void select_col(uint8_t col) { switch (col) { case 0: - writePinLow(B5); - writePinLow(B7); - writePinLow(F0); - writePinHigh(B0); + gpio_write_pin_low(B5); + gpio_write_pin_low(B7); + gpio_write_pin_low(F0); + gpio_write_pin_high(B0); break; case 1: - writePinLow(B5); - writePinLow(B7); - writePinHigh(F0); - writePinHigh(B0); + gpio_write_pin_low(B5); + gpio_write_pin_low(B7); + gpio_write_pin_high(F0); + gpio_write_pin_high(B0); break; case 2: - writePinLow(B5); - writePinHigh(B7); - writePinLow(F0); - writePinHigh(B0); + gpio_write_pin_low(B5); + gpio_write_pin_high(B7); + gpio_write_pin_low(F0); + gpio_write_pin_high(B0); break; case 3: - writePinLow(B5); - writePinHigh(B7); - writePinHigh(F0); - writePinHigh(B0); + gpio_write_pin_low(B5); + gpio_write_pin_high(B7); + gpio_write_pin_high(F0); + gpio_write_pin_high(B0); break; case 4: - writePinHigh(B5); - writePinLow(B7); - writePinLow(F0); - writePinHigh(B0); + gpio_write_pin_high(B5); + gpio_write_pin_low(B7); + gpio_write_pin_low(F0); + gpio_write_pin_high(B0); break; case 5: - writePinHigh(B5); - writePinLow(B7); - writePinHigh(F0); - writePinHigh(B0); + gpio_write_pin_high(B5); + gpio_write_pin_low(B7); + gpio_write_pin_high(F0); + gpio_write_pin_high(B0); break; case 6: - writePinHigh(B5); - writePinHigh(B7); - writePinLow(F0); - writePinHigh(B0); + gpio_write_pin_high(B5); + gpio_write_pin_high(B7); + gpio_write_pin_low(F0); + gpio_write_pin_high(B0); break; case 7: - writePinHigh(B5); - writePinHigh(B7); - writePinHigh(F0); - writePinHigh(B0); + gpio_write_pin_high(B5); + gpio_write_pin_high(B7); + gpio_write_pin_high(F0); + gpio_write_pin_high(B0); break; case 8: - writePinLow(B5); - writePinLow(B7); - writePinLow(F0); - writePinHigh(F1); + gpio_write_pin_low(B5); + gpio_write_pin_low(B7); + gpio_write_pin_low(F0); + gpio_write_pin_high(F1); break; case 9: - writePinLow(B5); - writePinLow(B7); - writePinHigh(F0); - writePinHigh(F1); + gpio_write_pin_low(B5); + gpio_write_pin_low(B7); + gpio_write_pin_high(F0); + gpio_write_pin_high(F1); break; case 10: - writePinLow(B5); - writePinHigh(B7); - writePinLow(F0); - writePinHigh(F1); + gpio_write_pin_low(B5); + gpio_write_pin_high(B7); + gpio_write_pin_low(F0); + gpio_write_pin_high(F1); break; case 11: - writePinLow(B5); - writePinHigh(B7); - writePinHigh(F0); - writePinHigh(F1); + gpio_write_pin_low(B5); + gpio_write_pin_high(B7); + gpio_write_pin_high(F0); + gpio_write_pin_high(F1); break; case 12: - writePinHigh(B5); - writePinLow(B7); - writePinLow(F0); - writePinHigh(F1); + gpio_write_pin_high(B5); + gpio_write_pin_low(B7); + gpio_write_pin_low(F0); + gpio_write_pin_high(F1); break; case 13: - writePinHigh(B5); - writePinLow(B7); - writePinHigh(F0); - writePinHigh(F1); + gpio_write_pin_high(B5); + gpio_write_pin_low(B7); + gpio_write_pin_high(F0); + gpio_write_pin_high(F1); break; case 14: - writePinHigh(B5); - writePinHigh(B7); - writePinHigh(F0); - writePinHigh(F1); + gpio_write_pin_high(B5); + gpio_write_pin_high(B7); + gpio_write_pin_high(F0); + gpio_write_pin_high(F1); break; case 15: - writePinHigh(B5); - writePinHigh(B7); - writePinLow(F0); - writePinHigh(F1); + gpio_write_pin_high(B5); + gpio_write_pin_high(B7); + gpio_write_pin_low(F0); + gpio_write_pin_high(F1); break; case 16: - writePinLow(E6); + gpio_write_pin_low(E6); break; } } @@ -205,130 +205,130 @@ static void select_col(uint8_t col) { static void unselect_col(uint8_t col) { switch (col) { case 0: - writePinHigh(B5); - writePinHigh(B7); - writePinHigh(F0); - writePinLow(B0); + gpio_write_pin_high(B5); + gpio_write_pin_high(B7); + gpio_write_pin_high(F0); + gpio_write_pin_low(B0); break; case 1: - writePinHigh(B5); - writePinHigh(B7); - writePinLow(F0); - writePinLow(B0); + gpio_write_pin_high(B5); + gpio_write_pin_high(B7); + gpio_write_pin_low(F0); + gpio_write_pin_low(B0); break; case 2: - writePinHigh(B5); - writePinLow(B7); - writePinHigh(F0); - writePinLow(B0); + gpio_write_pin_high(B5); + gpio_write_pin_low(B7); + gpio_write_pin_high(F0); + gpio_write_pin_low(B0); break; case 3: - writePinHigh(B5); - writePinLow(B7); - writePinLow(F0); - writePinLow(B0); + gpio_write_pin_high(B5); + gpio_write_pin_low(B7); + gpio_write_pin_low(F0); + gpio_write_pin_low(B0); break; case 4: - writePinLow(B5); - writePinHigh(B7); - writePinHigh(F0); - writePinLow(B0); + gpio_write_pin_low(B5); + gpio_write_pin_high(B7); + gpio_write_pin_high(F0); + gpio_write_pin_low(B0); break; case 5: - writePinLow(B5); - writePinHigh(B7); - writePinLow(F0); - writePinLow(B0); + gpio_write_pin_low(B5); + gpio_write_pin_high(B7); + gpio_write_pin_low(F0); + gpio_write_pin_low(B0); break; case 6: - writePinLow(B5); - writePinLow(B7); - writePinHigh(F0); - writePinLow(B0); + gpio_write_pin_low(B5); + gpio_write_pin_low(B7); + gpio_write_pin_high(F0); + gpio_write_pin_low(B0); break; case 7: - writePinLow(B5); - writePinLow(B7); - writePinLow(F0); - writePinLow(B0); + gpio_write_pin_low(B5); + gpio_write_pin_low(B7); + gpio_write_pin_low(F0); + gpio_write_pin_low(B0); break; case 8: - writePinHigh(B5); - writePinHigh(B7); - writePinHigh(F0); - writePinLow(F1); + gpio_write_pin_high(B5); + gpio_write_pin_high(B7); + gpio_write_pin_high(F0); + gpio_write_pin_low(F1); break; case 9: - writePinHigh(B5); - writePinHigh(B7); - writePinLow(F0); - writePinLow(F1); + gpio_write_pin_high(B5); + gpio_write_pin_high(B7); + gpio_write_pin_low(F0); + gpio_write_pin_low(F1); break; case 10: - writePinHigh(B5); - writePinLow(B7); - writePinHigh(F0); - writePinLow(F1); + gpio_write_pin_high(B5); + gpio_write_pin_low(B7); + gpio_write_pin_high(F0); + gpio_write_pin_low(F1); break; case 11: - writePinHigh(B5); - writePinLow(B7); - writePinLow(F0); - writePinLow(F1); + gpio_write_pin_high(B5); + gpio_write_pin_low(B7); + gpio_write_pin_low(F0); + gpio_write_pin_low(F1); break; case 12: - writePinLow(B5); - writePinHigh(B7); - writePinHigh(F0); - writePinLow(F1); + gpio_write_pin_low(B5); + gpio_write_pin_high(B7); + gpio_write_pin_high(F0); + gpio_write_pin_low(F1); break; case 13: - writePinLow(B5); - writePinHigh(B7); - writePinLow(F0); - writePinLow(F1); + gpio_write_pin_low(B5); + gpio_write_pin_high(B7); + gpio_write_pin_low(F0); + gpio_write_pin_low(F1); break; case 14: - writePinLow(B5); - writePinLow(B7); - writePinLow(F0); - writePinLow(F1); + gpio_write_pin_low(B5); + gpio_write_pin_low(B7); + gpio_write_pin_low(F0); + gpio_write_pin_low(F1); break; case 15: - writePinLow(B5); - writePinLow(B7); - writePinHigh(F0); - writePinLow(F1); + gpio_write_pin_low(B5); + gpio_write_pin_low(B7); + gpio_write_pin_high(F0); + gpio_write_pin_low(F1); break; case 16: - writePinHigh(E6); + gpio_write_pin_high(E6); break; } } static void unselect_cols(void) { //Native - writePinHigh(E6); + gpio_write_pin_high(E6); //Demultiplexer - writePinLow(B0); - writePinLow(F1); - writePinHigh(B5); - writePinHigh(B7); - writePinHigh(F0); + gpio_write_pin_low(B0); + gpio_write_pin_low(F1); + gpio_write_pin_high(B5); + gpio_write_pin_high(B7); + gpio_write_pin_high(F0); } static void init_pins(void) { unselect_cols(); for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } - setPinOutput(B5); - setPinOutput(B7); - setPinOutput(F0); - setPinOutput(B0); - setPinOutput(F1); - setPinOutput(E6); + gpio_set_pin_output(B5); + gpio_set_pin_output(B7); + gpio_set_pin_output(F0); + gpio_set_pin_output(B0); + gpio_set_pin_output(F1); + gpio_set_pin_output(E6); } static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) { @@ -344,7 +344,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) matrix_row_t last_row_value = current_matrix[row_index]; // Check row pin state - if (readPin(row_pins[row_index]) == 0) { + if (gpio_read_pin(row_pins[row_index]) == 0) { // Pin LO, set col bit current_matrix[row_index] |= (MATRIX_ROW_SHIFTER << current_col); } else { diff --git a/keyboards/mechlovin/zed65/no_backlight/wearhaus66/wearhaus66.c b/keyboards/mechlovin/zed65/no_backlight/wearhaus66/wearhaus66.c index 091373e387..a6942a2cb8 100644 --- a/keyboards/mechlovin/zed65/no_backlight/wearhaus66/wearhaus66.c +++ b/keyboards/mechlovin/zed65/no_backlight/wearhaus66/wearhaus66.c @@ -20,5 +20,5 @@ along with this program. If not, see . void keyboard_pre_init_user(void) { // Call the keyboard pre init code. // Set our LED pins as output - setPinOutput(B7); + gpio_set_pin_output(B7); } diff --git a/keyboards/mechwild/puckbuddy/puckbuddy.c b/keyboards/mechwild/puckbuddy/puckbuddy.c index 5cf2d79b36..d386cf050e 100644 --- a/keyboards/mechwild/puckbuddy/puckbuddy.c +++ b/keyboards/mechwild/puckbuddy/puckbuddy.c @@ -21,7 +21,7 @@ uint16_t dpi_array[] = GLIDEPOINT_DPI_OPTIONS; void board_init(void) { // B9 is configured as I2C1_SDA in the board file; that function must be // disabled before using B7 as I2C1_SDA. - setPinInputHigh(B9); + gpio_set_pin_input_high(B9); } #ifdef DYNAMIC_TAPPING_TERM_ENABLE diff --git a/keyboards/mechwild/sugarglider/sugarglider.c b/keyboards/mechwild/sugarglider/sugarglider.c index 76c6d29832..086294470e 100644 --- a/keyboards/mechwild/sugarglider/sugarglider.c +++ b/keyboards/mechwild/sugarglider/sugarglider.c @@ -19,14 +19,14 @@ uint16_t dpi_array[] = GLIDEPOINT_DPI_OPTIONS; void board_init(void) { // B9 is configured as I2C1_SDA in the board file; that function must be // disabled before using B7 as I2C1_SDA. - setPinInputHigh(B9); - setPinOutput(B12); - setPinOutput(B13); - setPinOutput(B14); - writePinLow(B12); - writePinLow(B13); - writePinLow(B14); - setPinOutput(C13); + gpio_set_pin_input_high(B9); + gpio_set_pin_output(B12); + gpio_set_pin_output(B13); + gpio_set_pin_output(B14); + gpio_write_pin_low(B12); + gpio_write_pin_low(B13); + gpio_write_pin_low(B14); + gpio_set_pin_output(C13); } #ifdef DYNAMIC_TAPPING_TERM_ENABLE @@ -110,10 +110,10 @@ bool encoder_update_kb(uint8_t index, bool clockwise) { bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if(res) { - writePin(B12, led_state.num_lock); // Updates status LEDs - writePin(B13, led_state.caps_lock); // Updates status LEDs - writePin(B14, led_state.scroll_lock); // Updates status LEDs - writePin(C13, !led_state.caps_lock); // Updates status LEDs, this is the LED on the blackpill itself + gpio_write_pin(B12, led_state.num_lock); // Updates status LEDs + gpio_write_pin(B13, led_state.caps_lock); // Updates status LEDs + gpio_write_pin(B14, led_state.scroll_lock); // Updates status LEDs + gpio_write_pin(C13, !led_state.caps_lock); // Updates status LEDs, this is the LED on the blackpill itself } return res; } diff --git a/keyboards/mexsistor/ludmila/matrix.c b/keyboards/mexsistor/ludmila/matrix.c index 5d27ec683f..fd197f366d 100644 --- a/keyboards/mexsistor/ludmila/matrix.c +++ b/keyboards/mexsistor/ludmila/matrix.c @@ -31,22 +31,22 @@ extern matrix_row_t matrix[MATRIX_ROWS]; // debounced values static void select_row(uint8_t row) { - setPinOutput(row_pins[row]); - writePinLow(row_pins[row]); + gpio_set_pin_output(row_pins[row]); + gpio_write_pin_low(row_pins[row]); } -static void unselect_row(uint8_t row) { setPinInputHigh(row_pins[row]); } +static void unselect_row(uint8_t row) { gpio_set_pin_input_high(row_pins[row]); } static void unselect_rows(void) { for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } } static void init_pins(void) { unselect_rows(); for (uint8_t x = 0; x < MATRIX_COLS; x++) { - setPinInputHigh(col_pins[x]); + gpio_set_pin_input_high(col_pins[x]); } } @@ -64,7 +64,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) // For each col... for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { // Select the col pin to read (active low) - uint8_t pin_state = readPin(col_pins[col_index]); + uint8_t pin_state = gpio_read_pin(col_pins[col_index]); // Populate the matrix row with the state of the col pin current_matrix[current_row] |= pin_state ? 0 : (MATRIX_ROW_SHIFTER << col_index); @@ -79,7 +79,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) void matrix_init_custom(void) { // initialize key pins - setPinInput(ENC_SW); + gpio_set_pin_input(ENC_SW); init_pins(); } @@ -108,7 +108,7 @@ static bool read_encoder_switches(matrix_row_t current_matrix[], uint8_t current static uint8_t btn_1_array; bool btn_1_pressed = 0; btn_1_array <<= 1; - btn_1_array |= readPin(ENC_SW); + btn_1_array |= gpio_read_pin(ENC_SW); (btn_1_array == 0b11111111) ? (btn_1_pressed = 1) : (btn_1_pressed = 0); // Populate the matrix row with the state of the encoder diff --git a/keyboards/miiiw/blackio83/rev_0100/matrix.c b/keyboards/miiiw/blackio83/rev_0100/matrix.c index ab252f919b..11a5aa97e6 100644 --- a/keyboards/miiiw/blackio83/rev_0100/matrix.c +++ b/keyboards/miiiw/blackio83/rev_0100/matrix.c @@ -34,7 +34,7 @@ static pin_t dip_switch_pad[] = DIP_SWITCH_PINS; void matrix_init_custom(void) { for (uint8_t row = 0; row < MATRIX_ROWS; row++) { - setPinInputLow(row_pins[row]); + gpio_set_pin_input_low(row_pins[row]); } shift_init(); @@ -65,12 +65,12 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { void matrix_power_up(void) { for (uint8_t row = 0; row < MATRIX_ROWS; row++) { palDisableLineEvent(row_pins[row]); - setPinInputLow(row_pins[row]); + gpio_set_pin_input_low(row_pins[row]); } init_cols(); #ifdef DIP_SWITCH_PINS for (uint8_t i = 1; i < NUMBER_OF_DIP_SWITCHES; i++) { - setPinInputHigh(dip_switch_pad[i]); + gpio_set_pin_input_high(dip_switch_pad[i]); } #endif } @@ -78,12 +78,12 @@ void matrix_power_up(void) { void matrix_power_down(void) { unselect_cols(); for (uint8_t row = 0; row < MATRIX_ROWS; row++) { - setPinInputLow(row_pins[row]); + gpio_set_pin_input_low(row_pins[row]); palEnableLineEvent(row_pins[row], PAL_EVENT_MODE_RISING_EDGE); } #ifdef DIP_SWITCH_PINS for (uint8_t i = 1; i < NUMBER_OF_DIP_SWITCHES; i++) { - setPinInputLow(dip_switch_pad[i]); + gpio_set_pin_input_low(dip_switch_pad[i]); } #endif } @@ -91,7 +91,7 @@ void matrix_power_down(void) { static uint8_t read_rows(void) { uint8_t row_value = 0; for(uint8_t row = 0; row < MATRIX_ROWS; row++) { - row_value |= (readPin(row_pins[row]) << row); + row_value |= (gpio_read_pin(row_pins[row]) << row); } return row_value; } @@ -100,15 +100,15 @@ static void init_cols(void) { shift_writeAll(0); for(uint8_t col = 0; col < MATRIX_COLS; col++) { if(col_pins[col] < H0) { - setPinOutput(col_pins[col]); - writePinLow(col_pins[col]); + gpio_set_pin_output(col_pins[col]); + gpio_write_pin_low(col_pins[col]); } } } static void select_col(uint8_t col) { if(col_pins[col] < H0){ - writePinHigh(col_pins[col]); + gpio_write_pin_high(col_pins[col]); waitInputPinDelay(); waitInputPinDelay(); waitInputPinDelay(); @@ -122,7 +122,7 @@ static void select_col(uint8_t col) { static void unselect_col(uint8_t col) { if(col_pins[col] < H0){ - writePinLow(col_pins[col]); + gpio_write_pin_low(col_pins[col]); }else{ shift_writePin(col_pins[col], 0); } @@ -132,8 +132,8 @@ static void unselect_cols(void) { shift_writeAll(1); for(uint8_t col = 0; col < MATRIX_COLS; col++) { if(col_pins[col] < H0) { - setPinOutput(col_pins[col]); - writePinHigh(col_pins[col]); + gpio_set_pin_output(col_pins[col]); + gpio_write_pin_high(col_pins[col]); } } } diff --git a/keyboards/miiiw/blackio83/rev_0100/rev_0100.c b/keyboards/miiiw/blackio83/rev_0100/rev_0100.c index 7af6861f53..18f4c86510 100644 --- a/keyboards/miiiw/blackio83/rev_0100/rev_0100.c +++ b/keyboards/miiiw/blackio83/rev_0100/rev_0100.c @@ -49,25 +49,25 @@ void ws2812_poweron(void) { if(p_setup) return; p_setup = true; s_init = false; - setPinOutput(RGB_EN_PIN); - writePinHigh(RGB_EN_PIN); + gpio_set_pin_output(RGB_EN_PIN); + gpio_write_pin_high(RGB_EN_PIN); } void ws2812_poweroff(void) { if(!p_setup) return; p_setup = false; - setPinInputLow(WS2812_DI_PIN); - writePinLow(RGB_EN_PIN); + gpio_set_pin_input_low(WS2812_DI_PIN); + gpio_write_pin_low(RGB_EN_PIN); } void keyboard_pre_init_kb() { keyboard_pre_init_user(); - setPinInputLow(MWPROTO_STATUS_PIN); - setPinOutput(MWPROTO_WAKEUP_PIN); - writePinLow(MWPROTO_WAKEUP_PIN); + gpio_set_pin_input_low(MWPROTO_STATUS_PIN); + gpio_set_pin_output(MWPROTO_WAKEUP_PIN); + gpio_write_pin_low(MWPROTO_WAKEUP_PIN); wait_ms(2); - writePinHigh(MWPROTO_WAKEUP_PIN); + gpio_write_pin_high(MWPROTO_WAKEUP_PIN); palSetLineMode(MWPROTO_TX_PIN, PAL_MODE_ALTERNATE(MWPROTO_TX_PAL_MODE) | PAL_OUTPUT_TYPE_OPENDRAIN); sdStart(&MWPROTO_DRIVER, &mwproto_uart_config); @@ -84,14 +84,14 @@ void keyboard_post_init_kb(void) { "BUILD: " __DATE__ "\n" ); /* clang-format on */ - writePinLow(MWPROTO_WAKEUP_PIN); + gpio_write_pin_low(MWPROTO_WAKEUP_PIN); wait_ms(50); sdPutI(&MWPROTO_DRIVER, 0xA5); sdPutI(&MWPROTO_DRIVER, 0x12); sdPutI(&MWPROTO_DRIVER, 0x01); sdPutI(&MWPROTO_DRIVER, 0x02); sdPutI(&MWPROTO_DRIVER, 0xB4); - writePinHigh(MWPROTO_WAKEUP_PIN); + gpio_write_pin_high(MWPROTO_WAKEUP_PIN); ws2812_poweron(); loop10hz_token = defer_exec(LOOP_10HZ_PERIOD, loop_10Hz, NULL); @@ -117,7 +117,7 @@ bool dip_switch_update_mask_kb(uint32_t state) { usbDisconnectBus(&USB_DRIVER); usbStop(&USB_DRIVER); shutdown_user(true); - setPinInputHigh(POWER_SWITCH_PIN); + gpio_set_pin_input_high(POWER_SWITCH_PIN); palEnableLineEvent(POWER_SWITCH_PIN, PAL_EVENT_MODE_RISING_EDGE); POWER_EnterSleep(); } @@ -132,8 +132,8 @@ uint32_t loop_10Hz(uint32_t trigger_time, void *cb_arg) { static uint32_t pmu_timer = 0; if(timer_elapsed32(pmu_timer) > 3000) { pmu_timer = timer_read32(); - writePinLow(MWPROTO_WAKEUP_PIN); - if(readPin(MWPROTO_STATUS_PIN)) + gpio_write_pin_low(MWPROTO_WAKEUP_PIN); + if(gpio_read_pin(MWPROTO_STATUS_PIN)) wait_us(500); else wait_us(1500); @@ -141,7 +141,7 @@ uint32_t loop_10Hz(uint32_t trigger_time, void *cb_arg) { sdPutI(&MWPROTO_DRIVER, 0x28); sdPutI(&MWPROTO_DRIVER, 0x00); sdPutI(&MWPROTO_DRIVER, 0x8D); - writePinHigh(MWPROTO_WAKEUP_PIN); + gpio_write_pin_high(MWPROTO_WAKEUP_PIN); } } @@ -151,8 +151,8 @@ uint32_t loop_10Hz(uint32_t trigger_time, void *cb_arg) { matrix[2] == 0 && matrix[3] == 0 && matrix[4] == 0 && matrix[5] == 0x201) { if(restore_tick++ > 50) { restore_tick = 0; - writePinLow(MWPROTO_WAKEUP_PIN); - if(readPin(MWPROTO_STATUS_PIN)) + gpio_write_pin_low(MWPROTO_WAKEUP_PIN); + if(gpio_read_pin(MWPROTO_STATUS_PIN)) wait_us(500); else wait_us(1500); @@ -161,7 +161,7 @@ uint32_t loop_10Hz(uint32_t trigger_time, void *cb_arg) { sdPutI(&MWPROTO_DRIVER, 0x01); sdPutI(&MWPROTO_DRIVER, 0x0F); sdPutI(&MWPROTO_DRIVER, 0xB4); - writePinHigh(MWPROTO_WAKEUP_PIN); + gpio_write_pin_high(MWPROTO_WAKEUP_PIN); wait_ms(50); eeconfig_init(); #ifdef RGB_MATRIX_ENABLE diff --git a/keyboards/miiiw/common/shift_register.c b/keyboards/miiiw/common/shift_register.c index 2c9259180e..5f82fc6442 100644 --- a/keyboards/miiiw/common/shift_register.c +++ b/keyboards/miiiw/common/shift_register.c @@ -23,30 +23,30 @@ static uint8_t shift_values[SHR_SERIES_NUM] = {0}; void shift_init(void) { #ifdef SHR_OE_PIN - setPinOutput(SHR_OE_PIN); - writePinHigh(SHR_OE_PIN); + gpio_set_pin_output(SHR_OE_PIN); + gpio_write_pin_high(SHR_OE_PIN); #endif - setPinOutput(SHR_DATA_PIN); - setPinOutput(SHR_LATCH_PIN); - setPinOutput(SHR_CLOCK_PIN); + gpio_set_pin_output(SHR_DATA_PIN); + gpio_set_pin_output(SHR_LATCH_PIN); + gpio_set_pin_output(SHR_CLOCK_PIN); } void shift_enable(void) { #ifdef SHR_OE_PIN - writePinLow(SHR_OE_PIN); + gpio_write_pin_low(SHR_OE_PIN); #endif - writePinLow(SHR_DATA_PIN); - writePinLow(SHR_LATCH_PIN); - writePinLow(SHR_CLOCK_PIN); + gpio_write_pin_low(SHR_DATA_PIN); + gpio_write_pin_low(SHR_LATCH_PIN); + gpio_write_pin_low(SHR_CLOCK_PIN); } void shift_disable(void) { #ifdef SHR_OE_PIN - writePinHigh(SHR_OE_PIN); + gpio_write_pin_high(SHR_OE_PIN); #endif - writePinLow(SHR_DATA_PIN); - writePinLow(SHR_LATCH_PIN); - writePinLow(SHR_CLOCK_PIN); + gpio_write_pin_low(SHR_DATA_PIN); + gpio_write_pin_low(SHR_LATCH_PIN); + gpio_write_pin_low(SHR_CLOCK_PIN); } void shift_writePin(pin_t pin, int level) { @@ -78,13 +78,13 @@ void shift_writeAll(int level) { static void shift_out(void) { uint8_t n = SHR_SERIES_NUM; - writePinLow(SHR_LATCH_PIN); + gpio_write_pin_low(SHR_LATCH_PIN); while(n--){ for (uint8_t i = 0; i < 8; i++) { - writePinLow(SHR_CLOCK_PIN); - writePin(SHR_DATA_PIN, shift_values[n] & (0x80 >> i)); - writePinHigh(SHR_CLOCK_PIN); + gpio_write_pin_low(SHR_CLOCK_PIN); + gpio_write_pin(SHR_DATA_PIN, shift_values[n] & (0x80 >> i)); + gpio_write_pin_high(SHR_CLOCK_PIN); } } - writePinHigh(SHR_LATCH_PIN); + gpio_write_pin_high(SHR_LATCH_PIN); } diff --git a/keyboards/mlego/m48/m48.h b/keyboards/mlego/m48/m48.h index 5acc5c4590..1d183bbd6d 100644 --- a/keyboards/mlego/m48/m48.h +++ b/keyboards/mlego/m48/m48.h @@ -21,18 +21,18 @@ along with this program. If not, see . static inline void led_lwr(const bool on) { #ifdef LED_NUM_LOCK_PIN - writePin(LED_NUM_LOCK_PIN, on); + gpio_write_pin(LED_NUM_LOCK_PIN, on); #endif } static inline void led_rse(const bool on) { #ifdef LED_SCROLL_LOCK_PIN - writePin(LED_SCROLL_LOCK_PIN, on); + gpio_write_pin(LED_SCROLL_LOCK_PIN, on); #endif } static inline void led_caps(const bool on) { #ifdef LED_CAPS_LOCK_PIN - writePin(LED_CAPS_LOCK_PIN, !on); + gpio_write_pin(LED_CAPS_LOCK_PIN, !on); #endif } diff --git a/keyboards/mlego/m60/m60.h b/keyboards/mlego/m60/m60.h index 13a56f3ff0..44245f5e1e 100644 --- a/keyboards/mlego/m60/m60.h +++ b/keyboards/mlego/m60/m60.h @@ -21,18 +21,18 @@ along with this program. If not, see . static inline void led_lwr(const bool on) { #ifdef LED_NUM_LOCK_PIN - writePin(LED_NUM_LOCK_PIN, on); + gpio_write_pin(LED_NUM_LOCK_PIN, on); #endif } static inline void led_rse(const bool on) { #ifdef LED_SCROLL_LOCK_PIN - writePin(LED_SCROLL_LOCK_PIN, on); + gpio_write_pin(LED_SCROLL_LOCK_PIN, on); #endif } static inline void led_caps(const bool on) { #ifdef LED_CAPS_LOCK_PIN - writePin(LED_CAPS_LOCK_PIN, !on); + gpio_write_pin(LED_CAPS_LOCK_PIN, !on); #endif } diff --git a/keyboards/mlego/m60_split/m60_split.h b/keyboards/mlego/m60_split/m60_split.h index 10be6662c4..203514244f 100644 --- a/keyboards/mlego/m60_split/m60_split.h +++ b/keyboards/mlego/m60_split/m60_split.h @@ -19,19 +19,19 @@ static inline void led_lwr(const bool on) { #ifdef LED_NUM_LOCK_PIN - writePin(LED_NUM_LOCK_PIN, on); + gpio_write_pin(LED_NUM_LOCK_PIN, on); #endif } static inline void led_rse(const bool on) { #ifdef LED_SCROLL_LOCK_PIN - writePin(LED_SCROLL_LOCK_PIN, on); + gpio_write_pin(LED_SCROLL_LOCK_PIN, on); #endif } static inline void led_caps(const bool on) { #ifdef LED_CAPS_LOCK_PIN - writePin(LED_CAPS_LOCK_PIN, !on); + gpio_write_pin(LED_CAPS_LOCK_PIN, !on); #endif } diff --git a/keyboards/mlego/m65/m65.h b/keyboards/mlego/m65/m65.h index 1c5589c111..0ce073cfc6 100644 --- a/keyboards/mlego/m65/m65.h +++ b/keyboards/mlego/m65/m65.h @@ -30,14 +30,14 @@ void set_led_toggle(const uint8_t, const bool); static inline void init_lwr_rse_led(void) { #if defined(LED_LWR_PIN) - setPinOutput(LED_LWR_PIN); - writePin(LED_LWR_PIN, false); + gpio_set_pin_output(LED_LWR_PIN); + gpio_write_pin(LED_LWR_PIN, false); wait_ms(30); #endif #if defined(LED_RSE_PIN) - setPinOutput(LED_RSE_PIN); - writePin(LED_RSE_PIN, false); + gpio_set_pin_output(LED_RSE_PIN); + gpio_write_pin(LED_RSE_PIN, false); wait_ms(30); #endif } @@ -46,9 +46,9 @@ static inline void led_lwr(const bool on) { #if defined(LED_LWR_PIN) if ((PRODUCT_ID == 0x6064) || (PRODUCT_ID == 0x6065) || (PRODUCT_ID == 0x6066) || (PRODUCT_ID == 0x6067)) { - writePin(LED_LWR_PIN, !on); + gpio_write_pin(LED_LWR_PIN, !on); }else{ - writePin(LED_LWR_PIN, on); + gpio_write_pin(LED_LWR_PIN, on); } #endif } @@ -57,9 +57,9 @@ static inline void led_rse(const bool on) { #if defined(LED_RSE_PIN) if ((PRODUCT_ID == 0x6064) || (PRODUCT_ID == 0x6065) || (PRODUCT_ID == 0x6066) || (PRODUCT_ID == 0x6067)) { - writePin(LED_RSE_PIN, !on); + gpio_write_pin(LED_RSE_PIN, !on); }else{ - writePin(LED_RSE_PIN, on); + gpio_write_pin(LED_RSE_PIN, on); } #endif } diff --git a/keyboards/mode/m65ha_alpha/m65ha_alpha.c b/keyboards/mode/m65ha_alpha/m65ha_alpha.c index afb093058f..0d438b02de 100644 --- a/keyboards/mode/m65ha_alpha/m65ha_alpha.c +++ b/keyboards/mode/m65ha_alpha/m65ha_alpha.c @@ -18,7 +18,7 @@ along with this program. If not, see . #include "quantum.h" void board_init(void) { - setPinInput(B10); + gpio_set_pin_input(B10); } void led_init_ports(void) { @@ -54,12 +54,12 @@ void led_init_ports(void) { 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(LED_CAPS_LOCK_PIN, !led_state.caps_lock); + gpio_write_pin(LED_CAPS_LOCK_PIN, !led_state.caps_lock); } return res; } diff --git a/keyboards/mode/m65hi_alpha/m65hi_alpha.c b/keyboards/mode/m65hi_alpha/m65hi_alpha.c index afb093058f..0d438b02de 100644 --- a/keyboards/mode/m65hi_alpha/m65hi_alpha.c +++ b/keyboards/mode/m65hi_alpha/m65hi_alpha.c @@ -18,7 +18,7 @@ along with this program. If not, see . #include "quantum.h" void board_init(void) { - setPinInput(B10); + gpio_set_pin_input(B10); } void led_init_ports(void) { @@ -54,12 +54,12 @@ void led_init_ports(void) { 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(LED_CAPS_LOCK_PIN, !led_state.caps_lock); + gpio_write_pin(LED_CAPS_LOCK_PIN, !led_state.caps_lock); } return res; } diff --git a/keyboards/mode/m65s/m65s.c b/keyboards/mode/m65s/m65s.c index 954644310b..13f2ea40ff 100644 --- a/keyboards/mode/m65s/m65s.c +++ b/keyboards/mode/m65s/m65s.c @@ -18,7 +18,7 @@ along with this program. If not, see . #include "quantum.h" void board_init(void) { - setPinInput(B10); + gpio_set_pin_input(B10); } void led_init_ports(void) { @@ -55,12 +55,12 @@ void led_init_ports(void) { 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(LED_CAPS_LOCK_PIN, !led_state.caps_lock); + gpio_write_pin(LED_CAPS_LOCK_PIN, !led_state.caps_lock); } return res; } diff --git a/keyboards/monsgeek/m3/m3.c b/keyboards/monsgeek/m3/m3.c index 9a93a7d7d4..04a9f0ca96 100644 --- a/keyboards/monsgeek/m3/m3.c +++ b/keyboards/monsgeek/m3/m3.c @@ -136,15 +136,15 @@ enum __layers { }; void matrix_init_kb(void) { - setPinOutput(LED_MAC_OS_PIN); // LDE2 MAC\WIN - writePinLow(LED_MAC_OS_PIN); - setPinOutput(LED_WIN_LOCK_PIN); // LED3 Win Lock - writePinLow(LED_WIN_LOCK_PIN); + gpio_set_pin_output(LED_MAC_OS_PIN); // LDE2 MAC\WIN + gpio_write_pin_low(LED_MAC_OS_PIN); + gpio_set_pin_output(LED_WIN_LOCK_PIN); // LED3 Win Lock + gpio_write_pin_low(LED_WIN_LOCK_PIN); } void housekeeping_task_kb(void){ - writePin(LED_MAC_OS_PIN, (get_highest_layer(default_layer_state) == 3)); - writePin(LED_WIN_LOCK_PIN, keymap_config.no_gui); + gpio_write_pin(LED_MAC_OS_PIN, (get_highest_layer(default_layer_state) == 3)); + gpio_write_pin(LED_WIN_LOCK_PIN, keymap_config.no_gui); } bool process_record_kb(uint16_t keycode, keyrecord_t* record) { @@ -166,7 +166,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) { return false; case GU_TOGG: if (record->event.pressed) { - writePin(LED_WIN_LOCK_PIN, !keymap_config.no_gui); + gpio_write_pin(LED_WIN_LOCK_PIN, !keymap_config.no_gui); } return true; case RGB_TOG: diff --git a/keyboards/monsgeek/m5/m5.c b/keyboards/monsgeek/m5/m5.c index 822214a05c..3e1d752581 100644 --- a/keyboards/monsgeek/m5/m5.c +++ b/keyboards/monsgeek/m5/m5.c @@ -149,15 +149,15 @@ const snled27351_led_t PROGMEM g_snled27351_leds[SNLED27351_LED_COUNT] = { #endif void keyboard_pre_init_kb(void) { - setPinOutput(LED_WIN_LOCK_PIN); // LED3 Win Lock - writePinLow(LED_WIN_LOCK_PIN); + gpio_set_pin_output(LED_WIN_LOCK_PIN); // LED3 Win Lock + gpio_write_pin_low(LED_WIN_LOCK_PIN); keyboard_pre_init_user(); } bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if (res) { - writePin(LED_WIN_LOCK_PIN, keymap_config.no_gui); + gpio_write_pin(LED_WIN_LOCK_PIN, keymap_config.no_gui); } return res; } diff --git a/keyboards/monstargear/xo87/solderable/solderable.c b/keyboards/monstargear/xo87/solderable/solderable.c index cb4da24a3a..56f3c524ea 100644 --- a/keyboards/monstargear/xo87/solderable/solderable.c +++ b/keyboards/monstargear/xo87/solderable/solderable.c @@ -23,28 +23,28 @@ #define ledCapSP (80+8) void backlight_init_ports(void) { - setPinOutput(Lseg0); - setPinOutput(Lseg1); - setPinOutput(Lseg2); - setPinOutput(Lseg3); - setPinOutput(Lseg4); - setPinOutput(Lseg5); - setPinOutput(Lcom0); - setPinOutput(Lcom1); - setPinOutput(Lcom2); - setPinOutput(Lcom3); - setPinOutput(Lcom4); - setPinOutput(Lcom5); - setPinOutput(Lcom6); - setPinOutput(Lcom7); - setPinOutput(Lcom8); - setPinOutput(Lcom9); - setPinOutput(Lcom10); - setPinOutput(Lcom11); - setPinOutput(Lcom12); - setPinOutput(Lcom13); - setPinOutput(Lcom14); - setPinOutput(Lcom15); + gpio_set_pin_output(Lseg0); + gpio_set_pin_output(Lseg1); + gpio_set_pin_output(Lseg2); + gpio_set_pin_output(Lseg3); + gpio_set_pin_output(Lseg4); + gpio_set_pin_output(Lseg5); + gpio_set_pin_output(Lcom0); + gpio_set_pin_output(Lcom1); + gpio_set_pin_output(Lcom2); + gpio_set_pin_output(Lcom3); + gpio_set_pin_output(Lcom4); + gpio_set_pin_output(Lcom5); + gpio_set_pin_output(Lcom6); + gpio_set_pin_output(Lcom7); + gpio_set_pin_output(Lcom8); + gpio_set_pin_output(Lcom9); + gpio_set_pin_output(Lcom10); + gpio_set_pin_output(Lcom11); + gpio_set_pin_output(Lcom12); + gpio_set_pin_output(Lcom13); + gpio_set_pin_output(Lcom14); + gpio_set_pin_output(Lcom15); } void backlight_set(uint8_t level) { @@ -54,22 +54,22 @@ void backlight_task(void) { // This is a temporary workaround to get the status LEDs working until we can figure out the LED matrix led_t host_leds = host_keyboard_led_state(); if (host_leds.scroll_lock) { - writePinHigh(Lcom3); - writePinHigh(Lseg5); + gpio_write_pin_high(Lcom3); + gpio_write_pin_high(Lseg5); } else { - writePinLow(Lcom3); + gpio_write_pin_low(Lcom3); } if (host_leds.num_lock) { - writePinHigh(Lcom7); - writePinHigh(Lseg5); + gpio_write_pin_high(Lcom7); + gpio_write_pin_high(Lseg5); } else { - writePinLow(Lcom7); + gpio_write_pin_low(Lcom7); } if (host_leds.caps_lock) { - writePinHigh(Lcom8); - writePinHigh(Lseg5); + gpio_write_pin_high(Lcom8); + gpio_write_pin_high(Lseg5); } else { - writePinLow(Lcom8); + gpio_write_pin_low(Lcom8); } } diff --git a/keyboards/neson_design/700e/700e.c b/keyboards/neson_design/700e/700e.c index a9bcbee288..cdcd90d3e0 100644 --- a/keyboards/neson_design/700e/700e.c +++ b/keyboards/neson_design/700e/700e.c @@ -292,8 +292,8 @@ const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = { void matrix_init_kb(void) { - setPinOutput(LED_CAPS_LOCK_PIN); - writePinLow(LED_CAPS_LOCK_PIN); + gpio_set_pin_output(LED_CAPS_LOCK_PIN); + gpio_write_pin_low(LED_CAPS_LOCK_PIN); is31fl3731_init_drivers(); @@ -363,7 +363,7 @@ bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if (res) { - writePin(LED_CAPS_LOCK_PIN, led_state.caps_lock); + gpio_write_pin(LED_CAPS_LOCK_PIN, led_state.caps_lock); if (rgb_state.state != SELF_TESTING) { if (led_state.caps_lock) { diff --git a/keyboards/neson_design/n6/n6.c b/keyboards/neson_design/n6/n6.c index f257735acc..fc34400b1c 100644 --- a/keyboards/neson_design/n6/n6.c +++ b/keyboards/neson_design/n6/n6.c @@ -296,8 +296,8 @@ const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = { void matrix_init_kb(void) { - setPinOutput(LED_CAPS_LOCK_PIN); - writePinLow(LED_CAPS_LOCK_PIN); + gpio_set_pin_output(LED_CAPS_LOCK_PIN); + gpio_write_pin_low(LED_CAPS_LOCK_PIN); is31fl3731_init_drivers(); @@ -358,7 +358,7 @@ bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if (res) { - writePin(LED_CAPS_LOCK_PIN, led_state.caps_lock); + gpio_write_pin(LED_CAPS_LOCK_PIN, led_state.caps_lock); if (rgb_state.state != SELF_TESTING) { if (led_state.caps_lock) { diff --git a/keyboards/nopunin10did/kastenwagen1840/kastenwagen1840.c b/keyboards/nopunin10did/kastenwagen1840/kastenwagen1840.c index 01eb8f3903..995434bb2c 100644 --- a/keyboards/nopunin10did/kastenwagen1840/kastenwagen1840.c +++ b/keyboards/nopunin10did/kastenwagen1840/kastenwagen1840.c @@ -19,29 +19,29 @@ #ifndef LAYER_LED_DISABLE void keyboard_pre_init_kb(void) { - setPinOutput(LED_INDICATOR_TOP); - setPinOutput(LED_INDICATOR_MID); - setPinOutput(LED_INDICATOR_BOT); + gpio_set_pin_output(LED_INDICATOR_TOP); + gpio_set_pin_output(LED_INDICATOR_MID); + gpio_set_pin_output(LED_INDICATOR_BOT); keyboard_pre_init_user(); } __attribute__((weak)) layer_state_t layer_state_set_user(layer_state_t state) { - writePinHigh(LED_INDICATOR_TOP); - writePinHigh(LED_INDICATOR_MID); - writePinHigh(LED_INDICATOR_BOT); + gpio_write_pin_high(LED_INDICATOR_TOP); + gpio_write_pin_high(LED_INDICATOR_MID); + gpio_write_pin_high(LED_INDICATOR_BOT); switch(get_highest_layer(state) % 4) { case 1: - writePinLow(LED_INDICATOR_TOP); - writePinLow(LED_INDICATOR_MID); + gpio_write_pin_low(LED_INDICATOR_TOP); + gpio_write_pin_low(LED_INDICATOR_MID); break; case 2: - writePinLow(LED_INDICATOR_TOP); - writePinLow(LED_INDICATOR_BOT); + gpio_write_pin_low(LED_INDICATOR_TOP); + gpio_write_pin_low(LED_INDICATOR_BOT); break; case 3: - writePinLow(LED_INDICATOR_MID); - writePinLow(LED_INDICATOR_BOT); + gpio_write_pin_low(LED_INDICATOR_MID); + gpio_write_pin_low(LED_INDICATOR_BOT); break; } return state; diff --git a/keyboards/nopunin10did/kastenwagen48/kastenwagen48.c b/keyboards/nopunin10did/kastenwagen48/kastenwagen48.c index 01eb8f3903..995434bb2c 100644 --- a/keyboards/nopunin10did/kastenwagen48/kastenwagen48.c +++ b/keyboards/nopunin10did/kastenwagen48/kastenwagen48.c @@ -19,29 +19,29 @@ #ifndef LAYER_LED_DISABLE void keyboard_pre_init_kb(void) { - setPinOutput(LED_INDICATOR_TOP); - setPinOutput(LED_INDICATOR_MID); - setPinOutput(LED_INDICATOR_BOT); + gpio_set_pin_output(LED_INDICATOR_TOP); + gpio_set_pin_output(LED_INDICATOR_MID); + gpio_set_pin_output(LED_INDICATOR_BOT); keyboard_pre_init_user(); } __attribute__((weak)) layer_state_t layer_state_set_user(layer_state_t state) { - writePinHigh(LED_INDICATOR_TOP); - writePinHigh(LED_INDICATOR_MID); - writePinHigh(LED_INDICATOR_BOT); + gpio_write_pin_high(LED_INDICATOR_TOP); + gpio_write_pin_high(LED_INDICATOR_MID); + gpio_write_pin_high(LED_INDICATOR_BOT); switch(get_highest_layer(state) % 4) { case 1: - writePinLow(LED_INDICATOR_TOP); - writePinLow(LED_INDICATOR_MID); + gpio_write_pin_low(LED_INDICATOR_TOP); + gpio_write_pin_low(LED_INDICATOR_MID); break; case 2: - writePinLow(LED_INDICATOR_TOP); - writePinLow(LED_INDICATOR_BOT); + gpio_write_pin_low(LED_INDICATOR_TOP); + gpio_write_pin_low(LED_INDICATOR_BOT); break; case 3: - writePinLow(LED_INDICATOR_MID); - writePinLow(LED_INDICATOR_BOT); + gpio_write_pin_low(LED_INDICATOR_MID); + gpio_write_pin_low(LED_INDICATOR_BOT); break; } return state; diff --git a/keyboards/novelkeys/nk65b/nk65b.c b/keyboards/novelkeys/nk65b/nk65b.c index 370814aabd..369bab262f 100755 --- a/keyboards/novelkeys/nk65b/nk65b.c +++ b/keyboards/novelkeys/nk65b/nk65b.c @@ -24,8 +24,8 @@ void led_init_ports(void) { } layer_state_t layer_state_set_kb(layer_state_t state) { - writePin(A15, !layer_state_cmp(state, 1)); - writePin(B3, !layer_state_cmp(state, 2)); + gpio_write_pin(A15, !layer_state_cmp(state, 1)); + gpio_write_pin(B3, !layer_state_cmp(state, 2)); return layer_state_set_user(state); } diff --git a/keyboards/novelkeys/nk87b/nk87b.c b/keyboards/novelkeys/nk87b/nk87b.c index a0686d5b09..125b5d7404 100644 --- a/keyboards/novelkeys/nk87b/nk87b.c +++ b/keyboards/novelkeys/nk87b/nk87b.c @@ -25,8 +25,8 @@ void led_init_ports(void) { } layer_state_t layer_state_set_kb(layer_state_t state) { - writePin(A3, !layer_state_cmp(state, 1)); - writePin(A4, !layer_state_cmp(state, 2)); + gpio_write_pin(A3, !layer_state_cmp(state, 1)); + gpio_write_pin(A4, !layer_state_cmp(state, 2)); return layer_state_set_user(state); } diff --git a/keyboards/noxary/220/220.c b/keyboards/noxary/220/220.c index caeb13a799..c5affa4344 100644 --- a/keyboards/noxary/220/220.c +++ b/keyboards/noxary/220/220.c @@ -22,13 +22,13 @@ void matrix_init_kb(void) { // put your keyboard start-up code here // runs once when the firmware starts up - setPinOutput(C6); + gpio_set_pin_output(C6); matrix_init_user(); } bool led_update_kb(led_t led_state) { if(led_update_user(led_state)) { - writePin(C6, led_state.num_lock); + gpio_write_pin(C6, led_state.num_lock); } return true; } \ No newline at end of file diff --git a/keyboards/noxary/268_2/268_2.c b/keyboards/noxary/268_2/268_2.c index 60d54a681c..56b42d2343 100644 --- a/keyboards/noxary/268_2/268_2.c +++ b/keyboards/noxary/268_2/268_2.c @@ -18,13 +18,13 @@ void matrix_init_kb(void) { // put your keyboard start-up code here // runs once when the firmware starts up - setPinOutput(B0); + gpio_set_pin_output(B0); matrix_init_user(); } bool led_update_kb(led_t led_state) { if(led_update_user(led_state)) { - writePin(B0, led_state.caps_lock); + gpio_write_pin(B0, led_state.caps_lock); } return true; } diff --git a/keyboards/noxary/280/280.c b/keyboards/noxary/280/280.c index 8bece8dee1..0f29df178f 100644 --- a/keyboards/noxary/280/280.c +++ b/keyboards/noxary/280/280.c @@ -23,15 +23,15 @@ void matrix_init_kb(void) { // put your keyboard start-up code here // runs once when the firmware starts up - setPinOutput(D5); - setPinOutput(D0); + gpio_set_pin_output(D5); + gpio_set_pin_output(D0); matrix_init_user(); } bool led_update_kb(led_t led_state) { if(led_update_user(led_state)) { - writePin(D5, led_state.caps_lock); - writePin(D0, led_state.scroll_lock); + gpio_write_pin(D5, led_state.caps_lock); + gpio_write_pin(D0, led_state.scroll_lock); } return true; } \ No newline at end of file diff --git a/keyboards/noxary/x268/x268.c b/keyboards/noxary/x268/x268.c index 54c37b2079..67d6dff89d 100644 --- a/keyboards/noxary/x268/x268.c +++ b/keyboards/noxary/x268/x268.c @@ -22,13 +22,13 @@ void matrix_init_kb(void) { // put your keyboard start-up code here // runs once when the firmware starts up - setPinOutput(B0); + gpio_set_pin_output(B0); matrix_init_user(); } bool led_update_kb(led_t led_state) { if(led_update_user(led_state)) { - writePin(B0, led_state.caps_lock); + gpio_write_pin(B0, led_state.caps_lock); } return true; } diff --git a/keyboards/nullbitsco/common/bitc_led.c b/keyboards/nullbitsco/common/bitc_led.c index 64d7c7160a..8f91e665f8 100644 --- a/keyboards/nullbitsco/common/bitc_led.c +++ b/keyboards/nullbitsco/common/bitc_led.c @@ -18,17 +18,17 @@ void set_bitc_LED(uint8_t mode) { switch(mode) { case LED_ON: - setPinOutput(PIN_LED); - writePin(PIN_LED, GPIO_STATE_HIGH); + gpio_set_pin_output(PIN_LED); + gpio_write_pin(PIN_LED, GPIO_STATE_HIGH); break; case LED_DIM: - setPinInput(PIN_LED); + gpio_set_pin_input(PIN_LED); break; case LED_OFF: - setPinOutput(PIN_LED); - writePin(PIN_LED, GPIO_STATE_LOW); + gpio_set_pin_output(PIN_LED); + gpio_write_pin(PIN_LED, GPIO_STATE_LOW); break; default: diff --git a/keyboards/nullbitsco/nibble/big_led.c b/keyboards/nullbitsco/nibble/big_led.c index d66a808153..0e61b440b6 100644 --- a/keyboards/nullbitsco/nibble/big_led.c +++ b/keyboards/nullbitsco/nibble/big_led.c @@ -24,13 +24,13 @@ void set_big_LED_rgb(uint8_t r_mode, uint8_t g_mode, uint8_t b_mode) { void set_big_LED_r(uint8_t mode) { switch(mode) { case LED_ON: - setPinOutput(BIG_LED_R_PIN); - writePin(BIG_LED_R_PIN, GPIO_STATE_HIGH); + gpio_set_pin_output(BIG_LED_R_PIN); + gpio_write_pin(BIG_LED_R_PIN, GPIO_STATE_HIGH); break; case LED_OFF: - setPinOutput(BIG_LED_R_PIN); - writePin(BIG_LED_R_PIN, GPIO_STATE_LOW); + gpio_set_pin_output(BIG_LED_R_PIN); + gpio_write_pin(BIG_LED_R_PIN, GPIO_STATE_LOW); break; default: @@ -41,13 +41,13 @@ void set_big_LED_r(uint8_t mode) { void set_big_LED_g(uint8_t mode) { switch(mode) { case LED_ON: - setPinOutput(BIG_LED_G_PIN); - writePin(BIG_LED_G_PIN, GPIO_STATE_HIGH); + gpio_set_pin_output(BIG_LED_G_PIN); + gpio_write_pin(BIG_LED_G_PIN, GPIO_STATE_HIGH); break; case LED_OFF: - setPinOutput(BIG_LED_G_PIN); - writePin(BIG_LED_G_PIN, GPIO_STATE_LOW); + gpio_set_pin_output(BIG_LED_G_PIN); + gpio_write_pin(BIG_LED_G_PIN, GPIO_STATE_LOW); break; default: @@ -58,13 +58,13 @@ void set_big_LED_g(uint8_t mode) { void set_big_LED_b(uint8_t mode) { switch(mode) { case LED_ON: - setPinOutput(BIG_LED_B_PIN); - writePin(BIG_LED_B_PIN, GPIO_STATE_HIGH); + gpio_set_pin_output(BIG_LED_B_PIN); + gpio_write_pin(BIG_LED_B_PIN, GPIO_STATE_HIGH); break; case LED_OFF: - setPinOutput(BIG_LED_B_PIN); - writePin(BIG_LED_B_PIN, GPIO_STATE_LOW); + gpio_set_pin_output(BIG_LED_B_PIN); + gpio_write_pin(BIG_LED_B_PIN, GPIO_STATE_LOW); break; default: diff --git a/keyboards/nullbitsco/nibble/matrix.c b/keyboards/nullbitsco/nibble/matrix.c index 6508b704e9..7ea5a6c470 100644 --- a/keyboards/nullbitsco/nibble/matrix.c +++ b/keyboards/nullbitsco/nibble/matrix.c @@ -27,17 +27,17 @@ static const uint8_t col_pins[MATRIX_MUX_COLS] = MATRIX_COL_MUX_PINS; static void init_pins(void) { // Set cols to outputs, low for (uint8_t pin = 0; pin < MATRIX_MUX_COLS; pin++) { - setPinOutput(col_pins[pin]); + gpio_set_pin_output(col_pins[pin]); } // Unselect cols for (uint8_t bit = 0; bit < MATRIX_MUX_COLS; bit++) { - writePinLow(col_pins[bit]); + gpio_write_pin_low(col_pins[bit]); } // Set rows to input, pullup for (uint8_t pin = 0; pin < MATRIX_ROWS; pin++) { - setPinInputHigh(row_pins[pin]); + gpio_set_pin_input_high(row_pins[pin]); } } @@ -45,7 +45,7 @@ static void select_col(uint8_t col) { for (uint8_t bit = 0; bit < MATRIX_MUX_COLS; bit++) { uint8_t state = (col & (0b1 << bit)) >> bit; - writePin(col_pins[bit], state); + gpio_write_pin(col_pins[bit], state); } } @@ -60,7 +60,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) { matrix_row_t last_row_value = current_matrix[row_index]; - if (!readPin(row_pins[row_index])) + if (!gpio_read_pin(row_pins[row_index])) { current_matrix[row_index] |= (COL_SHIFTER << current_col); } diff --git a/keyboards/nullbitsco/scramble/v1/v1.c b/keyboards/nullbitsco/scramble/v1/v1.c index 4b5e8e3e67..3a85dce192 100644 --- a/keyboards/nullbitsco/scramble/v1/v1.c +++ b/keyboards/nullbitsco/scramble/v1/v1.c @@ -6,17 +6,17 @@ void set_scramble_LED(uint8_t mode) { switch(mode) { case LED_ON: - setPinOutput(PIN_LED); - writePin(PIN_LED, GPIO_STATE_HIGH); + gpio_set_pin_output(PIN_LED); + gpio_write_pin(PIN_LED, GPIO_STATE_HIGH); break; case LED_DIM: - setPinInput(PIN_LED); + gpio_set_pin_input(PIN_LED); break; case LED_OFF: - setPinOutput(PIN_LED); - writePin(PIN_LED, GPIO_STATE_LOW); + gpio_set_pin_output(PIN_LED); + gpio_write_pin(PIN_LED, GPIO_STATE_LOW); break; default: diff --git a/keyboards/nullbitsco/snap/matrix.c b/keyboards/nullbitsco/snap/matrix.c index 3cd3f5c37e..64b451641d 100644 --- a/keyboards/nullbitsco/snap/matrix.c +++ b/keyboards/nullbitsco/snap/matrix.c @@ -37,23 +37,23 @@ static uint8_t* col_pins = col_pins_left; static void init_pins(void) { // Set cols to outputs, low for (uint8_t pin = 0; pin < MATRIX_MUX_COLS; pin++) { - setPinOutput(col_pins[pin]); + gpio_set_pin_output(col_pins[pin]); } // Unselect cols for (uint8_t bit = 0; bit < MATRIX_MUX_COLS; bit++) { - writePinLow(col_pins[bit]); + gpio_write_pin_low(col_pins[bit]); } // Set rows to input, pullup for (uint8_t pin = 0; pin < ROWS_PER_HAND; pin++) { - setPinInputHigh(row_pins[pin]); + gpio_set_pin_input_high(row_pins[pin]); } // Set extended pin (only on right side) if (!isLeftHand) { // Set extended pin to input, pullup - setPinInputHigh(MATRIX_EXT_PIN_RIGHT); + gpio_set_pin_input_high(MATRIX_EXT_PIN_RIGHT); } } @@ -61,7 +61,7 @@ static void select_col(uint8_t col) { // Drive demux with correct column address for (uint8_t bit = 0; bit < MATRIX_MUX_COLS; bit++) { uint8_t state = (col & (0b1 << bit)) >> bit; - writePin(col_pins[bit], !state); + gpio_write_pin(col_pins[bit], !state); } } @@ -71,7 +71,7 @@ static void read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) // Read each row sequentially for (uint8_t row_index = 0; row_index < ROWS_PER_HAND; row_index++) { - if (readPin(row_pins[row_index]) == 0) { + if (gpio_read_pin(row_pins[row_index]) == 0) { current_matrix[row_index] |= (COL_SHIFTER << current_col); } else { current_matrix[row_index] &= ~(COL_SHIFTER << current_col); @@ -82,7 +82,7 @@ static void read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) static void read_ext_pin(matrix_row_t current_matrix[]) { // Read the state of the extended matrix pin if (!isLeftHand) { - if (readPin(MATRIX_EXT_PIN_RIGHT) == 0) { + if (gpio_read_pin(MATRIX_EXT_PIN_RIGHT) == 0) { current_matrix[EXT_PIN_ROW] |= (COL_SHIFTER << EXT_PIN_COL); } else { current_matrix[EXT_PIN_ROW] &= ~(COL_SHIFTER << EXT_PIN_COL); diff --git a/keyboards/om60/matrix.c b/keyboards/om60/matrix.c index b0e252ec45..837abcdca1 100644 --- a/keyboards/om60/matrix.c +++ b/keyboards/om60/matrix.c @@ -31,37 +31,37 @@ static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; static void select_row(uint8_t row) { - setPinOutput(row_pins[row]); - writePinLow(row_pins[row]); + gpio_set_pin_output(row_pins[row]); + gpio_write_pin_low(row_pins[row]); } static void unselect_row(uint8_t row) { - setPinInputHigh(row_pins[row]); + gpio_set_pin_input_high(row_pins[row]); } static void unselect_rows(void) { for(uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } } static void select_col(uint8_t col) { - setPinOutput(col_pins[col]); - writePinLow(col_pins[col]); + gpio_set_pin_output(col_pins[col]); + gpio_write_pin_low(col_pins[col]); } static void unselect_col(uint8_t col) { - setPinInputHigh(col_pins[col]); + gpio_set_pin_input_high(col_pins[col]); } static void unselect_cols(void) { for(uint8_t x = 0; x < MATRIX_COLS; x++) { - setPinInputHigh(col_pins[x]); + gpio_set_pin_input_high(col_pins[x]); } } @@ -69,10 +69,10 @@ static void init_pins(void) { unselect_rows(); unselect_cols(); for (uint8_t x = 0; x < MATRIX_COLS; x++) { - setPinInputHigh(col_pins[x]); + gpio_set_pin_input_high(col_pins[x]); } for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } } @@ -92,7 +92,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) for(uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { // Select the col pin to read (active low) - uint8_t pin_state = readPin(col_pins[col_index]); + uint8_t pin_state = gpio_read_pin(col_pins[col_index]); // Populate the matrix row with the state of the col pin current_matrix[current_row] |= pin_state ? 0 : (ROW_SHIFTER << col_index); @@ -120,7 +120,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) matrix_row_t last_row_value = current_matrix[tmp]; // Check row pin state - if (readPin(row_pins[row_index]) == 0) + if (gpio_read_pin(row_pins[row_index]) == 0) { // Pin LO, set col bit current_matrix[tmp] |= (ROW_SHIFTER << current_col); diff --git a/keyboards/opendeck/32/rev1/rev1.c b/keyboards/opendeck/32/rev1/rev1.c index 8b3f9c0222..ca05d12243 100644 --- a/keyboards/opendeck/32/rev1/rev1.c +++ b/keyboards/opendeck/32/rev1/rev1.c @@ -90,12 +90,12 @@ led_config_t g_led_config = { void keyboard_pre_init_kb(void) { // Light power LED - setPinOutput(POWER_LED_PIN); - writePinLow(POWER_LED_PIN); + gpio_set_pin_output(POWER_LED_PIN); + gpio_write_pin_low(POWER_LED_PIN); // We don't use this feature of the IS31FL3731 but it is electrically connected // Make sure not to drive it - setPinInput(IS31FL3731_IRQ_PIN); + gpio_set_pin_input(IS31FL3731_IRQ_PIN); keyboard_pre_init_user(); } diff --git a/keyboards/ortho5by12/ortho5by12.c b/keyboards/ortho5by12/ortho5by12.c index 29173749ae..d0d9ce9102 100644 --- a/keyboards/ortho5by12/ortho5by12.c +++ b/keyboards/ortho5by12/ortho5by12.c @@ -16,15 +16,15 @@ #include "quantum.h" void matrix_init_kb(void) { - setPinOutput(C4); - setPinOutput(C5); + gpio_set_pin_output(C4); + gpio_set_pin_output(C5); } bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if(res) { - writePin(C4, led_state.num_lock); - writePin(C5, led_state.caps_lock); + gpio_write_pin(C4, led_state.num_lock); + gpio_write_pin(C5, led_state.caps_lock); } return res; } diff --git a/keyboards/peej/lumberjack/lumberjack.c b/keyboards/peej/lumberjack/lumberjack.c index 111092d579..fce14ac7de 100644 --- a/keyboards/peej/lumberjack/lumberjack.c +++ b/keyboards/peej/lumberjack/lumberjack.c @@ -17,8 +17,8 @@ #include "lumberjack.h" void keyboard_pre_init_kb() { - setPinOutput(LED1); - setPinOutput(LED2); + gpio_set_pin_output(LED1); + gpio_set_pin_output(LED2); keyboard_pre_init_user(); } diff --git a/keyboards/peej/rosaline/rosaline.c b/keyboards/peej/rosaline/rosaline.c index df0594da44..0ebcb76660 100644 --- a/keyboards/peej/rosaline/rosaline.c +++ b/keyboards/peej/rosaline/rosaline.c @@ -17,13 +17,13 @@ #include "quantum.h" bool process_record_kb(uint16_t keycode, keyrecord_t *record) { - writePin(LED1, record->event.pressed); + gpio_write_pin(LED1, record->event.pressed); return process_record_user(keycode, record); } layer_state_t layer_state_set_kb(layer_state_t state) { - writePin(LED2, state); + gpio_write_pin(LED2, state); return layer_state_set_user(state); } diff --git a/keyboards/percent/canoe_gen2/canoe_gen2.c b/keyboards/percent/canoe_gen2/canoe_gen2.c index d174d01876..ea091c3474 100644 --- a/keyboards/percent/canoe_gen2/canoe_gen2.c +++ b/keyboards/percent/canoe_gen2/canoe_gen2.c @@ -18,15 +18,15 @@ along with this program. If not, see . #include "quantum.h" void keyboard_pre_init_kb(void) { - setPinOutput(E6); - writePinHigh(E6); - + gpio_set_pin_output(E6); + gpio_write_pin_high(E6); + keyboard_pre_init_user(); } bool led_update_kb(led_t led_state) { if(led_update_user(led_state)) { - writePin(E6, !led_state.caps_lock); + gpio_write_pin(E6, !led_state.caps_lock); } return true; diff --git a/keyboards/pica40/rev2/rev2.c b/keyboards/pica40/rev2/rev2.c index 2ee73dcc6b..0ba9a53734 100644 --- a/keyboards/pica40/rev2/rev2.c +++ b/keyboards/pica40/rev2/rev2.c @@ -11,7 +11,7 @@ // custom handler that returns encoder B pin status from slave side void encoder_sync_slave_handler(uint8_t in_buflen, const void *in_data, uint8_t out_buflen, void *out_data) { - *(uint8_t *)out_data = readPin(ENCODER_PIN_B) ? 1 : 0; + *(uint8_t *)out_data = gpio_read_pin(ENCODER_PIN_B) ? 1 : 0; } void encoder_quadrature_init_pin(uint8_t index, bool pad_b) {} @@ -22,7 +22,7 @@ uint8_t encoder_quadrature_read_pin(uint8_t index, bool pad_b) { transaction_rpc_recv(ENCODER_SYNC, sizeof(data), &data); return data; } - return readPin(ENCODER_PIN_A) ? 1 : 0; + return gpio_read_pin(ENCODER_PIN_A) ? 1 : 0; } #endif // ENCODER_ENABLE @@ -53,11 +53,11 @@ bool should_set_rgblight = false; #endif // defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_LAYERS) void keyboard_post_init_kb(void) { - setPinOutput(PICA40_RGB_POWER_PIN); + gpio_set_pin_output(PICA40_RGB_POWER_PIN); #ifdef ENCODER_ENABLE - setPinInputHigh(ENCODER_PIN_A); - setPinInputHigh(ENCODER_PIN_B); + gpio_set_pin_input_high(ENCODER_PIN_A); + gpio_set_pin_input_high(ENCODER_PIN_B); transaction_register_rpc(ENCODER_SYNC, encoder_sync_slave_handler); #endif // ENCODER_ENABLE @@ -113,9 +113,9 @@ void housekeeping_task_kb(void) { should_set_rgblight = true; if (is_layer_active) { - writePinHigh(PICA40_RGB_POWER_PIN); + gpio_write_pin_high(PICA40_RGB_POWER_PIN); } else { - writePinLow(PICA40_RGB_POWER_PIN); + gpio_write_pin_low(PICA40_RGB_POWER_PIN); } } } diff --git a/keyboards/planck/planck.c b/keyboards/planck/planck.c index 660be55bab..9410b71a97 100644 --- a/keyboards/planck/planck.c +++ b/keyboards/planck/planck.c @@ -4,8 +4,8 @@ __attribute__ ((weak)) void matrix_init_kb(void) { // Turn status LED on, with the exception of THK #if defined(__AVR_ATmega32U4__) - setPinOutput(E6); - writePinHigh(E6); + gpio_set_pin_output(E6); + gpio_write_pin_high(E6); #endif matrix_init_user(); diff --git a/keyboards/planck/rev6_drop/matrix.c b/keyboards/planck/rev6_drop/matrix.c index d140356738..4d535fbb03 100644 --- a/keyboards/planck/rev6_drop/matrix.c +++ b/keyboards/planck/rev6_drop/matrix.c @@ -27,13 +27,13 @@ static matrix_row_t matrix_inverted[MATRIX_COLS]; void matrix_init_custom(void) { // actual matrix setup - cols for (int i = 0; i < MATRIX_COLS; i++) { - setPinOutput(matrix_col_pins[i]); - writePinLow(matrix_col_pins[i]); + gpio_set_pin_output(matrix_col_pins[i]); + gpio_write_pin_low(matrix_col_pins[i]); } // rows for (int i = 0; i < MATRIX_ROWS; i++) { - setPinInputLow(matrix_row_pins[i]); + gpio_set_pin_input_low(matrix_row_pins[i]); } } @@ -45,18 +45,18 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { matrix_row_t data = 0; // strobe col - writePinHigh(matrix_col_pins[col]); + gpio_write_pin_high(matrix_col_pins[col]); // need wait to settle pin state wait_us(20); // read row data for (int row = 0; row < MATRIX_ROWS; row++) { - data |= (readPin(matrix_row_pins[row]) << row); + data |= (gpio_read_pin(matrix_row_pins[row]) << row); } // unstrobe col - writePinLow(matrix_col_pins[col]); + gpio_write_pin_low(matrix_col_pins[col]); if (matrix_inverted[col] != data) { matrix_inverted[col] = data; diff --git a/keyboards/planck/rev7/matrix.c b/keyboards/planck/rev7/matrix.c index 8cadfa5e8d..777bd6a7fe 100644 --- a/keyboards/planck/rev7/matrix.c +++ b/keyboards/planck/rev7/matrix.c @@ -44,18 +44,18 @@ static matrix_row_t matrix_inverted[MATRIX_COLS]; void matrix_init_custom(void) { // actual matrix setup - cols for (int i = 0; i < MATRIX_COLS; i++) { - setPinOutput(matrix_col_pins[i]); - writePinLow(matrix_col_pins[i]); + gpio_set_pin_output(matrix_col_pins[i]); + gpio_write_pin_low(matrix_col_pins[i]); } // rows for (int i = 0; i < MATRIX_ROWS; i++) { - setPinInputLow(matrix_row_pins[i]); + gpio_set_pin_input_low(matrix_row_pins[i]); } // encoder A & B setup - setPinInputLow(B12); - setPinInputLow(B13); + gpio_set_pin_input_low(B12); + gpio_set_pin_input_low(B13); #ifndef PLANCK_WATCHDOG_DISABLE wdgInit(); @@ -81,18 +81,18 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { matrix_row_t data = 0; // strobe col - writePinHigh(matrix_col_pins[col]); + gpio_write_pin_high(matrix_col_pins[col]); // need wait to settle pin state wait_us(20); // read row data for (int row = 0; row < MATRIX_ROWS; row++) { - data |= (readPin(matrix_row_pins[row]) << row); + data |= (gpio_read_pin(matrix_row_pins[row]) << row); } // unstrobe col - writePinLow(matrix_col_pins[col]); + gpio_write_pin_low(matrix_col_pins[col]); if (matrix_inverted[col] != data) { matrix_inverted[col] = data; @@ -113,11 +113,11 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { uint8_t encoder_quadrature_read_pin(uint8_t index, bool pad_b) { pin_t pin = pad_b ? B13: B12; - setPinInputHigh(pin); - writePinLow(matrix_row_pins[index]); + gpio_set_pin_input_high(pin); + gpio_write_pin_low(matrix_row_pins[index]); wait_us(10); - uint8_t ret = readPin(pin) ? 1 : 0; - setPinInputLow(matrix_row_pins[index]); - setPinInputLow(pin); + uint8_t ret = gpio_read_pin(pin) ? 1 : 0; + gpio_set_pin_input_low(matrix_row_pins[index]); + gpio_set_pin_input_low(pin); return ret; } diff --git a/keyboards/pom_keyboards/tnln95/tnln95.c b/keyboards/pom_keyboards/tnln95/tnln95.c index 12651327ea..b8ab8ff7a7 100644 --- a/keyboards/pom_keyboards/tnln95/tnln95.c +++ b/keyboards/pom_keyboards/tnln95/tnln95.c @@ -16,11 +16,11 @@ #include "quantum.h" void keyboard_pre_init_kb(void) { - setPinOutput(B1); - setPinOutput(B2); + gpio_set_pin_output(B1); + gpio_set_pin_output(B2); /* I will add function to these later */ - // setPinOutput(B3); - // setPinOutput(E2); + // gpio_set_pin_output(B3); + // gpio_set_pin_output(E2); keyboard_pre_init_user(); } @@ -28,8 +28,8 @@ void keyboard_pre_init_kb(void) { bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if(res) { - writePin(B1, led_state.num_lock); - writePin(B2, led_state.caps_lock); + gpio_write_pin(B1, led_state.num_lock); + gpio_write_pin(B2, led_state.caps_lock); } return res; } diff --git a/keyboards/preonic/rev1/rev1.c b/keyboards/preonic/rev1/rev1.c index eed51f2d84..8613da79ee 100644 --- a/keyboards/preonic/rev1/rev1.c +++ b/keyboards/preonic/rev1/rev1.c @@ -18,8 +18,8 @@ void matrix_init_kb(void) { // Turn status LED on - setPinOutput(E6); - writePinHigh(E6); + gpio_set_pin_output(E6); + gpio_write_pin_high(E6); matrix_init_user(); }; diff --git a/keyboards/preonic/rev2/rev2.c b/keyboards/preonic/rev2/rev2.c index eed51f2d84..8613da79ee 100644 --- a/keyboards/preonic/rev2/rev2.c +++ b/keyboards/preonic/rev2/rev2.c @@ -18,8 +18,8 @@ void matrix_init_kb(void) { // Turn status LED on - setPinOutput(E6); - writePinHigh(E6); + gpio_set_pin_output(E6); + gpio_write_pin_high(E6); matrix_init_user(); }; diff --git a/keyboards/primekb/meridian/meridian.c b/keyboards/primekb/meridian/meridian.c index c2f740dd14..585769e462 100644 --- a/keyboards/primekb/meridian/meridian.c +++ b/keyboards/primekb/meridian/meridian.c @@ -19,7 +19,7 @@ along with this program. If not, see . //Initialize B12 for in-switch caps lock void keyboard_pre_init_kb(void){ - setPinOutput(B12); + gpio_set_pin_output(B12); keyboard_pre_init_user(); } @@ -35,7 +35,7 @@ void keyboard_post_init_user(void) { bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if (res) { - // writePin(B12, !led_state.caps_lock); //Un-comment this line to enable in-switch capslock indicator + // gpio_write_pin(B12, !led_state.caps_lock); //Un-comment this line to enable in-switch capslock indicator if (led_state.caps_lock) { rgblight_setrgb_at(0, 255, 0, 0); //green } else { diff --git a/keyboards/projectd/65/projectd_65_ansi/projectd_65_ansi.c b/keyboards/projectd/65/projectd_65_ansi/projectd_65_ansi.c index e2a85a75c3..7d7989fdde 100644 --- a/keyboards/projectd/65/projectd_65_ansi/projectd_65_ansi.c +++ b/keyboards/projectd/65/projectd_65_ansi/projectd_65_ansi.c @@ -118,9 +118,9 @@ void spi_init(void) { is_initialised = true; // Try releasing special pins for a short time - setPinInput(SPI_SCK_PIN); - setPinInput(SPI_MOSI_PIN); - setPinInput(SPI_MISO_PIN); + gpio_set_pin_input(SPI_SCK_PIN); + gpio_set_pin_input(SPI_MOSI_PIN); + gpio_set_pin_input(SPI_MISO_PIN); chThdSleepMilliseconds(10); diff --git a/keyboards/projectd/75/ansi/ansi.c b/keyboards/projectd/75/ansi/ansi.c index f32bf369a9..8257cf39c2 100644 --- a/keyboards/projectd/75/ansi/ansi.c +++ b/keyboards/projectd/75/ansi/ansi.c @@ -134,9 +134,9 @@ void spi_init(void) { is_initialised = true; // Try releasing special pins for a short time - setPinInput(SPI_SCK_PIN); - setPinInput(SPI_MOSI_PIN); - setPinInput(SPI_MISO_PIN); + gpio_set_pin_input(SPI_SCK_PIN); + gpio_set_pin_input(SPI_MOSI_PIN); + gpio_set_pin_input(SPI_MISO_PIN); chThdSleepMilliseconds(10); diff --git a/keyboards/projectkb/alice/alice.c b/keyboards/projectkb/alice/alice.c index 5e5687f7e8..8ec5f16736 100644 --- a/keyboards/projectkb/alice/alice.c +++ b/keyboards/projectkb/alice/alice.c @@ -1,9 +1,9 @@ #include "quantum.h" void keyboard_pre_init_kb(void) { - setPinOutput(INDICATOR_PIN_0); - setPinOutput(INDICATOR_PIN_1); - setPinOutput(INDICATOR_PIN_2); + gpio_set_pin_output(INDICATOR_PIN_0); + gpio_set_pin_output(INDICATOR_PIN_1); + gpio_set_pin_output(INDICATOR_PIN_2); keyboard_pre_init_user(); } @@ -12,9 +12,9 @@ void keyboard_pre_init_kb(void) { bool led_update_kb(led_t led_state) { bool runDefault = led_update_user(led_state); if (runDefault) { - writePin(INDICATOR_PIN_0, !led_state.num_lock); - writePin(INDICATOR_PIN_1, !led_state.caps_lock); - writePin(INDICATOR_PIN_2, !led_state.scroll_lock); + gpio_write_pin(INDICATOR_PIN_0, !led_state.num_lock); + gpio_write_pin(INDICATOR_PIN_1, !led_state.caps_lock); + gpio_write_pin(INDICATOR_PIN_2, !led_state.scroll_lock); } return runDefault; } diff --git a/keyboards/protozoa/event_horizon/event_horizon.c b/keyboards/protozoa/event_horizon/event_horizon.c index 544d7c32b2..a8977a0e03 100644 --- a/keyboards/protozoa/event_horizon/event_horizon.c +++ b/keyboards/protozoa/event_horizon/event_horizon.c @@ -17,5 +17,5 @@ void led_init_ports(void) { // Set our LED pins as open drain outputs - setPinOutputOpenDrain(LED_CAPS_LOCK_PIN); + gpio_set_pin_output_open_drain(LED_CAPS_LOCK_PIN); } diff --git a/keyboards/punk75/punk75.c b/keyboards/punk75/punk75.c index aaabefb5aa..8d9d09d43c 100644 --- a/keyboards/punk75/punk75.c +++ b/keyboards/punk75/punk75.c @@ -18,7 +18,7 @@ void matrix_init_kb(void) { // Set our LED pin as output - setPinOutput(LED); + gpio_set_pin_output(LED); matrix_init_user(); } @@ -26,7 +26,7 @@ void matrix_init_kb(void) { bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if(res) { - writePin(LED, !led_state.caps_lock); + gpio_write_pin(LED, !led_state.caps_lock); } return res; } diff --git a/keyboards/quad_h/lb75/lb75.c b/keyboards/quad_h/lb75/lb75.c index 4c8e4f929b..ef716092b9 100644 --- a/keyboards/quad_h/lb75/lb75.c +++ b/keyboards/quad_h/lb75/lb75.c @@ -20,8 +20,8 @@ void matrix_init_kb(void) { // put your keyboard start-up code here // runs once when the firmware starts up - setPinOutput(B1); - setPinOutput(B2); + gpio_set_pin_output(B1); + gpio_set_pin_output(B2); matrix_init_user(); } @@ -30,8 +30,8 @@ bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if(res) { - writePin(B1, !led_state.caps_lock); - writePin(B2, !led_state.scroll_lock); + gpio_write_pin(B1, !led_state.caps_lock); + gpio_write_pin(B2, !led_state.scroll_lock); } return res; diff --git a/keyboards/qvex/lynepad/lynepad.c b/keyboards/qvex/lynepad/lynepad.c index cc69e12240..0e715e68bc 100644 --- a/keyboards/qvex/lynepad/lynepad.c +++ b/keyboards/qvex/lynepad/lynepad.c @@ -15,12 +15,12 @@ along with this program. If not, see . void keyboard_pre_init_kb(void) { // Encoder pins - setPinInput(PIN_TW_SW); - setPinInput(PIN_RJ_SW); - setPinInput(PIN_RJ_DIR_A); - setPinInput(PIN_RJ_DIR_C); - setPinInput(PIN_RJ_DIR_B); - setPinInput(PIN_RJ_DIR_D); + gpio_set_pin_input(PIN_TW_SW); + gpio_set_pin_input(PIN_RJ_SW); + gpio_set_pin_input(PIN_RJ_DIR_A); + gpio_set_pin_input(PIN_RJ_DIR_C); + gpio_set_pin_input(PIN_RJ_DIR_B); + gpio_set_pin_input(PIN_RJ_DIR_D); keyboard_pre_init_user(); } @@ -40,18 +40,18 @@ int16_t enc2RightPrev = 1; void matrix_scan_kb(void) { enc1CenterPrev = enc1Center; - enc1Center = readPin(PIN_TW_SW); + enc1Center = gpio_read_pin(PIN_TW_SW); enc2CenterPrev = enc2Center; - enc2Center = readPin(PIN_RJ_SW); + enc2Center = gpio_read_pin(PIN_RJ_SW); enc2UpPrev = enc2Up; - enc2Up = readPin(PIN_RJ_DIR_A); + enc2Up = gpio_read_pin(PIN_RJ_DIR_A); enc2DownPrev = enc2Down; - enc2Down = readPin(PIN_RJ_DIR_C); + enc2Down = gpio_read_pin(PIN_RJ_DIR_C); enc2LeftPrev = enc2Left; - enc2Left = readPin(PIN_RJ_DIR_B); + enc2Left = gpio_read_pin(PIN_RJ_DIR_B); enc2RightPrev = enc2Right; - enc2Right = readPin(PIN_RJ_DIR_D); + enc2Right = gpio_read_pin(PIN_RJ_DIR_D); // Ensure any user customizations are called (for some reason this wasn't happening by default) matrix_scan_user(); diff --git a/keyboards/qvex/lynepad2/matrix.c b/keyboards/qvex/lynepad2/matrix.c index 89c56b8d40..23b22cdb69 100644 --- a/keyboards/qvex/lynepad2/matrix.c +++ b/keyboards/qvex/lynepad2/matrix.c @@ -24,31 +24,31 @@ extern matrix_row_t raw_matrix[MATRIX_ROWS]; // raw values extern matrix_row_t matrix[MATRIX_ROWS]; // debounced values static void select_row(uint8_t row) { - setPinOutput(row_pins[row]); - writePinLow(row_pins[row]); + gpio_set_pin_output(row_pins[row]); + gpio_write_pin_low(row_pins[row]); } static void unselect_row(uint8_t row) { - setPinInputHigh(row_pins[row]); + gpio_set_pin_input_high(row_pins[row]); } static void unselect_rows(void) { for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } } static void init_pins(void) { unselect_rows(); for (uint8_t x = 0; x < MATRIX_COLS; x++) { - setPinInputHigh(col_pins[x]); + gpio_set_pin_input_high(col_pins[x]); } - setPinInputHigh(PIN_JU); - setPinInputHigh(PIN_JD); - setPinInputHigh(PIN_JL); - setPinInputHigh(PIN_JR); - setPinInputHigh(PIN_JC); - setPinInputHigh(PIN_TC); + gpio_set_pin_input_high(PIN_JU); + gpio_set_pin_input_high(PIN_JD); + gpio_set_pin_input_high(PIN_JL); + gpio_set_pin_input_high(PIN_JR); + gpio_set_pin_input_high(PIN_JC); + gpio_set_pin_input_high(PIN_TC); } static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) { @@ -62,7 +62,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) wait_us(30); for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { - uint8_t pin_state = readPin(col_pins[col_index]); + uint8_t pin_state = gpio_read_pin(col_pins[col_index]); current_matrix[current_row] |= pin_state ? 0 : (MATRIX_ROW_SHIFTER << col_index); } @@ -78,16 +78,16 @@ static bool read_encoder_switches(matrix_row_t current_matrix[]) { current_matrix[3] = 0; current_matrix[4] = 0; - current_matrix[4] |= !readPin(PIN_TC) ? (1 << 1) : 0; + current_matrix[4] |= !gpio_read_pin(PIN_TC) ? (1 << 1) : 0; - if (!readPin(PIN_JC)) { - if (!readPin(PIN_JU)) { + if (!gpio_read_pin(PIN_JC)) { + if (!gpio_read_pin(PIN_JU)) { current_matrix[3] |= (1 << 0); - } else if (!readPin(PIN_JD)) { + } else if (!gpio_read_pin(PIN_JD)) { current_matrix[3] |= (1 << 1); - } else if (!readPin(PIN_JL)) { + } else if (!gpio_read_pin(PIN_JL)) { current_matrix[3] |= (1 << 2); - } else if (!readPin(PIN_JR)) { + } else if (!gpio_read_pin(PIN_JR)) { current_matrix[3] |= (1 << 3); } else { current_matrix[4] |= (1 << 0); diff --git a/keyboards/rart/rartlite/rartlite.c b/keyboards/rart/rartlite/rartlite.c index 691c68253e..f0ca27151e 100644 --- a/keyboards/rart/rartlite/rartlite.c +++ b/keyboards/rart/rartlite/rartlite.c @@ -15,12 +15,12 @@ #include "quantum.h" void keyboard_pre_init_kb(void) { - setPinOutput(B1); + gpio_set_pin_output(B1); keyboard_pre_init_user(); } layer_state_t layer_state_set_kb(layer_state_t state) { - writePin(B1, layer_state_cmp(state, 1)); + gpio_write_pin(B1, layer_state_cmp(state, 1)); return layer_state_set_user(state); } diff --git a/keyboards/rate/pistachio_pro/matrix.c b/keyboards/rate/pistachio_pro/matrix.c index bb962c76e2..f235c65f56 100644 --- a/keyboards/rate/pistachio_pro/matrix.c +++ b/keyboards/rate/pistachio_pro/matrix.c @@ -22,13 +22,13 @@ static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; static inline void setPinOutput_writeLow(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinLow(pin); + gpio_set_pin_output(pin); + gpio_write_pin_low(pin); } } static inline void setPinInputHigh_atomic(pin_t pin) { - ATOMIC_BLOCK_FORCEON { setPinInputHigh(pin); } + ATOMIC_BLOCK_FORCEON { gpio_set_pin_input_high(pin); } } static void select_row(uint8_t row) { @@ -81,7 +81,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) // For each col... for (uint8_t col_index = 0; col_index < MATRIX_COLS / 2; col_index++) { // Check row pin state - if (readPin(col_pins[col_index])) { + if (gpio_read_pin(col_pins[col_index])) { // Pin HI, clear col bit current_matrix[current_row] &= ~(MATRIX_ROW_SHIFTER << col_index); } else { @@ -109,7 +109,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) matrix_row_t last_row_value = current_matrix[row_index]; // Check row pin state - if (readPin(row_pins[row_index])) { + if (gpio_read_pin(row_pins[row_index])) { // Pin HI, clear col bit current_matrix[row_index] &= ~(MATRIX_ROW_SHIFTER << ( current_col + MATRIX_COLS/2)); } else { diff --git a/keyboards/redox/wireless/wireless.c b/keyboards/redox/wireless/wireless.c index 30cefd9f4e..a82afbf603 100644 --- a/keyboards/redox/wireless/wireless.c +++ b/keyboards/redox/wireless/wireless.c @@ -18,15 +18,15 @@ along with this program. If not, see . #include "wireless.h" void led_init(void) { - setPinOutput(D0); - setPinOutput(D1); - setPinOutput(F4); - setPinOutput(F5); + gpio_set_pin_output(D0); + gpio_set_pin_output(D1); + gpio_set_pin_output(F4); + gpio_set_pin_output(F5); - writePinHigh(D0); - writePinHigh(D1); - writePinHigh(F4); - writePinHigh(F5); + gpio_write_pin_high(D0); + gpio_write_pin_high(D1); + gpio_write_pin_high(F4); + gpio_write_pin_high(F5); } diff --git a/keyboards/redox/wireless/wireless.h b/keyboards/redox/wireless/wireless.h index a0ba09aff3..f752e0b13f 100644 --- a/keyboards/redox/wireless/wireless.h +++ b/keyboards/redox/wireless/wireless.h @@ -19,14 +19,14 @@ along with this program. If not, see . #include "quantum.h" -#define red_led_off writePinHigh(F5) -#define red_led_on writePinLow(F5) -#define blu_led_off writePinHigh(F4) -#define blu_led_on writePinLow(F4) -#define grn_led_off writePinHigh(D1) -#define grn_led_on writePinLow(D1) -#define wht_led_off writePinHigh(D0) -#define wht_led_on writePinLow(D0) +#define red_led_off gpio_write_pin_high(F5) +#define red_led_on gpio_write_pin_low(F5) +#define blu_led_off gpio_write_pin_high(F4) +#define blu_led_on gpio_write_pin_low(F4) +#define grn_led_off gpio_write_pin_high(D1) +#define grn_led_on gpio_write_pin_low(D1) +#define wht_led_off gpio_write_pin_high(D0) +#define wht_led_on gpio_write_pin_low(D0) #define set_led_off red_led_off; grn_led_off; blu_led_off; wht_led_off #define set_led_red red_led_on; grn_led_off; blu_led_off; wht_led_off diff --git a/keyboards/redscarf_i/redscarf_i.c b/keyboards/redscarf_i/redscarf_i.c index fac3e245fb..949bc362ad 100644 --- a/keyboards/redscarf_i/redscarf_i.c +++ b/keyboards/redscarf_i/redscarf_i.c @@ -18,19 +18,19 @@ void keyboard_pre_init_kb(void) { // initialize top row leds - setPinOutput(F7); - setPinOutput(F6); - setPinOutput(F5); + gpio_set_pin_output(F7); + gpio_set_pin_output(F6); + gpio_set_pin_output(F5); // and then turn them off - writePinHigh(F7); - writePinHigh(F6); - writePinHigh(F5); + gpio_write_pin_high(F7); + gpio_write_pin_high(F6); + gpio_write_pin_high(F5); } bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if(res) { - writePin(F7, !led_state.num_lock); + gpio_write_pin(F7, !led_state.num_lock); } return res; } @@ -38,16 +38,16 @@ bool led_update_kb(led_t led_state) { layer_state_t layer_state_set_kb(layer_state_t state) { switch (get_highest_layer(state)) { case 1: - writePinHigh(F6); - writePinLow(F5); + gpio_write_pin_high(F6); + gpio_write_pin_low(F5); break; case 2: - writePinLow(F6); - writePinHigh(F5); + gpio_write_pin_low(F6); + gpio_write_pin_high(F5); break; default: - writePinHigh(F6); - writePinHigh(F5); + gpio_write_pin_high(F6); + gpio_write_pin_high(F5); break; } return state; diff --git a/keyboards/redscarf_iiplus/verb/matrix.c b/keyboards/redscarf_iiplus/verb/matrix.c index 391a923f16..886704f9ef 100755 --- a/keyboards/redscarf_iiplus/verb/matrix.c +++ b/keyboards/redscarf_iiplus/verb/matrix.c @@ -114,7 +114,7 @@ static void init_pins(void) { for (int col = 0; col < MATRIX_COLS; col++) { pin_t pin = direct_pins[row][col]; if (pin != NO_PIN) { - setPinInputHigh(pin); + gpio_set_pin_input_high(pin); } } } @@ -127,7 +127,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { pin_t pin = direct_pins[current_row][col_index]; if (pin != NO_PIN) { - current_matrix[current_row] |= readPin(pin) ? 0 : (ROW_SHIFTER << col_index); + current_matrix[current_row] |= gpio_read_pin(pin) ? 0 : (ROW_SHIFTER << col_index); } } @@ -150,27 +150,27 @@ static void select_row(uint8_t col) { switch (col) { case 0: - writePinLow(B0); - writePinLow(B1); - writePinLow(B2); + gpio_write_pin_low(B0); + gpio_write_pin_low(B1); + gpio_write_pin_low(B2); break; case 1: - writePinLow(B0); - writePinLow(B1); + gpio_write_pin_low(B0); + gpio_write_pin_low(B1); break; case 2: - writePinLow(B0); - writePinLow(B2); + gpio_write_pin_low(B0); + gpio_write_pin_low(B2); break; case 3: - writePinLow(B0); + gpio_write_pin_low(B0); break; case 4: - writePinLow(B1); - writePinLow(B2); + gpio_write_pin_low(B1); + gpio_write_pin_low(B2); break; case 5: - writePinLow(B1); + gpio_write_pin_low(B1); break; } } @@ -179,46 +179,46 @@ static void unselect_row(uint8_t col) { switch (col) { case 0: - writePinHigh(B0); - writePinHigh(B1); - writePinHigh(B2); + gpio_write_pin_high(B0); + gpio_write_pin_high(B1); + gpio_write_pin_high(B2); break; case 1: - writePinHigh(B0); - writePinHigh(B1); + gpio_write_pin_high(B0); + gpio_write_pin_high(B1); break; case 2: - writePinHigh(B0); - writePinHigh(B2); + gpio_write_pin_high(B0); + gpio_write_pin_high(B2); break; case 3: - writePinHigh(B0); + gpio_write_pin_high(B0); break; case 4: - writePinHigh(B1); - writePinHigh(B2); + gpio_write_pin_high(B1); + gpio_write_pin_high(B2); break; case 5: - writePinHigh(B1); + gpio_write_pin_high(B1); break; } } static void unselect_rows(void) { - setPinOutput(B0); - setPinOutput(B1); - setPinOutput(B2); + gpio_set_pin_output(B0); + gpio_set_pin_output(B1); + gpio_set_pin_output(B2); // make all pins high to select Y7, nothing is connected to that (otherwise the first row will act weird) - writePinHigh(B0); - writePinHigh(B1); - writePinHigh(B2); + gpio_write_pin_high(B0); + gpio_write_pin_high(B1); + gpio_write_pin_high(B2); } static void init_pins(void) { unselect_rows(); for (uint8_t x = 0; x < MATRIX_COLS; x++) { - setPinInputHigh(col_pins[x]); + gpio_set_pin_input_high(col_pins[x]); } } @@ -238,7 +238,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) for(uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { // Select the col pin to read (active low) - uint8_t pin_state = readPin(col_pins[col_index]); + uint8_t pin_state = gpio_read_pin(col_pins[col_index]); // Populate the matrix row with the state of the col pin current_matrix[current_row] |= pin_state ? 0 : (ROW_SHIFTER << col_index); @@ -254,26 +254,26 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) static void select_col(uint8_t col) { - setPinOutput(col_pins[col]); - writePinLow(col_pins[col]); + gpio_set_pin_output(col_pins[col]); + gpio_write_pin_low(col_pins[col]); } static void unselect_col(uint8_t col) { - setPinInputHigh(col_pins[col]); + gpio_set_pin_input_high(col_pins[col]); } static void unselect_cols(void) { for(uint8_t x = 0; x < MATRIX_COLS; x++) { - setPinInputHigh(col_pins[x]); + gpio_set_pin_input_high(col_pins[x]); } } static void init_pins(void) { unselect_cols(); for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } } @@ -293,7 +293,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) matrix_row_t last_row_value = current_matrix[row_index]; // Check row pin state - if (readPin(row_pins[row_index]) == 0) + if (gpio_read_pin(row_pins[row_index]) == 0) { // Pin LO, set col bit current_matrix[row_index] |= (ROW_SHIFTER << current_col); diff --git a/keyboards/redscarf_iiplus/verc/matrix.c b/keyboards/redscarf_iiplus/verc/matrix.c index 391a923f16..886704f9ef 100755 --- a/keyboards/redscarf_iiplus/verc/matrix.c +++ b/keyboards/redscarf_iiplus/verc/matrix.c @@ -114,7 +114,7 @@ static void init_pins(void) { for (int col = 0; col < MATRIX_COLS; col++) { pin_t pin = direct_pins[row][col]; if (pin != NO_PIN) { - setPinInputHigh(pin); + gpio_set_pin_input_high(pin); } } } @@ -127,7 +127,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { pin_t pin = direct_pins[current_row][col_index]; if (pin != NO_PIN) { - current_matrix[current_row] |= readPin(pin) ? 0 : (ROW_SHIFTER << col_index); + current_matrix[current_row] |= gpio_read_pin(pin) ? 0 : (ROW_SHIFTER << col_index); } } @@ -150,27 +150,27 @@ static void select_row(uint8_t col) { switch (col) { case 0: - writePinLow(B0); - writePinLow(B1); - writePinLow(B2); + gpio_write_pin_low(B0); + gpio_write_pin_low(B1); + gpio_write_pin_low(B2); break; case 1: - writePinLow(B0); - writePinLow(B1); + gpio_write_pin_low(B0); + gpio_write_pin_low(B1); break; case 2: - writePinLow(B0); - writePinLow(B2); + gpio_write_pin_low(B0); + gpio_write_pin_low(B2); break; case 3: - writePinLow(B0); + gpio_write_pin_low(B0); break; case 4: - writePinLow(B1); - writePinLow(B2); + gpio_write_pin_low(B1); + gpio_write_pin_low(B2); break; case 5: - writePinLow(B1); + gpio_write_pin_low(B1); break; } } @@ -179,46 +179,46 @@ static void unselect_row(uint8_t col) { switch (col) { case 0: - writePinHigh(B0); - writePinHigh(B1); - writePinHigh(B2); + gpio_write_pin_high(B0); + gpio_write_pin_high(B1); + gpio_write_pin_high(B2); break; case 1: - writePinHigh(B0); - writePinHigh(B1); + gpio_write_pin_high(B0); + gpio_write_pin_high(B1); break; case 2: - writePinHigh(B0); - writePinHigh(B2); + gpio_write_pin_high(B0); + gpio_write_pin_high(B2); break; case 3: - writePinHigh(B0); + gpio_write_pin_high(B0); break; case 4: - writePinHigh(B1); - writePinHigh(B2); + gpio_write_pin_high(B1); + gpio_write_pin_high(B2); break; case 5: - writePinHigh(B1); + gpio_write_pin_high(B1); break; } } static void unselect_rows(void) { - setPinOutput(B0); - setPinOutput(B1); - setPinOutput(B2); + gpio_set_pin_output(B0); + gpio_set_pin_output(B1); + gpio_set_pin_output(B2); // make all pins high to select Y7, nothing is connected to that (otherwise the first row will act weird) - writePinHigh(B0); - writePinHigh(B1); - writePinHigh(B2); + gpio_write_pin_high(B0); + gpio_write_pin_high(B1); + gpio_write_pin_high(B2); } static void init_pins(void) { unselect_rows(); for (uint8_t x = 0; x < MATRIX_COLS; x++) { - setPinInputHigh(col_pins[x]); + gpio_set_pin_input_high(col_pins[x]); } } @@ -238,7 +238,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) for(uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { // Select the col pin to read (active low) - uint8_t pin_state = readPin(col_pins[col_index]); + uint8_t pin_state = gpio_read_pin(col_pins[col_index]); // Populate the matrix row with the state of the col pin current_matrix[current_row] |= pin_state ? 0 : (ROW_SHIFTER << col_index); @@ -254,26 +254,26 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) static void select_col(uint8_t col) { - setPinOutput(col_pins[col]); - writePinLow(col_pins[col]); + gpio_set_pin_output(col_pins[col]); + gpio_write_pin_low(col_pins[col]); } static void unselect_col(uint8_t col) { - setPinInputHigh(col_pins[col]); + gpio_set_pin_input_high(col_pins[col]); } static void unselect_cols(void) { for(uint8_t x = 0; x < MATRIX_COLS; x++) { - setPinInputHigh(col_pins[x]); + gpio_set_pin_input_high(col_pins[x]); } } static void init_pins(void) { unselect_cols(); for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } } @@ -293,7 +293,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) matrix_row_t last_row_value = current_matrix[row_index]; // Check row pin state - if (readPin(row_pins[row_index]) == 0) + if (gpio_read_pin(row_pins[row_index]) == 0) { // Pin LO, set col bit current_matrix[row_index] |= (ROW_SHIFTER << current_col); diff --git a/keyboards/redscarf_iiplus/verd/matrix.c b/keyboards/redscarf_iiplus/verd/matrix.c index b2046db2ce..133898b652 100644 --- a/keyboards/redscarf_iiplus/verd/matrix.c +++ b/keyboards/redscarf_iiplus/verd/matrix.c @@ -114,7 +114,7 @@ static void init_pins(void) { for (int col = 0; col < MATRIX_COLS; col++) { pin_t pin = direct_pins[row][col]; if (pin != NO_PIN) { - setPinInputHigh(pin); + gpio_set_pin_input_high(pin); } } } @@ -127,7 +127,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { pin_t pin = direct_pins[current_row][col_index]; if (pin != NO_PIN) { - current_matrix[current_row] |= readPin(pin) ? 0 : (ROW_SHIFTER << col_index); + current_matrix[current_row] |= gpio_read_pin(pin) ? 0 : (ROW_SHIFTER << col_index); } } @@ -150,27 +150,27 @@ static void select_row(uint8_t col) { switch (col) { case 0: - writePinLow(B0); - writePinLow(B1); - writePinLow(B2); + gpio_write_pin_low(B0); + gpio_write_pin_low(B1); + gpio_write_pin_low(B2); break; case 1: - writePinLow(B0); - writePinLow(B1); + gpio_write_pin_low(B0); + gpio_write_pin_low(B1); break; case 2: - writePinLow(B0); - writePinLow(B2); + gpio_write_pin_low(B0); + gpio_write_pin_low(B2); break; case 3: - writePinLow(B0); + gpio_write_pin_low(B0); break; case 4: - writePinLow(B1); - writePinLow(B2); + gpio_write_pin_low(B1); + gpio_write_pin_low(B2); break; case 5: - writePinLow(B1); + gpio_write_pin_low(B1); break; } } @@ -179,46 +179,46 @@ static void unselect_row(uint8_t col) { switch (col) { case 0: - writePinHigh(B0); - writePinHigh(B1); - writePinHigh(B2); + gpio_write_pin_high(B0); + gpio_write_pin_high(B1); + gpio_write_pin_high(B2); break; case 1: - writePinHigh(B0); - writePinHigh(B1); + gpio_write_pin_high(B0); + gpio_write_pin_high(B1); break; case 2: - writePinHigh(B0); - writePinHigh(B2); + gpio_write_pin_high(B0); + gpio_write_pin_high(B2); break; case 3: - writePinHigh(B0); + gpio_write_pin_high(B0); break; case 4: - writePinHigh(B1); - writePinHigh(B2); + gpio_write_pin_high(B1); + gpio_write_pin_high(B2); break; case 5: - writePinHigh(B1); + gpio_write_pin_high(B1); break; } } static void unselect_rows(void) { - setPinOutput(B0); - setPinOutput(B1); - setPinOutput(B2); + gpio_set_pin_output(B0); + gpio_set_pin_output(B1); + gpio_set_pin_output(B2); // make all pins high to select Y7, nothing is connected to that (otherwise the first row will act weird) - writePinHigh(B0); - writePinHigh(B1); - writePinHigh(B2); + gpio_write_pin_high(B0); + gpio_write_pin_high(B1); + gpio_write_pin_high(B2); } static void init_pins(void) { unselect_rows(); for (uint8_t x = 0; x < MATRIX_COLS; x++) { - setPinInputHigh(col_pins[x]); + gpio_set_pin_input_high(col_pins[x]); } } @@ -238,7 +238,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) for(uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { // Select the col pin to read (active low) - uint8_t pin_state = readPin(col_pins[col_index]); + uint8_t pin_state = gpio_read_pin(col_pins[col_index]); // Populate the matrix row with the state of the col pin current_matrix[current_row] |= pin_state ? 0 : (ROW_SHIFTER << col_index); @@ -254,26 +254,26 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) static void select_col(uint8_t col) { - setPinOutput(col_pins[col]); - writePinLow(col_pins[col]); + gpio_set_pin_output(col_pins[col]); + gpio_write_pin_low(col_pins[col]); } static void unselect_col(uint8_t col) { - setPinInputHigh(col_pins[col]); + gpio_set_pin_input_high(col_pins[col]); } static void unselect_cols(void) { for(uint8_t x = 0; x < MATRIX_COLS; x++) { - setPinInputHigh(col_pins[x]); + gpio_set_pin_input_high(col_pins[x]); } } static void init_pins(void) { unselect_cols(); for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } } @@ -293,7 +293,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) matrix_row_t last_row_value = current_matrix[row_index]; // Check row pin state - if (readPin(row_pins[row_index]) == 0) + if (gpio_read_pin(row_pins[row_index]) == 0) { // Pin LO, set col bit current_matrix[row_index] |= (ROW_SHIFTER << current_col); diff --git a/keyboards/rmi_kb/wete/v1/v1.c b/keyboards/rmi_kb/wete/v1/v1.c index 088ca3c6b7..34a0917468 100644 --- a/keyboards/rmi_kb/wete/v1/v1.c +++ b/keyboards/rmi_kb/wete/v1/v1.c @@ -18,17 +18,17 @@ void keyboard_pre_init_user(void) { // Initialize indicator LED pins - setPinOutput(A14); // Num Lock - setPinOutput(A15); // Scroll Lock - setPinOutput(B3); // Caps Lock + gpio_set_pin_output(A14); // Num Lock + gpio_set_pin_output(A15); // Scroll Lock + gpio_set_pin_output(B3); // Caps Lock } bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if (res) { - writePin(A14, !led_state.num_lock); - writePin(A15, !led_state.scroll_lock); - writePin(B3, !led_state.caps_lock); + gpio_write_pin(A14, !led_state.num_lock); + gpio_write_pin(A15, !led_state.scroll_lock); + gpio_write_pin(B3, !led_state.caps_lock); } return res; diff --git a/keyboards/rookiebwoy/neopad/rev1/rev1.c b/keyboards/rookiebwoy/neopad/rev1/rev1.c index c8216f4e70..3b527794c0 100755 --- a/keyboards/rookiebwoy/neopad/rev1/rev1.c +++ b/keyboards/rookiebwoy/neopad/rev1/rev1.c @@ -17,8 +17,8 @@ void keyboard_pre_init_kb(void) { // Set LED IO as outputs - setPinOutput(LED_00); - setPinOutput(LED_01); + gpio_set_pin_output(LED_00); + gpio_set_pin_output(LED_01); keyboard_pre_init_user(); } @@ -27,8 +27,8 @@ bool shutdown_kb(bool jump_to_bootloader) { return false; } // Shutdown LEDs - writePinLow(LED_00); - writePinLow(LED_01); + gpio_write_pin_low(LED_00); + gpio_write_pin_low(LED_01); return true; } @@ -37,8 +37,8 @@ layer_state_t layer_state_set_kb(layer_state_t state) { // Layer LEDs act as binary indication of current layer uint8_t layer = get_highest_layer(state); - writePin(LED_00, layer & 0b1); - writePin(LED_01, (layer >> 1) & 0b1); + gpio_write_pin(LED_00, layer & 0b1); + gpio_write_pin(LED_01, (layer >> 1) & 0b1); return state; } @@ -51,11 +51,11 @@ void matrix_init_kb(void) { // runs once when the firmware starts up uint8_t led_delay_ms = 80; for (int i = 0; i < 2; i++) { - writePinHigh(LED_00); - writePinHigh(LED_01); + gpio_write_pin_high(LED_00); + gpio_write_pin_high(LED_01); wait_ms(led_delay_ms); - writePinLow(LED_00); - writePinLow(LED_01); + gpio_write_pin_low(LED_00); + gpio_write_pin_low(LED_01); if (i < 1) { wait_ms(led_delay_ms); } diff --git a/keyboards/rubi/rubi.c b/keyboards/rubi/rubi.c index b125ff34a5..89bf9caa6d 100644 --- a/keyboards/rubi/rubi.c +++ b/keyboards/rubi/rubi.c @@ -68,7 +68,7 @@ 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(C6, led_state.num_lock); + gpio_write_pin(C6, led_state.num_lock); } return true; } diff --git a/keyboards/ryanskidmore/rskeys100/matrix.c b/keyboards/ryanskidmore/rskeys100/matrix.c index 2ab9eafd7f..53ad18ee48 100644 --- a/keyboards/ryanskidmore/rskeys100/matrix.c +++ b/keyboards/ryanskidmore/rskeys100/matrix.c @@ -30,16 +30,16 @@ static void shift_out_single(uint8_t value); static void shift_out(uint32_t value); void matrix_init_custom(void) { - setPinInput(ROW_A); - setPinInput(ROW_B); - setPinInput(ROW_C); - setPinInput(ROW_D); - setPinInput(ROW_E); - setPinInput(ROW_F); + gpio_set_pin_input(ROW_A); + gpio_set_pin_input(ROW_B); + gpio_set_pin_input(ROW_C); + gpio_set_pin_input(ROW_D); + gpio_set_pin_input(ROW_E); + gpio_set_pin_input(ROW_F); - setPinOutput(SHR_DATA); - setPinOutput(SHR_LATCH); - setPinOutput(SHR_CLOCK); + gpio_set_pin_output(SHR_DATA); + gpio_set_pin_output(SHR_LATCH); + gpio_set_pin_output(SHR_CLOCK); } bool matrix_scan_custom(matrix_row_t current_matrix[]) { @@ -63,12 +63,12 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { } static uint8_t read_rows(void) { - return (readPin(ROW_F) << 5) - | (readPin(ROW_E) << 4) - | (readPin(ROW_D) << 3) - | (readPin(ROW_C) << 2) - | (readPin(ROW_B) << 1) - | (readPin(ROW_A) ); + return (gpio_read_pin(ROW_F) << 5) + | (gpio_read_pin(ROW_E) << 4) + | (gpio_read_pin(ROW_D) << 3) + | (gpio_read_pin(ROW_C) << 2) + | (gpio_read_pin(ROW_B) << 1) + | (gpio_read_pin(ROW_A) ); } static void select_col(uint8_t col) { @@ -76,7 +76,7 @@ static void select_col(uint8_t col) { } static void shift_out(uint32_t value) { - writePinLow(SHR_LATCH); + gpio_write_pin_low(SHR_LATCH); uint8_t first_byte = (value >> 16) & 0xFF; uint8_t second_byte = (value >> 8) & 0xFF; uint8_t third_byte = (uint8_t)(value & 0xFF); @@ -84,7 +84,7 @@ static void shift_out(uint32_t value) { shift_out_single(first_byte); shift_out_single(second_byte); shift_out_single(third_byte); - writePinHigh(SHR_LATCH); + gpio_write_pin_high(SHR_LATCH); /* We delay here to prevent multiple consecutive keys being triggered with a single switch press */ _delay_us(10); } @@ -92,9 +92,9 @@ static void shift_out(uint32_t value) { static void shift_out_single(uint8_t value) { for (uint8_t i = 0; i < 8; i++) { if (value & 0b10000000) { - writePinHigh(SHR_DATA); + gpio_write_pin_high(SHR_DATA); } else { - writePinLow(SHR_DATA); + gpio_write_pin_low(SHR_DATA); } shift_pulse(); @@ -103,6 +103,6 @@ static void shift_out_single(uint8_t value) { } static inline void shift_pulse(void) { - writePinHigh(SHR_CLOCK); - writePinLow(SHR_CLOCK); + gpio_write_pin_high(SHR_CLOCK); + gpio_write_pin_low(SHR_CLOCK); } \ No newline at end of file diff --git a/keyboards/sekigon/grs_70ec/ec_switch_matrix.c b/keyboards/sekigon/grs_70ec/ec_switch_matrix.c index 9c474695a1..0583da79d7 100644 --- a/keyboards/sekigon/grs_70ec/ec_switch_matrix.c +++ b/keyboards/sekigon/grs_70ec/ec_switch_matrix.c @@ -29,35 +29,35 @@ _Static_assert(sizeof(mux_sel_pins) == 3, "invalid MUX_SEL_PINS"); static ecsm_config_t config; static uint16_t ecsm_sw_value[MATRIX_ROWS][MATRIX_COLS]; -static inline void discharge_capacitor(void) { setPinOutput(DISCHARGE_PIN); } +static inline void discharge_capacitor(void) { gpio_set_pin_output(DISCHARGE_PIN); } static inline void charge_capacitor(uint8_t row) { - setPinInput(DISCHARGE_PIN); - writePinHigh(row_pins[row]); + gpio_set_pin_input(DISCHARGE_PIN); + gpio_write_pin_high(row_pins[row]); } static inline void clear_all_row_pins(void) { for (int row = 0; row < sizeof(row_pins); row++) { - writePinLow(row_pins[row]); + gpio_write_pin_low(row_pins[row]); } } static inline void init_mux_sel(void) { for (int idx = 0; idx < sizeof(mux_sel_pins); idx++) { - setPinOutput(mux_sel_pins[idx]); + gpio_set_pin_output(mux_sel_pins[idx]); } } static inline void select_mux(uint8_t col) { uint8_t ch = col_channels[col]; - writePin(mux_sel_pins[0], ch & 1); - writePin(mux_sel_pins[1], ch & 2); - writePin(mux_sel_pins[2], ch & 4); + gpio_write_pin(mux_sel_pins[0], ch & 1); + gpio_write_pin(mux_sel_pins[1], ch & 2); + gpio_write_pin(mux_sel_pins[2], ch & 4); } static inline void init_row(void) { for (int idx = 0; idx < sizeof(row_pins); idx++) { - setPinOutput(row_pins[idx]); - writePinLow(row_pins[idx]); + gpio_set_pin_output(row_pins[idx]); + gpio_write_pin_low(row_pins[idx]); } } @@ -67,8 +67,8 @@ int ecsm_init(ecsm_config_t const* const ecsm_config) { config = *ecsm_config; // initialize discharge pin as discharge mode - writePinLow(DISCHARGE_PIN); - setPinOutput(DISCHARGE_PIN); + gpio_write_pin_low(DISCHARGE_PIN); + gpio_set_pin_output(DISCHARGE_PIN); // set analog reference analogReference(ADC_REF_POWER); @@ -80,7 +80,7 @@ int ecsm_init(ecsm_config_t const* const ecsm_config) { init_mux_sel(); // set discharge pin to charge mode - setPinInput(DISCHARGE_PIN); + gpio_set_pin_input(DISCHARGE_PIN); return 0; } diff --git a/keyboards/sekigon/grs_70ec/grs_70ec.c b/keyboards/sekigon/grs_70ec/grs_70ec.c index e855a80dcf..9f20e9784a 100644 --- a/keyboards/sekigon/grs_70ec/grs_70ec.c +++ b/keyboards/sekigon/grs_70ec/grs_70ec.c @@ -17,11 +17,11 @@ #include "grs_70ec.h" void led_on(void) { - setPinOutput(D2); - writePinHigh(D2); + gpio_set_pin_output(D2); + gpio_write_pin_high(D2); } -void led_off(void) { writePinLow(D2); } +void led_off(void) { gpio_write_pin_low(D2); } void keyboard_post_init_kb(void) { led_on(); @@ -31,8 +31,8 @@ void keyboard_post_init_kb(void) { void keyboard_pre_init_kb(void) { // Turn on extern circuit - setPinOutput(F7); - writePinHigh(F7); + gpio_set_pin_output(F7); + gpio_write_pin_high(F7); keyboard_pre_init_user(); } diff --git a/keyboards/sergiopoverony/creator_pro/creator_pro.c b/keyboards/sergiopoverony/creator_pro/creator_pro.c index 55c0497df2..acb99fdfc7 100644 --- a/keyboards/sergiopoverony/creator_pro/creator_pro.c +++ b/keyboards/sergiopoverony/creator_pro/creator_pro.c @@ -19,15 +19,15 @@ void matrix_init_kb(void) { matrix_init_user(); /* led pins */ - setPinOutput(RED_LED); - setPinOutput(BLUE_LED); - setPinOutput(GREEN_LED); + gpio_set_pin_output(RED_LED); + gpio_set_pin_output(BLUE_LED); + gpio_set_pin_output(GREEN_LED); } void turn_off_leds(void) { - writePinLow(RED_LED); - writePinLow(BLUE_LED); - writePinLow(GREEN_LED); + gpio_write_pin_low(RED_LED); + gpio_write_pin_low(BLUE_LED); + gpio_write_pin_low(GREEN_LED); } void turn_on_led(pin_t pin) { - writePinHigh(pin); + gpio_write_pin_high(pin); } diff --git a/keyboards/skyloong/gk61/pro/pro.c b/keyboards/skyloong/gk61/pro/pro.c index 06d9ce721d..49841b2ee5 100644 --- a/keyboards/skyloong/gk61/pro/pro.c +++ b/keyboards/skyloong/gk61/pro/pro.c @@ -213,14 +213,14 @@ bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) { void suspend_power_down_kb() { # ifdef RGB_MATRIX_ENABLE - writePinLow(IS31FL3743A_SDB_PIN); + gpio_write_pin_low(IS31FL3743A_SDB_PIN); # endif suspend_power_down_user(); } void suspend_wakeup_init_kb() { # ifdef RGB_MATRIX_ENABLE - writePinHigh(IS31FL3743A_SDB_PIN); + gpio_write_pin_high(IS31FL3743A_SDB_PIN); # endif suspend_wakeup_init_user(); } diff --git a/keyboards/skyloong/gk61/pro_48/pro_48.c b/keyboards/skyloong/gk61/pro_48/pro_48.c index c5758ffcf4..ff49f5d22f 100644 --- a/keyboards/skyloong/gk61/pro_48/pro_48.c +++ b/keyboards/skyloong/gk61/pro_48/pro_48.c @@ -149,12 +149,12 @@ bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) { void suspend_power_down_kb(void) { - writePinLow(IS31FL3743A_SDB_PIN); + gpio_write_pin_low(IS31FL3743A_SDB_PIN); suspend_power_down_user(); } void suspend_wakeup_init_kb(void) { - writePinHigh(IS31FL3743A_SDB_PIN); + gpio_write_pin_high(IS31FL3743A_SDB_PIN); suspend_wakeup_init_user(); } #endif diff --git a/keyboards/skyloong/gk61/v1/v1.c b/keyboards/skyloong/gk61/v1/v1.c index 01e6b6c6ae..0e8b7691c3 100644 --- a/keyboards/skyloong/gk61/v1/v1.c +++ b/keyboards/skyloong/gk61/v1/v1.c @@ -102,13 +102,13 @@ const snled27351_led_t PROGMEM g_snled27351_leds[SNLED27351_LED_COUNT] = { #endif // RGB_MATRIX_ENABLE void suspend_power_down_kb() { - writePinLow(SNLED27351_SDB_PIN); + gpio_write_pin_low(SNLED27351_SDB_PIN); suspend_power_down_user(); } void suspend_wakeup_init_kb() { - writePinHigh(SNLED27351_SDB_PIN); + gpio_write_pin_high(SNLED27351_SDB_PIN); suspend_wakeup_init_user(); } diff --git a/keyboards/smithrune/iron165r2/iron165r2.c b/keyboards/smithrune/iron165r2/iron165r2.c index 6f1606f89d..428494f408 100644 --- a/keyboards/smithrune/iron165r2/iron165r2.c +++ b/keyboards/smithrune/iron165r2/iron165r2.c @@ -17,8 +17,8 @@ #include "quantum.h" void board_init(void) { - setPinInput(B6); - setPinInput(B7); + gpio_set_pin_input(B6); + gpio_set_pin_input(B7); #if defined (LINE_RGBS) rgblight_set_effect_range(0,16); #elif defined (RUNE_RGBS) @@ -30,6 +30,6 @@ void board_init(void) { bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); - if(res) writePin(LED_CAPS_LOCK_PIN, led_state.caps_lock); + if(res) gpio_write_pin(LED_CAPS_LOCK_PIN, led_state.caps_lock); return res; } diff --git a/keyboards/sneakbox/aliceclone/aliceclone.c b/keyboards/sneakbox/aliceclone/aliceclone.c index 9ddc198db8..74d19e515c 100644 --- a/keyboards/sneakbox/aliceclone/aliceclone.c +++ b/keyboards/sneakbox/aliceclone/aliceclone.c @@ -18,9 +18,9 @@ along with this program. If not, see . #include "quantum.h" void keyboard_pre_init_kb(void) { - setPinOutput(D7); - setPinOutput(D6); - setPinOutput(D4); + gpio_set_pin_output(D7); + gpio_set_pin_output(D6); + gpio_set_pin_output(D4); keyboard_pre_init_user(); } @@ -28,9 +28,9 @@ void keyboard_pre_init_kb(void) { bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if(res) { - writePin(D7, led_state.num_lock); - writePin(D6, led_state.caps_lock); - writePin(D4, led_state.scroll_lock); + gpio_write_pin(D7, led_state.num_lock); + gpio_write_pin(D6, led_state.caps_lock); + gpio_write_pin(D4, led_state.scroll_lock); } return res; } diff --git a/keyboards/snes_macropad/matrix.c b/keyboards/snes_macropad/matrix.c index 28d036aca9..af7e3db951 100644 --- a/keyboards/snes_macropad/matrix.c +++ b/keyboards/snes_macropad/matrix.c @@ -36,48 +36,48 @@ static const int kbd_pin_map[] = { void matrix_init_custom(void) { // init snes controller - setPinInputHigh(SNES_D0); + gpio_set_pin_input_high(SNES_D0); // todo: look into protocol for other strange snes controllers that use D1 and IO - // setPinInputHigh(SNES_D1); - // setPinInputHigh(SNES_IO); - setPinOutput(SNES_CLOCK); - setPinOutput(SNES_LATCH); - writePinLow(SNES_CLOCK); - writePinLow(SNES_LATCH); + // gpio_set_pin_input_high(SNES_D1); + // gpio_set_pin_input_high(SNES_IO); + gpio_set_pin_output(SNES_CLOCK); + gpio_set_pin_output(SNES_LATCH); + gpio_write_pin_low(SNES_CLOCK); + gpio_write_pin_low(SNES_LATCH); // init rows - setPinOutput(KBD_ROW0); - setPinOutput(KBD_ROW1); - setPinOutput(KBD_ROW2); - writePinHigh(KBD_ROW0); - writePinHigh(KBD_ROW1); - writePinHigh(KBD_ROW2); + gpio_set_pin_output(KBD_ROW0); + gpio_set_pin_output(KBD_ROW1); + gpio_set_pin_output(KBD_ROW2); + gpio_write_pin_high(KBD_ROW0); + gpio_write_pin_high(KBD_ROW1); + gpio_write_pin_high(KBD_ROW2); // init columns - setPinInputHigh(KBD_COL0); - setPinInputHigh(KBD_COL1); - setPinInputHigh(KBD_COL2); - setPinInputHigh(KBD_COL3); + gpio_set_pin_input_high(KBD_COL0); + gpio_set_pin_input_high(KBD_COL1); + gpio_set_pin_input_high(KBD_COL2); + gpio_set_pin_input_high(KBD_COL3); } static matrix_row_t readRow(size_t row, int setupDelay) { const int pin = kbd_pin_map[row]; // select the row - setPinOutput(pin); - writePinLow(pin); + gpio_set_pin_output(pin); + gpio_write_pin_low(pin); wait_us(setupDelay); // read the column data const matrix_row_t ret = - (readPin(KBD_COL0) ? 0 : 1 << 0) - | (readPin(KBD_COL1) ? 0 : 1 << 1) - | (readPin(KBD_COL2) ? 0 : 1 << 2) - | (readPin(KBD_COL3) ? 0 : 1 << 3); + (gpio_read_pin(KBD_COL0) ? 0 : 1 << 0) + | (gpio_read_pin(KBD_COL1) ? 0 : 1 << 1) + | (gpio_read_pin(KBD_COL2) ? 0 : 1 << 2) + | (gpio_read_pin(KBD_COL3) ? 0 : 1 << 3); // deselect the row - setPinOutput(pin); - writePinHigh(pin); + gpio_set_pin_output(pin); + gpio_write_pin_high(pin); return ret; } @@ -103,7 +103,7 @@ static matrix_row_t getBits(uint16_t value, size_t bit0, size_t bit1, size_t bit static void readSnesController(matrix_row_t current_matrix[]) { uint16_t controller = 0; - writePinHigh(SNES_LATCH); + gpio_write_pin_high(SNES_LATCH); for (size_t bit = 0; bit < SNES_DATA_BITS; ++bit) { // Wait for shift register to setup the data line @@ -111,16 +111,16 @@ static void readSnesController(matrix_row_t current_matrix[]) { // Shift accumulated data and read data pin controller <<= 1; - controller |= readPin(SNES_D0) ? 0 : 1; + controller |= gpio_read_pin(SNES_D0) ? 0 : 1; // todo: maybe read D1 and IO here too // Shift next bit in - writePinHigh(SNES_CLOCK); + gpio_write_pin_high(SNES_CLOCK); wait_us(SNES_CLOCK_PULSE_DURATION); - writePinLow(SNES_CLOCK); + gpio_write_pin_low(SNES_CLOCK); } - writePinLow(SNES_LATCH); + gpio_write_pin_low(SNES_LATCH); controller >>= 4; diff --git a/keyboards/splitkb/aurora/helix/rev1/rev1.c b/keyboards/splitkb/aurora/helix/rev1/rev1.c index da24934eef..0a478a5c73 100644 --- a/keyboards/splitkb/aurora/helix/rev1/rev1.c +++ b/keyboards/splitkb/aurora/helix/rev1/rev1.c @@ -24,8 +24,8 @@ static enum { UNKNOWN, LEFT, RIGHT } hand_side = UNKNOWN; if (hand_side == UNKNOWN) { #if defined(SPLIT_HAND_PIN) // Test pin SPLIT_HAND_PIN for High/Low, if low it's right hand - setPinInput(SPLIT_HAND_PIN); - hand_side = readPin(SPLIT_HAND_PIN) ? LEFT : RIGHT; + gpio_set_pin_input(SPLIT_HAND_PIN); + hand_side = gpio_read_pin(SPLIT_HAND_PIN) ? LEFT : RIGHT; return (hand_side == LEFT); #endif hand_side = is_keyboard_master() ? LEFT : RIGHT; diff --git a/keyboards/sthlmkb/lagom/matrix.c b/keyboards/sthlmkb/lagom/matrix.c index 6a16722ad0..177cda2354 100644 --- a/keyboards/sthlmkb/lagom/matrix.c +++ b/keyboards/sthlmkb/lagom/matrix.c @@ -27,17 +27,17 @@ static const uint8_t col_pins[MATRIX_MUX_COLS] = MATRIX_COL_MUX_PINS; static void init_pins(void) { // Set cols to outputs, low for (uint8_t pin = 0; pin < MATRIX_MUX_COLS; pin++) { - setPinOutput(col_pins[pin]); + gpio_set_pin_output(col_pins[pin]); } // Unselect cols for (uint8_t bit = 0; bit < MATRIX_MUX_COLS; bit++) { - writePinLow(col_pins[bit]); + gpio_write_pin_low(col_pins[bit]); } // Set rows to input, pullup for (uint8_t pin = 0; pin < MATRIX_ROWS; pin++) { - setPinInputHigh(row_pins[pin]); + gpio_set_pin_input_high(row_pins[pin]); } } @@ -45,7 +45,7 @@ static void select_col(uint8_t col) { for (uint8_t bit = 0; bit < MATRIX_MUX_COLS; bit++) { uint8_t state = (col & (0b1 << bit)) >> bit; - writePin(col_pins[bit], state); + gpio_write_pin(col_pins[bit], state); } } @@ -60,7 +60,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) { matrix_row_t last_row_value = current_matrix[row_index]; - if (!readPin(row_pins[row_index])) + if (!gpio_read_pin(row_pins[row_index])) { current_matrix[row_index] |= (COL_SHIFTER << current_col); } diff --git a/keyboards/strech/soulstone/soulstone.c b/keyboards/strech/soulstone/soulstone.c index 4a951aff9d..e6457a5271 100644 --- a/keyboards/strech/soulstone/soulstone.c +++ b/keyboards/strech/soulstone/soulstone.c @@ -18,13 +18,13 @@ // Prepare layer indicator LED void keyboard_post_init_kb(void) { - setPinOutput(LAYER_INDICATOR_LED_PIN); - writePinLow(LAYER_INDICATOR_LED_PIN); + gpio_set_pin_output(LAYER_INDICATOR_LED_PIN); + gpio_write_pin_low(LAYER_INDICATOR_LED_PIN); keyboard_post_init_user(); } // Function for layer indicator LED layer_state_t layer_state_set_kb(layer_state_t state) { - writePin(LAYER_INDICATOR_LED_PIN, !layer_state_cmp(state, 0)); + gpio_write_pin(LAYER_INDICATOR_LED_PIN, !layer_state_cmp(state, 0)); return layer_state_set_user(state); } diff --git a/keyboards/switchplate/southpaw_65/southpaw_65.c b/keyboards/switchplate/southpaw_65/southpaw_65.c index d75c9b101d..dfe3665928 100644 --- a/keyboards/switchplate/southpaw_65/southpaw_65.c +++ b/keyboards/switchplate/southpaw_65/southpaw_65.c @@ -16,7 +16,7 @@ #include "quantum.h" void keyboard_pre_init_kb(void) { - setPinOutput(B6); + gpio_set_pin_output(B6); keyboard_pre_init_user(); } @@ -24,7 +24,7 @@ void keyboard_pre_init_kb(void) { bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if(res) { - writePin(B6, !led_state.caps_lock); + gpio_write_pin(B6, !led_state.caps_lock); } return res; } diff --git a/keyboards/switchplate/southpaw_fullsize/southpaw_fullsize.c b/keyboards/switchplate/southpaw_fullsize/southpaw_fullsize.c index f631e1d95a..3d77e8722e 100644 --- a/keyboards/switchplate/southpaw_fullsize/southpaw_fullsize.c +++ b/keyboards/switchplate/southpaw_fullsize/southpaw_fullsize.c @@ -30,9 +30,9 @@ void matrix_init_kb(void) { // runs once when the firmware starts up // D3 Numlock, D4 Capslock, D5 Scrlock - setPinOutput(INDICATOR_NUM); - setPinOutput(INDICATOR_CAPS); - setPinOutput(INDICATOR_SCR); + gpio_set_pin_output(INDICATOR_NUM); + gpio_set_pin_output(INDICATOR_CAPS); + gpio_set_pin_output(INDICATOR_SCR); matrix_init_user(); } @@ -42,9 +42,9 @@ bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if (res) { - writePin(INDICATOR_NUM, !led_state.num_lock); - writePin(INDICATOR_CAPS, !led_state.caps_lock); - writePin(INDICATOR_SCR, !led_state.scroll_lock); + gpio_write_pin(INDICATOR_NUM, !led_state.num_lock); + gpio_write_pin(INDICATOR_CAPS, !led_state.caps_lock); + gpio_write_pin(INDICATOR_SCR, !led_state.scroll_lock); } return res; } diff --git a/keyboards/team0110/p1800fl/p1800fl.c b/keyboards/team0110/p1800fl/p1800fl.c index c82507ec27..9f47b8a5c4 100644 --- a/keyboards/team0110/p1800fl/p1800fl.c +++ b/keyboards/team0110/p1800fl/p1800fl.c @@ -19,9 +19,9 @@ bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if(res) { - writePin(D3, led_state.num_lock); - writePin(D5, led_state.caps_lock); - writePin(C6, led_state.scroll_lock); + gpio_write_pin(D3, led_state.num_lock); + gpio_write_pin(D5, led_state.caps_lock); + gpio_write_pin(C6, led_state.scroll_lock); } return res; } diff --git a/keyboards/technika/technika.c b/keyboards/technika/technika.c index cc60debe9f..65dc9e0d31 100644 --- a/keyboards/technika/technika.c +++ b/keyboards/technika/technika.c @@ -18,9 +18,9 @@ along with this program. If not, see . #include "quantum.h" void keyboard_pre_init_kb(void) { - setPinOutput(A15); - setPinOutput(B3); - setPinOutput(B4); + gpio_set_pin_output(A15); + gpio_set_pin_output(B3); + gpio_set_pin_output(B4); keyboard_pre_init_user(); } diff --git a/keyboards/telophase/telophase.c b/keyboards/telophase/telophase.c index 334cc7697b..cea18abec5 100644 --- a/keyboards/telophase/telophase.c +++ b/keyboards/telophase/telophase.c @@ -18,12 +18,12 @@ along with this program. If not, see . #include "telophase.h" void led_init(void) { - setPinOutput(D1); - setPinOutput(F4); - setPinOutput(F5); - writePinHigh(D1); - writePinHigh(F4); - writePinHigh(F5); + gpio_set_pin_output(D1); + gpio_set_pin_output(F4); + gpio_set_pin_output(F5); + gpio_write_pin_high(D1); + gpio_write_pin_high(F4); + gpio_write_pin_high(F5); } void matrix_init_kb(void) { diff --git a/keyboards/telophase/telophase.h b/keyboards/telophase/telophase.h index 112ba79504..52771ce071 100644 --- a/keyboards/telophase/telophase.h +++ b/keyboards/telophase/telophase.h @@ -19,12 +19,12 @@ along with this program. If not, see . #include "quantum.h" -#define red_led_off writePinHigh(F5) -#define red_led_on writePinLow(F5) -#define blu_led_off writePinHigh(F4) -#define blu_led_on writePinLow(F4) -#define grn_led_off writePinHigh(D1) -#define grn_led_on writePinLow(D1) +#define red_led_off gpio_write_pin_high(F5) +#define red_led_on gpio_write_pin_low(F5) +#define blu_led_off gpio_write_pin_high(F4) +#define blu_led_on gpio_write_pin_low(F4) +#define grn_led_off gpio_write_pin_high(D1) +#define grn_led_on gpio_write_pin_low(D1) #define set_led_off red_led_off; grn_led_off; blu_led_off #define set_led_red red_led_on; grn_led_off; blu_led_off diff --git a/keyboards/tkc/m0lly/m0lly.c b/keyboards/tkc/m0lly/m0lly.c index 2f76952b1f..ceb03e4543 100644 --- a/keyboards/tkc/m0lly/m0lly.c +++ b/keyboards/tkc/m0lly/m0lly.c @@ -17,11 +17,11 @@ #include "quantum.h" void keyboard_pre_init_kb(void) { - setPinInputHigh(D0); - setPinInputHigh(D1); + gpio_set_pin_input_high(D0); + gpio_set_pin_input_high(D1); - setPinOutput(B7); - writePinHigh(B7); + gpio_set_pin_output(B7); + gpio_write_pin_high(B7); keyboard_pre_init_user(); } diff --git a/keyboards/tkc/osav2/osav2.c b/keyboards/tkc/osav2/osav2.c index 51f4ac0e04..9966046486 100644 --- a/keyboards/tkc/osav2/osav2.c +++ b/keyboards/tkc/osav2/osav2.c @@ -16,18 +16,18 @@ #include "quantum.h" void keyboard_pre_init_kb(void) { - setPinOutput(C7); - setPinOutput(C6); - setPinOutput(B6); + gpio_set_pin_output(C7); + gpio_set_pin_output(C6); + gpio_set_pin_output(B6); keyboard_pre_init_user(); } bool led_update_kb(led_t led_state) { if (led_update_user(led_state)) { - writePin(C7, led_state.num_lock); - writePin(C6, led_state.caps_lock); - writePin(B6, led_state.scroll_lock); + gpio_write_pin(C7, led_state.num_lock); + gpio_write_pin(C6, led_state.caps_lock); + gpio_write_pin(B6, led_state.scroll_lock); } return true; } diff --git a/keyboards/tkc/tkc1800/tkc1800.c b/keyboards/tkc/tkc1800/tkc1800.c index b5b4cf0887..815c1d6208 100644 --- a/keyboards/tkc/tkc1800/tkc1800.c +++ b/keyboards/tkc/tkc1800/tkc1800.c @@ -16,11 +16,11 @@ #include "quantum.h" void keyboard_pre_init_kb(void) { - setPinInputHigh(D0); - setPinInputHigh(D1); + gpio_set_pin_input_high(D0); + gpio_set_pin_input_high(D1); - setPinOutput(B7); - writePinHigh(B7); + gpio_set_pin_output(B7); + gpio_write_pin_high(B7); keyboard_pre_init_user(); } diff --git a/keyboards/torn/matrix.c b/keyboards/torn/matrix.c index b674f21d57..64a808534c 100644 --- a/keyboards/torn/matrix.c +++ b/keyboards/torn/matrix.c @@ -30,15 +30,15 @@ static const mcp23018_pin_t secondary_row_pins[MATRIX_ROWS] = SECONDARY_RO static const mcp23018_pin_t secondary_col_pins[SPLIT_MATRIX_COLS] = SECONDARY_COL_PINS; static void select_row(uint8_t row) { - setPinOutput(row_pins[row]); - writePinLow(row_pins[row]); + gpio_set_pin_output(row_pins[row]); + gpio_write_pin_low(row_pins[row]); } -static void unselect_row(uint8_t row) { setPinInputHigh(row_pins[row]); } +static void unselect_row(uint8_t row) { gpio_set_pin_input_high(row_pins[row]); } static void unselect_rows(void) { for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } } @@ -50,7 +50,7 @@ static void select_secondary_row(uint8_t row) { static void init_pins(void) { unselect_rows(); for (uint8_t x = 0; x < SPLIT_MATRIX_COLS; x++) { - setPinInputHigh(col_pins[x]); + gpio_set_pin_input_high(col_pins[x]); } } @@ -60,7 +60,7 @@ static matrix_row_t read_cols(void) { // For each col... for (uint8_t col_index = 0; col_index < SPLIT_MATRIX_COLS; col_index++) { // Select the col pin to read (active low) - uint8_t pin_state = readPin(col_pins[col_index]); + uint8_t pin_state = gpio_read_pin(col_pins[col_index]); // Populate the matrix row with the state of the col pin state |= pin_state ? 0 : (MATRIX_ROW_SHIFTER << col_index); diff --git a/keyboards/touchpad/matrix.c b/keyboards/touchpad/matrix.c index 7929e0969b..afe14cf542 100644 --- a/keyboards/touchpad/matrix.c +++ b/keyboards/touchpad/matrix.c @@ -127,32 +127,32 @@ void matrix_init(void) { i2c_init(); //Motor enable - setPinOutput(E6); + gpio_set_pin_output(E6); //Motor PWM - setPinOutput(D7); + gpio_set_pin_output(D7); //Power LED - setPinOutput(B7); - writePinHigh(B7); + gpio_set_pin_output(B7); + gpio_write_pin_high(B7); //LEDs Columns - setPinOutput(F7); - setPinOutput(F6); - setPinOutput(F5); - setPinOutput(F4); - setPinOutput(F1); - setPinOutput(F0); + gpio_set_pin_output(F7); + gpio_set_pin_output(F6); + gpio_set_pin_output(F5); + gpio_set_pin_output(F4); + gpio_set_pin_output(F1); + gpio_set_pin_output(F0); //LEDs Rows - setPinOutput(D6); - setPinOutput(B4); - setPinOutput(B5); - setPinOutput(B6); - setPinOutput(C6); - setPinOutput(C7); + gpio_set_pin_output(D6); + gpio_set_pin_output(B4); + gpio_set_pin_output(B5); + gpio_set_pin_output(B6); + gpio_set_pin_output(C6); + gpio_set_pin_output(C7); //Capacitive Interrupt - setPinInput(D2); + gpio_set_pin_input(D2); capSetup(); writeDataToTS(0x06, 0x12); //Calibrate capacitive touch IC @@ -208,7 +208,7 @@ void touchClearCurrentDetections(void) { //Check interrupt pin uint8_t isTouchChangeDetected(void) { - return !readPin(D2); + return !gpio_read_pin(D2); } uint8_t matrix_scan(void) { @@ -232,34 +232,34 @@ uint8_t matrix_scan(void) { for (uint8_t c = 0; c < 6; c++) { for (uint8_t r = 0; r < 6; r++) { switch (r) { - case 0: writePin(D6, matrix_is_on(r, c)); break; - case 1: writePin(B4, matrix_is_on(r, c)); break; - case 2: writePin(B5, matrix_is_on(r, c)); break; - case 3: writePin(B6, matrix_is_on(r, c)); break; - case 4: writePin(C6, matrix_is_on(r, c)); break; - case 5: writePin(C7, matrix_is_on(r, c)); break; + case 0: gpio_write_pin(D6, matrix_is_on(r, c)); break; + case 1: gpio_write_pin(B4, matrix_is_on(r, c)); break; + case 2: gpio_write_pin(B5, matrix_is_on(r, c)); break; + case 3: gpio_write_pin(B6, matrix_is_on(r, c)); break; + case 4: gpio_write_pin(C6, matrix_is_on(r, c)); break; + case 5: gpio_write_pin(C7, matrix_is_on(r, c)); break; } switch (c) { - case 0: writePin(F5, !matrix_is_on(r, c)); break; - case 1: writePin(F4, !matrix_is_on(r, c)); break; - case 2: writePin(F1, !matrix_is_on(r, c)); break; - case 3: writePin(F0, !matrix_is_on(r, c)); break; - case 4: writePin(F6, !matrix_is_on(r, c)); break; - case 5: writePin(F7, !matrix_is_on(r, c)); break; + case 0: gpio_write_pin(F5, !matrix_is_on(r, c)); break; + case 1: gpio_write_pin(F4, !matrix_is_on(r, c)); break; + case 2: gpio_write_pin(F1, !matrix_is_on(r, c)); break; + case 3: gpio_write_pin(F0, !matrix_is_on(r, c)); break; + case 4: gpio_write_pin(F6, !matrix_is_on(r, c)); break; + case 5: gpio_write_pin(F7, !matrix_is_on(r, c)); break; } } } if (vibrate == VIBRATE_LENGTH) { - writePinHigh(E6); - writePinHigh(D7); + gpio_write_pin_high(E6); + gpio_write_pin_high(D7); vibrate--; } else if (vibrate > 0) { vibrate--; } else if (vibrate == 0) { - writePinLow(D7); - writePinLow(E6); + gpio_write_pin_low(D7); + gpio_write_pin_low(E6); } matrix_scan_kb(); diff --git a/keyboards/tr60w/tr60w.c b/keyboards/tr60w/tr60w.c index 2bc0648241..ebf48cb1c7 100644 --- a/keyboards/tr60w/tr60w.c +++ b/keyboards/tr60w/tr60w.c @@ -3,9 +3,9 @@ bool led_update_kb(led_t led_state) { bool runDefault = led_update_user(led_state); if (runDefault) { - writePin(B1, !led_state.num_lock); - writePin(B2, !led_state.caps_lock); - writePin(B3, !led_state.scroll_lock); + gpio_write_pin(B1, !led_state.num_lock); + gpio_write_pin(B2, !led_state.caps_lock); + gpio_write_pin(B3, !led_state.scroll_lock); } return runDefault; } diff --git a/keyboards/tzarc/djinn/djinn.c b/keyboards/tzarc/djinn/djinn.c index 8d6e2ec92e..a104710b03 100644 --- a/keyboards/tzarc/djinn/djinn.c +++ b/keyboards/tzarc/djinn/djinn.c @@ -46,23 +46,23 @@ void keyboard_post_init_kb(void) { memset(&kb_state, 0, sizeof(kb_state)); // Turn off increased current limits - setPinOutput(RGB_CURR_1500mA_OK_PIN); - writePinLow(RGB_CURR_1500mA_OK_PIN); - setPinOutput(RGB_CURR_3000mA_OK_PIN); - writePinLow(RGB_CURR_3000mA_OK_PIN); + gpio_set_pin_output(RGB_CURR_1500mA_OK_PIN); + gpio_write_pin_low(RGB_CURR_1500mA_OK_PIN); + gpio_set_pin_output(RGB_CURR_3000mA_OK_PIN); + gpio_write_pin_low(RGB_CURR_3000mA_OK_PIN); // Turn on the RGB - setPinOutput(RGB_POWER_ENABLE_PIN); - writePinHigh(RGB_POWER_ENABLE_PIN); + gpio_set_pin_output(RGB_POWER_ENABLE_PIN); + gpio_write_pin_high(RGB_POWER_ENABLE_PIN); #ifdef EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN - setPinOutput(EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN); - writePinHigh(EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN); + gpio_set_pin_output(EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN); + gpio_write_pin_high(EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN); #endif // EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN // Turn on the LCD - setPinOutput(LCD_POWER_ENABLE_PIN); - writePinHigh(LCD_POWER_ENABLE_PIN); + gpio_set_pin_output(LCD_POWER_ENABLE_PIN); + gpio_write_pin_high(LCD_POWER_ENABLE_PIN); // Let the LCD get some power... wait_ms(150); @@ -148,16 +148,16 @@ void housekeeping_task_kb(void) { switch (current_setting) { default: case USBPD_500MA: - writePinLow(RGB_CURR_1500mA_OK_PIN); - writePinLow(RGB_CURR_3000mA_OK_PIN); + gpio_write_pin_low(RGB_CURR_1500mA_OK_PIN); + gpio_write_pin_low(RGB_CURR_3000mA_OK_PIN); break; case USBPD_1500MA: - writePinHigh(RGB_CURR_1500mA_OK_PIN); - writePinLow(RGB_CURR_3000mA_OK_PIN); + gpio_write_pin_high(RGB_CURR_1500mA_OK_PIN); + gpio_write_pin_low(RGB_CURR_3000mA_OK_PIN); break; case USBPD_3000MA: - writePinHigh(RGB_CURR_1500mA_OK_PIN); - writePinHigh(RGB_CURR_3000mA_OK_PIN); + gpio_write_pin_high(RGB_CURR_1500mA_OK_PIN); + gpio_write_pin_high(RGB_CURR_3000mA_OK_PIN); break; } #else @@ -166,12 +166,12 @@ void housekeeping_task_kb(void) { default: case USBPD_500MA: case USBPD_1500MA: - writePinLow(RGB_CURR_1500mA_OK_PIN); - writePinLow(RGB_CURR_3000mA_OK_PIN); + gpio_write_pin_low(RGB_CURR_1500mA_OK_PIN); + gpio_write_pin_low(RGB_CURR_3000mA_OK_PIN); break; case USBPD_3000MA: - writePinHigh(RGB_CURR_1500mA_OK_PIN); - writePinLow(RGB_CURR_3000mA_OK_PIN); + gpio_write_pin_high(RGB_CURR_1500mA_OK_PIN); + gpio_write_pin_low(RGB_CURR_3000mA_OK_PIN); break; } #endif @@ -189,7 +189,7 @@ void housekeeping_task_kb(void) { // Enable/disable RGB if (peripherals_on) { // Turn on RGB - writePinHigh(RGB_POWER_ENABLE_PIN); + gpio_write_pin_high(RGB_POWER_ENABLE_PIN); // Modify the RGB state if different to the LCD state if (rgb_matrix_is_enabled() != peripherals_on) { // Wait for a small amount of time to allow the RGB capacitors to charge, before enabling RGB output @@ -199,7 +199,7 @@ void housekeeping_task_kb(void) { } } else { // Turn off RGB - writePinLow(RGB_POWER_ENABLE_PIN); + gpio_write_pin_low(RGB_POWER_ENABLE_PIN); // Disable the PWM output for the RGB if (rgb_matrix_is_enabled() != peripherals_on) { rgb_matrix_disable_noeeprom(); diff --git a/keyboards/tzarc/djinn/djinn_portscan_matrix.c b/keyboards/tzarc/djinn/djinn_portscan_matrix.c index 63f480be27..3506f3b8ac 100644 --- a/keyboards/tzarc/djinn/djinn_portscan_matrix.c +++ b/keyboards/tzarc/djinn/djinn_portscan_matrix.c @@ -16,7 +16,7 @@ void matrix_wait_for_pin(pin_t pin, uint8_t target_state) { rtcnt_t start = chSysGetRealtimeCounterX(); rtcnt_t end = start + 5000; while (chSysIsCounterWithinX(chSysGetRealtimeCounterX(), start, end)) { - if (readPin(pin) == target_state) { + if (gpio_read_pin(pin) == target_state) { break; } } @@ -36,10 +36,10 @@ static void dummy_vt_callback(virtual_timer_t *vtp, void *p) {} void matrix_init_custom(void) { for (int i = 0; i < MATRIX_ROWS; ++i) { - setPinInputHigh(row_pins[i]); + gpio_set_pin_input_high(row_pins[i]); } for (int i = 0; i < MATRIX_COLS; ++i) { - setPinInputHigh(col_pins[i]); + gpio_set_pin_input_high(col_pins[i]); } // Start a virtual timer so we'll still get periodic wakeups, now that USB SOF doesn't wake up the main loop @@ -56,8 +56,8 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { pin_t curr_col_pin = col_pins[current_col]; // Setup the output column pin - setPinOutput(curr_col_pin); - writePinLow(curr_col_pin); + gpio_set_pin_output(curr_col_pin); + gpio_write_pin_low(curr_col_pin); matrix_wait_for_pin(curr_col_pin, 0); // Read the row ports @@ -65,7 +65,7 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { uint32_t gpio_c = palReadPort(GPIOC); // Unselect the row pin - setPinInputHigh(curr_col_pin); + gpio_set_pin_input_high(curr_col_pin); // Construct the packed bitmask for the pins uint32_t readback = ~(((gpio_b & GPIOB_BITMASK) >> GPIOB_OFFSET) | (((gpio_c & GPIOC_BITMASK) >> GPIOC_OFFSET) << GPIOB_COUNT)); @@ -98,11 +98,11 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { void matrix_wait_for_interrupt(void) { // Set up row/col pins and attach callback for (int i = 0; i < ARRAY_SIZE(col_pins); ++i) { - setPinOutput(col_pins[i]); - writePinLow(col_pins[i]); + gpio_set_pin_output(col_pins[i]); + gpio_write_pin_low(col_pins[i]); } for (int i = 0; i < ARRAY_SIZE(row_pins); ++i) { - setPinInputHigh(row_pins[i]); + gpio_set_pin_input_high(row_pins[i]); palEnableLineEvent(row_pins[i], PAL_EVENT_MODE_BOTH_EDGES); } @@ -112,11 +112,11 @@ void matrix_wait_for_interrupt(void) { // Now that the interrupt has woken us up, reset all the row/col pins back to defaults for (int i = 0; i < ARRAY_SIZE(row_pins); ++i) { palDisableLineEvent(row_pins[i]); - writePinHigh(row_pins[i]); - setPinInputHigh(row_pins[i]); + gpio_write_pin_high(row_pins[i]); + gpio_set_pin_input_high(row_pins[i]); } for (int i = 0; i < ARRAY_SIZE(col_pins); ++i) { - writePinHigh(col_pins[i]); - setPinInputHigh(col_pins[i]); + gpio_write_pin_high(col_pins[i]); + gpio_set_pin_input_high(col_pins[i]); } } diff --git a/keyboards/tzarc/ghoul/ghoul.c b/keyboards/tzarc/ghoul/ghoul.c index a97399110c..bbd536dfdb 100644 --- a/keyboards/tzarc/ghoul/ghoul.c +++ b/keyboards/tzarc/ghoul/ghoul.c @@ -6,8 +6,8 @@ void keyboard_post_init_kb(void) { // Enable RGB current limiter and wait for a bit before allowing RGB to continue - setPinOutput(RGB_ENABLE_PIN); - writePinHigh(RGB_ENABLE_PIN); + gpio_set_pin_output(RGB_ENABLE_PIN); + gpio_write_pin_high(RGB_ENABLE_PIN); wait_ms(20); // Offload to the user func @@ -16,12 +16,12 @@ void keyboard_post_init_kb(void) { void matrix_init_custom(void) { // SPI Matrix - setPinOutput(SPI_MATRIX_CHIP_SELECT_PIN); - writePinHigh(SPI_MATRIX_CHIP_SELECT_PIN); + gpio_set_pin_output(SPI_MATRIX_CHIP_SELECT_PIN); + gpio_write_pin_high(SPI_MATRIX_CHIP_SELECT_PIN); spi_init(); // Encoder pushbutton - setPinInputLow(ENCODER_PUSHBUTTON_PIN); + gpio_set_pin_input_low(ENCODER_PUSHBUTTON_PIN); } bool matrix_scan_custom(matrix_row_t current_matrix[]) { @@ -33,7 +33,7 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { spi_stop(); // Read from the encoder pushbutton - temp_matrix[5] = readPin(ENCODER_PUSHBUTTON_PIN) ? 1 : 0; + temp_matrix[5] = gpio_read_pin(ENCODER_PUSHBUTTON_PIN) ? 1 : 0; // Check if we've changed, return the last-read data bool changed = memcmp(current_matrix, temp_matrix, sizeof(temp_matrix)) != 0; diff --git a/keyboards/unicomp/spacesaver_m_post_2013/overnumpad_1xb/overnumpad_1xb.c b/keyboards/unicomp/spacesaver_m_post_2013/overnumpad_1xb/overnumpad_1xb.c index f0c1161cfe..f441285c9a 100644 --- a/keyboards/unicomp/spacesaver_m_post_2013/overnumpad_1xb/overnumpad_1xb.c +++ b/keyboards/unicomp/spacesaver_m_post_2013/overnumpad_1xb/overnumpad_1xb.c @@ -20,19 +20,19 @@ void keyboard_post_init_kb(void) { // Led pins: // C12 is the left-most led, normally Num Lock, but on Spacesaver M it's Caps Lock. Configured in info.json - setPinOutput(C11); // middle led, always off on Spacesaver M - writePin(C11, 0); - setPinOutput(C10); // right-most led, normally Scroll Lock, but on Spacesaver M indicates function layer + gpio_set_pin_output(C11); // middle led, always off on Spacesaver M + gpio_write_pin(C11, 0); + gpio_set_pin_output(C10); // right-most led, normally Scroll Lock, but on Spacesaver M indicates function layer } layer_state_t layer_state_set_kb(layer_state_t state) { switch (get_highest_layer(state)) { case 0: - writePin(C10, 0); + gpio_write_pin(C10, 0); break; default: - writePin(C10, 1); + gpio_write_pin(C10, 1); break; } return layer_state_set_user(state); diff --git a/keyboards/unicomp/spacesaver_m_pre_2013/overnumpad_1xb/overnumpad_1xb.c b/keyboards/unicomp/spacesaver_m_pre_2013/overnumpad_1xb/overnumpad_1xb.c index 517df0035a..bad0c76e43 100644 --- a/keyboards/unicomp/spacesaver_m_pre_2013/overnumpad_1xb/overnumpad_1xb.c +++ b/keyboards/unicomp/spacesaver_m_pre_2013/overnumpad_1xb/overnumpad_1xb.c @@ -20,18 +20,18 @@ void keyboard_post_init_kb(void) { // Led pins: // C12 is the left-most led, normally Num Lock, but on Spacesaver M it's Caps Lock. Configured in info.json - setPinOutput(C11); // middle led, always off on Spacesaver M - writePin(C11, 0); - setPinOutput(C10); // right-most led, normally Scroll Lock, but on Spacesaver M indicates function layer + gpio_set_pin_output(C11); // middle led, always off on Spacesaver M + gpio_write_pin(C11, 0); + gpio_set_pin_output(C10); // right-most led, normally Scroll Lock, but on Spacesaver M indicates function layer } layer_state_t layer_state_set_kb(layer_state_t state) { switch (get_highest_layer(state)) { case 0: - writePin(C10, 0); + gpio_write_pin(C10, 0); break; default: - writePin(C10, 1); + gpio_write_pin(C10, 1); break; } return layer_state_set_user(state); diff --git a/keyboards/viktus/minne_topre/ec.c b/keyboards/viktus/minne_topre/ec.c index edd5f9a31d..12ca8a3c80 100644 --- a/keyboards/viktus/minne_topre/ec.c +++ b/keyboards/viktus/minne_topre/ec.c @@ -48,35 +48,35 @@ _Static_assert(sizeof(mux_sel_pins) == 3, "invalid MUX_SEL_PINS"); static ec_config_t config; static uint16_t ec_sw_value[MATRIX_COLS][MATRIX_ROWS]; -static inline void discharge_capacitor(void) { setPinOutput(DISCHARGE_PIN); } +static inline void discharge_capacitor(void) { gpio_set_pin_output(DISCHARGE_PIN); } static inline void charge_capacitor(uint8_t col) { - setPinInput(DISCHARGE_PIN); - writePinHigh(col_pins[col]); + gpio_set_pin_input(DISCHARGE_PIN); + gpio_write_pin_high(col_pins[col]); } static inline void clear_all_col_pins(void) { for (int col = 0; col < sizeof(col_pins); col++) { - writePinLow(col_pins[col]); + gpio_write_pin_low(col_pins[col]); } } void init_mux_sel(void) { for (int idx = 0; idx < sizeof(mux_sel_pins); idx++) { - setPinOutput(mux_sel_pins[idx]); + gpio_set_pin_output(mux_sel_pins[idx]); } } void select_mux(uint8_t row) { uint8_t ch = row_channels[row]; - writePin(mux_sel_pins[0], ch & 1); - writePin(mux_sel_pins[1], ch & 2); - writePin(mux_sel_pins[2], ch & 4); + gpio_write_pin(mux_sel_pins[0], ch & 1); + gpio_write_pin(mux_sel_pins[1], ch & 2); + gpio_write_pin(mux_sel_pins[2], ch & 4); } void init_col(void) { for (int idx = 0; idx < sizeof(col_pins); idx++) { - setPinOutput(col_pins[idx]); - writePinLow(col_pins[idx]); + gpio_set_pin_output(col_pins[idx]); + gpio_write_pin_low(col_pins[idx]); } } @@ -85,8 +85,8 @@ void ec_init(ec_config_t const* const ec_config) { config = *ec_config; // initialize discharge pin as discharge mode - writePinLow(DISCHARGE_PIN); - setPinOutput(DISCHARGE_PIN); + gpio_write_pin_low(DISCHARGE_PIN); + gpio_set_pin_output(DISCHARGE_PIN); // set analog reference analogReference(ADC_REF_POWER); @@ -98,7 +98,7 @@ void ec_init(ec_config_t const* const ec_config) { init_mux_sel(); // set discharge pin to charge mode - setPinInput(DISCHARGE_PIN); + gpio_set_pin_input(DISCHARGE_PIN); } uint16_t ec_readkey_raw(uint8_t col, uint8_t row) { diff --git a/keyboards/viktus/osav2_numpad_topre/ec.c b/keyboards/viktus/osav2_numpad_topre/ec.c index 93e698412a..f5890db50b 100644 --- a/keyboards/viktus/osav2_numpad_topre/ec.c +++ b/keyboards/viktus/osav2_numpad_topre/ec.c @@ -48,35 +48,35 @@ _Static_assert(sizeof(mux_sel_pins) == 3, "invalid MUX_SEL_PINS"); static ec_config_t config; static uint16_t ec_sw_value[MATRIX_COLS][MATRIX_ROWS]; -static inline void discharge_capacitor(void) { setPinOutput(DISCHARGE_PIN); } +static inline void discharge_capacitor(void) { gpio_set_pin_output(DISCHARGE_PIN); } static inline void charge_capacitor(uint8_t col) { - setPinInput(DISCHARGE_PIN); - writePinHigh(col_pins[col]); + gpio_set_pin_input(DISCHARGE_PIN); + gpio_write_pin_high(col_pins[col]); } static inline void clear_all_col_pins(void) { for (int col = 0; col < sizeof(col_pins); col++) { - writePinLow(col_pins[col]); + gpio_write_pin_low(col_pins[col]); } } void init_mux_sel(void) { for (int idx = 0; idx < sizeof(mux_sel_pins); idx++) { - setPinOutput(mux_sel_pins[idx]); + gpio_set_pin_output(mux_sel_pins[idx]); } } void select_mux(uint8_t row) { uint8_t ch = row_channels[row]; - writePin(mux_sel_pins[0], ch & 1); - writePin(mux_sel_pins[1], ch & 2); - writePin(mux_sel_pins[2], ch & 4); + gpio_write_pin(mux_sel_pins[0], ch & 1); + gpio_write_pin(mux_sel_pins[1], ch & 2); + gpio_write_pin(mux_sel_pins[2], ch & 4); } void init_col(void) { for (int idx = 0; idx < sizeof(col_pins); idx++) { - setPinOutput(col_pins[idx]); - writePinLow(col_pins[idx]); + gpio_set_pin_output(col_pins[idx]); + gpio_write_pin_low(col_pins[idx]); } } @@ -85,8 +85,8 @@ void ec_init(ec_config_t const* const ec_config) { config = *ec_config; // initialize discharge pin as discharge mode - writePinLow(DISCHARGE_PIN); - setPinOutput(DISCHARGE_PIN); + gpio_write_pin_low(DISCHARGE_PIN); + gpio_set_pin_output(DISCHARGE_PIN); // set analog reference analogReference(ADC_REF_POWER); @@ -98,7 +98,7 @@ void ec_init(ec_config_t const* const ec_config) { init_mux_sel(); // set discharge pin to charge mode - setPinInput(DISCHARGE_PIN); + gpio_set_pin_input(DISCHARGE_PIN); } uint16_t ec_readkey_raw(uint8_t col, uint8_t row) { diff --git a/keyboards/viktus/osav2_topre/ec.c b/keyboards/viktus/osav2_topre/ec.c index 13d9fde654..702af681a2 100644 --- a/keyboards/viktus/osav2_topre/ec.c +++ b/keyboards/viktus/osav2_topre/ec.c @@ -48,35 +48,35 @@ _Static_assert(sizeof(mux_sel_pins) == 3, "invalid MUX_SEL_PINS"); static ec_config_t config; static uint16_t ec_sw_value[MATRIX_COLS][MATRIX_ROWS]; -static inline void discharge_capacitor(void) { setPinOutput(DISCHARGE_PIN); } +static inline void discharge_capacitor(void) { gpio_set_pin_output(DISCHARGE_PIN); } static inline void charge_capacitor(uint8_t col) { - setPinInput(DISCHARGE_PIN); - writePinHigh(col_pins[col]); + gpio_set_pin_input(DISCHARGE_PIN); + gpio_write_pin_high(col_pins[col]); } static inline void clear_all_col_pins(void) { for (int col = 0; col < sizeof(col_pins); col++) { - writePinLow(col_pins[col]); + gpio_write_pin_low(col_pins[col]); } } void init_mux_sel(void) { for (int idx = 0; idx < sizeof(mux_sel_pins); idx++) { - setPinOutput(mux_sel_pins[idx]); + gpio_set_pin_output(mux_sel_pins[idx]); } } void select_mux(uint8_t row) { uint8_t ch = row_channels[row]; - writePin(mux_sel_pins[0], ch & 1); - writePin(mux_sel_pins[1], ch & 2); - writePin(mux_sel_pins[2], ch & 4); + gpio_write_pin(mux_sel_pins[0], ch & 1); + gpio_write_pin(mux_sel_pins[1], ch & 2); + gpio_write_pin(mux_sel_pins[2], ch & 4); } void init_col(void) { for (int idx = 0; idx < sizeof(col_pins); idx++) { - setPinOutput(col_pins[idx]); - writePinLow(col_pins[idx]); + gpio_set_pin_output(col_pins[idx]); + gpio_write_pin_low(col_pins[idx]); } } @@ -85,8 +85,8 @@ void ec_init(ec_config_t const* const ec_config) { config = *ec_config; // initialize discharge pin as discharge mode - writePinLow(DISCHARGE_PIN); - setPinOutput(DISCHARGE_PIN); + gpio_write_pin_low(DISCHARGE_PIN); + gpio_set_pin_output(DISCHARGE_PIN); // set analog reference analogReference(ADC_REF_POWER); @@ -98,7 +98,7 @@ void ec_init(ec_config_t const* const ec_config) { init_mux_sel(); // set discharge pin to charge mode - setPinInput(DISCHARGE_PIN); + gpio_set_pin_input(DISCHARGE_PIN); } uint16_t ec_readkey_raw(uint8_t col, uint8_t row) { diff --git a/keyboards/viktus/sp111/matrix.c b/keyboards/viktus/sp111/matrix.c index 35a1a740fc..5ead535593 100644 --- a/keyboards/viktus/sp111/matrix.c +++ b/keyboards/viktus/sp111/matrix.c @@ -33,22 +33,22 @@ static const pin_t col_pins[MATRIX_COLS] = {F5, F6, F7, C7, C6, B6, B5, D3, //_____REGULAR funcs____________________________________________________________ static void select_row(uint8_t row) { - setPinOutput(row_pins[row]); - writePinLow(row_pins[row]); + gpio_set_pin_output(row_pins[row]); + gpio_write_pin_low(row_pins[row]); } -static void unselect_row(uint8_t row) { setPinInputHigh(row_pins[row]); } +static void unselect_row(uint8_t row) { gpio_set_pin_input_high(row_pins[row]); } static void unselect_rows(void) { for (uint8_t x = 0; x < MATRIX_ROWS / 2; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } } static void init_pins(void) { unselect_rows(); for (uint8_t x = 0; x < MATRIX_COLS; x++) { - setPinInputHigh(col_pins[x]); + gpio_set_pin_input_high(col_pins[x]); } } @@ -66,7 +66,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) // For each col... for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { // Select the col pin to read (active low) - uint8_t pin_state = readPin(col_pins[col_index]); + uint8_t pin_state = gpio_read_pin(col_pins[col_index]); // Populate the matrix row with the state of the col pin current_row_value |= pin_state ? 0 : (MATRIX_ROW_SHIFTER << col_index); diff --git a/keyboards/viktus/sp111/sp111.c b/keyboards/viktus/sp111/sp111.c index 523666ed73..1626683804 100644 --- a/keyboards/viktus/sp111/sp111.c +++ b/keyboards/viktus/sp111/sp111.c @@ -17,16 +17,16 @@ void keyboard_pre_init_kb(void) { // enable built in pullups to avoid timeouts when right hand not connected - setPinInputHigh(D0); - setPinInputHigh(D1); + gpio_set_pin_input_high(D0); + gpio_set_pin_input_high(D1); keyboard_pre_init_user(); } void matrix_init_kb(void) { - setPinOutput(F0); - setPinOutput(F1); - setPinOutput(F4); + gpio_set_pin_output(F0); + gpio_set_pin_output(F1); + gpio_set_pin_output(F4); matrix_init_user(); } @@ -34,9 +34,9 @@ void matrix_init_kb(void) { bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if (res) { - writePin(F0, led_state.num_lock); - writePin(F1, led_state.caps_lock); - writePin(F4, led_state.scroll_lock); + gpio_write_pin(F0, led_state.num_lock); + gpio_write_pin(F1, led_state.caps_lock); + gpio_write_pin(F4, led_state.scroll_lock); } return res; } diff --git a/keyboards/viktus/sp111_v2/sp111_v2.c b/keyboards/viktus/sp111_v2/sp111_v2.c index 96a9aaa5fe..9d749ccbac 100644 --- a/keyboards/viktus/sp111_v2/sp111_v2.c +++ b/keyboards/viktus/sp111_v2/sp111_v2.c @@ -5,8 +5,8 @@ void keyboard_pre_init_kb(void) { // enable built in pullups to avoid timeouts when right hand not connected - setPinInputHigh(D0); - setPinInputHigh(D1); + gpio_set_pin_input_high(D0); + gpio_set_pin_input_high(D1); keyboard_pre_init_user(); } diff --git a/keyboards/viktus/sp_mini/sp_mini.c b/keyboards/viktus/sp_mini/sp_mini.c index ffae6c5c54..1554dd3469 100644 --- a/keyboards/viktus/sp_mini/sp_mini.c +++ b/keyboards/viktus/sp_mini/sp_mini.c @@ -18,8 +18,8 @@ void keyboard_pre_init_kb(void) { // enable built in pullups to avoid timeouts when right hand not connected - setPinInputHigh(D0); - setPinInputHigh(D1); + gpio_set_pin_input_high(D0); + gpio_set_pin_input_high(D1); keyboard_pre_init_user(); } diff --git a/keyboards/viktus/styrka_topre/ec.c b/keyboards/viktus/styrka_topre/ec.c index 078723f691..4a8ce5ca29 100644 --- a/keyboards/viktus/styrka_topre/ec.c +++ b/keyboards/viktus/styrka_topre/ec.c @@ -49,35 +49,35 @@ _Static_assert(sizeof(mux_sel_pins) == 3, "invalid MUX_SEL_PINS"); static ec_config_t config; static uint16_t ec_sw_value[MATRIX_COLS][MATRIX_ROWS]; -static inline void discharge_capacitor(void) { setPinOutput(DISCHARGE_PIN); } +static inline void discharge_capacitor(void) { gpio_set_pin_output(DISCHARGE_PIN); } static inline void charge_capacitor(uint8_t col) { - setPinInput(DISCHARGE_PIN); - writePinHigh(col_pins[col]); + gpio_set_pin_input(DISCHARGE_PIN); + gpio_write_pin_high(col_pins[col]); } static inline void clear_all_col_pins(void) { for (int col = 0; col < sizeof(col_pins); col++) { - writePinLow(col_pins[col]); + gpio_write_pin_low(col_pins[col]); } } void init_mux_sel(void) { for (int idx = 0; idx < sizeof(mux_sel_pins); idx++) { - setPinOutput(mux_sel_pins[idx]); + gpio_set_pin_output(mux_sel_pins[idx]); } } void select_mux(uint8_t row) { uint8_t ch = row_channels[row]; - writePin(mux_sel_pins[0], ch & 1); - writePin(mux_sel_pins[1], ch & 2); - writePin(mux_sel_pins[2], ch & 4); + gpio_write_pin(mux_sel_pins[0], ch & 1); + gpio_write_pin(mux_sel_pins[1], ch & 2); + gpio_write_pin(mux_sel_pins[2], ch & 4); } void init_col(void) { for (int idx = 0; idx < sizeof(col_pins); idx++) { - setPinOutput(col_pins[idx]); - writePinLow(col_pins[idx]); + gpio_set_pin_output(col_pins[idx]); + gpio_write_pin_low(col_pins[idx]); } } @@ -86,8 +86,8 @@ void ec_init(ec_config_t const* const ec_config) { config = *ec_config; // initialize discharge pin as discharge mode - writePinLow(DISCHARGE_PIN); - setPinOutput(DISCHARGE_PIN); + gpio_write_pin_low(DISCHARGE_PIN); + gpio_set_pin_output(DISCHARGE_PIN); // set analog reference analogReference(ADC_REF_POWER); @@ -99,7 +99,7 @@ void ec_init(ec_config_t const* const ec_config) { init_mux_sel(); // set discharge pin to charge mode - setPinInput(DISCHARGE_PIN); + gpio_set_pin_input(DISCHARGE_PIN); } uint16_t ec_readkey_raw(uint8_t col, uint8_t row) { diff --git a/keyboards/vitamins_included/rev2/rev2.c b/keyboards/vitamins_included/rev2/rev2.c index d34cdb4fc1..e445a3da45 100644 --- a/keyboards/vitamins_included/rev2/rev2.c +++ b/keyboards/vitamins_included/rev2/rev2.c @@ -7,9 +7,9 @@ bool is_keyboard_left(void) { return !is_keyboard_master(); #elif defined(SPLIT_HAND_PIN) // Test pin SPLIT_HAND_PIN for High/Low, if low it's right hand - setPinInputHigh(SPLIT_HAND_PIN); - bool x = !readPin(SPLIT_HAND_PIN); - setPinInput(SPLIT_HAND_PIN); + gpio_set_pin_input_high(SPLIT_HAND_PIN); + bool x = !gpio_read_pin(SPLIT_HAND_PIN); + gpio_set_pin_input(SPLIT_HAND_PIN); return x; #elif defined(EE_HANDS) return eeprom_read_byte(EECONFIG_HANDEDNESS); diff --git a/keyboards/westfoxtrot/cypher/rev1/rev1.c b/keyboards/westfoxtrot/cypher/rev1/rev1.c index b6736f97a7..eeaa7b4a4c 100644 --- a/keyboards/westfoxtrot/cypher/rev1/rev1.c +++ b/keyboards/westfoxtrot/cypher/rev1/rev1.c @@ -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; } diff --git a/keyboards/westfoxtrot/cypher/rev5/rev5.c b/keyboards/westfoxtrot/cypher/rev5/rev5.c index 477e1298af..37ca9cf3c1 100644 --- a/keyboards/westfoxtrot/cypher/rev5/rev5.c +++ b/keyboards/westfoxtrot/cypher/rev5/rev5.c @@ -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; } diff --git a/keyboards/westfoxtrot/prophet/prophet.c b/keyboards/westfoxtrot/prophet/prophet.c index 4284fa81a6..3ef0a3f928 100644 --- a/keyboards/westfoxtrot/prophet/prophet.c +++ b/keyboards/westfoxtrot/prophet/prophet.c @@ -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; } diff --git a/keyboards/wilba_tech/wt60_xt/wt60_xt.c b/keyboards/wilba_tech/wt60_xt/wt60_xt.c index 87527e7edf..7c6a2fafc4 100644 --- a/keyboards/wilba_tech/wt60_xt/wt60_xt.c +++ b/keyboards/wilba_tech/wt60_xt/wt60_xt.c @@ -51,14 +51,14 @@ void eeconfig_init_kb(void) { #endif // AUDIO_CLICKY void keyboard_pre_init_kb(void) { - setPinOutput(F1); + gpio_set_pin_output(F1); keyboard_pre_init_user(); } bool led_update_kb(led_t led_state) { if (led_update_user(led_state)) { - writePin(F1, led_state.caps_lock); + gpio_write_pin(F1, led_state.caps_lock); } #ifdef AUDIO_ENABLE diff --git a/keyboards/wilba_tech/wt69_a/wt69_a.c b/keyboards/wilba_tech/wt69_a/wt69_a.c index 718bb0d32f..842b62a4d1 100644 --- a/keyboards/wilba_tech/wt69_a/wt69_a.c +++ b/keyboards/wilba_tech/wt69_a/wt69_a.c @@ -17,14 +17,14 @@ #include "quantum.h" void keyboard_pre_init_kb(void) { - setPinOutput(F1); + gpio_set_pin_output(F1); keyboard_pre_init_user(); } bool led_update_kb(led_t led_state) { if (led_update_user(led_state)) { - writePin(F1, led_state.caps_lock); + gpio_write_pin(F1, led_state.caps_lock); } return true; } diff --git a/keyboards/wilba_tech/wt70_jb/wt70_jb.c b/keyboards/wilba_tech/wt70_jb/wt70_jb.c index 7a879207d6..ae9b5dcbec 100644 --- a/keyboards/wilba_tech/wt70_jb/wt70_jb.c +++ b/keyboards/wilba_tech/wt70_jb/wt70_jb.c @@ -18,14 +18,14 @@ bool g_first_execution = false; void keyboard_pre_init_kb(void) { - setPinOutput(F1); + gpio_set_pin_output(F1); keyboard_pre_init_user(); } bool led_update_kb(led_t led_state) { if (led_update_user(led_state)) { - writePin(F1, led_state.caps_lock); + gpio_write_pin(F1, led_state.caps_lock); } return true; } diff --git a/keyboards/wolfmarkclub/wm1/wm1.c b/keyboards/wolfmarkclub/wm1/wm1.c index 370f9c7cfa..9c4fb090c8 100644 --- a/keyboards/wolfmarkclub/wm1/wm1.c +++ b/keyboards/wolfmarkclub/wm1/wm1.c @@ -6,17 +6,17 @@ void bootloader_jump(void) { } void matrix_init_kb(void) { - setPinOutput(B1); // Top Indicator LED - setPinOutput(B0); // Middle Indicator LED - setPinOutput(C5); // Bottom Indicator LED + gpio_set_pin_output(B1); // Top Indicator LED + gpio_set_pin_output(B0); // Middle Indicator LED + gpio_set_pin_output(C5); // Bottom Indicator LED matrix_init_user(); } bool led_update_kb(led_t led_state) { if(led_update_user(led_state)) { - writePin(B1, led_state.caps_lock); - writePin(B0, led_state.num_lock); - writePin(C5, led_state.scroll_lock); + gpio_write_pin(B1, led_state.caps_lock); + gpio_write_pin(B0, led_state.num_lock); + gpio_write_pin(C5, led_state.scroll_lock); } return true; } diff --git a/keyboards/work_louder/micro/matrix.c b/keyboards/work_louder/micro/matrix.c index 743c788662..3cfbf17dad 100644 --- a/keyboards/work_louder/micro/matrix.c +++ b/keyboards/work_louder/micro/matrix.c @@ -22,27 +22,27 @@ static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; static inline void setPinOutput_writeLow(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinLow(pin); + gpio_set_pin_output(pin); + gpio_write_pin_low(pin); } } static inline void setPinOutput_writeHigh(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinHigh(pin); + gpio_set_pin_output(pin); + gpio_write_pin_high(pin); } } static inline void setPinInputHigh_atomic(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinInputHigh(pin); + gpio_set_pin_input_high(pin); } } static inline uint8_t readMatrixPin(pin_t pin) { if (pin != NO_PIN) { - return readPin(pin); + return gpio_read_pin(pin); } else { return 1; } diff --git a/keyboards/work_louder/micro/micro.c b/keyboards/work_louder/micro/micro.c index d845a62250..07ab92f7a7 100644 --- a/keyboards/work_louder/micro/micro.c +++ b/keyboards/work_louder/micro/micro.c @@ -49,29 +49,29 @@ bool encoder_update_kb(uint8_t index, bool clockwise) { #endif void work_louder_micro_led_1_on(void) { - setPinOutput(WORK_LOUDER_LED_PIN_1); - writePin(WORK_LOUDER_LED_PIN_1, true); + gpio_set_pin_output(WORK_LOUDER_LED_PIN_1); + gpio_write_pin(WORK_LOUDER_LED_PIN_1, true); } void work_louder_micro_led_2_on(void) { - setPinOutput(WORK_LOUDER_LED_PIN_2); - writePin(WORK_LOUDER_LED_PIN_2, true); + gpio_set_pin_output(WORK_LOUDER_LED_PIN_2); + gpio_write_pin(WORK_LOUDER_LED_PIN_2, true); } void work_louder_micro_led_3_on(void) { - setPinOutput(WORK_LOUDER_LED_PIN_3); - writePin(WORK_LOUDER_LED_PIN_3, true); + gpio_set_pin_output(WORK_LOUDER_LED_PIN_3); + gpio_write_pin(WORK_LOUDER_LED_PIN_3, true); } void work_louder_micro_led_1_off(void) { - setPinInput(WORK_LOUDER_LED_PIN_1); - writePin(WORK_LOUDER_LED_PIN_1, false); + gpio_set_pin_input(WORK_LOUDER_LED_PIN_1); + gpio_write_pin(WORK_LOUDER_LED_PIN_1, false); } void work_louder_micro_led_2_off(void) { - setPinInput(WORK_LOUDER_LED_PIN_2); - writePin(WORK_LOUDER_LED_PIN_2, false); + gpio_set_pin_input(WORK_LOUDER_LED_PIN_2); + gpio_write_pin(WORK_LOUDER_LED_PIN_2, false); } void work_louder_micro_led_3_off(void) { - setPinInput(WORK_LOUDER_LED_PIN_3); - writePin(WORK_LOUDER_LED_PIN_3, false); + gpio_set_pin_input(WORK_LOUDER_LED_PIN_3); + gpio_write_pin(WORK_LOUDER_LED_PIN_3, false); } void work_louder_micro_led_all_on(void) { diff --git a/keyboards/work_louder/work_board/work_board.c b/keyboards/work_louder/work_board/work_board.c index 157504216d..975c7aa794 100644 --- a/keyboards/work_louder/work_board/work_board.c +++ b/keyboards/work_louder/work_board/work_board.c @@ -111,13 +111,13 @@ bool rgb_matrix_indicators_kb(void) { } void keyboard_pre_init_kb(void) { - setPinOutput(B2); - setPinOutput(B3); - setPinOutput(B7); + gpio_set_pin_output(B2); + gpio_set_pin_output(B3); + gpio_set_pin_output(B7); - writePinLow(B2); - writePinLow(B3); - writePinLow(B7); + gpio_write_pin_low(B2); + gpio_write_pin_low(B3); + gpio_write_pin_low(B7); keyboard_pre_init_user(); } diff --git a/keyboards/wsk/g4m3ralpha/g4m3ralpha.c b/keyboards/wsk/g4m3ralpha/g4m3ralpha.c index fb9344a1bf..3c039a173f 100644 --- a/keyboards/wsk/g4m3ralpha/g4m3ralpha.c +++ b/keyboards/wsk/g4m3ralpha/g4m3ralpha.c @@ -18,12 +18,12 @@ void matrix_init_kb(void) { - setPinOutput(D3); - writePinLow(D3); - setPinOutput(D2); - writePinLow(D2); - setPinOutput(D0); - writePinLow(D0); + gpio_set_pin_output(D3); + gpio_write_pin_low(D3); + gpio_set_pin_output(D2); + gpio_write_pin_low(D2); + gpio_set_pin_output(D0); + gpio_write_pin_low(D0); matrix_init_user(); }; @@ -31,9 +31,9 @@ void matrix_init_kb(void) { bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if(res) { - writePin(D3, led_state.num_lock); - writePin(D0, led_state.caps_lock); - writePin(D2, led_state.scroll_lock); + gpio_write_pin(D3, led_state.num_lock); + gpio_write_pin(D0, led_state.caps_lock); + gpio_write_pin(D2, led_state.scroll_lock); } return res; } diff --git a/keyboards/wuque/ikki68/ikki68.c b/keyboards/wuque/ikki68/ikki68.c index a61ddf3a56..382ec00251 100644 --- a/keyboards/wuque/ikki68/ikki68.c +++ b/keyboards/wuque/ikki68/ikki68.c @@ -17,14 +17,14 @@ #include "quantum.h" void matrix_init_kb(void) { - setPinOutput(C6); + gpio_set_pin_output(C6); matrix_init_user(); } bool led_update_kb(led_t led_state) { bool res = led_update_user(led_state); if(res) { - writePin(C6, !led_state.caps_lock); + gpio_write_pin(C6, !led_state.caps_lock); } return res; } diff --git a/keyboards/xiudi/xd75/xd75.c b/keyboards/xiudi/xd75/xd75.c index b016643572..47bfd6d3dd 100644 --- a/keyboards/xiudi/xd75/xd75.c +++ b/keyboards/xiudi/xd75/xd75.c @@ -29,40 +29,40 @@ void matrix_init_kb(void) { } void capslock_led_init(void) { - setPinOutput(XD75_CAPSLOCK_LED); + gpio_set_pin_output(XD75_CAPSLOCK_LED); capslock_led_off(); } void capslock_led_off(void) { - writePinHigh(XD75_CAPSLOCK_LED); + gpio_write_pin_high(XD75_CAPSLOCK_LED); } void capslock_led_on(void) { - writePinLow(XD75_CAPSLOCK_LED); + gpio_write_pin_low(XD75_CAPSLOCK_LED); } void gp100_led_init(void) { - setPinOutput(XD75_GP100_LED); + gpio_set_pin_output(XD75_GP100_LED); gp100_led_off(); } void gp100_led_off(void) { - writePinHigh(XD75_GP100_LED); + gpio_write_pin_high(XD75_GP100_LED); } void gp100_led_on(void) { - writePinLow(XD75_GP100_LED); + gpio_write_pin_low(XD75_GP100_LED); } void gp103_led_init(void) { - setPinOutput(XD75_GP103_LED); + gpio_set_pin_output(XD75_GP103_LED); gp103_led_off(); } void gp103_led_off(void) { - writePinLow(XD75_GP103_LED); + gpio_write_pin_low(XD75_GP103_LED); } void gp103_led_on(void) { - writePinHigh(XD75_GP103_LED); + gpio_write_pin_high(XD75_GP103_LED); } diff --git a/keyboards/ydkb/grape/matrix.c b/keyboards/ydkb/grape/matrix.c index 3e070f8d7d..49e55fe329 100644 --- a/keyboards/ydkb/grape/matrix.c +++ b/keyboards/ydkb/grape/matrix.c @@ -38,7 +38,7 @@ static void select_row(uint8_t row) { static void init_pins(void) { for (uint8_t x = 0; x < MATRIX_COLS; x++) { - setPinInputHigh(col_pins[x]); + gpio_set_pin_input_high(col_pins[x]); } } @@ -60,7 +60,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { // Select the col pin to read (active low) - uint8_t pin_state = readPin(col_pins[col_index]); + uint8_t pin_state = gpio_read_pin(col_pins[col_index]); // Populate the matrix row with the state of the col pin current_matrix[current_row] |= pin_state ? 0 : (row_shifter << col_index); diff --git a/keyboards/ydkb/yd68/yd68.c b/keyboards/ydkb/yd68/yd68.c index 0e6d5b82d5..1054a8673e 100644 --- a/keyboards/ydkb/yd68/yd68.c +++ b/keyboards/ydkb/yd68/yd68.c @@ -17,20 +17,20 @@ void keyboard_pre_init_kb(void) { //Backlight LEDs Output Low - setPinOutput(D6); - writePinLow(D6); + gpio_set_pin_output(D6); + gpio_write_pin_low(D6); //RGB power output low - setPinOutput(E2); - writePinLow(E2); + gpio_set_pin_output(E2); + gpio_write_pin_low(E2); //Bluetooth power output high - setPinOutput(B2); - writePinLow(B2); + gpio_set_pin_output(B2); + gpio_write_pin_low(B2); //RGB data output low - setPinOutput(B3); - writePinLow(B3); + gpio_set_pin_output(B3); + gpio_write_pin_low(B3); keyboard_pre_init_user(); } diff --git a/keyboards/yiancardesigns/barleycorn/barleycorn.c b/keyboards/yiancardesigns/barleycorn/barleycorn.c index 9bd5d84d2b..c73c1559c2 100644 --- a/keyboards/yiancardesigns/barleycorn/barleycorn.c +++ b/keyboards/yiancardesigns/barleycorn/barleycorn.c @@ -17,21 +17,21 @@ void keyboard_pre_init_kb(void) { // Set our LED pins as output - setPinOutput(B5); - setPinOutput(C0); + gpio_set_pin_output(B5); + gpio_set_pin_output(C0); keyboard_pre_init_user(); } 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(B5, led_state.caps_lock); - writePin(C0, led_state.num_lock); + gpio_write_pin(B5, led_state.caps_lock); + gpio_write_pin(C0, led_state.num_lock); } return res; } diff --git a/keyboards/yiancardesigns/barleycorn/matrix.c b/keyboards/yiancardesigns/barleycorn/matrix.c index 008f096266..02fdb6c7b4 100644 --- a/keyboards/yiancardesigns/barleycorn/matrix.c +++ b/keyboards/yiancardesigns/barleycorn/matrix.c @@ -23,17 +23,17 @@ static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; static void unselect_rows(void) { for(uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } } static void select_row(uint8_t row) { - setPinOutput(row_pins[row]); - writePinLow(row_pins[row]); + gpio_set_pin_output(row_pins[row]); + gpio_write_pin_low(row_pins[row]); } static void unselect_row(uint8_t row) { - setPinInputHigh(row_pins[row]); + gpio_set_pin_input_high(row_pins[row]); } static void init_pins(void) { @@ -46,7 +46,7 @@ static void init_pins(void) { for (uint8_t x = 0; x < MATRIX_COLS; x++) { if ( x < 8 ) { - setPinInputHigh(col_pins[x]); + gpio_set_pin_input_high(col_pins[x]); } } } @@ -111,7 +111,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) pin_state = port_expander_col_buffer[1] & (1 << 1); break; default : - pin_state = readPin(col_pins[col_index]); + pin_state = gpio_read_pin(col_pins[col_index]); } // Populate the matrix row with the state of the col pin diff --git a/keyboards/yiancardesigns/gingham/matrix.c b/keyboards/yiancardesigns/gingham/matrix.c index 4e6319b52b..48719e14bc 100644 --- a/keyboards/yiancardesigns/gingham/matrix.c +++ b/keyboards/yiancardesigns/gingham/matrix.c @@ -23,17 +23,17 @@ static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; static void unselect_rows(void) { for(uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } } static void select_row(uint8_t row) { - setPinOutput(row_pins[row]); - writePinLow(row_pins[row]); + gpio_set_pin_output(row_pins[row]); + gpio_write_pin_low(row_pins[row]); } static void unselect_row(uint8_t row) { - setPinInputHigh(row_pins[row]); + gpio_set_pin_input_high(row_pins[row]); } static void init_pins(void) { @@ -46,7 +46,7 @@ static void init_pins(void) { for (uint8_t x = 0; x < MATRIX_COLS; x++) { if ( (x > 0) && (x < 12) ) { - setPinInputHigh(col_pins[x]); + gpio_set_pin_input_high(col_pins[x]); } } } @@ -90,7 +90,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) pin_state = pin_state & (1 << 1); break; default : - pin_state = readPin(col_pins[col_index]); + pin_state = gpio_read_pin(col_pins[col_index]); } // Populate the matrix row with the state of the col pin diff --git a/keyboards/yiancardesigns/seigaiha/matrix.c b/keyboards/yiancardesigns/seigaiha/matrix.c index dc80c4becf..16041754eb 100644 --- a/keyboards/yiancardesigns/seigaiha/matrix.c +++ b/keyboards/yiancardesigns/seigaiha/matrix.c @@ -23,17 +23,17 @@ static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; static void unselect_rows(void) { for(uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh(row_pins[x]); + gpio_set_pin_input_high(row_pins[x]); } } static void select_row(uint8_t row) { - setPinOutput(row_pins[row]); - writePinLow(row_pins[row]); + gpio_set_pin_output(row_pins[row]); + gpio_write_pin_low(row_pins[row]); } static void unselect_row(uint8_t row) { - setPinInputHigh(row_pins[row]); + gpio_set_pin_input_high(row_pins[row]); } static void init_pins(void) { @@ -46,7 +46,7 @@ static void init_pins(void) { for (uint8_t x = 0; x < MATRIX_COLS; x++) { if ( x < 10 ) { - setPinInputHigh(col_pins[x]); + gpio_set_pin_input_high(col_pins[x]); } } } @@ -96,7 +96,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) pin_state = port_expander_col_buffer & (1 << 4); break; default : - pin_state = readPin(col_pins[col_index]); + pin_state = gpio_read_pin(col_pins[col_index]); } // Populate the matrix row with the state of the col pin diff --git a/keyboards/ymdk/yd60mq/yd60mq.c b/keyboards/ymdk/yd60mq/yd60mq.c index 1a14040907..40c899c46f 100644 --- a/keyboards/ymdk/yd60mq/yd60mq.c +++ b/keyboards/ymdk/yd60mq/yd60mq.c @@ -2,20 +2,20 @@ __attribute__((weak)) void matrix_init_kb(void){ - setPinOutput(F4); - writePinHigh(F4); + gpio_set_pin_output(F4); + gpio_write_pin_high(F4); } __attribute__((weak)) 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.caps_lock); + gpio_write_pin(F4, !led_state.caps_lock); } return res; } diff --git a/keyboards/zsa/moonlander/matrix.c b/keyboards/zsa/moonlander/matrix.c index aa97d0721f..2c9edd417c 100644 --- a/keyboards/zsa/moonlander/matrix.c +++ b/keyboards/zsa/moonlander/matrix.c @@ -71,21 +71,21 @@ void matrix_init_custom(void) { dprintf("matrix init\n"); // debug_matrix = true; // outputs - setPinOutput(B10); - setPinOutput(B11); - setPinOutput(B12); - setPinOutput(B13); - setPinOutput(B14); - setPinOutput(B15); + gpio_set_pin_output(B10); + gpio_set_pin_output(B11); + gpio_set_pin_output(B12); + gpio_set_pin_output(B13); + gpio_set_pin_output(B14); + gpio_set_pin_output(B15); // inputs - setPinInputLow(A0); - setPinInputLow(A1); - setPinInputLow(A2); - setPinInputLow(A3); - setPinInputLow(A6); - setPinInputLow(A7); - setPinInputLow(B0); + gpio_set_pin_input_low(A0); + gpio_set_pin_input_low(A1); + gpio_set_pin_input_low(A2); + gpio_set_pin_input_low(A3); + gpio_set_pin_input_low(A6); + gpio_set_pin_input_low(A7); + gpio_set_pin_input_low(B0); mcp23018_init(); } @@ -117,12 +117,12 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { for (uint8_t row = 0; row <= ROWS_PER_HAND; row++) { // strobe row switch (row) { - case 0: writePinHigh(B10); break; - case 1: writePinHigh(B11); break; - case 2: writePinHigh(B12); break; - case 3: writePinHigh(B13); break; - case 4: writePinHigh(B14); break; - case 5: writePinHigh(B15); break; + case 0: gpio_write_pin_high(B10); break; + case 1: gpio_write_pin_high(B11); break; + case 2: gpio_write_pin_high(B12); break; + case 3: gpio_write_pin_high(B13); break; + case 4: gpio_write_pin_high(B14); break; + case 5: gpio_write_pin_high(B15); break; case 6: break; // Left hand has 6 rows } @@ -170,22 +170,22 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { } // read col data data = ( - (readPin(A0) << 0 ) | - (readPin(A1) << 1 ) | - (readPin(A2) << 2 ) | - (readPin(A3) << 3 ) | - (readPin(A6) << 4 ) | - (readPin(A7) << 5 ) | - (readPin(B0) << 6 ) + (gpio_read_pin(A0) << 0 ) | + (gpio_read_pin(A1) << 1 ) | + (gpio_read_pin(A2) << 2 ) | + (gpio_read_pin(A3) << 3 ) | + (gpio_read_pin(A6) << 4 ) | + (gpio_read_pin(A7) << 5 ) | + (gpio_read_pin(B0) << 6 ) ); // unstrobe row switch (row) { - case 0: writePinLow(B10); break; - case 1: writePinLow(B11); break; - case 2: writePinLow(B12); break; - case 3: writePinLow(B13); break; - case 4: writePinLow(B14); break; - case 5: writePinLow(B15); break; + case 0: gpio_write_pin_low(B10); break; + case 1: gpio_write_pin_low(B11); break; + case 2: gpio_write_pin_low(B12); break; + case 3: gpio_write_pin_low(B13); break; + case 4: gpio_write_pin_low(B14); break; + case 5: gpio_write_pin_low(B15); break; case 6: break; } diff --git a/keyboards/zsa/moonlander/moonlander.c b/keyboards/zsa/moonlander/moonlander.c index dad795d315..02c64f4b96 100644 --- a/keyboards/zsa/moonlander/moonlander.c +++ b/keyboards/zsa/moonlander/moonlander.c @@ -95,13 +95,13 @@ static THD_FUNCTION(LEDThread, arg) { } void keyboard_pre_init_kb(void) { - setPinOutput(B5); - setPinOutput(B4); - setPinOutput(B3); + gpio_set_pin_output(B5); + gpio_set_pin_output(B4); + gpio_set_pin_output(B3); - writePinLow(B5); - writePinLow(B4); - writePinLow(B3); + gpio_write_pin_low(B5); + gpio_write_pin_low(B4); + gpio_write_pin_low(B3); chThdCreateStatic(waLEDThread, sizeof(waLEDThread), NORMALPRIO - 16, LEDThread, NULL); diff --git a/keyboards/zsa/moonlander/moonlander.h b/keyboards/zsa/moonlander/moonlander.h index 0e5282c511..3e1f39ad96 100644 --- a/keyboards/zsa/moonlander/moonlander.h +++ b/keyboards/zsa/moonlander/moonlander.h @@ -26,9 +26,9 @@ extern bool mcp23018_leds[]; #define MCP23018_DEFAULT_ADDRESS 0b0100000 -#define ML_LED_1(status) writePin(B5, (bool)status) -#define ML_LED_2(status) writePin(B4, (bool)status) -#define ML_LED_3(status) writePin(B3, (bool)status) +#define ML_LED_1(status) gpio_write_pin(B5, (bool)status) +#define ML_LED_2(status) gpio_write_pin(B4, (bool)status) +#define ML_LED_3(status) gpio_write_pin(B3, (bool)status) #define ML_LED_4(status) mcp23018_leds[0] = (bool)status #define ML_LED_5(status) mcp23018_leds[1] = (bool)status