diff options
| author | tmk <nobody@nowhere> | 2013-11-19 03:39:15 +0900 |
|---|---|---|
| committer | tmk <nobody@nowhere> | 2013-11-19 03:39:15 +0900 |
| commit | 755e4d8b00a4f9be0c50c2b005d063b94c528f8c (patch) | |
| tree | 5c8f33d7204868571370774e5ddb4d5c8e6ba469 /keyboard/onekey | |
| parent | 44d2d5f5fda3fbdf73e311067807026bb53798c0 (diff) | |
| download | qmk_firmware-755e4d8b00a4f9be0c50c2b005d063b94c528f8c.tar.gz qmk_firmware-755e4d8b00a4f9be0c50c2b005d063b94c528f8c.zip | |
Add PS/2 mouse configure to onekey
Diffstat (limited to 'keyboard/onekey')
| -rw-r--r-- | keyboard/onekey/Makefile.lufa | 31 | ||||
| -rw-r--r-- | keyboard/onekey/Makefile.pjrc | 31 | ||||
| -rw-r--r-- | keyboard/onekey/config.h | 85 | ||||
| -rw-r--r-- | keyboard/onekey/matrix.c | 1 |
4 files changed, 109 insertions, 39 deletions
diff --git a/keyboard/onekey/Makefile.lufa b/keyboard/onekey/Makefile.lufa index 03cfd83a5..2a97aa63a 100644 --- a/keyboard/onekey/Makefile.lufa +++ b/keyboard/onekey/Makefile.lufa | |||
| @@ -108,34 +108,25 @@ OPT_DEFS += -DBOOTLOADER_SIZE=4096 | |||
| 108 | # Build Options | 108 | # Build Options |
| 109 | # comment out to disable the options. | 109 | # comment out to disable the options. |
| 110 | # | 110 | # |
| 111 | BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) | 111 | #BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) |
| 112 | MOUSEKEY_ENABLE = yes # Mouse keys(+4700) | 112 | #MOUSEKEY_ENABLE = yes # Mouse keys(+4700) |
| 113 | EXTRAKEY_ENABLE = yes # Audio control and System control(+450) | 113 | #EXTRAKEY_ENABLE = yes # Audio control and System control(+450) |
| 114 | CONSOLE_ENABLE = yes # Console for debug(+400) | 114 | CONSOLE_ENABLE = yes # Console for debug(+400) |
| 115 | COMMAND_ENABLE = yes # Commands for debug and configuration | 115 | #COMMAND_ENABLE = yes # Commands for debug and configuration |
| 116 | SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend | 116 | #SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend |
| 117 | #NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA | 117 | #NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA |
| 118 | 118 | ||
| 119 | PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support | ||
| 120 | PS2_USE_BUSYWAIT = yes # uses primitive reference code | ||
| 121 | #PS2_USE_INT = yes # uses external interrupt for falling edge of PS/2 clock pin | ||
| 122 | #PS2_USE_USART = yes # uses hardware USART engine for PS/2 signal receive(recomened) | ||
| 119 | 123 | ||
| 120 | # Optimize size but this may cause error "relocation truncated to fit" | ||
| 121 | #EXTRALDFLAGS = -Wl,--relax | ||
| 122 | 124 | ||
| 123 | # Search Path | 125 | # Search Path |
| 124 | VPATH += $(TARGET_DIR) | 126 | VPATH += $(TARGET_DIR) |
| 125 | VPATH += $(TOP_DIR) | 127 | VPATH += $(TOP_DIR) |
| 126 | 128 | ||
| 127 | include $(TOP_DIR)/protocol/lufa.mk | ||
| 128 | include $(TOP_DIR)/common.mk | 129 | include $(TOP_DIR)/common.mk |
| 130 | include $(TOP_DIR)/protocol.mk | ||
| 131 | include $(TOP_DIR)/protocol/lufa.mk | ||
| 129 | include $(TOP_DIR)/rules.mk | 132 | include $(TOP_DIR)/rules.mk |
| 130 | |||
| 131 | plain: OPT_DEFS += -DKEYMAP_PLAIN | ||
| 132 | plain: all | ||
| 133 | |||
| 134 | poker: OPT_DEFS += -DKEYMAP_POKER | ||
| 135 | poker: all | ||
| 136 | |||
| 137 | poker_set: OPT_DEFS += -DKEYMAP_POKER_SET | ||
| 138 | poker_set: all | ||
| 139 | |||
| 140 | poker_bit: OPT_DEFS += -DKEYMAP_POKER_BIT | ||
| 141 | poker_bit: all | ||
diff --git a/keyboard/onekey/Makefile.pjrc b/keyboard/onekey/Makefile.pjrc index 194a2b975..0f0f70972 100644 --- a/keyboard/onekey/Makefile.pjrc +++ b/keyboard/onekey/Makefile.pjrc | |||
| @@ -79,32 +79,25 @@ OPT_DEFS += -DBOOTLOADER_SIZE=4096 | |||
| 79 | # Build Options | 79 | # Build Options |
| 80 | # comment out to disable the options. | 80 | # comment out to disable the options. |
| 81 | # | 81 | # |
| 82 | BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) | 82 | #BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) |
| 83 | MOUSEKEY_ENABLE = yes # Mouse keys(+5000) | 83 | #MOUSEKEY_ENABLE = yes # Mouse keys(+5000) |
| 84 | EXTRAKEY_ENABLE = yes # Audio control and System control(+600) | 84 | #EXTRAKEY_ENABLE = yes # Audio control and System control(+600) |
| 85 | CONSOLE_ENABLE = yes # Console for debug | 85 | CONSOLE_ENABLE = yes # Console for debug |
| 86 | COMMAND_ENABLE = yes # Commands for debug and configuration | 86 | #COMMAND_ENABLE = yes # Commands for debug and configuration |
| 87 | SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend | 87 | #SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend |
| 88 | NKRO_ENABLE = yes # USB Nkey Rollover(+500) | 88 | #NKRO_ENABLE = yes # USB Nkey Rollover(+500) |
| 89 | |||
| 89 | #PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support | 90 | #PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support |
| 91 | #PS2_USE_BUSYWAIT = yes # uses primitive reference code | ||
| 92 | #PS2_USE_INT = yes # uses external interrupt for falling edge of PS/2 clock pin | ||
| 93 | #PS2_USE_USART = yes # uses hardware USART engine for PS/2 signal receive(recomened) | ||
| 90 | 94 | ||
| 91 | 95 | ||
| 92 | # Search Path | 96 | # Search Path |
| 93 | VPATH += $(TARGET_DIR) | 97 | VPATH += $(TARGET_DIR) |
| 94 | VPATH += $(TOP_DIR) | 98 | VPATH += $(TOP_DIR) |
| 95 | 99 | ||
| 96 | include $(TOP_DIR)/protocol/pjrc.mk | ||
| 97 | include $(TOP_DIR)/common.mk | 100 | include $(TOP_DIR)/common.mk |
| 101 | include $(TOP_DIR)/protocol.mk | ||
| 102 | include $(TOP_DIR)/protocol/pjrc.mk | ||
| 98 | include $(TOP_DIR)/rules.mk | 103 | include $(TOP_DIR)/rules.mk |
| 99 | |||
| 100 | plain: OPT_DEFS += -DKEYMAP_PLAIN | ||
| 101 | plain: all | ||
| 102 | |||
| 103 | poker: OPT_DEFS += -DKEYMAP_POKER | ||
| 104 | poker: all | ||
| 105 | |||
| 106 | poker_set: OPT_DEFS += -DKEYMAP_POKER_SET | ||
| 107 | poker_set: all | ||
| 108 | |||
| 109 | poker_bit: OPT_DEFS += -DKEYMAP_POKER_BIT | ||
| 110 | poker_bit: all | ||
diff --git a/keyboard/onekey/config.h b/keyboard/onekey/config.h index c5bc64de9..8403c9b65 100644 --- a/keyboard/onekey/config.h +++ b/keyboard/onekey/config.h | |||
| @@ -67,4 +67,89 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 67 | //#define NO_ACTION_MACRO | 67 | //#define NO_ACTION_MACRO |
| 68 | //#define NO_ACTION_FUNCTION | 68 | //#define NO_ACTION_FUNCTION |
| 69 | 69 | ||
| 70 | |||
| 71 | /* PS/2 mouse */ | ||
| 72 | #define PS2_MOUSE_DEBUG | ||
| 73 | #ifdef PS2_USE_BUSYWAIT | ||
| 74 | # define PS2_CLOCK_PORT PORTD | ||
| 75 | # define PS2_CLOCK_PIN PIND | ||
| 76 | # define PS2_CLOCK_DDR DDRD | ||
| 77 | # define PS2_CLOCK_BIT 1 | ||
| 78 | # define PS2_DATA_PORT PORTD | ||
| 79 | # define PS2_DATA_PIN PIND | ||
| 80 | # define PS2_DATA_DDR DDRD | ||
| 81 | # define PS2_DATA_BIT 2 | ||
| 82 | #endif | ||
| 83 | |||
| 84 | |||
| 85 | #ifdef PS2_USE_INT | ||
| 86 | /* uses INT1 for clock line(ATMega32U4) */ | ||
| 87 | #define PS2_CLOCK_PORT PORTD | ||
| 88 | #define PS2_CLOCK_PIN PIND | ||
| 89 | #define PS2_CLOCK_DDR DDRD | ||
| 90 | #define PS2_CLOCK_BIT 1 | ||
| 91 | #define PS2_DATA_PORT PORTD | ||
| 92 | #define PS2_DATA_PIN PIND | ||
| 93 | #define PS2_DATA_DDR DDRD | ||
| 94 | #define PS2_DATA_BIT 2 | ||
| 95 | |||
| 96 | #define PS2_INT_INIT() do { \ | ||
| 97 | EICRA |= ((1<<ISC11) | \ | ||
| 98 | (0<<ISC10)); \ | ||
| 99 | } while (0) | ||
| 100 | #define PS2_INT_ON() do { \ | ||
| 101 | EIMSK |= (1<<INT1); \ | ||
| 102 | } while (0) | ||
| 103 | #define PS2_INT_OFF() do { \ | ||
| 104 | EIMSK &= ~(1<<INT1); \ | ||
| 105 | } while (0) | ||
| 106 | #define PS2_INT_VECT INT1_vect | ||
| 107 | #endif | ||
| 108 | |||
| 109 | |||
| 110 | #ifdef PS2_USE_USART | ||
| 111 | #if defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__) | ||
| 112 | /* XCK for clock line and RXD for data line */ | ||
| 113 | #define PS2_CLOCK_PORT PORTD | ||
| 114 | #define PS2_CLOCK_PIN PIND | ||
| 115 | #define PS2_CLOCK_DDR DDRD | ||
| 116 | #define PS2_CLOCK_BIT 5 | ||
| 117 | #define PS2_DATA_PORT PORTD | ||
| 118 | #define PS2_DATA_PIN PIND | ||
| 119 | #define PS2_DATA_DDR DDRD | ||
| 120 | #define PS2_DATA_BIT 2 | ||
| 121 | |||
| 122 | /* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */ | ||
| 123 | /* set DDR of CLOCK as input to be slave */ | ||
| 124 | #define PS2_USART_INIT() do { \ | ||
| 125 | PS2_CLOCK_DDR &= ~(1<<PS2_CLOCK_BIT); \ | ||
| 126 | PS2_DATA_DDR &= ~(1<<PS2_DATA_BIT); \ | ||
| 127 | UCSR1C = ((1 << UMSEL10) | \ | ||
| 128 | (3 << UPM10) | \ | ||
| 129 | (0 << USBS1) | \ | ||
| 130 | (3 << UCSZ10) | \ | ||
| 131 | (0 << UCPOL1)); \ | ||
| 132 | UCSR1A = 0; \ | ||
| 133 | UBRR1H = 0; \ | ||
| 134 | UBRR1L = 0; \ | ||
| 135 | } while (0) | ||
| 136 | #define PS2_USART_RX_INT_ON() do { \ | ||
| 137 | UCSR1B = ((1 << RXCIE1) | \ | ||
| 138 | (1 << RXEN1)); \ | ||
| 139 | } while (0) | ||
| 140 | #define PS2_USART_RX_POLL_ON() do { \ | ||
| 141 | UCSR1B = (1 << RXEN1); \ | ||
| 142 | } while (0) | ||
| 143 | #define PS2_USART_OFF() do { \ | ||
| 144 | UCSR1C = 0; \ | ||
| 145 | UCSR1B &= ~((1 << RXEN1) | \ | ||
| 146 | (1 << TXEN1)); \ | ||
| 147 | } while (0) | ||
| 148 | #define PS2_USART_RX_READY (UCSR1A & (1<<RXC1)) | ||
| 149 | #define PS2_USART_RX_DATA UDR1 | ||
| 150 | #define PS2_USART_ERROR (UCSR1A & ((1<<FE1) | (1<<DOR1) | (1<<UPE1))) | ||
| 151 | #define PS2_USART_RX_VECT USART1_RX_vect | ||
| 152 | #endif | ||
| 153 | #endif | ||
| 154 | |||
| 70 | #endif | 155 | #endif |
diff --git a/keyboard/onekey/matrix.c b/keyboard/onekey/matrix.c index cd0789c60..a0a14ff82 100644 --- a/keyboard/onekey/matrix.c +++ b/keyboard/onekey/matrix.c | |||
| @@ -59,6 +59,7 @@ void matrix_init(void) | |||
| 59 | { | 59 | { |
| 60 | debug_enable = true; | 60 | debug_enable = true; |
| 61 | debug_matrix = true; | 61 | debug_matrix = true; |
| 62 | debug_mouse = true; | ||
| 62 | // initialize row and col | 63 | // initialize row and col |
| 63 | unselect_rows(); | 64 | unselect_rows(); |
| 64 | init_cols(); | 65 | init_cols(); |
