Add PS2 mouse support for gh60
This commit is contained in:
parent
d004baf727
commit
8a3b663762
@ -68,7 +68,9 @@ void keyboard_init(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PS2_MOUSE_ENABLE
|
#ifdef PS2_MOUSE_ENABLE
|
||||||
ps2_mouse_init();
|
if (ps2_enabled()) {
|
||||||
|
ps2_mouse_init();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef BOOTMAGIC_ENABLE
|
#ifdef BOOTMAGIC_ENABLE
|
||||||
@ -80,7 +82,7 @@ void keyboard_init(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef KEYMAP_EX_ENABLE
|
#ifdef KEYMAP_EX_ENABLE
|
||||||
keymap_init();
|
keymap_ex_init();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,7 +135,9 @@ MATRIX_LOOP_END:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PS2_MOUSE_ENABLE
|
#ifdef PS2_MOUSE_ENABLE
|
||||||
ps2_mouse_task();
|
if (ps2_enabled()) {
|
||||||
|
ps2_mouse_task();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// update LED
|
// update LED
|
||||||
|
@ -133,12 +133,12 @@ CONSOLE_ENABLE = yes # Console for debug(+400)
|
|||||||
COMMAND_ENABLE = yes # Commands for debug and configuration
|
COMMAND_ENABLE = yes # Commands for debug and configuration
|
||||||
#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
|
#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
|
||||||
NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
|
NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
|
||||||
#PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support
|
PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support
|
||||||
|
PS2_USE_BUSYWAIT = yes
|
||||||
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
||||||
KEYMAP_EX_ENABLE = yes # External keymap in eeprom
|
KEYMAP_EX_ENABLE = yes # External keymap in eeprom
|
||||||
KEYMAP_SECTION_ENABLE = yes # Fixed address keymap for keymap editor
|
KEYMAP_SECTION_ENABLE = yes # Fixed address keymap for keymap editor
|
||||||
|
|
||||||
|
|
||||||
# Optimize size but this may cause error "relocation truncated to fit"
|
# Optimize size but this may cause error "relocation truncated to fit"
|
||||||
#EXTRALDFLAGS = -Wl,--relax
|
#EXTRALDFLAGS = -Wl,--relax
|
||||||
|
|
||||||
@ -147,5 +147,6 @@ VPATH += $(TARGET_DIR)
|
|||||||
VPATH += $(TOP_DIR)
|
VPATH += $(TOP_DIR)
|
||||||
|
|
||||||
include $(TOP_DIR)/protocol/lufa.mk
|
include $(TOP_DIR)/protocol/lufa.mk
|
||||||
|
include $(TOP_DIR)/protocol.mk
|
||||||
include $(TOP_DIR)/common.mk
|
include $(TOP_DIR)/common.mk
|
||||||
include $(TOP_DIR)/rules.mk
|
include $(TOP_DIR)/rules.mk
|
||||||
|
@ -66,7 +66,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
|
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/* PS2 mouse support */
|
||||||
|
#ifdef PS2_MOUSE_ENABLE
|
||||||
|
#define PS2_CLOCK_PORT PORTF
|
||||||
|
#define PS2_CLOCK_PIN PINF
|
||||||
|
#define PS2_CLOCK_DDR DDRF
|
||||||
|
#define PS2_CLOCK_BIT PF7
|
||||||
|
|
||||||
|
#define PS2_DATA_PORT PORTF
|
||||||
|
#define PS2_DATA_PIN PINF
|
||||||
|
#define PS2_DATA_DDR DDRF
|
||||||
|
#define PS2_DATA_BIT PF6
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Feature disable options
|
* Feature disable options
|
||||||
|
@ -26,6 +26,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "matrix.h"
|
#include "matrix.h"
|
||||||
|
#ifdef PS2_MOUSE_ENABLE
|
||||||
|
#include "ps2.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifndef DEBOUNCE
|
#ifndef DEBOUNCE
|
||||||
@ -42,6 +45,14 @@ static void init_cols(void);
|
|||||||
static void unselect_rows(void);
|
static void unselect_rows(void);
|
||||||
static void select_row(uint8_t row);
|
static void select_row(uint8_t row);
|
||||||
|
|
||||||
|
#ifdef PS2_MOUSE_ENABLE
|
||||||
|
static uint8_t ps2_mouse_detected;
|
||||||
|
|
||||||
|
uint8_t ps2_enabled(void)
|
||||||
|
{
|
||||||
|
return ps2_mouse_detected;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
inline
|
inline
|
||||||
uint8_t matrix_rows(void)
|
uint8_t matrix_rows(void)
|
||||||
@ -61,6 +72,19 @@ void matrix_init(void)
|
|||||||
MCUCR = (1<<JTD);
|
MCUCR = (1<<JTD);
|
||||||
MCUCR = (1<<JTD);
|
MCUCR = (1<<JTD);
|
||||||
|
|
||||||
|
#ifdef PS2_MOUSE_ENABLE
|
||||||
|
// ps2 mouse detect
|
||||||
|
DDRF &= ~(1<<PF5 | 1<<PF4);
|
||||||
|
PORTF |= (1<<PF5 | 1<<PF4);
|
||||||
|
if (PINF & (1<<PF5 | 1 <<PF4)) {
|
||||||
|
ps2_mouse_detected = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ps2_mouse_detected = 1;
|
||||||
|
}
|
||||||
|
DDRF |= (1<<PF5 | 1<<PF4);
|
||||||
|
#endif
|
||||||
|
|
||||||
// initialize row and col
|
// initialize row and col
|
||||||
unselect_rows();
|
unselect_rows();
|
||||||
init_cols();
|
init_cols();
|
||||||
|
@ -90,6 +90,7 @@ uint8_t ps2_host_send(uint8_t data);
|
|||||||
uint8_t ps2_host_recv_response(void);
|
uint8_t ps2_host_recv_response(void);
|
||||||
uint8_t ps2_host_recv(void);
|
uint8_t ps2_host_recv(void);
|
||||||
void ps2_host_set_led(uint8_t usb_led);
|
void ps2_host_set_led(uint8_t usb_led);
|
||||||
|
uint8_t ps2_enabled(void);
|
||||||
|
|
||||||
|
|
||||||
/* Check port settings for clock and data line */
|
/* Check port settings for clock and data line */
|
||||||
|
Reference in New Issue
Block a user