Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align PS/2 GPIO defines #14745

Merged
merged 6 commits into from
Oct 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 8 additions & 26 deletions docs/feature_ps2_mouse.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,8 @@ In your keyboard config.h:

```c
#ifdef PS2_USE_BUSYWAIT
# define PS2_CLOCK_PORT PORTD
# define PS2_CLOCK_PIN PIND
# define PS2_CLOCK_DDR DDRD
# define PS2_CLOCK_BIT 1
# define PS2_DATA_PORT PORTD
# define PS2_DATA_PIN PIND
# define PS2_DATA_DDR DDRD
# define PS2_DATA_BIT 2
# define PS2_CLOCK_PIN D1
# define PS2_DATA_PIN D2
#endif
```

Expand All @@ -65,14 +59,8 @@ In your keyboard config.h:

```c
#ifdef PS2_USE_INT
#define PS2_CLOCK_PORT PORTD
#define PS2_CLOCK_PIN PIND
#define PS2_CLOCK_DDR DDRD
#define PS2_CLOCK_BIT 2
#define PS2_DATA_PORT PORTD
#define PS2_DATA_PIN PIND
#define PS2_DATA_DDR DDRD
#define PS2_DATA_BIT 5
#define PS2_CLOCK_PIN D2
#define PS2_DATA_PIN D5

#define PS2_INT_INIT() do { \
EICRA |= ((1<<ISC21) | \
Expand Down Expand Up @@ -102,8 +90,8 @@ PS2_USE_INT = yes
In your keyboard config.h:

```c
#define PS2_CLOCK A8
#define PS2_DATA A9
#define PS2_CLOCK_PIN A8
#define PS2_DATA_PIN A9
```

And in the chibios specifig halconf.h:
Expand All @@ -127,14 +115,8 @@ In your keyboard config.h:

```c
#ifdef PS2_USE_USART
#define PS2_CLOCK_PORT PORTD
#define PS2_CLOCK_PIN PIND
#define PS2_CLOCK_DDR DDRD
#define PS2_CLOCK_BIT 5
#define PS2_DATA_PORT PORTD
#define PS2_DATA_PIN PIND
#define PS2_DATA_DDR DDRD
#define PS2_DATA_BIT 2
#define PS2_CLOCK_PIN D5
#define PS2_DATA_PIN D2

/* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */
/* set DDR of CLOCK as input to be slave */
Expand Down
31 changes: 7 additions & 24 deletions docs/ja/feature_ps2_mouse.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,8 @@ PS2_USE_BUSYWAIT = yes

```c
#ifdef PS2_USE_BUSYWAIT
# define PS2_CLOCK_PORT PORTD
# define PS2_CLOCK_PIN PIND
# define PS2_CLOCK_DDR DDRD
# define PS2_CLOCK_BIT 1
# define PS2_DATA_PORT PORTD
# define PS2_DATA_PIN PIND
# define PS2_DATA_DDR DDRD
# define PS2_DATA_BIT 2
# define PS2_CLOCK_PIN D1
# define PS2_DATA_PIN D2
#endif
```

Expand All @@ -69,14 +63,8 @@ PS2_USE_INT = yes

```c
#ifdef PS2_USE_INT
#define PS2_CLOCK_PORT PORTD
#define PS2_CLOCK_PIN PIND
#define PS2_CLOCK_DDR DDRD
#define PS2_CLOCK_BIT 2
#define PS2_DATA_PORT PORTD
#define PS2_DATA_PIN PIND
#define PS2_DATA_DDR DDRD
#define PS2_DATA_BIT 5
#define PS2_CLOCK_PIN D2
#define PS2_DATA_PIN D5

#define PS2_INT_INIT() do { \
EICRA |= ((1<<ISC21) | \
Expand Down Expand Up @@ -107,14 +95,9 @@ PS2_USE_USART = yes

```c
#ifdef PS2_USE_USART
#define PS2_CLOCK_PORT PORTD
#define PS2_CLOCK_PIN PIND
#define PS2_CLOCK_DDR DDRD
#define PS2_CLOCK_BIT 5
#define PS2_DATA_PORT PORTD
#define PS2_DATA_PIN PIND
#define PS2_DATA_DDR DDRD
#define PS2_DATA_BIT 2
#ifdef PS2_USE_USART
#define PS2_CLOCK_PIN D5
#define PS2_DATA_PIN D2

