Enable PS/2 mouse for TentaPad
This commit is contained in:
parent
641490bbd2
commit
41707e723f
@ -64,6 +64,7 @@ static bool has_ghost_in_row(uint8_t row)
|
||||
}
|
||||
#endif
|
||||
|
||||
extern uint8_t ps2_mouse_enabled;
|
||||
|
||||
void keyboard_init(void)
|
||||
{
|
||||
@ -75,7 +76,7 @@ void keyboard_init(void)
|
||||
#endif
|
||||
|
||||
#ifdef PS2_MOUSE_ENABLE
|
||||
if (ps2_enabled()) {
|
||||
if (ps2_mouse_enabled) {
|
||||
ps2_mouse_init();
|
||||
}
|
||||
#endif
|
||||
@ -157,7 +158,7 @@ MATRIX_LOOP_END:
|
||||
#endif
|
||||
|
||||
#ifdef PS2_MOUSE_ENABLE
|
||||
if (ps2_enabled()) {
|
||||
if (ps2_mouse_enabled) {
|
||||
ps2_mouse_task();
|
||||
}
|
||||
#endif
|
||||
|
@ -130,11 +130,13 @@ COMMAND_ENABLE = yes # Commands for debug and configuration
|
||||
#NKRO_ENABLE = yes # USB Nkey Rollover
|
||||
#USB_6KRO_ENABLE = yes # USB 6key Rollover
|
||||
PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support
|
||||
PS2_USE_BUSYWAIT = yes
|
||||
PS2_USE_USART= yes
|
||||
#PS2_USE_BUSYWAIT = yes
|
||||
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
||||
KEYMAP_IN_EEPROM_ENABLE = yes # Read keymap from eeprom
|
||||
#KEYMAP_SECTION_ENABLE = yes # Fixed address keymap for keymap editor
|
||||
SOFTPWM_LED_ENABLE = yes # Enable SoftPWM to drive backlight
|
||||
FADING_LED_ENABLE = yes # Enable fading backlight
|
||||
BREATHING_LED_ENABLE = yes # Enable breathing backlight
|
||||
#LEDMAP_ENABLE = yes # Enable LED mapping
|
||||
#LEDMAP_IN_EEPROM_ENABLE = yes # Read LED mapping from eeprom
|
||||
|
@ -105,6 +105,7 @@ BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
||||
KEYMAP_IN_EEPROM_ENABLE = yes # Read keymap from eeprom
|
||||
#KEYMAP_SECTION_ENABLE = yes # Fixed address keymap for keymap editor
|
||||
SOFTPWM_LED_ENABLE = yes # Enable SoftPWM to drive backlight
|
||||
FADING_LED_ENABLE = yes # Enable fading backlight
|
||||
BREATHING_LED_ENABLE = yes # Enable breathing backlight
|
||||
#LEDMAP_ENABLE = yes # Enable LED mapping
|
||||
#LEDMAP_IN_EEPROM_ENABLE = yes # Read LED mapping from eeprom
|
||||
|
@ -135,6 +135,7 @@ BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
||||
KEYMAP_IN_EEPROM_ENABLE = yes # Read keymap from eeprom
|
||||
#KEYMAP_SECTION_ENABLE = yes # Fixed address keymap for keymap editor
|
||||
SOFTPWM_LED_ENABLE = yes # Enable SoftPWM to drive backlight
|
||||
FADING_LED_ENABLE = yes # Enable fading backlight
|
||||
BREATHING_LED_ENABLE = yes # Enable breathing backlight
|
||||
#LEDMAP_ENABLE = yes # Enable LED mapping
|
||||
#LEDMAP_IN_EEPROM_ENABLE = yes # Read LED mapping from eeprom
|
||||
|
@ -105,6 +105,7 @@ BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
||||
KEYMAP_IN_EEPROM_ENABLE = yes # Read keymap from eeprom
|
||||
#KEYMAP_SECTION_ENABLE = yes # Fixed address keymap for keymap editor
|
||||
SOFTPWM_LED_ENABLE = yes # Enable SoftPWM to drive backlight
|
||||
FADING_LED_ENABLE = yes # Enable fading backlight
|
||||
BREATHING_LED_ENABLE = yes # Enable breathing backlight
|
||||
#LEDMAP_ENABLE = yes # Enable LED mapping
|
||||
#LEDMAP_IN_EEPROM_ENABLE = yes # Read LED mapping from eeprom
|
||||
|
@ -42,11 +42,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#define DEBOUNCE 5
|
||||
|
||||
/* number of backlight levels */
|
||||
#ifdef BREATHING_LED_ENABLE
|
||||
#define BACKLIGHT_LEVELS 6
|
||||
#else
|
||||
#define BACKLIGHT_LEVELS 3
|
||||
#endif
|
||||
#define BACKLIGHT_LEVELS 8
|
||||
|
||||
/* number of LEDs */
|
||||
#define LED_COUNT 4
|
||||
@ -64,15 +60,48 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/* PS2 mouse support */
|
||||
#ifdef PS2_MOUSE_ENABLE
|
||||
|
||||
#define PS2_CLOCK_PORT PORTD
|
||||
#define PS2_CLOCK_PIN PIND
|
||||
#define PS2_CLOCK_DDR DDRD
|
||||
#define PS2_CLOCK_BIT PD3
|
||||
#define PS2_CLOCK_BIT PD5
|
||||
|
||||
#define PS2_DATA_PORT PORTD
|
||||
#define PS2_DATA_PIN PIND
|
||||
#define PS2_DATA_DDR DDRD
|
||||
#define PS2_DATA_BIT PD4
|
||||
#define PS2_DATA_BIT PD2
|
||||
|
||||
#ifdef PS2_USE_USART
|
||||
#define PS2_USART_INIT() do { \
|
||||
PS2_CLOCK_DDR &= ~(1<<PS2_CLOCK_BIT); \
|
||||
PS2_DATA_DDR &= ~(1<<PS2_DATA_BIT); \
|
||||
UCSR1C = ((1 << UMSEL10) | \
|
||||
(3 << UPM10) | \
|
||||
(0 << USBS1) | \
|
||||
(3 << UCSZ10) | \
|
||||
(0 << UCPOL1)); \
|
||||
UCSR1A = 0; \
|
||||
UBRR1H = 0; \
|
||||
UBRR1L = 0; \
|
||||
} while (0)
|
||||
#define PS2_USART_RX_INT_ON() do { \
|
||||
UCSR1B = ((1 << RXCIE1) | \
|
||||
(1 << RXEN1)); \
|
||||
} while (0)
|
||||
#define PS2_USART_RX_POLL_ON() do { \
|
||||
UCSR1B = (1 << RXEN1); \
|
||||
} while (0)
|
||||
#define PS2_USART_OFF() do { \
|
||||
UCSR1C = 0; \
|
||||
UCSR1B &= ~((1 << RXEN1) | \
|
||||
(1 << TXEN1)); \
|
||||
} while (0)
|
||||
#define PS2_USART_RX_READY (UCSR1A & (1<<RXC1))
|
||||
#define PS2_USART_RX_DATA UDR1
|
||||
#define PS2_USART_ERROR (UCSR1A & ((1<<FE1) | (1<<DOR1) | (1<<UPE1)))
|
||||
#define PS2_USART_RX_VECT USART1_RX_vect
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -47,12 +47,7 @@ static matrix_row_t read_cols(void);
|
||||
static void init_cols(void);
|
||||
|
||||
#ifdef PS2_MOUSE_ENABLE
|
||||
static uint8_t ps2_mouse_detected;
|
||||
|
||||
uint8_t ps2_enabled(void)
|
||||
{
|
||||
return ps2_mouse_detected;
|
||||
}
|
||||
uint8_t ps2_mouse_enabled;
|
||||
#endif
|
||||
|
||||
inline
|
||||
@ -71,15 +66,16 @@ void matrix_init(void)
|
||||
{
|
||||
#ifdef PS2_MOUSE_ENABLE
|
||||
// ps2 mouse detect
|
||||
DDRC &= ~(1<<PC2);
|
||||
PORTC |= (1<<PC2);
|
||||
if (PINC & (1<<PC2)) {
|
||||
ps2_mouse_detected = 0;
|
||||
DDRD &= ~(1<<PD3);
|
||||
PORTD |= (1<<PD3);
|
||||
_delay_us(30);
|
||||
if (PIND & (1<<PD3)) {
|
||||
ps2_mouse_enabled = 0;
|
||||
}
|
||||
else {
|
||||
ps2_mouse_detected = 1;
|
||||
ps2_mouse_enabled = 1;
|
||||
}
|
||||
PORTC &= ~(1<<PC2);
|
||||
PORTD &= ~(1<<PD3);
|
||||
#endif
|
||||
|
||||
keymaps_cache_init();
|
||||
|
@ -90,7 +90,6 @@ uint8_t ps2_host_send(uint8_t data);
|
||||
uint8_t ps2_host_recv_response(void);
|
||||
uint8_t ps2_host_recv(void);
|
||||
void ps2_host_set_led(uint8_t usb_led);
|
||||
uint8_t ps2_enabled(void);
|
||||
|
||||
|
||||
/* Check port settings for clock and data line */
|
||||
|
Reference in New Issue
Block a user