mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-09-11 08:58:04 +00:00
Update GPIO API usage in keyboard code (#23361)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
@@ -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();
|
||||
}
|
||||
|
Reference in New Issue
Block a user