Update GPIO API usage in keyboard code (#23361)
This commit is contained in:
parent
5426a7a129
commit
d09a06a1b3
@ -165,8 +165,8 @@ static void init_cols(void) {
|
||||
pin_t matrix_col_pins_mcu[MATRIX_COLS_PER_SIDE] = MATRIX_COL_PINS_L;
|
||||
for (int pin_index = 0; pin_index < MATRIX_COLS_PER_SIDE; pin_index++) {
|
||||
pin_t pin = matrix_col_pins_mcu[pin_index];
|
||||
setPinInput(pin);
|
||||
writePinHigh(pin);
|
||||
gpio_set_pin_input(pin);
|
||||
gpio_write_pin_high(pin);
|
||||
}
|
||||
}
|
||||
|
||||
@ -177,7 +177,7 @@ static matrix_row_t read_cols(uint8_t row) {
|
||||
// For each col...
|
||||
for (uint8_t col_index = 0; col_index < MATRIX_COLS_PER_SIDE; col_index++) {
|
||||
// Select the col pin to read (active low)
|
||||
uint8_t pin_state = readPin(matrix_col_pins_mcu[col_index]);
|
||||
uint8_t pin_state = gpio_read_pin(matrix_col_pins_mcu[col_index]);
|
||||
|
||||
// Populate the matrix row with the state of the col pin
|
||||
current_row_value |= pin_state ? 0 : (MATRIX_ROW_SHIFTER << col_index);
|
||||
@ -223,8 +223,8 @@ static void unselect_rows(void) {
|
||||
pin_t matrix_row_pins_mcu[MATRIX_ROWS_PER_SIDE] = MATRIX_ROW_PINS_L;
|
||||
for (int pin_index = 0; pin_index < MATRIX_ROWS_PER_SIDE; pin_index++) {
|
||||
pin_t pin = matrix_row_pins_mcu[pin_index];
|
||||
setPinInput(pin);
|
||||
writePinLow(pin);
|
||||
gpio_set_pin_input(pin);
|
||||
gpio_write_pin_low(pin);
|
||||
}
|
||||
}
|
||||
|
||||
@ -236,8 +236,8 @@ static void select_row(uint8_t row) {
|
||||
// select on atmega32u4
|
||||
pin_t matrix_row_pins_mcu[MATRIX_ROWS_PER_SIDE] = MATRIX_ROW_PINS_L;
|
||||
pin_t pin = matrix_row_pins_mcu[row];
|
||||
setPinOutput(pin);
|
||||
writePinLow(pin);
|
||||
gpio_set_pin_output(pin);
|
||||
gpio_write_pin_low(pin);
|
||||
} else {
|
||||
// select on tca9555
|
||||
if (tca9555_status) { // if there was an error
|
||||
|
@ -165,8 +165,8 @@ static void init_cols(void) {
|
||||
pin_t matrix_col_pins_mcu[MATRIX_COLS_PER_SIDE] = MATRIX_COL_PINS_L;
|
||||
for (int pin_index = 0; pin_index < MATRIX_COLS_PER_SIDE; pin_index++) {
|
||||
pin_t pin = matrix_col_pins_mcu[pin_index];
|
||||
setPinInput(pin);
|
||||
writePinHigh(pin);
|
||||
gpio_set_pin_input(pin);
|
||||
gpio_write_pin_high(pin);
|
||||
}
|
||||
}
|
||||
|
||||
@ -177,7 +177,7 @@ static matrix_row_t read_cols(uint8_t row) {
|
||||
// For each col...
|
||||
for (uint8_t col_index = 0; col_index < MATRIX_COLS_PER_SIDE; col_index++) {
|
||||
// Select the col pin to read (active low)
|
||||
uint8_t pin_state = readPin(matrix_col_pins_mcu[col_index]);
|
||||
uint8_t pin_state = gpio_read_pin(matrix_col_pins_mcu[col_index]);
|
||||
|
||||
// Populate the matrix row with the state of the col pin
|
||||
current_row_value |= pin_state ? 0 : (MATRIX_ROW_SHIFTER << col_index);
|
||||
@ -221,8 +221,8 @@ static void unselect_rows(void) {
|
||||
pin_t matrix_row_pins_mcu[MATRIX_ROWS_PER_SIDE] = MATRIX_ROW_PINS_L;
|
||||
for (int pin_index = 0; pin_index < MATRIX_ROWS_PER_SIDE; pin_index++) {
|
||||
pin_t pin = matrix_row_pins_mcu[pin_index];
|
||||
setPinInput(pin);
|
||||
writePinLow(pin);
|
||||
gpio_set_pin_input(pin);
|
||||
gpio_write_pin_low(pin);
|
||||
}
|
||||
}
|
||||
|
||||
@ -233,8 +233,8 @@ static void select_row(uint8_t row) {
|
||||
// select on atmega32u4
|
||||
pin_t matrix_row_pins_mcu[MATRIX_ROWS_PER_SIDE] = MATRIX_ROW_PINS_L;
|
||||
pin_t pin = matrix_row_pins_mcu[row];
|
||||
setPinOutput(pin);
|
||||
writePinLow(pin);
|
||||
gpio_set_pin_output(pin);
|
||||
gpio_write_pin_low(pin);
|
||||
} else {
|
||||
// select on tca9555
|
||||
if (tca9555_status) { // if there was an error
|
||||
|
@ -23,8 +23,8 @@ void matrix_init_kb(void) {
|
||||
// put your keyboard start-up code here
|
||||
// runs once when the firmware starts up
|
||||
|
||||
setPinOutput(F4); // cathodes
|
||||
setPinOutput(F5); // cathodes
|
||||
gpio_set_pin_output(F4); // cathodes
|
||||
gpio_set_pin_output(F5); // cathodes
|
||||
|
||||
// Do the rest
|
||||
matrix_init_user();
|
||||
|
@ -16,9 +16,9 @@
|
||||
#include "quantum.h"
|
||||
|
||||
void matrix_init_kb(void) {
|
||||
setPinOutput(B6); // Backlight cathodes Col.3
|
||||
setPinOutput(F6); // Backlight cathodes Col.2
|
||||
setPinOutput(F7); // Backlight cathodes Col.1
|
||||
gpio_set_pin_output(B6); // Backlight cathodes Col.3
|
||||
gpio_set_pin_output(F6); // Backlight cathodes Col.2
|
||||
gpio_set_pin_output(F7); // Backlight cathodes Col.1
|
||||
|
||||
matrix_init_user();
|
||||
}
|
||||
|
@ -17,9 +17,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include "rev_a.h"
|
||||
|
||||
void board_init(void) {
|
||||
setPinInputHigh(CAPS_PIN);
|
||||
setPinInputHigh(SCROLL_PIN);
|
||||
setPinInputHigh(NUM_PIN);
|
||||
gpio_set_pin_input_high(CAPS_PIN);
|
||||
gpio_set_pin_input_high(SCROLL_PIN);
|
||||
gpio_set_pin_input_high(NUM_PIN);
|
||||
}
|
||||
|
||||
/* Set indicator leds to indicate lock states */
|
||||
@ -27,23 +27,23 @@ bool led_update_kb(led_t led_state) {
|
||||
bool res = led_update_user(led_state);
|
||||
if(res && LOCK_LIGHTS) {
|
||||
if(led_state.caps_lock){
|
||||
setPinOutput(CAPS_PIN);
|
||||
writePin(CAPS_PIN, 0);
|
||||
gpio_set_pin_output(CAPS_PIN);
|
||||
gpio_write_pin(CAPS_PIN, 0);
|
||||
}
|
||||
else
|
||||
setPinInputHigh(CAPS_PIN);
|
||||
gpio_set_pin_input_high(CAPS_PIN);
|
||||
if(led_state.scroll_lock){
|
||||
setPinOutput(SCROLL_PIN);
|
||||
writePin(SCROLL_PIN, 0);
|
||||
gpio_set_pin_output(SCROLL_PIN);
|
||||
gpio_write_pin(SCROLL_PIN, 0);
|
||||
}
|
||||
else
|
||||
setPinInputHigh(SCROLL_PIN);
|
||||
gpio_set_pin_input_high(SCROLL_PIN);
|
||||
if(led_state.num_lock){
|
||||
setPinOutput(NUM_PIN);
|
||||
writePin(NUM_PIN, 0);
|
||||
gpio_set_pin_output(NUM_PIN);
|
||||
gpio_write_pin(NUM_PIN, 0);
|
||||
}
|
||||
else
|
||||
setPinInputHigh(NUM_PIN);
|
||||
gpio_set_pin_input_high(NUM_PIN);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@ -59,50 +59,50 @@ layer_state_t layer_state_set_kb(layer_state_t state) {
|
||||
void setLayerLed(layer_state_t state){
|
||||
switch(get_highest_layer(state)){
|
||||
case 0 :
|
||||
setPinOutput(LAYER_1);
|
||||
writePin(LAYER_1, 0);
|
||||
setPinInputHigh(LAYER_2);
|
||||
setPinInputHigh(LAYER_3);
|
||||
setPinInputHigh(LAYER_4);
|
||||
setPinInputHigh(LAYER_5);
|
||||
gpio_set_pin_output(LAYER_1);
|
||||
gpio_write_pin(LAYER_1, 0);
|
||||
gpio_set_pin_input_high(LAYER_2);
|
||||
gpio_set_pin_input_high(LAYER_3);
|
||||
gpio_set_pin_input_high(LAYER_4);
|
||||
gpio_set_pin_input_high(LAYER_5);
|
||||
break;
|
||||
case 1 :
|
||||
setPinOutput(LAYER_2);
|
||||
writePin(LAYER_2, 0);
|
||||
setPinInputHigh(LAYER_1);
|
||||
setPinInputHigh(LAYER_3);
|
||||
setPinInputHigh(LAYER_4);
|
||||
setPinInputHigh(LAYER_5);
|
||||
gpio_set_pin_output(LAYER_2);
|
||||
gpio_write_pin(LAYER_2, 0);
|
||||
gpio_set_pin_input_high(LAYER_1);
|
||||
gpio_set_pin_input_high(LAYER_3);
|
||||
gpio_set_pin_input_high(LAYER_4);
|
||||
gpio_set_pin_input_high(LAYER_5);
|
||||
break;
|
||||
case 2 :
|
||||
setPinOutput(LAYER_3);
|
||||
writePin(LAYER_3, 0);
|
||||
setPinInputHigh(LAYER_1);
|
||||
setPinInputHigh(LAYER_2);
|
||||
setPinInputHigh(LAYER_4);
|
||||
setPinInputHigh(LAYER_5);
|
||||
gpio_set_pin_output(LAYER_3);
|
||||
gpio_write_pin(LAYER_3, 0);
|
||||
gpio_set_pin_input_high(LAYER_1);
|
||||
gpio_set_pin_input_high(LAYER_2);
|
||||
gpio_set_pin_input_high(LAYER_4);
|
||||
gpio_set_pin_input_high(LAYER_5);
|
||||
break;
|
||||
case 3 :
|
||||
writePin(LAYER_4, 0);
|
||||
setPinInputHigh(LAYER_5);
|
||||
setPinInputHigh(LAYER_1);
|
||||
setPinInputHigh(LAYER_2);
|
||||
setPinInputHigh(LAYER_3);
|
||||
setPinOutput(LAYER_4);
|
||||
gpio_write_pin(LAYER_4, 0);
|
||||
gpio_set_pin_input_high(LAYER_5);
|
||||
gpio_set_pin_input_high(LAYER_1);
|
||||
gpio_set_pin_input_high(LAYER_2);
|
||||
gpio_set_pin_input_high(LAYER_3);
|
||||
gpio_set_pin_output(LAYER_4);
|
||||
break;
|
||||
case 4 :
|
||||
setPinOutput(LAYER_5);
|
||||
writePin(LAYER_5, 0);
|
||||
setPinInputHigh(LAYER_1);
|
||||
setPinInputHigh(LAYER_2);
|
||||
setPinInputHigh(LAYER_3);
|
||||
setPinInputHigh(LAYER_4);
|
||||
gpio_set_pin_output(LAYER_5);
|
||||
gpio_write_pin(LAYER_5, 0);
|
||||
gpio_set_pin_input_high(LAYER_1);
|
||||
gpio_set_pin_input_high(LAYER_2);
|
||||
gpio_set_pin_input_high(LAYER_3);
|
||||
gpio_set_pin_input_high(LAYER_4);
|
||||
break;
|
||||
default :
|
||||
setPinInputHigh(LAYER_1);
|
||||
setPinInputHigh(LAYER_2);
|
||||
setPinInputHigh(LAYER_3);
|
||||
setPinInputHigh(LAYER_4);
|
||||
setPinInputHigh(LAYER_5);
|
||||
gpio_set_pin_input_high(LAYER_1);
|
||||
gpio_set_pin_input_high(LAYER_2);
|
||||
gpio_set_pin_input_high(LAYER_3);
|
||||
gpio_set_pin_input_high(LAYER_4);
|
||||
gpio_set_pin_input_high(LAYER_5);
|
||||
}
|
||||
}
|
||||
|
@ -17,11 +17,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include "rev_b.h"
|
||||
|
||||
void keyboard_pre_init_kb(void) {
|
||||
setPinOutput(LAYER_1);
|
||||
setPinOutput(LAYER_2);
|
||||
setPinOutput(LAYER_3);
|
||||
setPinOutput(LAYER_4);
|
||||
setPinOutput(LAYER_5);
|
||||
gpio_set_pin_output(LAYER_1);
|
||||
gpio_set_pin_output(LAYER_2);
|
||||
gpio_set_pin_output(LAYER_3);
|
||||
gpio_set_pin_output(LAYER_4);
|
||||
gpio_set_pin_output(LAYER_5);
|
||||
keyboard_pre_init_user();
|
||||
}
|
||||
|
||||
@ -32,26 +32,26 @@ layer_state_t layer_state_set_kb(layer_state_t state) {
|
||||
}
|
||||
/* Set indicator leds to indicate which layer is active */
|
||||
void setLayerLed(layer_state_t state){
|
||||
writePinLow(LAYER_1);
|
||||
writePinLow(LAYER_2);
|
||||
writePinLow(LAYER_3);
|
||||
writePinLow(LAYER_4);
|
||||
writePinLow(LAYER_5);
|
||||
gpio_write_pin_low(LAYER_1);
|
||||
gpio_write_pin_low(LAYER_2);
|
||||
gpio_write_pin_low(LAYER_3);
|
||||
gpio_write_pin_low(LAYER_4);
|
||||
gpio_write_pin_low(LAYER_5);
|
||||
switch (get_highest_layer(state)) {
|
||||
case 0:
|
||||
writePinHigh(LAYER_1);
|
||||
gpio_write_pin_high(LAYER_1);
|
||||
break;
|
||||
case 1:
|
||||
writePinHigh(LAYER_2);
|
||||
gpio_write_pin_high(LAYER_2);
|
||||
break;
|
||||
case 2:
|
||||
writePinHigh(LAYER_3);
|
||||
gpio_write_pin_high(LAYER_3);
|
||||
break;
|
||||
case 3:
|
||||
writePinHigh(LAYER_4);
|
||||
gpio_write_pin_high(LAYER_4);
|
||||
break;
|
||||
case 4:
|
||||
writePinHigh(LAYER_5);
|
||||
gpio_write_pin_high(LAYER_5);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -18,8 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include "quantum.h"
|
||||
|
||||
void board_init(void) {
|
||||
setPinInput(B9);
|
||||
setPinInput(B10);
|
||||
gpio_set_pin_input(B9);
|
||||
gpio_set_pin_input(B10);
|
||||
}
|
||||
|
||||
led_config_t g_led_config = { {
|
||||
|
@ -18,8 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include "quantum.h"
|
||||
|
||||
void board_init(void) {
|
||||
setPinInput(B9);
|
||||
setPinInput(B10);
|
||||
gpio_set_pin_input(B9);
|
||||
gpio_set_pin_input(B10);
|
||||
}
|
||||
|
||||
led_config_t g_led_config = { {
|
||||
|
@ -17,8 +17,8 @@
|
||||
#include "quantum.h"
|
||||
|
||||
void board_init(void) {
|
||||
setPinInput(B6);
|
||||
setPinInput(B7);
|
||||
gpio_set_pin_input(B6);
|
||||
gpio_set_pin_input(B7);
|
||||
}
|
||||
|
||||
void keyboard_post_init_kb(void){
|
||||
@ -34,10 +34,10 @@ bool led_update_kb(led_t led_state) {
|
||||
bool res = led_update_user(led_state);
|
||||
#ifdef CAPSLOCK_INDICATOR
|
||||
if(res) {
|
||||
writePin(LED_CAPS_LOCK_PIN, !led_state.caps_lock);
|
||||
gpio_write_pin(LED_CAPS_LOCK_PIN, !led_state.caps_lock);
|
||||
}
|
||||
#else
|
||||
writePin(LED_CAPS_LOCK_PIN, 0);
|
||||
gpio_write_pin(LED_CAPS_LOCK_PIN, 0);
|
||||
#endif
|
||||
return res;
|
||||
}
|
||||
|
@ -17,18 +17,18 @@
|
||||
#include "quantum.h"
|
||||
|
||||
void board_init(void) {
|
||||
setPinInput(B6);
|
||||
setPinInput(B7);
|
||||
gpio_set_pin_input(B6);
|
||||
gpio_set_pin_input(B7);
|
||||
}
|
||||
|
||||
bool led_update_kb(led_t led_state) {
|
||||
bool res = led_update_user(led_state);
|
||||
#ifdef CAPSLOCK_INDICATOR
|
||||
if(res) {
|
||||
writePin(LED_CAPS_LOCK_PIN, led_state.caps_lock);
|
||||
gpio_write_pin(LED_CAPS_LOCK_PIN, led_state.caps_lock);
|
||||
}
|
||||
#else
|
||||
writePin(LED_CAPS_LOCK_PIN, 0);
|
||||
gpio_write_pin(LED_CAPS_LOCK_PIN, 0);
|
||||
#endif
|
||||
return res;
|
||||
}
|
||||
|
@ -1,18 +1,18 @@
|
||||
#include "quantum.h"
|
||||
|
||||
void keyboard_pre_init_kb(void) {
|
||||
setPinOutput(A0);
|
||||
setPinOutput(A1);
|
||||
setPinOutput(A2);
|
||||
gpio_set_pin_output(A0);
|
||||
gpio_set_pin_output(A1);
|
||||
gpio_set_pin_output(A2);
|
||||
|
||||
keyboard_pre_init_user();
|
||||
}
|
||||
|
||||
bool led_update_kb(led_t led_state) {
|
||||
if (led_update_user(led_state)) {
|
||||
writePin(A2, led_state.num_lock);
|
||||
writePin(A0, led_state.caps_lock);
|
||||
writePin(A1, led_state.scroll_lock);
|
||||
gpio_write_pin(A2, led_state.num_lock);
|
||||
gpio_write_pin(A0, led_state.caps_lock);
|
||||
gpio_write_pin(A1, led_state.scroll_lock);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -30,18 +30,18 @@ void led_init_ports(void) {
|
||||
bool led_update_kb(led_t led_state) {
|
||||
bool res = led_update_user(led_state);
|
||||
if(res) {
|
||||
writePin(LED1_PIN, !led_state.num_lock);
|
||||
writePin(LED2_PIN, !led_state.caps_lock);
|
||||
writePin(LED3_PIN, !led_state.scroll_lock);
|
||||
gpio_write_pin(LED1_PIN, !led_state.num_lock);
|
||||
gpio_write_pin(LED2_PIN, !led_state.caps_lock);
|
||||
gpio_write_pin(LED3_PIN, !led_state.scroll_lock);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
// Turns off all bottom LEDs
|
||||
void turn_off_bottom_leds(void){
|
||||
writePin(LED4_PIN, 1);
|
||||
writePin(LED5_PIN, 1);
|
||||
writePin(LED6_PIN, 1);
|
||||
gpio_write_pin(LED4_PIN, 1);
|
||||
gpio_write_pin(LED5_PIN, 1);
|
||||
gpio_write_pin(LED6_PIN, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -53,19 +53,19 @@ layer_state_t layer_state_set_kb(layer_state_t state) {
|
||||
switch (get_highest_layer(state)) {
|
||||
// The base layer, or layer zero, will be handled by the default case.
|
||||
case 1:
|
||||
writePin(LED4_PIN, 1);
|
||||
writePin(LED5_PIN, 0);
|
||||
writePin(LED6_PIN, 1);
|
||||
gpio_write_pin(LED4_PIN, 1);
|
||||
gpio_write_pin(LED5_PIN, 0);
|
||||
gpio_write_pin(LED6_PIN, 1);
|
||||
break;
|
||||
case 2:
|
||||
writePin(LED4_PIN, 1);
|
||||
writePin(LED5_PIN, 1);
|
||||
writePin(LED6_PIN, 0);
|
||||
gpio_write_pin(LED4_PIN, 1);
|
||||
gpio_write_pin(LED5_PIN, 1);
|
||||
gpio_write_pin(LED6_PIN, 0);
|
||||
break;
|
||||
default:
|
||||
writePin(LED4_PIN, 0);
|
||||
writePin(LED5_PIN, 1);
|
||||
writePin(LED6_PIN, 1);
|
||||
gpio_write_pin(LED4_PIN, 0);
|
||||
gpio_write_pin(LED5_PIN, 1);
|
||||
gpio_write_pin(LED6_PIN, 1);
|
||||
break;
|
||||
}
|
||||
return state;
|
||||
@ -73,5 +73,5 @@ layer_state_t layer_state_set_kb(layer_state_t state) {
|
||||
|
||||
// Since the keyboard starts at layer 0, the init function starts LED4 as lit up.
|
||||
void keyboard_post_init_kb(void){
|
||||
writePin(LED4_PIN, 0);
|
||||
gpio_write_pin(LED4_PIN, 0);
|
||||
}
|
||||
|
@ -17,6 +17,6 @@
|
||||
#include "quantum.h"
|
||||
|
||||
void board_init(void) {
|
||||
setPinInput(B6);
|
||||
setPinInput(B7);
|
||||
gpio_set_pin_input(B6);
|
||||
gpio_set_pin_input(B7);
|
||||
}
|
||||
|
@ -19,18 +19,18 @@
|
||||
void keyboard_pre_init_user(void) {
|
||||
// Call the keyboard pre init code.
|
||||
// Set our LED pins as output
|
||||
setPinOutput(D5);
|
||||
setPinOutput(D3);
|
||||
setPinOutput(D2);
|
||||
setPinOutput(D1);
|
||||
gpio_set_pin_output(D5);
|
||||
gpio_set_pin_output(D3);
|
||||
gpio_set_pin_output(D2);
|
||||
gpio_set_pin_output(D1);
|
||||
}
|
||||
|
||||
bool led_update_kb(led_t led_state) {
|
||||
bool res = led_update_user(led_state);
|
||||
if(res) {
|
||||
writePin(D5, led_state.num_lock);
|
||||
writePin(D3, led_state.caps_lock);
|
||||
writePin(D2, led_state.scroll_lock);
|
||||
gpio_write_pin(D5, led_state.num_lock);
|
||||
gpio_write_pin(D3, led_state.caps_lock);
|
||||
gpio_write_pin(D2, led_state.scroll_lock);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@ -38,10 +38,10 @@ bool led_update_kb(led_t led_state) {
|
||||
layer_state_t layer_state_set_kb(layer_state_t state) {
|
||||
switch (get_highest_layer(state)) {
|
||||
case 1:
|
||||
writePinHigh(D1);
|
||||
gpio_write_pin_high(D1);
|
||||
break;
|
||||
default: // for any other layers, or the default layer
|
||||
writePinLow(D1);
|
||||
gpio_write_pin_low(D1);
|
||||
break;
|
||||
}
|
||||
return layer_state_set_user(state);
|
||||
|
@ -71,10 +71,10 @@ bool oled_task_kb(void) {
|
||||
void keyboard_pre_init_kb(void) {
|
||||
// Call the keyboard pre init code.
|
||||
// Set our LED pins as output
|
||||
setPinOutput(B4);
|
||||
setPinOutput(B3);
|
||||
setPinOutput(A15);
|
||||
setPinOutput(A14);
|
||||
gpio_set_pin_output(B4);
|
||||
gpio_set_pin_output(B3);
|
||||
gpio_set_pin_output(A15);
|
||||
gpio_set_pin_output(A14);
|
||||
|
||||
keyboard_pre_init_user();
|
||||
}
|
||||
@ -82,9 +82,9 @@ void keyboard_pre_init_kb(void) {
|
||||
bool led_update_kb(led_t led_state) {
|
||||
bool res = led_update_user(led_state);
|
||||
if (res) {
|
||||
writePin(B4, led_state.num_lock);
|
||||
writePin(B3, led_state.caps_lock);
|
||||
writePin(A15, led_state.scroll_lock);
|
||||
gpio_write_pin(B4, led_state.num_lock);
|
||||
gpio_write_pin(B3, led_state.caps_lock);
|
||||
gpio_write_pin(A15, led_state.scroll_lock);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@ -92,10 +92,10 @@ bool led_update_kb(led_t led_state) {
|
||||
layer_state_t layer_state_set_kb(layer_state_t state) {
|
||||
switch (get_highest_layer(state)) {
|
||||
case 1:
|
||||
writePinHigh(A14);
|
||||
gpio_write_pin_high(A14);
|
||||
break;
|
||||
default: // for any other layers, or the default layer
|
||||
writePinLow(A14);
|
||||
gpio_write_pin_low(A14);
|
||||
break;
|
||||
}
|
||||
return layer_state_set_user(state);
|
||||
|
@ -22,16 +22,16 @@ void matrix_io_delay(void) { __asm__ volatile("nop\nnop\nnop\n"); }
|
||||
void keyboard_pre_init_user(void) {
|
||||
// Call the keyboard pre init code.
|
||||
// Set our LED pins as output
|
||||
setPinOutput(LED_LAYERS_PIN);
|
||||
gpio_set_pin_output(LED_LAYERS_PIN);
|
||||
}
|
||||
|
||||
layer_state_t layer_state_set_kb(layer_state_t state) {
|
||||
switch (get_highest_layer(state)) {
|
||||
case 1:
|
||||
writePinHigh(LED_LAYERS_PIN);
|
||||
gpio_write_pin_high(LED_LAYERS_PIN);
|
||||
break;
|
||||
default: // for any other layers, or the default layer
|
||||
writePinLow(LED_LAYERS_PIN);
|
||||
gpio_write_pin_low(LED_LAYERS_PIN);
|
||||
break;
|
||||
}
|
||||
return layer_state_set_user(state);
|
||||
|
@ -19,13 +19,13 @@
|
||||
void led_init_ports(void) {
|
||||
// Initialize indicator LEDs to output
|
||||
if (isLeftHand) {
|
||||
setPinOutput(C6);
|
||||
setPinOutput(B6);
|
||||
setPinOutput(B5);
|
||||
gpio_set_pin_output(C6);
|
||||
gpio_set_pin_output(B6);
|
||||
gpio_set_pin_output(B5);
|
||||
} else {
|
||||
setPinOutput(F6);
|
||||
setPinOutput(F7);
|
||||
setPinOutput(C7);
|
||||
gpio_set_pin_output(F6);
|
||||
gpio_set_pin_output(F7);
|
||||
gpio_set_pin_output(C7);
|
||||
}
|
||||
|
||||
set_layer_indicators(0);
|
||||
@ -40,15 +40,15 @@ void led_toggle(uint8_t id, bool on) {
|
||||
switch (id) {
|
||||
case 0:
|
||||
// Left hand C6
|
||||
writePin(C6, on);
|
||||
gpio_write_pin(C6, on);
|
||||
break;
|
||||
case 1:
|
||||
// Left hand B6
|
||||
writePin(B6, on);
|
||||
gpio_write_pin(B6, on);
|
||||
break;
|
||||
case 2:
|
||||
// Left hand B5
|
||||
writePin(B5, on);
|
||||
gpio_write_pin(B5, on);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -57,15 +57,15 @@ void led_toggle(uint8_t id, bool on) {
|
||||
switch (id) {
|
||||
case 3:
|
||||
// Right hand F6
|
||||
writePin(F6, on);
|
||||
gpio_write_pin(F6, on);
|
||||
break;
|
||||
case 4:
|
||||
// Right hand F7
|
||||
writePin(F7, on);
|
||||
gpio_write_pin(F7, on);
|
||||
break;
|
||||
case 5:
|
||||
// Right hand C7
|
||||
writePin(C7, on);
|
||||
gpio_write_pin(C7, on);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -19,8 +19,8 @@
|
||||
void matrix_init_kb(void) {
|
||||
// Initialize indicator LEDs to output
|
||||
|
||||
setPinOutput(B7); // Caps
|
||||
setPinOutput(A5); // Slck
|
||||
gpio_set_pin_output(B7); // Caps
|
||||
gpio_set_pin_output(A5); // Slck
|
||||
|
||||
matrix_init_user();
|
||||
}
|
||||
@ -30,8 +30,8 @@ bool led_update_kb(led_t led_state) {
|
||||
bool res = led_update_user(led_state);
|
||||
|
||||
if(res) {
|
||||
writePin(B7, !led_state.caps_lock);
|
||||
writePin(A5, !led_state.scroll_lock);
|
||||
gpio_write_pin(B7, !led_state.caps_lock);
|
||||
gpio_write_pin(A5, !led_state.scroll_lock);
|
||||
}
|
||||
return res;
|
||||
}
|
@ -137,17 +137,17 @@ enum __layers {
|
||||
// clang-format on
|
||||
|
||||
void matrix_init_kb(void) {
|
||||
setPinOutput(LED_MAC_OS_PIN); // LDE2 MAC\WIN
|
||||
writePinLow(LED_MAC_OS_PIN);
|
||||
setPinOutput(LED_WIN_LOCK_PIN); // LED3 Win Lock
|
||||
writePinLow(LED_WIN_LOCK_PIN);
|
||||
gpio_set_pin_output(LED_MAC_OS_PIN); // LDE2 MAC\WIN
|
||||
gpio_write_pin_low(LED_MAC_OS_PIN);
|
||||
gpio_set_pin_output(LED_WIN_LOCK_PIN); // LED3 Win Lock
|
||||
gpio_write_pin_low(LED_WIN_LOCK_PIN);
|
||||
|
||||
matrix_init_user();
|
||||
}
|
||||
|
||||
void housekeeping_task_kb(void){
|
||||
writePin(LED_MAC_OS_PIN, (get_highest_layer(default_layer_state) == 3));
|
||||
writePin(LED_WIN_LOCK_PIN, keymap_config.no_gui);
|
||||
gpio_write_pin(LED_MAC_OS_PIN, (get_highest_layer(default_layer_state) == 3));
|
||||
gpio_write_pin(LED_WIN_LOCK_PIN, keymap_config.no_gui);
|
||||
}
|
||||
|
||||
bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
|
||||
|
@ -148,15 +148,15 @@ const snled27351_led_t PROGMEM g_snled27351_leds[SNLED27351_LED_COUNT] = {
|
||||
#endif
|
||||
|
||||
void keyboard_pre_init_kb(void) {
|
||||
setPinOutput(LED_WIN_LOCK_PIN); // LED3 Win Lock
|
||||
writePinLow(LED_WIN_LOCK_PIN);
|
||||
gpio_set_pin_output(LED_WIN_LOCK_PIN); // LED3 Win Lock
|
||||
gpio_write_pin_low(LED_WIN_LOCK_PIN);
|
||||
keyboard_pre_init_user();
|
||||
}
|
||||
|
||||
bool led_update_kb(led_t led_state) {
|
||||
bool res = led_update_user(led_state);
|
||||
if (res) {
|
||||
writePin(LED_WIN_LOCK_PIN, keymap_config.no_gui);
|
||||
gpio_write_pin(LED_WIN_LOCK_PIN, keymap_config.no_gui);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ static void select_col(uint8_t col) {
|
||||
|
||||
static void init_pins(void) {
|
||||
for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
|
||||
setPinInputHigh(row_pins[x]);
|
||||
gpio_set_pin_input_high(row_pins[x]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,7 +65,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 {
|
||||
|
@ -6,8 +6,8 @@
|
||||
|
||||
void keyboard_post_init_kb(void) {
|
||||
// Enable RGB LED
|
||||
setPinOutput(GP11);
|
||||
writePinHigh(GP11);
|
||||
gpio_set_pin_output(GP11);
|
||||
gpio_write_pin_high(GP11);
|
||||
rgblight_enable();
|
||||
|
||||
// Offload to the user func
|
||||
|
@ -6,8 +6,8 @@
|
||||
|
||||
void keyboard_post_init_kb(void) {
|
||||
// Enable RGB LED
|
||||
setPinOutput(GP11);
|
||||
writePinHigh(GP11);
|
||||
gpio_set_pin_output(GP11);
|
||||
gpio_write_pin_high(GP11);
|
||||
rgblight_enable();
|
||||
|
||||
// Offload to the user func
|
||||
|
@ -26,27 +26,27 @@ static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
|
||||
|
||||
static inline void setPinOutput_writeLow(pin_t pin) {
|
||||
ATOMIC_BLOCK_FORCEON {
|
||||
setPinOutput(pin);
|
||||
writePinLow(pin);
|
||||
gpio_set_pin_output(pin);
|
||||
gpio_write_pin_low(pin);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void setPinOutput_writeHigh(pin_t pin) {
|
||||
ATOMIC_BLOCK_FORCEON {
|
||||
setPinOutput(pin);
|
||||
writePinHigh(pin);
|
||||
gpio_set_pin_output(pin);
|
||||
gpio_write_pin_high(pin);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void setPinInputHigh_atomic(pin_t pin) {
|
||||
ATOMIC_BLOCK_FORCEON {
|
||||
setPinInputHigh(pin);
|
||||
gpio_set_pin_input_high(pin);
|
||||
}
|
||||
}
|
||||
|
||||
static inline uint8_t readMatrixPin(pin_t pin) {
|
||||
if (pin != NO_PIN) {
|
||||
return (readPin(pin) == 0) ? 0 : 1;
|
||||
return (gpio_read_pin(pin) == 0) ? 0 : 1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
|
@ -17,5 +17,5 @@
|
||||
|
||||
void led_init_ports(void) {
|
||||
// Set our LED pins as open drain outputs
|
||||
setPinOutputOpenDrain(LED_CAPS_LOCK_PIN);
|
||||
gpio_set_pin_output_open_drain(LED_CAPS_LOCK_PIN);
|
||||
}
|
||||
|
@ -5,26 +5,26 @@
|
||||
|
||||
layer_state_t layer_state_set_kb(layer_state_t state) {
|
||||
/* Display current layer using indicator LEDs */
|
||||
writePin(LED_INDICATOR_0_PIN, !IS_LAYER_ON_STATE(state, 1));
|
||||
writePin(LED_INDICATOR_1_PIN, !IS_LAYER_ON_STATE(state, 2));
|
||||
writePin(LED_INDICATOR_2_PIN, !IS_LAYER_ON_STATE(state, 3));
|
||||
gpio_write_pin(LED_INDICATOR_0_PIN, !IS_LAYER_ON_STATE(state, 1));
|
||||
gpio_write_pin(LED_INDICATOR_1_PIN, !IS_LAYER_ON_STATE(state, 2));
|
||||
gpio_write_pin(LED_INDICATOR_2_PIN, !IS_LAYER_ON_STATE(state, 3));
|
||||
return layer_state_set_user(state);
|
||||
}
|
||||
|
||||
void keyboard_pre_init_kb(void) {
|
||||
/* Set indicator LEDs as outputs */
|
||||
setPinOutput(LED_INDICATOR_0_PIN);
|
||||
setPinOutput(LED_INDICATOR_1_PIN);
|
||||
setPinOutput(LED_INDICATOR_2_PIN);
|
||||
gpio_set_pin_output(LED_INDICATOR_0_PIN);
|
||||
gpio_set_pin_output(LED_INDICATOR_1_PIN);
|
||||
gpio_set_pin_output(LED_INDICATOR_2_PIN);
|
||||
keyboard_pre_init_user();
|
||||
}
|
||||
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
void suspend_power_down_kb(void) {
|
||||
/* Disable indicator LEDs when going to sleep */
|
||||
writePin(LED_INDICATOR_0_PIN, 1);
|
||||
writePin(LED_INDICATOR_1_PIN, 1);
|
||||
writePin(LED_INDICATOR_2_PIN, 1);
|
||||
gpio_write_pin(LED_INDICATOR_0_PIN, 1);
|
||||
gpio_write_pin(LED_INDICATOR_1_PIN, 1);
|
||||
gpio_write_pin(LED_INDICATOR_2_PIN, 1);
|
||||
suspend_power_down_user();
|
||||
}
|
||||
|
||||
|
@ -21,8 +21,8 @@ void matrix_init_kb(void) {
|
||||
// runs once when the firmware starts up
|
||||
|
||||
// Turn status LED on
|
||||
setPinOutput(E6);
|
||||
writePinHigh(E6);
|
||||
gpio_set_pin_output(E6);
|
||||
gpio_write_pin_high(E6);
|
||||
|
||||
matrix_init_user();
|
||||
}
|
||||
|
@ -53,17 +53,17 @@ uint8_t bajjak_left_leds_update(void);
|
||||
#endif
|
||||
|
||||
|
||||
inline void bajjak_board_led_on(void) { setPinOutput(D6); writePinHigh(D6); }
|
||||
inline void bajjak_right_led_1_on(void) { setPinOutput(B5); writePinHigh(B5); }
|
||||
inline void bajjak_right_led_2_on(void) { setPinOutput(B6); writePinHigh(B6); }
|
||||
inline void bajjak_right_led_3_on(void) { setPinOutput(B7); writePinHigh(B7); }
|
||||
inline void bajjak_right_led_on(uint8_t led) { setPinOutput(led+4); writePinHigh(led+4); }
|
||||
inline void bajjak_board_led_on(void) { gpio_set_pin_output(D6); gpio_write_pin_high(D6); }
|
||||
inline void bajjak_right_led_1_on(void) { gpio_set_pin_output(B5); gpio_write_pin_high(B5); }
|
||||
inline void bajjak_right_led_2_on(void) { gpio_set_pin_output(B6); gpio_write_pin_high(B6); }
|
||||
inline void bajjak_right_led_3_on(void) { gpio_set_pin_output(B7); gpio_write_pin_high(B7); }
|
||||
inline void bajjak_right_led_on(uint8_t led) { gpio_set_pin_output(led+4); gpio_write_pin_high(led+4); }
|
||||
|
||||
inline void bajjak_board_led_off(void) { setPinInput(D6); writePinLow(D6); }
|
||||
inline void bajjak_right_led_1_off(void) { setPinInput(B5); writePinLow(B5); }
|
||||
inline void bajjak_right_led_2_off(void) { setPinInput(B6); writePinLow(B6); }
|
||||
inline void bajjak_right_led_3_off(void) { setPinInput(B7); writePinLow(B7); }
|
||||
inline void bajjak_right_led_off(uint8_t led) { setPinInput(led+4); writePinLow(led+4); }
|
||||
inline void bajjak_board_led_off(void) { gpio_set_pin_input(D6); gpio_write_pin_low(D6); }
|
||||
inline void bajjak_right_led_1_off(void) { gpio_set_pin_input(B5); gpio_write_pin_low(B5); }
|
||||
inline void bajjak_right_led_2_off(void) { gpio_set_pin_input(B6); gpio_write_pin_low(B6); }
|
||||
inline void bajjak_right_led_3_off(void) { gpio_set_pin_input(B7); gpio_write_pin_low(B7); }
|
||||
inline void bajjak_right_led_off(uint8_t led) { gpio_set_pin_input(led+4); gpio_write_pin_low(led+4); }
|
||||
|
||||
#ifdef LEFT_LEDS
|
||||
bool bajjak_left_led_1;
|
||||
|
@ -128,13 +128,13 @@ static void init_cols(void) {
|
||||
// not needed, already done as part of init_mcp23018()
|
||||
|
||||
// init on teensy
|
||||
setPinInputHigh(F0);
|
||||
setPinInputHigh(F1);
|
||||
setPinInputHigh(F4);
|
||||
setPinInputHigh(F5);
|
||||
setPinInputHigh(F6);
|
||||
setPinInputHigh(F7);
|
||||
setPinInputHigh(D7);
|
||||
gpio_set_pin_input_high(F0);
|
||||
gpio_set_pin_input_high(F1);
|
||||
gpio_set_pin_input_high(F4);
|
||||
gpio_set_pin_input_high(F5);
|
||||
gpio_set_pin_input_high(F6);
|
||||
gpio_set_pin_input_high(F7);
|
||||
gpio_set_pin_input_high(D7);
|
||||
}
|
||||
|
||||
static matrix_row_t read_cols(uint8_t row) {
|
||||
@ -175,13 +175,13 @@ static void unselect_rows(void) {
|
||||
// direction
|
||||
|
||||
// unselect on teensy
|
||||
setPinInput(B0);
|
||||
setPinInput(B1);
|
||||
setPinInput(B2);
|
||||
setPinInput(B3);
|
||||
setPinInput(D2);
|
||||
setPinInput(D3);
|
||||
setPinInput(C6);
|
||||
gpio_set_pin_input(B0);
|
||||
gpio_set_pin_input(B1);
|
||||
gpio_set_pin_input(B2);
|
||||
gpio_set_pin_input(B3);
|
||||
gpio_set_pin_input(D2);
|
||||
gpio_set_pin_input(D3);
|
||||
gpio_set_pin_input(C6);
|
||||
}
|
||||
|
||||
static void select_row(uint8_t row) {
|
||||
@ -200,32 +200,32 @@ static void select_row(uint8_t row) {
|
||||
// Output low(DDR:1, PORT:0) to select
|
||||
switch (row) {
|
||||
case 7:
|
||||
setPinOutput(B0);
|
||||
writePinLow(B0);
|
||||
gpio_set_pin_output(B0);
|
||||
gpio_write_pin_low(B0);
|
||||
break;
|
||||
case 8:
|
||||
setPinOutput(B1);
|
||||
writePinLow(B1);
|
||||
gpio_set_pin_output(B1);
|
||||
gpio_write_pin_low(B1);
|
||||
break;
|
||||
case 9:
|
||||
setPinOutput(B2);
|
||||
writePinLow(B2);
|
||||
gpio_set_pin_output(B2);
|
||||
gpio_write_pin_low(B2);
|
||||
break;
|
||||
case 10:
|
||||
setPinOutput(B3);
|
||||
writePinLow(B3);
|
||||
gpio_set_pin_output(B3);
|
||||
gpio_write_pin_low(B3);
|
||||
break;
|
||||
case 11:
|
||||
setPinOutput(D2);
|
||||
writePinLow(D2);
|
||||
gpio_set_pin_output(D2);
|
||||
gpio_write_pin_low(D2);
|
||||
break;
|
||||
case 12:
|
||||
setPinOutput(D3);
|
||||
writePinLow(D3);
|
||||
gpio_set_pin_output(D3);
|
||||
gpio_write_pin_low(D3);
|
||||
break;
|
||||
case 13:
|
||||
setPinOutput(C6);
|
||||
writePinLow(C6);
|
||||
gpio_set_pin_output(C6);
|
||||
gpio_write_pin_low(C6);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -70,14 +70,14 @@ led_config_t g_led_config = {
|
||||
|
||||
#if defined(SPLIT_HAND_MATRIX_GRID)
|
||||
static uint8_t peek_matrix_intersection(pin_t out_pin, pin_t in_pin) {
|
||||
setPinInputHigh(in_pin);
|
||||
setPinOutput(out_pin);
|
||||
writePinLow(out_pin);
|
||||
gpio_set_pin_input_high(in_pin);
|
||||
gpio_set_pin_output(out_pin);
|
||||
gpio_write_pin_low(out_pin);
|
||||
// It's almost unnecessary, but wait until it's down to low, just in case.
|
||||
wait_us(1);
|
||||
uint8_t pin_state = readPin(in_pin);
|
||||
uint8_t pin_state = gpio_read_pin(in_pin);
|
||||
// Set out_pin to a setting that is less susceptible to noise.
|
||||
setPinInputHigh(out_pin);
|
||||
gpio_set_pin_input_high(out_pin);
|
||||
matrix_io_delay(); // Wait for the pull-up to go HIGH.
|
||||
return pin_state;
|
||||
}
|
||||
@ -93,8 +93,8 @@ static enum { UNKNOWN, LEFT, RIGHT } hand_side = UNKNOWN;
|
||||
if (hand_side == UNKNOWN) {
|
||||
#if defined(SPLIT_HAND_PIN)
|
||||
// Test pin SPLIT_HAND_PIN for High/Low, if low it's right hand
|
||||
setPinInput(SPLIT_HAND_PIN);
|
||||
hand_side = readPin(SPLIT_HAND_PIN) ? LEFT : RIGHT;
|
||||
gpio_set_pin_input(SPLIT_HAND_PIN);
|
||||
hand_side = gpio_read_pin(SPLIT_HAND_PIN) ? LEFT : RIGHT;
|
||||
return (hand_side == LEFT);
|
||||
#elif defined(SPLIT_HAND_MATRIX_GRID)
|
||||
# ifdef SPLIT_HAND_MATRIX_GRID_LOW_IS_LEFT
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user