diff options
Diffstat (limited to 'keyboards/hazel/bad_wings/matrix.c')
-rw-r--r-- | keyboards/hazel/bad_wings/matrix.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/keyboards/hazel/bad_wings/matrix.c b/keyboards/hazel/bad_wings/matrix.c index 496bebd58f..4a05e132f7 100644 --- a/keyboards/hazel/bad_wings/matrix.c +++ b/keyboards/hazel/bad_wings/matrix.c @@ -2,12 +2,11 @@ // Copyright 2023 @jasonhazel (Jason Hazel) // SPDX-License-Identifier: GPL-3.0-or-later -#include "quantum.h" -#include "spi_master.h" -#include <string.h> /* memset */ -#include <unistd.h> /* close */ -#include "quantum.h" #include "matrix.h" +#include <string.h> +#include "spi_master.h" +#include "debug.h" +#include "wait.h" #if (!defined(SHIFTREG_MATRIX_COL_CS)) # error Missing shift register I/O pin definitions @@ -49,11 +48,11 @@ bool sr_74hc595_spi_start(void) { bool sr_74hc595_spi_send_byte(uint8_t data) { sr_74hc595_spi_start(); - writePinLow(SHIFTREG_MATRIX_COL_CS); + gpio_write_pin_low(SHIFTREG_MATRIX_COL_CS); matrix_io_delay(); spi_write(data); matrix_io_delay(); - writePinHigh(SHIFTREG_MATRIX_COL_CS); + gpio_write_pin_high(SHIFTREG_MATRIX_COL_CS); sr_74hc595_spi_stop(); return true; } @@ -83,12 +82,12 @@ void matrix_init_custom(void) { // Set up the initial states for all the row pins for (int r = 0; r < SHIFTREG_ROWS; r++) { // Note: This needs to use the internal pull down resistors, and atmegas do *not* support that - setPinInputLow(rowPinsSR[r]); + gpio_set_pin_input_low(rowPinsSR[r]); } // Set the CS to low by default, and specify as an output pin - writePinHigh(SHIFTREG_MATRIX_COL_CS); // should be high when using SPI? - setPinOutput(SHIFTREG_MATRIX_COL_CS); + gpio_write_pin_high(SHIFTREG_MATRIX_COL_CS); // should be high when using SPI? + gpio_set_pin_output(SHIFTREG_MATRIX_COL_CS); // Since it's the init, deactivate all the columns. We'll activate once we get to the matrix scan clearColumns(); @@ -117,7 +116,7 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { matrix_io_delay(); for (int r = 0; r < SHIFTREG_ROWS; r++) { - current_matrix[r] |= ((readPin(rowPinsSR[r]) ? 1 : 0) << c); + current_matrix[r] |= ((gpio_read_pin(rowPinsSR[r]) ? 1 : 0) << c); } } |