Update GPIO API usage in keyboard code (#23361)
This commit is contained in:
parent
5426a7a129
commit
d09a06a1b3
390 changed files with 3912 additions and 3913 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue