~ruther/qmk_firmware

qmk_firmware/keyboards/handwired/symmetric70_proto/matrix_fast/gpio_extr.h -rw-r--r-- 1.3 KiB
6e7c1c90 — Rutherther fix: remap ROW3 in kyria because of broken pin by static electricity discharge 2 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#pragma once

#include <stdint.h>

// clang-format off

#if defined(__AVR__)
typedef uint8_t     port_data_t;

#define readPort(port)                 PINx_ADDRESS(port)

#define setPortBitInput(port, bit)     (DDRx_ADDRESS(port) &= ~_BV((bit)&0xF), PORTx_ADDRESS(port) &= ~_BV((bit)&0xF))
#define setPortBitInputHigh(port, bit) (DDRx_ADDRESS(port) &= ~_BV((bit)&0xF), PORTx_ADDRESS(port) |= _BV((bit)&0xF))
#define setPortBitOutput(port, bit)    (DDRx_ADDRESS(port) |= _BV((bit)&0xF))

#define writePortBitLow(port, bit)     (PORTx_ADDRESS(port) &= ~_BV((bit)&0xF))
#define writePortBitHigh(port, bit)    (PORTx_ADDRESS(port) |= _BV((bit)&0xF))

#else
typedef uint16_t     port_data_t;

#define readPort(qmk_pin)                 palReadPort(PAL_PORT(qmk_pin))

#define setPortBitInput(qmk_pin, bit)     palSetPadMode(PAL_PORT(qmk_pin), bit, PAL_MODE_INPUT)
#define setPortBitInputHigh(qmk_pin, bit) palSetPadMode(PAL_PORT(qmk_pin), bit, PAL_MODE_INPUT_PULLUP)
#define setPortBitInputLow(qmk_pin, bit)  palSetPadMode(PAL_PORT(qmk_pin), bit, PAL_MODE_INPUT_PULLDOWN)
#define setPortBitOutput(qmk_pin, bit)    palSetPadMode(PAL_PORT(qmk_pin), bit, PAL_MODE_OUTPUT_PUSHPULL)

#define writePortBitLow(qmk_pin, bit)     palClearLine(PAL_LINE(PAL_PORT(qmk_pin), bit))
#define writePortBitHigh(qmk_pin, bit)    palSetLine(PAL_LINE(PAL_PORT(qmk_pin), bit))
#endif
Do not follow this link