diff options
Diffstat (limited to 'keyboards/nullbitsco/snap/matrix.c')
-rw-r--r-- | keyboards/nullbitsco/snap/matrix.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/keyboards/nullbitsco/snap/matrix.c b/keyboards/nullbitsco/snap/matrix.c index ceb9cd8984..64b451641d 100644 --- a/keyboards/nullbitsco/snap/matrix.c +++ b/keyboards/nullbitsco/snap/matrix.c @@ -13,13 +13,10 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include <stdint.h> -#include <stdbool.h> -#include <string.h> -#include "util.h" #include "matrix.h" +#include <string.h> #include "split_util.h" -#include "quantum.h" +#include "wait.h" #define VIRT_COLS_PER_HAND 1 #define PHYS_COLS_PER_HAND (MATRIX_COLS - VIRT_COLS_PER_HAND) @@ -40,23 +37,23 @@ static uint8_t* col_pins = col_pins_left; static void init_pins(void) { // Set cols to outputs, low for (uint8_t pin = 0; pin < MATRIX_MUX_COLS; pin++) { - setPinOutput(col_pins[pin]); + gpio_set_pin_output(col_pins[pin]); } // Unselect cols for (uint8_t bit = 0; bit < MATRIX_MUX_COLS; bit++) { - writePinLow(col_pins[bit]); + gpio_write_pin_low(col_pins[bit]); } // Set rows to input, pullup for (uint8_t pin = 0; pin < ROWS_PER_HAND; pin++) { - setPinInputHigh(row_pins[pin]); + gpio_set_pin_input_high(row_pins[pin]); } // Set extended pin (only on right side) if (!isLeftHand) { // Set extended pin to input, pullup - setPinInputHigh(MATRIX_EXT_PIN_RIGHT); + gpio_set_pin_input_high(MATRIX_EXT_PIN_RIGHT); } } @@ -64,7 +61,7 @@ static void select_col(uint8_t col) { // Drive demux with correct column address for (uint8_t bit = 0; bit < MATRIX_MUX_COLS; bit++) { uint8_t state = (col & (0b1 << bit)) >> bit; - writePin(col_pins[bit], !state); + gpio_write_pin(col_pins[bit], !state); } } @@ -74,7 +71,7 @@ static void read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) // Read each row sequentially for (uint8_t row_index = 0; row_index < ROWS_PER_HAND; row_index++) { - if (readPin(row_pins[row_index]) == 0) { + if (gpio_read_pin(row_pins[row_index]) == 0) { current_matrix[row_index] |= (COL_SHIFTER << current_col); } else { current_matrix[row_index] &= ~(COL_SHIFTER << current_col); @@ -85,7 +82,7 @@ static void read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) static void read_ext_pin(matrix_row_t current_matrix[]) { // Read the state of the extended matrix pin if (!isLeftHand) { - if (readPin(MATRIX_EXT_PIN_RIGHT) == 0) { + if (gpio_read_pin(MATRIX_EXT_PIN_RIGHT) == 0) { current_matrix[EXT_PIN_ROW] |= (COL_SHIFTER << EXT_PIN_COL); } else { current_matrix[EXT_PIN_ROW] &= ~(COL_SHIFTER << EXT_PIN_COL); |