Subversion Repositories group.electronics

Rev

Rev 33 | Rev 35 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 33 Rev 34
Line 15... Line 15...
15
 
15
 
16
#define ROTS_ATTACHED	2
16
#define ROTS_ATTACHED	2
17
#define STAT		0
17
#define STAT		0
18
#define SENT		1
18
#define SENT		1
19
 
19
 
-
 
20
/*
-
 
21
 * Keyboard modifier codes
-
 
22
 */
-
 
23
#define MOD_CONTROL_LEFT    (1<<0)
-
 
24
#define MOD_SHIFT_LEFT      (1<<1)
-
 
25
#define MOD_ALT_LEFT        (1<<2)
-
 
26
#define MOD_GUI_LEFT        (1<<3)
-
 
27
#define MOD_CONTROL_RIGHT   (1<<4)
-
 
28
#define MOD_SHIFT_RIGHT     (1<<5)
-
 
29
#define MOD_ALT_RIGHT       (1<<6)
-
 
30
#define MOD_GUI_RIGHT       (1<<7)
-
 
31
 
20
 
32
 
21
void doInt(uint8_t pcint);
33
void doInt(uint8_t pcint);
22
uint8_t getKey(void);
34
uint8_t getKey(void);
23
uint8_t analogRead(uint8_t pin);
35
uint8_t analogRead(uint8_t pin);
24
 
36
 
Line 27... Line 39...
27
volatile uint8_t pcIntMask[3] = {0,0,0};
39
volatile uint8_t pcIntMask[3] = {0,0,0};
28
 
40
 
29
// rotdata = [rot#][(stat|sent)]
41
// rotdata = [rot#][(stat|sent)]
30
volatile uint8_t rotdata[2][2] = { {0,0}, {0,0} };
42
volatile uint8_t rotdata[2][2] = { {0,0}, {0,0} };
31
 
43
 
32
uint8_t keyMap[] = { 	'1', '2', '3',
44
uint8_t keyMap[] = { 	49, 50, 51,
33
			'4', '5', '6',
45
			52, 53, 54,
34
			'7', '8', '9',
46
			55, 56, 57,
35
			'*', '0', '#' };
47
			56, 48, 52 };
36
 
48
 
37
struct {
49
struct {
38
	uint8_t report_id;
50
	uint8_t report_id;
39
	uint8_t modifier;
51
	uint8_t modifier;
40
	uint8_t reserved;
-
 
41
	uint8_t keycodes[6];
52
	uint8_t keycode;
42
} reportKeyboard;
53
} reportKeyboard;
43
 
54
 
44
struct{
55
struct{
45
	uint8_t report_id;
56
	uint8_t report_id;
46
  union {
57
  union {
Line 159... Line 170...
159
		if (key > 0)
170
		if (key > 0)
160
			reportJoystick.data2 |= (1 << (key -1));
171
			reportJoystick.data2 |= (1 << (key -1));
161
	} else {
172
	} else {
162
		// Keypad is keyboard
173
		// Keypad is keyboard
163
		if (key > 0) {
174
		if (key > 0) {
164
 
-
 
-
 
175
			reportKeyboard.modifier = 0x00;
-
 
176
			if (key==10 || key==12)
-
 
177
				reportKeyboard.modifier |= (1<<1);	//Left shif
-
 
178
			reportKeyboard.keycode = keyMap[key];
165
		}
179
		}
166
	}
180
	}
167
 
181
 
168
	// Now work out what rotary to send, if any
182
	// Now work out what rotary to send, if any
169
	// Also record if we sent a positive response, 
183
	// Also record if we sent a positive response,