aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/timer.h3
-rw-r--r--converter/usb_usb/Makefile1
-rw-r--r--converter/usb_usb/keymap.c40
-rw-r--r--converter/usb_usb/main.cpp14
-rw-r--r--keyboard/hbkb/Makefile.pjrc56
-rw-r--r--protocol/usb_hid.mk6
-rwxr-xr-x[-rw-r--r--]protocol/usb_hid/README10
7 files changed, 52 insertions, 78 deletions
diff --git a/common/timer.h b/common/timer.h
index 70b008e6c..6437473ff 100644
--- a/common/timer.h
+++ b/common/timer.h
@@ -43,11 +43,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
43#define TIMER_DIFF_8(a, b) TIMER_DIFF(a, b, UINT8_MAX) 43#define TIMER_DIFF_8(a, b) TIMER_DIFF(a, b, UINT8_MAX)
44#define TIMER_DIFF_16(a, b) TIMER_DIFF(a, b, UINT16_MAX) 44#define TIMER_DIFF_16(a, b) TIMER_DIFF(a, b, UINT16_MAX)
45#define TIMER_DIFF_32(a, b) TIMER_DIFF(a, b, UINT32_MAX) 45#define TIMER_DIFF_32(a, b) TIMER_DIFF(a, b, UINT32_MAX)
46#define TIMER_DIFF_RAW(a, b) TIMER_DIFF_8(a, b)
46 47
47 48
48#ifdef __cplusplus 49#ifdef __cplusplus
49extern "C" { 50extern "C" {
50#endif 51#endif
52
51extern volatile uint32_t timer_count; 53extern volatile uint32_t timer_count;
52 54
53 55
@@ -57,6 +59,7 @@ uint16_t timer_read(void);
57uint32_t timer_read32(void); 59uint32_t timer_read32(void);
58uint16_t timer_elapsed(uint16_t last); 60uint16_t timer_elapsed(uint16_t last);
59uint32_t timer_elapsed32(uint32_t last); 61uint32_t timer_elapsed32(uint32_t last);
62
60#ifdef __cplusplus 63#ifdef __cplusplus
61} 64}
62#endif 65#endif
diff --git a/converter/usb_usb/Makefile b/converter/usb_usb/Makefile
index 4565ca508..41a64e464 100644
--- a/converter/usb_usb/Makefile
+++ b/converter/usb_usb/Makefile
@@ -116,7 +116,6 @@ CONFIG_H = config.h
116# Search Path 116# Search Path
117VPATH += $(TARGET_DIR) 117VPATH += $(TARGET_DIR)
118VPATH += $(TOP_DIR) 118VPATH += $(TOP_DIR)
119#VPATH += $(TOP_DIR)/common
120 119
121 120
122 121
diff --git a/converter/usb_usb/keymap.c b/converter/usb_usb/keymap.c
index 406197450..8399f606e 100644
--- a/converter/usb_usb/keymap.c
+++ b/converter/usb_usb/keymap.c
@@ -65,7 +65,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
65 65
66 66
67// Layers to switch by holding Fn key(0-7) 67// Layers to switch by holding Fn key(0-7)
68static const uint8_t PROGMEM fn_layer[] = { 5, 6, 0, 0, 0, 0, 0, 0 }; 68static const uint8_t PROGMEM fn_layer[] = { 5, 6, 5, 0, 0, 0, 0, 0 };
69 69
70// Codes to register by clicking Fn key(0-7) 70// Codes to register by clicking Fn key(0-7)
71static const uint8_t PROGMEM fn_keycode[] = { KB_SCLN, KB_SLSH, KB_NO, KB_NO, KB_NO, KB_NO, KB_NO, KB_NO }; 71static const uint8_t PROGMEM fn_keycode[] = { KB_SCLN, KB_SLSH, KB_NO, KB_NO, KB_NO, KB_NO, KB_NO, KB_NO };
@@ -90,12 +90,12 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
90 * / = Fn1(to Layer 6) 90 * / = Fn1(to Layer 6)
91 */ 91 */
92 KEYMAP( 92 KEYMAP(
93 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, 93 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS,
94 GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, 94 ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
95 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9, 95 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9,
96 CAPS,A, S, D, F, G, H, J, K, L, FN0, QUOT, ENT, P4, P5, P6, PPLS, 96 LCTL,A, S, D, F, G, H, J, K, L, FN0, QUOT, ENT, P4, P5, P6, PPLS,
97 LSFT,Z, X, C, V, B, N, M, COMM,DOT, FN1, RSFT, UP, P1, P2, P3, 97 LSFT,Z, X, C, V, B, N, M, COMM,DOT, FN1, RSFT, UP, P1, P2, P3,
98 LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT 98 FN2, LGUI,LALT, SPC, RALT,FN2, FN2, GRV, LEFT,DOWN,RGHT, P0, PDOT,PENT
99 ), 99 ),
100 100
101 /* 1: plain Qwerty without layer switching 101 /* 1: plain Qwerty without layer switching
@@ -112,7 +112,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
112 * `-----------------------------------------------------------' 112 * `-----------------------------------------------------------'
113 */ 113 */
114 KEYMAP( 114 KEYMAP(
115 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, 115 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS,
116 GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, 116 GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
117 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9, 117 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9,
118 CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS, 118 CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS,
@@ -134,7 +134,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
134 * `----------------------------------------------------------' 134 * `----------------------------------------------------------'
135 */ 135 */
136 KEYMAP( 136 KEYMAP(
137 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, 137 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS,
138 GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, 138 GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
139 TAB, Q, W, F, P, G, J, L, U, Y, SCLN,LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9, 139 TAB, Q, W, F, P, G, J, L, U, Y, SCLN,LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9,
140 BSPC,A, R, S, T, D, H, N, E, I, O, QUOT, ENT, P4, P5, P6, PPLS, 140 BSPC,A, R, S, T, D, H, N, E, I, O, QUOT, ENT, P4, P5, P6, PPLS,
@@ -156,7 +156,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
156 * `-----------------------------------------------------------' 156 * `-----------------------------------------------------------'
157 */ 157 */
158 KEYMAP( 158 KEYMAP(
159 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, 159 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS,
160 GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, LBRC,RBRC,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, 160 GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, LBRC,RBRC,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
161 TAB, QUOT,COMM,DOT, P, Y, F, G, C, R, L, SLSH,EQL, BSLS, DEL, END, PGDN, P7, P8, P9, 161 TAB, QUOT,COMM,DOT, P, Y, F, G, C, R, L, SLSH,EQL, BSLS, DEL, END, PGDN, P7, P8, P9,
162 CAPS,A, O, E, U, I, D, H, T, N, S, MINS, ENT, P4, P5, P6, PPLS, 162 CAPS,A, O, E, U, I, D, H, T, N, S, MINS, ENT, P4, P5, P6, PPLS,
@@ -178,7 +178,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
178 * `-----------------------------------------------------------' 178 * `-----------------------------------------------------------'
179 */ 179 */
180 KEYMAP( 180 KEYMAP(
181 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, 181 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS,
182 GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, 182 GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
183 TAB, Q, D, R, W, B, J, F, U, P, SCLN,LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9, 183 TAB, Q, D, R, W, B, J, F, U, P, SCLN,LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9,
184 BSPC,A, S, H, T, G, Y, N, E, O, I, QUOT, ENT, P4, P5, P6, PPLS, 184 BSPC,A, S, H, T, G, Y, N, E, O, I, QUOT, ENT, P4, P5, P6, PPLS,
@@ -202,12 +202,12 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
202 * Vo = Volume, Mut = Mute 202 * Vo = Volume, Mut = Mute
203 */ 203 */
204 KEYMAP( 204 KEYMAP(
205 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, 205 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS,
206 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F8, F10, F11, F12, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, 206 GRV, F1, F2, F3, F4, F5, F6, F7, F8, F8, F10, F11, F12, DEL, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
207 TAB, WH_L,WH_D,MS_U,WH_U,WH_R,WH_L,WH_D,WH_U,WH_R,NO, NO, NO, BSLS, DEL, END, PGDN, P7, P8, P9, 207 CAPS,NO, NO, NO, NO, NO, WH_L,WH_D,WH_U,WH_R,PSCR,SLCK,PAUS,INS, DEL, END, PGDN, P7, P8, P9,
208 CAPS,NO, MS_L,MS_D,MS_R,NO, MS_L,MS_D,MS_U,MS_R,FN0, NO, ENT, P4, P5, P6, PPLS, 208 LCTL,VOLD,VOLU,MUTE,NO, NO, MS_L,MS_D,MS_U,MS_R,FN0, NO, ENT, P4, P5, P6, PPLS,
209 LSFT,VOLD,VOLU,MUTE,BTN2,BTN3,BTN2,BTN1,VOLD,VOLU,MUTE, RSFT, UP, P1, P2, P3, 209 LSFT,NO, NO, NO, NO, BTN3,BTN2,BTN1,NO, NO, NO, RSFT, UP, P1, P2, P3,
210 LCTL,LGUI,LALT, BTN1, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT 210 FN2, LGUI,LALT, BTN1, RALT,FN2, FN2, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
211 ), 211 ),
212 212
213 /* 6: Cursor keys 213 /* 6: Cursor keys
@@ -224,11 +224,11 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
224 * `-----------------------------------------------------------' 224 * `-----------------------------------------------------------'
225 */ 225 */
226 KEYMAP( 226 KEYMAP(
227 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, 227 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS,
228 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F8, F10, F11, F12, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, 228 GRV, F1, F2, F3, F4, F5, F6, F7, F8, F8, F10, F11, F12, DEL, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
229 TAB, NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, NO, NO, NO, BSLS, DEL, END, PGDN, P7, P8, P9, 229 CAPS,NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, NO, NO, NO, INS, DEL, END, PGDN, P7, P8, P9,
230 CAPS,NO, NO, NO, NO, NO, LEFT,DOWN,UP, RGHT,NO, NO, ENT, P4, P5, P6, PPLS, 230 LCTL,NO, NO, NO, NO, NO, LEFT,DOWN,UP, RGHT,NO, NO, ENT, P4, P5, P6, PPLS,
231 LSFT,VOLD,VOLU,MUTE,NO, NO, HOME,PGDN,PGUP,END, FN1, RSFT, UP, P1, P2, P3, 231 LSFT,NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, FN1, RSFT, UP, P1, P2, P3,
232 LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT 232 LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
233 ), 233 ),
234}; 234};
diff --git a/converter/usb_usb/main.cpp b/converter/usb_usb/main.cpp
index 00d2d59b6..04d838f57 100644
--- a/converter/usb_usb/main.cpp
+++ b/converter/usb_usb/main.cpp
@@ -2,7 +2,6 @@
2#include <avr/wdt.h> 2#include <avr/wdt.h>
3#include <avr/power.h> 3#include <avr/power.h>
4#include <util/delay.h> 4#include <util/delay.h>
5#include <Arduino.h>
6 5
7// USB HID host 6// USB HID host
8#include "Usb.h" 7#include "Usb.h"
@@ -13,6 +12,7 @@
13// LUFA 12// LUFA
14#include "lufa.h" 13#include "lufa.h"
15 14
15#include "timer.h"
16#include "debug.h" 16#include "debug.h"
17#include "keyboard.h" 17#include "keyboard.h"
18 18
@@ -71,19 +71,31 @@ int main(void)
71 LUFA_setup(); 71 LUFA_setup();
72 sei(); 72 sei();
73 73
74uint8_t ret;
74 // wait for startup of sendchar routine 75 // wait for startup of sendchar routine
75 while (USB_DeviceState != DEVICE_STATE_Configured) ; 76 while (USB_DeviceState != DEVICE_STATE_Configured) ;
76 if (debug_enable) { 77 if (debug_enable) {
77 _delay_ms(1000); 78 _delay_ms(1000);
78 } 79 }
79 80
81 debug("init: start\n");
80 HID_setup(); 82 HID_setup();
81 83
82 debug("init: done\n"); 84 debug("init: done\n");
85
86uint16_t timer;
87// to see loop pulse with oscillo scope
88DDRF = (1<<7);
83 for (;;) { 89 for (;;) {
90PORTF ^= (1<<7);
84 keyboard_proc(); 91 keyboard_proc();
85 92
93timer = timer_read();
86 usb_host.Task(); 94 usb_host.Task();
95timer = timer_elapsed(timer);
96if (timer > 100) {
97 debug("host.Task: "); debug_hex16(timer); debug("\n");
98}
87 99
88#if !defined(INTERRUPT_CONTROL_ENDPOINT) 100#if !defined(INTERRUPT_CONTROL_ENDPOINT)
89 // LUFA Task for control request 101 // LUFA Task for control request
diff --git a/keyboard/hbkb/Makefile.pjrc b/keyboard/hbkb/Makefile.pjrc
deleted file mode 100644
index 159f56b44..000000000
--- a/keyboard/hbkb/Makefile.pjrc
+++ /dev/null
@@ -1,56 +0,0 @@
1# Target file name (without extension).
2TARGET = hbkb
3
4# Directory common source filess exist
5TOP_DIR = ../..
6
7# Directory keyboard dependent files exist
8TARGET_DIR = .
9
10# keyboard dependent files
11SRC = main.c \
12 keymap.c \
13 matrix.c \
14 led.c
15
16CONFIG_H = config.h
17
18
19# MCU name, you MUST set this to match the board you are using
20# type "make clean" after changing this, so all files will be rebuilt
21#MCU = at90usb162 # Teensy 1.0
22MCU = atmega32u4 # Teensy 2.0
23#MCU = at90usb646 # Teensy++ 1.0
24#MCU = at90usb1286 # Teensy++ 2.0
25
26
27# Processor frequency.
28# Normally the first thing your program should do is set the clock prescaler,
29# so your program will run at the correct speed. You should also set this
30# variable to same clock speed. The _delay_ms() macro uses this, and many
31# examples use this variable to calculate timings. Do not add a "UL" here.
32F_CPU = 16000000
33
34
35# Build Options
36# comment out to disable the options.
37#
38MOUSEKEY_ENABLE = yes # Mouse keys
39#PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support
40EXTRAKEY_ENABLE = yes # Audio control and System control
41#NKRO_ENABLE = yes # USB Nkey Rollover
42
43
44
45#---------------- Programming Options --------------------------
46#PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
47PROGRAM_CMD = /opt/dfu-programmer-0.5.2/bin/dfu-programmer $(MCU) erase && \
48 /opt/dfu-programmer-0.5.2/bin/dfu-programmer $(MCU) flash $(TARGET).hex && \
49 /opt/dfu-programmer-0.5.2/bin/dfu-programmer $(MCU) start
50
51
52
53include $(TOP_DIR)/protocol/pjrc.mk
54include $(TOP_DIR)/protocol.mk
55include $(TOP_DIR)/common.mk
56include $(TOP_DIR)/rules.mk
diff --git a/protocol/usb_hid.mk b/protocol/usb_hid.mk
index f3149f7f4..fb4916d56 100644
--- a/protocol/usb_hid.mk
+++ b/protocol/usb_hid.mk
@@ -65,3 +65,9 @@ VPATH += $(TOP_DIR)/$(ARDUINO_CORES_DIR)
65 65
66# for #include "pins_arduino.h" 66# for #include "pins_arduino.h"
67VPATH += $(TOP_DIR)/$(ARDUINO_DIR)/variants/leonardo 67VPATH += $(TOP_DIR)/$(ARDUINO_DIR)/variants/leonardo
68
69# ad hoc workaround for compile problem on Windows:
70# Windows doesn't know difference between common/print.h and arduino/Print.h.
71# On Linux no problem.
72# Change file name common/print.h to console.h ?
73VPATH := $(TOP_DIR)/common $(VPATH)
diff --git a/protocol/usb_hid/README b/protocol/usb_hid/README
index 5d49cc8d2..1357a4c72 100644..100755
--- a/protocol/usb_hid/README
+++ b/protocol/usb_hid/README
@@ -27,6 +27,11 @@ Restriction and Bug
27------------------- 27-------------------
28Not statble yet. 28Not statble yet.
29 29
30Switching power on VBUS:
31 To power reset device.
32 http://www.circuitsathome.com/camera-control/simulating-cable-disconnect-on-usb-host-shield-2-0
33 This is needed for a device which are not initilized with 'USB Bus Reset'(long SE0)
34
30Can't bus-reset a keyboard which already attached on bus properly. 35Can't bus-reset a keyboard which already attached on bus properly.
31 Slow start up of Leonardo's bootloader causes this? 36 Slow start up of Leonardo's bootloader causes this?
32 Need to unplug/plug a keyboard after firmware starts up. 37 Need to unplug/plug a keyboard after firmware starts up.
@@ -34,3 +39,8 @@ Can't bus-reset a keyboard which already attached on bus properly.
34 39
35Keyboard with other endpoints than boot keyboard may go wrong. 40Keyboard with other endpoints than boot keyboard may go wrong.
36 On my keyboard with mouse key the converter locks up when using mouse key function. 41 On my keyboard with mouse key the converter locks up when using mouse key function.
42
43Can't compile on Windows filesystem.
44 On Linux no problem.
45 Windows doesn't know difference between common/print.h and arduino/Print.h.
46 Change file name common/print.h to console.h ?