/* 同期、奇数パリティ、1-bit ストップ、8-bit データ、立ち下がりエッジでサンプル */
/* CLOCK の DDR を入力としてスレーブに設定 */
Expand Down
33 changes: 6 additions & 27 deletions keyboards/converter/ibm_terminal/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef PS2_USE_USART
/* XCK for clock line */
#define PS2_CLOCK_PORT PORTD
#define PS2_CLOCK_PIN PIND
#define PS2_CLOCK_DDR DDRD
#define PS2_CLOCK_BIT 5
/* RXD for data line */
#define PS2_DATA_PORT PORTD
#define PS2_DATA_PIN PIND
#define PS2_DATA_DDR DDRD
#define PS2_DATA_BIT 2
#define PS2_CLOCK_PIN D5
#define PS2_DATA_PIN D2

/* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */
/* set DDR of CLOCK as input to be slave */
Expand Down Expand Up @@ -93,15 +86,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef PS2_USE_INT
/* uses INT1 for clock line(ATMega32U4) */
#define PS2_CLOCK_PORT PORTD
#define PS2_CLOCK_PIN PIND
#define PS2_CLOCK_DDR DDRD
#define PS2_CLOCK_BIT 1

#define PS2_DATA_PORT PORTD
#define PS2_DATA_PIN PIND
#define PS2_DATA_DDR DDRD
#define PS2_DATA_BIT 0
#define PS2_CLOCK_PIN D1
#define PS2_DATA_PIN D0

