Update atomic GPIO macros in keyboard custom matrix (#23796)
This commit is contained in:
parent
5c43a9bed1
commit
1552cf2ddc
20 changed files with 270 additions and 270 deletions
|
|
@ -20,53 +20,53 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
|
||||
static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
|
||||
|
||||
static inline void setPinOutput_writeLow(pin_t pin) {
|
||||
static inline void gpio_atomic_set_pin_output_low(pin_t pin) {
|
||||
ATOMIC_BLOCK_FORCEON {
|
||||
gpio_set_pin_output(pin);
|
||||
gpio_write_pin_low(pin);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void setPinInputHigh_atomic(pin_t pin) {
|
||||
static inline void gpio_atomic_set_pin_input_high(pin_t pin) {
|
||||
ATOMIC_BLOCK_FORCEON { gpio_set_pin_input_high(pin); }
|
||||
}
|
||||
|
||||
static void select_row(uint8_t row) {
|
||||
setPinOutput_writeLow(row_pins[row]);
|
||||
gpio_atomic_set_pin_output_low(row_pins[row]);
|
||||
}
|
||||
|
||||
static void unselect_row(uint8_t row) {
|
||||
setPinInputHigh_atomic(row_pins[row]);
|
||||
gpio_atomic_set_pin_input_high(row_pins[row]);
|
||||
}
|
||||
|
||||
static void unselect_rows(void) {
|
||||
for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
|
||||
setPinInputHigh_atomic(row_pins[x]);
|
||||
gpio_atomic_set_pin_input_high(row_pins[x]);
|
||||
}
|
||||
}
|
||||
|
||||
static void select_col(uint8_t col) {
|
||||
setPinOutput_writeLow(col_pins[col]);
|
||||
gpio_atomic_set_pin_output_low(col_pins[col]);
|
||||
}
|
||||
|
||||
static void unselect_col(uint8_t col) {
|
||||
setPinInputHigh_atomic(col_pins[col]);
|
||||
gpio_atomic_set_pin_input_high(col_pins[col]);
|
||||
}
|
||||
|
||||
static void unselect_cols(void) {
|
||||
for (uint8_t x = 0; x < MATRIX_COLS; x++) {
|
||||
setPinInputHigh_atomic(col_pins[x]);
|
||||
gpio_atomic_set_pin_input_high(col_pins[x]);
|
||||
}
|
||||
}
|
||||
|
||||
static void init_pins(void) {
|
||||
unselect_rows();
|
||||
for (uint8_t x = 0; x < MATRIX_COLS; x++) {
|
||||
setPinInputHigh_atomic(col_pins[x]);
|
||||
gpio_atomic_set_pin_input_high(col_pins[x]);
|
||||
}
|
||||
unselect_cols();
|
||||
for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
|
||||
setPinInputHigh_atomic(row_pins[x]);
|
||||
gpio_atomic_set_pin_input_high(row_pins[x]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue