1
0
Fork 0

Add PS/2 mouse support to connect TrackPoint Unit.

Change build options:  Makefile and config.h. See README.
This commit is contained in:
tmk 2011-01-02 23:52:13 +09:00
parent 1ed336a064
commit 2a562a4191
27 changed files with 954 additions and 314 deletions

View file

@ -39,16 +39,6 @@
# To rebuild project do "make clean" then "make all".
#----------------------------------------------------------------------------
# TODO: use config.h for build options?
VENDOR_ID = 0xFEED
PRODUCT_ID = 0xCAFE
MANUFACTURER = 't.m.k.'
PRODUCT = 'HHKB Mod'
DESCRIPTION = 't.m.k. firmware for HHKB pro'
MOUSE_DELAY_TIME = 127
NKRO_ENABLE = true
# Target file name (without extension).
TARGET = tmk_hhkb
@ -78,4 +68,11 @@ MCU = at90usb1286 # Teensy++ 2.0
# examples use this variable to calculate timings. Do not add a "UL" here.
F_CPU = 16000000
# Options
# comment out to disable
USB_NKRO_ENABLE = yes
MOUSEKEY_ENABLE = yes
#PS2_MOUSE_ENABLE = yes
include $(COMMON_DIR)/Makefile.common

40
hhkb/config.h Normal file
View file

@ -0,0 +1,40 @@
#ifndef CONFIG_H
#define CONFIG_H
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0xCAFE
#define MANUFACTURER t.m.k.
#define PRODUCT HHKB mod
#define DESCRIPTION t.m.k. keyboard firmware for HHKB mod
/* controller */
#include "controller_teensy.h"
/* matrix size */
#define MATRIX_ROWS 8
#define MATRIX_COLS 8
/* USB NKey Rollover */
#ifdef USB_NKRO_ENABLE
#endif
/* mouse keys */
#ifdef MOUSEKEY_ENABLE
# define MOUSEKEY_DELAY_TIME 192
#endif
/* PS/2 mouse */
#ifdef PS2_MOUSE_ENABLE
/*
# define PS2_CLOCK_PORT PORTF
# define PS2_CLOCK_PIN PINF
# define PS2_CLOCK_DDR DDRF
# define PS2_CLOCK_BIT 0
# define PS2_DATA_PORT PORTF
# define PS2_DATA_PIN PINF
# define PS2_DATA_DDR DDRF
# define PS2_DATA_BIT 1
*/
#endif
#endif

View file

@ -1,12 +0,0 @@
#ifndef CONTROLLER_H
#define CONTROLLER_H 1
#include "controller_teensy.h"
/* matrix row size */
#define MATRIX_ROWS 8
/* matrix column size */
#define MATRIX_COLS 8
#endif

View file

@ -9,7 +9,6 @@
#include "print.h"
#include "debug.h"
#include "util.h"
#include "controller.h"
#include "keymap_skel.h"
@ -75,7 +74,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |-----------------------------------------------------------|
* |Caps | | | | | | | |Psc|Slk|Pus|Up | |Backs|
* |-----------------------------------------------------------|
* |Contro| | | | | | *| /|Hom|PgU|Lef|Rig|Enter |
* |Contro|VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig|Enter |
* |-----------------------------------------------------------|
* |Shift | | | | | | +| -|End|PgD|Dow|Shift |xxx|
* `-----------------------------------------------------------'

View file

@ -7,7 +7,6 @@
#include <util/delay.h>
#include "print.h"
#include "util.h"
#include "controller.h"
#include "matrix_skel.h"
// matrix is active low. (key on: 0/key off: 1)
@ -22,7 +21,7 @@
// KEY_PREV: (on: 1/ off: 0)
// PE6,PE7(KEY, KEY_PREV)
#define COL_ENABLE (1<<6)
#define KEY_SELELCT(ROW, COL) (PORTB = COL_ENABLE|(((COL)&0x07)<<3)|((ROW)&0x07))
#define KEY_SELELCT(ROW, COL) (PORTB = (PORTB&(1<<7))|COL_ENABLE|(((COL)&0x07)<<3)|((ROW)&0x07))
#define KEY_ENABLE (PORTB &= ~COL_ENABLE)
#define KEY_UNABLE (PORTB |= COL_ENABLE)
#define KEY_STATE (PINE&(1<<6))
@ -53,7 +52,7 @@ void matrix_init(void)
{
// row & col output(PB0-6)
DDRB = 0xFF;
PORTB = KEY_SELELCT(0, 0);
KEY_SELELCT(0, 0);
// KEY: input with pullup(PE6)
// KEY_PREV: output(PE7)
DDRE = 0xBF;