Enable PS/2 mouse for TentaPad
This commit is contained in:
parent
e0ea55beeb
commit
e82f32d367
@ -66,6 +66,7 @@ static bool has_ghost_in_row(uint8_t row)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern uint8_t ps2_mouse_enabled;
|
||||||
|
|
||||||
void keyboard_init(void)
|
void keyboard_init(void)
|
||||||
{
|
{
|
||||||
@ -77,7 +78,7 @@ void keyboard_init(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PS2_MOUSE_ENABLE
|
#ifdef PS2_MOUSE_ENABLE
|
||||||
if (ps2_enabled()) {
|
if (ps2_mouse_enabled) {
|
||||||
ps2_mouse_init();
|
ps2_mouse_init();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -163,7 +164,7 @@ MATRIX_LOOP_END:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PS2_MOUSE_ENABLE
|
#ifdef PS2_MOUSE_ENABLE
|
||||||
if (ps2_enabled()) {
|
if (ps2_mouse_enabled) {
|
||||||
ps2_mouse_task();
|
ps2_mouse_task();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -130,11 +130,13 @@ COMMAND_ENABLE = yes # Commands for debug and configuration
|
|||||||
#NKRO_ENABLE = yes # USB Nkey Rollover
|
#NKRO_ENABLE = yes # USB Nkey Rollover
|
||||||
#USB_6KRO_ENABLE = yes # USB 6key Rollover
|
#USB_6KRO_ENABLE = yes # USB 6key Rollover
|
||||||
PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support
|
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
|
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
||||||
KEYMAP_IN_EEPROM_ENABLE = yes # Read keymap from eeprom
|
KEYMAP_IN_EEPROM_ENABLE = yes # Read keymap from eeprom
|
||||||
#KEYMAP_SECTION_ENABLE = yes # Fixed address keymap for keymap editor
|
#KEYMAP_SECTION_ENABLE = yes # Fixed address keymap for keymap editor
|
||||||
SOFTPWM_LED_ENABLE = yes # Enable SoftPWM to drive backlight
|
SOFTPWM_LED_ENABLE = yes # Enable SoftPWM to drive backlight
|
||||||
|
FADING_LED_ENABLE = yes # Enable fading backlight
|
||||||
BREATHING_LED_ENABLE = yes # Enable breathing backlight
|
BREATHING_LED_ENABLE = yes # Enable breathing backlight
|
||||||
#LEDMAP_ENABLE = yes # Enable LED mapping
|
#LEDMAP_ENABLE = yes # Enable LED mapping
|
||||||
#LEDMAP_IN_EEPROM_ENABLE = yes # Read LED mapping from eeprom
|
#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_IN_EEPROM_ENABLE = yes # Read keymap from eeprom
|
||||||
#KEYMAP_SECTION_ENABLE = yes # Fixed address keymap for keymap editor
|
#KEYMAP_SECTION_ENABLE = yes # Fixed address keymap for keymap editor
|
||||||
SOFTPWM_LED_ENABLE = yes # Enable SoftPWM to drive backlight
|
SOFTPWM_LED_ENABLE = yes # Enable SoftPWM to drive backlight
|
||||||
|
FADING_LED_ENABLE = yes # Enable fading backlight
|
||||||
BREATHING_LED_ENABLE = yes # Enable breathing backlight
|
BREATHING_LED_ENABLE = yes # Enable breathing backlight
|
||||||
#LEDMAP_ENABLE = yes # Enable LED mapping
|
#LEDMAP_ENABLE = yes # Enable LED mapping
|
||||||
#LEDMAP_IN_EEPROM_ENABLE = yes # Read LED mapping from eeprom
|
#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_IN_EEPROM_ENABLE = yes # Read keymap from eeprom
|
||||||
#KEYMAP_SECTION_ENABLE = yes # Fixed address keymap for keymap editor
|
#KEYMAP_SECTION_ENABLE = yes # Fixed address keymap for keymap editor
|
||||||
SOFTPWM_LED_ENABLE = yes # Enable SoftPWM to drive backlight
|
SOFTPWM_LED_ENABLE = yes # Enable SoftPWM to drive backlight
|
||||||
|
FADING_LED_ENABLE = yes # Enable fading backlight
|
||||||
BREATHING_LED_ENABLE = yes # Enable breathing backlight
|
BREATHING_LED_ENABLE = yes # Enable breathing backlight
|
||||||
#LEDMAP_ENABLE = yes # Enable LED mapping
|
#LEDMAP_ENABLE = yes # Enable LED mapping
|
||||||
#LEDMAP_IN_EEPROM_ENABLE = yes # Read LED mapping from eeprom
|
#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_IN_EEPROM_ENABLE = yes # Read keymap from eeprom
|
||||||
#KEYMAP_SECTION_ENABLE = yes # Fixed address keymap for keymap editor
|
#KEYMAP_SECTION_ENABLE = yes # Fixed address keymap for keymap editor
|
||||||
SOFTPWM_LED_ENABLE = yes # Enable SoftPWM to drive backlight
|
SOFTPWM_LED_ENABLE = yes # Enable SoftPWM to drive backlight
|
||||||
|
FADING_LED_ENABLE = yes # Enable fading backlight
|
||||||
BREATHING_LED_ENABLE = yes # Enable breathing backlight
|
BREATHING_LED_ENABLE = yes # Enable breathing backlight
|
||||||
#LEDMAP_ENABLE = yes # Enable LED mapping
|
#LEDMAP_ENABLE = yes # Enable LED mapping
|
||||||
#LEDMAP_IN_EEPROM_ENABLE = yes # Read LED mapping from eeprom
|
#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
|
#define DEBOUNCE 5
|
||||||
|
|
||||||
/* number of backlight levels */
|
/* number of backlight levels */
|
||||||
#ifdef BREATHING_LED_ENABLE
|
#define BACKLIGHT_LEVELS 8
|
||||||
#define BACKLIGHT_LEVELS 6
|
|
||||||
#else
|
|
||||||
#define BACKLIGHT_LEVELS 3
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* number of LEDs */
|
/* number of LEDs */
|
||||||
#define LED_COUNT 4
|
#define LED_COUNT 4
|
||||||
@ -64,15 +60,48 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
/* PS2 mouse support */
|
/* PS2 mouse support */
|
||||||
#ifdef PS2_MOUSE_ENABLE
|
#ifdef PS2_MOUSE_ENABLE
|
||||||
|
|
||||||
#define PS2_CLOCK_PORT PORTD
|
#define PS2_CLOCK_PORT PORTD
|
||||||
#define PS2_CLOCK_PIN PIND
|
#define PS2_CLOCK_PIN PIND
|
||||||
#define PS2_CLOCK_DDR DDRD
|
#define PS2_CLOCK_DDR DDRD
|
||||||
#define PS2_CLOCK_BIT PD3
|
#define PS2_CLOCK_BIT PD5
|
||||||
|
|
||||||
#define PS2_DATA_PORT PORTD
|
#define PS2_DATA_PORT PORTD
|
||||||
#define PS2_DATA_PIN PIND
|
#define PS2_DATA_PIN PIND
|
||||||
#define PS2_DATA_DDR DDRD
|
#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
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -47,12 +47,7 @@ static matrix_row_t read_cols(void);
|
|||||||
static void init_cols(void);
|
static void init_cols(void);
|
||||||
|
|
||||||
#ifdef PS2_MOUSE_ENABLE
|
#ifdef PS2_MOUSE_ENABLE
|
||||||
static uint8_t ps2_mouse_detected;
|
uint8_t ps2_mouse_enabled;
|
||||||
|
|
||||||
uint8_t ps2_enabled(void)
|
|
||||||
{
|
|
||||||
return ps2_mouse_detected;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
inline
|
inline
|
||||||
@ -71,15 +66,16 @@ void matrix_init(void)
|
|||||||
{
|
{
|
||||||
#ifdef PS2_MOUSE_ENABLE
|
#ifdef PS2_MOUSE_ENABLE
|
||||||
// ps2 mouse detect
|
// ps2 mouse detect
|
||||||
DDRC &= ~(1<<PC2);
|
DDRD &= ~(1<<PD3);
|
||||||
PORTC |= (1<<PC2);
|
PORTD |= (1<<PD3);
|
||||||
if (PINC & (1<<PC2)) {
|
_delay_us(30);
|
||||||
ps2_mouse_detected = 0;
|
if (PIND & (1<<PD3)) {
|
||||||
|
ps2_mouse_enabled = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ps2_mouse_detected = 1;
|
ps2_mouse_enabled = 1;
|
||||||
}
|
}
|
||||||
PORTC &= ~(1<<PC2);
|
PORTD &= ~(1<<PD3);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
keymaps_cache_init();
|
keymaps_cache_init();
|
||||||
|
@ -91,7 +91,6 @@ 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);
|
|
||||||
|
|
||||||
|
|
||||||
/*--------------------------------------------------------------------
|
/*--------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user