Subversion Repositories group.electronics

Rev

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

Rev 64 Rev 94
Line 1... Line 1...
1
#include <avr/io.h>
1
#include <avr/io.h>
2
#include <avr/pgmspace.h>
2
#include <avr/pgmspace.h>
3
#include <avr/interrupt.h>
3
#include <avr/interrupt.h>
4
 
4
 
5
#define F_CPU 12000000
-
 
6
#include <util/delay.h>
5
#include <util/delay.h>
7
#include <avr/wdt.h>
6
#include <avr/wdt.h>
8
#include <usbdrv.h>
7
#include <usbdrv.h>
9
 
8
 
10
#include <stdlib.h>
9
#include <stdlib.h>
Line 81... Line 80...
81
			uint8_t sent:4;
80
			uint8_t sent:4;
82
		};
81
		};
83
	};
82
	};
84
} rotData[2];
83
} rotData[2];
85
 
84
 
-
 
85
// * = 0x25, #=0x20
-
 
86
// F9 = 0x42, F12 = 0x45
-
 
87
 
86
uint8_t keyMap[] = { 	0x1E, 0x1F, 0x20,
88
uint8_t keyMap[] = { 	0x1E, 0x1F, 0x20,
87
			0x21, 0x22, 0x23,
89
			0x21, 0x22, 0x23,
88
			0x24, 0x25, 0x26,
90
			0x24, 0x25, 0x26,
89
			0x25, 0x27, 0x20 };
91
			0x42, 0x27, 0x45 };
90
 
92
 
91
uint8_t keySelect = 1;
93
uint8_t keySelect = 1;
92
 
94
 
93
struct {
95
struct {
94
	uint8_t report_id;
96
	uint8_t report_id;
Line 289... Line 291...
289
		if (key > 0)
291
		if (key > 0)
290
			reportJoystick.data2 |= (1 << (--key));
292
			reportJoystick.data2 |= (1 << (--key));
291
	} else {
293
	} else {
292
		// Keypad is keyboard
294
		// Keypad is keyboard
293
		if (key > 0) {
295
		if (key > 0) {
294
			if (key==10 || key==12)
296
			//if (key==10 || key==12) // Left shift, for *, #
295
				reportKeyboard.modifier |= (1<<1);	//Left shift
297
			//	reportKeyboard.modifier |= (1<<1);
296
			reportKeyboard.keycode = keyMap[--key];
298
			reportKeyboard.keycode = keyMap[--key];
297
		}
299
		}
298
	}
300
	}
299
 
301
 
300
	// Now work out what rotary to send, if any
302
	// Now work out what rotary to send, if any