diff options
| author | Ryan <fauxpark@gmail.com> | 2024-05-03 15:21:29 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-03 15:21:29 +1000 |
| commit | d09a06a1b354760fd0e64a453abade972900e885 (patch) | |
| tree | 88d94640f4507ac8d7f570607423825bec3c6f89 /keyboards/tzarc | |
| parent | 5426a7a129acf2ff5c8b435014747f1238e17965 (diff) | |
Update GPIO API usage in keyboard code (#23361)
Diffstat (limited to 'keyboards/tzarc')
| -rw-r--r-- | keyboards/tzarc/djinn/djinn.c | 44 | ||||
| -rw-r--r-- | keyboards/tzarc/djinn/djinn_portscan_matrix.c | 26 | ||||
| -rw-r--r-- | keyboards/tzarc/ghoul/ghoul.c | 12 |
3 files changed, 41 insertions, 41 deletions
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) { | |||
| 46 | memset(&kb_state, 0, sizeof(kb_state)); | 46 | memset(&kb_state, 0, sizeof(kb_state)); |
| 47 | 47 | ||
| 48 | // Turn off increased current limits | 48 | // Turn off increased current limits |
| 49 | setPinOutput(RGB_CURR_1500mA_OK_PIN); | 49 | gpio_set_pin_output(RGB_CURR_1500mA_OK_PIN); |
| 50 | writePinLow(RGB_CURR_1500mA_OK_PIN); | 50 | gpio_write_pin_low(RGB_CURR_1500mA_OK_PIN); |
| 51 | setPinOutput(RGB_CURR_3000mA_OK_PIN); | 51 | gpio_set_pin_output(RGB_CURR_3000mA_OK_PIN); |
| 52 | writePinLow(RGB_CURR_3000mA_OK_PIN); | 52 | gpio_write_pin_low(RGB_CURR_3000mA_OK_PIN); |
| 53 | 53 | ||
| 54 | // Turn on the RGB | 54 | // Turn on the RGB |
| 55 | setPinOutput(RGB_POWER_ENABLE_PIN); | 55 | gpio_set_pin_output(RGB_POWER_ENABLE_PIN); |
| 56 | writePinHigh(RGB_POWER_ENABLE_PIN); | 56 | gpio_write_pin_high(RGB_POWER_ENABLE_PIN); |
| 57 | 57 | ||
| 58 | #ifdef EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN | 58 | #ifdef EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN |
| 59 | setPinOutput(EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN); | 59 | gpio_set_pin_output(EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN); |
| 60 | writePinHigh(EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN); | 60 | gpio_write_pin_high(EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN); |
| 61 | #endif // EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN | 61 | #endif // EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN |
| 62 | 62 | ||
| 63 | // Turn on the LCD | 63 | // Turn on the LCD |
| 64 | setPinOutput(LCD_POWER_ENABLE_PIN); | 64 | gpio_set_pin_output(LCD_POWER_ENABLE_PIN); |
| 65 | writePinHigh(LCD_POWER_ENABLE_PIN); | 65 | gpio_write_pin_high(LCD_POWER_ENABLE_PIN); |
| 66 | 66 | ||
| 67 | // Let the LCD get some power... | 67 | // Let the LCD get some power... |
| 68 | wait_ms(150); | 68 | wait_ms(150); |
| @@ -148,16 +148,16 @@ void housekeeping_task_kb(void) { | |||
| 148 | switch (current_setting) { | 148 | switch (current_setting) { |
| 149 | default: | 149 | default: |
| 150 | case USBPD_500MA: | 150 | case USBPD_500MA: |
| 151 | writePinLow(RGB_CURR_1500mA_OK_PIN); | 151 | gpio_write_pin_low(RGB_CURR_1500mA_OK_PIN); |
| 152 | writePinLow(RGB_CURR_3000mA_OK_PIN); | 152 | gpio_write_pin_low(RGB_CURR_3000mA_OK_PIN); |
| 153 | break; | 153 | break; |
| 154 | case USBPD_1500MA: | 154 | case USBPD_1500MA: |
| 155 | writePinHigh(RGB_CURR_1500mA_OK_PIN); | 155 | gpio_write_pin_high(RGB_CURR_1500mA_OK_PIN); |
| 156 | writePinLow(RGB_CURR_3000mA_OK_PIN); | 156 | gpio_write_pin_low(RGB_CURR_3000mA_OK_PIN); |
| 157 | break; | 157 | break; |
| 158 | case USBPD_3000MA: | 158 | case USBPD_3000MA: |
| 159 | writePinHigh(RGB_CURR_1500mA_OK_PIN); | 159 | gpio_write_pin_high(RGB_CURR_1500mA_OK_PIN); |
| 160 | writePinHigh(RGB_CURR_3000mA_OK_PIN); | 160 | gpio_write_pin_high(RGB_CURR_3000mA_OK_PIN); |
| 161 | break; | 161 | break; |
| 162 | } | 162 | } |
| 163 | #else | 163 | #else |
| @@ -166,12 +166,12 @@ void housekeeping_task_kb(void) { | |||
| 166 | default: | 166 | default: |
| 167 | case USBPD_500MA: | 167 | case USBPD_500MA: |
| 168 | case USBPD_1500MA: | 168 | case USBPD_1500MA: |
| 169 | writePinLow(RGB_CURR_1500mA_OK_PIN); | 169 | gpio_write_pin_low(RGB_CURR_1500mA_OK_PIN); |
| 170 | writePinLow(RGB_CURR_3000mA_OK_PIN); | 170 | gpio_write_pin_low(RGB_CURR_3000mA_OK_PIN); |
| 171 | break; | 171 | break; |
| 172 | case USBPD_3000MA: | 172 | case USBPD_3000MA: |
| 173 | writePinHigh(RGB_CURR_1500mA_OK_PIN); | 173 | gpio_write_pin_high(RGB_CURR_1500mA_OK_PIN); |
| 174 | writePinLow(RGB_CURR_3000mA_OK_PIN); | 174 | gpio_write_pin_low(RGB_CURR_3000mA_OK_PIN); |
| 175 | break; | 175 | break; |
| 176 | } | 176 | } |
| 177 | #endif | 177 | #endif |
| @@ -189,7 +189,7 @@ void housekeeping_task_kb(void) { | |||
| 189 | // Enable/disable RGB | 189 | // Enable/disable RGB |
| 190 | if (peripherals_on) { | 190 | if (peripherals_on) { |
| 191 | // Turn on RGB | 191 | // Turn on RGB |
| 192 | writePinHigh(RGB_POWER_ENABLE_PIN); | 192 | gpio_write_pin_high(RGB_POWER_ENABLE_PIN); |
| 193 | // Modify the RGB state if different to the LCD state | 193 | // Modify the RGB state if different to the LCD state |
| 194 | if (rgb_matrix_is_enabled() != peripherals_on) { | 194 | if (rgb_matrix_is_enabled() != peripherals_on) { |
| 195 | // Wait for a small amount of time to allow the RGB capacitors to charge, before enabling RGB output | 195 | // 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) { | |||
| 199 | } | 199 | } |
| 200 | } else { | 200 | } else { |
| 201 | // Turn off RGB | 201 | // Turn off RGB |
| 202 | writePinLow(RGB_POWER_ENABLE_PIN); | 202 | gpio_write_pin_low(RGB_POWER_ENABLE_PIN); |
| 203 | // Disable the PWM output for the RGB | 203 | // Disable the PWM output for the RGB |
| 204 | if (rgb_matrix_is_enabled() != peripherals_on) { | 204 | if (rgb_matrix_is_enabled() != peripherals_on) { |
| 205 | rgb_matrix_disable_noeeprom(); | 205 | 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) { | |||
| 16 | rtcnt_t start = chSysGetRealtimeCounterX(); | 16 | rtcnt_t start = chSysGetRealtimeCounterX(); |
| 17 | rtcnt_t end = start + 5000; | 17 | rtcnt_t end = start + 5000; |
| 18 | while (chSysIsCounterWithinX(chSysGetRealtimeCounterX(), start, end)) { | 18 | while (chSysIsCounterWithinX(chSysGetRealtimeCounterX(), start, end)) { |
| 19 | if (readPin(pin) == target_state) { | 19 | if (gpio_read_pin(pin) == target_state) { |
| 20 | break; | 20 | break; |
| 21 | } | 21 | } |
| 22 | } | 22 | } |
| @@ -36,10 +36,10 @@ static void dummy_vt_callback(virtual_timer_t *vtp, void *p) {} | |||
| 36 | 36 | ||
| 37 | void matrix_init_custom(void) { | 37 | void matrix_init_custom(void) { |
| 38 | for (int i = 0; i < MATRIX_ROWS; ++i) { | 38 | for (int i = 0; i < MATRIX_ROWS; ++i) { |
| 39 | setPinInputHigh(row_pins[i]); | 39 | gpio_set_pin_input_high(row_pins[i]); |
| 40 | } | 40 | } |
| 41 | for (int i = 0; i < MATRIX_COLS; ++i) { | 41 | for (int i = 0; i < MATRIX_COLS; ++i) { |
| 42 | setPinInputHigh(col_pins[i]); | 42 | gpio_set_pin_input_high(col_pins[i]); |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | // Start a virtual timer so we'll still get periodic wakeups, now that USB SOF doesn't wake up the main loop | 45 | // 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[]) { | |||
| 56 | pin_t curr_col_pin = col_pins[current_col]; | 56 | pin_t curr_col_pin = col_pins[current_col]; |
| 57 | 57 | ||
| 58 | // Setup the output column pin | 58 | // Setup the output column pin |
| 59 | setPinOutput(curr_col_pin); | 59 | gpio_set_pin_output(curr_col_pin); |
| 60 | writePinLow(curr_col_pin); | 60 | gpio_write_pin_low(curr_col_pin); |
| 61 | matrix_wait_for_pin(curr_col_pin, 0); | 61 | matrix_wait_for_pin(curr_col_pin, 0); |
| 62 | 62 | ||
| 63 | // Read the row ports | 63 | // Read the row ports |
| @@ -65,7 +65,7 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { | |||
| 65 | uint32_t gpio_c = palReadPort(GPIOC); | 65 | uint32_t gpio_c = palReadPort(GPIOC); |
| 66 | 66 | ||
| 67 | // Unselect the row pin | 67 | // Unselect the row pin |
| 68 | setPinInputHigh(curr_col_pin); | 68 | gpio_set_pin_input_high(curr_col_pin); |
| 69 | 69 | ||
| 70 | // Construct the packed bitmask for the pins | 70 | // Construct the packed bitmask for the pins |
| 71 | uint32_t readback = ~(((gpio_b & GPIOB_BITMASK) >> GPIOB_OFFSET) | (((gpio_c & GPIOC_BITMASK) >> GPIOC_OFFSET) << GPIOB_COUNT)); | 71 | 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[]) { | |||
| 98 | void matrix_wait_for_interrupt(void) { | 98 | void matrix_wait_for_interrupt(void) { |
| 99 | // Set up row/col pins and attach callback | 99 | // Set up row/col pins and attach callback |
| 100 | for (int i = 0; i < ARRAY_SIZE(col_pins); ++i) { | 100 | for (int i = 0; i < ARRAY_SIZE(col_pins); ++i) { |
| 101 | setPinOutput(col_pins[i]); | 101 | gpio_set_pin_output(col_pins[i]); |
| 102 | writePinLow(col_pins[i]); | 102 | gpio_write_pin_low(col_pins[i]); |
| 103 | } | 103 | } |
| 104 | for (int i = 0; i < ARRAY_SIZE(row_pins); ++i) { | 104 | for (int i = 0; i < ARRAY_SIZE(row_pins); ++i) { |
| 105 | setPinInputHigh(row_pins[i]); | 105 | gpio_set_pin_input_high(row_pins[i]); |
| 106 | palEnableLineEvent(row_pins[i], PAL_EVENT_MODE_BOTH_EDGES); | 106 | palEnableLineEvent(row_pins[i], PAL_EVENT_MODE_BOTH_EDGES); |
| 107 | } | 107 | } |
| 108 | 108 | ||
| @@ -112,11 +112,11 @@ void matrix_wait_for_interrupt(void) { | |||
| 112 | // Now that the interrupt has woken us up, reset all the row/col pins back to defaults | 112 | // Now that the interrupt has woken us up, reset all the row/col pins back to defaults |
| 113 | for (int i = 0; i < ARRAY_SIZE(row_pins); ++i) { | 113 | for (int i = 0; i < ARRAY_SIZE(row_pins); ++i) { |
| 114 | palDisableLineEvent(row_pins[i]); | 114 | palDisableLineEvent(row_pins[i]); |
| 115 | writePinHigh(row_pins[i]); | 115 | gpio_write_pin_high(row_pins[i]); |
| 116 | setPinInputHigh(row_pins[i]); | 116 | gpio_set_pin_input_high(row_pins[i]); |
| 117 | } | 117 | } |
| 118 | for (int i = 0; i < ARRAY_SIZE(col_pins); ++i) { | 118 | for (int i = 0; i < ARRAY_SIZE(col_pins); ++i) { |
| 119 | writePinHigh(col_pins[i]); | 119 | gpio_write_pin_high(col_pins[i]); |
| 120 | setPinInputHigh(col_pins[i]); | 120 | gpio_set_pin_input_high(col_pins[i]); |
| 121 | } | 121 | } |
| 122 | } | 122 | } |
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 @@ | |||
| 6 | 6 | ||
| 7 | void keyboard_post_init_kb(void) { | 7 | void keyboard_post_init_kb(void) { |
| 8 | // Enable RGB current limiter and wait for a bit before allowing RGB to continue | 8 | // Enable RGB current limiter and wait for a bit before allowing RGB to continue |
| 9 | setPinOutput(RGB_ENABLE_PIN); | 9 | gpio_set_pin_output(RGB_ENABLE_PIN); |
| 10 | writePinHigh(RGB_ENABLE_PIN); | 10 | gpio_write_pin_high(RGB_ENABLE_PIN); |
| 11 | wait_ms(20); | 11 | wait_ms(20); |
| 12 | 12 | ||
| 13 | // Offload to the user func | 13 | // Offload to the user func |
| @@ -16,12 +16,12 @@ void keyboard_post_init_kb(void) { | |||
| 16 | 16 | ||
| 17 | void matrix_init_custom(void) { | 17 | void matrix_init_custom(void) { |
| 18 | // SPI Matrix | 18 | // SPI Matrix |
| 19 | setPinOutput(SPI_MATRIX_CHIP_SELECT_PIN); | 19 | gpio_set_pin_output(SPI_MATRIX_CHIP_SELECT_PIN); |
| 20 | writePinHigh(SPI_MATRIX_CHIP_SELECT_PIN); | 20 | gpio_write_pin_high(SPI_MATRIX_CHIP_SELECT_PIN); |
| 21 | spi_init(); | 21 | spi_init(); |
| 22 | 22 | ||
| 23 | // Encoder pushbutton | 23 | // Encoder pushbutton |
| 24 | setPinInputLow(ENCODER_PUSHBUTTON_PIN); | 24 | gpio_set_pin_input_low(ENCODER_PUSHBUTTON_PIN); |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | bool matrix_scan_custom(matrix_row_t current_matrix[]) { | 27 | bool matrix_scan_custom(matrix_row_t current_matrix[]) { |
| @@ -33,7 +33,7 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { | |||
| 33 | spi_stop(); | 33 | spi_stop(); |
| 34 | 34 | ||
| 35 | // Read from the encoder pushbutton | 35 | // Read from the encoder pushbutton |
| 36 | temp_matrix[5] = readPin(ENCODER_PUSHBUTTON_PIN) ? 1 : 0; | 36 | temp_matrix[5] = gpio_read_pin(ENCODER_PUSHBUTTON_PIN) ? 1 : 0; |
| 37 | 37 | ||
| 38 | // Check if we've changed, return the last-read data | 38 | // Check if we've changed, return the last-read data |
| 39 | bool changed = memcmp(current_matrix, temp_matrix, sizeof(temp_matrix)) != 0; | 39 | bool changed = memcmp(current_matrix, temp_matrix, sizeof(temp_matrix)) != 0; |
