Browse Source

convert gpio commands

pull/22181/head
Drashna Jael're 2 months ago
parent
commit
fc2aa7007e
No known key found for this signature in database GPG Key ID: DBA1FD3A860D1B11
4 changed files with 38 additions and 33 deletions
  1. +6
    -1
      keyboards/zsa/moonlander/matrix.c
  2. +12
    -12
      keyboards/zsa/voyager/matrix.c
  3. +18
    -18
      keyboards/zsa/voyager/voyager.c
  4. +2
    -2
      keyboards/zsa/voyager/voyager.h

+ 6
- 1
keyboards/zsa/moonlander/matrix.c View File

@ -19,6 +19,8 @@
#include "moonlander.h"
#include "i2c_master.h"
#pragma GCC push_options
#pragma GCC optimize("-O3")
/*
#define MATRIX_ROW_PINS { B10, B11, B12, B13, B14, B15 } outputs
#define MATRIX_COL_PINS { A0, A1, A2, A3, A6, A7, B0 } inputs
@ -230,4 +232,7 @@ void matrix_power_up(void) {
bool is_transport_connected(void) {
return mcp23018_initd;
}
}
#pragma GCC pop_options

+ 12
- 12
keyboards/zsa/voyager/matrix.c View File

@ -81,22 +81,22 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) {
// strobe row
switch (row) {
case 0:
writePinHigh(B10);
gpio_write_pin_high(B10);
break;
case 1:
writePinHigh(B11);
gpio_write_pin_high(B11);
break;
case 2:
writePinHigh(B12);
gpio_write_pin_high(B12);
break;
case 3:
writePinHigh(B13);
gpio_write_pin_high(B13);
break;
case 4:
writePinHigh(B14);
gpio_write_pin_high(B14);
break;
case 5:
writePinHigh(B15);
gpio_write_pin_high(B15);
break;
case 6:
break; // Left hand has 6 rows
@ -120,22 +120,22 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) {
// unstrobe row
switch (row) {
case 0:
writePinLow(B10);
gpio_write_pin_low(B10);
break;
case 1:
writePinLow(B11);
gpio_write_pin_low(B11);
break;
case 2:
writePinLow(B12);
gpio_write_pin_low(B12);
break;
case 3:
writePinLow(B13);
gpio_write_pin_low(B13);
break;
case 4:
writePinLow(B14);
gpio_write_pin_low(B14);
break;
case 5:
writePinLow(B15);
gpio_write_pin_low(B15);
break;
case 6:
break;


+ 18
- 18
keyboards/zsa/voyager/voyager.c View File

@ -69,17 +69,17 @@ static THD_FUNCTION(LEDThread, arg) {
void keyboard_pre_init_kb(void) {
// Initialize Reset pins
setPinInput(A8);
setPinOutput(A9);
writePinLow(A9);
gpio_set_pin_input(A8);
gpio_set_pin_output(A9);
gpio_write_pin_low(A9);
setPinOutput(B5);
setPinOutput(B4);
setPinOutput(B3);
gpio_set_pin_output(B5);
gpio_set_pin_output(B4);
gpio_set_pin_output(B3);
writePinLow(B5);
writePinLow(B4);
writePinLow(B3);
gpio_write_pin_low(B5);
gpio_write_pin_low(B4);
gpio_write_pin_low(B3);
chThdCreateStatic(waLEDThread, sizeof(waLEDThread), NORMALPRIO - 16, LEDThread, NULL);
keyboard_pre_init_user();
@ -280,22 +280,22 @@ __attribute__((weak)) void bootloader_jump(void) {
// Setting both A8 and A9 high will charge the capacitor quickly.
// Setting A9 low before reset will cause the capacitor to discharge
// thus making the bootloder unlikely to trigger twice between power cycles.
setPinOutputPushPull(A9);
setPinOutputPushPull(A8);
writePinHigh(A9);
writePinHigh(A8);
gpio_set_pin_output_push_pull(A9);
gpio_set_pin_output_push_pull(A8);
gpio_write_pin_high(A9);
gpio_write_pin_high(A8);
wait_ms(500);
writePinLow(A9);
gpio_write_pin_low(A9);
NVIC_SystemReset();
}
__attribute__((weak)) void mcu_reset(void) {
setPinOutputPushPull(A9);
setPinOutputPushPull(A8);
writePinLow(A8);
writePinLow(A9);
gpio_set_pin_output_push_pull(A9);
gpio_set_pin_output_push_pull(A8);
gpio_write_pin_low(A8);
gpio_write_pin_low(A9);
NVIC_SystemReset();
}

+ 2
- 2
keyboards/zsa/voyager/voyager.h View File

@ -10,8 +10,8 @@ extern bool mcp23018_leds[];
#define MCP23018_DEFAULT_ADDRESS 0b0100000
#define STATUS_LED_1(status) writePin(B5, (bool)(status))
#define STATUS_LED_2(status) writePin(B4, (bool)(status))
#define STATUS_LED_1(status) gpio_write_pin(B5, (bool)(status))
#define STATUS_LED_2(status) gpio_write_pin(B4, (bool)(status))
#define STATUS_LED_3(status) mcp23018_leds[0] = (bool)(status)
#define STATUS_LED_4(status) mcp23018_leds[1] = (bool)(status)


Loading…
Cancel
Save