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
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue