Update GPIO API usage in keyboard code (#23361)
This commit is contained in:
@@ -43,27 +43,27 @@ 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 setPinInput_high(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);
|
||||
return gpio_read_pin(pin);
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
@@ -81,13 +81,13 @@ static void HC595_output(SIZE_T data, uint8_t bit) {
|
||||
ATOMIC_BLOCK_FORCEON {
|
||||
for (uint8_t i = 0; i < (SHIFT_COL_END - SHIFT_COL_START + 1); i++) {
|
||||
if (data & 0x1) {
|
||||
writePinHigh(HC595_DS);
|
||||
gpio_write_pin_high(HC595_DS);
|
||||
} else {
|
||||
writePinLow(HC595_DS);
|
||||
gpio_write_pin_low(HC595_DS);
|
||||
}
|
||||
writePinHigh(HC595_SHCP);
|
||||
gpio_write_pin_high(HC595_SHCP);
|
||||
HC595_delay(n);
|
||||
writePinLow(HC595_SHCP);
|
||||
gpio_write_pin_low(HC595_SHCP);
|
||||
HC595_delay(n);
|
||||
if (bit) {
|
||||
break;
|
||||
@@ -95,9 +95,9 @@ static void HC595_output(SIZE_T data, uint8_t bit) {
|
||||
data = data >> 1;
|
||||
}
|
||||
}
|
||||
writePinHigh(HC595_STCP);
|
||||
gpio_write_pin_high(HC595_STCP);
|
||||
HC595_delay(n);
|
||||
writePinLow(HC595_STCP);
|
||||
gpio_write_pin_low(HC595_STCP);
|
||||
HC595_delay(n);
|
||||
}
|
||||
}
|
||||
@@ -175,9 +175,9 @@ static void matrix_read_rows_on_col(matrix_row_t current_matrix[], uint8_t curre
|
||||
}
|
||||
|
||||
void matrix_init_custom(void) {
|
||||
setPinOutput(HC595_DS);
|
||||
setPinOutput(HC595_STCP);
|
||||
setPinOutput(HC595_SHCP);
|
||||
gpio_set_pin_output(HC595_DS);
|
||||
gpio_set_pin_output(HC595_STCP);
|
||||
gpio_set_pin_output(HC595_SHCP);
|
||||
|
||||
for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
|
||||
if (row_pins[x] != NO_PIN) {
|
||||
|
||||
@@ -36,27 +36,27 @@ static 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);
|
||||
return gpio_read_pin(pin);
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -130,12 +130,12 @@ void keyboard_post_init_kb(void) {
|
||||
// and disable USB connectivity when the ADC value exceeds 1000,
|
||||
// to avoid affecting the serial usart communication between the left hand and the right hand.
|
||||
if (is_keyboard_left()) {
|
||||
setPinOutput(A0);
|
||||
writePinHigh(A0);
|
||||
gpio_set_pin_output(A0);
|
||||
gpio_write_pin_high(A0);
|
||||
} else {
|
||||
if ((analogReadPin_my(B0) > 1000) || (analogReadPin_my(B1) > 1000)) {
|
||||
setPinInput(A11);
|
||||
setPinInput(A12);
|
||||
gpio_set_pin_input(A11);
|
||||
gpio_set_pin_input(A12);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,27 +36,27 @@ static 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);
|
||||
return gpio_read_pin(pin);
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -36,27 +36,27 @@ static 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);
|
||||
return gpio_read_pin(pin);
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -36,27 +36,27 @@ static 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);
|
||||
return gpio_read_pin(pin);
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -36,27 +36,27 @@ static 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);
|
||||
return gpio_read_pin(pin);
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -48,27 +48,27 @@ static 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);
|
||||
return gpio_read_pin(pin);
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -36,32 +36,32 @@ static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
|
||||
|
||||
static inline void writePinLow_atomic(pin_t pin) {
|
||||
ATOMIC_BLOCK_FORCEON {
|
||||
writePinLow(pin);
|
||||
gpio_write_pin_low(pin);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void writePinHigh_atomic(pin_t pin) {
|
||||
ATOMIC_BLOCK_FORCEON {
|
||||
writePinHigh(pin);
|
||||
gpio_write_pin_high(pin);
|
||||
}
|
||||
}
|
||||
|
||||
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 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);
|
||||
return gpio_read_pin(pin);
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
@@ -76,20 +76,20 @@ static void shiftOut(uint8_t dataOut) {
|
||||
for (uint8_t i = 0; i < 8; i++) {
|
||||
compiler_barrier();
|
||||
if (dataOut & 0x1) {
|
||||
writePinHigh(DATA_PIN);
|
||||
gpio_write_pin_high(DATA_PIN);
|
||||
} else {
|
||||
writePinLow(DATA_PIN);
|
||||
gpio_write_pin_low(DATA_PIN);
|
||||
}
|
||||
dataOut = dataOut >> 1;
|
||||
compiler_barrier();
|
||||
writePinHigh(CLOCK_PIN);
|
||||
gpio_write_pin_high(CLOCK_PIN);
|
||||
small_delay();
|
||||
writePinLow(CLOCK_PIN);
|
||||
gpio_write_pin_low(CLOCK_PIN);
|
||||
}
|
||||
compiler_barrier();
|
||||
writePinHigh(LATCH_PIN);
|
||||
gpio_write_pin_high(LATCH_PIN);
|
||||
small_delay();
|
||||
writePinLow(LATCH_PIN);
|
||||
gpio_write_pin_low(LATCH_PIN);
|
||||
compiler_barrier();
|
||||
}
|
||||
}
|
||||
@@ -98,18 +98,18 @@ static void shiftout_single(uint8_t data) {
|
||||
ATOMIC_BLOCK_FORCEON {
|
||||
compiler_barrier();
|
||||
if (data & 0x1) {
|
||||
writePinHigh(DATA_PIN);
|
||||
gpio_write_pin_high(DATA_PIN);
|
||||
} else {
|
||||
writePinLow(DATA_PIN);
|
||||
gpio_write_pin_low(DATA_PIN);
|
||||
}
|
||||
compiler_barrier();
|
||||
writePinHigh(CLOCK_PIN);
|
||||
gpio_write_pin_high(CLOCK_PIN);
|
||||
small_delay();
|
||||
writePinLow(CLOCK_PIN);
|
||||
gpio_write_pin_low(CLOCK_PIN);
|
||||
compiler_barrier();
|
||||
writePinHigh(LATCH_PIN);
|
||||
gpio_write_pin_high(LATCH_PIN);
|
||||
small_delay();
|
||||
writePinLow(LATCH_PIN);
|
||||
gpio_write_pin_low(LATCH_PIN);
|
||||
compiler_barrier();
|
||||
}
|
||||
}
|
||||
@@ -165,13 +165,13 @@ static void unselect_cols(void) {
|
||||
}
|
||||
|
||||
static void matrix_init_pins(void) {
|
||||
setPinOutput(DATA_PIN);
|
||||
setPinOutput(CLOCK_PIN);
|
||||
setPinOutput(LATCH_PIN);
|
||||
gpio_set_pin_output(DATA_PIN);
|
||||
gpio_set_pin_output(CLOCK_PIN);
|
||||
gpio_set_pin_output(LATCH_PIN);
|
||||
#ifdef MATRIX_UNSELECT_DRIVE_HIGH
|
||||
for (uint8_t x = 0; x < MATRIX_COLS; x++) {
|
||||
if (col_pins[x] != NO_PIN) {
|
||||
setPinOutput(col_pins[x]);
|
||||
gpio_set_pin_output(col_pins[x]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -36,27 +36,27 @@ static 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);
|
||||
return gpio_read_pin(pin);
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
@@ -71,20 +71,20 @@ static void shiftOut(uint8_t dataOut) {
|
||||
for (uint8_t i = 0; i < 8; i++) {
|
||||
compiler_barrier();
|
||||
if (dataOut & 0x1) {
|
||||
writePinHigh(DATA_PIN);
|
||||
gpio_write_pin_high(DATA_PIN);
|
||||
} else {
|
||||
writePinLow(DATA_PIN);
|
||||
gpio_write_pin_low(DATA_PIN);
|
||||
}
|
||||
dataOut = dataOut >> 1;
|
||||
compiler_barrier();
|
||||
writePinHigh(CLOCK_PIN);
|
||||
gpio_write_pin_high(CLOCK_PIN);
|
||||
small_delay();
|
||||
writePinLow(CLOCK_PIN);
|
||||
gpio_write_pin_low(CLOCK_PIN);
|
||||
}
|
||||
compiler_barrier();
|
||||
writePinHigh(LATCH_PIN);
|
||||
gpio_write_pin_high(LATCH_PIN);
|
||||
small_delay();
|
||||
writePinLow(LATCH_PIN);
|
||||
gpio_write_pin_low(LATCH_PIN);
|
||||
compiler_barrier();
|
||||
}
|
||||
}
|
||||
@@ -93,18 +93,18 @@ static void shiftOut_single(uint8_t data) {
|
||||
ATOMIC_BLOCK_FORCEON {
|
||||
compiler_barrier();
|
||||
if (data & 0x1) {
|
||||
writePinHigh(DATA_PIN);
|
||||
gpio_write_pin_high(DATA_PIN);
|
||||
} else {
|
||||
writePinLow(DATA_PIN);
|
||||
gpio_write_pin_low(DATA_PIN);
|
||||
}
|
||||
compiler_barrier();
|
||||
writePinHigh(CLOCK_PIN);
|
||||
gpio_write_pin_high(CLOCK_PIN);
|
||||
small_delay();
|
||||
writePinLow(CLOCK_PIN);
|
||||
gpio_write_pin_low(CLOCK_PIN);
|
||||
compiler_barrier();
|
||||
writePinHigh(LATCH_PIN);
|
||||
gpio_write_pin_high(LATCH_PIN);
|
||||
small_delay();
|
||||
writePinLow(LATCH_PIN);
|
||||
gpio_write_pin_low(LATCH_PIN);
|
||||
compiler_barrier();
|
||||
}
|
||||
}
|
||||
@@ -156,13 +156,13 @@ static void unselect_cols(void) {
|
||||
}
|
||||
|
||||
static void matrix_init_pins(void) {
|
||||
setPinOutput(DATA_PIN);
|
||||
setPinOutput(CLOCK_PIN);
|
||||
setPinOutput(LATCH_PIN);
|
||||
gpio_set_pin_output(DATA_PIN);
|
||||
gpio_set_pin_output(CLOCK_PIN);
|
||||
gpio_set_pin_output(LATCH_PIN);
|
||||
#ifdef MATRIX_UNSELECT_DRIVE_HIGH
|
||||
for (uint8_t x = 0; x < MATRIX_COLS; x++) {
|
||||
if (col_pins[x] != NO_PIN) {
|
||||
setPinOutput(col_pins[x]);
|
||||
gpio_set_pin_output(col_pins[x]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -36,27 +36,27 @@ static 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);
|
||||
return gpio_read_pin(pin);
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
@@ -70,34 +70,34 @@ static void shiftOut(uint16_t dataOut) {
|
||||
ATOMIC_BLOCK_FORCEON {
|
||||
for (uint8_t i = 0; i < PIN_USED_74HC595; i++) {
|
||||
if (dataOut & 0x1) {
|
||||
writePinHigh(DATA_PIN_74HC595);
|
||||
gpio_write_pin_high(DATA_PIN_74HC595);
|
||||
} else {
|
||||
writePinLow(DATA_PIN_74HC595);
|
||||
gpio_write_pin_low(DATA_PIN_74HC595);
|
||||
}
|
||||
dataOut = dataOut >> 1;
|
||||
writePinHigh(CLOCK_PIN_74HC595);
|
||||
gpio_write_pin_high(CLOCK_PIN_74HC595);
|
||||
small_delay(2);
|
||||
writePinLow(CLOCK_PIN_74HC595);
|
||||
gpio_write_pin_low(CLOCK_PIN_74HC595);
|
||||
}
|
||||
writePinHigh(LATCH_PIN_74HC595);
|
||||
gpio_write_pin_high(LATCH_PIN_74HC595);
|
||||
small_delay(2);
|
||||
writePinLow(LATCH_PIN_74HC595);
|
||||
gpio_write_pin_low(LATCH_PIN_74HC595);
|
||||
}
|
||||
}
|
||||
|
||||
static void shiftOut_single(uint8_t data) {
|
||||
ATOMIC_BLOCK_FORCEON {
|
||||
if (data & 0x1) {
|
||||
writePinHigh(DATA_PIN_74HC595);
|
||||
gpio_write_pin_high(DATA_PIN_74HC595);
|
||||
} else {
|
||||
writePinLow(DATA_PIN_74HC595);
|
||||
gpio_write_pin_low(DATA_PIN_74HC595);
|
||||
}
|
||||
writePinHigh(CLOCK_PIN_74HC595);
|
||||
gpio_write_pin_high(CLOCK_PIN_74HC595);
|
||||
small_delay(2);
|
||||
writePinLow(CLOCK_PIN_74HC595);
|
||||
writePinHigh(LATCH_PIN_74HC595);
|
||||
gpio_write_pin_low(CLOCK_PIN_74HC595);
|
||||
gpio_write_pin_high(LATCH_PIN_74HC595);
|
||||
small_delay(2);
|
||||
writePinLow(LATCH_PIN_74HC595);
|
||||
gpio_write_pin_low(LATCH_PIN_74HC595);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,13 +149,13 @@ static void unselect_cols(void) {
|
||||
}
|
||||
|
||||
static void matrix_init_pins(void) {
|
||||
setPinOutput(DATA_PIN_74HC595);
|
||||
setPinOutput(CLOCK_PIN_74HC595);
|
||||
setPinOutput(LATCH_PIN_74HC595);
|
||||
gpio_set_pin_output(DATA_PIN_74HC595);
|
||||
gpio_set_pin_output(CLOCK_PIN_74HC595);
|
||||
gpio_set_pin_output(LATCH_PIN_74HC595);
|
||||
#ifdef MATRIX_UNSELECT_DRIVE_HIGH
|
||||
for (uint8_t x = 0; x < MATRIX_COLS; x++) {
|
||||
if (col_pins[x] != NO_PIN) {
|
||||
setPinOutput(col_pins[x]);
|
||||
gpio_set_pin_output(col_pins[x]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -36,27 +36,27 @@ static 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);
|
||||
return gpio_read_pin(pin);
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
@@ -71,20 +71,20 @@ static void shiftOut(uint8_t dataOut) {
|
||||
for (uint8_t i = 0; i < 8; i++) {
|
||||
compiler_barrier();
|
||||
if (dataOut & 0x1) {
|
||||
writePinHigh(DATA_PIN);
|
||||
gpio_write_pin_high(DATA_PIN);
|
||||
} else {
|
||||
writePinLow(DATA_PIN);
|
||||
gpio_write_pin_low(DATA_PIN);
|
||||
}
|
||||
dataOut = dataOut >> 1;
|
||||
compiler_barrier();
|
||||
writePinHigh(CLOCK_PIN);
|
||||
gpio_write_pin_high(CLOCK_PIN);
|
||||
small_delay();
|
||||
writePinLow(CLOCK_PIN);
|
||||
gpio_write_pin_low(CLOCK_PIN);
|
||||
}
|
||||
compiler_barrier();
|
||||
writePinHigh(LATCH_PIN);
|
||||
gpio_write_pin_high(LATCH_PIN);
|
||||
small_delay();
|
||||
writePinLow(LATCH_PIN);
|
||||
gpio_write_pin_low(LATCH_PIN);
|
||||
compiler_barrier();
|
||||
}
|
||||
}
|
||||
@@ -93,18 +93,18 @@ static void shiftOut_single(uint8_t data) {
|
||||
ATOMIC_BLOCK_FORCEON {
|
||||
compiler_barrier();
|
||||
if (data & 0x1) {
|
||||
writePinHigh(DATA_PIN);
|
||||
gpio_write_pin_high(DATA_PIN);
|
||||
} else {
|
||||
writePinLow(DATA_PIN);
|
||||
gpio_write_pin_low(DATA_PIN);
|
||||
}
|
||||
compiler_barrier();
|
||||
writePinHigh(CLOCK_PIN);
|
||||
gpio_write_pin_high(CLOCK_PIN);
|
||||
small_delay();
|
||||
writePinLow(CLOCK_PIN);
|
||||
gpio_write_pin_low(CLOCK_PIN);
|
||||
compiler_barrier();
|
||||
writePinHigh(LATCH_PIN);
|
||||
gpio_write_pin_high(LATCH_PIN);
|
||||
small_delay();
|
||||
writePinLow(LATCH_PIN);
|
||||
gpio_write_pin_low(LATCH_PIN);
|
||||
compiler_barrier();
|
||||
}
|
||||
}
|
||||
@@ -156,13 +156,13 @@ static void unselect_cols(void) {
|
||||
}
|
||||
|
||||
static void matrix_init_pins(void) {
|
||||
setPinOutput(DATA_PIN);
|
||||
setPinOutput(CLOCK_PIN);
|
||||
setPinOutput(LATCH_PIN);
|
||||
gpio_set_pin_output(DATA_PIN);
|
||||
gpio_set_pin_output(CLOCK_PIN);
|
||||
gpio_set_pin_output(LATCH_PIN);
|
||||
#ifdef MATRIX_UNSELECT_DRIVE_HIGH
|
||||
for (uint8_t x = 0; x < MATRIX_COLS; x++) {
|
||||
if (col_pins[x] != NO_PIN) {
|
||||
setPinOutput(col_pins[x]);
|
||||
gpio_set_pin_output(col_pins[x]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -36,27 +36,27 @@ static 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);
|
||||
return gpio_read_pin(pin);
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
@@ -71,20 +71,20 @@ static void shiftOut(uint8_t dataOut) {
|
||||
for (uint8_t i = 0; i < 8; i++) {
|
||||
compiler_barrier();
|
||||
if (dataOut & 0x1) {
|
||||
writePinHigh(DATA_PIN);
|
||||
gpio_write_pin_high(DATA_PIN);
|
||||
} else {
|
||||
writePinLow(DATA_PIN);
|
||||
gpio_write_pin_low(DATA_PIN);
|
||||
}
|
||||
dataOut = dataOut >> 1;
|
||||
compiler_barrier();
|
||||
writePinHigh(CLOCK_PIN);
|
||||
gpio_write_pin_high(CLOCK_PIN);
|
||||
small_delay();
|
||||
writePinLow(CLOCK_PIN);
|
||||
gpio_write_pin_low(CLOCK_PIN);
|
||||
}
|
||||
compiler_barrier();
|
||||
writePinHigh(LATCH_PIN);
|
||||
gpio_write_pin_high(LATCH_PIN);
|
||||
small_delay();
|
||||
writePinLow(LATCH_PIN);
|
||||
gpio_write_pin_low(LATCH_PIN);
|
||||
compiler_barrier();
|
||||
}
|
||||
}
|
||||
@@ -93,18 +93,18 @@ static void shiftOut_single(uint8_t data) {
|
||||
ATOMIC_BLOCK_FORCEON {
|
||||
compiler_barrier();
|
||||
if (data & 0x1) {
|
||||
writePinHigh(DATA_PIN);
|
||||
gpio_write_pin_high(DATA_PIN);
|
||||
} else {
|
||||
writePinLow(DATA_PIN);
|
||||
gpio_write_pin_low(DATA_PIN);
|
||||
}
|
||||
compiler_barrier();
|
||||
writePinHigh(CLOCK_PIN);
|
||||
gpio_write_pin_high(CLOCK_PIN);
|
||||
small_delay();
|
||||
writePinLow(CLOCK_PIN);
|
||||
gpio_write_pin_low(CLOCK_PIN);
|
||||
compiler_barrier();
|
||||
writePinHigh(LATCH_PIN);
|
||||
gpio_write_pin_high(LATCH_PIN);
|
||||
small_delay();
|
||||
writePinLow(LATCH_PIN);
|
||||
gpio_write_pin_low(LATCH_PIN);
|
||||
compiler_barrier();
|
||||
}
|
||||
}
|
||||
@@ -156,13 +156,13 @@ static void unselect_cols(void) {
|
||||
}
|
||||
|
||||
static void matrix_init_pins(void) {
|
||||
setPinOutput(DATA_PIN);
|
||||
setPinOutput(CLOCK_PIN);
|
||||
setPinOutput(LATCH_PIN);
|
||||
gpio_set_pin_output(DATA_PIN);
|
||||
gpio_set_pin_output(CLOCK_PIN);
|
||||
gpio_set_pin_output(LATCH_PIN);
|
||||
#ifdef MATRIX_UNSELECT_DRIVE_HIGH
|
||||
for (uint8_t x = 0; x < MATRIX_COLS; x++) {
|
||||
if (col_pins[x] != NO_PIN) {
|
||||
setPinOutput(col_pins[x]);
|
||||
gpio_set_pin_output(col_pins[x]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -36,27 +36,27 @@ static 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);
|
||||
return gpio_read_pin(pin);
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
@@ -70,34 +70,34 @@ static void shiftOut(uint16_t dataOut) {
|
||||
ATOMIC_BLOCK_FORCEON {
|
||||
for (uint8_t i = 0; i < PIN_USED_74HC595; i++) {
|
||||
if (dataOut & 0x1) {
|
||||
writePinHigh(DATA_PIN_74HC595);
|
||||
gpio_write_pin_high(DATA_PIN_74HC595);
|
||||
} else {
|
||||
writePinLow(DATA_PIN_74HC595);
|
||||
gpio_write_pin_low(DATA_PIN_74HC595);
|
||||
}
|
||||
dataOut = dataOut >> 1;
|
||||
writePinHigh(CLOCK_PIN_74HC595);
|
||||
gpio_write_pin_high(CLOCK_PIN_74HC595);
|
||||
small_delay(2);
|
||||
writePinLow(CLOCK_PIN_74HC595);
|
||||
gpio_write_pin_low(CLOCK_PIN_74HC595);
|
||||
}
|
||||
writePinHigh(LATCH_PIN_74HC595);
|
||||
gpio_write_pin_high(LATCH_PIN_74HC595);
|
||||
small_delay(2);
|
||||
writePinLow(LATCH_PIN_74HC595);
|
||||
gpio_write_pin_low(LATCH_PIN_74HC595);
|
||||
}
|
||||
}
|
||||
|
||||
static void shiftOut_single(uint8_t data) {
|
||||
ATOMIC_BLOCK_FORCEON {
|
||||
if (data & 0x1) {
|
||||
writePinHigh(DATA_PIN_74HC595);
|
||||
gpio_write_pin_high(DATA_PIN_74HC595);
|
||||
} else {
|
||||
writePinLow(DATA_PIN_74HC595);
|
||||
gpio_write_pin_low(DATA_PIN_74HC595);
|
||||
}
|
||||
writePinHigh(CLOCK_PIN_74HC595);
|
||||
gpio_write_pin_high(CLOCK_PIN_74HC595);
|
||||
small_delay(2);
|
||||
writePinLow(CLOCK_PIN_74HC595);
|
||||
writePinHigh(LATCH_PIN_74HC595);
|
||||
gpio_write_pin_low(CLOCK_PIN_74HC595);
|
||||
gpio_write_pin_high(LATCH_PIN_74HC595);
|
||||
small_delay(2);
|
||||
writePinLow(LATCH_PIN_74HC595);
|
||||
gpio_write_pin_low(LATCH_PIN_74HC595);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,13 +149,13 @@ static void unselect_cols(void) {
|
||||
}
|
||||
|
||||
static void matrix_init_pins(void) {
|
||||
setPinOutput(DATA_PIN_74HC595);
|
||||
setPinOutput(CLOCK_PIN_74HC595);
|
||||
setPinOutput(LATCH_PIN_74HC595);
|
||||
gpio_set_pin_output(DATA_PIN_74HC595);
|
||||
gpio_set_pin_output(CLOCK_PIN_74HC595);
|
||||
gpio_set_pin_output(LATCH_PIN_74HC595);
|
||||
#ifdef MATRIX_UNSELECT_DRIVE_HIGH
|
||||
for (uint8_t x = 0; x < MATRIX_COLS; x++) {
|
||||
if (col_pins[x] != NO_PIN) {
|
||||
setPinOutput(col_pins[x]);
|
||||
gpio_set_pin_output(col_pins[x]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user