#define PS2_INT_INIT() do { \
EICRA |= ((1<<ISC11) | \
Expand All @@ -121,13 +107,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
* PS/2 Busywait configuration
*/
#ifdef PS2_USE_BUSYWAIT
#define PS2_CLOCK_PORT PORTD
#define PS2_CLOCK_PIN PIND
#define PS2_CLOCK_DDR DDRD
#define PS2_CLOCK_BIT 1

#define PS2_DATA_PORT PORTD
#define PS2_DATA_PIN PIND
#define PS2_DATA_DDR DDRD
#define PS2_DATA_BIT 0
#define PS2_CLOCK_PIN D1
#define PS2_DATA_PIN D0
#endif
10 changes: 2 additions & 8 deletions keyboards/evyd13/gh80_3700/keymaps/ps2/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,8 @@
#pragma once

#ifdef PS2_USE_USART
#define PS2_CLOCK_PORT PORTD
#define PS2_CLOCK_PIN PIND
#define PS2_CLOCK_DDR DDRD
#define PS2_CLOCK_BIT 5
#define PS2_DATA_PORT PORTD
#define PS2_DATA_PIN PIND
#define PS2_DATA_DDR DDRD
#define PS2_DATA_BIT 2
#define PS2_CLOCK_PIN D5
#define PS2_DATA_PIN D2

/* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */
/* set DDR of CLOCK as input to be slave */
Expand Down
10 changes: 2 additions & 8 deletions keyboards/handwired/108key_trackpoint/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,8 @@
#define MATRIX_COLS 23

#ifdef PS2_USE_USART
#define PS2_CLOCK_PORT PORTD
#define PS2_CLOCK_PIN PIND
#define PS2_CLOCK_DDR DDRD
#define PS2_CLOCK_BIT 5
#define PS2_DATA_PORT PORTD
#define PS2_DATA_PIN PIND
#define PS2_DATA_DDR DDRD
#define PS2_DATA_BIT 2
#define PS2_CLOCK_PIN D5
#define PS2_DATA_PIN D2

/* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */
/* set DDR of CLOCK as input to be slave */
Expand Down
30 changes: 6 additions & 24 deletions keyboards/handwired/promethium/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,27 +224,15 @@ enum led_sequence {

/* PS/2 mouse */
#ifdef PS2_USE_BUSYWAIT
# define PS2_CLOCK_PORT PORTD
# define PS2_CLOCK_PIN PIND
# define PS2_CLOCK_DDR DDRD
# define PS2_CLOCK_BIT 3
# define PS2_DATA_PORT PORTD
# define PS2_DATA_PIN PIND
# define PS2_DATA_DDR DDRD
# define PS2_DATA_BIT 2
# define PS2_CLOCK_PIN D3
# define PS2_DATA_PIN D2
#endif

/* PS/2 mouse interrupt version */
#ifdef PS2_USE_INT
/* uses INT1 for clock line(ATMega32U4) */
# define PS2_CLOCK_PORT PORTD
# define PS2_CLOCK_PIN PIND
# define PS2_CLOCK_DDR DDRD
# define PS2_CLOCK_BIT 3
# define PS2_DATA_PORT PORTD
# define PS2_DATA_PIN PIND
# define PS2_DATA_DDR DDRD
# define PS2_DATA_BIT 2
# define PS2_CLOCK_PIN D3
# define PS2_DATA_PIN D2

# define PS2_INT_INIT() \
do { \
Expand All @@ -264,14 +252,8 @@ enum led_sequence {
/* PS/2 mouse USART version */
#ifdef PS2_USE_USART
/* XCK for clock line and RXD for data line */
# define PS2_CLOCK_PORT PORTD
# define PS2_CLOCK_PIN PIND
# define PS2_CLOCK_DDR DDRD
# define PS2_CLOCK_BIT 5
# define PS2_DATA_PORT PORTD
# define PS2_DATA_PIN PIND
# define PS2_DATA_DDR DDRD
# define PS2_DATA_BIT 2
#define PS2_CLOCK_PIN D5
#define PS2_DATA_PIN D2

/* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */
/* set DDR of CLOCK as input to be slave */
Expand Down
10 changes: 2 additions & 8 deletions keyboards/handwired/trackpoint/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,8 @@
#define MATRIX_COLS 3

#ifdef PS2_USE_USART
#define PS2_CLOCK_PORT PORTD
#define PS2_CLOCK_PIN PIND
#define PS2_CLOCK_DDR DDRD
#define PS2_CLOCK_BIT 5
#define PS2_DATA_PORT PORTD
#define PS2_DATA_PIN PIND
#define PS2_DATA_DDR DDRD
#define PS2_DATA_BIT 2
#define PS2_CLOCK_PIN D5
#define PS2_DATA_PIN D2

/* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */
/* set DDR of CLOCK as input to be slave */
Expand Down
20 changes: 4 additions & 16 deletions keyboards/kapcave/paladin64/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

/* Only required if you add in a trackpoint hardware to the pcb */
#ifdef PS2_USE_USART
#define PS2_CLOCK_PORT PORTD
#define PS2_CLOCK_PIN PIND
#define PS2_CLOCK_DDR DDRD
#define PS2_CLOCK_BIT 5
#define PS2_DATA_PORT PORTD
#define PS2_DATA_PIN PIND
#define PS2_DATA_DDR DDRD
#define PS2_DATA_BIT 2
#define PS2_CLOCK_PIN D5
#define PS2_DATA_PIN D2

/* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling
* edge */
Expand Down Expand Up @@ -77,14 +71,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#endif

#ifdef PS2_USE_INT
#define PS2_CLOCK_PORT PORTD
#define PS2_CLOCK_PIN PIND
#define PS2_CLOCK_DDR DDRD
#define PS2_CLOCK_BIT 2
#define PS2_DATA_PORT PORTD
#define PS2_DATA_PIN PIND
#define PS2_DATA_DDR DDRD
#define PS2_DATA_BIT 5
#define PS2_CLOCK_PIN D2
#define PS2_DATA_PIN D5

#define PS2_INT_INIT() do { \
EICRA |= ((1<<ISC21) | \
Expand Down
18 changes: 9 additions & 9 deletions tmk_core/protocol/ps2_interrupt.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,17 @@ static inline void pbuf_clear(void);
void ps2_interrupt_service_routine(void);
void palCallback(void *arg) { ps2_interrupt_service_routine(); }

# define PS2_INT_INIT() \
{ palSetLineMode(PS2_CLOCK, PAL_MODE_INPUT); } \
# define PS2_INT_INIT() \
{ palSetLineMode(PS2_CLOCK_PIN, PAL_MODE_INPUT); } \
while (0)
# define PS2_INT_ON() \
{ \
palEnableLineEvent(PS2_CLOCK, PAL_EVENT_MODE_FALLING_EDGE); \
palSetLineCallback(PS2_CLOCK, palCallback, NULL); \
} \
# define PS2_INT_ON() \
{ \
palEnableLineEvent(PS2_CLOCK_PIN, PAL_EVENT_MODE_FALLING_EDGE); \
palSetLineCallback(PS2_CLOCK_PIN, palCallback, NULL); \
} \
while (0)
# define PS2_INT_OFF() \
{ palDisableLineEvent(PS2_CLOCK); } \
# define PS2_INT_OFF() \
{ palDisableLineEvent(PS2_CLOCK_PIN); } \
while (0)
#endif // PROTOCOL_CHIBIOS

Expand Down
Loading