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
|
@ -37,7 +37,7 @@ static void init_pins(void) {
|
|||
for (int col = 0; col < MATRIX_COLS; col++) {
|
||||
pin_t pin = direct_pins[row][col];
|
||||
if (pin != NO_PIN) {
|
||||
setPinInputHigh(pin);
|
||||
gpio_set_pin_input_high(pin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
|
|||
for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) {
|
||||
pin_t pin = direct_pins[current_row][col_index];
|
||||
if (pin != NO_PIN) {
|
||||
current_matrix[current_row] |= readPin(pin) ? 0 : (MATRIX_ROW_SHIFTER << col_index);
|
||||
current_matrix[current_row] |= gpio_read_pin(pin) ? 0 : (MATRIX_ROW_SHIFTER << col_index);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,94 +97,94 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
|
|||
static void select_col(uint8_t col) {
|
||||
switch (col) {
|
||||
case 0:
|
||||
writePinLow(F4);
|
||||
writePinLow(F1);
|
||||
writePinHigh(F0);
|
||||
writePinHigh(F5);
|
||||
gpio_write_pin_low(F4);
|
||||
gpio_write_pin_low(F1);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_high(F5);
|
||||
break;
|
||||
case 1:
|
||||
writePinLow(F4);
|
||||
writePinHigh(F1);
|
||||
writePinLow(F0);
|
||||
writePinHigh(F5);
|
||||
gpio_write_pin_low(F4);
|
||||
gpio_write_pin_high(F1);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_high(F5);
|
||||
break;
|
||||
case 2:
|
||||
writePinLow(F4);
|
||||
writePinHigh(F1);
|
||||
writePinHigh(F0);
|
||||
writePinHigh(F5);
|
||||
gpio_write_pin_low(F4);
|
||||
gpio_write_pin_high(F1);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_high(F5);
|
||||
break;
|
||||
case 3:
|
||||
writePinHigh(F4);
|
||||
writePinLow(F1);
|
||||
writePinLow(F0);
|
||||
writePinHigh(F5);
|
||||
gpio_write_pin_high(F4);
|
||||
gpio_write_pin_low(F1);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_high(F5);
|
||||
break;
|
||||
case 4:
|
||||
writePinHigh(F4);
|
||||
writePinLow(F1);
|
||||
writePinHigh(F0);
|
||||
writePinHigh(F5);
|
||||
gpio_write_pin_high(F4);
|
||||
gpio_write_pin_low(F1);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_high(F5);
|
||||
break;
|
||||
case 5:
|
||||
writePinHigh(F4);
|
||||
writePinHigh(F1);
|
||||
writePinHigh(F0);
|
||||
writePinHigh(F5);
|
||||
gpio_write_pin_high(F4);
|
||||
gpio_write_pin_high(F1);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_high(F5);
|
||||
break;
|
||||
case 6:
|
||||
writePinHigh(F4);
|
||||
writePinHigh(F1);
|
||||
writePinHigh(F0);
|
||||
writePinHigh(F6);
|
||||
gpio_write_pin_high(F4);
|
||||
gpio_write_pin_high(F1);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_high(F6);
|
||||
break;
|
||||
case 7:
|
||||
writePinLow(F4);
|
||||
writePinLow(F1);
|
||||
writePinLow(F0);
|
||||
writePinHigh(F6);
|
||||
gpio_write_pin_low(F4);
|
||||
gpio_write_pin_low(F1);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_high(F6);
|
||||
break;
|
||||
case 8:
|
||||
writePinLow(F4);
|
||||
writePinLow(F1);
|
||||
writePinHigh(F0);
|
||||
writePinHigh(F6);
|
||||
gpio_write_pin_low(F4);
|
||||
gpio_write_pin_low(F1);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_high(F6);
|
||||
break;
|
||||
case 9:
|
||||
writePinLow(F4);
|
||||
writePinHigh(F1);
|
||||
writePinLow(F0);
|
||||
writePinHigh(F6);
|
||||
gpio_write_pin_low(F4);
|
||||
gpio_write_pin_high(F1);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_high(F6);
|
||||
break;
|
||||
case 10:
|
||||
writePinLow(F4);
|
||||
writePinHigh(F1);
|
||||
writePinHigh(F0);
|
||||
writePinHigh(F6);
|
||||
gpio_write_pin_low(F4);
|
||||
gpio_write_pin_high(F1);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_high(F6);
|
||||
break;
|
||||
case 11:
|
||||
writePinHigh(F4);
|
||||
writePinLow(F1);
|
||||
writePinLow(F0);
|
||||
writePinHigh(F6);
|
||||
gpio_write_pin_high(F4);
|
||||
gpio_write_pin_low(F1);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_high(F6);
|
||||
break;
|
||||
case 12:
|
||||
writePinHigh(F4);
|
||||
writePinLow(F1);
|
||||
writePinHigh(F0);
|
||||
writePinHigh(F6);
|
||||
gpio_write_pin_high(F4);
|
||||
gpio_write_pin_low(F1);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_high(F6);
|
||||
break;
|
||||
case 13:
|
||||
writePinHigh(F4);
|
||||
writePinHigh(F1);
|
||||
writePinLow(F0);
|
||||
writePinHigh(F6);
|
||||
gpio_write_pin_high(F4);
|
||||
gpio_write_pin_high(F1);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_high(F6);
|
||||
break;
|
||||
case 14:
|
||||
writePinLow(F4);
|
||||
writePinLow(F1);
|
||||
writePinLow(F0);
|
||||
writePinHigh(F5);
|
||||
gpio_write_pin_low(F4);
|
||||
gpio_write_pin_low(F1);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_high(F5);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -192,94 +192,94 @@ static void select_col(uint8_t col) {
|
|||
static void unselect_col(uint8_t col) {
|
||||
switch (col) {
|
||||
case 0:
|
||||
writePinHigh(F4);
|
||||
writePinHigh(F1);
|
||||
writePinLow(F0);
|
||||
writePinLow(F5);
|
||||
gpio_write_pin_high(F4);
|
||||
gpio_write_pin_high(F1);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_low(F5);
|
||||
break;
|
||||
case 1:
|
||||
writePinHigh(F4);
|
||||
writePinLow(F1);
|
||||
writePinHigh(F0);
|
||||
writePinLow(F5);
|
||||
gpio_write_pin_high(F4);
|
||||
gpio_write_pin_low(F1);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_low(F5);
|
||||
break;
|
||||
case 2:
|
||||
writePinHigh(F4);
|
||||
writePinLow(F1);
|
||||
writePinLow(F0);
|
||||
writePinLow(F5);
|
||||
gpio_write_pin_high(F4);
|
||||
gpio_write_pin_low(F1);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_low(F5);
|
||||
break;
|
||||
case 3:
|
||||
writePinLow(F4);
|
||||
writePinHigh(F1);
|
||||
writePinHigh(F0);
|
||||
writePinLow(F5);
|
||||
gpio_write_pin_low(F4);
|
||||
gpio_write_pin_high(F1);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_low(F5);
|
||||
break;
|
||||
case 4:
|
||||
writePinLow(F4);
|
||||
writePinHigh(F1);
|
||||
writePinLow(F0);
|
||||
writePinLow(F5);
|
||||
gpio_write_pin_low(F4);
|
||||
gpio_write_pin_high(F1);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_low(F5);
|
||||
break;
|
||||
case 5:
|
||||
writePinLow(F4);
|
||||
writePinLow(F1);
|
||||
writePinLow(F0);
|
||||
writePinLow(F5);
|
||||
gpio_write_pin_low(F4);
|
||||
gpio_write_pin_low(F1);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_low(F5);
|
||||
break;
|
||||
case 6:
|
||||
writePinLow(F4);
|
||||
writePinLow(F1);
|
||||
writePinLow(F0);
|
||||
writePinLow(F6);
|
||||
gpio_write_pin_low(F4);
|
||||
gpio_write_pin_low(F1);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_low(F6);
|
||||
break;
|
||||
case 7:
|
||||
writePinHigh(F4);
|
||||
writePinHigh(F1);
|
||||
writePinHigh(F0);
|
||||
writePinLow(F6);
|
||||
gpio_write_pin_high(F4);
|
||||
gpio_write_pin_high(F1);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_low(F6);
|
||||
break;
|
||||
case 8:
|
||||
writePinHigh(F4);
|
||||
writePinHigh(F1);
|
||||
writePinLow(F0);
|
||||
writePinLow(F6);
|
||||
gpio_write_pin_high(F4);
|
||||
gpio_write_pin_high(F1);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_low(F6);
|
||||
break;
|
||||
case 9:
|
||||
writePinHigh(F4);
|
||||
writePinLow(F1);
|
||||
writePinHigh(F0);
|
||||
writePinLow(F6);
|
||||
gpio_write_pin_high(F4);
|
||||
gpio_write_pin_low(F1);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_low(F6);
|
||||
break;
|
||||
case 10:
|
||||
writePinHigh(F4);
|
||||
writePinLow(F1);
|
||||
writePinLow(F0);
|
||||
writePinLow(F6);
|
||||
gpio_write_pin_high(F4);
|
||||
gpio_write_pin_low(F1);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_low(F6);
|
||||
break;
|
||||
case 11:
|
||||
writePinLow(F4);
|
||||
writePinHigh(F1);
|
||||
writePinHigh(F0);
|
||||
writePinLow(F6);
|
||||
gpio_write_pin_low(F4);
|
||||
gpio_write_pin_high(F1);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_low(F6);
|
||||
break;
|
||||
case 12:
|
||||
writePinLow(F4);
|
||||
writePinHigh(F1);
|
||||
writePinLow(F0);
|
||||
writePinLow(F6);
|
||||
gpio_write_pin_low(F4);
|
||||
gpio_write_pin_high(F1);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_low(F6);
|
||||
break;
|
||||
case 13:
|
||||
writePinLow(F4);
|
||||
writePinLow(F1);
|
||||
writePinHigh(F0);
|
||||
writePinLow(F6);
|
||||
gpio_write_pin_low(F4);
|
||||
gpio_write_pin_low(F1);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_low(F6);
|
||||
break;
|
||||
case 14:
|
||||
writePinHigh(F4);
|
||||
writePinHigh(F1);
|
||||
writePinHigh(F0);
|
||||
writePinLow(F5);
|
||||
gpio_write_pin_high(F4);
|
||||
gpio_write_pin_high(F1);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_low(F5);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -287,23 +287,23 @@ static void unselect_col(uint8_t col) {
|
|||
static void unselect_cols(void) {
|
||||
|
||||
//Demultiplexer
|
||||
writePinHigh(F0);
|
||||
writePinHigh(F1);
|
||||
writePinHigh(F4);
|
||||
writePinLow(F5);
|
||||
writePinLow(F6);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_high(F1);
|
||||
gpio_write_pin_high(F4);
|
||||
gpio_write_pin_low(F5);
|
||||
gpio_write_pin_low(F6);
|
||||
}
|
||||
|
||||
static void init_pins(void) {
|
||||
unselect_cols();
|
||||
for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
|
||||
setPinInputHigh(row_pins[x]);
|
||||
gpio_set_pin_input_high(row_pins[x]);
|
||||
}
|
||||
setPinOutput(F0);
|
||||
setPinOutput(F1);
|
||||
setPinOutput(F4);
|
||||
setPinOutput(F5);
|
||||
setPinOutput(F6);
|
||||
gpio_set_pin_output(F0);
|
||||
gpio_set_pin_output(F1);
|
||||
gpio_set_pin_output(F4);
|
||||
gpio_set_pin_output(F5);
|
||||
gpio_set_pin_output(F6);
|
||||
}
|
||||
|
||||
static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) {
|
||||
|
@ -319,7 +319,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
|
|||
matrix_row_t last_row_value = current_matrix[row_index];
|
||||
|
||||
// Check row pin state
|
||||
if (readPin(row_pins[row_index]) == 0) {
|
||||
if (gpio_read_pin(row_pins[row_index]) == 0) {
|
||||
// Pin LO, set col bit
|
||||
current_matrix[row_index] |= (MATRIX_ROW_SHIFTER << current_col);
|
||||
} else {
|
||||
|
|
|
@ -16,17 +16,17 @@
|
|||
#include "quantum.h"
|
||||
|
||||
void led_init_ports(void) {
|
||||
setPinOutput(B2);
|
||||
setPinOutput(D0);
|
||||
setPinOutput(D1);
|
||||
setPinOutput(D2);
|
||||
gpio_set_pin_output(B2);
|
||||
gpio_set_pin_output(D0);
|
||||
gpio_set_pin_output(D1);
|
||||
gpio_set_pin_output(D2);
|
||||
|
||||
}
|
||||
|
||||
bool led_update_kb(led_t led_state) {
|
||||
bool res = led_update_user(led_state);
|
||||
if(res) {
|
||||
writePin(B2, led_state.caps_lock);
|
||||
gpio_write_pin(B2, led_state.caps_lock);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
@ -35,22 +35,22 @@ layer_state_t layer_state_set_user(layer_state_t state)
|
|||
{
|
||||
// if on layer 1, turn on D2 LED, otherwise off.
|
||||
if (get_highest_layer(state) == 1) {
|
||||
writePinHigh(D2);
|
||||
gpio_write_pin_high(D2);
|
||||
} else {
|
||||
writePinLow(D2);
|
||||
gpio_write_pin_low(D2);
|
||||
}
|
||||
// if on layer 2, turn on D1 LED, otherwise off.
|
||||
if (get_highest_layer(state) == 2) {
|
||||
writePinHigh(D1);
|
||||
gpio_write_pin_high(D1);
|
||||
} else {
|
||||
writePinLow(D1);
|
||||
gpio_write_pin_low(D1);
|
||||
}
|
||||
|
||||
// if on layer 3, turn on D0 LED, otherwise off.
|
||||
if (get_highest_layer(state) == 3) {
|
||||
writePinHigh(D0);
|
||||
gpio_write_pin_high(D0);
|
||||
} else {
|
||||
writePinLow(D0);
|
||||
gpio_write_pin_low(D0);
|
||||
}
|
||||
|
||||
return state;
|
||||
|
|
|
@ -37,7 +37,7 @@ static void init_pins(void) {
|
|||
for (int col = 0; col < MATRIX_COLS; col++) {
|
||||
pin_t pin = direct_pins[row][col];
|
||||
if (pin != NO_PIN) {
|
||||
setPinInputHigh(pin);
|
||||
gpio_set_pin_input_high(pin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
|
|||
for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) {
|
||||
pin_t pin = direct_pins[current_row][col_index];
|
||||
if (pin != NO_PIN) {
|
||||
current_matrix[current_row] |= readPin(pin) ? 0 : (MATRIX_ROW_SHIFTER << col_index);
|
||||
current_matrix[current_row] |= gpio_read_pin(pin) ? 0 : (MATRIX_ROW_SHIFTER << col_index);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,103 +101,103 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
|
|||
static void select_col(uint8_t col) {
|
||||
switch (col) {
|
||||
case 0:
|
||||
writePinLow(B5);
|
||||
writePinLow(B7);
|
||||
writePinLow(F0);
|
||||
writePinHigh(B0);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_high(B0);
|
||||
break;
|
||||
case 1:
|
||||
writePinLow(B5);
|
||||
writePinLow(B7);
|
||||
writePinHigh(F0);
|
||||
writePinHigh(B0);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_high(B0);
|
||||
break;
|
||||
case 2:
|
||||
writePinLow(B5);
|
||||
writePinHigh(B7);
|
||||
writePinLow(F0);
|
||||
writePinHigh(B0);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_high(B0);
|
||||
break;
|
||||
case 3:
|
||||
writePinLow(B5);
|
||||
writePinHigh(B7);
|
||||
writePinHigh(F0);
|
||||
writePinHigh(B0);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_high(B0);
|
||||
break;
|
||||
case 4:
|
||||
writePinHigh(B5);
|
||||
writePinLow(B7);
|
||||
writePinLow(F0);
|
||||
writePinHigh(B0);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_high(B0);
|
||||
break;
|
||||
case 5:
|
||||
writePinHigh(B5);
|
||||
writePinLow(B7);
|
||||
writePinHigh(F0);
|
||||
writePinHigh(B0);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_high(B0);
|
||||
break;
|
||||
case 6:
|
||||
writePinHigh(B5);
|
||||
writePinHigh(B7);
|
||||
writePinLow(F0);
|
||||
writePinHigh(B0);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_high(B0);
|
||||
break;
|
||||
case 7:
|
||||
writePinHigh(B5);
|
||||
writePinHigh(B7);
|
||||
writePinHigh(F0);
|
||||
writePinHigh(B0);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_high(B0);
|
||||
break;
|
||||
case 8:
|
||||
writePinLow(B5);
|
||||
writePinLow(B7);
|
||||
writePinLow(F0);
|
||||
writePinHigh(F1);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_high(F1);
|
||||
break;
|
||||
case 9:
|
||||
writePinLow(B5);
|
||||
writePinLow(B7);
|
||||
writePinHigh(F0);
|
||||
writePinHigh(F1);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_high(F1);
|
||||
break;
|
||||
case 10:
|
||||
writePinLow(B5);
|
||||
writePinHigh(B7);
|
||||
writePinLow(F0);
|
||||
writePinHigh(F1);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_high(F1);
|
||||
break;
|
||||
case 11:
|
||||
writePinLow(B5);
|
||||
writePinHigh(B7);
|
||||
writePinHigh(F0);
|
||||
writePinHigh(F1);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_high(F1);
|
||||
break;
|
||||
case 12:
|
||||
writePinHigh(B5);
|
||||
writePinLow(B7);
|
||||
writePinLow(F0);
|
||||
writePinHigh(F1);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_high(F1);
|
||||
break;
|
||||
case 13:
|
||||
writePinHigh(B5);
|
||||
writePinLow(B7);
|
||||
writePinHigh(F0);
|
||||
writePinHigh(F1);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_high(F1);
|
||||
break;
|
||||
case 14:
|
||||
writePinHigh(B5);
|
||||
writePinHigh(B7);
|
||||
writePinHigh(F0);
|
||||
writePinHigh(F1);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_high(F1);
|
||||
break;
|
||||
case 15:
|
||||
writePinHigh(B5);
|
||||
writePinHigh(B7);
|
||||
writePinLow(F0);
|
||||
writePinHigh(F1);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_high(F1);
|
||||
break;
|
||||
case 16:
|
||||
writePinLow(E6);
|
||||
gpio_write_pin_low(E6);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -205,130 +205,130 @@ static void select_col(uint8_t col) {
|
|||
static void unselect_col(uint8_t col) {
|
||||
switch (col) {
|
||||
case 0:
|
||||
writePinHigh(B5);
|
||||
writePinHigh(B7);
|
||||
writePinHigh(F0);
|
||||
writePinLow(B0);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_low(B0);
|
||||
break;
|
||||
case 1:
|
||||
writePinHigh(B5);
|
||||
writePinHigh(B7);
|
||||
writePinLow(F0);
|
||||
writePinLow(B0);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_low(B0);
|
||||
break;
|
||||
case 2:
|
||||
writePinHigh(B5);
|
||||
writePinLow(B7);
|
||||
writePinHigh(F0);
|
||||
writePinLow(B0);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_low(B0);
|
||||
break;
|
||||
case 3:
|
||||
writePinHigh(B5);
|
||||
writePinLow(B7);
|
||||
writePinLow(F0);
|
||||
writePinLow(B0);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_low(B0);
|
||||
break;
|
||||
case 4:
|
||||
writePinLow(B5);
|
||||
writePinHigh(B7);
|
||||
writePinHigh(F0);
|
||||
writePinLow(B0);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_low(B0);
|
||||
break;
|
||||
case 5:
|
||||
writePinLow(B5);
|
||||
writePinHigh(B7);
|
||||
writePinLow(F0);
|
||||
writePinLow(B0);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_low(B0);
|
||||
break;
|
||||
case 6:
|
||||
writePinLow(B5);
|
||||
writePinLow(B7);
|
||||
writePinHigh(F0);
|
||||
writePinLow(B0);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_low(B0);
|
||||
break;
|
||||
case 7:
|
||||
writePinLow(B5);
|
||||
writePinLow(B7);
|
||||
writePinLow(F0);
|
||||
writePinLow(B0);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_low(B0);
|
||||
break;
|
||||
case 8:
|
||||
writePinHigh(B5);
|
||||
writePinHigh(B7);
|
||||
writePinHigh(F0);
|
||||
writePinLow(F1);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_low(F1);
|
||||
break;
|
||||
case 9:
|
||||
writePinHigh(B5);
|
||||
writePinHigh(B7);
|
||||
writePinLow(F0);
|
||||
writePinLow(F1);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_low(F1);
|
||||
break;
|
||||
case 10:
|
||||
writePinHigh(B5);
|
||||
writePinLow(B7);
|
||||
writePinHigh(F0);
|
||||
writePinLow(F1);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_low(F1);
|
||||
break;
|
||||
case 11:
|
||||
writePinHigh(B5);
|
||||
writePinLow(B7);
|
||||
writePinLow(F0);
|
||||
writePinLow(F1);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_low(F1);
|
||||
break;
|
||||
case 12:
|
||||
writePinLow(B5);
|
||||
writePinHigh(B7);
|
||||
writePinHigh(F0);
|
||||
writePinLow(F1);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_low(F1);
|
||||
break;
|
||||
case 13:
|
||||
writePinLow(B5);
|
||||
writePinHigh(B7);
|
||||
writePinLow(F0);
|
||||
writePinLow(F1);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_low(F1);
|
||||
break;
|
||||
case 14:
|
||||
writePinLow(B5);
|
||||
writePinLow(B7);
|
||||
writePinLow(F0);
|
||||
writePinLow(F1);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_low(F1);
|
||||
break;
|
||||
case 15:
|
||||
writePinLow(B5);
|
||||
writePinLow(B7);
|
||||
writePinHigh(F0);
|
||||
writePinLow(F1);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_low(F1);
|
||||
break;
|
||||
case 16:
|
||||
writePinHigh(E6);
|
||||
gpio_write_pin_high(E6);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void unselect_cols(void) {
|
||||
//Native
|
||||
writePinHigh(E6);
|
||||
gpio_write_pin_high(E6);
|
||||
|
||||
//Demultiplexer
|
||||
writePinLow(B0);
|
||||
writePinLow(F1);
|
||||
writePinHigh(B5);
|
||||
writePinHigh(B7);
|
||||
writePinHigh(F0);
|
||||
gpio_write_pin_low(B0);
|
||||
gpio_write_pin_low(F1);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
}
|
||||
|
||||
static void init_pins(void) {
|
||||
unselect_cols();
|
||||
for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
|
||||
setPinInputHigh(row_pins[x]);
|
||||
gpio_set_pin_input_high(row_pins[x]);
|
||||
}
|
||||
setPinOutput(B5);
|
||||
setPinOutput(B7);
|
||||
setPinOutput(F0);
|
||||
setPinOutput(B0);
|
||||
setPinOutput(F1);
|
||||
setPinOutput(E6);
|
||||
gpio_set_pin_output(B5);
|
||||
gpio_set_pin_output(B7);
|
||||
gpio_set_pin_output(F0);
|
||||
gpio_set_pin_output(B0);
|
||||
gpio_set_pin_output(F1);
|
||||
gpio_set_pin_output(E6);
|
||||
}
|
||||
|
||||
static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) {
|
||||
|
@ -344,7 +344,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
|
|||
matrix_row_t last_row_value = current_matrix[row_index];
|
||||
|
||||
// Check row pin state
|
||||
if (readPin(row_pins[row_index]) == 0) {
|
||||
if (gpio_read_pin(row_pins[row_index]) == 0) {
|
||||
// Pin LO, set col bit
|
||||
current_matrix[row_index] |= (MATRIX_ROW_SHIFTER << current_col);
|
||||
} else {
|
||||
|
|
|
@ -37,7 +37,7 @@ static void init_pins(void) {
|
|||
for (int col = 0; col < MATRIX_COLS; col++) {
|
||||
pin_t pin = direct_pins[row][col];
|
||||
if (pin != NO_PIN) {
|
||||
setPinInputHigh(pin);
|
||||
gpio_set_pin_input_high(pin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
|
|||
for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) {
|
||||
pin_t pin = direct_pins[current_row][col_index];
|
||||
if (pin != NO_PIN) {
|
||||
current_matrix[current_row] |= readPin(pin) ? 0 : (MATRIX_ROW_SHIFTER << col_index);
|
||||
current_matrix[current_row] |= gpio_read_pin(pin) ? 0 : (MATRIX_ROW_SHIFTER << col_index);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,103 +101,103 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
|
|||
static void select_col(uint8_t col) {
|
||||
switch (col) {
|
||||
case 0:
|
||||
writePinLow(B5);
|
||||
writePinLow(B7);
|
||||
writePinLow(F0);
|
||||
writePinHigh(B0);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_high(B0);
|
||||
break;
|
||||
case 1:
|
||||
writePinLow(B5);
|
||||
writePinLow(B7);
|
||||
writePinHigh(F0);
|
||||
writePinHigh(B0);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_high(B0);
|
||||
break;
|
||||
case 2:
|
||||
writePinLow(B5);
|
||||
writePinHigh(B7);
|
||||
writePinLow(F0);
|
||||
writePinHigh(B0);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_high(B0);
|
||||
break;
|
||||
case 3:
|
||||
writePinLow(B5);
|
||||
writePinHigh(B7);
|
||||
writePinHigh(F0);
|
||||
writePinHigh(B0);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_high(B0);
|
||||
break;
|
||||
case 4:
|
||||
writePinHigh(B5);
|
||||
writePinLow(B7);
|
||||
writePinLow(F0);
|
||||
writePinHigh(B0);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_high(B0);
|
||||
break;
|
||||
case 5:
|
||||
writePinHigh(B5);
|
||||
writePinLow(B7);
|
||||
writePinHigh(F0);
|
||||
writePinHigh(B0);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_high(B0);
|
||||
break;
|
||||
case 6:
|
||||
writePinHigh(B5);
|
||||
writePinHigh(B7);
|
||||
writePinLow(F0);
|
||||
writePinHigh(B0);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_high(B0);
|
||||
break;
|
||||
case 7:
|
||||
writePinHigh(B5);
|
||||
writePinHigh(B7);
|
||||
writePinHigh(F0);
|
||||
writePinHigh(B0);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_high(B0);
|
||||
break;
|
||||
case 8:
|
||||
writePinLow(B5);
|
||||
writePinLow(B7);
|
||||
writePinLow(F0);
|
||||
writePinHigh(F1);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_high(F1);
|
||||
break;
|
||||
case 9:
|
||||
writePinLow(B5);
|
||||
writePinLow(B7);
|
||||
writePinHigh(F0);
|
||||
writePinHigh(F1);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_high(F1);
|
||||
break;
|
||||
case 10:
|
||||
writePinLow(B5);
|
||||
writePinHigh(B7);
|
||||
writePinLow(F0);
|
||||
writePinHigh(F1);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_high(F1);
|
||||
break;
|
||||
case 11:
|
||||
writePinLow(B5);
|
||||
writePinHigh(B7);
|
||||
writePinHigh(F0);
|
||||
writePinHigh(F1);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_high(F1);
|
||||
break;
|
||||
case 12:
|
||||
writePinHigh(B5);
|
||||
writePinLow(B7);
|
||||
writePinLow(F0);
|
||||
writePinHigh(F1);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_high(F1);
|
||||
break;
|
||||
case 13:
|
||||
writePinHigh(B5);
|
||||
writePinLow(B7);
|
||||
writePinHigh(F0);
|
||||
writePinHigh(F1);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_high(F1);
|
||||
break;
|
||||
case 14:
|
||||
writePinHigh(B5);
|
||||
writePinHigh(B7);
|
||||
writePinHigh(F0);
|
||||
writePinHigh(F1);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_high(F1);
|
||||
break;
|
||||
case 15:
|
||||
writePinHigh(B5);
|
||||
writePinHigh(B7);
|
||||
writePinLow(F0);
|
||||
writePinHigh(F1);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_high(F1);
|
||||
break;
|
||||
case 16:
|
||||
writePinLow(E6);
|
||||
gpio_write_pin_low(E6);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -205,130 +205,130 @@ static void select_col(uint8_t col) {
|
|||
static void unselect_col(uint8_t col) {
|
||||
switch (col) {
|
||||
case 0:
|
||||
writePinHigh(B5);
|
||||
writePinHigh(B7);
|
||||
writePinHigh(F0);
|
||||
writePinLow(B0);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_low(B0);
|
||||
break;
|
||||
case 1:
|
||||
writePinHigh(B5);
|
||||
writePinHigh(B7);
|
||||
writePinLow(F0);
|
||||
writePinLow(B0);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_low(B0);
|
||||
break;
|
||||
case 2:
|
||||
writePinHigh(B5);
|
||||
writePinLow(B7);
|
||||
writePinHigh(F0);
|
||||
writePinLow(B0);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_low(B0);
|
||||
break;
|
||||
case 3:
|
||||
writePinHigh(B5);
|
||||
writePinLow(B7);
|
||||
writePinLow(F0);
|
||||
writePinLow(B0);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_low(B0);
|
||||
break;
|
||||
case 4:
|
||||
writePinLow(B5);
|
||||
writePinHigh(B7);
|
||||
writePinHigh(F0);
|
||||
writePinLow(B0);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_low(B0);
|
||||
break;
|
||||
case 5:
|
||||
writePinLow(B5);
|
||||
writePinHigh(B7);
|
||||
writePinLow(F0);
|
||||
writePinLow(B0);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_low(B0);
|
||||
break;
|
||||
case 6:
|
||||
writePinLow(B5);
|
||||
writePinLow(B7);
|
||||
writePinHigh(F0);
|
||||
writePinLow(B0);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_low(B0);
|
||||
break;
|
||||
case 7:
|
||||
writePinLow(B5);
|
||||
writePinLow(B7);
|
||||
writePinLow(F0);
|
||||
writePinLow(B0);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_low(B0);
|
||||
break;
|
||||
case 8:
|
||||
writePinHigh(B5);
|
||||
writePinHigh(B7);
|
||||
writePinHigh(F0);
|
||||
writePinLow(F1);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_low(F1);
|
||||
break;
|
||||
case 9:
|
||||
writePinHigh(B5);
|
||||
writePinHigh(B7);
|
||||
writePinLow(F0);
|
||||
writePinLow(F1);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_low(F1);
|
||||
break;
|
||||
case 10:
|
||||
writePinHigh(B5);
|
||||
writePinLow(B7);
|
||||
writePinHigh(F0);
|
||||
writePinLow(F1);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_low(F1);
|
||||
break;
|
||||
case 11:
|
||||
writePinHigh(B5);
|
||||
writePinLow(B7);
|
||||
writePinLow(F0);
|
||||
writePinLow(F1);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_low(F1);
|
||||
break;
|
||||
case 12:
|
||||
writePinLow(B5);
|
||||
writePinHigh(B7);
|
||||
writePinHigh(F0);
|
||||
writePinLow(F1);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_low(F1);
|
||||
break;
|
||||
case 13:
|
||||
writePinLow(B5);
|
||||
writePinHigh(B7);
|
||||
writePinLow(F0);
|
||||
writePinLow(F1);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_low(F1);
|
||||
break;
|
||||
case 14:
|
||||
writePinLow(B5);
|
||||
writePinLow(B7);
|
||||
writePinLow(F0);
|
||||
writePinLow(F1);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_low(F1);
|
||||
break;
|
||||
case 15:
|
||||
writePinLow(B5);
|
||||
writePinLow(B7);
|
||||
writePinHigh(F0);
|
||||
writePinLow(F1);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_low(F1);
|
||||
break;
|
||||
case 16:
|
||||
writePinHigh(E6);
|
||||
gpio_write_pin_high(E6);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void unselect_cols(void) {
|
||||
//Native
|
||||
writePinHigh(E6);
|
||||
gpio_write_pin_high(E6);
|
||||
|
||||
//Demultiplexer
|
||||
writePinLow(B0);
|
||||
writePinLow(F1);
|
||||
writePinHigh(B5);
|
||||
writePinHigh(B7);
|
||||
writePinHigh(F0);
|
||||
gpio_write_pin_low(B0);
|
||||
gpio_write_pin_low(F1);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
}
|
||||
|
||||
static void init_pins(void) {
|
||||
unselect_cols();
|
||||
for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
|
||||
setPinInputHigh(row_pins[x]);
|
||||
gpio_set_pin_input_high(row_pins[x]);
|
||||
}
|
||||
setPinOutput(B5);
|
||||
setPinOutput(B7);
|
||||
setPinOutput(F0);
|
||||
setPinOutput(B0);
|
||||
setPinOutput(F1);
|
||||
setPinOutput(E6);
|
||||
gpio_set_pin_output(B5);
|
||||
gpio_set_pin_output(B7);
|
||||
gpio_set_pin_output(F0);
|
||||
gpio_set_pin_output(B0);
|
||||
gpio_set_pin_output(F1);
|
||||
gpio_set_pin_output(E6);
|
||||
}
|
||||
|
||||
static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) {
|
||||
|
@ -344,7 +344,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
|
|||
matrix_row_t last_row_value = current_matrix[row_index];
|
||||
|
||||
// Check row pin state
|
||||
if (readPin(row_pins[row_index]) == 0) {
|
||||
if (gpio_read_pin(row_pins[row_index]) == 0) {
|
||||
// Pin LO, set col bit
|
||||
current_matrix[row_index] |= (MATRIX_ROW_SHIFTER << current_col);
|
||||
} else {
|
||||
|
|
|
@ -18,12 +18,12 @@
|
|||
|
||||
void led_init_ports(void) {
|
||||
// * Set our LED pins as output
|
||||
setPinOutput(B3);
|
||||
gpio_set_pin_output(B3);
|
||||
}
|
||||
bool led_update_kb(led_t led_state) {
|
||||
bool res = led_update_user(led_state);
|
||||
if(res) {
|
||||
writePin(B3, led_state.caps_lock);
|
||||
gpio_write_pin(B3, led_state.caps_lock);
|
||||
rgblight_set_effect_range(1, 30);
|
||||
if (led_state.scroll_lock) {
|
||||
rgblight_setrgb_at(255, 255, 255, 0);
|
||||
|
|
|
@ -17,15 +17,15 @@
|
|||
#include "quantum.h"
|
||||
|
||||
void led_init_ports(void) {
|
||||
setPinOutput(B2);
|
||||
setPinOutput(D0);
|
||||
setPinOutput(D1);
|
||||
setPinOutput(D2);
|
||||
gpio_set_pin_output(B2);
|
||||
gpio_set_pin_output(D0);
|
||||
gpio_set_pin_output(D1);
|
||||
gpio_set_pin_output(D2);
|
||||
|
||||
}
|
||||
bool led_update_kb(led_t led_state) {
|
||||
if(led_update_user(led_state)) {
|
||||
writePin(B2, led_state.caps_lock);
|
||||
gpio_write_pin(B2, led_state.caps_lock);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -34,10 +34,10 @@ bool led_update_kb(led_t led_state) {
|
|||
__attribute__((weak))
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
// if on layer 1, turn on D2 LED, otherwise off.
|
||||
writePin(D2, get_highest_layer(state) == 1);
|
||||
gpio_write_pin(D2, get_highest_layer(state) == 1);
|
||||
// if on layer 2, turn on D1 LED, otherwise off.
|
||||
writePin(D1, get_highest_layer(state) == 2);
|
||||
gpio_write_pin(D1, get_highest_layer(state) == 2);
|
||||
// if on layer 3, turn on D0 LED, otherwise off.
|
||||
writePin(D0, get_highest_layer(state) == 3);
|
||||
gpio_write_pin(D0, get_highest_layer(state) == 3);
|
||||
return state;
|
||||
}
|
||||
|
|
|
@ -21,5 +21,5 @@ void keyboard_pre_init_user(void) {
|
|||
// Call the keyboard pre init code.
|
||||
|
||||
// Set our LED pins as output
|
||||
setPinOutput(D7);
|
||||
gpio_set_pin_output(D7);
|
||||
}
|
||||
|
|
|
@ -17,19 +17,19 @@
|
|||
#include "quantum.h"
|
||||
|
||||
void led_init_ports(void) {
|
||||
setPinOutput(C0);
|
||||
setPinOutput(D0);
|
||||
setPinOutput(D1);
|
||||
setPinOutput(C1);
|
||||
setPinOutput(C6);
|
||||
gpio_set_pin_output(C0);
|
||||
gpio_set_pin_output(D0);
|
||||
gpio_set_pin_output(D1);
|
||||
gpio_set_pin_output(C1);
|
||||
gpio_set_pin_output(C6);
|
||||
}
|
||||
|
||||
__attribute__((weak)) layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
writePin(D1, layer_state_cmp(state, 1));
|
||||
writePin(D0, layer_state_cmp(state, 2));
|
||||
writePin(C1, layer_state_cmp(state, 3));
|
||||
writePin(C0, layer_state_cmp(state, 4));
|
||||
writePin(C6, layer_state_cmp(state, 5));
|
||||
gpio_write_pin(D1, layer_state_cmp(state, 1));
|
||||
gpio_write_pin(D0, layer_state_cmp(state, 2));
|
||||
gpio_write_pin(C1, layer_state_cmp(state, 3));
|
||||
gpio_write_pin(C0, layer_state_cmp(state, 4));
|
||||
gpio_write_pin(C6, layer_state_cmp(state, 5));
|
||||
|
||||
return state;
|
||||
}
|
||||
|
|
|
@ -67,109 +67,109 @@ static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
|
|||
static void select_col(uint8_t col) {
|
||||
switch (col) {
|
||||
case 0:
|
||||
writePinLow(A0);
|
||||
writePinLow(A1);
|
||||
writePinLow(A2);
|
||||
writePinHigh(B4);
|
||||
gpio_write_pin_low(A0);
|
||||
gpio_write_pin_low(A1);
|
||||
gpio_write_pin_low(A2);
|
||||
gpio_write_pin_high(B4);
|
||||
break;
|
||||
case 1:
|
||||
writePinLow(A0);
|
||||
writePinLow(A1);
|
||||
writePinHigh(A2);
|
||||
writePinHigh(B4);
|
||||
gpio_write_pin_low(A0);
|
||||
gpio_write_pin_low(A1);
|
||||
gpio_write_pin_high(A2);
|
||||
gpio_write_pin_high(B4);
|
||||
break;
|
||||
case 2:
|
||||
writePinLow(A0);
|
||||
writePinHigh(A1);
|
||||
writePinLow(A2);
|
||||
writePinHigh(B4);
|
||||
gpio_write_pin_low(A0);
|
||||
gpio_write_pin_high(A1);
|
||||
gpio_write_pin_low(A2);
|
||||
gpio_write_pin_high(B4);
|
||||
break;
|
||||
case 3:
|
||||
writePinLow(A0);
|
||||
writePinHigh(A1);
|
||||
writePinHigh(A2);
|
||||
writePinHigh(B4);
|
||||
gpio_write_pin_low(A0);
|
||||
gpio_write_pin_high(A1);
|
||||
gpio_write_pin_high(A2);
|
||||
gpio_write_pin_high(B4);
|
||||
break;
|
||||
case 4:
|
||||
writePinHigh(A0);
|
||||
writePinLow(A1);
|
||||
writePinLow(A2);
|
||||
writePinHigh(B4);
|
||||
gpio_write_pin_high(A0);
|
||||
gpio_write_pin_low(A1);
|
||||
gpio_write_pin_low(A2);
|
||||
gpio_write_pin_high(B4);
|
||||
break;
|
||||
case 5:
|
||||
writePinHigh(A0);
|
||||
writePinLow(A1);
|
||||
writePinHigh(A2);
|
||||
writePinHigh(B4);
|
||||
gpio_write_pin_high(A0);
|
||||
gpio_write_pin_low(A1);
|
||||
gpio_write_pin_high(A2);
|
||||
gpio_write_pin_high(B4);
|
||||
break;
|
||||
case 6:
|
||||
writePinHigh(A0);
|
||||
writePinHigh(A1);
|
||||
writePinLow(A2);
|
||||
writePinHigh(B4);
|
||||
gpio_write_pin_high(A0);
|
||||
gpio_write_pin_high(A1);
|
||||
gpio_write_pin_low(A2);
|
||||
gpio_write_pin_high(B4);
|
||||
break;
|
||||
case 7:
|
||||
writePinHigh(A0);
|
||||
writePinHigh(A1);
|
||||
writePinHigh(A2);
|
||||
writePinHigh(B4);
|
||||
gpio_write_pin_high(A0);
|
||||
gpio_write_pin_high(A1);
|
||||
gpio_write_pin_high(A2);
|
||||
gpio_write_pin_high(B4);
|
||||
break;
|
||||
case 8:
|
||||
writePinHigh(A0);
|
||||
writePinHigh(A1);
|
||||
writePinHigh(A2);
|
||||
writePinHigh(C7);
|
||||
gpio_write_pin_high(A0);
|
||||
gpio_write_pin_high(A1);
|
||||
gpio_write_pin_high(A2);
|
||||
gpio_write_pin_high(C7);
|
||||
break;
|
||||
case 9:
|
||||
writePinLow(A0);
|
||||
writePinLow(A1);
|
||||
writePinLow(A2);
|
||||
writePinHigh(C7);
|
||||
gpio_write_pin_low(A0);
|
||||
gpio_write_pin_low(A1);
|
||||
gpio_write_pin_low(A2);
|
||||
gpio_write_pin_high(C7);
|
||||
break;
|
||||
case 10:
|
||||
writePinLow(A0);
|
||||
writePinLow(A1);
|
||||
writePinHigh(A2);
|
||||
writePinHigh(C7);
|
||||
gpio_write_pin_low(A0);
|
||||
gpio_write_pin_low(A1);
|
||||
gpio_write_pin_high(A2);
|
||||
gpio_write_pin_high(C7);
|
||||
break;
|
||||
case 11:
|
||||
writePinLow(A0);
|
||||
writePinHigh(A1);
|
||||
writePinLow(A2);
|
||||
writePinHigh(C7);
|
||||
gpio_write_pin_low(A0);
|
||||
gpio_write_pin_high(A1);
|
||||
gpio_write_pin_low(A2);
|
||||
gpio_write_pin_high(C7);
|
||||
break;
|
||||
case 12:
|
||||
writePinLow(A0);
|
||||
writePinHigh(A1);
|
||||
writePinHigh(A2);
|
||||
writePinHigh(C7);
|
||||
gpio_write_pin_low(A0);
|
||||
gpio_write_pin_high(A1);
|
||||
gpio_write_pin_high(A2);
|
||||
gpio_write_pin_high(C7);
|
||||
break;
|
||||
case 13:
|
||||
writePinHigh(A0);
|
||||
writePinLow(A1);
|
||||
writePinLow(A2);
|
||||
writePinHigh(C7);
|
||||
gpio_write_pin_high(A0);
|
||||
gpio_write_pin_low(A1);
|
||||
gpio_write_pin_low(A2);
|
||||
gpio_write_pin_high(C7);
|
||||
break;
|
||||
case 14:
|
||||
writePinHigh(A0);
|
||||
writePinLow(A1);
|
||||
writePinHigh(A2);
|
||||
writePinHigh(C7);
|
||||
gpio_write_pin_high(A0);
|
||||
gpio_write_pin_low(A1);
|
||||
gpio_write_pin_high(A2);
|
||||
gpio_write_pin_high(C7);
|
||||
break;
|
||||
case 15:
|
||||
writePinHigh(A0);
|
||||
writePinHigh(A1);
|
||||
writePinLow(A2);
|
||||
writePinHigh(C7);
|
||||
gpio_write_pin_high(A0);
|
||||
gpio_write_pin_high(A1);
|
||||
gpio_write_pin_low(A2);
|
||||
gpio_write_pin_high(C7);
|
||||
break;
|
||||
case 16:
|
||||
writePinLow(C2);
|
||||
gpio_write_pin_low(C2);
|
||||
break;
|
||||
case 17:
|
||||
writePinLow(C3);
|
||||
gpio_write_pin_low(C3);
|
||||
break;
|
||||
case 18:
|
||||
writePinLow(C5);
|
||||
gpio_write_pin_low(C5);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -177,140 +177,140 @@ static void select_col(uint8_t col) {
|
|||
static void unselect_col(uint8_t col) {
|
||||
switch (col) {
|
||||
case 0:
|
||||
writePinHigh(A0);
|
||||
writePinHigh(A1);
|
||||
writePinHigh(A2);
|
||||
writePinLow(B4);
|
||||
gpio_write_pin_high(A0);
|
||||
gpio_write_pin_high(A1);
|
||||
gpio_write_pin_high(A2);
|
||||
gpio_write_pin_low(B4);
|
||||
break;
|
||||
case 1:
|
||||
writePinHigh(A0);
|
||||
writePinHigh(A1);
|
||||
writePinLow(A2);
|
||||
writePinLow(B4);
|
||||
gpio_write_pin_high(A0);
|
||||
gpio_write_pin_high(A1);
|
||||
gpio_write_pin_low(A2);
|
||||
gpio_write_pin_low(B4);
|
||||
break;
|
||||
case 2:
|
||||
writePinHigh(A0);
|
||||
writePinLow(A1);
|
||||
writePinHigh(A2);
|
||||
writePinLow(B4);
|
||||
gpio_write_pin_high(A0);
|
||||
gpio_write_pin_low(A1);
|
||||
gpio_write_pin_high(A2);
|
||||
gpio_write_pin_low(B4);
|
||||
break;
|
||||
case 3:
|
||||
writePinHigh(A0);
|
||||
writePinLow(A1);
|
||||
writePinLow(A2);
|
||||
writePinLow(B4);
|
||||
gpio_write_pin_high(A0);
|
||||
gpio_write_pin_low(A1);
|
||||
gpio_write_pin_low(A2);
|
||||
gpio_write_pin_low(B4);
|
||||
break;
|
||||
case 4:
|
||||
writePinLow(A0);
|
||||
writePinHigh(A1);
|
||||
writePinHigh(A2);
|
||||
writePinLow(B4);
|
||||
gpio_write_pin_low(A0);
|
||||
gpio_write_pin_high(A1);
|
||||
gpio_write_pin_high(A2);
|
||||
gpio_write_pin_low(B4);
|
||||
break;
|
||||
case 5:
|
||||
writePinLow(A0);
|
||||
writePinHigh(A1);
|
||||
writePinLow(A2);
|
||||
writePinLow(B4);
|
||||
gpio_write_pin_low(A0);
|
||||
gpio_write_pin_high(A1);
|
||||
gpio_write_pin_low(A2);
|
||||
gpio_write_pin_low(B4);
|
||||
break;
|
||||
case 6:
|
||||
writePinLow(A0);
|
||||
writePinLow(A1);
|
||||
writePinHigh(A2);
|
||||
writePinLow(B4);
|
||||
gpio_write_pin_low(A0);
|
||||
gpio_write_pin_low(A1);
|
||||
gpio_write_pin_high(A2);
|
||||
gpio_write_pin_low(B4);
|
||||
break;
|
||||
case 7:
|
||||
writePinLow(A0);
|
||||
writePinLow(A1);
|
||||
writePinLow(A2);
|
||||
writePinLow(B4);
|
||||
gpio_write_pin_low(A0);
|
||||
gpio_write_pin_low(A1);
|
||||
gpio_write_pin_low(A2);
|
||||
gpio_write_pin_low(B4);
|
||||
break;
|
||||
case 8:
|
||||
writePinLow(A0);
|
||||
writePinLow(A1);
|
||||
writePinLow(A2);
|
||||
writePinLow(C7);
|
||||
gpio_write_pin_low(A0);
|
||||
gpio_write_pin_low(A1);
|
||||
gpio_write_pin_low(A2);
|
||||
gpio_write_pin_low(C7);
|
||||
break;
|
||||
case 9:
|
||||
writePinHigh(A0);
|
||||
writePinHigh(A1);
|
||||
writePinHigh(A2);
|
||||
writePinLow(C7);
|
||||
gpio_write_pin_high(A0);
|
||||
gpio_write_pin_high(A1);
|
||||
gpio_write_pin_high(A2);
|
||||
gpio_write_pin_low(C7);
|
||||
break;
|
||||
case 10:
|
||||
writePinHigh(A0);
|
||||
writePinHigh(A1);
|
||||
writePinLow(A2);
|
||||
writePinLow(C7);
|
||||
gpio_write_pin_high(A0);
|
||||
gpio_write_pin_high(A1);
|
||||
gpio_write_pin_low(A2);
|
||||
gpio_write_pin_low(C7);
|
||||
break;
|
||||
case 11:
|
||||
writePinHigh(A0);
|
||||
writePinLow(A1);
|
||||
writePinHigh(A2);
|
||||
writePinLow(C7);
|
||||
gpio_write_pin_high(A0);
|
||||
gpio_write_pin_low(A1);
|
||||
gpio_write_pin_high(A2);
|
||||
gpio_write_pin_low(C7);
|
||||
break;
|
||||
case 12:
|
||||
writePinHigh(A0);
|
||||
writePinLow(A1);
|
||||
writePinLow(A2);
|
||||
writePinLow(C7);
|
||||
gpio_write_pin_high(A0);
|
||||
gpio_write_pin_low(A1);
|
||||
gpio_write_pin_low(A2);
|
||||
gpio_write_pin_low(C7);
|
||||
break;
|
||||
case 13:
|
||||
writePinLow(A0);
|
||||
writePinHigh(A1);
|
||||
writePinHigh(A2);
|
||||
writePinLow(C7);
|
||||
gpio_write_pin_low(A0);
|
||||
gpio_write_pin_high(A1);
|
||||
gpio_write_pin_high(A2);
|
||||
gpio_write_pin_low(C7);
|
||||
break;
|
||||
case 14:
|
||||
writePinLow(A0);
|
||||
writePinHigh(A1);
|
||||
writePinLow(A2);
|
||||
writePinLow(C7);
|
||||
gpio_write_pin_low(A0);
|
||||
gpio_write_pin_high(A1);
|
||||
gpio_write_pin_low(A2);
|
||||
gpio_write_pin_low(C7);
|
||||
break;
|
||||
case 15:
|
||||
writePinLow(A0);
|
||||
writePinLow(A1);
|
||||
writePinHigh(A2);
|
||||
writePinLow(C7);
|
||||
gpio_write_pin_low(A0);
|
||||
gpio_write_pin_low(A1);
|
||||
gpio_write_pin_high(A2);
|
||||
gpio_write_pin_low(C7);
|
||||
break;
|
||||
case 16:
|
||||
writePinHigh(C2);
|
||||
gpio_write_pin_high(C2);
|
||||
break;
|
||||
case 17:
|
||||
writePinHigh(C3);
|
||||
gpio_write_pin_high(C3);
|
||||
break;
|
||||
case 18:
|
||||
writePinHigh(C5);
|
||||
gpio_write_pin_high(C5);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void unselect_cols(void) {
|
||||
//Native
|
||||
writePinHigh(C2);
|
||||
writePinHigh(C3);
|
||||
writePinHigh(C5);
|
||||
gpio_write_pin_high(C2);
|
||||
gpio_write_pin_high(C3);
|
||||
gpio_write_pin_high(C5);
|
||||
|
||||
//Demultiplexer
|
||||
writePinLow(B4);
|
||||
writePinLow(C7);
|
||||
writePinHigh(A0);
|
||||
writePinHigh(A1);
|
||||
writePinHigh(A2);
|
||||
gpio_write_pin_low(B4);
|
||||
gpio_write_pin_low(C7);
|
||||
gpio_write_pin_high(A0);
|
||||
gpio_write_pin_high(A1);
|
||||
gpio_write_pin_high(A2);
|
||||
}
|
||||
|
||||
static void init_pins(void) {
|
||||
unselect_cols();
|
||||
for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
|
||||
setPinInputHigh(row_pins[x]);
|
||||
gpio_set_pin_input_high(row_pins[x]);
|
||||
}
|
||||
setPinOutput(A0);
|
||||
setPinOutput(A1);
|
||||
setPinOutput(A2);
|
||||
setPinOutput(B4);
|
||||
setPinOutput(C7);
|
||||
setPinOutput(C2);
|
||||
setPinOutput(C3);
|
||||
setPinOutput(C5);
|
||||
gpio_set_pin_output(A0);
|
||||
gpio_set_pin_output(A1);
|
||||
gpio_set_pin_output(A2);
|
||||
gpio_set_pin_output(B4);
|
||||
gpio_set_pin_output(C7);
|
||||
gpio_set_pin_output(C2);
|
||||
gpio_set_pin_output(C3);
|
||||
gpio_set_pin_output(C5);
|
||||
}
|
||||
|
||||
static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) {
|
||||
|
@ -326,7 +326,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
|
|||
matrix_row_t last_row_value = current_matrix[row_index];
|
||||
|
||||
// Check row pin state
|
||||
if (readPin(row_pins[row_index]) == 0) {
|
||||
if (gpio_read_pin(row_pins[row_index]) == 0) {
|
||||
// Pin LO, set col bit
|
||||
current_matrix[row_index] |= (MATRIX_ROW_SHIFTER << current_col);
|
||||
} else {
|
||||
|
|
|
@ -37,7 +37,7 @@ static void init_pins(void) {
|
|||
for (int col = 0; col < MATRIX_COLS; col++) {
|
||||
pin_t pin = direct_pins[row][col];
|
||||
if (pin != NO_PIN) {
|
||||
setPinInputHigh(pin);
|
||||
gpio_set_pin_input_high(pin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
|
|||
for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) {
|
||||
pin_t pin = direct_pins[current_row][col_index];
|
||||
if (pin != NO_PIN) {
|
||||
current_matrix[current_row] |= readPin(pin) ? 0 : (MATRIX_ROW_SHIFTER << col_index);
|
||||
current_matrix[current_row] |= gpio_read_pin(pin) ? 0 : (MATRIX_ROW_SHIFTER << col_index);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,22 +60,22 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
|
|||
#elif (DIODE_DIRECTION == COL2ROW)
|
||||
|
||||
static void select_row(uint8_t row) {
|
||||
setPinOutput(row_pins[row]);
|
||||
writePinLow(row_pins[row]);
|
||||
gpio_set_pin_output(row_pins[row]);
|
||||
gpio_write_pin_low(row_pins[row]);
|
||||
}
|
||||
|
||||
static void unselect_row(uint8_t row) { setPinInputHigh(row_pins[row]); }
|
||||
static void unselect_row(uint8_t row) { gpio_set_pin_input_high(row_pins[row]); }
|
||||
|
||||
static void unselect_rows(void) {
|
||||
for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
|
||||
setPinInputHigh(row_pins[x]);
|
||||
gpio_set_pin_input_high(row_pins[x]);
|
||||
}
|
||||
}
|
||||
|
||||
static void init_pins(void) {
|
||||
unselect_rows();
|
||||
for (uint8_t x = 0; x < MATRIX_COLS; x++) {
|
||||
setPinInputHigh(col_pins[x]);
|
||||
gpio_set_pin_input_high(col_pins[x]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
|
|||
for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) {
|
||||
|
||||
// Select the col pin to read (active low)
|
||||
uint8_t pin_state = readPin(col_pins[col_index]);
|
||||
uint8_t pin_state = gpio_read_pin(col_pins[col_index]);
|
||||
|
||||
// Populate the matrix row with the state of the col pin
|
||||
current_matrix[current_row] |= pin_state ? 0 : (MATRIX_ROW_SHIFTER << col_index);
|
||||
|
@ -154,109 +154,109 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
|
|||
static void select_col(uint8_t col) {
|
||||
switch (col) {
|
||||
case 0:
|
||||
writePinLow(A0);
|
||||
writePinLow(A1);
|
||||
writePinLow(A2);
|
||||
writePinHigh(B4);
|
||||
gpio_write_pin_low(A0);
|
||||
gpio_write_pin_low(A1);
|
||||
gpio_write_pin_low(A2);
|
||||
gpio_write_pin_high(B4);
|
||||
break;
|
||||
case 1:
|
||||
writePinLow(A0);
|
||||
writePinLow(A1);
|
||||
writePinHigh(A2);
|
||||
writePinHigh(B4);
|
||||
gpio_write_pin_low(A0);
|
||||
gpio_write_pin_low(A1);
|
||||
gpio_write_pin_high(A2);
|
||||
gpio_write_pin_high(B4);
|
||||
break;
|
||||
case 2:
|
||||
writePinLow(A0);
|
||||
writePinHigh(A1);
|
||||
writePinLow(A2);
|
||||
writePinHigh(B4);
|
||||
gpio_write_pin_low(A0);
|
||||
gpio_write_pin_high(A1);
|
||||
gpio_write_pin_low(A2);
|
||||
gpio_write_pin_high(B4);
|
||||
break;
|
||||
case 3:
|
||||
writePinLow(A0);
|
||||
writePinHigh(A1);
|
||||
writePinHigh(A2);
|
||||
writePinHigh(B4);
|
||||
gpio_write_pin_low(A0);
|
||||
gpio_write_pin_high(A1);
|
||||
gpio_write_pin_high(A2);
|
||||
gpio_write_pin_high(B4);
|
||||
break;
|
||||
case 4:
|
||||
writePinHigh(A0);
|
||||
writePinLow(A1);
|
||||
writePinLow(A2);
|
||||
writePinHigh(B4);
|
||||
gpio_write_pin_high(A0);
|
||||
gpio_write_pin_low(A1);
|
||||
gpio_write_pin_low(A2);
|
||||
gpio_write_pin_high(B4);
|
||||
break;
|
||||
case 5:
|
||||
writePinHigh(A0);
|
||||
writePinLow(A1);
|
||||
writePinHigh(A2);
|
||||
writePinHigh(B4);
|
||||
gpio_write_pin_high(A0);
|
||||
gpio_write_pin_low(A1);
|
||||
gpio_write_pin_high(A2);
|
||||
gpio_write_pin_high(B4);
|
||||
break;
|
||||
case 6:
|
||||
writePinHigh(A0);
|
||||
writePinHigh(A1);
|
||||
writePinLow(A2);
|
||||
writePinHigh(B4);
|
||||
gpio_write_pin_high(A0);
|
||||
gpio_write_pin_high(A1);
|
||||
gpio_write_pin_low(A2);
|
||||
gpio_write_pin_high(B4);
|
||||
break;
|
||||
case 7:
|
||||
writePinHigh(A0);
|
||||
writePinHigh(A1);
|
||||
writePinHigh(A2);
|
||||
writePinHigh(B4);
|
||||
gpio_write_pin_high(A0);
|
||||
gpio_write_pin_high(A1);
|
||||
gpio_write_pin_high(A2);
|
||||
gpio_write_pin_high(B4);
|
||||
break;
|
||||
case 8:
|
||||
writePinHigh(A0);
|
||||
writePinHigh(A1);
|
||||
writePinHigh(A2);
|
||||
writePinHigh(C7);
|
||||
gpio_write_pin_high(A0);
|
||||
gpio_write_pin_high(A1);
|
||||
gpio_write_pin_high(A2);
|
||||
gpio_write_pin_high(C7);
|
||||
break;
|
||||
case 9:
|
||||
writePinLow(A0);
|
||||
writePinLow(A1);
|
||||
writePinLow(A2);
|
||||
writePinHigh(C7);
|
||||
gpio_write_pin_low(A0);
|
||||
gpio_write_pin_low(A1);
|
||||
gpio_write_pin_low(A2);
|
||||
gpio_write_pin_high(C7);
|
||||
break;
|
||||
case 10:
|
||||
writePinLow(A0);
|
||||
writePinLow(A1);
|
||||
writePinHigh(A2);
|
||||
writePinHigh(C7);
|
||||
gpio_write_pin_low(A0);
|
||||
gpio_write_pin_low(A1);
|
||||
gpio_write_pin_high(A2);
|
||||
gpio_write_pin_high(C7);
|
||||
break;
|
||||
case 11:
|
||||
writePinLow(A0);
|
||||
writePinHigh(A1);
|
||||
writePinLow(A2);
|
||||
writePinHigh(C7);
|
||||
gpio_write_pin_low(A0);
|
||||
gpio_write_pin_high(A1);
|
||||
gpio_write_pin_low(A2);
|
||||
gpio_write_pin_high(C7);
|
||||
break;
|
||||
case 12:
|
||||
writePinLow(A0);
|
||||
writePinHigh(A1);
|
||||
writePinHigh(A2);
|
||||
writePinHigh(C7);
|
||||
gpio_write_pin_low(A0);
|
||||
gpio_write_pin_high(A1);
|
||||
gpio_write_pin_high(A2);
|
||||
gpio_write_pin_high(C7);
|
||||
break;
|
||||
case 13:
|
||||
writePinHigh(A0);
|
||||
writePinLow(A1);
|
||||
writePinLow(A2);
|
||||
writePinHigh(C7);
|
||||
gpio_write_pin_high(A0);
|
||||
gpio_write_pin_low(A1);
|
||||
gpio_write_pin_low(A2);
|
||||
gpio_write_pin_high(C7);
|
||||
break;
|
||||
case 14:
|
||||
writePinHigh(A0);
|
||||
writePinLow(A1);
|
||||
writePinHigh(A2);
|
||||
writePinHigh(C7);
|
||||
gpio_write_pin_high(A0);
|
||||
gpio_write_pin_low(A1);
|
||||
gpio_write_pin_high(A2);
|
||||
gpio_write_pin_high(C7);
|
||||
break;
|
||||
case 15:
|
||||
writePinHigh(A0);
|
||||
writePinHigh(A1);
|
||||
writePinLow(A2);
|
||||
writePinHigh(C7);
|
||||
gpio_write_pin_high(A0);
|
||||
gpio_write_pin_high(A1);
|
||||
gpio_write_pin_low(A2);
|
||||
gpio_write_pin_high(C7);
|
||||
break;
|
||||
case 16:
|
||||
writePinLow(C2);
|
||||
gpio_write_pin_low(C2);
|
||||
break;
|
||||
case 17:
|
||||
writePinLow(C3);
|
||||
gpio_write_pin_low(C3);
|
||||
break;
|
||||
case 18:
|
||||
writePinLow(C5);
|
||||
gpio_write_pin_low(C5);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -264,140 +264,140 @@ static void select_col(uint8_t col) {
|
|||
static void unselect_col(uint8_t col) {
|
||||
switch (col) {
|
||||
case 0:
|
||||
writePinHigh(A0);
|
||||
writePinHigh(A1);
|
||||
writePinHigh(A2);
|
||||
writePinLow(B4);
|
||||
gpio_write_pin_high(A0);
|
||||
gpio_write_pin_high(A1);
|
||||
gpio_write_pin_high(A2);
|
||||
gpio_write_pin_low(B4);
|
||||
break;
|
||||
case 1:
|
||||
writePinHigh(A0);
|
||||
writePinHigh(A1);
|
||||
writePinLow(A2);
|
||||
writePinLow(B4);
|
||||
gpio_write_pin_high(A0);
|
||||
gpio_write_pin_high(A1);
|
||||
gpio_write_pin_low(A2);
|
||||
gpio_write_pin_low(B4);
|
||||
break;
|
||||
case 2:
|
||||
writePinHigh(A0);
|
||||
writePinLow(A1);
|
||||
writePinHigh(A2);
|
||||
writePinLow(B4);
|
||||
gpio_write_pin_high(A0);
|
||||
gpio_write_pin_low(A1);
|
||||
gpio_write_pin_high(A2);
|
||||
gpio_write_pin_low(B4);
|
||||
break;
|
||||
case 3:
|
||||
writePinHigh(A0);
|
||||
writePinLow(A1);
|
||||
writePinLow(A2);
|
||||
writePinLow(B4);
|
||||
gpio_write_pin_high(A0);
|
||||
gpio_write_pin_low(A1);
|
||||
gpio_write_pin_low(A2);
|
||||
gpio_write_pin_low(B4);
|
||||
break;
|
||||
case 4:
|
||||
writePinLow(A0);
|
||||
writePinHigh(A1);
|
||||
writePinHigh(A2);
|
||||
writePinLow(B4);
|
||||
gpio_write_pin_low(A0);
|
||||
gpio_write_pin_high(A1);
|
||||
gpio_write_pin_high(A2);
|
||||
gpio_write_pin_low(B4);
|
||||
break;
|
||||
case 5:
|
||||
writePinLow(A0);
|
||||
writePinHigh(A1);
|
||||
writePinLow(A2);
|
||||
writePinLow(B4);
|
||||
gpio_write_pin_low(A0);
|
||||
gpio_write_pin_high(A1);
|
||||
gpio_write_pin_low(A2);
|
||||
gpio_write_pin_low(B4);
|
||||
break;
|
||||
case 6:
|
||||
writePinLow(A0);
|
||||
writePinLow(A1);
|
||||
writePinHigh(A2);
|
||||
writePinLow(B4);
|
||||
gpio_write_pin_low(A0);
|
||||
gpio_write_pin_low(A1);
|
||||
gpio_write_pin_high(A2);
|
||||
gpio_write_pin_low(B4);
|
||||
break;
|
||||
case 7:
|
||||
writePinLow(A0);
|
||||
writePinLow(A1);
|
||||
writePinLow(A2);
|
||||
writePinLow(B4);
|
||||
gpio_write_pin_low(A0);
|
||||
gpio_write_pin_low(A1);
|
||||
gpio_write_pin_low(A2);
|
||||
gpio_write_pin_low(B4);
|
||||
break;
|
||||
case 8:
|
||||
writePinLow(A0);
|
||||
writePinLow(A1);
|
||||
writePinLow(A2);
|
||||
writePinLow(C7);
|
||||
gpio_write_pin_low(A0);
|
||||
gpio_write_pin_low(A1);
|
||||
gpio_write_pin_low(A2);
|
||||
gpio_write_pin_low(C7);
|
||||
break;
|
||||
case 9:
|
||||
writePinHigh(A0);
|
||||
writePinHigh(A1);
|
||||
writePinHigh(A2);
|
||||
writePinLow(C7);
|
||||
gpio_write_pin_high(A0);
|
||||
gpio_write_pin_high(A1);
|
||||
gpio_write_pin_high(A2);
|
||||
gpio_write_pin_low(C7);
|
||||
break;
|
||||
case 10:
|
||||
writePinHigh(A0);
|
||||
writePinHigh(A1);
|
||||
writePinLow(A2);
|
||||
writePinLow(C7);
|
||||
gpio_write_pin_high(A0);
|
||||
gpio_write_pin_high(A1);
|
||||
gpio_write_pin_low(A2);
|
||||
gpio_write_pin_low(C7);
|
||||
break;
|
||||
case 11:
|
||||
writePinHigh(A0);
|
||||
writePinLow(A1);
|
||||
writePinHigh(A2);
|
||||
writePinLow(C7);
|
||||
gpio_write_pin_high(A0);
|
||||
gpio_write_pin_low(A1);
|
||||
gpio_write_pin_high(A2);
|
||||
gpio_write_pin_low(C7);
|
||||
break;
|
||||
case 12:
|
||||
writePinHigh(A0);
|
||||
writePinLow(A1);
|
||||
writePinLow(A2);
|
||||
writePinLow(C7);
|
||||
gpio_write_pin_high(A0);
|
||||
gpio_write_pin_low(A1);
|
||||
gpio_write_pin_low(A2);
|
||||
gpio_write_pin_low(C7);
|
||||
break;
|
||||
case 13:
|
||||
writePinLow(A0);
|
||||
writePinHigh(A1);
|
||||
writePinHigh(A2);
|
||||
writePinLow(C7);
|
||||
gpio_write_pin_low(A0);
|
||||
gpio_write_pin_high(A1);
|
||||
gpio_write_pin_high(A2);
|
||||
gpio_write_pin_low(C7);
|
||||
break;
|
||||
case 14:
|
||||
writePinLow(A0);
|
||||
writePinHigh(A1);
|
||||
writePinLow(A2);
|
||||
writePinLow(C7);
|
||||
gpio_write_pin_low(A0);
|
||||
gpio_write_pin_high(A1);
|
||||
gpio_write_pin_low(A2);
|
||||
gpio_write_pin_low(C7);
|
||||
break;
|
||||
case 15:
|
||||
writePinLow(A0);
|
||||
writePinLow(A1);
|
||||
writePinHigh(A2);
|
||||
writePinLow(C7);
|
||||
gpio_write_pin_low(A0);
|
||||
gpio_write_pin_low(A1);
|
||||
gpio_write_pin_high(A2);
|
||||
gpio_write_pin_low(C7);
|
||||
break;
|
||||
case 16:
|
||||
writePinHigh(C2);
|
||||
gpio_write_pin_high(C2);
|
||||
break;
|
||||
case 17:
|
||||
writePinHigh(C3);
|
||||
gpio_write_pin_high(C3);
|
||||
break;
|
||||
case 18:
|
||||
writePinHigh(C5);
|
||||
gpio_write_pin_high(C5);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void unselect_cols(void) {
|
||||
//Native
|
||||
writePinHigh(C2);
|
||||
writePinHigh(C3);
|
||||
writePinHigh(C5);
|
||||
gpio_write_pin_high(C2);
|
||||
gpio_write_pin_high(C3);
|
||||
gpio_write_pin_high(C5);
|
||||
|
||||
//Demultiplexer
|
||||
writePinLow(B4);
|
||||
writePinLow(C7);
|
||||
writePinHigh(A0);
|
||||
writePinHigh(A1);
|
||||
writePinHigh(A2);
|
||||
gpio_write_pin_low(B4);
|
||||
gpio_write_pin_low(C7);
|
||||
gpio_write_pin_high(A0);
|
||||
gpio_write_pin_high(A1);
|
||||
gpio_write_pin_high(A2);
|
||||
}
|
||||
|
||||
static void init_pins(void) {
|
||||
unselect_cols();
|
||||
for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
|
||||
setPinInputHigh(row_pins[x]);
|
||||
gpio_set_pin_input_high(row_pins[x]);
|
||||
}
|
||||
setPinOutput(A0);
|
||||
setPinOutput(A1);
|
||||
setPinOutput(A2);
|
||||
setPinOutput(B4);
|
||||
setPinOutput(C7);
|
||||
setPinOutput(C2);
|
||||
setPinOutput(C3);
|
||||
setPinOutput(C5);
|
||||
gpio_set_pin_output(A0);
|
||||
gpio_set_pin_output(A1);
|
||||
gpio_set_pin_output(A2);
|
||||
gpio_set_pin_output(B4);
|
||||
gpio_set_pin_output(C7);
|
||||
gpio_set_pin_output(C2);
|
||||
gpio_set_pin_output(C3);
|
||||
gpio_set_pin_output(C5);
|
||||
}
|
||||
|
||||
static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) {
|
||||
|
@ -413,7 +413,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
|
|||
matrix_row_t last_row_value = current_matrix[row_index];
|
||||
|
||||
// Check row pin state
|
||||
if (readPin(row_pins[row_index]) == 0) {
|
||||
if (gpio_read_pin(row_pins[row_index]) == 0) {
|
||||
// Pin LO, set col bit
|
||||
current_matrix[row_index] |= (MATRIX_ROW_SHIFTER << current_col);
|
||||
} else {
|
||||
|
|
|
@ -18,22 +18,22 @@
|
|||
|
||||
|
||||
void led_init_ports(void) {
|
||||
setPinOutput(C0);
|
||||
setPinOutput(D0);
|
||||
setPinOutput(D1);
|
||||
setPinOutput(C1);
|
||||
setPinOutput(C6);
|
||||
setPinOutput(B0);
|
||||
setPinOutput(B1);
|
||||
setPinOutput(B2);
|
||||
gpio_set_pin_output(C0);
|
||||
gpio_set_pin_output(D0);
|
||||
gpio_set_pin_output(D1);
|
||||
gpio_set_pin_output(C1);
|
||||
gpio_set_pin_output(C6);
|
||||
gpio_set_pin_output(B0);
|
||||
gpio_set_pin_output(B1);
|
||||
gpio_set_pin_output(B2);
|
||||
}
|
||||
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
writePin(D1, layer_state_cmp(state, 1));
|
||||
writePin(D0, layer_state_cmp(state, 2));
|
||||
writePin(C1, layer_state_cmp(state, 3));
|
||||
writePin(C0, layer_state_cmp(state, 4));
|
||||
writePin(C6, layer_state_cmp(state, 5));
|
||||
gpio_write_pin(D1, layer_state_cmp(state, 1));
|
||||
gpio_write_pin(D0, layer_state_cmp(state, 2));
|
||||
gpio_write_pin(C1, layer_state_cmp(state, 3));
|
||||
gpio_write_pin(C0, layer_state_cmp(state, 4));
|
||||
gpio_write_pin(C6, layer_state_cmp(state, 5));
|
||||
|
||||
return state;
|
||||
}
|
||||
|
|
|
@ -22,20 +22,20 @@ void board_init(void) {
|
|||
}
|
||||
|
||||
void keyboard_pre_init_kb(void) {
|
||||
setPinOutput(B5);
|
||||
setPinOutput(B6);
|
||||
setPinOutput(B7);
|
||||
setPinOutput(B8);
|
||||
setPinOutput(B9);
|
||||
gpio_set_pin_output(B5);
|
||||
gpio_set_pin_output(B6);
|
||||
gpio_set_pin_output(B7);
|
||||
gpio_set_pin_output(B8);
|
||||
gpio_set_pin_output(B9);
|
||||
keyboard_pre_init_user();
|
||||
}
|
||||
|
||||
layer_state_t layer_state_set_kb(layer_state_t state) {
|
||||
state = layer_state_set_user(state);
|
||||
writePin(B7, layer_state_cmp(state, 0));
|
||||
writePin(B6, layer_state_cmp(state, 1));
|
||||
writePin(B5, layer_state_cmp(state, 2));
|
||||
writePin(B8, layer_state_cmp(state, 3));
|
||||
writePin(B9, layer_state_cmp(state, 4));
|
||||
gpio_write_pin(B7, layer_state_cmp(state, 0));
|
||||
gpio_write_pin(B6, layer_state_cmp(state, 1));
|
||||
gpio_write_pin(B5, layer_state_cmp(state, 2));
|
||||
gpio_write_pin(B8, layer_state_cmp(state, 3));
|
||||
gpio_write_pin(B9, layer_state_cmp(state, 4));
|
||||
return state;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ static void init_pins(void) {
|
|||
for (int col = 0; col < MATRIX_COLS; col++) {
|
||||
pin_t pin = direct_pins[row][col];
|
||||
if (pin != NO_PIN) {
|
||||
setPinInputHigh(pin);
|
||||
gpio_set_pin_input_high(pin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
|
|||
for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) {
|
||||
pin_t pin = direct_pins[current_row][col_index];
|
||||
if (pin != NO_PIN) {
|
||||
current_matrix[current_row] |= readPin(pin) ? 0 : (MATRIX_ROW_SHIFTER << col_index);
|
||||
current_matrix[current_row] |= gpio_read_pin(pin) ? 0 : (MATRIX_ROW_SHIFTER << col_index);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,103 +101,103 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
|
|||
static void select_col(uint8_t col) {
|
||||
switch (col) {
|
||||
case 0:
|
||||
writePinLow(B5);
|
||||
writePinLow(B7);
|
||||
writePinLow(F0);
|
||||
writePinHigh(B0);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_high(B0);
|
||||
break;
|
||||
case 1:
|
||||
writePinLow(B5);
|
||||
writePinLow(B7);
|
||||
writePinHigh(F0);
|
||||
writePinHigh(B0);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_high(B0);
|
||||
break;
|
||||
case 2:
|
||||
writePinLow(B5);
|
||||
writePinHigh(B7);
|
||||
writePinLow(F0);
|
||||
writePinHigh(B0);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_high(B0);
|
||||
break;
|
||||
case 3:
|
||||
writePinLow(B5);
|
||||
writePinHigh(B7);
|
||||
writePinHigh(F0);
|
||||
writePinHigh(B0);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_high(B0);
|
||||
break;
|
||||
case 4:
|
||||
writePinHigh(B5);
|
||||
writePinLow(B7);
|
||||
writePinLow(F0);
|
||||
writePinHigh(B0);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_high(B0);
|
||||
break;
|
||||
case 5:
|
||||
writePinHigh(B5);
|
||||
writePinLow(B7);
|
||||
writePinHigh(F0);
|
||||
writePinHigh(B0);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_high(B0);
|
||||
break;
|
||||
case 6:
|
||||
writePinHigh(B5);
|
||||
writePinHigh(B7);
|
||||
writePinLow(F0);
|
||||
writePinHigh(B0);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_high(B0);
|
||||
break;
|
||||
case 7:
|
||||
writePinHigh(B5);
|
||||
writePinHigh(B7);
|
||||
writePinHigh(F0);
|
||||
writePinHigh(B0);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_high(B0);
|
||||
break;
|
||||
case 8:
|
||||
writePinLow(B5);
|
||||
writePinLow(B7);
|
||||
writePinLow(F0);
|
||||
writePinHigh(F1);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_high(F1);
|
||||
break;
|
||||
case 9:
|
||||
writePinLow(B5);
|
||||
writePinLow(B7);
|
||||
writePinHigh(F0);
|
||||
writePinHigh(F1);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_high(F1);
|
||||
break;
|
||||
case 10:
|
||||
writePinLow(B5);
|
||||
writePinHigh(B7);
|
||||
writePinLow(F0);
|
||||
writePinHigh(F1);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_high(F1);
|
||||
break;
|
||||
case 11:
|
||||
writePinLow(B5);
|
||||
writePinHigh(B7);
|
||||
writePinHigh(F0);
|
||||
writePinHigh(F1);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_high(F1);
|
||||
break;
|
||||
case 12:
|
||||
writePinHigh(B5);
|
||||
writePinLow(B7);
|
||||
writePinLow(F0);
|
||||
writePinHigh(F1);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_high(F1);
|
||||
break;
|
||||
case 13:
|
||||
writePinHigh(B5);
|
||||
writePinLow(B7);
|
||||
writePinHigh(F0);
|
||||
writePinHigh(F1);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_high(F1);
|
||||
break;
|
||||
case 14:
|
||||
writePinHigh(B5);
|
||||
writePinHigh(B7);
|
||||
writePinHigh(F0);
|
||||
writePinHigh(F1);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_high(F1);
|
||||
break;
|
||||
case 15:
|
||||
writePinHigh(B5);
|
||||
writePinHigh(B7);
|
||||
writePinLow(F0);
|
||||
writePinHigh(F1);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_high(F1);
|
||||
break;
|
||||
case 16:
|
||||
writePinLow(E6);
|
||||
gpio_write_pin_low(E6);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -205,130 +205,130 @@ static void select_col(uint8_t col) {
|
|||
static void unselect_col(uint8_t col) {
|
||||
switch (col) {
|
||||
case 0:
|
||||
writePinHigh(B5);
|
||||
writePinHigh(B7);
|
||||
writePinHigh(F0);
|
||||
writePinLow(B0);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_low(B0);
|
||||
break;
|
||||
case 1:
|
||||
writePinHigh(B5);
|
||||
writePinHigh(B7);
|
||||
writePinLow(F0);
|
||||
writePinLow(B0);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_low(B0);
|
||||
break;
|
||||
case 2:
|
||||
writePinHigh(B5);
|
||||
writePinLow(B7);
|
||||
writePinHigh(F0);
|
||||
writePinLow(B0);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_low(B0);
|
||||
break;
|
||||
case 3:
|
||||
writePinHigh(B5);
|
||||
writePinLow(B7);
|
||||
writePinLow(F0);
|
||||
writePinLow(B0);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_low(B0);
|
||||
break;
|
||||
case 4:
|
||||
writePinLow(B5);
|
||||
writePinHigh(B7);
|
||||
writePinHigh(F0);
|
||||
writePinLow(B0);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_low(B0);
|
||||
break;
|
||||
case 5:
|
||||
writePinLow(B5);
|
||||
writePinHigh(B7);
|
||||
writePinLow(F0);
|
||||
writePinLow(B0);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_low(B0);
|
||||
break;
|
||||
case 6:
|
||||
writePinLow(B5);
|
||||
writePinLow(B7);
|
||||
writePinHigh(F0);
|
||||
writePinLow(B0);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_low(B0);
|
||||
break;
|
||||
case 7:
|
||||
writePinLow(B5);
|
||||
writePinLow(B7);
|
||||
writePinLow(F0);
|
||||
writePinLow(B0);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_low(B0);
|
||||
break;
|
||||
case 8:
|
||||
writePinHigh(B5);
|
||||
writePinHigh(B7);
|
||||
writePinHigh(F0);
|
||||
writePinLow(F1);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_low(F1);
|
||||
break;
|
||||
case 9:
|
||||
writePinHigh(B5);
|
||||
writePinHigh(B7);
|
||||
writePinLow(F0);
|
||||
writePinLow(F1);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_low(F1);
|
||||
break;
|
||||
case 10:
|
||||
writePinHigh(B5);
|
||||
writePinLow(B7);
|
||||
writePinHigh(F0);
|
||||
writePinLow(F1);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_low(F1);
|
||||
break;
|
||||
case 11:
|
||||
writePinHigh(B5);
|
||||
writePinLow(B7);
|
||||
writePinLow(F0);
|
||||
writePinLow(F1);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_low(F1);
|
||||
break;
|
||||
case 12:
|
||||
writePinLow(B5);
|
||||
writePinHigh(B7);
|
||||
writePinHigh(F0);
|
||||
writePinLow(F1);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_low(F1);
|
||||
break;
|
||||
case 13:
|
||||
writePinLow(B5);
|
||||
writePinHigh(B7);
|
||||
writePinLow(F0);
|
||||
writePinLow(F1);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_low(F1);
|
||||
break;
|
||||
case 14:
|
||||
writePinLow(B5);
|
||||
writePinLow(B7);
|
||||
writePinLow(F0);
|
||||
writePinLow(F1);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_low(F0);
|
||||
gpio_write_pin_low(F1);
|
||||
break;
|
||||
case 15:
|
||||
writePinLow(B5);
|
||||
writePinLow(B7);
|
||||
writePinHigh(F0);
|
||||
writePinLow(F1);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_low(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
gpio_write_pin_low(F1);
|
||||
break;
|
||||
case 16:
|
||||
writePinHigh(E6);
|
||||
gpio_write_pin_high(E6);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void unselect_cols(void) {
|
||||
//Native
|
||||
writePinHigh(E6);
|
||||
gpio_write_pin_high(E6);
|
||||
|
||||
//Demultiplexer
|
||||
writePinLow(B0);
|
||||
writePinLow(F1);
|
||||
writePinHigh(B5);
|
||||
writePinHigh(B7);
|
||||
writePinHigh(F0);
|
||||
gpio_write_pin_low(B0);
|
||||
gpio_write_pin_low(F1);
|
||||
gpio_write_pin_high(B5);
|
||||
gpio_write_pin_high(B7);
|
||||
gpio_write_pin_high(F0);
|
||||
}
|
||||
|
||||
static void init_pins(void) {
|
||||
unselect_cols();
|
||||
for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
|
||||
setPinInputHigh(row_pins[x]);
|
||||
gpio_set_pin_input_high(row_pins[x]);
|
||||
}
|
||||
setPinOutput(B5);
|
||||
setPinOutput(B7);
|
||||
setPinOutput(F0);
|
||||
setPinOutput(B0);
|
||||
setPinOutput(F1);
|
||||
setPinOutput(E6);
|
||||
gpio_set_pin_output(B5);
|
||||
gpio_set_pin_output(B7);
|
||||
gpio_set_pin_output(F0);
|
||||
gpio_set_pin_output(B0);
|
||||
gpio_set_pin_output(F1);
|
||||
gpio_set_pin_output(E6);
|
||||
}
|
||||
|
||||
static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) {
|
||||
|
@ -344,7 +344,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
|
|||
matrix_row_t last_row_value = current_matrix[row_index];
|
||||
|
||||
// Check row pin state
|
||||
if (readPin(row_pins[row_index]) == 0) {
|
||||
if (gpio_read_pin(row_pins[row_index]) == 0) {
|
||||
// Pin LO, set col bit
|
||||
current_matrix[row_index] |= (MATRIX_ROW_SHIFTER << current_col);
|
||||
} else {
|
||||
|
|
|
@ -20,5 +20,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
void keyboard_pre_init_user(void) {
|
||||
// Call the keyboard pre init code.
|
||||
// Set our LED pins as output
|
||||
setPinOutput(B7);
|
||||
gpio_set_pin_output(B7);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue