1
0
Fork 0
forked from forks/qmk_firmware

Update GPIO API usage in keyboard code (#23361)

This commit is contained in:
Ryan 2024-05-03 15:21:29 +10:00 committed by GitHub
parent 5426a7a129
commit d09a06a1b3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
390 changed files with 3912 additions and 3913 deletions

View file

@ -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

View file

@ -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

View file

@ -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();

View file

@ -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();
}

View file

@ -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);
}
}

View file

@ -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;
}
}

View file

@ -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 = { {

View file

@ -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 = { {

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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;

View file

@ -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;
}

View file

@ -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) {

View file

@ -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;
}

View file

@ -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 {

View file

@ -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

View file

@ -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

View file

@ -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;
}

View file

@ -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);
}

View file

@ -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();
}

View file

@ -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();
}

View file

@ -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;

View file

@ -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;
}
}

View file

@ -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

View file

@ -23,17 +23,17 @@ static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
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 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]);
gpio_set_pin_input_high(row_pins[row]);
}
static void init_pins(void) {
@ -46,7 +46,7 @@ static void init_pins(void) {
for (uint8_t x = 0; x < MATRIX_COLS; x++) {
if ( x < 8 ) {
setPinInputHigh(col_pins[x]);
gpio_set_pin_input_high(col_pins[x]);
}
}
}
@ -111,7 +111,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
pin_state = port_expander_col_buffer[1] & (1 << 1);
break;
default :
pin_state = readPin(col_pins[col_index]);
pin_state = gpio_read_pin(col_pins[col_index]);
}
// Populate the matrix row with the state of the col pin

View file

@ -371,12 +371,12 @@ void housekeeping_task_kb(void) {
#if defined(KEYBOARD_bastardkb_charybdis_3x5_blackpill) || defined(KEYBOARD_bastardkb_charybdis_4x6_blackpill)
void keyboard_pre_init_kb(void) {
setPinInputHigh(A0);
gpio_set_pin_input_high(A0);
keyboard_pre_init_user();
}
void matrix_scan_kb(void) {
if (!readPin(A0)) {
if (!gpio_read_pin(A0)) {
reset_keyboard();
}
matrix_scan_user();

View file

@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
void keyboard_pre_init_kb(void) {
//Sets LED pin as output
setPinOutput(F7);
gpio_set_pin_output(F7);
keyboard_pre_init_user();
}
@ -28,7 +28,7 @@ bool led_update_kb(led_t led_state) {
// Caps Lock LED indicator toggling code here
bool res = led_update_user(led_state);
if(res) {
writePin(F7, led_state.caps_lock);
gpio_write_pin(F7, led_state.caps_lock);
}
return res;
}

View file

@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
void keyboard_pre_init_kb(void) {
//Sets LED pin as output
setPinOutput(F7);
gpio_set_pin_output(F7);
keyboard_pre_init_user();
}
@ -28,7 +28,7 @@ bool led_update_kb(led_t led_state) {
// Caps Lock LED indicator toggling code here
bool res = led_update_user(led_state);
if(res) {
writePin(F7, led_state.caps_lock);
gpio_write_pin(F7, led_state.caps_lock);
}
return res;
}

View file

@ -15,14 +15,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "quantum.h"
void keyboard_pre_init_kb(void) {
setPinOutput(F0);
writePinHigh(F0);
gpio_set_pin_output(F0);
gpio_write_pin_high(F0);
keyboard_pre_init_user();
}
bool led_update_kb(led_t led_state) {
if (led_update_user(led_state)) {
writePin(F0, !led_state.caps_lock);
gpio_write_pin(F0, !led_state.caps_lock);
}
return true;
}

View file

@ -15,14 +15,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "quantum.h"
void keyboard_pre_init_kb(void) {
setPinOutput(F0);
writePinHigh(F0);
gpio_set_pin_output(F0);
gpio_write_pin_high(F0);
keyboard_pre_init_user();
}
bool led_update_kb(led_t led_state) {
if (led_update_user(led_state)) {
writePin(F0, !led_state.caps_lock);
gpio_write_pin(F0, !led_state.caps_lock);
}
return true;
}

View file

@ -14,14 +14,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "quantum.h"
void keyboard_pre_init_kb(void) {
setPinOutput(F0);
writePinHigh(F0);
gpio_set_pin_output(F0);
gpio_write_pin_high(F0);
keyboard_pre_init_user();
}
bool led_update_kb(led_t led_state) {
if (led_update_user(led_state)) {
writePin(F0, !led_state.caps_lock);
gpio_write_pin(F0, !led_state.caps_lock);
}
return true;
}

View file

@ -18,8 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
void keyboard_pre_init_kb(void)
{
setPinOutput(F4);
setPinOutput(F5);
gpio_set_pin_output(F4);
gpio_set_pin_output(F5);
keyboard_pre_init_user();
};

View file

@ -19,7 +19,7 @@
bool led_update_kb(led_t led_state) {
if (!led_update_user(led_state)) { return false; }
writePin(LED_CAPS_LOCK_PIN, led_state.caps_lock);
gpio_write_pin(LED_CAPS_LOCK_PIN, led_state.caps_lock);
return true;
};

View file

@ -18,8 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "ghost_squid.h"
void keyboard_pre_init_kb(void) {
setPinOutput(D0);
writePinLow(D0);
gpio_set_pin_output(D0);
gpio_write_pin_low(D0);
fn_led_off();
keyboard_pre_init_user();

View file

@ -19,5 +19,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "quantum.h"
#define fn_led_on() writePinLow(D0)
#define fn_led_off() writePinHigh(D0)
#define fn_led_on() gpio_write_pin_low(D0)
#define fn_led_off() gpio_write_pin_high(D0)

View file

@ -55,22 +55,22 @@ void select_col(uint8_t col) {
void matrix_init_custom(void) {
/* Column output pins */
setPinOutput(D1);
setPinOutput(D2);
setPinOutput(D3);
setPinOutput(D4);
setPinOutput(D5);
setPinOutput(D6);
gpio_set_pin_output(D1);
gpio_set_pin_output(D2);
gpio_set_pin_output(D3);
gpio_set_pin_output(D4);
gpio_set_pin_output(D5);
gpio_set_pin_output(D6);
/* Row input pins */
writePinHigh(B0);
writePinHigh(B1);
writePinHigh(B2);
writePinHigh(B3);
writePinHigh(B4);
writePinHigh(B5);
writePinHigh(B6);
writePinHigh(C2);
gpio_write_pin_high(B0);
gpio_write_pin_high(B1);
gpio_write_pin_high(B2);
gpio_write_pin_high(B3);
gpio_write_pin_high(B4);
gpio_write_pin_high(B5);
gpio_write_pin_high(B6);
gpio_write_pin_high(C2);
}
bool matrix_scan_custom(matrix_row_t current_matrix[]) {

View file

@ -20,12 +20,12 @@ void matrix_init_kb(void)
audio_init();
PLAY_SONG(test_sound);
// Fix port B5
setPinInput(B5);
writePinHigh(B5);
gpio_set_pin_input(B5);
gpio_write_pin_high(B5);
#else
// If we're not using the audio pin, drive it low
setPinOutput(C6);
writePinLow(C6);
gpio_set_pin_output(C6);
gpio_write_pin_low(C6);
#endif
}

View file

@ -3,7 +3,7 @@
#include "quantum.h"
void matrix_init_kb(void) {
setPinOutput(E6);
gpio_set_pin_output(E6);
matrix_init_user();
}

View file

@ -2,23 +2,23 @@
void led_init(void) {
#if MCU == atmega32u2
setPinOutput(C4); // Set red LED pin as output
setPinOutput(C5); // Set blue LED pin as output
setPinOutput(D1); // Set green LED pin as output
gpio_set_pin_output(C4); // Set red LED pin as output
gpio_set_pin_output(C5); // Set blue LED pin as output
gpio_set_pin_output(D1); // Set green LED pin as output
writePinHigh(C4); // Turn off red LED pin
writePinHigh(C5); // Turn off blue LED pin
writePinHigh(D1); // Turn off green LED pin
gpio_write_pin_high(C4); // Turn off red LED pin
gpio_write_pin_high(C5); // Turn off blue LED pin
gpio_write_pin_high(D1); // Turn off green LED pin
#else
setPinOutput(F4); // Set red LED pin as output
setPinOutput(F5); // Set blue LED pin as output
setPinOutput(D1); // Set green LED pin as output
gpio_set_pin_output(F4); // Set red LED pin as output
gpio_set_pin_output(F5); // Set blue LED pin as output
gpio_set_pin_output(D1); // Set green LED pin as output
writePinHigh(F4); // Turn off red LED pin
writePinHigh(F5); // Turn off blue LED pin
writePinHigh(D1); // Turn off green LED pin
gpio_write_pin_high(F4); // Turn off red LED pin
gpio_write_pin_high(F5); // Turn off blue LED pin
gpio_write_pin_high(D1); // Turn off green LED pin
#endif

View file

@ -3,21 +3,21 @@
#include "quantum.h"
#if MCU == atmega32u2
#define red_led_off writePinHigh(C5)
#define red_led_on writePinLow(C5)
#define blu_led_off writePinHigh(C4)
#define blu_led_on writePinLow(C4)
#define red_led_off gpio_write_pin_high(C5)
#define red_led_on gpio_write_pin_low(C5)
#define blu_led_off gpio_write_pin_high(C4)
#define blu_led_on gpio_write_pin_low(C4)
#else
#define red_led_off writePinHigh(F5)
#define red_led_on writePinLow(F5)
#define blu_led_off writePinHigh(F4)
#define blu_led_on writePinLow(F4)
#define red_led_off gpio_write_pin_high(F5)
#define red_led_on gpio_write_pin_low(F5)
#define blu_led_off gpio_write_pin_high(F4)
#define blu_led_on gpio_write_pin_low(F4)
#endif
#define grn_led_off writePinHigh(D1)
#define grn_led_on writePinLow(D1)
#define grn_led_off gpio_write_pin_high(D1)
#define grn_led_on gpio_write_pin_low(D1)
#define set_led_off red_led_off; blu_led_off
#define set_led_red red_led_on; grn_led_off; blu_led_off

View file

@ -1,17 +1,17 @@
#include "quantum.h"
void matrix_init_board(void){
setPinOutput(A8);
setPinOutput(A9);
setPinOutput(A10);
gpio_set_pin_output(A8);
gpio_set_pin_output(A9);
gpio_set_pin_output(A10);
}
bool led_update_kb(led_t led_state) {
bool runDefault = led_update_user(led_state);
if (runDefault) {
writePin(A8, !led_state.num_lock);
writePin(A9, !led_state.caps_lock);
writePin(A10, !led_state.scroll_lock);
gpio_write_pin(A8, !led_state.num_lock);
gpio_write_pin(A9, !led_state.caps_lock);
gpio_write_pin(A10, !led_state.scroll_lock);
}
return runDefault;
}

View file

@ -54,19 +54,19 @@ static adc_mux adcMux;
void init_row(void) {
// Set all row pins as output and low
for (uint8_t idx = 0; idx < MATRIX_ROWS; idx++) {
setPinOutput(row_pins[idx]);
writePinLow(row_pins[idx]);
gpio_set_pin_output(row_pins[idx]);
gpio_write_pin_low(row_pins[idx]);
}
}
// Initialize the multiplexers
void init_amux(void) {
for (uint8_t idx = 0; idx < AMUX_COUNT; idx++) {
setPinOutput(amux_en_pins[idx]);
writePinLow(amux_en_pins[idx]);
gpio_set_pin_output(amux_en_pins[idx]);
gpio_write_pin_low(amux_en_pins[idx]);
}
for (uint8_t idx = 0; idx < AMUX_SEL_PINS_COUNT; idx++) {
setPinOutput(amux_sel_pins[idx]);
gpio_set_pin_output(amux_sel_pins[idx]);
}
}
@ -75,13 +75,13 @@ void select_amux_channel(uint8_t channel, uint8_t col) {
// Get the channel for the specified multiplexer
uint8_t ch = amux_n_col_channels[channel][col];
// momentarily disable specified multiplexer
writePinHigh(amux_en_pins[channel]);
gpio_write_pin_high(amux_en_pins[channel]);
// Select the multiplexer channel
for (uint8_t i = 0; i < AMUX_SEL_PINS_COUNT; i++) {
writePin(amux_sel_pins[i], ch & (1 << i));
gpio_write_pin(amux_sel_pins[i], ch & (1 << i));
}
// re enable specified multiplexer
writePinLow(amux_en_pins[channel]);
gpio_write_pin_low(amux_en_pins[channel]);
}
// Disable all the unused multiplexers
@ -89,28 +89,28 @@ void disable_unused_amux(uint8_t channel) {
// disable all the other multiplexers apart from the current selected one
for (uint8_t idx = 0; idx < AMUX_COUNT; idx++) {
if (idx != channel) {
writePinHigh(amux_en_pins[idx]);
gpio_write_pin_high(amux_en_pins[idx]);
}
}
}
// Discharge the peak hold capacitor
void discharge_capacitor(void) {
#ifdef OPEN_DRAIN_SUPPORT
writePinLow(DISCHARGE_PIN);
gpio_write_pin_low(DISCHARGE_PIN);
#else
writePinLow(DISCHARGE_PIN);
setPinOutput(DISCHARGE_PIN);
gpio_write_pin_low(DISCHARGE_PIN);
gpio_set_pin_output(DISCHARGE_PIN);
#endif
}
// Charge the peak hold capacitor
void charge_capacitor(uint8_t row) {
#ifdef OPEN_DRAIN_SUPPORT
writePinHigh(DISCHARGE_PIN);
gpio_write_pin_high(DISCHARGE_PIN);
#else
setPinInput(DISCHARGE_PIN);
gpio_set_pin_input(DISCHARGE_PIN);
#endif
writePinHigh(row_pins[row]);
gpio_write_pin_high(row_pins[row]);
}
// Initialize the peripherals pins
@ -123,11 +123,11 @@ int ec_init(void) {
adc_read(adcMux);
// Initialize discharge pin as discharge mode
writePinLow(DISCHARGE_PIN);
gpio_write_pin_low(DISCHARGE_PIN);
#ifdef OPEN_DRAIN_SUPPORT
setPinOutputOpenDrain(DISCHARGE_PIN);
gpio_set_pin_output_open_drain(DISCHARGE_PIN);
#else
setPinOutput(DISCHARGE_PIN);
gpio_set_pin_output(DISCHARGE_PIN);
#endif
// Initialize drive lines
@ -212,7 +212,7 @@ uint16_t ec_readkey_raw(uint8_t channel, uint8_t row, uint8_t col) {
select_amux_channel(channel, col);
// Set the row pin to low state to avoid ghosting
writePinLow(row_pins[row]);
gpio_write_pin_low(row_pins[row]);
ATOMIC_BLOCK_FORCEON {
// Set the row pin to high state and have capacitor charge

View file

@ -17,14 +17,14 @@
void matrix_init_kb(void) {
// Set our LED pins as output
setPinOutput(D6);
setPinOutput(B4);
setPinOutput(B5);
setPinOutput(B6);
gpio_set_pin_output(D6);
gpio_set_pin_output(B4);
gpio_set_pin_output(B5);
gpio_set_pin_output(B6);
// Set our Tilt Sensor pins as input
setPinInputHigh(SHAKE_PIN_A);
setPinInputHigh(SHAKE_PIN_B);
gpio_set_pin_input_high(SHAKE_PIN_A);
gpio_set_pin_input_high(SHAKE_PIN_B);
// Run the keymap level init
matrix_init_user();
@ -43,12 +43,12 @@ void check_encoder_buttons(void) {
if (drawing_mode) {
dprintf("Turning drawing mode off.\n");
drawing_mode = false;
writePinLow(D6);
gpio_write_pin_low(D6);
unregister_code(KC_BTN1);
} else {
dprintf("Turning drawing mode on.\n");
drawing_mode = true;
writePinHigh(D6);
gpio_write_pin_high(D6);
register_code(KC_BTN1);
}
}
@ -65,7 +65,7 @@ void matrix_scan_kb(void) {
#ifdef SHAKE_ENABLE
// Read the current state of the tilt sensor. It is physically
// impossible for both pins to register a low state at the same time.
uint8_t tilt_read = (readPin(SHAKE_PIN_A) << 4) | readPin(SHAKE_PIN_B);
uint8_t tilt_read = (gpio_read_pin(SHAKE_PIN_A) << 4) | gpio_read_pin(SHAKE_PIN_B);
// Check to see if the tilt sensor has changed state since our last read
if (tilt_state != tilt_read) {
@ -136,9 +136,9 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if(res) {
writePin(B4, !led_state.num_lock);
writePin(B5, !led_state.caps_lock);
writePin(B6, !led_state.scroll_lock);
gpio_write_pin(B4, !led_state.num_lock);
gpio_write_pin(B5, !led_state.caps_lock);
gpio_write_pin(B6, !led_state.scroll_lock);
}
return res;

View file

@ -206,8 +206,8 @@ void max7219_init(void) {
wait_ms(1500);
dprintf("max7219_init()\n");
setPinOutput(MAX7219_LOAD);
writePinHigh(MAX7219_LOAD);
gpio_set_pin_output(MAX7219_LOAD);
gpio_write_pin_high(MAX7219_LOAD);
spi_init();
for (int i=0; i<MAX7219_CONTROLLERS; i++) {

View file

@ -2,23 +2,23 @@
void led_init_ports(void) {
// Set our LED pins as output
setPinOutput(B13); // LED1
writePinLow(B13);
setPinOutput(B14); // LED2
writePinLow(B14);
setPinOutput(A8); // LED3
writePinLow(A8);
setPinOutput(A0); // Capslock LED
writePinLow(A0);
gpio_set_pin_output(B13); // LED1
gpio_write_pin_low(B13);
gpio_set_pin_output(B14); // LED2
gpio_write_pin_low(B14);
gpio_set_pin_output(A8); // LED3
gpio_write_pin_low(A8);
gpio_set_pin_output(A0); // Capslock LED
gpio_write_pin_low(A0);
}
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if(res) {
writePin(B13, led_state.num_lock);
writePin(A0, led_state.caps_lock);
writePin(B14, led_state.caps_lock);
writePin(A8, led_state.scroll_lock);
gpio_write_pin(B13, led_state.num_lock);
gpio_write_pin(A0, led_state.caps_lock);
gpio_write_pin(B14, led_state.caps_lock);
gpio_write_pin(A8, led_state.scroll_lock);
}
return res;
}

View file

@ -95,27 +95,27 @@ void pins_init(void) {
// set pins for pullups, Rts , power &etc.
//print ("pins setup\n");
setPinOutput(VCC_PIN);
writePinLow(VCC_PIN);
gpio_set_pin_output(VCC_PIN);
gpio_write_pin_low(VCC_PIN);
#if ( HANDSPRING == 0)
#ifdef CY835
setPinOutput(GND_PIN);
writePinLow(GND_PIN);
gpio_set_pin_output(GND_PIN);
gpio_write_pin_low(GND_PIN);
setPinOutput(PULLDOWN_PIN);
writePinLow(PULLDOWN_PIN);
gpio_set_pin_output(PULLDOWN_PIN);
gpio_write_pin_low(PULLDOWN_PIN);
#endif
setPinInput(DCD_PIN);
setPinInput(RTS_PIN);
gpio_set_pin_input(DCD_PIN);
gpio_set_pin_input(RTS_PIN);
#endif
/* check that the other side isn't powered up.
test=readPin(DCD_PIN);
test=gpio_read_pin(DCD_PIN);
xprintf("b%02X:", test);
test=readPin(RTS_PIN);
test=gpio_read_pin(RTS_PIN);
xprintf("%02X\n", test);
*/
@ -128,16 +128,16 @@ uint8_t rts_reset(void) {
// On boot, we keep rts as input, then switch roles here
// on leaving sleep, we toggle the same way
firstread=readPin(RTS_PIN);
firstread=gpio_read_pin(RTS_PIN);
// printf("r%02X:", firstread);
setPinOutput(RTS_PIN);
gpio_set_pin_output(RTS_PIN);
if (firstread) {
writePinLow(RTS_PIN);
gpio_write_pin_low(RTS_PIN);
}
wait_ms(10);
writePinHigh(RTS_PIN);
gpio_write_pin_high(RTS_PIN);
/* the future is Arm
@ -223,9 +223,9 @@ uint8_t handspring_handshake(void) {
}
uint8_t handspring_reset(void) {
writePinLow(VCC_PIN);
gpio_write_pin_low(VCC_PIN);
wait_ms(5);
writePinHigh(VCC_PIN);
gpio_write_pin_high(VCC_PIN);
if ( handspring_handshake() ) {
last_activity = timer_read();
@ -249,7 +249,7 @@ void matrix_init(void)
#endif
print("power up\n");
writePinHigh(VCC_PIN);
gpio_write_pin_high(VCC_PIN);
// wait for DCD strobe from keyboard - it will do this
// up to 3 times, then the board needs the RTS toggled to try again
@ -264,7 +264,7 @@ void matrix_init(void)
}
#else /// Palm / HP device with DCD
while( !readPin(DCD_PIN) ) {;}
while( !gpio_read_pin(DCD_PIN) ) {;}
print("dcd\n");
rts_reset(); // at this point the keyboard should think all is well.

View file

@ -79,29 +79,29 @@ static void pal_cb(void* unused) {
void matrix_init(void) {
//Set I/O as pull-up inputs to read states
setPinInputHigh(A0);
setPinInputHigh(A1);
setPinInputHigh(A2);
setPinInputHigh(A3);
setPinInputHigh(A4);
setPinInputHigh(A5);
setPinInputHigh(A6);
setPinInputHigh(A7);
setPinInputHigh(A8);
setPinInputHigh(A9);
setPinInputHigh(A10);
setPinInputHigh(B3);
setPinInputHigh(B4);
setPinInputHigh(B5);
setPinInputHigh(B6);
setPinInputHigh(B7);
setPinInputHigh(B8);
setPinInputHigh(B9);
setPinInputHigh(B11);
setPinInputHigh(B12);
setPinInputHigh(B13);
setPinInputHigh(B14);
setPinInputHigh(B15);
gpio_set_pin_input_high(A0);
gpio_set_pin_input_high(A1);
gpio_set_pin_input_high(A2);
gpio_set_pin_input_high(A3);
gpio_set_pin_input_high(A4);
gpio_set_pin_input_high(A5);
gpio_set_pin_input_high(A6);
gpio_set_pin_input_high(A7);
gpio_set_pin_input_high(A8);
gpio_set_pin_input_high(A9);
gpio_set_pin_input_high(A10);
gpio_set_pin_input_high(B3);
gpio_set_pin_input_high(B4);
gpio_set_pin_input_high(B5);
gpio_set_pin_input_high(B6);
gpio_set_pin_input_high(B7);
gpio_set_pin_input_high(B8);
gpio_set_pin_input_high(B9);
gpio_set_pin_input_high(B11);
gpio_set_pin_input_high(B12);
gpio_set_pin_input_high(B13);
gpio_set_pin_input_high(B14);
gpio_set_pin_input_high(B15);
memset(matrix, 0, MATRIX_ROWS * sizeof(matrix_row_t));
memset(matrix_debouncing, 0, MATRIX_ROWS * sizeof(matrix_row_t));
@ -207,7 +207,7 @@ uint8_t matrix_scan(void) {
matrix[3] = 0x00;
}
//Special case for Shift
if (readPin(B11) == 0) { matrix[3] |= 0x01; }
if (gpio_read_pin(B11) == 0) { matrix[3] |= 0x01; }
porta_buffer = 65535;
portb_buffer = 65535;

View file

@ -34,10 +34,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* hard reset: low pulse for 500ms and after that HiZ for safety */
#define XT_RESET() do { \
writePinLow(XT_RST_PIN); \
setPinOutput(XT_RST_PIN); \
gpio_write_pin_low(XT_RST_PIN); \
gpio_set_pin_output(XT_RST_PIN); \
wait_ms(500); \
setPinInput(XT_RST_PIN); \
gpio_set_pin_input(XT_RST_PIN); \
} while (0)
/* INT1 for falling edge of clock line */

View file

@ -43,30 +43,30 @@ POSSIBILITY OF SUCH DAMAGE.
#define XT_DATA_IN() \
do { \
setPinInput(XT_DATA_PIN); \
writePinHigh(XT_DATA_PIN); \
gpio_set_pin_input(XT_DATA_PIN); \
gpio_write_pin_high(XT_DATA_PIN); \
} while (0)
#define XT_DATA_READ() readPin(XT_DATA_PIN)
#define XT_DATA_READ() gpio_read_pin(XT_DATA_PIN)
#define XT_DATA_LO() \
do { \
writePinLow(XT_DATA_PIN); \
setPinOutput(XT_DATA_PIN); \
gpio_write_pin_low(XT_DATA_PIN); \
gpio_set_pin_output(XT_DATA_PIN); \
} while (0)
#define XT_CLOCK_IN() \
do { \
setPinInput(XT_CLOCK_PIN); \
writePinHigh(XT_CLOCK_PIN); \
gpio_set_pin_input(XT_CLOCK_PIN); \
gpio_write_pin_high(XT_CLOCK_PIN); \
} while (0)
#define XT_CLOCK_READ() readPin(XT_CLOCK_PIN)
#define XT_CLOCK_READ() gpio_read_pin(XT_CLOCK_PIN)
#define XT_CLOCK_LO() \
do { \
writePinLow(XT_CLOCK_PIN); \
setPinOutput(XT_CLOCK_PIN); \
gpio_write_pin_low(XT_CLOCK_PIN); \
gpio_set_pin_output(XT_CLOCK_PIN); \
} while (0)
void xt_host_init(void);

View file

@ -10,7 +10,7 @@ void matrix_wait_for_pin(pin_t pin, uint8_t target_state) {
rtcnt_t start = chSysGetRealtimeCounterX();
rtcnt_t end = start + 5000;
while (chSysIsCounterWithinX(chSysGetRealtimeCounterX(), start, end)) {
if (readPin(pin) == target_state) {
if (gpio_read_pin(pin) == target_state) {
break;
}
}
@ -27,22 +27,22 @@ void matrix_wait_for_port(stm32_gpio_t *port, uint32_t target_bitmask) {
}
void shift_pulse_clock(void) {
writePinHigh(COL_SHIFT_CLK_PIN);
gpio_write_pin_high(COL_SHIFT_CLK_PIN);
matrix_wait_for_pin(COL_SHIFT_CLK_PIN, 1);
writePinLow(COL_SHIFT_CLK_PIN);
gpio_write_pin_low(COL_SHIFT_CLK_PIN);
}
void matrix_init_custom(void) {
//set all row pins as input with pullups
for (int i = 0; i < MATRIX_ROWS; ++i) {
writePinHigh(row_pins[i]);
setPinInputHigh(row_pins[i]);
gpio_write_pin_high(row_pins[i]);
gpio_set_pin_input_high(row_pins[i]);
}
//set all column pins high in ROW2COL matrix
setPinOutput(COL_SHIFT_IN_PIN);
setPinOutput(COL_SHIFT_CLK_PIN);
writePinHigh(COL_SHIFT_IN_PIN);
gpio_set_pin_output(COL_SHIFT_IN_PIN);
gpio_set_pin_output(COL_SHIFT_CLK_PIN);
gpio_write_pin_high(COL_SHIFT_IN_PIN);
matrix_wait_for_pin(COL_SHIFT_IN_PIN, 1);
for (int i = 0; i < MATRIX_COLS; ++i) {
@ -54,13 +54,13 @@ void matrix_init_custom(void) {
bool matrix_scan_custom(matrix_row_t current_matrix[]) {
static matrix_row_t temp_matrix[MATRIX_ROWS] = {0};
writePinLow(COL_SHIFT_IN_PIN);
gpio_write_pin_low(COL_SHIFT_IN_PIN);
matrix_wait_for_pin(COL_SHIFT_IN_PIN, 0);
// Setup the output column pin
shift_pulse_clock();
writePinHigh(COL_SHIFT_IN_PIN);
gpio_write_pin_high(COL_SHIFT_IN_PIN);
for (int current_col = 0; current_col < MATRIX_COLS; ++current_col) {
// Read the column ports

View file

@ -16,7 +16,7 @@
#include "quantum.h"
void matrix_init_kb(void) {
setPinOutput(B0);
gpio_set_pin_output(B0);
matrix_init_user();
}

View file

@ -17,34 +17,34 @@
#include "quantum.h"
void keyoard_post_init_kb(void) {
setPinOutput(LED_CAPS_LOCK_PIN);
setPinOutput(LED_INDICATOR_1);
setPinOutput(LED_INDICATOR_2);
setPinOutput(LED_INDICATOR_3);
setPinOutput(LED_INDICATOR_4);
setPinOutput(LED_INDICATOR_5);
gpio_set_pin_output(LED_CAPS_LOCK_PIN);
gpio_set_pin_output(LED_INDICATOR_1);
gpio_set_pin_output(LED_INDICATOR_2);
gpio_set_pin_output(LED_INDICATOR_3);
gpio_set_pin_output(LED_INDICATOR_4);
gpio_set_pin_output(LED_INDICATOR_5);
#ifndef LED_CAPS_LOCK_PIN
writePin(LED_CAPS_LOCK_PIN, 0);
gpio_write_pin(LED_CAPS_LOCK_PIN, 0);
#endif
#ifndef LED_INDICATOR_1
writePin(LED_INDICATOR_1, 0);
gpio_write_pin(LED_INDICATOR_1, 0);
#endif
#ifndef LED_INDICATOR_2
writePin(LED_INDICATOR_2, 0);
gpio_write_pin(LED_INDICATOR_2, 0);
#endif
#ifndef LED_INDICATOR_3
writePin(LED_INDICATOR_3, 0);
gpio_write_pin(LED_INDICATOR_3, 0);
#endif
#ifndef LED_INDICATOR_4
writePin(LED_INDICATOR_4, 0);
gpio_write_pin(LED_INDICATOR_4, 0);
#endif
#ifndef LED_INDICATOR_5
writePin(LED_INDICATOR_5, 0);
gpio_write_pin(LED_INDICATOR_5, 0);
#endif
keyboard_post_init_user();
}
@ -53,39 +53,39 @@ layer_state_t layer_state_set_kb(layer_state_t state) {
switch (get_highest_layer(state)) {
case 1:
#ifdef LED_INDICATOR_4
writePin(LED_INDICATOR_4, 1);
gpio_write_pin(LED_INDICATOR_4, 1);
#endif
#ifdef LED_INDICATOR_5
writePin(LED_INDICATOR_5, 1);
gpio_write_pin(LED_INDICATOR_5, 1);
#endif
break;
case 2:
#ifdef LED_INDICATOR_1
writePin(LED_INDICATOR_1, 1);
gpio_write_pin(LED_INDICATOR_1, 1);
#endif
#ifdef LED_INDICATOR_2
writePin(LED_INDICATOR_2, 1);
gpio_write_pin(LED_INDICATOR_2, 1);
#endif
#ifdef LED_INDICATOR_3
writePin(LED_INDICATOR_3, 1);
gpio_write_pin(LED_INDICATOR_3, 1);
#endif
break;
default:
#ifdef LED_INDICATOR_1
writePin(LED_INDICATOR_1, 0);
gpio_write_pin(LED_INDICATOR_1, 0);
#endif
#ifdef LED_INDICATOR_2
writePin(LED_INDICATOR_2, 0);
gpio_write_pin(LED_INDICATOR_2, 0);
#endif
#ifdef LED_INDICATOR_3
writePin(LED_INDICATOR_3, 0);
gpio_write_pin(LED_INDICATOR_3, 0);
#endif
#ifdef LED_INDICATOR_4
writePin(LED_INDICATOR_4, 0);
gpio_write_pin(LED_INDICATOR_4, 0);
#endif
#ifdef LED_INDICATOR_5
writePin(LED_INDICATOR_5, 0);
gpio_write_pin(LED_INDICATOR_5, 0);
#endif
break;
}

View file

@ -132,9 +132,9 @@ void spi_init(void) {
is_initialised = true;
// Try releasing special pins for a short time
setPinInput(SPI_SCK_PIN);
setPinInput(SPI_MOSI_PIN);
setPinInput(SPI_MISO_PIN);
gpio_set_pin_input(SPI_SCK_PIN);
gpio_set_pin_input(SPI_MOSI_PIN);
gpio_set_pin_input(SPI_MISO_PIN);
chThdSleepMilliseconds(10);
@ -147,12 +147,12 @@ void spi_init(void) {
#endif
void keyboard_pre_init_kb(void) {
setPinOutput(C0);
setPinOutput(C15);
gpio_set_pin_output(C0);
gpio_set_pin_output(C15);
keyboard_pre_init_user();
};
void housekeeping_task_kb(void) {
writePin(C15, keymap_config.no_gui);
gpio_write_pin(C15, keymap_config.no_gui);
};
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {

View file

@ -133,9 +133,9 @@ void spi_init(void) {
is_initialised = true;
// Try releasing special pins for a short time
setPinInput(SPI_SCK_PIN);
setPinInput(SPI_MOSI_PIN);
setPinInput(SPI_MISO_PIN);
gpio_set_pin_input(SPI_SCK_PIN);
gpio_set_pin_input(SPI_MOSI_PIN);
gpio_set_pin_input(SPI_MISO_PIN);
chThdSleepMilliseconds(10);
@ -148,12 +148,12 @@ void spi_init(void) {
#endif
void keyboard_pre_init_kb(void) {
setPinOutput(C0);
setPinOutput(C15);
gpio_set_pin_output(C0);
gpio_set_pin_output(C15);
keyboard_pre_init_user();
};
void housekeeping_task_kb(void) {
writePin(C15, keymap_config.no_gui);
gpio_write_pin(C15, keymap_config.no_gui);
};
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {

View file

@ -21,11 +21,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "quantum.h"
void keyboard_pre_init_kb(void) {
setPinOutput(A0);
writePinHigh(A0);
writePinLow(A0);
gpio_set_pin_output(A0);
gpio_write_pin_high(A0);
gpio_write_pin_low(A0);
wait_ms(10);
writePinHigh(A0);
gpio_write_pin_high(A0);
keyboard_pre_init_user();
}

View file

@ -60,13 +60,13 @@ bool pointing_device_task(void){
}
void led_init(void) {
setPinOutput(D1);
setPinOutput(F5);
setPinOutput(F6);
gpio_set_pin_output(D1);
gpio_set_pin_output(F5);
gpio_set_pin_output(F6);
writePinHigh(D1);
writePinHigh(F5);
writePinHigh(F6);
gpio_write_pin_high(D1);
gpio_write_pin_high(F5);
gpio_write_pin_high(F6);
}

View file

@ -4,12 +4,12 @@
#include "pointing_device.h"
#include "quantum.h"
#define red_led_off() writePinHigh(F6)
#define red_led_on() writePinLow(F6)
#define blu_led_off() writePinHigh(F5)
#define blu_led_on() writePinLow(F5)
#define grn_led_off() writePinHigh(D1)
#define grn_led_on() writePinLow(D1)
#define red_led_off() gpio_write_pin_high(F6)
#define red_led_on() gpio_write_pin_low(F6)
#define blu_led_off() gpio_write_pin_high(F5)
#define blu_led_on() gpio_write_pin_low(F5)
#define grn_led_off() gpio_write_pin_high(D1)
#define grn_led_on() gpio_write_pin_low(D1)
#define red_led(flag) if (flag) red_led_on(); else red_led_off()
#define blu_led(flag) if (flag) blu_led_on(); else blu_led_off()

View file

@ -17,8 +17,8 @@
void keyboard_pre_init_kb(void) {
// Immediately set the LED pin as an output and set it ON
setPinOutput(A15);
writePinHigh(A15);
gpio_set_pin_output(A15);
gpio_write_pin_high(A15);
keyboard_pre_init_user();
}
@ -26,11 +26,11 @@ void keyboard_pre_init_kb(void) {
void keyboard_post_init_kb(void) {
// Blink the LED so we know everything is running OK
// Finish with LED OFF
writePinLow(A15);
gpio_write_pin_low(A15);
wait_ms(100);
writePinHigh(A15);
gpio_write_pin_high(A15);
wait_ms(100);
writePinLow(A15);
gpio_write_pin_low(A15);
keyboard_post_init_user();
}

View file

@ -40,8 +40,8 @@ void matrix_init_kb(void) {
}
void led_init_ports(void) {
setPinOutput(E6);
setPinOutput(F0);
gpio_set_pin_output(E6);
gpio_set_pin_output(F0);
}
void led_update_ports(led_t led_state) {

View file

@ -19,11 +19,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "quantum.h"
inline void dk60_caps_led_on(void) { writePinHigh(E6); }
inline void dk60_esc_led_on(void) { writePinHigh(F0); }
inline void dk60_caps_led_on(void) { gpio_write_pin_high(E6); }
inline void dk60_esc_led_on(void) { gpio_write_pin_high(F0); }
inline void dk60_caps_led_off(void) { writePinLow(E6); }
inline void dk60_esc_led_off(void) { writePinLow(F0); }
inline void dk60_caps_led_off(void) { gpio_write_pin_low(E6); }
inline void dk60_esc_led_off(void) { gpio_write_pin_low(F0); }
inline void dk60_led_all_on(void) {
dk60_caps_led_on();

View file

@ -12,7 +12,7 @@ void lain_eeconfig_update_kb(void) { eeconfig_update_kb(lain_config.raw); }
void lain_set_led(uint8_t no, bool flag) {
led_states[no] = flag;
writePin(leds[no], lain_config.led_enabled ? flag : false);
gpio_write_pin(leds[no], lain_config.led_enabled ? flag : false);
}
void lain_enable_leds(bool flag) {
@ -20,7 +20,7 @@ void lain_enable_leds(bool flag) {
lain_eeconfig_update_kb();
for (int i = 0; i < LED_NUM; i++) {
writePin(leds[i], lain_config.led_enabled ? led_states[i] : false);
gpio_write_pin(leds[i], lain_config.led_enabled ? led_states[i] : false);
}
}
@ -28,7 +28,7 @@ void lain_enable_leds_toggle(void) { lain_enable_leds(!lain_config.led_enabled);
void led_init_ports(void) {
for (uint8_t i = 0; i < LED_NUM; i++) {
setPinOutput(leds[i]);
gpio_set_pin_output(leds[i]);
lain_set_led(leds[i], 0);
}
}

View file

@ -16,30 +16,30 @@
#include "quantum.h"
void keyboard_pre_init_kb(void) {
setPinOutput(C6);
setPinOutput(B0);
gpio_set_pin_output(C6);
gpio_set_pin_output(B0);
}
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if (res) {
// writePin sets the pin high for 1 and low for 0.
// gpio_write_pin sets the pin high for 1 and low for 0.
// In this example the pins are inverted, setting
// it low/0 turns it on, and high/1 turns the LED off.
// This behavior depends on whether the LED is between the pin
// and VCC or the pin and GND.
writePin(C6, !led_state.caps_lock);
gpio_write_pin(C6, !led_state.caps_lock);
}
return res;
}
__attribute__((weak)) layer_state_t layer_state_set_user(layer_state_t state) {
writePin(B0, !(state & (1UL << 1)));
gpio_write_pin(B0, !(state & (1UL << 1)));
return state;
}
// Override core logic as we reuse SPLIT_HAND_PIN within matrix pins
bool is_keyboard_left(void) {
setPinInput(SPLIT_HAND_PIN);
return readPin(SPLIT_HAND_PIN);
gpio_set_pin_input(SPLIT_HAND_PIN);
return gpio_read_pin(SPLIT_HAND_PIN);
}

View file

@ -54,10 +54,10 @@ void matrix_scan_user(void) {}
void matrix_init(void)
{
//setPinOutput(F0);
//writePinHigh(F0);
setPinOutput(B4);
writePinLow(B4);
//gpio_set_pin_output(F0);
//gpio_write_pin_high(F0);
gpio_set_pin_output(B4);
gpio_write_pin_low(B4);
init_cols();
init_rows();
@ -123,20 +123,20 @@ void matrix_print(void)
*/
static void init_rows(void)
{
setPinInputHigh(E6);
setPinInputHigh(F6);
setPinInputHigh(F7);
setPinInputHigh(B7);
setPinInputHigh(D4);
gpio_set_pin_input_high(E6);
gpio_set_pin_input_high(F6);
gpio_set_pin_input_high(F7);
gpio_set_pin_input_high(B7);
gpio_set_pin_input_high(D4);
}
static uint8_t read_rows(void)
{
return ((readPin(E6) ? 0 : (1 << 0)) |
(readPin(F6) ? 0 : (1 << 1)) |
(readPin(F7) ? 0 : (1 << 2)) |
(readPin(B7) ? 0 : (1 << 3)) |
(readPin(D4) ? 0 : (1 << 4)));
return ((gpio_read_pin(E6) ? 0 : (1 << 0)) |
(gpio_read_pin(F6) ? 0 : (1 << 1)) |
(gpio_read_pin(F7) ? 0 : (1 << 2)) |
(gpio_read_pin(B7) ? 0 : (1 << 3)) |
(gpio_read_pin(D4) ? 0 : (1 << 4)));
}
/*
@ -164,104 +164,104 @@ static uint8_t read_rows(void)
*/
static void init_cols(void)
{
setPinOutput(F0);
setPinOutput(F1);
setPinOutput(F4);
setPinOutput(F5);
gpio_set_pin_output(F0);
gpio_set_pin_output(F1);
gpio_set_pin_output(F4);
gpio_set_pin_output(F5);
setPinOutput(D2);
setPinOutput(D3);
setPinOutput(D5);
setPinOutput(D6);
gpio_set_pin_output(D2);
gpio_set_pin_output(D3);
gpio_set_pin_output(D5);
gpio_set_pin_output(D6);
unselect_cols();
}
static void unselect_cols(void)
{
writePinHigh(F0);
writePinHigh(F1);
writePinHigh(F4);
writePinHigh(F5);
gpio_write_pin_high(F0);
gpio_write_pin_high(F1);
gpio_write_pin_high(F4);
gpio_write_pin_high(F5);
writePinHigh(D2);
writePinHigh(D3);
writePinHigh(D5);
writePinHigh(D6);
gpio_write_pin_high(D2);
gpio_write_pin_high(D3);
gpio_write_pin_high(D5);
gpio_write_pin_high(D6);
}
static void select_col(uint8_t col) {
switch (col) {
case 0:
writePinLow(F0);
writePinLow(F1);
writePinLow(F4);
gpio_write_pin_low(F0);
gpio_write_pin_low(F1);
gpio_write_pin_low(F4);
break;
case 1:
writePinHigh(F0);
writePinLow(F1);
writePinLow(F4);
gpio_write_pin_high(F0);
gpio_write_pin_low(F1);
gpio_write_pin_low(F4);
break;
case 2:
writePinLow(F0);
writePinHigh(F1);
writePinLow(F4);
gpio_write_pin_low(F0);
gpio_write_pin_high(F1);
gpio_write_pin_low(F4);
break;
case 3:
writePinHigh(F0);
writePinHigh(F1);
writePinLow(F4);
gpio_write_pin_high(F0);
gpio_write_pin_high(F1);
gpio_write_pin_low(F4);
break;
case 4:
writePinLow(F0);
writePinLow(F1);
writePinHigh(F4);
gpio_write_pin_low(F0);
gpio_write_pin_low(F1);
gpio_write_pin_high(F4);
break;
case 5:
writePinHigh(F0);
writePinLow(F1);
writePinHigh(F4);
gpio_write_pin_high(F0);
gpio_write_pin_low(F1);
gpio_write_pin_high(F4);
break;
case 6:
writePinLow(F0);
writePinHigh(F1);
writePinHigh(F4);
gpio_write_pin_low(F0);
gpio_write_pin_high(F1);
gpio_write_pin_high(F4);
break;
case 7:
writePinLow(D2);
writePinLow(D3);
writePinLow(D5);
gpio_write_pin_low(D2);
gpio_write_pin_low(D3);
gpio_write_pin_low(D5);
break;
case 8:
writePinHigh(D2);
writePinLow(D3);
writePinLow(D5);
gpio_write_pin_high(D2);
gpio_write_pin_low(D3);
gpio_write_pin_low(D5);
break;
case 9:
writePinLow(D2);
writePinHigh(D3);
writePinLow(D5);
gpio_write_pin_low(D2);
gpio_write_pin_high(D3);
gpio_write_pin_low(D5);
break;
case 10:
writePinHigh(D2);
writePinHigh(D3);
writePinLow(D5);
gpio_write_pin_high(D2);
gpio_write_pin_high(D3);
gpio_write_pin_low(D5);
break;
case 11:
writePinLow(D2);
writePinLow(D3);
writePinHigh(D5);
gpio_write_pin_low(D2);
gpio_write_pin_low(D3);
gpio_write_pin_high(D5);
break;
case 12:
writePinHigh(D2);
writePinLow(D3);
writePinHigh(D5);
gpio_write_pin_high(D2);
gpio_write_pin_low(D3);
gpio_write_pin_high(D5);
break;
case 13:
writePinLow(D2);
writePinHigh(D3);
writePinHigh(D5);
gpio_write_pin_low(D2);
gpio_write_pin_high(D3);
gpio_write_pin_high(D5);
break;
}
}

View file

@ -22,8 +22,8 @@
#define C2_B5_SENSE B0
static inline void digital_write(pin_t pin, uint8_t level) {
setPinOutput(pin);
writePin(pin, level);
gpio_set_pin_output(pin);
gpio_write_pin(pin, level);
}
uint16_t v_con_1 = 0;
@ -42,10 +42,10 @@ void keyboard_USB_enable(void) {
digital_write(SRC_1, 1);
digital_write(SRC_2, 1);
setPinInput(C1_A5_SENSE);
setPinInput(C1_B5_SENSE);
setPinInput(C2_A5_SENSE);
setPinInput(C2_B5_SENSE);
gpio_set_pin_input(C1_A5_SENSE);
gpio_set_pin_input(C1_B5_SENSE);
gpio_set_pin_input(C2_A5_SENSE);
gpio_set_pin_input(C2_B5_SENSE);
// reset hub
digital_write(HUB_RESET_N, 0);

View file

@ -56,13 +56,13 @@ void matrix_scan_user(void) {
void indicator_init_ports(void) {
// Num LED
setPinOutput(B4);
gpio_set_pin_output(B4);
// Caps Lock
setPinOutput(B0);
gpio_set_pin_output(B0);
// Scroll Lock
setPinOutput(D7);
gpio_set_pin_output(D7);
}
void matrix_init(void) {

View file

@ -31,9 +31,9 @@
// of the Escape key.
bool led_update_kb(led_t led_state) {
if(led_update_user(led_state)) {
writePin(B0, !led_state.caps_lock);
writePin(B4, !led_state.num_lock);
writePin(D7, !led_state.scroll_lock);
gpio_write_pin(B0, !led_state.caps_lock);
gpio_write_pin(B4, !led_state.num_lock);
gpio_write_pin(D7, !led_state.scroll_lock);
}
return true;
}

View file

@ -17,8 +17,8 @@
void keyboard_pre_init_kb(void) {
// Set LED IO as outputs
setPinOutput(LED_00);
setPinOutput(LED_01);
gpio_set_pin_output(LED_00);
gpio_set_pin_output(LED_01);
keyboard_pre_init_user();
}
@ -27,16 +27,16 @@ bool shutdown_kb(bool jump_to_bootloader) {
return false;
}
// Shutdown LEDs
writePinLow(LED_00);
writePinLow(LED_01);
gpio_write_pin_low(LED_00);
gpio_write_pin_low(LED_01);
return true;
}
layer_state_t layer_state_set_kb(layer_state_t state) {
// Layer LEDs act as binary indication of current layer
uint8_t layer = get_highest_layer(state);
writePin(LED_00, layer & 0b1);
writePin(LED_01, (layer >> 1) & 0b1);
gpio_write_pin(LED_00, layer & 0b1);
gpio_write_pin(LED_01, (layer >> 1) & 0b1);
return layer_state_set_user(state);
}
@ -49,11 +49,11 @@ void matrix_init_kb(void) {
// runs once when the firmware starts up
uint8_t led_delay_ms = 80;
for (int i = 0; i < 2; i++) {
writePinHigh(LED_00);
writePinHigh(LED_01);
gpio_write_pin_high(LED_00);
gpio_write_pin_high(LED_01);
wait_ms(led_delay_ms);
writePinLow(LED_00);
writePinLow(LED_01);
gpio_write_pin_low(LED_00);
gpio_write_pin_low(LED_01);
if (i < 1) {
wait_ms(led_delay_ms);
}

View file

@ -17,8 +17,8 @@
void keyboard_pre_init_kb(void) {
// Set LED IO as outputs
setPinOutput(LED_00);
setPinOutput(LED_01);
gpio_set_pin_output(LED_00);
gpio_set_pin_output(LED_01);
keyboard_pre_init_user();
}
@ -27,16 +27,16 @@ bool shutdown_kb(bool jump_to_bootloader) {
return false;
}
// Shutdown LEDs
writePinLow(LED_00);
writePinLow(LED_01);
gpio_write_pin_low(LED_00);
gpio_write_pin_low(LED_01);
return true;
}
layer_state_t layer_state_set_kb(layer_state_t state) {
// Layer LEDs act as binary indication of current layer
uint8_t layer = get_highest_layer(state);
writePin(LED_00, layer & 0b1);
writePin(LED_01, (layer >> 1) & 0b1);
gpio_write_pin(LED_00, layer & 0b1);
gpio_write_pin(LED_01, (layer >> 1) & 0b1);
return layer_state_set_user(state);
}
@ -49,11 +49,11 @@ void matrix_init_kb(void) {
// runs once when the firmware starts up
uint8_t led_delay_ms = 80;
for (int i = 0; i < 2; i++) {
writePinHigh(LED_00);
writePinHigh(LED_01);
gpio_write_pin_high(LED_00);
gpio_write_pin_high(LED_01);
wait_ms(led_delay_ms);
writePinLow(LED_00);
writePinLow(LED_01);
gpio_write_pin_low(LED_00);
gpio_write_pin_low(LED_01);
if (i < 1) {
wait_ms(led_delay_ms);
}

View file

@ -17,8 +17,8 @@
void keyboard_pre_init_kb(void) {
// Set LED IO as outputs
setPinOutput(LED_00);
setPinOutput(LED_01);
gpio_set_pin_output(LED_00);
gpio_set_pin_output(LED_01);
keyboard_pre_init_user();
}
@ -27,16 +27,16 @@ bool shutdown_kb(bool jump_to_bootloader) {
return false;
}
// Shutdown LEDs
writePinLow(LED_00);
writePinLow(LED_01);
gpio_write_pin_low(LED_00);
gpio_write_pin_low(LED_01);
return true;
}
layer_state_t layer_state_set_kb(layer_state_t state) {
// Layer LEDs act as binary indication of current layer
uint8_t layer = get_highest_layer(state);
writePin(LED_00, layer & 0b1);
writePin(LED_01, (layer >> 1) & 0b1);
gpio_write_pin(LED_00, layer & 0b1);
gpio_write_pin(LED_01, (layer >> 1) & 0b1);
return layer_state_set_user(state);
}
@ -49,11 +49,11 @@ void matrix_init_kb(void) {
// runs once when the firmware starts up
uint8_t led_delay_ms = 80;
for (int i = 0; i < 2; i++) {
writePinHigh(LED_00);
writePinHigh(LED_01);
gpio_write_pin_high(LED_00);
gpio_write_pin_high(LED_01);
wait_ms(led_delay_ms);
writePinLow(LED_00);
writePinLow(LED_01);
gpio_write_pin_low(LED_00);
gpio_write_pin_low(LED_01);
if (i < 1) {
wait_ms(led_delay_ms);
}

View file

@ -17,9 +17,9 @@
void keyboard_pre_init_kb(void) {
// Set LED IO as outputs
setPinOutput(LED_00);
setPinOutput(LED_01);
setPinOutput(LED_02);
gpio_set_pin_output(LED_00);
gpio_set_pin_output(LED_01);
gpio_set_pin_output(LED_02);
keyboard_pre_init_user();
}
@ -28,17 +28,17 @@ bool shutdown_kb(bool jump_to_bootloader) {
return false;
}
// Shutdown LEDs
writePinLow(LED_00);
writePinLow(LED_01);
writePinLow(LED_02);
gpio_write_pin_low(LED_00);
gpio_write_pin_low(LED_01);
gpio_write_pin_low(LED_02);
return true;
}
layer_state_t layer_state_set_kb(layer_state_t state) {
// Layer LEDs act as binary indication of current layer
uint8_t layer = get_highest_layer(state);
writePin(LED_00, layer & 0b1);
writePin(LED_01, (layer >> 1) & 0b1);
gpio_write_pin(LED_00, layer & 0b1);
gpio_write_pin(LED_01, (layer >> 1) & 0b1);
return layer_state_set_user(state);
}
@ -51,13 +51,13 @@ void matrix_init_kb(void) {
// runs once when the firmware starts up
uint8_t led_delay_ms = 80;
for (int i = 0; i < 2; i++) {
writePinHigh(LED_00);
writePinHigh(LED_01);
writePinHigh(LED_02);
gpio_write_pin_high(LED_00);
gpio_write_pin_high(LED_01);
gpio_write_pin_high(LED_02);
wait_ms(led_delay_ms);
writePinLow(LED_00);
writePinLow(LED_01);
writePinLow(LED_02);
gpio_write_pin_low(LED_00);
gpio_write_pin_low(LED_01);
gpio_write_pin_low(LED_02);
if (i < 1) {
wait_ms(led_delay_ms);
}
@ -69,7 +69,7 @@ void matrix_init_kb(void) {
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if(res) {
writePin(LED_02, !led_state.num_lock);
gpio_write_pin(LED_02, !led_state.num_lock);
}
return res;
}

View file

@ -17,9 +17,9 @@
void keyboard_pre_init_kb(void) {
// Set LED IO as outputs
setPinOutput(LED_00);
setPinOutput(LED_01);
setPinOutput(LED_02);
gpio_set_pin_output(LED_00);
gpio_set_pin_output(LED_01);
gpio_set_pin_output(LED_02);
keyboard_pre_init_user();
}
@ -28,17 +28,17 @@ bool shutdown_kb(bool jump_to_bootloader) {
return false;
}
// Shutdown LEDs
writePinLow(LED_00);
writePinLow(LED_01);
writePinLow(LED_02);
gpio_write_pin_low(LED_00);
gpio_write_pin_low(LED_01);
gpio_write_pin_low(LED_02);
return true;
}
layer_state_t layer_state_set_kb(layer_state_t state) {
// Layer LEDs act as binary indication of current layer
uint8_t layer = get_highest_layer(state);
writePin(LED_00, layer & 0b1);
writePin(LED_01, (layer >> 1) & 0b1);
gpio_write_pin(LED_00, layer & 0b1);
gpio_write_pin(LED_01, (layer >> 1) & 0b1);
return layer_state_set_user(state);
}
@ -51,13 +51,13 @@ void matrix_init_kb(void) {
// runs once when the firmware starts up
uint8_t led_delay_ms = 80;
for (int i = 0; i < 2; i++) {
writePinHigh(LED_00);
writePinHigh(LED_01);
writePinHigh(LED_02);
gpio_write_pin_high(LED_00);
gpio_write_pin_high(LED_01);
gpio_write_pin_high(LED_02);
wait_ms(led_delay_ms);
writePinLow(LED_00);
writePinLow(LED_01);
writePinLow(LED_02);
gpio_write_pin_low(LED_00);
gpio_write_pin_low(LED_01);
gpio_write_pin_low(LED_02);
if (i < 1) {
wait_ms(led_delay_ms);
}
@ -69,7 +69,7 @@ void matrix_init_kb(void) {
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if(res) {
writePin(LED_02, !led_state.num_lock);
gpio_write_pin(LED_02, !led_state.num_lock);
}
return res;
}

View file

@ -17,9 +17,9 @@
void keyboard_pre_init_kb(void) {
// Set LED IO as outputs
setPinOutput(LED_00);
setPinOutput(LED_01);
setPinOutput(LED_02);
gpio_set_pin_output(LED_00);
gpio_set_pin_output(LED_01);
gpio_set_pin_output(LED_02);
keyboard_pre_init_user();
}
@ -28,17 +28,17 @@ bool shutdown_kb(bool jump_to_bootloader) {
return false;
}
// Shutdown LEDs
writePinLow(LED_00);
writePinLow(LED_01);
writePinLow(LED_02);
gpio_write_pin_low(LED_00);
gpio_write_pin_low(LED_01);
gpio_write_pin_low(LED_02);
return true;
}
layer_state_t layer_state_set_kb(layer_state_t state) {
// Layer LEDs act as binary indication of current layer
uint8_t layer = get_highest_layer(state);
writePin(LED_00, layer & 0b1);
writePin(LED_01, (layer >> 1) & 0b1);
gpio_write_pin(LED_00, layer & 0b1);
gpio_write_pin(LED_01, (layer >> 1) & 0b1);
return layer_state_set_user(state);
}
@ -51,13 +51,13 @@ void matrix_init_kb(void) {
// runs once when the firmware starts up
uint8_t led_delay_ms = 80;
for (int i = 0; i < 2; i++) {
writePinHigh(LED_00);
writePinHigh(LED_01);
writePinHigh(LED_02);
gpio_write_pin_high(LED_00);
gpio_write_pin_high(LED_01);
gpio_write_pin_high(LED_02);
wait_ms(led_delay_ms);
writePinLow(LED_00);
writePinLow(LED_01);
writePinLow(LED_02);
gpio_write_pin_low(LED_00);
gpio_write_pin_low(LED_01);
gpio_write_pin_low(LED_02);
if (i < 1) {
wait_ms(led_delay_ms);
}
@ -69,7 +69,7 @@ void matrix_init_kb(void) {
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if(res) {
writePin(LED_02, !led_state.num_lock);
gpio_write_pin(LED_02, !led_state.num_lock);
}
return res;
}

View file

@ -48,9 +48,9 @@ led_config_t g_led_config = {{// Key Matrix to LED Index
void keyboard_pre_init_kb(void) {
// Set LED IO as outputs
setPinOutput(LED_00);
setPinOutput(LED_01);
setPinOutput(LED_02);
gpio_set_pin_output(LED_00);
gpio_set_pin_output(LED_01);
gpio_set_pin_output(LED_02);
keyboard_pre_init_user();
}
@ -59,17 +59,17 @@ bool shutdown_kb(bool jump_to_bootloader) {
return false;
}
// Shutdown LEDs
writePinLow(LED_00);
writePinLow(LED_01);
writePinLow(LED_02);
gpio_write_pin_low(LED_00);
gpio_write_pin_low(LED_01);
gpio_write_pin_low(LED_02);
return true;
}
layer_state_t layer_state_set_kb(layer_state_t state) {
// Layer LEDs act as binary indication of current layer
uint8_t layer = get_highest_layer(state);
writePin(LED_00, layer & 0b1);
writePin(LED_01, (layer >> 1) & 0b1);
gpio_write_pin(LED_00, layer & 0b1);
gpio_write_pin(LED_01, (layer >> 1) & 0b1);
uprintf("%d string", layer);
return layer_state_set_user(state);
}
@ -83,13 +83,13 @@ void matrix_init_kb(void) {
// runs once when the firmware starts up
uint8_t led_delay_ms = 80;
for (int i = 0; i < 2; i++) {
writePinHigh(LED_00);
writePinHigh(LED_01);
writePinHigh(LED_02);
gpio_write_pin_high(LED_00);
gpio_write_pin_high(LED_01);
gpio_write_pin_high(LED_02);
wait_ms(led_delay_ms);
writePinLow(LED_00);
writePinLow(LED_01);
writePinLow(LED_02);
gpio_write_pin_low(LED_00);
gpio_write_pin_low(LED_01);
gpio_write_pin_low(LED_02);
if (i < 1) {
wait_ms(led_delay_ms);
}
@ -101,6 +101,6 @@ void matrix_init_kb(void) {
bool led_update_kb(led_t led_state) {
if (!led_update_user(led_state)) return false;
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
writePin(LED_02, !led_state.num_lock);
gpio_write_pin(LED_02, !led_state.num_lock);
return true;
}

View file

@ -18,22 +18,22 @@
/* Private Functions */
void off_all_leds(void) {
writePinHigh(LED_CAPS_LOCK_PIN);
writePinHigh(LED_WIN_LOCK_PIN);
writePinHigh(LED_MR_LOCK_PIN);
gpio_write_pin_high(LED_CAPS_LOCK_PIN);
gpio_write_pin_high(LED_WIN_LOCK_PIN);
gpio_write_pin_high(LED_MR_LOCK_PIN);
}
void on_all_leds(void) {
writePinLow(LED_CAPS_LOCK_PIN);
writePinLow(LED_WIN_LOCK_PIN);
writePinLow(LED_MR_LOCK_PIN);
gpio_write_pin_low(LED_CAPS_LOCK_PIN);
gpio_write_pin_low(LED_WIN_LOCK_PIN);
gpio_write_pin_low(LED_MR_LOCK_PIN);
}
/* WinLock and MR LEDs are non-standard. Need to override led init */
void led_init_ports(void) {
setPinOutput(LED_CAPS_LOCK_PIN);
setPinOutput(LED_WIN_LOCK_PIN);
setPinOutput(LED_MR_LOCK_PIN);
gpio_set_pin_output(LED_CAPS_LOCK_PIN);
gpio_set_pin_output(LED_WIN_LOCK_PIN);
gpio_set_pin_output(LED_MR_LOCK_PIN);
off_all_leds();
}
@ -44,7 +44,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
case GU_TOGG:
if (record->event.pressed) {
// Toggle LED on key press
togglePin(LED_WIN_LOCK_PIN);
gpio_toggle_pin(LED_WIN_LOCK_PIN);
}
break;
}

View file

@ -22,33 +22,33 @@
/* Private Functions */
void off_all_leds(void) {
#ifdef LED_NUM_LOCK_PIN
writePinHigh(LED_NUM_LOCK_PIN);
gpio_write_pin_high(LED_NUM_LOCK_PIN);
#endif
writePinHigh(LED_CAPS_LOCK_PIN);
writePinHigh(LED_SCROLL_LOCK_PIN);
writePinHigh(LED_WIN_LOCK_PIN);
writePinHigh(LED_MR_LOCK_PIN);
gpio_write_pin_high(LED_CAPS_LOCK_PIN);
gpio_write_pin_high(LED_SCROLL_LOCK_PIN);
gpio_write_pin_high(LED_WIN_LOCK_PIN);
gpio_write_pin_high(LED_MR_LOCK_PIN);
}
void on_all_leds(void) {
#ifdef LED_NUM_LOCK_PIN
writePinLow(LED_NUM_LOCK_PIN);
gpio_write_pin_low(LED_NUM_LOCK_PIN);
#endif
writePinLow(LED_CAPS_LOCK_PIN);
writePinLow(LED_SCROLL_LOCK_PIN);
writePinLow(LED_WIN_LOCK_PIN);
writePinLow(LED_MR_LOCK_PIN);
gpio_write_pin_low(LED_CAPS_LOCK_PIN);
gpio_write_pin_low(LED_SCROLL_LOCK_PIN);
gpio_write_pin_low(LED_WIN_LOCK_PIN);
gpio_write_pin_low(LED_MR_LOCK_PIN);
}
/* WinLock and MR LEDs are non-standard. Need to override led init */
void led_init_ports(void) {
#ifdef LED_NUM_LOCK_PIN
setPinOutput(LED_NUM_LOCK_PIN);
gpio_set_pin_output(LED_NUM_LOCK_PIN);
#endif
setPinOutput(LED_CAPS_LOCK_PIN);
setPinOutput(LED_SCROLL_LOCK_PIN);
setPinOutput(LED_WIN_LOCK_PIN);
setPinOutput(LED_MR_LOCK_PIN);
gpio_set_pin_output(LED_CAPS_LOCK_PIN);
gpio_set_pin_output(LED_SCROLL_LOCK_PIN);
gpio_set_pin_output(LED_WIN_LOCK_PIN);
gpio_set_pin_output(LED_MR_LOCK_PIN);
off_all_leds();
}
@ -58,7 +58,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
case GU_TOGG:
if (record->event.pressed) {
// Toggle LED on key press
togglePin(LED_WIN_LOCK_PIN);
gpio_toggle_pin(LED_WIN_LOCK_PIN);
}
break;
}
@ -75,7 +75,7 @@ static void hardware_reset_cb(void *arg) {
#endif
void keyboard_pre_init_kb(void) {
setPinInputHigh(HARDWARE_RESET_PIN);
gpio_set_pin_input_high(HARDWARE_RESET_PIN);
#ifndef HW_RESET_PIN_DISABLED
/* Jump to bootloader when the hardware reset button is pressed */
@ -83,7 +83,7 @@ void keyboard_pre_init_kb(void) {
palSetPadCallback(PAL_PORT(HARDWARE_RESET_PIN), PAL_PAD(HARDWARE_RESET_PIN), hardware_reset_cb, NULL);
/* The interrupt is edge-triggered so check that it's not already pressed */
if (!readPin(HARDWARE_RESET_PIN)) {
if (!gpio_read_pin(HARDWARE_RESET_PIN)) {
bootloader_jump();
}
#endif

View file

@ -22,33 +22,33 @@
/* Private Functions */
void off_all_leds(void) {
#ifdef LED_NUM_LOCK_PIN
writePinHigh(LED_NUM_LOCK_PIN);
gpio_write_pin_high(LED_NUM_LOCK_PIN);
#endif
writePinHigh(LED_CAPS_LOCK_PIN);
writePinHigh(LED_SCROLL_LOCK_PIN);
writePinHigh(LED_WIN_LOCK_PIN);
writePinHigh(LED_MR_LOCK_PIN);
gpio_write_pin_high(LED_CAPS_LOCK_PIN);
gpio_write_pin_high(LED_SCROLL_LOCK_PIN);
gpio_write_pin_high(LED_WIN_LOCK_PIN);
gpio_write_pin_high(LED_MR_LOCK_PIN);
}
void on_all_leds(void) {
#ifdef LED_NUM_LOCK_PIN
writePinLow(LED_NUM_LOCK_PIN);
gpio_write_pin_low(LED_NUM_LOCK_PIN);
#endif
writePinLow(LED_CAPS_LOCK_PIN);
writePinLow(LED_SCROLL_LOCK_PIN);
writePinLow(LED_WIN_LOCK_PIN);
writePinLow(LED_MR_LOCK_PIN);
gpio_write_pin_low(LED_CAPS_LOCK_PIN);
gpio_write_pin_low(LED_SCROLL_LOCK_PIN);
gpio_write_pin_low(LED_WIN_LOCK_PIN);
gpio_write_pin_low(LED_MR_LOCK_PIN);
}
/* WinLock and MR LEDs are non-standard. Need to override led init */
void led_init_ports(void) {
#ifdef LED_NUM_LOCK_PIN
setPinOutput(LED_NUM_LOCK_PIN);
gpio_set_pin_output(LED_NUM_LOCK_PIN);
#endif
setPinOutput(LED_CAPS_LOCK_PIN);
setPinOutput(LED_SCROLL_LOCK_PIN);
setPinOutput(LED_WIN_LOCK_PIN);
setPinOutput(LED_MR_LOCK_PIN);
gpio_set_pin_output(LED_CAPS_LOCK_PIN);
gpio_set_pin_output(LED_SCROLL_LOCK_PIN);
gpio_set_pin_output(LED_WIN_LOCK_PIN);
gpio_set_pin_output(LED_MR_LOCK_PIN);
off_all_leds();
}
@ -58,7 +58,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
case GU_TOGG:
if (record->event.pressed) {
// Toggle LED on key press
togglePin(LED_WIN_LOCK_PIN);
gpio_toggle_pin(LED_WIN_LOCK_PIN);
}
break;
}
@ -75,7 +75,7 @@ static void hardware_reset_cb(void *arg) {
#endif
void keyboard_pre_init_kb(void) {
setPinInputHigh(HARDWARE_RESET_PIN);
gpio_set_pin_input_high(HARDWARE_RESET_PIN);
#ifndef HW_RESET_PIN_DISABLED
/* Jump to bootloader when the hardware reset button is pressed */
@ -83,7 +83,7 @@ void keyboard_pre_init_kb(void) {
palSetPadCallback(PAL_PORT(HARDWARE_RESET_PIN), PAL_PAD(HARDWARE_RESET_PIN), hardware_reset_cb, NULL);
/* The interrupt is edge-triggered so check that it's not already pressed */
if (!readPin(HARDWARE_RESET_PIN)) {
if (!gpio_read_pin(HARDWARE_RESET_PIN)) {
bootloader_jump();
}
#endif

View file

@ -16,14 +16,14 @@
#include "quantum.h"
void matrix_init_kb(void) {
setPinOutput(E6);
gpio_set_pin_output(E6);
matrix_init_user();
}
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if(res) {
writePin(E6, !led_state.caps_lock);
gpio_write_pin(E6, !led_state.caps_lock);
}
return res;
}

View file

@ -54,14 +54,14 @@ bool encoder_update_kb(uint8_t index, bool clockwise) {
}
void keyboard_pre_init_kb(void) {
setPinOutput(F0);
gpio_set_pin_output(F0);
keyboard_pre_init_user();
}
bool led_update_kb(led_t led_state) {
if (led_update_user(led_state)) {
writePin(F0, led_state.caps_lock);
gpio_write_pin(F0, led_state.caps_lock);
}
return true;
}

View file

@ -18,32 +18,32 @@ void keyboard_pre_init_kb(void) {
keyboard_pre_init_user();
// Set our LED pins as output
setPinOutput(B2);
setPinOutput(B1);
setPinOutput(B0);
gpio_set_pin_output(B2);
gpio_set_pin_output(B1);
gpio_set_pin_output(B0);
}
__attribute__((weak)) layer_state_t layer_state_set_user(layer_state_t state) {
switch (get_highest_layer(state)) {
case 1:
writePin(B2, 1);
writePin(B1, 0);
writePin(B0, 0);
gpio_write_pin(B2, 1);
gpio_write_pin(B1, 0);
gpio_write_pin(B0, 0);
break;
case 2:
writePin(B2, 1);
writePin(B1, 1);
writePin(B0, 0);
gpio_write_pin(B2, 1);
gpio_write_pin(B1, 1);
gpio_write_pin(B0, 0);
break;
case 3:
writePin(B2, 1);
writePin(B1, 1);
writePin(B0, 1);
gpio_write_pin(B2, 1);
gpio_write_pin(B1, 1);
gpio_write_pin(B0, 1);
break;
default: // for any other layers, or the default layer
writePin(B2, 0);
writePin(B1, 0);
writePin(B0, 0);
gpio_write_pin(B2, 0);
gpio_write_pin(B1, 0);
gpio_write_pin(B0, 0);
break;
}
return state;

View file

@ -3,15 +3,15 @@
#include "quantum.h"
void matrix_init_user(void) {
setPinOutput(GP9); //init gpio
writePinLow(GP9);
setPinOutput(GP11); //init and turn off inverted power led
writePinHigh(GP11);
gpio_set_pin_output(GP9); //init gpio
gpio_write_pin_low(GP9);
gpio_set_pin_output(GP11); //init and turn off inverted power led
gpio_write_pin_high(GP11);
}
//layer, capslock and numlock
layer_state_t layer_state_set_user(layer_state_t state) {
writePin(GP9, layer_state_cmp(state, 1));
gpio_write_pin(GP9, layer_state_cmp(state, 1));
return state;
}

View file

@ -130,12 +130,12 @@ 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);
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);
}
static matrix_row_t read_cols(uint8_t row) {
@ -176,13 +176,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;
}
}

View file

@ -16,22 +16,22 @@
#include "quantum.h"
void led_init_ports(void) {
setPinOutput(E6);
setPinOutput(B1);
setPinOutput(D0);
setPinOutput(D1);
setPinOutput(F0);
gpio_set_pin_output(E6);
gpio_set_pin_output(B1);
gpio_set_pin_output(D0);
gpio_set_pin_output(D1);
gpio_set_pin_output(F0);
writePinHigh(E6);
writePinHigh(B1);
writePinHigh(D0);
writePinHigh(D1);
writePinHigh(F0);
gpio_write_pin_high(E6);
gpio_write_pin_high(B1);
gpio_write_pin_high(D0);
gpio_write_pin_high(D1);
gpio_write_pin_high(F0);
}
bool led_update_kb(led_t led_state) {
if(led_update_user(led_state)) {
writePin(E6, !led_state.num_lock);
gpio_write_pin(E6, !led_state.num_lock);
}
return true;

View file

@ -17,6 +17,6 @@
void keyboard_pre_init_kb(void) {
// Enable top LED
setPinOutput(B3);
writePinLow(B3);
gpio_set_pin_output(B3);
gpio_write_pin_low(B3);
}

View file

@ -17,20 +17,20 @@
void led_init_ports(void) {
// * Enable LED anodes (Vbus pin is replaced by B0 on some boards)
setPinOutput(B0);
writePinHigh(B0);
gpio_set_pin_output(B0);
gpio_write_pin_high(B0);
// * Set our LED pins as output and high
setPinOutput(F5);
writePinHigh(F5);
gpio_set_pin_output(F5);
gpio_write_pin_high(F5);
setPinOutput(F4);
writePinLow(F4);
gpio_set_pin_output(F4);
gpio_write_pin_low(F4);
}
bool led_update_kb(led_t led_state) {
if(led_update_user(led_state)) {
writePin(F5, !led_state.caps_lock);
gpio_write_pin(F5, !led_state.caps_lock);
}
return true;

View file

@ -46,7 +46,7 @@ static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
*/
static void select_col(uint8_t col) {
if (col_pins[col] != NO_PIN) {
writePinLow(col_pins[col]);
gpio_write_pin_low(col_pins[col]);
} else {
sn74x138_set_addr(13 - col);
}
@ -54,8 +54,8 @@ static void select_col(uint8_t col) {
static void unselect_col(uint8_t col) {
if (col_pins[col] != NO_PIN) {
setPinOutput(col_pins[col]);
writePinHigh(col_pins[col]);
gpio_set_pin_output(col_pins[col]);
gpio_write_pin_high(col_pins[col]);
} else {
sn74x138_set_addr(0);
}
@ -65,8 +65,8 @@ static void unselect_cols(void) {
// Native
for (uint8_t x = 0; x < MATRIX_COLS; x++) {
if (col_pins[x] != NO_PIN) {
setPinOutput(col_pins[x]);
writePinHigh(col_pins[x]);
gpio_set_pin_output(col_pins[x]);
gpio_write_pin_high(col_pins[x]);
}
}
@ -77,7 +77,7 @@ static void unselect_cols(void) {
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]);
}
}
@ -94,7 +94,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 {

View file

@ -48,7 +48,7 @@ static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
*/
static void select_col(uint8_t col) {
if (col_pins[col] != NO_PIN) {
writePinLow(col_pins[col]);
gpio_write_pin_low(col_pins[col]);
} else {
sn74x138_set_addr((col == 6) ? 7 : 15 - col);
sn74x138_set_enabled(true);
@ -57,8 +57,8 @@ static void select_col(uint8_t col) {
static void unselect_col(uint8_t col) {
if (col_pins[col] != NO_PIN) {
setPinOutput(col_pins[col]);
writePinHigh(col_pins[col]);
gpio_set_pin_output(col_pins[col]);
gpio_write_pin_high(col_pins[col]);
} else {
sn74x138_set_enabled(false);
}
@ -68,8 +68,8 @@ static void unselect_cols(void) {
// Native
for (uint8_t x = 0; x < MATRIX_COLS; x++) {
if (col_pins[x] != NO_PIN) {
setPinOutput(col_pins[x]);
writePinHigh(col_pins[x]);
gpio_set_pin_output(col_pins[x]);
gpio_write_pin_high(col_pins[x]);
}
}
@ -80,7 +80,7 @@ static void unselect_cols(void) {
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]);
}
}
@ -97,7 +97,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 {

View file

@ -1,15 +1,15 @@
#include "quantum.h"
void led_init_ports(void) {
setPinOutput(B2);
setPinOutput(B6);
gpio_set_pin_output(B2);
gpio_set_pin_output(B6);
}
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if(res) {
writePin(B2, !led_state.caps_lock);
writePin(B6, led_state.raw == 0);
gpio_write_pin(B2, !led_state.caps_lock);
gpio_write_pin(B6, led_state.raw == 0);
}
return res;
}

View file

@ -17,16 +17,16 @@
#include "quantum.h"
void keyboard_pre_init_kb(void) {
setPinOutput(C7);
setPinOutput(B5);
gpio_set_pin_output(C7);
gpio_set_pin_output(B5);
keyboard_pre_init_user();
}
bool led_update_kb(led_t led_state) {
if (led_update_user(led_state)) {
writePin(C7, led_state.caps_lock);
writePin(B5, led_state.scroll_lock);
gpio_write_pin(C7, led_state.caps_lock);
gpio_write_pin(B5, led_state.scroll_lock);
}
return true;
}

View file

@ -17,16 +17,16 @@
#include "quantum.h"
void keyboard_pre_init_kb(void) {
setPinOutput(C7);
setPinOutput(B5);
gpio_set_pin_output(C7);
gpio_set_pin_output(B5);
keyboard_pre_init_user();
}
bool led_update_kb(led_t led_state) {
if (led_update_user(led_state)) {
writePin(C7, led_state.caps_lock);
writePin(B5, led_state.scroll_lock);
gpio_write_pin(C7, led_state.caps_lock);
gpio_write_pin(B5, led_state.scroll_lock);
}
return true;
}

View file

@ -182,8 +182,8 @@ static void init_cols(void) {
pin_t matrix_col_pins_mcu[MATRIX_COLS_PER_SIDE] = MATRIX_COL_PINS_MCU;
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);
}
}
@ -194,7 +194,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);
@ -229,8 +229,8 @@ static void unselect_rows(void) {
pin_t matrix_row_pins_mcu[MATRIX_ROWS_PER_SIDE] = MATRIX_ROW_PINS_MCU;
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);
}
}
@ -239,8 +239,8 @@ static void select_row(uint8_t row) {
// select on atmega32u4
pin_t matrix_row_pins_mcu[MATRIX_ROWS_PER_SIDE] = MATRIX_ROW_PINS_MCU;
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 mcp23017
if (mcp23017_status) { // if there was an error

View file

@ -173,7 +173,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);
@ -199,7 +199,7 @@ static matrix_row_t read_cols(uint8_t row) {
static void unselect_row(uint8_t row) {
pin_t matrix_row_pins_mcu[MATRIX_ROWS_PER_SIDE] = MATRIX_ROW_PINS_MCU;
setPinInputHigh(matrix_row_pins_mcu[row]);
gpio_set_pin_input_high(matrix_row_pins_mcu[row]);
}
static void unselect_rows(void) {
@ -211,14 +211,14 @@ static void unselect_rows(void) {
pin_t matrix_row_pins_mcu[MATRIX_ROWS_PER_SIDE] = MATRIX_ROW_PINS_MCU;
for (int pin_index = 0; pin_index < MATRIX_ROWS_PER_SIDE; pin_index++) {
pin_t pin = matrix_row_pins_mcu[pin_index];
setPinInputHigh(pin);
gpio_set_pin_input_high(pin);
}
}
static void unselect_cols(void) {
pin_t matrix_col_pins_mcu[MATRIX_COLS_PER_SIDE] = MATRIX_COL_PINS_MCU;
for (int pin_index = 0; pin_index < MATRIX_COLS_PER_SIDE; pin_index++) {
pin_t pin = matrix_col_pins_mcu[pin_index];
setPinInputHigh(pin);
gpio_set_pin_input_high(pin);
}
}
@ -227,8 +227,8 @@ static void select_row(uint8_t row) {
// select on MCU
pin_t matrix_row_pins_mcu[MATRIX_ROWS_PER_SIDE] = MATRIX_ROW_PINS_MCU;
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 mcp23017
if (mcp23017_status) { // if there was an error

View file

@ -15,14 +15,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
void matrix_init_kb(void) {
// Initialize indicator LEDs to output
setPinOutput(F7); // Caps
gpio_set_pin_output(F7); // Caps
matrix_init_user();
}
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if(res) {
writePin(F7, led_state.caps_lock);
gpio_write_pin(F7, led_state.caps_lock);
}
return res;
}

View file

@ -20,15 +20,15 @@ void matrix_init_kb(void) {
// put your keyboard start-up code here
// runs once when the firmware starts up
setPinOutput(E6);
setPinOutput(B2);
gpio_set_pin_output(E6);
gpio_set_pin_output(B2);
matrix_init_user();
}
bool led_update_kb(led_t led_state) {
if(led_update_user(led_state)) {
writePin(E6, !led_state.caps_lock);
writePin(B2, !led_state.scroll_lock);
gpio_write_pin(E6, !led_state.caps_lock);
gpio_write_pin(B2, !led_state.scroll_lock);
}
return true;
}

View file

@ -168,7 +168,7 @@ void matrix_print(void) {
// Remember this means ROWS
static void init_cols(void) {
for (uint8_t col = 0; col < MATRIX_COLS; col++) {
setPinInputHigh(col_pins[col]);
gpio_set_pin_input_high(col_pins[col]);
}
}
@ -195,8 +195,8 @@ static void unselect_rows(void) {
// the other row bits high, and it's not changing to a different direction
for (uint8_t row = 0; row < MATRIX_ROWS_PER_SIDE; row++) {
setPinInput(row_pins[row]);
writePinLow(row_pins[row]);
gpio_set_pin_input(row_pins[row]);
gpio_write_pin_low(row_pins[row]);
}
}
@ -211,7 +211,7 @@ static void select_row(uint8_t row) {
}
} else {
setPinOutput(row_pins[row - MATRIX_ROWS_PER_SIDE]);
writePinLow(row_pins[row - MATRIX_ROWS_PER_SIDE]);
gpio_set_pin_output(row_pins[row - MATRIX_ROWS_PER_SIDE]);
gpio_write_pin_low(row_pins[row - MATRIX_ROWS_PER_SIDE]);
}
}

Some files were not shown because too many files have changed in this diff Show more