Compare commits

..

1 Commits

Author SHA1 Message Date
(no author)
5de6521477 This commit was manufactured by cvs2svn to create tag
'release080712'.
2008-07-12 21:23:36 +00:00
58 changed files with 327 additions and 131991 deletions

View File

@ -7,10 +7,3 @@ $Id: Changelog.txt,v 1.3 2008/07/12 21:23:36 rschaten Exp $
* Release 080712
- fixed usbSendReport() and backslash-key on european keyboards
* Release TODO
- ghost key detection and prevention
- support for two different hardware models, added Sun Type 5
- bootloader hotkey moved to D, to provide consistency on keyboards without
numeric keypad

View File

@ -22,11 +22,7 @@ AVRDUDE = avrdude $(PROGRAMMER) -p $(DEVICE)
CC = avr-gcc
# Options:
DEFINES = -DMODELIBMMODELM
#DEFINES = -DMODELMAYHEM
#DEFINES = -DMODELSUNTYPE5
#DEFINES = -DMODELIBMHOST
DEFINES = #-DDEBUG_LEVEL=2
CFLAGS = -Wall -Os -I. -mmcu=$(DEVICE) -DF_CPU=$(F_CPU) $(DEFINES)
LDFLAGS = -Wl,--section-start=.text=$(BOOTLOADER_ADDRESS)

View File

@ -23,7 +23,7 @@
* these macros are defined, the boot loader usees them.
*
* \author Ronald Schaten <ronald@schatenseite.de>
* \version $Id$
* \version $Id: bootloaderconfig.h,v 1.1 2008/07/09 20:47:11 rschaten Exp $
*
* License: GNU GPL v2 (see License.txt)
*/
@ -115,126 +115,32 @@
#ifndef __ASSEMBLER__ /* assembler cannot parse function definitions */
#ifdef MODELSUNTYPE5
# define SRCLOCKON PORTC |= (1 << PC5)
# define SRCLOCKOFF PORTC &= ~(1 << PC5)
# define SRDATAON PORTC |= (1 << PC6)
# define SRDATAOFF PORTC &= ~(1 << PC6)
# define SRSTROBEON PORTC |= (1 << PC7)
# define SRSTROBEOFF PORTC &= ~(1 << PC7)
# define KEYROW 16
#endif
uint8_t ledbrightness = 0; ///< brightness level of the leds, between 0 and 127
uint8_t ledcounter = 0; ///< needed for PWM operation
int8_t leddirection = 1; ///< indicates if leds fade higher or lower
uint8_t ledcounter = 0; ///< counter used to set the speed of the running light
uint8_t ledstate = 0; ///< state of the running light
/**
* Prepare IO-ports for detection of bootloader-condition, which happens in
* bootLoaderCondition().
*/
#ifdef MODELIBMMODELM
static inline void bootLoaderInit(void) {
// switch on leds
DDRD |= (1 << PIND4) | (1 << PIND5) | (1 << PIND6);
PORTD &= ~((1 << PIND4) | (1 << PIND5) | (1 << PIND6));
// choose matrix position for hotkey. we use KEY_D, so we set row 4
// and later look for column 5
DDRA = (1 << DDA4);
PORTA = ~(1 << PINA4);
DDRB &= ~(1 << PB5);
PORTB |= (1 << PB5);
DDRC = 0x00;
PORTC = 0xff;
}
#endif
#ifdef MODELMAYHEM
static inline void bootLoaderInit(void) {
// switch on leds
DDRD |= (1 << PIND1) | (1 << PIND3) | (1 << PIND6) | (1 << PIND7);
PORTD &= ~((1 << PIND1) | (1 << PIND3) | (1 << PIND6) | (1 << PIND7));
// choose matrix position for hotkey. we use KEY_D, so we set row 4
// and later look for column 5
DDRA = (1 << DDA4);
PORTA = ~(1 << PINA4);
DDRB &= ~(1 << PB5);
PORTB |= (1 << PB5);
DDRC = 0x00;
PORTC = 0xff;
}
#endif
#ifdef MODELSUNTYPE5
static inline void bootLoaderInit(void) {
// configure ports
DDRA = 0x00;
PORTA = 0xff;
DDRB = (1 << PB4) |(1 << PB5) | (1 << PB6) | (1 << PB7);
PORTB = (1 << PB0) | (1 << PB1) | (1 << PB2) | (1 << PB3);
DDRC = (1 << PC5) | (1 << PC6) | (1 << PC7);
PORTC = (1 << PC0) | (1 << PC1) | (1 << PC2) | (1 << PC3) | (1 << PC4);
DDRD &= ~((1 << PD4) | (1 << PD5) | (1 << PD6) | (1 << PD7));
PORTD |= (1 << PD4) | (1 << PD5) | (1 << PD6) | (1 << PD7);
// switch on leds
PORTB &= ~((1 << PB4) | (1 << PB5) | (1 << PB6) | (1 << PB7));
// choose matrix position for hotkey. we use KEY_D, so we set all
// rows to 1 except for row 16 (KEYROW) and later look for column 12
SRDATAON;
SRSTROBEOFF;
uint8_t i = 0;
for (i = 0; i < (21 - KEYROW); i++) {
SRCLOCKON; SRCLOCKOFF;
}
SRDATAOFF;
SRCLOCKON; SRCLOCKOFF;
SRDATAON;
for (i = 0; i < KEYROW; i++) {
SRCLOCKON; SRCLOCKOFF;
}
SRSTROBEON; SRSTROBEOFF;
}
#endif
#ifdef MODELIBMHOST
static inline void bootLoaderInit(void) {
// choose matrix position for hotkey. we use KEY_D, so we set row 13
// choose matrix position for hotkey. we use KEY_KPminus, so we set row 13
// and later look for pin 7
DDRA = 0x00;
PORTA = 0xff;
DDRC = (1 << DDC2);
PORTC = ~(1 << PINC2);
DDRD &= ~((1 << PIND4) | (1 << PIND5) | (1 << PIND6) | (1 << PIND7));
PORTD |= ((1 << PIND4) | (1 << PIND5) | (1 << PIND6) | (1 << PIND7));
// and later look for column 6
DDRB &= ~(1 << PB6);
PORTB |= (1 << PB6);
}
#endif
/**
* Clean up after boot loader action. In this case: switch off all LEDs.
*/
#ifdef MODELIBMMODELM
static inline void bootLoaderExit(void) {
// switch off leds
PORTD |= (1 << PIND4) | (1 << PIND5) | (1 << PIND6);
}
#endif
#ifdef MODELMAYHEM
static inline void bootLoaderExit(void) {
// switch off leds
PORTD |= (1 << PIND1) | (1 << PIND3) | (1 << PIND6) | (1 << PIND7);
}
#endif
#ifdef MODELSUNTYPE5
static inline void bootLoaderExit(void) {
// switch off leds
PORTB |= (1 << PB4) | (1 << PB5) | (1 << PB6) | (1 << PB7);
}
#endif
#ifdef MODELIBMHOST
static inline void bootLoaderExit(void) {
// do nothing
}
#endif
/**
* Check if conditions for boot loader are met. This function is called in an
@ -242,54 +148,33 @@ static inline void bootLoaderExit(void) {
* the LEDs.
* \return 1 if bootloader should be active, 0 otherwise
*/
#ifdef MODELIBMMODELM
static inline uint8_t bootLoaderCondition() {
// look for pin 5
if (!(PINB & (1 << PINB5))) {
// boot loader active, fade leds
// look for pin 7
if (!(PINB & (1 << PINB7))) {
// boot loader active, blink leds
_delay_ms(1);
ledcounter++;
if (ledcounter < ledbrightness) {
// switch on leds
PORTD &= ~((1 << PIND4) | (1 << PIND5) | (1 << PIND6));
} else {
// switch off leds
PORTD |= (1 << PIND4) | (1 << PIND5) | (1 << PIND6);
}
if (ledcounter == 255) {
ledcounter = 0;
ledbrightness += leddirection;
if (ledbrightness == 255) {
leddirection = -leddirection;
ledbrightness += leddirection;
if (ledcounter == 127) {
switch (ledstate) {
case 0:
PORTD &= ~(1 << PIND6);
PORTD |= (1 << PIND4) | (1 << PIND5);
ledstate = 1;
break;
case 1:
PORTD &= ~(1 << PIND5);
PORTD |= (1 << PIND4) | (1 << PIND6);
ledstate = 2;
break;
case 2:
PORTD &= ~(1 << PIND4);
PORTD |= (1 << PIND5) | (1 << PIND6);
ledstate = 0;
break;
default:
ledstate = 0;
}
}
return 1;
} else {
// no boot loader
return 0;
}
}
#endif
#ifdef MODELMAYHEM
static inline uint8_t bootLoaderCondition() {
// look for pin 5
if (!(PINB & (1 << PINB5))) {
// boot loader active, fade leds
ledcounter++;
if (ledcounter < ledbrightness) {
// switch on leds
PORTD &= ~((1 << PIND1) | (1 << PIND3) | (1 << PIND6) | (1 << PIND7));
} else {
// switch off leds
PORTD |= (1 << PIND1) | (1 << PIND3) | (1 << PIND6) | (1 << PIND7);
}
if (ledcounter == 255) {
ledcounter = 0;
ledbrightness += leddirection;
if (ledbrightness == 255) {
leddirection = -leddirection;
ledbrightness += leddirection;
}
}
return 1;
} else {
@ -297,47 +182,6 @@ static inline uint8_t bootLoaderCondition() {
return 0;
}
}
#endif
#ifdef MODELSUNTYPE5
static inline uint8_t bootLoaderCondition() {
// look for pin 12, KEY_D
if (!(PINC & (1 << PINC4))) {
// boot loader active, fade leds
ledcounter++;
if (ledcounter < ledbrightness) {
// switch on leds
PORTB &= ~((1 << PINB4) | (1 << PINB5) | (1 << PINB6) | (1 << PINB7));
} else {
// switch off leds
PORTB |= (1 << PINB4) | (1 << PINB5) | (1 << PINB6) | (1 << PINB7);
}
if (ledcounter == 255) {
ledcounter = 0;
ledbrightness += leddirection;
if (ledbrightness == 255) {
leddirection = -leddirection;
ledbrightness += leddirection;
}
}
return 1;
} else {
// no boot loader
return 0;
}
}
#endif
#ifdef MODELIBMHOST
static inline uint8_t bootLoaderCondition() {
// look for pin 6
if (!(PINB & (1 << PINB6))) {
// boot loader active
return 1;
} else {
// no boot loader
return 0;
}
}
#endif
#endif /* __ASSEMBLER__ */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,818 +0,0 @@
EESchema Schematic File Version 2
LIBS:power,pinhead,device,conn,linear,regul,74xx,cmos4000,adc-dac,memory,xilinx,special,microcontrollers,dsp,microchip,analog_switches,motorola,texas,intel,audio,interface,digital-audio,philips,display,cypress,siliconi,contrib,valves,./dulcimer.cache
EELAYER 24 0
EELAYER END
$Descr A4 11700 8267
Sheet 1 1
Title "Dulcimer - USB Keyboard Controller"
Date "10 jul 2008"
Rev "090324"
Comp "Ronald Schaten - http://www.schatenseite.de"
Comment1 "Version for IBM Host Keyboard"
Comment2 ""
Comment3 ""
Comment4 ""
$EndDescr
NoConn ~ 4400 4600
NoConn ~ 4400 4400
Text Label 4600 4300 0 60 ~
R19
Text Label 4600 4200 0 60 ~
R18
Text Label 4600 4100 0 60 ~
R17
Text Label 4600 4000 0 60 ~
R16
Entry Wire Line
5350 4300 5450 4200
Entry Wire Line
5350 4200 5450 4100
Entry Wire Line
5350 4100 5450 4000
Entry Wire Line
5350 4000 5450 3900
Wire Wire Line
4400 4300 5350 4300
Wire Wire Line
4400 4200 5350 4200
Wire Wire Line
4400 4100 5350 4100
Wire Wire Line
4400 4000 5350 4000
Wire Wire Line
9250 2900 9950 2900
Wire Wire Line
3150 6600 4650 6600
Wire Wire Line
4650 6600 4650 6400
Wire Wire Line
4850 6400 4850 6750
Wire Wire Line
3150 6850 3150 7100
Wire Wire Line
9450 6350 8900 6350
Wire Wire Line
9450 6250 8900 6250
Wire Wire Line
9450 6150 8900 6150
Wire Wire Line
8850 4750 9950 4750
Wire Wire Line
8850 4550 9950 4550
Wire Wire Line
8850 4350 9950 4350
Wire Wire Line
8850 4150 9950 4150
Wire Wire Line
9250 2700 9950 2700
Wire Wire Line
9250 2500 9950 2500
Wire Wire Line
9250 2300 9950 2300
Wire Wire Line
9250 2100 9950 2100
Wire Wire Line
9250 1900 9950 1900
Wire Wire Line
9250 1700 9950 1700
Wire Wire Line
9250 1500 9950 1500
Wire Wire Line
4400 2800 5700 2800
Wire Wire Line
4400 2600 5700 2600
Wire Wire Line
5700 2400 4400 2400
Wire Wire Line
5700 2200 4400 2200
Wire Wire Line
4400 3700 5350 3700
Wire Wire Line
4400 3500 5350 3500
Wire Wire Line
4400 3300 5350 3300
Wire Wire Line
4400 3100 5350 3100
Wire Wire Line
4400 1900 5350 1900
Wire Wire Line
4400 1700 5350 1700
Wire Wire Line
4400 1500 5350 1500
Wire Bus Line
9150 3100 9150 850
Wire Bus Line
9150 850 5450 850
Wire Bus Line
5450 850 5450 4200
Connection ~ 10150 6250
Wire Wire Line
10150 6250 9750 6250
Wire Wire Line
10150 6550 10150 6050
Wire Wire Line
10150 6050 9750 6050
Connection ~ 1900 2300
Connection ~ 1900 1700
Connection ~ 3850 6750
Wire Wire Line
3850 7000 3850 6750
Wire Wire Line
3500 6900 3500 6450
Wire Wire Line
4200 7550 4200 7400
Wire Wire Line
3500 7550 3500 7400
Wire Wire Line
2400 6600 2200 6600
Wire Wire Line
2200 6600 2200 6350
Wire Wire Line
1550 4200 1550 4450
Wire Wire Line
1000 4200 1000 4450
Wire Wire Line
1150 2300 850 2300
Wire Wire Line
2200 2100 2200 2300
Wire Wire Line
2200 2100 2400 2100
Wire Wire Line
3300 1000 3300 800
Wire Wire Line
1400 1300 1150 1300
Wire Wire Line
1150 1300 1150 1100
Wire Wire Line
1900 1300 2400 1300
Wire Wire Line
850 1700 1150 1700
Wire Wire Line
1550 1700 2400 1700
Wire Wire Line
2200 2300 1550 2300
Wire Wire Line
1000 3600 1000 3800
Wire Wire Line
1550 3600 1550 3800
Wire Wire Line
3300 5000 3300 5150
Wire Wire Line
2200 7100 2200 6750
Wire Wire Line
2200 6750 2400 6750
Wire Wire Line
3850 7400 3850 7550
Connection ~ 3500 6750
Wire Wire Line
3500 5950 3500 5850
Wire Wire Line
4200 6600 4200 7000
Connection ~ 4200 6600
Wire Wire Line
9750 5950 10150 5950
Wire Wire Line
10150 5950 10150 5800
Wire Wire Line
9750 6150 10150 6150
Connection ~ 10150 6150
Wire Wire Line
10150 6350 9750 6350
Connection ~ 10150 6350
Wire Bus Line
5800 2800 5800 1750
Wire Bus Line
5800 1750 8750 1750
Wire Bus Line
8750 1750 8750 4750
Wire Wire Line
5350 1400 4400 1400
Wire Wire Line
5350 1600 4400 1600
Wire Wire Line
5350 1800 4400 1800
Wire Wire Line
5350 2000 4400 2000
Wire Wire Line
5350 3200 4400 3200
Wire Wire Line
5350 3400 4400 3400
Wire Wire Line
5350 3600 4400 3600
Wire Wire Line
5350 3800 4400 3800
Wire Wire Line
4400 2300 5700 2300
Wire Wire Line
5700 2500 4400 2500
Wire Wire Line
5700 2700 4400 2700
Wire Wire Line
5700 2900 4400 2900
Wire Wire Line
9950 1400 9250 1400
Wire Wire Line
9950 1600 9250 1600
Wire Wire Line
9950 1800 9250 1800
Wire Wire Line
9950 2000 9250 2000
Wire Wire Line
9950 2200 9250 2200
Wire Wire Line
9950 2400 9250 2400
Wire Wire Line
9950 2600 9250 2600
Wire Wire Line
9950 2800 9250 2800
Wire Wire Line
9950 4250 8850 4250
Wire Wire Line
9950 4450 8850 4450
Wire Wire Line
9950 4650 8850 4650
Wire Wire Line
9950 4850 8850 4850
Wire Wire Line
9250 1300 9950 1300
Wire Wire Line
4400 1300 5350 1300
Wire Wire Line
9450 5950 8900 5950
Wire Wire Line
2400 6850 2400 7100
Wire Wire Line
4400 4700 4850 4700
Wire Wire Line
4850 4700 4850 5900
Wire Wire Line
4400 4500 4650 4500
Wire Wire Line
4650 4500 4650 5900
Wire Wire Line
4850 6750 3150 6750
Wire Wire Line
9950 3000 9250 3000
Wire Wire Line
9950 3100 9250 3100
Wire Wire Line
9950 3200 9250 3200
Text Label 9450 3200 0 60 ~
R19
Text Label 9450 3100 0 60 ~
R18
Text Label 9450 3000 0 60 ~
R17
Text Label 9450 2900 0 60 ~
R16
Entry Wire Line
9150 3100 9250 3200
Entry Wire Line
9150 2700 9250 2800
Entry Wire Line
9150 3000 9250 3100
Entry Wire Line
9150 2900 9250 3000
Entry Wire Line
9150 2800 9250 2900
$Comp
L PINHD-1X20 JP1
U 1 1 49C89FF7
P 10050 2200
F 0 "JP1" H 9800 3225 50 0000 L B
F 1 "Keyboard Rows" H 9800 1000 50 0000 L B
F 2 "pinhead-1X20" H 10050 2350 50 0001 C C
1 10050 2200
1 0 0 -1
$EndComp
$Comp
L GND #PWR01
U 1 1 480611E8
P 3150 7100
F 0 "#PWR01" H 3150 7100 30 0001 C C
F 1 "GND" H 3150 7030 30 0001 C C
1 3150 7100
1 0 0 -1
$EndComp
$Comp
L GND #PWR02
U 1 1 480611E3
P 2400 7100
F 0 "#PWR02" H 2400 7100 30 0001 C C
F 1 "GND" H 2400 7030 30 0001 C C
1 2400 7100
1 0 0 -1
$EndComp
Text Notes 9500 5700 0 60 ~
ISP
Text Label 4900 2300 0 60 ~
MISO
Text Label 8900 6350 0 60 ~
MISO
Text Label 4900 2200 0 60 ~
SCK
Text Label 8900 6250 0 60 ~
SCK
Text Label 8900 5950 0 60 ~
MOSI
Text Label 4900 2400 0 60 ~
MOSI
Text Label 8900 6150 0 60 ~
Reset
Text Label 2000 1300 0 60 ~
Reset
Text Label 9450 2800 0 60 ~
R15
Text Label 9450 2700 0 60 ~
R14
Text Label 9450 2600 0 60 ~
R13
Text Label 9450 2500 0 60 ~
R12
Text Label 9450 2400 0 60 ~
R11
Text Label 9450 2300 0 60 ~
R10
Text Label 9450 2200 0 60 ~
R9
Text Label 9450 2100 0 60 ~
R8
Text Label 9450 2000 0 60 ~
R7
Text Label 9450 1900 0 60 ~
R6
Text Label 9450 1800 0 60 ~
R5
Text Label 9450 1700 0 60 ~
R4
Text Label 9450 1600 0 60 ~
R3
Text Label 9450 1500 0 60 ~
R2
Text Label 9450 1400 0 60 ~
R1
Text Label 9450 1300 0 60 ~
R0
Text Label 4600 3800 0 60 ~
R15
Text Label 4600 3700 0 60 ~
R14
Text Label 4600 3600 0 60 ~
R13
Text Label 4600 3500 0 60 ~
R12
Text Label 4600 3400 0 60 ~
R11
Text Label 4600 3300 0 60 ~
R10
Text Label 4600 3200 0 60 ~
R9
Text Label 4600 3100 0 60 ~
R8
Text Label 4600 1300 0 60 ~
R7
Text Label 4600 1400 0 60 ~
R6
Text Label 4600 1500 0 60 ~
R5
Text Label 4600 1600 0 60 ~
R4
Text Label 4600 1700 0 60 ~
R3
Text Label 4600 1800 0 60 ~
R2
Text Label 4600 1900 0 60 ~
R1
Text Label 4600 2000 0 60 ~
R0
Text Label 4600 2200 0 60 ~
C7
Text Label 4600 2300 0 60 ~
C6
Text Label 4600 2400 0 60 ~
C5
Text Label 4600 2500 0 60 ~
C4
Text Label 4600 2600 0 60 ~
C3
Text Label 4600 2700 0 60 ~
C2
Text Label 4600 2800 0 60 ~
C1
Text Label 4600 2900 0 60 ~
C0
Text Label 9450 4850 0 60 ~
C7
Text Label 9450 4750 0 60 ~
C6
Text Label 9450 4650 0 60 ~
C5
Text Label 9450 4550 0 60 ~
C4
Text Label 9450 4450 0 60 ~
C3
Text Label 9450 4350 0 60 ~
C2
Text Label 9450 4250 0 60 ~
C1
Text Label 9450 4150 0 60 ~
C0
Entry Wire Line
9150 1200 9250 1300
Entry Wire Line
9150 1300 9250 1400
Entry Wire Line
9150 1400 9250 1500
Entry Wire Line
9150 1500 9250 1600
Entry Wire Line
9150 1600 9250 1700
Entry Wire Line
9150 1700 9250 1800
Entry Wire Line
9150 1800 9250 1900
Entry Wire Line
9150 1900 9250 2000
Entry Wire Line
9150 2000 9250 2100
Entry Wire Line
9150 2100 9250 2200
Entry Wire Line
9150 2200 9250 2300
Entry Wire Line
9150 2300 9250 2400
Entry Wire Line
9150 2400 9250 2500
Entry Wire Line
9150 2500 9250 2600
Entry Wire Line
9150 2600 9250 2700
Entry Wire Line
8750 4050 8850 4150
Entry Wire Line
8750 4150 8850 4250
Entry Wire Line
8750 4250 8850 4350
Entry Wire Line
8750 4350 8850 4450
Entry Wire Line
8750 4450 8850 4550
Entry Wire Line
8750 4550 8850 4650
Entry Wire Line
8750 4650 8850 4750
Entry Wire Line
8750 4750 8850 4850
Entry Wire Line
5700 2900 5800 2800
Entry Wire Line
5700 2800 5800 2700
Entry Wire Line
5700 2700 5800 2600
Entry Wire Line
5700 2600 5800 2500
Entry Wire Line
5700 2500 5800 2400
Entry Wire Line
5700 2400 5800 2300
Entry Wire Line
5700 2300 5800 2200
Entry Wire Line
5700 2200 5800 2100
Entry Wire Line
5350 3800 5450 3700
Entry Wire Line
5350 3700 5450 3600
Entry Wire Line
5350 3600 5450 3500
Entry Wire Line
5350 3500 5450 3400
Entry Wire Line
5350 3400 5450 3300
Entry Wire Line
5350 3300 5450 3200
Entry Wire Line
5350 3200 5450 3100
Entry Wire Line
5350 3100 5450 3000
Entry Wire Line
5350 2000 5450 1900
Entry Wire Line
5350 1900 5450 1800
Entry Wire Line
5350 1800 5450 1700
Entry Wire Line
5350 1700 5450 1600
Entry Wire Line
5350 1600 5450 1500
Entry Wire Line
5350 1500 5450 1400
Entry Wire Line
5350 1400 5450 1300
Entry Wire Line
5350 1300 5450 1200
$Comp
L GND #PWR03
U 1 1 4804562B
P 10150 6550
F 0 "#PWR03" H 10150 6550 30 0001 C C
F 1 "GND" H 10150 6480 30 0001 C C
1 10150 6550
1 0 0 -1
$EndComp
$Comp
L VCC #PWR04
U 1 1 4804561C
P 10150 5800
F 0 "#PWR04" H 10150 5900 30 0001 C C
F 1 "VCC" H 10150 5900 30 0000 C C
1 10150 5800
1 0 0 -1
$EndComp
NoConn ~ 9450 6050
NoConn ~ 3400 5000
NoConn ~ 2400 2500
NoConn ~ 3400 1000
$Comp
L VCC #PWR05
U 1 1 480450B7
P 3500 5850
F 0 "#PWR05" H 3500 5950 30 0001 C C
F 1 "VCC" H 3500 5950 30 0000 C C
1 3500 5850
1 0 0 -1
$EndComp
$Comp
L VCC #PWR06
U 1 1 48044F99
P 1150 1100
F 0 "#PWR06" H 1150 1200 30 0001 C C
F 1 "VCC" H 1150 1200 30 0000 C C
1 1150 1100
1 0 0 -1
$EndComp
$Comp
L GND #PWR07
U 1 1 48044DD0
P 2200 7100
F 0 "#PWR07" H 2200 7100 30 0001 C C
F 1 "GND" H 2200 7030 30 0001 C C
1 2200 7100
1 0 0 -1
$EndComp
$Comp
L VCC #PWR08
U 1 1 48044DC6
P 2200 6350
F 0 "#PWR08" H 2200 6450 30 0001 C C
F 1 "VCC" H 2200 6450 30 0000 C C
1 2200 6350
1 0 0 -1
$EndComp
$Comp
L VCC #PWR09
U 1 1 48044DB8
P 1550 3600
F 0 "#PWR09" H 1550 3700 30 0001 C C
F 1 "VCC" H 1550 3700 30 0000 C C
1 1550 3600
1 0 0 -1
$EndComp
$Comp
L VCC #PWR010
U 1 1 48044DB5
P 1000 3600
F 0 "#PWR010" H 1000 3700 30 0001 C C
F 1 "VCC" H 1000 3700 30 0000 C C
1 1000 3600
1 0 0 -1
$EndComp
$Comp
L VCC #PWR011
U 1 1 48044D21
P 3300 800
F 0 "#PWR011" H 3300 900 30 0001 C C
F 1 "VCC" H 3300 900 30 0000 C C
1 3300 800
1 0 0 -1
$EndComp
$Comp
L GND #PWR012
U 1 1 48044A9D
P 4200 7550
F 0 "#PWR012" H 4200 7550 30 0001 C C
F 1 "GND" H 4200 7480 30 0001 C C
1 4200 7550
1 0 0 -1
$EndComp
$Comp
L GND #PWR013
U 1 1 48044A97
P 3850 7550
F 0 "#PWR013" H 3850 7550 30 0001 C C
F 1 "GND" H 3850 7480 30 0001 C C
1 3850 7550
1 0 0 -1
$EndComp
$Comp
L GND #PWR014
U 1 1 48044A95
P 3500 7550
F 0 "#PWR014" H 3500 7550 30 0001 C C
F 1 "GND" H 3500 7480 30 0001 C C
1 3500 7550
1 0 0 -1
$EndComp
$Comp
L GND #PWR015
U 1 1 48044A93
P 1550 4450
F 0 "#PWR015" H 1550 4450 30 0001 C C
F 1 "GND" H 1550 4380 30 0001 C C
1 1550 4450
1 0 0 -1
$EndComp
$Comp
L GND #PWR016
U 1 1 48044A8D
P 1000 4450
F 0 "#PWR016" H 1000 4450 30 0001 C C
F 1 "GND" H 1000 4380 30 0001 C C
1 1000 4450
1 0 0 -1
$EndComp
$Comp
L GND #PWR017
U 1 1 48044A8A
P 3300 5150
F 0 "#PWR017" H 3300 5150 30 0001 C C
F 1 "GND" H 3300 5080 30 0001 C C
1 3300 5150
1 0 0 -1
$EndComp
$Comp
L GND #PWR018
U 1 1 48044A88
P 850 1700
F 0 "#PWR018" H 850 1700 30 0001 C C
F 1 "GND" H 850 1630 30 0001 C C
1 850 1700
0 1 1 0
$EndComp
$Comp
L GND #PWR019
U 1 1 48044A82
P 850 2300
F 0 "#PWR019" H 850 2300 30 0001 C C
F 1 "GND" H 850 2230 30 0001 C C
1 850 2300
0 1 1 0
$EndComp
$Comp
L PINHD-2X5M JP7
U 1 1 48044A4D
P 9550 6150
F 0 "JP7" H 9300 6475 50 0000 L B
F 1 "ISP" H 9300 5750 50 0000 L B
F 2 "pinhead-2X05M" H 9550 6300 50 0001 C C
1 9550 6150
1 0 0 -1
$EndComp
$Comp
L PINHD-1X8M JP2
U 1 1 48044A0E
P 10050 4550
F 0 "JP2" H 9800 5075 50 0000 L B
F 1 "Keyboard Columns" H 9800 4050 50 0000 L B
F 2 "pinhead-1X08M" H 10050 4700 50 0001 C C
1 10050 4550
1 0 0 -1
$EndComp
$Comp
L MEGA32-P IC1
U 1 1 480447FC
P 3400 3000
F 0 "IC1" H 3450 3050 50 0000 L B
F 1 "MEGA32-P" H 3600 1000 50 0000 L B
F 2 "atmel-DIL40" H 3400 3150 50 0001 C C
1 3400 3000
1 0 0 -1
$EndComp
$Comp
L ZENER D2
U 1 1 48044798
P 4200 7200
F 0 "D2" H 4200 7300 50 0000 C C
F 1 "3.6V" H 4200 7100 40 0000 C C
1 4200 7200
0 -1 -1 0
$EndComp
$Comp
L ZENER D1
U 1 1 48044791
P 3850 7200
F 0 "D1" H 3850 7300 50 0000 C C
F 1 "3.6V" H 3850 7100 40 0000 C C
1 3850 7200
0 -1 -1 0
$EndComp
$Comp
L CRYSTAL X1
U 1 1 4804477C
P 1900 2000
F 0 "X1" H 1900 2150 60 0000 C C
F 1 "12MHz" H 1900 1850 60 0000 C C
1 1900 2000
0 1 1 0
$EndComp
$Comp
L CP C2
U 1 1 48044769
P 1550 4000
F 0 "C2" H 1600 4100 50 0000 L C
F 1 "10u" H 1600 3900 50 0000 L C
1 1550 4000
-1 0 0 -1
$EndComp
$Comp
L C C1
U 1 1 48044756
P 1000 4000
F 0 "C1" H 1050 4100 50 0000 L C
F 1 "100n" H 1050 3900 50 0000 L C
1 1000 4000
-1 0 0 -1
$EndComp
$Comp
L C C4
U 1 1 48044754
P 1350 2300
F 0 "C4" H 1400 2400 50 0000 L C
F 1 "22p" H 1400 2200 50 0000 L C
1 1350 2300
0 1 1 0
$EndComp
$Comp
L C C3
U 1 1 48044750
P 1350 1700
F 0 "C3" H 1400 1800 50 0000 L C
F 1 "22p" H 1400 1600 50 0000 L C
1 1350 1700
0 1 1 0
$EndComp
$Comp
L R R8
U 1 1 48044743
P 4850 6150
F 0 "R8" V 4930 6150 50 0000 C C
F 1 "68" V 4850 6150 50 0000 C C
1 4850 6150
-1 0 0 1
$EndComp
$Comp
L R R7
U 1 1 48044741
P 4650 6150
F 0 "R7" V 4730 6150 50 0000 C C
F 1 "68" V 4650 6150 50 0000 C C
1 4650 6150
-1 0 0 1
$EndComp
$Comp
L R R1
U 1 1 4804473F
P 1650 1300
F 0 "R1" V 1730 1300 50 0000 C C
F 1 "10k" V 1650 1300 50 0000 C C
1 1650 1300
0 1 1 0
$EndComp
$Comp
L R R2
U 1 1 4804473B
P 3500 6200
F 0 "R2" V 3580 6200 50 0000 C C
F 1 "2k2" V 3500 6200 50 0000 C C
1 3500 6200
1 0 0 -1
$EndComp
$Comp
L R R6
U 1 1 48044739
P 3500 7150
F 0 "R6" V 3580 7150 50 0000 C C
F 1 "4k7" V 3500 7150 50 0000 C C
1 3500 7150
1 0 0 -1
$EndComp
$Comp
L USB J1
U 1 1 480446AA
P 2800 6400
F 0 "J1" H 2750 6800 60 0000 C C
F 1 "USB" V 2550 6550 60 0000 C C
1 2800 6400
1 0 0 -1
$EndComp
$EndSCHEMATC

File diff suppressed because it is too large Load Diff

View File

@ -1,26 +0,0 @@
EESchema-DOCLIB Version 2.0 24/3/2009-11:07:44
#
$CMP C
D Condensateur non polarise
$ENDCMP
#
$CMP CP
D Condensateur polarise
$ENDCMP
#
$CMP R
D Resistance
K R DEV
$ENDCMP
#
$CMP USB_CONN
D USB CONNECTOR
K USB
$ENDCMP
#
$CMP ZENER
D Diode zener
K DEV DIODE
$ENDCMP
#
#End Doc Library

View File

@ -1,275 +0,0 @@
EESchema-LIBRARY Version 24/3/2009-11:07:44
#
#
# C
#
DEF C C 0 10 N Y 1 F N
F0 "C" 50 100 50 H V L C
F1 "C" 50 -100 50 H V L C
$FPLIST
SM*
C?
C1-1
$ENDFPLIST
DRAW
P 2 0 1 8 -100 30 100 30 N
P 2 0 1 8 -100 -30 100 -30 N
X ~ 1 0 200 170 D 40 40 1 1 P
X ~ 2 0 -200 170 U 40 40 1 1 P
ENDDRAW
ENDDEF
#
# CP
#
DEF CP C 0 10 N N 1 F N
F0 "C" 50 100 50 H V L C
F1 "CP" 50 -100 50 H V L C
ALIAS CAPAPOL
$FPLIST
CP*
SM*
$ENDFPLIST
DRAW
P 4 0 1 0 -50 50 -50 -20 50 -20 50 50 F
P 4 0 1 8 -100 50 -100 -50 100 -50 100 50 N
X ~ 1 0 200 150 D 40 40 1 1 P
X ~ 2 0 -200 150 U 40 40 1 1 P
ENDDRAW
ENDDEF
#
# CRYSTAL
#
DEF CRYSTAL X 0 40 N N 0 F N
F0 "X" 0 150 60 H V C C
F1 "CRYSTAL" 0 -150 60 H V C C
DRAW
P 5 0 1 12 -50 50 50 50 50 -50 -50 -50 -50 50 f
P 2 0 1 16 -100 100 -100 -100 N
P 2 0 1 16 100 100 100 -100 N
X 2 2 300 0 200 L 40 40 1 1 P
X 1 1 -300 0 200 R 40 40 1 1 P
ENDDRAW
ENDDEF
#
# GND
#
DEF ~GND #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 0 30 H I C C
F1 "GND" 0 -70 30 H I C C
DRAW
P 4 0 1 4 -50 0 0 -50 50 0 -50 0 N
X GND 1 0 0 0 U 30 30 1 1 W N
ENDDRAW
ENDDEF
#
# MEGA32-P
#
DEF MEGA32-P IC 0 40 Y Y 1 L N
F0 "IC" -800 1830 50 H V L B
F1 "MEGA32-P" 200 -2000 50 H V L B
F2 "atmel-DIL40" 0 150 50 H I C C
DRAW
P 2 1 0 0 -800 1800 800 1800 N
P 2 1 0 0 800 1800 800 -1800 N
P 2 1 0 0 800 -1800 -800 -1800 N
P 2 1 0 0 -800 -1800 -800 1800 N
X VCC 10 -100 2000 200 D 40 40 1 1 W
X AVCC 30 0 2000 200 D 40 40 1 1 W
X (RXD)PD0 14 1000 -1700 200 L 40 40 1 1 B
X (TXD)PD1 15 1000 -1600 200 L 40 40 1 1 B
X (INT0)PD2 16 1000 -1500 200 L 40 40 1 1 B
X (INT1)PD3 17 1000 -1400 200 L 40 40 1 1 B
X (OC1B)PD4 18 1000 -1300 200 L 40 40 1 1 B
X (OC1A)PD5 19 1000 -1200 200 L 40 40 1 1 B
X (ICP)PD6 20 1000 -1100 200 L 40 40 1 1 B
X (OC2)PD7 21 1000 -1000 200 L 40 40 1 1 B
X (SCL)PC0 22 1000 -800 200 L 40 40 1 1 B
X (SDA)PC1 23 1000 -700 200 L 40 40 1 1 B
X (TCK)PC2 24 1000 -600 200 L 40 40 1 1 B
X (TMS)PC3 25 1000 -500 200 L 40 40 1 1 B
X (TDO)PC4 26 1000 -400 200 L 40 40 1 1 B
X (TDI)PC5 27 1000 -300 200 L 40 40 1 1 B
X (TOSC1)PC6 28 1000 -200 200 L 40 40 1 1 B
X (TOSC2)PC7 29 1000 -100 200 L 40 40 1 1 B
X (T0/XCK)PB0 1 1000 100 200 L 40 40 1 1 B
X (T1)PB1 2 1000 200 200 L 40 40 1 1 B
X (AIN0/INT2)PB2 3 1000 300 200 L 40 40 1 1 B
X (AIN1/OC0)PB3 4 1000 400 200 L 40 40 1 1 B
X (SS)PB4 5 1000 500 200 L 40 40 1 1 B
X (MOSI)PB5 6 1000 600 200 L 40 40 1 1 B
X (MISO)PB6 7 1000 700 200 L 40 40 1 1 B
X (SCK)PB7 8 1000 800 200 L 40 40 1 1 B
X (ADC0)PA0 40 1000 1000 200 L 40 40 1 1 B
X (ADC1)PA1 39 1000 1100 200 L 40 40 1 1 B
X (ADC2)PA2 38 1000 1200 200 L 40 40 1 1 B
X (ADC3)PA3 37 1000 1300 200 L 40 40 1 1 B
X (ADC4)PA4 36 1000 1400 200 L 40 40 1 1 B
X (ADC5)PA5 35 1000 1500 200 L 40 40 1 1 B
X (ADC6)PA6 34 1000 1600 200 L 40 40 1 1 B
X (ADC7)PA7 33 1000 1700 200 L 40 40 1 1 B
X AREF 32 -1000 500 200 R 40 40 1 1 W
X XTAL1 13 -1000 900 200 R 40 40 1 1 B
X XTAL2 12 -1000 1300 200 R 40 40 1 1 B
X RESET 9 -1000 1700 200 R 40 40 1 1 I I
X GND 11 -100 -2000 200 U 40 40 1 1 W
X AGND 31 0 -2000 200 U 40 40 1 1 W
ENDDRAW
ENDDEF
#
# PINHD-1X20
#
DEF PINHD-1X20 JP 0 40 Y Y 1 L N
F0 "JP" -250 1025 50 H V L B
F1 "PINHD-1X20" -250 -1200 50 H V L B
F2 "pinhead-1X20" 0 150 50 H I C C
DRAW
P 2 1 0 0 -250 1000 -250 -1100 N
P 2 1 0 0 50 1000 -250 1000 N
P 2 1 0 0 50 -1100 50 1000 N
P 2 1 0 0 -250 -1100 50 -1100 N
X 20 20 -100 -1000 100 R 40 40 1 1 P I
X 19 19 -100 -900 100 R 40 40 1 1 P I
X 18 18 -100 -800 100 R 40 40 1 1 P I
X 17 17 -100 -700 100 R 40 40 1 1 P I
X 16 16 -100 -600 100 R 40 40 1 1 P I
X 15 15 -100 -500 100 R 40 40 1 1 P I
X 14 14 -100 -400 100 R 40 40 1 1 P I
X 13 13 -100 -300 100 R 40 40 1 1 P I
X 12 12 -100 -200 100 R 40 40 1 1 P I
X 11 11 -100 -100 100 R 40 40 1 1 P I
X 10 10 -100 0 100 R 40 40 1 1 P I
X 9 9 -100 100 100 R 40 40 1 1 P I
X 8 8 -100 200 100 R 40 40 1 1 P I
X 7 7 -100 300 100 R 40 40 1 1 P I
X 6 6 -100 400 100 R 40 40 1 1 P I
X 5 5 -100 500 100 R 40 40 1 1 P I
X 4 4 -100 600 100 R 40 40 1 1 P I
X 3 3 -100 700 100 R 40 40 1 1 P I
X 2 2 -100 800 100 R 40 40 1 1 P I
X 1 1 -100 900 100 R 40 40 1 1 P I
ENDDRAW
ENDDEF
#
# PINHD-1X8M
#
DEF PINHD-1X8M JP 0 40 Y Y 1 L N
F0 "JP" -250 525 50 H V L B
F1 "PINHD-1X8M" -250 -500 50 H V L B
F2 "pinhead-1X08M" 0 150 50 H I C C
DRAW
P 2 1 0 0 -250 500 -250 -400 N
P 2 1 0 0 50 500 -250 500 N
P 2 1 0 0 50 -400 50 500 N
P 2 1 0 0 -250 -400 50 -400 N
X 8 8 -100 -300 100 R 40 40 1 1 P I
X 7 7 -100 -200 100 R 40 40 1 1 P I
X 6 6 -100 -100 100 R 40 40 1 1 P I
X 5 5 -100 0 100 R 40 40 1 1 P I
X 4 4 -100 100 100 R 40 40 1 1 P I
X 3 3 -100 200 100 R 40 40 1 1 P I
X 2 2 -100 300 100 R 40 40 1 1 P I
X 1 1 -100 400 100 R 40 40 1 1 P I
ENDDRAW
ENDDEF
#
# PINHD-2X5M
#
DEF PINHD-2X5M JP 0 40 Y Y 1 L N
F0 "JP" -250 325 50 H V L B
F1 "PINHD-2X5M" -250 -400 50 H V L B
F2 "pinhead-2X05M" 0 150 50 H I C C
DRAW
P 2 1 0 0 -250 300 -250 -300 N
P 2 1 0 0 350 300 -250 300 N
P 2 1 0 0 350 -300 350 300 N
P 2 1 0 0 -250 -300 350 -300 N
X 10 10 200 -200 100 L 40 40 1 1 P I
X 8 8 200 -100 100 L 40 40 1 1 P I
X 6 6 200 0 100 L 40 40 1 1 P I
X 4 4 200 100 100 L 40 40 1 1 P I
X 2 2 200 200 100 L 40 40 1 1 P I
X 9 9 -100 -200 100 R 40 40 1 1 P I
X 7 7 -100 -100 100 R 40 40 1 1 P I
X 5 5 -100 0 100 R 40 40 1 1 P I
X 3 3 -100 100 100 R 40 40 1 1 P I
X 1 1 -100 200 100 R 40 40 1 1 P I
ENDDRAW
ENDDEF
#
# R
#
DEF R R 0 0 N Y 1 F N
F0 "R" 80 0 50 V V C C
F1 "R" 0 0 50 V V C C
$FPLIST
R?
SM0603
SM0805
$ENDFPLIST
DRAW
S -40 150 40 -150 0 1 8 N
X ~ 1 0 250 100 D 60 60 1 1 P
X ~ 2 0 -250 100 U 60 60 1 1 P
ENDDRAW
ENDDEF
#
# USB_CONN
#
DEF USB_CONN J 0 0 Y Y 1 F N
F0 "J" -50 400 60 H V C C
F1 "USB_CONN" -250 150 60 V V C C
ALIAS USB
DRAW
P 3 0 1 0 100 -50 200 -200 200 -200 N
S 50 100 50 200 0 1 0 N
P 4 0 1 0 -100 -450 -50 -400 -50 -50 -50 -50 N
P 4 0 1 0 0 -50 0 -400 50 -450 50 -450 N
P 9 0 1 0 -150 0 100 0 100 250 50 300 -100 300 -150 250 -150 0 -150 0 -150 0 N
S -100 200 -100 100 0 1 0 N
P 4 0 1 0 50 -50 50 -250 200 -350 200 -350 N
S -100 200 -100 200 0 1 0 N
P 3 0 1 0 -150 -50 -250 -200 -250 -200 N
S 50 100 -100 100 0 1 0 N
P 6 0 1 0 -200 -50 150 -50 150 350 -200 350 -200 -50 -200 -50 N
S -100 200 50 200 0 1 0 N
P 4 0 1 0 -100 -50 -100 -250 -250 -350 -250 -350 N
X Shield_1 5 350 -450 300 L 40 30 1 1 P
X D- 2 350 -350 150 L 40 30 1 1 B
X D+ 3 350 -200 150 L 40 30 1 1 B
X Shield_2 6 -400 -450 300 R 40 30 1 1 P
X GND 4 -400 -350 150 R 40 30 1 1 w
X Vbus 1 -400 -200 150 R 40 30 1 1 w
ENDDRAW
ENDDEF
#
# VCC
#
DEF VCC #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 100 30 H I C C
F1 "VCC" 0 100 30 H V C C
DRAW
C 0 50 20 0 1 4 N
P 3 0 1 4 0 0 0 30 0 30 N
X VCC 1 0 0 0 U 20 20 0 0 W N
ENDDRAW
ENDDEF
#
# ZENER
#
DEF ZENER D 0 40 N N 1 F N
F0 "D" 0 100 50 H V C C
F1 "ZENER" 0 -100 40 H V C C
$FPLIST
D?
SO*
SM*
$ENDFPLIST
DRAW
P 5 0 1 0 50 0 -50 50 -50 -50 50 0 50 0 F
P 5 0 1 8 70 50 50 30 50 -30 30 -50 30 -50 N
X K 2 200 0 150 L 40 40 1 1 P
X A 1 -200 0 150 R 40 40 1 1 P
ENDDRAW
ENDDEF
#
#EndLibrary

View File

@ -1,122 +0,0 @@
Cmp-Mod V01 Created by Cvpcb (20080725 SVN-R1172) date = 24/3/2009-09:03:34
BeginCmp
TimeStamp = /48044756;
Reference = C1;
ValeurCmp = 100n;
IdModule = C1;
EndCmp
BeginCmp
TimeStamp = /48044769;
Reference = C2;
ValeurCmp = 10u;
IdModule = C1V7;
EndCmp
BeginCmp
TimeStamp = /48044750;
Reference = C3;
ValeurCmp = 22p;
IdModule = C1;
EndCmp
BeginCmp
TimeStamp = /48044754;
Reference = C4;
ValeurCmp = 22p;
IdModule = C1;
EndCmp
BeginCmp
TimeStamp = /48044791;
Reference = D1;
ValeurCmp = 3.6V;
IdModule = D3;
EndCmp
BeginCmp
TimeStamp = /48044798;
Reference = D2;
ValeurCmp = 3.6V;
IdModule = D3;
EndCmp
BeginCmp
TimeStamp = /480447FC;
Reference = IC1;
ValeurCmp = MEGA32-P;
IdModule = atmel-DIL40;
EndCmp
BeginCmp
TimeStamp = /480446AA;
Reference = J1;
ValeurCmp = USB;
IdModule = CONN_USB-B;
EndCmp
BeginCmp
TimeStamp = /49C89FF7;
Reference = JP1;
ValeurCmp = Keyboard_Rows;
IdModule = pinhead-1X20;
EndCmp
BeginCmp
TimeStamp = /48044A0E;
Reference = JP2;
ValeurCmp = Keyboard_Columns;
IdModule = pinhead-1X08;
EndCmp
BeginCmp
TimeStamp = /48044A4D;
Reference = JP7;
ValeurCmp = ISP;
IdModule = atmel-AVR-ISP-10;
EndCmp
BeginCmp
TimeStamp = /4804473F;
Reference = R1;
ValeurCmp = 10k;
IdModule = R3;
EndCmp
BeginCmp
TimeStamp = /4804473B;
Reference = R2;
ValeurCmp = 2k2;
IdModule = R3;
EndCmp
BeginCmp
TimeStamp = /48044739;
Reference = R6;
ValeurCmp = 4k7;
IdModule = R3;
EndCmp
BeginCmp
TimeStamp = /48044741;
Reference = R7;
ValeurCmp = 68;
IdModule = R3;
EndCmp
BeginCmp
TimeStamp = /48044743;
Reference = R8;
ValeurCmp = 68;
IdModule = R3;
EndCmp
BeginCmp
TimeStamp = /4804477C;
Reference = X1;
ValeurCmp = 12MHz;
IdModule = HC-18UV;
EndCmp
EndListe

View File

@ -1,345 +0,0 @@
# EESchema Netlist Version 1.1 created 24/3/2009-11:07:28
(
( /49C89FF7 pinhead-1X20 JP1 Keyboard_Rows {Lib=PINHD-1X20}
( 1 /R0 )
( 2 /R1 )
( 3 /R2 )
( 4 /R3 )
( 5 /R4 )
( 6 /R5 )
( 7 /R6 )
( 8 /R7 )
( 9 /R8 )
( 10 /R9 )
( 11 /R10 )
( 12 /R11 )
( 13 /R12 )
( 14 /R13 )
( 15 /R14 )
( 16 /R15 )
( 17 /R16 )
( 18 /R17 )
( 19 /R18 )
( 20 /R19 )
)
( /48044A4D pinhead-2X05M JP7 ISP {Lib=PINHD-2X5M}
( 1 /MOSI )
( 2 VCC )
( 3 ? )
( 4 GND )
( 5 /Reset )
( 6 GND )
( 7 /SCK )
( 8 GND )
( 9 /MISO )
( 10 GND )
)
( /48044A0E pinhead-1X08M JP2 Keyboard_Columns {Lib=PINHD-1X8M}
( 1 /C0 )
( 2 /C1 )
( 3 /C2 )
( 4 /C3 )
( 5 /C4 )
( 6 /MOSI )
( 7 /MISO )
( 8 /SCK )
)
( /480447FC atmel-DIL40 IC1 MEGA32-P {Lib=MEGA32-P}
( 1 /C0 )
( 2 /C1 )
( 3 /C2 )
( 4 /C3 )
( 5 /C4 )
( 6 /MOSI )
( 7 /MISO )
( 8 /SCK )
( 9 /Reset )
( 10 VCC )
( 11 GND )
( 12 N-000043 )
( 13 N-000042 )
( 14 N-000013 )
( 15 ? )
( 16 N-000014 )
( 17 ? )
( 18 /R19 )
( 19 /R18 )
( 20 /R17 )
( 21 /R16 )
( 22 /R15 )
( 23 /R14 )
( 24 /R13 )
( 25 /R12 )
( 26 /R11 )
( 27 /R10 )
( 28 /R9 )
( 29 /R8 )
( 30 ? )
( 31 ? )
( 32 ? )
( 33 /R7 )
( 34 /R6 )
( 35 /R5 )
( 36 /R4 )
( 37 /R3 )
( 38 /R2 )
( 39 /R1 )
( 40 /R0 )
)
( /48044798 $noname D2 3.6V {Lib=ZENER}
( 1 GND )
( 2 N-000010 )
)
( /48044791 $noname D1 3.6V {Lib=ZENER}
( 1 GND )
( 2 N-000009 )
)
( /4804477C $noname X1 12MHz {Lib=CRYSTAL}
( 1 N-000043 )
( 2 N-000042 )
)
( /48044769 $noname C2 10u {Lib=CP}
( 1 VCC )
( 2 GND )
)
( /48044756 $noname C1 100n {Lib=C}
( 1 VCC )
( 2 GND )
)
( /48044754 $noname C4 22p {Lib=C}
( 1 N-000042 )
( 2 GND )
)
( /48044750 $noname C3 22p {Lib=C}
( 1 N-000043 )
( 2 GND )
)
( /48044743 $noname R8 68 {Lib=R}
( 1 N-000009 )
( 2 N-000013 )
)
( /48044741 $noname R7 68 {Lib=R}
( 1 N-000010 )
( 2 N-000014 )
)
( /4804473F $noname R1 10k {Lib=R}
( 1 /Reset )
( 2 VCC )
)
( /4804473B $noname R2 2k2 {Lib=R}
( 1 VCC )
( 2 N-000009 )
)
( /48044739 $noname R6 4k7 {Lib=R}
( 1 N-000009 )
( 2 GND )
)
( /480446AA $noname J1 USB {Lib=USB}
( 1 VCC )
( 2 N-000009 )
( 3 N-000010 )
( 4 GND )
( 5 GND )
( 6 GND )
)
)
*
{ Allowed footprints by component:
$component D2
D?
SO*
SM*
$endlist
$component D1
D?
SO*
SM*
$endlist
$component C2
CP*
SM*
$endlist
$component C1
SM*
C?
C1-1
$endlist
$component C4
SM*
C?
C1-1
$endlist
$component C3
SM*
C?
C1-1
$endlist
$component R8
R?
SM0603
SM0805
$endlist
$component R7
R?
SM0603
SM0805
$endlist
$component R1
R?
SM0603
SM0805
$endlist
$component R2
R?
SM0603
SM0805
$endlist
$component R6
R?
SM0603
SM0805
$endlist
$endfootprintlist
}
{ Pin List by Nets
/Net 3 "R19"
JP1 20
IC1 18
/Net 4 "R18"
JP1 19
IC1 19
/Net 5 "R17"
JP1 18
IC1 20
/Net 6 "R16"
JP1 17
IC1 21
Net 7 "GND"
JP7 10
JP7 8
JP7 6
JP7 4
IC1 11
D2 1
D1 1
C2 2
C1 2
C4 2
C3 2
R6 2
J1 5
J1 6
J1 4
/Net 8 "Reset"
JP7 5
IC1 9
R1 1
Net 9 ""
D1 2
R8 1
R2 2
R6 1
J1 2
Net 10 ""
D2 2
R7 1
J1 3
Net 11 "VCC"
JP7 2
IC1 10
C2 1
C1 1
R1 2
R2 1
J1 1
/Net 12 "MOSI"
JP7 1
JP2 6
IC1 6
Net 13 ""
IC1 14
R8 2
Net 14 ""
IC1 16
R7 2
/Net 15 "R15"
JP1 16
IC1 22
/Net 16 "R14"
JP1 15
IC1 23
/Net 17 "R13"
JP1 14
IC1 24
/Net 18 "R12"
JP1 13
IC1 25
/Net 19 "R11"
JP1 12
IC1 26
/Net 20 "R10"
JP1 11
IC1 27
/Net 21 "R9"
JP1 10
IC1 28
/Net 22 "R8"
JP1 9
IC1 29
/Net 23 "R7"
JP1 8
IC1 33
/Net 24 "R6"
JP1 7
IC1 34
/Net 25 "R5"
JP1 6
IC1 35
/Net 26 "R4"
JP1 5
IC1 36
/Net 27 "R3"
JP1 4
IC1 37
/Net 28 "R2"
JP1 3
IC1 38
/Net 29 "R1"
JP1 2
IC1 39
/Net 30 "R0"
JP1 1
IC1 40
/Net 31 "SCK"
JP7 7
JP2 8
IC1 8
/Net 32 "MISO"
JP7 9
JP2 7
IC1 7
/Net 33 "C4"
JP2 5
IC1 5
/Net 34 "C3"
JP2 4
IC1 4
/Net 35 "C2"
JP2 3
IC1 3
/Net 36 "C1"
JP2 2
IC1 2
/Net 37 "C0"
JP2 1
IC1 1
Net 42 ""
IC1 13
X1 2
C4 1
Net 43 ""
IC1 12
X1 1
C3 1
}
#End

View File

@ -1,137 +0,0 @@
update=24/3/2009-09:10:45
last_client=pcbnew
[general]
version=1
RootSch=dulcimer.sch
BoardNm=dulcimer.brd
[common]
NetDir=
[eeschema]
version=1
LibDir=
NetFmt=1
HPGLSpd=20
HPGLDm=15
HPGLNum=1
offX_A4=0
offY_A4=0
offX_A3=0
offY_A3=0
offX_A2=0
offY_A2=0
offX_A1=0
offY_A1=0
offX_A0=0
offY_A0=0
offX_A=0
offY_A=0
offX_B=0
offY_B=0
offX_C=0
offY_C=0
offX_D=0
offY_D=0
offX_E=0
offY_E=0
RptD_X=0
RptD_Y=100
RptLab=1
SimCmd=
UseNetN=0
LabSize=60
[eeschema/libraries]
LibName1=power
LibName2=pinhead
LibName3=device
LibName4=conn
LibName5=linear
LibName6=regul
LibName7=74xx
LibName8=cmos4000
LibName9=adc-dac
LibName10=memory
LibName11=xilinx
LibName12=special
LibName13=microcontrollers
LibName14=dsp
LibName15=microchip
LibName16=analog_switches
LibName17=motorola
LibName18=texas
LibName19=intel
LibName20=audio
LibName21=interface
LibName22=digital-audio
LibName23=philips
LibName24=display
LibName25=cypress
LibName26=siliconi
LibName27=contrib
LibName28=valves
[cvpcb]
version=1
NetITyp=0
NetIExt=.net
PkgIExt=.pkg
NetType=0
[cvpcb/libraries]
EquName1=devcms
[pcbnew]
version=1
PadDrlX=320
PadDimH=600
PadDimV=600
PadForm=1
PadMask=14745599
ViaDiam=450
ViaDril=250
MViaDia=200
MViaDrl=80
Isol=60
Countlayer=2
Lpiste=300
RouteTo=15
RouteBo=0
TypeVia=3
Segm45=1
Racc45=1
SgPcb45=1
TxtPcbV=800
TxtPcbH=600
TxtModV=600
TxtModH=600
TxtModW=120
HPGLnum=1
HPGdiam=15
HPGLSpd=20
HPGLrec=2
HPGLorg=0
GERBmin=15
VEgarde=100
DrawLar=150
EdgeLar=150
TxtLar=120
MSegLar=150
ForPlot=1
WpenSer=10
UserGrX=1
UserGrY=1
UserGrU=1
DivGrPc=1
TimeOut=600
ShowRat=0
ShowMRa=1
[pcbnew/libraries]
LibDir=
LibName1=supports
LibName2=CONN_USB-B
LibName3=pl_empreinte
LibName4=pinhead
LibName5=atmel
LibName6=connect
LibName7=discret
LibName8=pin_array
LibName9=divers
LibName10=libcms
LibName11=display
LibName12=valves

File diff suppressed because it is too large Load Diff

View File

@ -1,818 +0,0 @@
EESchema Schematic File Version 2
LIBS:power,pinhead,device,conn,linear,regul,74xx,cmos4000,adc-dac,memory,xilinx,special,microcontrollers,dsp,microchip,analog_switches,motorola,texas,intel,audio,interface,digital-audio,philips,display,cypress,siliconi,contrib,valves,./dulcimer.cache
EELAYER 24 0
EELAYER END
$Descr A4 11700 8267
Sheet 1 1
Title "Dulcimer - USB Keyboard Controller"
Date "10 jul 2008"
Rev "090324"
Comp "Ronald Schaten - http://www.schatenseite.de"
Comment1 "Version for IBM Host Keyboard"
Comment2 ""
Comment3 ""
Comment4 ""
$EndDescr
NoConn ~ 4400 4600
NoConn ~ 4400 4400
Text Label 4600 4300 0 60 ~
R19
Text Label 4600 4200 0 60 ~
R18
Text Label 4600 4100 0 60 ~
R17
Text Label 4600 4000 0 60 ~
R16
Entry Wire Line
5350 4300 5450 4200
Entry Wire Line
5350 4200 5450 4100
Entry Wire Line
5350 4100 5450 4000
Entry Wire Line
5350 4000 5450 3900
Wire Wire Line
4400 4300 5350 4300
Wire Wire Line
4400 4200 5350 4200
Wire Wire Line
4400 4100 5350 4100
Wire Wire Line
4400 4000 5350 4000
Wire Wire Line
9250 2900 9950 2900
Wire Wire Line
3150 6600 4650 6600
Wire Wire Line
4650 6600 4650 6400
Wire Wire Line
4850 6400 4850 6750
Wire Wire Line
3150 6850 3150 7100
Wire Wire Line
9450 6350 8900 6350
Wire Wire Line
9450 6250 8900 6250
Wire Wire Line
9450 6150 8900 6150
Wire Wire Line
8850 4750 9950 4750
Wire Wire Line
8850 4550 9950 4550
Wire Wire Line
8850 4350 9950 4350
Wire Wire Line
8850 4150 9950 4150
Wire Wire Line
9250 2700 9950 2700
Wire Wire Line
9250 2500 9950 2500
Wire Wire Line
9250 2300 9950 2300
Wire Wire Line
9250 2100 9950 2100
Wire Wire Line
9250 1900 9950 1900
Wire Wire Line
9250 1700 9950 1700
Wire Wire Line
9250 1500 9950 1500
Wire Wire Line
4400 2800 5700 2800
Wire Wire Line
4400 2600 5700 2600
Wire Wire Line
5700 2400 4400 2400
Wire Wire Line
5700 2200 4400 2200
Wire Wire Line
4400 3700 5350 3700
Wire Wire Line
4400 3500 5350 3500
Wire Wire Line
4400 3300 5350 3300
Wire Wire Line
4400 3100 5350 3100
Wire Wire Line
4400 1900 5350 1900
Wire Wire Line
4400 1700 5350 1700
Wire Wire Line
4400 1500 5350 1500
Wire Bus Line
9150 3100 9150 850
Wire Bus Line
9150 850 5450 850
Wire Bus Line
5450 850 5450 4200
Connection ~ 10150 6250
Wire Wire Line
10150 6250 9750 6250
Wire Wire Line
10150 6550 10150 6050
Wire Wire Line
10150 6050 9750 6050
Connection ~ 1900 2300
Connection ~ 1900 1700
Connection ~ 3850 6750
Wire Wire Line
3850 7000 3850 6750
Wire Wire Line
3500 6900 3500 6450
Wire Wire Line
4200 7550 4200 7400
Wire Wire Line
3500 7550 3500 7400
Wire Wire Line
2400 6600 2200 6600
Wire Wire Line
2200 6600 2200 6350
Wire Wire Line
1550 4200 1550 4450
Wire Wire Line
1000 4200 1000 4450
Wire Wire Line
1150 2300 850 2300
Wire Wire Line
2200 2100 2200 2300
Wire Wire Line
2200 2100 2400 2100
Wire Wire Line
3300 1000 3300 800
Wire Wire Line
1400 1300 1150 1300
Wire Wire Line
1150 1300 1150 1100
Wire Wire Line
1900 1300 2400 1300
Wire Wire Line
850 1700 1150 1700
Wire Wire Line
1550 1700 2400 1700
Wire Wire Line
2200 2300 1550 2300
Wire Wire Line
1000 3600 1000 3800
Wire Wire Line
1550 3600 1550 3800
Wire Wire Line
3300 5000 3300 5150
Wire Wire Line
2200 7100 2200 6750
Wire Wire Line
2200 6750 2400 6750
Wire Wire Line
3850 7400 3850 7550
Connection ~ 3500 6750
Wire Wire Line
3500 5950 3500 5850
Wire Wire Line
4200 6600 4200 7000
Connection ~ 4200 6600
Wire Wire Line
9750 5950 10150 5950
Wire Wire Line
10150 5950 10150 5800
Wire Wire Line
9750 6150 10150 6150
Connection ~ 10150 6150
Wire Wire Line
10150 6350 9750 6350
Connection ~ 10150 6350
Wire Bus Line
5800 2800 5800 1750
Wire Bus Line
5800 1750 8750 1750
Wire Bus Line
8750 1750 8750 4750
Wire Wire Line
5350 1400 4400 1400
Wire Wire Line
5350 1600 4400 1600
Wire Wire Line
5350 1800 4400 1800
Wire Wire Line
5350 2000 4400 2000
Wire Wire Line
5350 3200 4400 3200
Wire Wire Line
5350 3400 4400 3400
Wire Wire Line
5350 3600 4400 3600
Wire Wire Line
5350 3800 4400 3800
Wire Wire Line
4400 2300 5700 2300
Wire Wire Line
5700 2500 4400 2500
Wire Wire Line
5700 2700 4400 2700
Wire Wire Line
5700 2900 4400 2900
Wire Wire Line
9950 1400 9250 1400
Wire Wire Line
9950 1600 9250 1600
Wire Wire Line
9950 1800 9250 1800
Wire Wire Line
9950 2000 9250 2000
Wire Wire Line
9950 2200 9250 2200
Wire Wire Line
9950 2400 9250 2400
Wire Wire Line
9950 2600 9250 2600
Wire Wire Line
9950 2800 9250 2800
Wire Wire Line
9950 4250 8850 4250
Wire Wire Line
9950 4450 8850 4450
Wire Wire Line
9950 4650 8850 4650
Wire Wire Line
9950 4850 8850 4850
Wire Wire Line
9250 1300 9950 1300
Wire Wire Line
4400 1300 5350 1300
Wire Wire Line
9450 5950 8900 5950
Wire Wire Line
2400 6850 2400 7100
Wire Wire Line
4400 4700 4850 4700
Wire Wire Line
4850 4700 4850 5900
Wire Wire Line
4400 4500 4650 4500
Wire Wire Line
4650 4500 4650 5900
Wire Wire Line
4850 6750 3150 6750
Wire Wire Line
9950 3000 9250 3000
Wire Wire Line
9950 3100 9250 3100
Wire Wire Line
9950 3200 9250 3200
Text Label 9450 3200 0 60 ~
R19
Text Label 9450 3100 0 60 ~
R18
Text Label 9450 3000 0 60 ~
R17
Text Label 9450 2900 0 60 ~
R16
Entry Wire Line
9150 3100 9250 3200
Entry Wire Line
9150 2700 9250 2800
Entry Wire Line
9150 3000 9250 3100
Entry Wire Line
9150 2900 9250 3000
Entry Wire Line
9150 2800 9250 2900
$Comp
L PINHD-1X20 JP1
U 1 1 49C89FF7
P 10050 2200
F 0 "JP1" H 9800 3225 50 0000 L B
F 1 "Keyboard Rows" H 9800 1000 50 0000 L B
F 2 "pinhead-1X20" H 10050 2350 50 0001 C C
1 10050 2200
1 0 0 -1
$EndComp
$Comp
L GND #PWR01
U 1 1 480611E8
P 3150 7100
F 0 "#PWR01" H 3150 7100 30 0001 C C
F 1 "GND" H 3150 7030 30 0001 C C
1 3150 7100
1 0 0 -1
$EndComp
$Comp
L GND #PWR02
U 1 1 480611E3
P 2400 7100
F 0 "#PWR02" H 2400 7100 30 0001 C C
F 1 "GND" H 2400 7030 30 0001 C C
1 2400 7100
1 0 0 -1
$EndComp
Text Notes 9500 5700 0 60 ~
ISP
Text Label 4900 2300 0 60 ~
MISO
Text Label 8900 6350 0 60 ~
MISO
Text Label 4900 2200 0 60 ~
SCK
Text Label 8900 6250 0 60 ~
SCK
Text Label 8900 5950 0 60 ~
MOSI
Text Label 4900 2400 0 60 ~
MOSI
Text Label 8900 6150 0 60 ~
Reset
Text Label 2000 1300 0 60 ~
Reset
Text Label 9450 2800 0 60 ~
R15
Text Label 9450 2700 0 60 ~
R14
Text Label 9450 2600 0 60 ~
R13
Text Label 9450 2500 0 60 ~
R12
Text Label 9450 2400 0 60 ~
R11
Text Label 9450 2300 0 60 ~
R10
Text Label 9450 2200 0 60 ~
R9
Text Label 9450 2100 0 60 ~
R8
Text Label 9450 2000 0 60 ~
R7
Text Label 9450 1900 0 60 ~
R6
Text Label 9450 1800 0 60 ~
R5
Text Label 9450 1700 0 60 ~
R4
Text Label 9450 1600 0 60 ~
R3
Text Label 9450 1500 0 60 ~
R2
Text Label 9450 1400 0 60 ~
R1
Text Label 9450 1300 0 60 ~
R0
Text Label 4600 3800 0 60 ~
R15
Text Label 4600 3700 0 60 ~
R14
Text Label 4600 3600 0 60 ~
R13
Text Label 4600 3500 0 60 ~
R12
Text Label 4600 3400 0 60 ~
R11
Text Label 4600 3300 0 60 ~
R10
Text Label 4600 3200 0 60 ~
R9
Text Label 4600 3100 0 60 ~
R8
Text Label 4600 1300 0 60 ~
R7
Text Label 4600 1400 0 60 ~
R6
Text Label 4600 1500 0 60 ~
R5
Text Label 4600 1600 0 60 ~
R4
Text Label 4600 1700 0 60 ~
R3
Text Label 4600 1800 0 60 ~
R2
Text Label 4600 1900 0 60 ~
R1
Text Label 4600 2000 0 60 ~
R0
Text Label 4600 2200 0 60 ~
C7
Text Label 4600 2300 0 60 ~
C6
Text Label 4600 2400 0 60 ~
C5
Text Label 4600 2500 0 60 ~
C4
Text Label 4600 2600 0 60 ~
C3
Text Label 4600 2700 0 60 ~
C2
Text Label 4600 2800 0 60 ~
C1
Text Label 4600 2900 0 60 ~
C0
Text Label 9450 4850 0 60 ~
C7
Text Label 9450 4750 0 60 ~
C6
Text Label 9450 4650 0 60 ~
C5
Text Label 9450 4550 0 60 ~
C4
Text Label 9450 4450 0 60 ~
C3
Text Label 9450 4350 0 60 ~
C2
Text Label 9450 4250 0 60 ~
C1
Text Label 9450 4150 0 60 ~
C0
Entry Wire Line
9150 1200 9250 1300
Entry Wire Line
9150 1300 9250 1400
Entry Wire Line
9150 1400 9250 1500
Entry Wire Line
9150 1500 9250 1600
Entry Wire Line
9150 1600 9250 1700
Entry Wire Line
9150 1700 9250 1800
Entry Wire Line
9150 1800 9250 1900
Entry Wire Line
9150 1900 9250 2000
Entry Wire Line
9150 2000 9250 2100
Entry Wire Line
9150 2100 9250 2200
Entry Wire Line
9150 2200 9250 2300
Entry Wire Line
9150 2300 9250 2400
Entry Wire Line
9150 2400 9250 2500
Entry Wire Line
9150 2500 9250 2600
Entry Wire Line
9150 2600 9250 2700
Entry Wire Line
8750 4050 8850 4150
Entry Wire Line
8750 4150 8850 4250
Entry Wire Line
8750 4250 8850 4350
Entry Wire Line
8750 4350 8850 4450
Entry Wire Line
8750 4450 8850 4550
Entry Wire Line
8750 4550 8850 4650
Entry Wire Line
8750 4650 8850 4750
Entry Wire Line
8750 4750 8850 4850
Entry Wire Line
5700 2900 5800 2800
Entry Wire Line
5700 2800 5800 2700
Entry Wire Line
5700 2700 5800 2600
Entry Wire Line
5700 2600 5800 2500
Entry Wire Line
5700 2500 5800 2400
Entry Wire Line
5700 2400 5800 2300
Entry Wire Line
5700 2300 5800 2200
Entry Wire Line
5700 2200 5800 2100
Entry Wire Line
5350 3800 5450 3700
Entry Wire Line
5350 3700 5450 3600
Entry Wire Line
5350 3600 5450 3500
Entry Wire Line
5350 3500 5450 3400
Entry Wire Line
5350 3400 5450 3300
Entry Wire Line
5350 3300 5450 3200
Entry Wire Line
5350 3200 5450 3100
Entry Wire Line
5350 3100 5450 3000
Entry Wire Line
5350 2000 5450 1900
Entry Wire Line
5350 1900 5450 1800
Entry Wire Line
5350 1800 5450 1700
Entry Wire Line
5350 1700 5450 1600
Entry Wire Line
5350 1600 5450 1500
Entry Wire Line
5350 1500 5450 1400
Entry Wire Line
5350 1400 5450 1300
Entry Wire Line
5350 1300 5450 1200
$Comp
L GND #PWR03
U 1 1 4804562B
P 10150 6550
F 0 "#PWR03" H 10150 6550 30 0001 C C
F 1 "GND" H 10150 6480 30 0001 C C
1 10150 6550
1 0 0 -1
$EndComp
$Comp
L VCC #PWR04
U 1 1 4804561C
P 10150 5800
F 0 "#PWR04" H 10150 5900 30 0001 C C
F 1 "VCC" H 10150 5900 30 0000 C C
1 10150 5800
1 0 0 -1
$EndComp
NoConn ~ 9450 6050
NoConn ~ 3400 5000
NoConn ~ 2400 2500
NoConn ~ 3400 1000
$Comp
L VCC #PWR05
U 1 1 480450B7
P 3500 5850
F 0 "#PWR05" H 3500 5950 30 0001 C C
F 1 "VCC" H 3500 5950 30 0000 C C
1 3500 5850
1 0 0 -1
$EndComp
$Comp
L VCC #PWR06
U 1 1 48044F99
P 1150 1100
F 0 "#PWR06" H 1150 1200 30 0001 C C
F 1 "VCC" H 1150 1200 30 0000 C C
1 1150 1100
1 0 0 -1
$EndComp
$Comp
L GND #PWR07
U 1 1 48044DD0
P 2200 7100
F 0 "#PWR07" H 2200 7100 30 0001 C C
F 1 "GND" H 2200 7030 30 0001 C C
1 2200 7100
1 0 0 -1
$EndComp
$Comp
L VCC #PWR08
U 1 1 48044DC6
P 2200 6350
F 0 "#PWR08" H 2200 6450 30 0001 C C
F 1 "VCC" H 2200 6450 30 0000 C C
1 2200 6350
1 0 0 -1
$EndComp
$Comp
L VCC #PWR09
U 1 1 48044DB8
P 1550 3600
F 0 "#PWR09" H 1550 3700 30 0001 C C
F 1 "VCC" H 1550 3700 30 0000 C C
1 1550 3600
1 0 0 -1
$EndComp
$Comp
L VCC #PWR010
U 1 1 48044DB5
P 1000 3600
F 0 "#PWR010" H 1000 3700 30 0001 C C
F 1 "VCC" H 1000 3700 30 0000 C C
1 1000 3600
1 0 0 -1
$EndComp
$Comp
L VCC #PWR011
U 1 1 48044D21
P 3300 800
F 0 "#PWR011" H 3300 900 30 0001 C C
F 1 "VCC" H 3300 900 30 0000 C C
1 3300 800
1 0 0 -1
$EndComp
$Comp
L GND #PWR012
U 1 1 48044A9D
P 4200 7550
F 0 "#PWR012" H 4200 7550 30 0001 C C
F 1 "GND" H 4200 7480 30 0001 C C
1 4200 7550
1 0 0 -1
$EndComp
$Comp
L GND #PWR013
U 1 1 48044A97
P 3850 7550
F 0 "#PWR013" H 3850 7550 30 0001 C C
F 1 "GND" H 3850 7480 30 0001 C C
1 3850 7550
1 0 0 -1
$EndComp
$Comp
L GND #PWR014
U 1 1 48044A95
P 3500 7550
F 0 "#PWR014" H 3500 7550 30 0001 C C
F 1 "GND" H 3500 7480 30 0001 C C
1 3500 7550
1 0 0 -1
$EndComp
$Comp
L GND #PWR015
U 1 1 48044A93
P 1550 4450
F 0 "#PWR015" H 1550 4450 30 0001 C C
F 1 "GND" H 1550 4380 30 0001 C C
1 1550 4450
1 0 0 -1
$EndComp
$Comp
L GND #PWR016
U 1 1 48044A8D
P 1000 4450
F 0 "#PWR016" H 1000 4450 30 0001 C C
F 1 "GND" H 1000 4380 30 0001 C C
1 1000 4450
1 0 0 -1
$EndComp
$Comp
L GND #PWR017
U 1 1 48044A8A
P 3300 5150
F 0 "#PWR017" H 3300 5150 30 0001 C C
F 1 "GND" H 3300 5080 30 0001 C C
1 3300 5150
1 0 0 -1
$EndComp
$Comp
L GND #PWR018
U 1 1 48044A88
P 850 1700
F 0 "#PWR018" H 850 1700 30 0001 C C
F 1 "GND" H 850 1630 30 0001 C C
1 850 1700
0 1 1 0
$EndComp
$Comp
L GND #PWR019
U 1 1 48044A82
P 850 2300
F 0 "#PWR019" H 850 2300 30 0001 C C
F 1 "GND" H 850 2230 30 0001 C C
1 850 2300
0 1 1 0
$EndComp
$Comp
L PINHD-2X5M JP7
U 1 1 48044A4D
P 9550 6150
F 0 "JP7" H 9300 6475 50 0000 L B
F 1 "ISP" H 9300 5750 50 0000 L B
F 2 "pinhead-2X05M" H 9550 6300 50 0001 C C
1 9550 6150
1 0 0 -1
$EndComp
$Comp
L PINHD-1X8M JP2
U 1 1 48044A0E
P 10050 4550
F 0 "JP2" H 9800 5075 50 0000 L B
F 1 "Keyboard Columns" H 9800 4050 50 0000 L B
F 2 "pinhead-1X08M" H 10050 4700 50 0001 C C
1 10050 4550
1 0 0 -1
$EndComp
$Comp
L MEGA32-P IC1
U 1 1 480447FC
P 3400 3000
F 0 "IC1" H 3450 3050 50 0000 L B
F 1 "MEGA32-P" H 3600 1000 50 0000 L B
F 2 "atmel-DIL40" H 3400 3150 50 0001 C C
1 3400 3000
1 0 0 -1
$EndComp
$Comp
L ZENER D2
U 1 1 48044798
P 4200 7200
F 0 "D2" H 4200 7300 50 0000 C C
F 1 "3.6V" H 4200 7100 40 0000 C C
1 4200 7200
0 -1 -1 0
$EndComp
$Comp
L ZENER D1
U 1 1 48044791
P 3850 7200
F 0 "D1" H 3850 7300 50 0000 C C
F 1 "3.6V" H 3850 7100 40 0000 C C
1 3850 7200
0 -1 -1 0
$EndComp
$Comp
L CRYSTAL X1
U 1 1 4804477C
P 1900 2000
F 0 "X1" H 1900 2150 60 0000 C C
F 1 "12MHz" H 1900 1850 60 0000 C C
1 1900 2000
0 1 1 0
$EndComp
$Comp
L CP C2
U 1 1 48044769
P 1550 4000
F 0 "C2" H 1600 4100 50 0000 L C
F 1 "10u" H 1600 3900 50 0000 L C
1 1550 4000
-1 0 0 -1
$EndComp
$Comp
L C C1
U 1 1 48044756
P 1000 4000
F 0 "C1" H 1050 4100 50 0000 L C
F 1 "100n" H 1050 3900 50 0000 L C
1 1000 4000
-1 0 0 -1
$EndComp
$Comp
L C C4
U 1 1 48044754
P 1350 2300
F 0 "C4" H 1400 2400 50 0000 L C
F 1 "22p" H 1400 2200 50 0000 L C
1 1350 2300
0 1 1 0
$EndComp
$Comp
L C C3
U 1 1 48044750
P 1350 1700
F 0 "C3" H 1400 1800 50 0000 L C
F 1 "22p" H 1400 1600 50 0000 L C
1 1350 1700
0 1 1 0
$EndComp
$Comp
L R R8
U 1 1 48044743
P 4850 6150
F 0 "R8" V 4930 6150 50 0000 C C
F 1 "68" V 4850 6150 50 0000 C C
1 4850 6150
-1 0 0 1
$EndComp
$Comp
L R R7
U 1 1 48044741
P 4650 6150
F 0 "R7" V 4730 6150 50 0000 C C
F 1 "68" V 4650 6150 50 0000 C C
1 4650 6150
-1 0 0 1
$EndComp
$Comp
L R R1
U 1 1 4804473F
P 1650 1300
F 0 "R1" V 1730 1300 50 0000 C C
F 1 "10k" V 1650 1300 50 0000 C C
1 1650 1300
0 1 1 0
$EndComp
$Comp
L R R2
U 1 1 4804473B
P 3500 6200
F 0 "R2" V 3580 6200 50 0000 C C
F 1 "2k2" V 3500 6200 50 0000 C C
1 3500 6200
1 0 0 -1
$EndComp
$Comp
L R R6
U 1 1 48044739
P 3500 7150
F 0 "R6" V 3580 7150 50 0000 C C
F 1 "4k7" V 3500 7150 50 0000 C C
1 3500 7150
1 0 0 -1
$EndComp
$Comp
L USB J1
U 1 1 480446AA
P 2800 6400
F 0 "J1" H 2750 6800 60 0000 C C
F 1 "USB" V 2550 6550 60 0000 C C
1 2800 6400
1 0 0 -1
$EndComp
$EndSCHEMATC

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +0,0 @@
** Drc report for /home/rschaten/microcontroller/dulcimer/circuit/dulcimer.brd **
** Created on 2008-07-10 08:10:47 **
** Found 0 DRC errors **
** Found 0 unconnected pads **
** End of Report **

View File

@ -1,5 +0,0 @@
ERC control (10/7/2008-05:33:33)
***** Sheet / (Root)
>> Errors ERC: 0

View File

@ -1,67 +0,0 @@
EESchema (20080320-r918) >> Creation date: 10/7/2008-05:33:42
#Cmp ( order = Reference )
| C1 100n
| C2 10u
| C3 22p
| C4 22p
| D1 3.6V
| D2 3.6V
| IC1 MEGA32-P
| J1 USB
| JP1 PINHD-1X16M
| JP10 PINHD-1X4
| JP11 PINHD-1X3
| JP12 PINHD-1X3
| JP13 PINHD-1X4
| JP2 PINHD-1X8M
| JP3 PINHD-1X4M
| JP4 JUMPER
| JP5 JUMPER
| JP6 JUMPER
| JP7 PINHD-2X5M
| P1 CONN_2
| R1 10k
| R2 2k2
| R3 470
| R4 470
| R5 470
| R6 4k7
| R7 68
| R8 68
| X1 12MHz
#End Cmp
#Cmp ( order = Value )
| 100n C1
| 10k R1
| 10u C2
| 12MHz X1
| 22p C3
| 22p C4
| 2k2 R2
| 3.6V D1
| 3.6V D2
| 470 R3
| 470 R4
| 470 R5
| 4k7 R6
| 68 R7
| 68 R8
| CONN_2 P1
| JUMPER JP4
| JUMPER JP5
| JUMPER JP6
| MEGA32-P IC1
| PINHD-1X16M JP1
| PINHD-1X3 JP11
| PINHD-1X3 JP12
| PINHD-1X4 JP10
| PINHD-1X4 JP13
| PINHD-1X4M JP3
| PINHD-1X8M JP2
| PINHD-2X5M JP7
| USB J1
#End Cmp
#End List

View File

@ -1,24 +0,0 @@
comp = "C1" module = "C1"
comp = "C2" module = "CP36V"
comp = "C3" module = "C1"
comp = "C4" module = "C1"
comp = "D1" module = "D3"
comp = "D2" module = "D3"
comp = "IC1" module = "atmel-DIL40"
comp = "J1" module = "PIN_ARRAY_2X2"
comp = "JP1" module = "pinhead-1X16M"
comp = "JP2" module = "pinhead-1X08M"
comp = "JP3" module = "pinhead-1X04M"
comp = "JP4" module = "PIN_ARRAY_2X1"
comp = "JP5" module = "PIN_ARRAY_2X1"
comp = "JP6" module = "PIN_ARRAY_2X1"
comp = "JP7" module = "pinhead-2X05M"
comp = "R1" module = "R3"
comp = "R2" module = "R3"
comp = "R3" module = "R3"
comp = "R4" module = "R3"
comp = "R5" module = "R3"
comp = "R6" module = "R3"
comp = "R7" module = "R3"
comp = "R8" module = "R3"
comp = "X1" module = "2PIN_6mm"

File diff suppressed because it is too large Load Diff

View File

@ -1,31 +0,0 @@
EESchema-DOCLIB Version 2.0 12/11/2008-07:33:03
#
$CMP C
D Condensateur non polarise
$ENDCMP
#
$CMP CONN_2
D Symbole general de connecteur
K CONN
$ENDCMP
#
$CMP CP
D Condensateur polarise
$ENDCMP
#
$CMP R
D Resistance
K R DEV
$ENDCMP
#
$CMP USB_CONN
D USB CONNECTOR
K USB
$ENDCMP
#
$CMP ZENER
D Diode zener
K DEV DIODE
$ENDCMP
#
#End Doc Library

View File

@ -1,354 +0,0 @@
EESchema-LIBRARY Version 12/11/2008-07:33:03
#
#
# C
#
DEF C C 0 10 N Y 1 F N
F0 "C" 50 100 50 H V L C
F1 "C" 50 -100 50 H V L C
$FPLIST
SM*
C?
C1-1
$ENDFPLIST
DRAW
P 2 0 1 8 -100 30 100 30 N
P 2 0 1 8 -100 -30 100 -30 N
X ~ 1 0 200 170 D 40 40 1 1 P
X ~ 2 0 -200 170 U 40 40 1 1 P
ENDDRAW
ENDDEF
#
# CONN_2
#
DEF CONN_2 P 0 40 Y N 1 F N
F0 "P" -50 0 40 V V C C
F1 "CONN_2" 50 0 40 V V C C
DRAW
S -100 150 100 -150 0 1 0 N
X PM 2 -350 -100 250 R 60 60 1 1 P I
X P1 1 -350 100 250 R 60 60 1 1 P I
ENDDRAW
ENDDEF
#
# CP
#
DEF CP C 0 10 N N 1 F N
F0 "C" 50 100 50 H V L C
F1 "CP" 50 -100 50 H V L C
ALIAS CAPAPOL
$FPLIST
CP*
SM*
$ENDFPLIST
DRAW
P 4 0 1 0 -50 50 -50 -20 50 -20 50 50 F
P 4 0 1 8 -100 50 -100 -50 100 -50 100 50 N
X ~ 1 0 200 150 D 40 40 1 1 P
X ~ 2 0 -200 150 U 40 40 1 1 P
ENDDRAW
ENDDEF
#
# CRYSTAL
#
DEF CRYSTAL X 0 40 N N 0 F N
F0 "X" 0 150 60 H V C C
F1 "CRYSTAL" 0 -150 60 H V C C
DRAW
P 5 0 1 12 -50 50 50 50 50 -50 -50 -50 -50 50 f
P 2 0 1 16 -100 100 -100 -100 N
P 2 0 1 16 100 100 100 -100 N
X 2 2 300 0 200 L 40 40 1 1 P
X 1 1 -300 0 200 R 40 40 1 1 P
ENDDRAW
ENDDEF
#
# GND
#
DEF ~GND #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 0 30 H I C C
F1 "GND" 0 -70 30 H I C C
DRAW
P 4 0 1 4 -50 0 0 -50 50 0 -50 0 N
X GND 1 0 0 0 U 30 30 1 1 W N
ENDDRAW
ENDDEF
#
# MEGA32-P
#
DEF MEGA32-P IC 0 40 Y Y 1 L N
F0 "IC" -800 1830 50 H V L B
F1 "MEGA32-P" 200 -2000 50 H V L B
F2 "atmel-DIL40" 0 150 50 H I C C
DRAW
P 2 1 0 0 -800 1800 800 1800 N
P 2 1 0 0 800 1800 800 -1800 N
P 2 1 0 0 800 -1800 -800 -1800 N
P 2 1 0 0 -800 -1800 -800 1800 N
X VCC 10 -100 2000 200 D 40 40 1 1 W
X AVCC 30 0 2000 200 D 40 40 1 1 W
X (RXD)PD0 14 1000 -1700 200 L 40 40 1 1 B
X (TXD)PD1 15 1000 -1600 200 L 40 40 1 1 B
X (INT0)PD2 16 1000 -1500 200 L 40 40 1 1 B
X (INT1)PD3 17 1000 -1400 200 L 40 40 1 1 B
X (OC1B)PD4 18 1000 -1300 200 L 40 40 1 1 B
X (OC1A)PD5 19 1000 -1200 200 L 40 40 1 1 B
X (ICP)PD6 20 1000 -1100 200 L 40 40 1 1 B
X (OC2)PD7 21 1000 -1000 200 L 40 40 1 1 B
X (SCL)PC0 22 1000 -800 200 L 40 40 1 1 B
X (SDA)PC1 23 1000 -700 200 L 40 40 1 1 B
X (TCK)PC2 24 1000 -600 200 L 40 40 1 1 B
X (TMS)PC3 25 1000 -500 200 L 40 40 1 1 B
X (TDO)PC4 26 1000 -400 200 L 40 40 1 1 B
X (TDI)PC5 27 1000 -300 200 L 40 40 1 1 B
X (TOSC1)PC6 28 1000 -200 200 L 40 40 1 1 B
X (TOSC2)PC7 29 1000 -100 200 L 40 40 1 1 B
X (T0/XCK)PB0 1 1000 100 200 L 40 40 1 1 B
X (T1)PB1 2 1000 200 200 L 40 40 1 1 B
X (AIN0/INT2)PB2 3 1000 300 200 L 40 40 1 1 B
X (AIN1/OC0)PB3 4 1000 400 200 L 40 40 1 1 B
X (SS)PB4 5 1000 500 200 L 40 40 1 1 B
X (MOSI)PB5 6 1000 600 200 L 40 40 1 1 B
X (MISO)PB6 7 1000 700 200 L 40 40 1 1 B
X (SCK)PB7 8 1000 800 200 L 40 40 1 1 B
X (ADC0)PA0 40 1000 1000 200 L 40 40 1 1 B
X (ADC1)PA1 39 1000 1100 200 L 40 40 1 1 B
X (ADC2)PA2 38 1000 1200 200 L 40 40 1 1 B
X (ADC3)PA3 37 1000 1300 200 L 40 40 1 1 B
X (ADC4)PA4 36 1000 1400 200 L 40 40 1 1 B
X (ADC5)PA5 35 1000 1500 200 L 40 40 1 1 B
X (ADC6)PA6 34 1000 1600 200 L 40 40 1 1 B
X (ADC7)PA7 33 1000 1700 200 L 40 40 1 1 B
X AREF 32 -1000 500 200 R 40 40 1 1 W
X XTAL1 13 -1000 900 200 R 40 40 1 1 B
X XTAL2 12 -1000 1300 200 R 40 40 1 1 B
X RESET 9 -1000 1700 200 R 40 40 1 1 I I
X GND 11 -100 -2000 200 U 40 40 1 1 W
X AGND 31 0 -2000 200 U 40 40 1 1 W
ENDDRAW
ENDDEF
#
# PINHD-1X16M
#
DEF PINHD-1X16M JP 0 40 Y Y 1 L N
F0 "JP" -250 825 50 H V L B
F1 "PINHD-1X16M" -250 -1000 50 H V L B
F2 "pinhead-1X16M" 0 150 50 H I C C
DRAW
P 2 1 0 0 -250 800 -250 -900 N
P 2 1 0 0 50 800 -250 800 N
P 2 1 0 0 50 -900 50 800 N
P 2 1 0 0 -250 -900 50 -900 N
X 16 16 -100 -800 100 R 40 40 1 1 P I
X 15 15 -100 -700 100 R 40 40 1 1 P I
X 14 14 -100 -600 100 R 40 40 1 1 P I
X 13 13 -100 -500 100 R 40 40 1 1 P I
X 12 12 -100 -400 100 R 40 40 1 1 P I
X 11 11 -100 -300 100 R 40 40 1 1 P I
X 10 10 -100 -200 100 R 40 40 1 1 P I
X 9 9 -100 -100 100 R 40 40 1 1 P I
X 8 8 -100 0 100 R 40 40 1 1 P I
X 7 7 -100 100 100 R 40 40 1 1 P I
X 6 6 -100 200 100 R 40 40 1 1 P I
X 5 5 -100 300 100 R 40 40 1 1 P I
X 4 4 -100 400 100 R 40 40 1 1 P I
X 3 3 -100 500 100 R 40 40 1 1 P I
X 2 2 -100 600 100 R 40 40 1 1 P I
X 1 1 -100 700 100 R 40 40 1 1 P I
ENDDRAW
ENDDEF
#
# PINHD-1X3
#
DEF PINHD-1X3 JP 0 40 Y Y 1 L N
F0 "JP" -250 225 50 H V L B
F1 "PINHD-1X3" -250 -300 50 H V L B
F2 "pinhead-1X03" 0 150 50 H I C C
DRAW
P 2 1 0 0 -250 200 -250 -200 N
P 2 1 0 0 50 200 -250 200 N
P 2 1 0 0 50 -200 50 200 N
P 2 1 0 0 -250 -200 50 -200 N
X 3 3 -100 -100 100 R 40 40 1 1 P I
X 2 2 -100 0 100 R 40 40 1 1 P I
X 1 1 -100 100 100 R 40 40 1 1 P I
ENDDRAW
ENDDEF
#
# PINHD-1X3M
#
DEF PINHD-1X3M JP 0 40 Y Y 1 L N
F0 "JP" -250 225 50 H V L B
F1 "PINHD-1X3M" -250 -300 50 H V L B
F2 "pinhead-1X03M" 0 150 50 H I C C
DRAW
P 2 1 0 0 -250 200 -250 -200 N
P 2 1 0 0 50 200 -250 200 N
P 2 1 0 0 50 -200 50 200 N
P 2 1 0 0 -250 -200 50 -200 N
X 3 3 -100 -100 100 R 40 40 1 1 P I
X 2 2 -100 0 100 R 40 40 1 1 P I
X 1 1 -100 100 100 R 40 40 1 1 P I
ENDDRAW
ENDDEF
#
# PINHD-1X4
#
DEF PINHD-1X4 JP 0 40 Y Y 1 L N
F0 "JP" -250 325 50 H V L B
F1 "PINHD-1X4" -250 -300 50 H V L B
F2 "pinhead-1X04" 0 150 50 H I C C
DRAW
P 2 1 0 0 -250 300 -250 -200 N
P 2 1 0 0 50 300 -250 300 N
P 2 1 0 0 50 -200 50 300 N
P 2 1 0 0 -250 -200 50 -200 N
X 4 4 -100 -100 100 R 40 40 1 1 P I
X 3 3 -100 0 100 R 40 40 1 1 P I
X 2 2 -100 100 100 R 40 40 1 1 P I
X 1 1 -100 200 100 R 40 40 1 1 P I
ENDDRAW
ENDDEF
#
# PINHD-1X5M
#
DEF PINHD-1X5M JP 0 40 Y Y 1 L N
F0 "JP" -250 325 50 H V L B
F1 "PINHD-1X5M" -250 -400 50 H V L B
F2 "pinhead-1X05M" 0 150 50 H I C C
DRAW
P 2 1 0 0 -250 300 -250 -300 N
P 2 1 0 0 50 300 -250 300 N
P 2 1 0 0 50 -300 50 300 N
P 2 1 0 0 -250 -300 50 -300 N
X 5 5 -100 -200 100 R 40 40 1 1 P I
X 4 4 -100 -100 100 R 40 40 1 1 P I
X 3 3 -100 0 100 R 40 40 1 1 P I
X 2 2 -100 100 100 R 40 40 1 1 P I
X 1 1 -100 200 100 R 40 40 1 1 P I
ENDDRAW
ENDDEF
#
# PINHD-1X8M
#
DEF PINHD-1X8M JP 0 40 Y Y 1 L N
F0 "JP" -250 525 50 H V L B
F1 "PINHD-1X8M" -250 -500 50 H V L B
F2 "pinhead-1X08M" 0 150 50 H I C C
DRAW
P 2 1 0 0 -250 500 -250 -400 N
P 2 1 0 0 50 500 -250 500 N
P 2 1 0 0 50 -400 50 500 N
P 2 1 0 0 -250 -400 50 -400 N
X 8 8 -100 -300 100 R 40 40 1 1 P I
X 7 7 -100 -200 100 R 40 40 1 1 P I
X 6 6 -100 -100 100 R 40 40 1 1 P I
X 5 5 -100 0 100 R 40 40 1 1 P I
X 4 4 -100 100 100 R 40 40 1 1 P I
X 3 3 -100 200 100 R 40 40 1 1 P I
X 2 2 -100 300 100 R 40 40 1 1 P I
X 1 1 -100 400 100 R 40 40 1 1 P I
ENDDRAW
ENDDEF
#
# PINHD-2X5M
#
DEF PINHD-2X5M JP 0 40 Y Y 1 L N
F0 "JP" -250 325 50 H V L B
F1 "PINHD-2X5M" -250 -400 50 H V L B
F2 "pinhead-2X05M" 0 150 50 H I C C
DRAW
P 2 1 0 0 -250 300 -250 -300 N
P 2 1 0 0 350 300 -250 300 N
P 2 1 0 0 350 -300 350 300 N
P 2 1 0 0 -250 -300 350 -300 N
X 10 10 200 -200 100 L 40 40 1 1 P I
X 8 8 200 -100 100 L 40 40 1 1 P I
X 6 6 200 0 100 L 40 40 1 1 P I
X 4 4 200 100 100 L 40 40 1 1 P I
X 2 2 200 200 100 L 40 40 1 1 P I
X 9 9 -100 -200 100 R 40 40 1 1 P I
X 7 7 -100 -100 100 R 40 40 1 1 P I
X 5 5 -100 0 100 R 40 40 1 1 P I
X 3 3 -100 100 100 R 40 40 1 1 P I
X 1 1 -100 200 100 R 40 40 1 1 P I
ENDDRAW
ENDDEF
#
# R
#
DEF R R 0 0 N Y 1 F N
F0 "R" 80 0 50 V V C C
F1 "R" 0 0 50 V V C C
$FPLIST
R?
SM0603
SM0805
$ENDFPLIST
DRAW
S -40 150 40 -150 0 1 8 N
X ~ 1 0 250 100 D 60 60 1 1 P
X ~ 2 0 -250 100 U 60 60 1 1 P
ENDDRAW
ENDDEF
#
# USB_CONN
#
DEF USB_CONN J 0 0 Y Y 1 F N
F0 "J" -50 400 60 H V C C
F1 "USB_CONN" -250 150 60 V V C C
ALIAS USB
DRAW
P 3 0 1 0 100 -50 200 -200 200 -200 N
S 50 100 50 200 0 1 0 N
P 4 0 1 0 -100 -450 -50 -400 -50 -50 -50 -50 N
P 4 0 1 0 0 -50 0 -400 50 -450 50 -450 N
P 9 0 1 0 -150 0 100 0 100 250 50 300 -100 300 -150 250 -150 0 -150 0 -150 0 N
S -100 200 -100 100 0 1 0 N
P 4 0 1 0 50 -50 50 -250 200 -350 200 -350 N
S -100 200 -100 200 0 1 0 N
P 3 0 1 0 -150 -50 -250 -200 -250 -200 N
S 50 100 -100 100 0 1 0 N
P 6 0 1 0 -200 -50 150 -50 150 350 -200 350 -200 -50 -200 -50 N
S -100 200 50 200 0 1 0 N
P 4 0 1 0 -100 -50 -100 -250 -250 -350 -250 -350 N
X Shield_1 5 350 -450 300 L 40 30 1 1 P
X D- 2 350 -350 150 L 40 30 1 1 B
X D+ 3 350 -200 150 L 40 30 1 1 B
X Shield_2 6 -400 -450 300 R 40 30 1 1 P
X GND 4 -400 -350 150 R 40 30 1 1 w
X Vbus 1 -400 -200 150 R 40 30 1 1 w
ENDDRAW
ENDDEF
#
# VCC
#
DEF VCC #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 100 30 H I C C
F1 "VCC" 0 100 30 H V C C
DRAW
C 0 50 20 0 1 4 N
P 3 0 1 4 0 0 0 30 0 30 N
X VCC 1 0 0 0 U 20 20 0 0 W N
ENDDRAW
ENDDEF
#
# ZENER
#
DEF ZENER D 0 40 N N 1 F N
F0 "D" 0 100 50 H V C C
F1 "ZENER" 0 -100 40 H V C C
$FPLIST
D?
SO*
SM*
$ENDFPLIST
DRAW
P 5 0 1 0 50 0 -50 50 -50 -50 50 0 50 0 F
P 5 0 1 8 70 50 50 30 50 -30 30 -50 30 -50 N
X K 2 200 0 150 L 40 40 1 1 P
X A 1 -200 0 150 R 40 40 1 1 P
ENDDRAW
ENDDEF
#
#EndLibrary

View File

@ -1,146 +0,0 @@
update=16/4/2008-14:31:58
last_client=pcbnew
[general]
version=1
RootSch=dulcimer.sch
[common]
NetDir=
[eeschema]
version=1
LibDir=
NetFmt=1
HPGLSpd=20
HPGLDm=15
HPGLNum=1
offX_A4=0
offY_A4=0
offX_A3=0
offY_A3=0
offX_A2=0
offY_A2=0
offX_A1=0
offY_A1=0
offX_A0=0
offY_A0=0
offX_A=0
offY_A=0
offX_B=0
offY_B=0
offX_C=0
offY_C=0
offX_D=0
offY_D=0
offX_E=0
offY_E=0
RptD_X=0
RptD_Y=100
RptLab=1
SimCmd=
UseNetN=0
LabSize=60
[eeschema/libraries]
LibName1=power
LibName2=pinhead
LibName3=device
LibName4=conn
LibName5=linear
LibName6=regul
LibName7=74xx
LibName8=cmos4000
LibName9=adc-dac
LibName10=memory
LibName11=xilinx
LibName12=special
LibName13=microcontrollers
LibName14=dsp
LibName15=microchip
LibName16=analog_switches
LibName17=motorola
LibName18=texas
LibName19=intel
LibName20=audio
LibName21=interface
LibName22=digital-audio
LibName23=philips
LibName24=display
LibName25=cypress
LibName26=siliconi
LibName27=contrib
LibName28=valves
[cvpcb]
version=1
NetITyp=0
NetIExt=.net
PkgIExt=.pkg
NetType=0
[cvpcb/libraries]
EquName1=devcms
[pcbnew]
version=1
PadDrlX=320
PadDimH=600
PadDimV=600
PadForm=1
PadMask=14745599
ViaDiam=450
ViaDril=250
MViaDia=200
MViaDrl=80
Isol=60
Countlayer=2
Lpiste=170
RouteTo=15
RouteBo=0
TypeVia=3
Segm45=1
Racc45=1
Unite=0
SegFill=1
SegAffG=0
NewAffG=1
PadFill=1
PadAffG=1
PadSNum=1
ModAffC=0
ModAffT=0
PcbAffT=0
SgPcb45=1
TxtPcbV=800
TxtPcbH=600
TxtModV=600
TxtModH=600
TxtModW=120
HPGLnum=1
HPGdiam=15
HPGLSpd=20
HPGLrec=2
HPGLorg=0
GERBmin=15
VEgarde=100
DrawLar=150
EdgeLar=150
TxtLar=120
MSegLar=150
ForPlot=1
WpenSer=10
UserGrX=1
UserGrY=1
UserGrU=1
DivGrPc=1
TimeOut=600
MaxLnkS=3
ShowRat=0
ShowMRa=1
[pcbnew/libraries]
LibDir=
LibName1=supports
LibName2=pl_empreinte
LibName3=pinhead
LibName4=atmel
LibName5=connect
LibName6=discret
LibName7=pin_array
LibName8=divers
LibName9=libcms
LibName10=display
LibName11=valves

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,351 +0,0 @@
EESchema-LIBRARY Version 2/11/2008-16:51:53
#
#
# 4094N
#
DEF 4094N IC 0 40 Y Y 2 L N
F0 "IC" -400 625 50 H V L B
F1 "4094N" -400 -700 50 H V L B
F2 "40xx-DIL16" 0 150 50 H I C C
DRAW
P 2 1 0 0 -400 600 -400 -600 N
P 2 1 0 0 300 600 -400 600 N
P 2 1 0 0 300 -600 300 600 N
P 2 1 0 0 -400 -600 300 -600 N
T 1 50 175 50 0 2 0 VDD
T 1 50 -155 50 0 2 0 VSS
X VDD 16 0 300 200 D 40 40 2 1 W
X QS* 10 500 -500 200 L 40 40 1 1 O
X QS 9 500 -400 200 L 40 40 1 1 O
X Q8 11 500 -200 200 L 40 40 1 1 O
X Q7 12 500 -100 200 L 40 40 1 1 O
X Q6 13 500 0 200 L 40 40 1 1 O
X Q5 14 500 100 200 L 40 40 1 1 O
X Q4 7 500 200 200 L 40 40 1 1 O
X Q3 6 500 300 200 L 40 40 1 1 O
X Q2 5 500 400 200 L 40 40 1 1 O
X Q1 4 500 500 200 L 40 40 1 1 O
X OE 15 -600 200 200 R 40 40 1 1 I
X CLK 3 -600 300 200 R 40 40 1 1 I C
X D 2 -600 400 200 R 40 40 1 1 I
X STR 1 -600 500 200 R 40 40 1 1 I
X VSS 8 0 -300 200 U 40 40 2 1 W
ENDDRAW
ENDDEF
#
# C
#
DEF C C 0 10 N Y 1 F N
F0 "C" 50 100 50 H V L C
F1 "C" 50 -100 50 H V L C
$FPLIST
SM*
C?
C1-1
$ENDFPLIST
DRAW
P 2 0 1 8 -100 30 100 30 N
P 2 0 1 8 -100 -30 100 -30 N
X ~ 1 0 200 170 D 40 40 1 1 P
X ~ 2 0 -200 170 U 40 40 1 1 P
ENDDRAW
ENDDEF
#
# CONN_14
#
DEF CONN_14 P 0 40 Y N 1 F N
F0 "P" -30 0 60 V V C C
F1 "CONN_14" 80 0 60 V V C C
DRAW
S -100 700 150 -700 0 1 0 N
X P14 14 -350 -650 250 R 50 50 1 1 P I
X P13 13 -350 -550 250 R 50 50 1 1 P I
X P12 12 -350 -450 250 R 50 50 1 1 P I
X P11 11 -350 -350 250 R 50 50 1 1 P I
X P10 10 -350 -250 250 R 50 50 1 1 P I
X P9 9 -350 -150 250 R 50 50 1 1 P I
X P8 8 -350 -50 250 R 50 50 1 1 P I
X P7 7 -350 50 250 R 50 50 1 1 P I
X P6 6 -350 150 250 R 50 50 1 1 P I
X P5 5 -350 250 250 R 50 50 1 1 P I
X P4 4 -350 350 250 R 50 50 1 1 P I
X P3 3 -350 450 250 R 50 50 1 1 P I
X P2 2 -350 550 250 R 50 50 1 1 P I
X P1 1 -350 650 250 R 50 50 1 1 P I
ENDDRAW
ENDDEF
#
# CP
#
DEF CP C 0 10 N N 1 F N
F0 "C" 50 100 50 H V L C
F1 "CP" 50 -100 50 H V L C
ALIAS CAPAPOL
$FPLIST
CP*
SM*
$ENDFPLIST
DRAW
P 4 0 1 0 -50 50 -50 -20 50 -20 50 50 F
P 4 0 1 8 -100 50 -100 -50 100 -50 100 50 N
X ~ 1 0 200 150 D 40 40 1 1 P
X ~ 2 0 -200 150 U 40 40 1 1 P
ENDDRAW
ENDDEF
#
# CRYSTAL
#
DEF CRYSTAL X 0 40 N N 0 F N
F0 "X" 0 150 60 H V C C
F1 "CRYSTAL" 0 -150 60 H V C C
DRAW
P 5 0 1 12 -50 50 50 50 50 -50 -50 -50 -50 50 f
P 2 0 1 16 -100 100 -100 -100 N
P 2 0 1 16 100 100 100 -100 N
X 2 2 300 0 200 L 40 40 1 1 P
X 1 1 -300 0 200 R 40 40 1 1 P
ENDDRAW
ENDDEF
#
# DIODE
#
DEF DIODE D 0 40 N N 1 F N
F0 "D" 0 100 40 H V C C
F1 "DIODE" 0 -100 40 H V C C
$FPLIST
D?
S*
$ENDFPLIST
DRAW
P 3 0 1 0 -50 50 50 0 -50 -50 F
P 2 0 1 6 50 50 50 -50 N
X K 2 200 0 150 L 40 40 1 1 P
X A 1 -200 0 150 R 40 40 1 1 P
ENDDRAW
ENDDEF
#
# DIPS_08
#
DEF DIPS_08 SW 0 0 Y N 1 F N
F0 "SW" -450 0 60 V V C C
F1 "DIPS_08" 450 0 60 V V C C
DRAW
S 375 0 325 -50 0 1 0 F
S 375 0 325 -50 0 1 0 F
S 275 0 225 -50 0 1 0 F
S 275 0 225 -50 0 1 0 F
S 175 0 125 -50 0 1 0 F
S 175 0 125 -50 0 1 0 F
S 75 0 25 -50 0 1 0 F
S 75 0 25 -50 0 1 0 F
S -125 0 -175 -50 0 1 0 F
S -125 0 -175 -50 0 1 0 F
S -25 0 -75 -50 0 1 0 F
S -25 0 -75 -50 0 1 0 F
S -225 0 -275 -50 0 1 0 F
S -225 0 -275 -50 0 1 0 F
S -325 0 -375 -50 0 1 0 F
S -325 0 -375 -50 0 1 0 F
S 275 50 225 -50 0 1 0 N
S 275 50 225 -50 0 1 0 N
S 75 50 25 -50 0 1 0 N
S 75 50 25 -50 0 1 0 N
S -325 50 -375 -50 0 1 0 N
S -325 50 -375 -50 0 1 0 N
S -225 50 -275 -50 0 1 0 N
S -225 50 -275 -50 0 1 0 N
S -25 50 -75 -50 0 1 0 N
S -25 50 -75 -50 0 1 0 N
S -125 50 -175 -50 0 1 0 N
S -125 50 -175 -50 0 1 0 N
S 175 50 125 -50 0 1 0 N
S 175 50 125 -50 0 1 0 N
S 375 50 325 -50 0 1 0 N
S 375 50 325 -50 0 1 0 N
S -400 100 400 -100 0 1 0 N
X ~ 16 -350 200 100 D 50 50 1 1 P
X ~ 15 -250 200 100 D 50 50 1 1 P
X ~ 14 -150 200 100 D 50 50 1 1 P
X ~ 13 -50 200 100 D 50 50 1 1 P
X ~ 12 50 200 100 D 50 50 1 1 P
X ~ 11 150 200 100 D 50 50 1 1 P
X ~ 10 250 200 100 D 50 50 1 1 P
X ~ 9 350 200 100 D 50 50 1 1 P
X ~ 1 -350 -200 100 U 50 50 1 1 P
X ~ 1 -350 -200 100 U 50 50 1 1 P
X ~ 2 -250 -200 100 U 50 50 1 1 P
X ~ 3 -150 -200 100 U 50 50 1 1 P
X ~ 4 -50 -200 100 U 50 50 1 1 P
X ~ 5 50 -200 100 U 50 50 1 1 P
X ~ 6 150 -200 100 U 50 50 1 1 P
X ~ 7 250 -200 100 U 50 50 1 1 P
X ~ 8 350 -200 100 U 50 50 1 1 P
ENDDRAW
ENDDEF
#
# GND
#
DEF ~GND #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 0 30 H I C C
F1 "GND" 0 -70 30 H I C C
DRAW
P 4 0 1 4 -50 0 0 -50 50 0 -50 0 N
X GND 1 0 0 0 U 30 30 1 1 W N
ENDDRAW
ENDDEF
#
# MEGA32-P
#
DEF MEGA32-P IC 0 40 Y Y 1 L N
F0 "IC" -800 1830 50 H V L B
F1 "MEGA32-P" 200 -2000 50 H V L B
F2 "atmel-DIL40" 0 150 50 H I C C
DRAW
P 2 1 0 0 -800 -1800 -800 1800 N
P 2 1 0 0 800 -1800 -800 -1800 N
P 2 1 0 0 800 1800 800 -1800 N
P 2 1 0 0 -800 1800 800 1800 N
X VCC 10 -100 2000 200 D 40 40 1 1 W
X AVCC 30 0 2000 200 D 40 40 1 1 W
X (RXD)PD0 14 1000 -1700 200 L 40 40 1 1 B
X (TXD)PD1 15 1000 -1600 200 L 40 40 1 1 B
X (INT0)PD2 16 1000 -1500 200 L 40 40 1 1 B
X (INT1)PD3 17 1000 -1400 200 L 40 40 1 1 B
X (OC1B)PD4 18 1000 -1300 200 L 40 40 1 1 B
X (OC1A)PD5 19 1000 -1200 200 L 40 40 1 1 B
X (ICP)PD6 20 1000 -1100 200 L 40 40 1 1 B
X (OC2)PD7 21 1000 -1000 200 L 40 40 1 1 B
X (SCL)PC0 22 1000 -800 200 L 40 40 1 1 B
X (SDA)PC1 23 1000 -700 200 L 40 40 1 1 B
X (TCK)PC2 24 1000 -600 200 L 40 40 1 1 B
X (TMS)PC3 25 1000 -500 200 L 40 40 1 1 B
X (TDO)PC4 26 1000 -400 200 L 40 40 1 1 B
X (TDI)PC5 27 1000 -300 200 L 40 40 1 1 B
X (TOSC1)PC6 28 1000 -200 200 L 40 40 1 1 B
X (TOSC2)PC7 29 1000 -100 200 L 40 40 1 1 B
X (T0/XCK)PB0 1 1000 100 200 L 40 40 1 1 B
X (T1)PB1 2 1000 200 200 L 40 40 1 1 B
X (AIN0/INT2)PB2 3 1000 300 200 L 40 40 1 1 B
X (AIN1/OC0)PB3 4 1000 400 200 L 40 40 1 1 B
X (SS)PB4 5 1000 500 200 L 40 40 1 1 B
X (MOSI)PB5 6 1000 600 200 L 40 40 1 1 B
X (MISO)PB6 7 1000 700 200 L 40 40 1 1 B
X (SCK)PB7 8 1000 800 200 L 40 40 1 1 B
X (ADC0)PA0 40 1000 1000 200 L 40 40 1 1 B
X (ADC1)PA1 39 1000 1100 200 L 40 40 1 1 B
X (ADC2)PA2 38 1000 1200 200 L 40 40 1 1 B
X (ADC3)PA3 37 1000 1300 200 L 40 40 1 1 B
X (ADC4)PA4 36 1000 1400 200 L 40 40 1 1 B
X (ADC5)PA5 35 1000 1500 200 L 40 40 1 1 B
X (ADC6)PA6 34 1000 1600 200 L 40 40 1 1 B
X (ADC7)PA7 33 1000 1700 200 L 40 40 1 1 B
X AREF 32 -1000 500 200 R 40 40 1 1 W
X XTAL1 13 -1000 900 200 R 40 40 1 1 B
X XTAL2 12 -1000 1300 200 R 40 40 1 1 B
X RESET 9 -1000 1700 200 R 40 40 1 1 I I
X GND 11 -100 -2000 200 U 40 40 1 1 W
X AGND 31 0 -2000 200 U 40 40 1 1 W
ENDDRAW
ENDDEF
#
# PINHD-2X5M
#
DEF PINHD-2X5M JP 0 40 Y Y 1 L N
F0 "JP" -250 325 50 H V L B
F1 "PINHD-2X5M" -250 -400 50 H V L B
F2 "pinhead-2X05M" 0 150 50 H I C C
DRAW
P 2 1 0 0 -250 300 -250 -300 N
P 2 1 0 0 350 300 -250 300 N
P 2 1 0 0 350 -300 350 300 N
P 2 1 0 0 -250 -300 350 -300 N
X 10 10 200 -200 100 L 40 40 1 1 P I
X 8 8 200 -100 100 L 40 40 1 1 P I
X 6 6 200 0 100 L 40 40 1 1 P I
X 4 4 200 100 100 L 40 40 1 1 P I
X 2 2 200 200 100 L 40 40 1 1 P I
X 9 9 -100 -200 100 R 40 40 1 1 P I
X 7 7 -100 -100 100 R 40 40 1 1 P I
X 5 5 -100 0 100 R 40 40 1 1 P I
X 3 3 -100 100 100 R 40 40 1 1 P I
X 1 1 -100 200 100 R 40 40 1 1 P I
ENDDRAW
ENDDEF
#
# R
#
DEF R R 0 0 N Y 1 F N
F0 "R" 80 0 50 V V C C
F1 "R" 0 0 50 V V C C
$FPLIST
R?
SM0603
SM0805
$ENDFPLIST
DRAW
S -40 150 40 -150 0 1 8 N
X ~ 1 0 250 100 D 60 60 1 1 P
X ~ 2 0 -250 100 U 60 60 1 1 P
ENDDRAW
ENDDEF
#
# USB_CONN
#
DEF USB_CONN J 0 0 Y Y 1 F N
F0 "J" -50 400 60 H V C C
F1 "USB_CONN" -250 150 60 V V C C
ALIAS USB
DRAW
P 3 0 1 0 100 -50 200 -200 200 -200 N
S 50 100 50 200 0 1 0 N
P 4 0 1 0 -100 -450 -50 -400 -50 -50 -50 -50 N
P 4 0 1 0 0 -50 0 -400 50 -450 50 -450 N
P 9 0 1 0 -150 0 100 0 100 250 50 300 -100 300 -150 250 -150 0 -150 0 -150 0 N
S -100 200 -100 100 0 1 0 N
P 4 0 1 0 50 -50 50 -250 200 -350 200 -350 N
S -100 200 -100 200 0 1 0 N
P 3 0 1 0 -150 -50 -250 -200 -250 -200 N
S 50 100 -100 100 0 1 0 N
P 6 0 1 0 -200 -50 150 -50 150 350 -200 350 -200 -50 -200 -50 N
S -100 200 50 200 0 1 0 N
P 4 0 1 0 -100 -50 -100 -250 -250 -350 -250 -350 N
X Shield_1 5 350 -450 300 L 40 30 1 1 P
X D- 2 350 -350 150 L 40 30 1 1 B
X D+ 3 350 -200 150 L 40 30 1 1 B
X Shield_2 6 -400 -450 300 R 40 30 1 1 P
X GND 4 -400 -350 150 R 40 30 1 1 w
X Vbus 1 -400 -200 150 R 40 30 1 1 w
ENDDRAW
ENDDEF
#
# VCC
#
DEF VCC #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 100 30 H I C C
F1 "VCC" 0 100 30 H V C C
DRAW
C 0 50 20 0 1 4 N
P 3 0 1 4 0 0 0 30 0 30 N
X VCC 1 0 0 0 U 20 20 0 0 W N
ENDDRAW
ENDDEF
#
# ZENER
#
DEF ZENER D 0 40 N N 1 F N
F0 "D" 0 100 50 H V C C
F1 "ZENER" 0 -100 40 H V C C
$FPLIST
D?
SO*
SM*
$ENDFPLIST
DRAW
P 5 0 1 0 50 0 -50 50 -50 -50 50 0 50 0 F
P 5 0 1 8 70 50 50 30 50 -30 30 -50 30 -50 N
X K 2 200 0 150 L 40 40 1 1 P
X A 1 -200 0 150 R 40 40 1 1 P
ENDDRAW
ENDDEF
#
#EndLibrary

View File

@ -1,149 +0,0 @@
update=21/10/2008-17:20:59
last_client=eeschema
[common]
NetDir=
[cvpcb]
version=1
NetITyp=0
NetIExt=.net
PkgIExt=.pkg
NetType=0
[cvpcb/libraries]
EquName1=devcms
[pcbnew]
version=1
PadDrlX=320
PadDimH=600
PadDimV=600
PadForm=1
PadMask=14745599
ViaDiam=450
ViaDril=250
MViaDia=200
MViaDrl=80
Isol=60
Countlayer=2
Lpiste=170
RouteTo=15
RouteBo=0
TypeVia=3
Segm45=1
Racc45=1
Unite=0
SegFill=1
SegAffG=0
NewAffG=1
PadFill=1
PadAffG=1
PadSNum=1
ModAffC=0
ModAffT=0
PcbAffT=0
SgPcb45=1
TxtPcbV=800
TxtPcbH=600
TxtModV=600
TxtModH=600
TxtModW=120
HPGLnum=1
HPGdiam=15
HPGLSpd=20
HPGLrec=2
HPGLorg=0
GERBmin=15
VEgarde=100
DrawLar=150
EdgeLar=150
TxtLar=120
MSegLar=150
ForPlot=1
WpenSer=10
UserGrX=1
UserGrY=1
UserGrU=1
DivGrPc=1
TimeOut=600
MaxLnkS=3
ShowRat=0
ShowMRa=1
[pcbnew/libraries]
LibDir=
LibName1=supports
LibName2=pl_empreinte
LibName3=pinhead
LibName4=atmel
LibName5=connect
LibName6=discret
LibName7=pin_array
LibName8=divers
LibName9=libcms
LibName10=display
LibName11=valves
[general]
version=1
RootSch=
BoardNm=
[eeschema]
version=1
LibDir=
NetFmt=1
HPGLSpd=20
HPGLDm=15
HPGLNum=1
offX_A4=0
offY_A4=0
offX_A3=0
offY_A3=0
offX_A2=0
offY_A2=0
offX_A1=0
offY_A1=0
offX_A0=0
offY_A0=0
offX_A=0
offY_A=0
offX_B=0
offY_B=0
offX_C=0
offY_C=0
offX_D=0
offY_D=0
offX_E=0
offY_E=0
RptD_X=0
RptD_Y=100
RptLab=1
SimCmd=
UseNetN=0
LabSize=60
[eeschema/libraries]
LibName1=power
LibName2=dips-s
LibName3=40xx
LibName4=1wire
LibName5=pinhead
LibName6=device
LibName7=conn
LibName8=linear
LibName9=regul
LibName10=74xx
LibName11=cmos4000
LibName12=adc-dac
LibName13=memory
LibName14=xilinx
LibName15=special
LibName16=microcontrollers
LibName17=dsp
LibName18=analog_switches
LibName19=motorola
LibName20=texas
LibName21=intel
LibName22=audio
LibName23=interface
LibName24=digital-audio
LibName25=philips
LibName26=display
LibName27=cypress
LibName28=siliconi
LibName29=contrib
LibName30=valves

File diff suppressed because it is too large Load Diff

View File

@ -5,19 +5,13 @@
# Tabsize: 4
# Copyright: (c) 2006 by OBJECTIVE DEVELOPMENT Software GmbH
# License: GNU GPL v2 (see License.txt) or proprietary (CommercialLicense.txt)
# This Revision: $Id$
# This Revision: $Id: Makefile,v 1.1 2008/07/09 20:47:12 rschaten Exp $
AVRDUDE = avrdude -p atmega32 -c usbasp
# Options:
#HWOBJECTS = modelibmmodelm.o
#HWOBJECTS = modelmayhem.o
#HWOBJECTS = modelsuntype5.o
HWOBJECTS = modelibmhost.o
COMPILE = avr-gcc -Wall -Os -Iusbdrv -I. -mmcu=atmega32 #-DDEBUG_LEVEL=1
COMPILE = avr-gcc -Wall -Os -Iusbdrv -I. -mmcu=atmega32 -DF_CPU=12000000L $(DEFINES)
OBJECTS = usbdrv/usbdrv.o usbdrv/usbdrvasm.o usbdrv/oddebug.o main.o commandhandler.o $(HWOBJECTS)
OBJECTS = usbdrv/usbdrv.o usbdrv/usbdrvasm.o usbdrv/oddebug.o main.o
# symbolic targets:
@ -42,7 +36,7 @@ program: all
fuses:
# - enable crystal
# - disable JTAG, so we can fully use PORTC
$(AVRDUDE) -U lfuse:w:0xCF:m -U hfuse:w:0xD8:m
$(AVRDUDE) -U lfuse:w:0xCF:m -U hfuse:w:0xD9:m
clean:
rm -f main.hex main.lst main.obj main.cof main.list main.map main.eep.hex main.bin *.o usbdrv/*.o main.s usbdrv/oddebug.s usbdrv/usbdrv.s

2
firmware/checksize Executable file → Normal file
View File

@ -5,7 +5,7 @@
# Creation Date: 2004-12-29
# Tabsize: 4
# Copyright: (c) 2005 OBJECTIVE DEVELOPMENT Software GmbH.
# Revision: $Id$
# Revision: $Id: checksize,v 1.1 2008/07/09 20:47:12 rschaten Exp $
error=0
codelimit=32768

View File

@ -1,187 +0,0 @@
/**
* \file commandhandler.c
* \brief TODO
* \author Ronald Schaten <ronald@schatenseite.de>
* \version $Id$
*
* License: TODO
*/
#include "commandhandler.h"
#include "keycodes.h"
#include "tools.h"
#include "modelinterface.h"
// TODO comment
typedef enum {
standard,
commandmode,
macrocommand,
macrodefinition,
macrodelete,
complexcommand
} Commandstate;
static Commandstate commandstate = standard;
#define MACROCOUNT 10
#define MACROLENGTH 20
// macrodefinitions[][0] is the macro-key
Key macrodefinitions[MACROCOUNT][MACROLENGTH + 1];
uint8_t macrocountindex = 0;
uint8_t macrodefinitionindex = 0;
uint8_t getMacroindex(Key macrokey) {
for (uint8_t i = 0; i < MACROCOUNT; i++) {
if ((macrodefinitions[i][0].mode == macrokey.mode) && (macrodefinitions[i][0].key == macrokey.key)) {
return i;
}
}
return MACROCOUNT;
}
void deleteMacroindex(Key macrokey) {
for (uint8_t i = 0; i < MACROCOUNT; i++) {
if ((macrodefinitions[i][0].mode == macrokey.mode) && (macrodefinitions[i][0].key == macrokey.key)) {
macrodefinitions[i][0].mode = MOD_NONE;
macrodefinitions[i][0].key = KEY_Reserved;
break;
}
}
}
void sendMacro(uint8_t index) {
for (uint8_t i = 0; i < MACROLENGTH; i++) {
if(macrodefinitions[index][i+1].key != KEY_Reserved) {
sendKey(macrodefinitions[index][i+1]);
} else {
break;
}
}
}
uint8_t checkmacrodefinition(uint8_t* reportbuffer) {
if ((reportbuffer[2] != KEY_Reserved) && (reportbuffer[3] == KEY_Reserved)) {
Key macrokey;
macrokey.mode = reportbuffer[0];
macrokey.key = reportbuffer[2];
return getMacroindex(macrokey);
}
return MACROCOUNT;
}
uint8_t setMacroindex(Key macrokey) {
for (uint8_t i = 0; i < MACROCOUNT; i++) {
if ((macrodefinitions[i][0].mode == macrokey.mode) && (macrodefinitions[i][0].key == macrokey.key)) {
macrodefinitions[i][0].mode = MOD_NONE;
macrodefinitions[i][0].key = KEY_Reserved;
break;
}
}
for (uint8_t i = 0; i < MACROCOUNT; i++) {
if ((macrodefinitions[i][0].mode == MOD_NONE) && (macrodefinitions[i][0].key == KEY_Reserved)) {
macrodefinitions[i][0].mode = macrokey.mode;
macrodefinitions[i][0].key = macrokey.key;
return i;
}
}
return MACROCOUNT;
}
uint8_t iskey(uint8_t* reportbuffer, uint8_t modifier, uint8_t key) {
if ((reportbuffer[0] == modifier) && (reportbuffer[2] == key) && (reportbuffer[3] == KEY_Reserved)) {
return 1;
} else {
return 0;
}
}
uint8_t ishotkey(uint8_t* reportbuffer) {
return iskey(reportbuffer, (MOD_SHIFT_LEFT | MOD_SHIFT_RIGHT), KEY_D);
}
void keypressed(uint8_t* reportbuffer, uint8_t size, uint16_t tickcounter) {
switch (commandstate) {
case commandmode:
if (iskey(reportbuffer, (MOD_SHIFT_LEFT | MOD_SHIFT_RIGHT), KEY_Reserved) ||
iskey(reportbuffer, MOD_SHIFT_LEFT, KEY_Reserved) ||
iskey(reportbuffer, MOD_SHIFT_RIGHT, KEY_Reserved) ||
iskey(reportbuffer, MOD_NONE, KEY_Reserved)) {
// ignore pressed shift-keys, probably still pressed from hot
// key usage
} else if (iskey(reportbuffer, MOD_NONE, KEY_T)) {
// toggle function
toggle();
commandstate = standard;
} else if (iskey(reportbuffer, MOD_NONE, KEY_M)) {
// record macro
commandstate = macrocommand;
} else if (iskey(reportbuffer, MOD_SHIFT_LEFT, KEY_M) || iskey(reportbuffer, MOD_SHIFT_RIGHT, KEY_M)) {
// delete macro
commandstate = macrodelete;
} else {
// command not recognized, return to standard mode
commandstate = standard;
}
break;
case macrocommand:
if (reportbuffer[2] == KEY_Reserved) {
// just modifier pressed => ignore
} else {
Key macrokey;
macrokey.mode = reportbuffer[0];
macrokey.key = reportbuffer[2];
macrocountindex = setMacroindex(macrokey);
if (macrocountindex == MACROCOUNT) {
// no space left
commandstate = standard;
} else {
commandstate = macrodefinition;
macrodefinitionindex = 0;
}
}
break;
case macrodefinition:
if (ishotkey(reportbuffer)) {
// macro definition complete
macrodefinitions[macrocountindex][macrodefinitionindex + 1].mode = MOD_NONE;
macrodefinitions[macrocountindex][macrodefinitionindex + 1].key = KEY_Reserved;
commandstate = standard;
} else if (reportbuffer[2] == KEY_Reserved) {
// just modifier pressed => ignore
} else {
macrodefinitions[macrocountindex][macrodefinitionindex + 1].mode = reportbuffer[0];
macrodefinitions[macrocountindex][macrodefinitionindex + 1].key = reportbuffer[2];
macrodefinitionindex++;
if (macrodefinitionindex == MACROLENGTH) {
// no space left in this macro
commandstate = standard;
}
}
break;
case macrodelete:
if (reportbuffer[2] == KEY_Reserved) {
// just modifier pressed => ignore
} else {
Key macrokey;
macrokey.mode = reportbuffer[0];
macrokey.key = reportbuffer[2];
deleteMacroindex(macrokey);
commandstate = standard;
}
break;
case complexcommand:
break;
default:
if (ishotkey(reportbuffer)) {
commandstate = commandmode;
} else if ((macrocountindex = checkmacrodefinition(reportbuffer)) != MACROCOUNT) {
sendMacro(macrocountindex);
} else {
usbSendReportBuffer(reportbuffer, size);
}
}
}

View File

@ -1,12 +0,0 @@
/**
* \file commandhandler.h
* \brief TODO
* \author Ronald Schaten <ronald@schatenseite.de>
* \version $Id$
*
* License: TODO
*/
#include <stdint.h>
void keypressed(uint8_t* reportbuffer, uint8_t size, uint16_t tickcounter);

View File

@ -6,7 +6,7 @@
* See usb.org's HID-usage-tables document, chapter 10 Keyboard/Keypad Page for
* more codes: http://www.usb.org/developers/devclass_docs/Hut1_12.pdf
* \author Ronald Schaten <ronald@schatenseite.de>
* \version $Id$
* \version $Id: keycodes.h,v 1.1 2008/07/09 20:47:12 rschaten Exp $
*
* License: GNU GPL v2 (see License.txt)
*/
@ -130,127 +130,7 @@ enum keycodes {
KEY_KP0, // Insert
KEY_KPcomma, // Delete
KEY_Euro, // non-US \ and |
KEY_Application, // windows menu or unix compose
KEY_Power,
KEY_KPequals, // =
KEY_F13,
KEY_F14,
KEY_F15,
KEY_F16,
KEY_F17,
KEY_F18,
KEY_F19,
KEY_F20,
KEY_F21,
KEY_F22,
KEY_F23,
KEY_F24,
KEY_Execute,
KEY_Help,
KEY_Menu,
KEY_Select,
KEY_Stop,
KEY_Again,
KEY_Undo,
KEY_Cut,
KEY_Copy,
KEY_Paste,
KEY_Find,
KEY_Mute,
KEY_Volume_Up,
KEY_Volume_Down,
KEY_Locking_Caps_Lock,
KEY_Locking_Num_Lock,
KEY_Locking_Scroll_Lock,
KEY_KPComma,
KEY_KPEqual_Sign,
KEY_International1,
KEY_International2,
KEY_International3,
KEY_International4,
KEY_International5,
KEY_International6,
KEY_International7,
KEY_International8,
KEY_International9,
KEY_LANG1,
KEY_LANG2,
KEY_LANG3,
KEY_LANG4,
KEY_LANG5,
KEY_LANG6,
KEY_LANG7,
KEY_LANG8,
KEY_LANG9,
KEY_Alternate_Erase,
KEY_SysReq_Attention,
KEY_Cancel,
KEY_Clear,
KEY_Prior,
KEY_Return2,
KEY_Separator,
KEY_Out,
KEY_Oper,
KEY_Clear_Again,
KEY_CrSel_Props,
KEY_ExSel,
Reserved165,
Reserved166,
Reserved167,
Reserved168,
Reserved169,
Reserved170,
Reserved171,
Reserved172,
Reserved173,
Reserved174,
Reserved175,
KEY_KP00,
KEY_KP000,
Thousands_Separator,
Decimal_Separator,
Currency_Unit,
Currency_Subunit,
KEY_KPleftParentheses,
KEY_KPrightParentheses,
KEY_KPleftBraces,
KEY_KPrightBraces,
KEY_KPTab,
KEY_KPBackspace,
KEY_KPA,
KEY_KPB,
KEY_KPC,
KEY_KPD,
KEY_KPE,
KEY_KPF,
KEY_KPXOR,
KEY_KPcircumflex, // ^
KEY_KPpercent, // %
KEY_KPlesser, // <
KEY_KPgreater, // >
KEY_KPand, // &
KEY_KPandand, // &&
KEY_KPor, // |
KEY_KPoror, // ||
KEY_KPcolon, // :
KEY_KPhash, // #
KEY_KPSpace,
KEY_KPat, // @
KEY_KPbang, // !
KEY_KPMemory_Store,
KEY_KPMemory_Recall,
KEY_KPMemory_Clear,
KEY_KPMemory_Add,
KEY_KPMemory_Subtract,
KEY_KPMemory_Multiply,
KEY_KPMemory_Divide,
KEY_KPplusminus, // +/-
KEY_KPClear,
KEY_KPClear_Entry,
KEY_KPBinary,
KEY_KPOctal,
KEY_KPDecimal,
KEY_KPHexadecimal
KEY_Application,
};
#endif /* __keycodes_h_included__ */

View File

@ -2,7 +2,7 @@
* \file firmware/main.c
* \brief Main functions for USB-keyboard
* \author Ronald Schaten <ronald@schatenseite.de>
* \version $Id$
* \version $Id: main.c,v 1.5 2008/07/12 21:05:24 rschaten Exp $
*
* License: GNU GPL v2 (see License.txt)
*/
@ -50,33 +50,19 @@
* update the keyboard's firmware without disassembling it, and without the
* need for a dedicated programmer.
*
* \subsection sec_models Models
*
* Till now, I modified the following keyboard models:
* - IBM Model M: The initial project, hardware as described above. This
* keyboard has a 8x16-matrix, all the lines can be connected directly to
* the controller.
* - Sun Type 5: Another classic. A nice model with many keys. Some of them
* are placed a bit uncommon, but if you think about it the layout is great.
* This model was never intended to work with a PC, it has some kind of
* proprietary connector. The contained matrix has 13 columns and 22 rows,
* which is too big for a naked Mega32. So I had to make a circuit with some
* shift registers.
* - IBM Host Keyboard: Like the Model M, but with 24 function keys on the top
* and 10 additional keys on the left. Many keys are labeled quite strange,
* but I guess that's common in the host world.
*
* Included in the package are circuits for both models, and a firmware that
* can be compiled separately for each one.
*
* \subsection sec_hardware Other hardware?
*
* As mentioned, the controller in this project is just connected to an
* ordinary keyboard matrix. You can find this kind of matrix in all kinds of
* keyboards, from key-telephones over good old hardware like the Commodore
* C=64 or the Schneider CPC, keyboards with non-PC-connectors like -- as
* mentioned -- those made by Sun, to modern hardware that could need a few
* more features.
* C=64 or the Schneider CPC, keyboards with non-PC-connectors like those made
* by Sun, to modern hardware that could need a few more features.
*
* Till now, I just made a PCB layout for the IBM Model M, but I intend to
* modify at least a Sun keyboard. In order to do that, I expect having to
* refactor the key-scanning, since the key-matrix is not 16x8. The positions
* of the keys on the matrix will be different, I'll have to re-engineer that.
* And of course, I'll have to make another PCB.
*
* \subsection sec_features Features
*
@ -105,10 +91,9 @@
* \section sec_install Building and installing
*
* Both, the bootloader and firmware are simply built with "make". You may need
* to customize both makefiles to fit to your system and to the keyboard model
* you want to run the firmware on. If you don't want to add new features, you
* don't need to build the software yourself. You can use the hex-files
* included in this package.
* to customize both makefiles to fit to your system. If you don't want to add
* new features, you don't need to build the software yourself. You can use the
* hex-files included in this package.
*
* \subsection sec_boot Bootloader
*
@ -138,10 +123,10 @@
* Afterwards you can put the programmer back into the toolbox, you won't need
* it from here on.
*
* When you plug in the device while holding the D-key (D is for Dulcimer)
* When you plug in the device while holding the minus-key on the number-keypad
* pressed, the keyboard indicates that it would like to get a new firmware by
* fading all LEDs on and off. That firmware will be flashed over the normal
* USB-cable that the keyboard is connected with.
* showing a running light on the LEDs. That firmware will be flashed over the
* normal USB-cable that the keyboard is connected with.
*
* \subsection sec_fw Firmware
*
@ -174,7 +159,11 @@
*
* \section sec_drawbacks Drawbacks
*
* Let me know if you find any. :-)
* I don't know if and how keyboard manufacturers face the problem of ghost
* keys, I didn't take special measurements for this. I hope that the engineers
* at IBM distributed the keys on the matrix in a way that minimizes this
* problem. Don't misunderstand: I haven't experienced that on this keyboard,
* but I know that it's a common problem on key-matrixes.
*
* \section sec_files Files in the distribution
*
@ -186,11 +175,9 @@
* only modified the bootloaderconfig.h and the Makefile.
* - \e USBaspLoader.2008-02-05.tar.gz: The unmodified bootloader sources, for
* reference.
* - \e circuit_ibm_model_m: Circuit diagrams for the IBM Model M, in PDF and
* KiCAD format. KiCAD is a free schematic- and layout-tool, you can learn
* more about it at its homepage:
* - \e circuit: Circuit diagrams in PDF and KiCAD format. KiCAD is a free
* schematic- and layout-tool, you can learn more about it at its homepage:
* http://www.lis.inpg.fr/realise_au_lis/kicad/
* - \e circuit_sun_type_5: Circuit diagrams for the Sun Type 5 keyboard.
* - \e License.txt: Public license for all contents of this project, except
* for the USB driver. Look in firmware/usbdrv/License.txt for further info.
* - \e Changelog.txt: Logfile documenting changes in soft-, firm- and
@ -203,18 +190,9 @@
* their driver for my project. In fact, this project wouldn't exist without
* the driver.
*
* I took great inspiration from <b>Spaceman Spiff</b>'s c64key, this software
* is based on his ideas.
*
* Further credits go to <b>xleave</b>, who etched the PCB for me, and also
* answered many stupid questions about electronics I had during the last few
* years.
*
* Once again, <b>Thomas Stegemann</b> supported this project. Ghost key
* prevention and the possibility to work on different models are his work.
*
* And of course I'd like to thank <b>FaUl</b> of the Chaostreff Dortmund who
* gave me the idea for this project.
* And of course I'd like to thank that friend of mine -- I doubt that he'd
* like to read his name in this place, I'll put it in if he wants me to --
* that gave me the idea for this project.
*
* \section sec_license About the license
*
@ -226,6 +204,8 @@
* <b>(c) 2008 by Ronald Schaten - http://www.schatenseite.de</b>
*/
#define F_CPU 12000000L ///< we use a 12MHz crystal
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
@ -236,20 +216,84 @@
#include "usbdrv.h"
#include "keycodes.h"
#include "tools.h"
#include "modelinterface.h"
#include "commandhandler.h"
/* ----------------------- hardware I/O abstraction ------------------------ */
#define PORTCOLUMNS PORTB ///< port on which we read the state of the columns
#define PINCOLUMNS PINB ///< port on which we read the state of the columns
#define DDRCOLUMNS DDRB ///< port on which we read the state of the columns
#define PORTROWS1 PORTA ///< first port connected to the matrix rows
#define PINROWS1 PINA ///< first port connected to the matrix rows
#define DDRROWS1 DDRA ///< first port connected to the matrix rows
#define PORTROWS2 PORTC ///< second port connected to the matrix rows
#define PINROWS2 PINC ///< second port connected to the matrix rows
#define DDRROWS2 DDRC ///< second port connected to the matrix rows
#define PORTLEDS PORTD ///< port on which the LEDs are connected
#define PINLEDS PIND ///< port on which the LEDs are connected
#define DDRLEDS DDRD ///< port on which the LEDs are connected
#define LEDSCROLL PIND4 ///< address of the scroll-lock LED
#define LEDCAPS PIND5 ///< address of the caps-lock LED
#define LEDNUM PIND6 ///< address of the num-lock LED
#define PORTJUMPERS PORTD ///< port for additional jumpers
#define PINJUMPERS PIND ///< port for additional jumpers
#define DDRJUMPERS DDRD ///< port for additional jumpers
#define JUMPER0 PD1 ///< address for jumper 0
#define JUMPER1 PD3 ///< address for jumper 1
#define JUMPER2 PD7 ///< address for jumper 2
/**
* Initialize hardware. Configure ports as inputs and outputs, set USB reset
* condition, start timer and blink LEDs.
*/
static void hardwareInit(void) {
// column-port is input
PORTCOLUMNS = 0xff;
DDRCOLUMNS = 0x00;
// row-ports are output
PORTROWS1 = 0xff;
DDRROWS1 = 0x00;
PORTROWS2 = 0xff;
DDRROWS2 = 0x00;
// port D contains USB (D0, D2),
// LEDs (D4, D5, D6)
// and Jumpers (D1, D3, D7),
// so we call it PORTD instead of PORTJUMPERS or PORTLEDS
PORTD = 0xfa; // 1000 1010: activate pull-ups except on USB- and LED-lines
DDRD = 0x75; // 0111 0101: all pins input except USB (-> USB reset) and LED-pins
// USB Reset by device only required on Watchdog Reset
_delay_us(11); // delay >10ms for USB reset
DDRD = 0x70; // 0111 0000 bin: remove USB reset condition
// configure timer 0 for a rate of 12M/(1024 * 256) = 45.78Hz (~22ms)
TCCR0 = 5; // timer 0 prescaler: 1024
// blink, to indicate power-on
PORTLEDS &= ~((1 << LEDNUM) | (1 << LEDCAPS) | (1 << LEDSCROLL));
_delay_ms(50);
PORTLEDS |= ((1 << LEDNUM) | (1 << LEDCAPS) | (1 << LEDSCROLL));
}
/* ------------------------------------------------------------------------- */
/* ----------------------------- USB interface ----------------------------- */
/* ------------------------------------------------------------------------- */
static uint8_t reportBuffer[8]; ///< buffer for HID reports
static uint8_t oldReportBuffer[8]; ///< buffer for the last sent HID report
static uint8_t idleRate; ///< in 4ms units
static uint8_t protocolVer = 1; ///< 0 = boot protocol, 1 = report protocol
uint8_t expectReport = 0; ///< flag to indicate if we expect an USB-report
#define LED_NUM 0x01 ///< num LED on a boot-protocol keyboard
#define LED_CAPS 0x02 ///< caps LED on a boot-protocol keyboard
#define LED_SCROLL 0x04 ///< scroll LED on a boot-protocol keyboard
#define LED_COMPOSE 0x08 ///< compose LED on a boot-protocol keyboard
#define LED_KANA 0x10 ///< kana LED on a boot-protocol keyboard
uint8_t LEDstate = 0; ///< current state of the LEDs
/** USB report descriptor (length is defined in usbconfig.h). The report
* descriptor has been created with usb.org's "HID Descriptor Tool" which can
* be downloaded from http://www.usb.org/developers/hidpage/ (it's an .exe, but
@ -282,10 +326,10 @@ char PROGMEM usbHidReportDescriptor[USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH] = {
0x95, 0x06, // REPORT_COUNT (6)
0x75, 0x08, // REPORT_SIZE (8)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x25, 0xff, // LOGICAL_MAXIMUM (255)
0x25, 0x65, // LOGICAL_MAXIMUM (101)
0x05, 0x07, // USAGE_PAGE (Keyboard)
0x19, 0x00, // USAGE_MINIMUM (Reserved (no event indicated))
0x29, 0xff, // USAGE_MAXIMUM (255)
0x29, 0x65, // USAGE_MAXIMUM (Keyboard Application)
0x81, 0x00, // INPUT (Data,Ary,Abs)
0xc0 // END_COLLECTION
};
@ -339,23 +383,27 @@ uint8_t usbFunctionSetup(uint8_t data[8]) {
*/
uint8_t usbFunctionWrite(uchar *data, uchar len) {
if (expectReport && (len == 1)) {
setLeds(data[0]);
LEDstate = data[0]; // Get the state of all 5 LEDs
if (LEDstate & LED_NUM) { // light up caps lock
PORTLEDS &= ~(1 << LEDNUM);
} else {
PORTLEDS |= (1 << LEDNUM);
}
if (LEDstate & LED_CAPS) { // light up caps lock
PORTLEDS &= ~(1 << LEDCAPS);
} else {
PORTLEDS |= (1 << LEDCAPS);
}
if (LEDstate & LED_SCROLL) { // light up caps lock
PORTLEDS &= ~(1 << LEDSCROLL);
} else {
PORTLEDS |= (1 << LEDSCROLL);
}
}
expectReport = 0;
return 0x01;
}
/**
* Send a report buffer to the computer.
* \param reportbuffer report buffer
*/
void usbSendReportBuffer(uint8_t* reportbuffer, uint8_t size) {
while (!usbInterruptIsReady()) {
usbPoll();
}
usbSetInterrupt(reportbuffer, size); // send
}
/**
* Send a single report to the computer. This function is not used during
* normal typing, it is only used to send non-pressed keys to simulate input.
@ -367,16 +415,79 @@ void usbSendReport(uint8_t mode, uint8_t key) {
uint8_t repBuffer[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
repBuffer[0] = mode;
repBuffer[2] = key;
wdt_reset();
usbSendReportBuffer(repBuffer, sizeof(repBuffer));
while (!usbInterruptIsReady()); // wait
usbSetInterrupt(repBuffer, sizeof(repBuffer)); // send
}
/* ------------------------------------------------------------------------- */
uint8_t curmatrix[16]; ///< contains current state of the keyboard
/**
* The keymatrix-array contains positions of keys in the matrix. Here you can
* see which row is connected to which column when a key is pressed. This array
* probably has to be modified if this firmware is ported to a different
* keyboard.
* \sa modmatrix
*/
const uint8_t PROGMEM keymatrix[16][8] = {
// 0 1 2 3 4 5 6 7
{KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved }, // 0
{KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved }, // 1
{KEY_ESCAPE, KEY_Tab, KEY_grave, KEY_1, KEY_Q, KEY_A, KEY_Z, KEY_Reserved }, // 2
{KEY_Euro, KEY_capslock, KEY_F1, KEY_2, KEY_W, KEY_S, KEY_X, KEY_Reserved }, // 3
{KEY_F4, KEY_F3, KEY_F2, KEY_3, KEY_E, KEY_D, KEY_C, KEY_Reserved }, // 4
{KEY_G, KEY_T, KEY_5, KEY_4, KEY_R, KEY_F, KEY_V, KEY_B }, // 5
{KEY_F5, KEY_DELETE, KEY_F9, KEY_F10, KEY_Reserved, KEY_Reserved, KEY_Return, KEY_Spacebar }, // 6
{KEY_H, KEY_Y, KEY_6, KEY_7, KEY_U, KEY_J, KEY_M, KEY_N }, // 7
{KEY_F6, KEY_rbracket, KEY_equals, KEY_8, KEY_I, KEY_K, KEY_comma, KEY_Reserved }, // 8
{KEY_Reserved, KEY_F7, KEY_F8, KEY_9, KEY_O, KEY_L, KEY_dot, KEY_Reserved }, // 9
{KEY_apostroph, KEY_lbracket, KEY_minus, KEY_0, KEY_P, KEY_semicolon, KEY_hash, KEY_slash }, // 10
{KEY_Reserved, KEY_KP4, KEY_DeleteForward, KEY_F11, KEY_KP7, KEY_KP1, KEY_NumLock, KEY_DownArrow }, // 11
{KEY_KP0, KEY_KP5, KEY_Insert, KEY_F12, KEY_KP8, KEY_KP2, KEY_KPslash, KEY_RightArrow }, // 12
{KEY_KPcomma, KEY_KP6, KEY_PageUp, KEY_PageDown, KEY_KP9, KEY_KP3, KEY_KPasterisk, KEY_KPminus }, // 13
{KEY_UpArrow, KEY_Reserved, KEY_Home, KEY_End, KEY_KPplus, KEY_KPenter, KEY_Pause, KEY_LeftArrow }, // 14
{KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_PrintScreen, KEY_ScrollLock, KEY_Reserved, KEY_Reserved, KEY_Reserved }, // 15
};
/**
* The modmatrix-array contains positions of the modifier-keys in the matrix.
* It is built in the same way as the keymatrix-array.
* \sa keymatrix
*/
const uint8_t PROGMEM modmatrix[16][8] = { // contains positions of modifiers in the matrix
// 0 1 2 3 4 5 6 7
{MOD_NONE, MOD_NONE, MOD_CONTROL_LEFT, MOD_NONE, MOD_NONE, MOD_NONE, MOD_CONTROL_RIGHT, MOD_NONE }, // 0
{MOD_NONE, MOD_SHIFT_LEFT, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_SHIFT_RIGHT, MOD_NONE }, // 1
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 2
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 3
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 4
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 5
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 6
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 7
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 8
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 9
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 10
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 11
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 12
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 13
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 14
{MOD_ALT_LEFT, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_ALT_RIGHT}, // 15
};
/**
* This structure can be used as a container for a single 'key'. It consists of
* the key-code and the modifier-code.
*/
typedef struct {
uint8_t mode;
uint8_t key;
} Key;
/**
* Convert an ASCII-character to the corresponding key-code and modifier-code
* combination.
* \param character ASCII-character to convert
* \parm character ASCII-character to convert
* \return structure containing the combination
*/
Key charToKey(char character) {
@ -493,8 +604,6 @@ Key charToKey(char character) {
case '?':
key.mode = MOD_SHIFT_LEFT;
key.key = KEY_slash; break;
case '\n':
key.key = KEY_Return; break;
}
if (key.key == KEY_Reserved) {
// still reserved? WTF? return question mark...
@ -527,47 +636,117 @@ void sendString(char* string) {
}
/**
* Calculate an average value for the speed the keys are pressed in. The speed
* value is sent to the keyboard interface, the keyboard decides what to do
* with it.
* \param updates number of updates since the last call (should be in the range
* 0-1)
* Print the current state of the keyboard in a readable form. This function
* is used for debug-purposes only.
*/
void calculateSpeed(uint8_t updates) {
static uint8_t callcounter = 0;
static uint8_t speed = 0;
callcounter++;
if (updates > 0) {
// a key has been pressed
if (speed < 251) {
// it can get hotter...
if (callcounter < 8) {
speed += 4;
} else {
speed += 2;
}
setSpeed(speed);
} else if (speed < 255) {
speed = 255;
setSpeed(speed);
}
callcounter = 0;
} else {
// no key pressed...
if (callcounter == 16) {
// ... for a long time, decrease speed value
if (speed > 8) {
speed -= 8;
setSpeed(speed);
} else if (speed > 0) {
speed = 0;
setSpeed(speed);
}
callcounter = 0;
void printMatrix(void) {
for (uint8_t i = 0; i <= 15; i++) {
char buffer[10];
/*
sprintf(buffer, "%d%d%d%d%d%d%d%d.",
(curmatrix[i] & (1 << 0) ? 1 : 0),
(curmatrix[i] & (1 << 1) ? 1 : 0),
(curmatrix[i] & (1 << 2) ? 1 : 0),
(curmatrix[i] & (1 << 3) ? 1 : 0),
(curmatrix[i] & (1 << 4) ? 1 : 0),
(curmatrix[i] & (1 << 5) ? 1 : 0),
(curmatrix[i] & (1 << 6) ? 1 : 0),
(curmatrix[i] & (1 << 7) ? 1 : 0));
*/
sprintf(buffer, "%2x", curmatrix[i]);
sendString(buffer);
if (i == 7) {
sendString(":");
} else {
sendString(".");
}
}
sendString("---");
}
/**
* Scan and debounce keypresses. This is the main worker function for normal
* keyboard operation, the code contains lot of comments. Basically, it first
* scans the keyboard state. If a change is detected, it initializes a counter
* that is decreased each time this function is called. If the counter reaches
* 1, that means that the same scan result has been scanned ten times in a row,
* so we can be pretty sure that the keys are in a certain state (as in: not
* bouncing). Then, the codes for keys and modifiers are searched from the two
* arrays, the USB-message to send the state is prepared. The return value of
* this function indicates if the message has to be sent.
* \return flag to indicate whether something has changed
*/
uint8_t scankeys(void) {
static uint8_t debounce = 5;
uint8_t retval = 0;
for (uint8_t row = 0; row <= 15; row++) {
if (row <= 7) {
DDRROWS1 = (1 << row);
PORTROWS1 = ~(1 << row);
DDRROWS2 = 0x00;
PORTROWS2 = 0xff;
} else {
DDRROWS1 = 0x00;
PORTROWS1 = 0xff;
// (15 - row) looks a bit weird, you would expect (row - 8) here.
// This is because pins on PORTC are ordered in the other direction
// than on PORTA. With (15 - row), we have the bytes in the
// resulting matrix matching the pins of the keyboard connector.
DDRROWS2 = (1 << (15 - row));
PORTROWS2 = ~(1 << (15 - row));
}
_delay_us(30);
uint8_t data = ~PINCOLUMNS;
if (data != curmatrix[row]) {
// if a change was detected
debounce = 10; // activate debounce counter
curmatrix[row] = data; // and store the result
}
}
if (debounce) {
// Count down, but avoid underflow
debounce--;
}
if (debounce == 1) {
// debounce counter expired, create report
uint8_t reportIndex = 2; // reportBuffer[0] contains modifiers
memset(reportBuffer, 0, sizeof(reportBuffer)); // clear report buffer
for (uint8_t row = 0; row <= 15; row++) { // process all rows for key-codes
uint8_t data = curmatrix[row]; // restore buffer
if (data != 0xff) { // anything on this row? - optimization
for (uint8_t col = 0; col <= 7; col++) { // check every bit on this row
uint8_t key, modifier;
if (data & (1 << col)) {
key = pgm_read_byte(&keymatrix[row][col]);
modifier = pgm_read_byte(&modmatrix[row][col]);
} else {
key = KEY_Reserved;
modifier = MOD_NONE;
}
if (key != KEY_Reserved) { // keycode should be added to report
if (reportIndex >= sizeof(reportBuffer)) { // too many keycodes
if (!retval & 0x02) { // Only fill buffer once
memset(reportBuffer+2, KEY_ErrorRollOver, sizeof(reportBuffer)-2);
retval |= 0x02; // continue decoding to get modifiers
}
} else {
reportBuffer[reportIndex] = key; // set next available entry
reportIndex++;
}
}
if (modifier != MOD_NONE) { // modifier should be added to report
reportBuffer[0] |= modifier;
}
}
}
}
retval |= 0x01; // must have been a change at some point, since debounce is done
}
return retval;
}
/* ------------------------------------------------------------------------- */
/**
* Main function, containing the main loop that manages timer- and
* USB-functionality.
@ -575,36 +754,23 @@ void calculateSpeed(uint8_t updates) {
*/
int main(void) {
uint8_t updateNeeded = 0;
//uint8_t idleCounter = 0;
uint8_t updates = 0;
uint16_t tickcounter = 0;
uint8_t idleCounter = 0;
wdt_enable(WDTO_2S);
hardwareInit();
usbInit();
sei();
memset(oldReportBuffer, 0, sizeof(oldReportBuffer)); // clear old report buffer
scankeys(reportBuffer, oldReportBuffer, sizeof(reportBuffer));
scankeys();
while (1) {
// main event loop
wdt_reset();
usbPoll();
updateNeeded = scankeys(reportBuffer, oldReportBuffer, sizeof(reportBuffer)); // changes?
if (updateNeeded) {
updates++;
}
updateNeeded = scankeys(); // changes?
// check timer if we need periodic reports
if (TIFR & (1 << TOV0)) {
TIFR = (1 << TOV0); // reset flag
if (tickcounter < UINT16_MAX) {
tickcounter++;
}
calculateSpeed(updates);
updates = 0;
/*
if (idleRate != 0) { // do we need periodic reports?
if(idleCounter > 4){ // yes, but not yet
idleCounter -= 5; // 22ms in units of 4ms
@ -613,14 +779,11 @@ int main(void) {
idleCounter = idleRate;
}
}
*/
}
// if an update is needed, send the report
if (updateNeeded) {
if (updateNeeded && usbInterruptIsReady()) {
updateNeeded = 0;
keypressed(reportBuffer, sizeof(reportBuffer), tickcounter);
tickcounter = 0;
memcpy(oldReportBuffer, reportBuffer, sizeof(oldReportBuffer));
usbSetInterrupt(reportBuffer, sizeof(reportBuffer));
}
}
return 0;

View File

@ -1,313 +0,0 @@
/**
* \file firmware/modelibmmodelm.c
* \brief Hardware specific part for IBM Host keyboard
* \author Ronald Schaten <ronald@schatenseite.de>
* \version $Id: modelibmmodelm.c 173 2009-02-14 21:11:43Z rschaten $
*
* License: GNU GPL v2 (see License.txt)
*/
#include <avr/io.h>
#include <avr/pgmspace.h>
#include <util/delay.h>
#include <string.h>
#include <stdio.h>
#include "keycodes.h"
#include "tools.h"
#include "modelinterface.h"
/* ----------------------- hardware I/O abstraction ------------------------ */
#define PORTCOLUMNS PORTB ///< port on which we read the state of the columns
#define PINCOLUMNS PINB ///< port on which we read the state of the columns
#define DDRCOLUMNS DDRB ///< port on which we read the state of the columns
#define PORTROWS1 PORTA ///< first port connected to the matrix rows
#define PINROWS1 PINA ///< first port connected to the matrix rows
#define DDRROWS1 DDRA ///< first port connected to the matrix rows
#define PORTROWS2 PORTC ///< second port connected to the matrix rows
#define PINROWS2 PINC ///< second port connected to the matrix rows
#define DDRROWS2 DDRC ///< second port connected to the matrix rows
#define PORTROWS3 PORTD ///< third port connected to the matrix rows
#define PINROWS3 PIND ///< third port connected to the matrix rows
#define DDRROWS3 DDRD ///< third port connected to the matrix rows
uint8_t curmatrix[20]; ///< contains current state of the keyboard
uint8_t oldmatrix[20]; ///< contains old state of the keyboard
uint8_t ghostmatrix[20]; ///< contains pressed keys that belong to a ghost-key situation
void hardwareInit(void) {
// column-port is input
PORTCOLUMNS = 0xff;
DDRCOLUMNS = 0x00;
// row-ports are output
PORTROWS1 = 0xff;
DDRROWS1 = 0x00;
PORTROWS2 = 0xff;
DDRROWS2 = 0x00;
PORTROWS3 |= ((1 << PIND4) | (1 << PIND5) | (1 << PIND6) | (1 << PIND7));
DDRROWS3 &= ~((1 << PIND4) | (1 << PIND5) | (1 << PIND6) | (1 << PIND7));
// port D contains USB (D0, D2),
// and keyboard rows (D4, D5, D6, D7).
// so we call it PORTD instead of PORTJUMPERS or PORTLEDS
PORTD &= ~((1 << PIND0) | (1 << PIND2)); // deactivate pull-ups on USB-lines
DDRD |= ((1 << PIND0) | (1 << PIND2)); // set reset USB condition.
// USB reset by device only required on watchdog reset
_delay_us(11); // delay >10us for USB reset
DDRD &= ~((1 << PIND0) | (1 << PIND2)); // remove USB reset condition
// configure timer 0 for a rate of 12M/(1024 * 256) = 45.78Hz (~22ms)
TCCR0 = 5; // timer 0 prescaler: 1024
}
/**
* Print the current state of the keyboard in a readable form. This function
* is used for debug-purposes only.
*/
void printMatrix(void) {
for (uint8_t i = 0; i <= 19; i++) {
char buffer[10];
/*
sprintf(buffer, "%d%d%d%d%d%d%d%d.",
(curmatrix[i] & (1 << 0) ? 1 : 0),
(curmatrix[i] & (1 << 1) ? 1 : 0),
(curmatrix[i] & (1 << 2) ? 1 : 0),
(curmatrix[i] & (1 << 3) ? 1 : 0),
(curmatrix[i] & (1 << 4) ? 1 : 0),
(curmatrix[i] & (1 << 5) ? 1 : 0),
(curmatrix[i] & (1 << 6) ? 1 : 0),
(curmatrix[i] & (1 << 7) ? 1 : 0));
*/
sprintf(buffer, "%2x", curmatrix[i]);
sendString(buffer);
if ((i == 7) || (i == 15)) {
sendString(":");
} else {
sendString(".");
}
}
sendString("---");
}
void toggle(void) {
// not used in this model/version
}
void setSpeed(uint8_t speed) {
// not used in this model/version
}
void setLeds(uint8_t LEDstate) {
// do nothing, since we don't have fancy lights on this hardware
}
/**
* The keymatrix-array contains positions of keys in the matrix. Here you can
* see which row is connected to which column when a key is pressed. This array
* probably has to be modified if this firmware is ported to a different
* keyboard.
* \sa modmatrix
*/
const uint8_t PROGMEM keymatrix[20][8] = {
// 0 / 0x01 1 / 0x02 2 / 0x04 3 / 0x08 4 / 0x10 5 / 0x20 6 / 0x40 7 / 0x80
{KEY_KPenter, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_RightArrow, KEY_Application }, // 0
{KEY_KPcomma, KEY_KP3, KEY_Reserved, KEY_KP9, KEY_Reserved, KEY_KPslash, KEY_KP6, KEY_Reserved }, // 1
{KEY_KP0, KEY_KP2, KEY_Reserved, KEY_KP8, KEY_Home, KEY_KPequals, KEY_KP5, KEY_Reserved }, // 2
{KEY_Reserved, KEY_Reserved, KEY_End, KEY_PageDown, KEY_Insert, KEY_PageUp, KEY_DeleteForward, KEY_UpArrow }, // 3
{KEY_Reserved, KEY_Return, KEY_Reserved, KEY_KP7, KEY_DELETE, KEY_KPBackspace, KEY_KP4, KEY_DownArrow }, // 4
{KEY_slash, KEY_hash, KEY_lbracket, KEY_P, KEY_minus, KEY_0, KEY_semicolon, KEY_apostroph }, // 5
{KEY_Reserved, KEY_dot, KEY_Reserved, KEY_O, KEY_Reserved, KEY_9, KEY_L, KEY_Reserved }, // 6
{KEY_Reserved, KEY_comma, KEY_rbracket, KEY_I, KEY_equals, KEY_8, KEY_K, KEY_Reserved }, // 7
{KEY_F12, KEY_F11, KEY_F9, KEY_F8, KEY_F6, KEY_F5, KEY_F3, KEY_F2 }, // 8
{KEY_F24, KEY_F10, KEY_F21, KEY_F7, KEY_F18, KEY_F4, KEY_F15, KEY_F1 }, // 9
{KEY_F23, KEY_F22, KEY_F20, KEY_F19, KEY_F17, KEY_F16, KEY_F14, KEY_F13 }, // 10
{KEY_N, KEY_M, KEY_Y, KEY_U, KEY_6, KEY_7, KEY_J, KEY_H }, // 11
{KEY_B, KEY_V, KEY_T, KEY_R, KEY_5, KEY_4, KEY_F, KEY_G }, // 12
{KEY_Reserved, KEY_C, KEY_Reserved, KEY_E, KEY_Reserved, KEY_3, KEY_D, KEY_Reserved }, // 13
{KEY_Reserved, KEY_X, KEY_Reserved, KEY_W, KEY_Reserved, KEY_2, KEY_S, KEY_Reserved }, // 14
{KEY_Euro, KEY_Z, KEY_Reserved, KEY_Q, KEY_grave, KEY_1, KEY_A, KEY_Reserved }, // 15
{KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved }, // 16
{KEY_Reserved, KEY_capslock, KEY_Copy, KEY_Tab, KEY_Again, KEY_Reserved, KEY_Paste, KEY_Find }, // 17
{KEY_Spacebar, KEY_KP1, KEY_Execute, KEY_Undo, KEY_Stop, KEY_Menu, KEY_Select, KEY_Cut }, // 18
{KEY_Reserved, KEY_LeftArrow, KEY_Reserved, KEY_KPminus, KEY_Reserved, KEY_KPasterisk, KEY_KPplus, KEY_Reserved }, // 19
};
/**
* The modmatrix-array contains positions of the modifier-keys in the matrix.
* It is built in the same way as the keymatrix-array.
* \sa keymatrix
*/
const uint8_t PROGMEM modmatrix[20][8] = { // contains positions of modifiers in the matrix
// 0 1 2 3 4 5 6 7
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 0
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 1
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 2
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 3
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 4
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 5
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 6
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 7
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 8
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 9
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 10
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 11
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 12
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 13
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 14
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 15
{MOD_SHIFT_LEFT, MOD_SHIFT_RIGHT, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_ALT_RIGHT }, // 16
{MOD_CONTROL_RIGHT, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 17
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 18
{MOD_ALT_LEFT, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_CONTROL_LEFT }, // 19
};
/**
* Checks if more than one bit in data is set.
* \param data value to check
* \return true if more than one bit is set
*/
static uint8_t bitcount2(uint16_t data) {
data &= (data - 1);
return data != 0;
}
/**
* check if reportBuffer contains the key
* \param buffer buffer to check
* \param key key to search
* \return 1 if buffer contains key, 0 otherwise
*/
static uint8_t bufferContains(uint8_t* buffer, uint8_t key) {
for (uint8_t i = 2; i < sizeof(buffer); i++) {
if (buffer[i] == key) {
return 1;
}
}
return 0;
}
/**
* Scan and debounce keypresses. This is the main worker function for normal
* keyboard operation, the code contains lot of comments. Basically, it first
* scans the keyboard state. If a change is detected, it initializes a counter
* that is decreased each time this function is called. If the counter reaches
* 1, that means that the same scan result has been scanned ten times in a row,
* so we can be pretty sure that the keys are in a certain state (as in: not
* bouncing). Then, the codes for keys and modifiers are searched from the two
* arrays, the USB-message to send the state is prepared. The return value of
* this function indicates if the message has to be sent.
* \return flag to indicate whether something has changed
*/
uint8_t scankeys(uint8_t* reportBuffer, uint8_t* oldReportBuffer, uint8_t sizeOfReportBuffer) {
static uint8_t debounce = 5;
uint8_t retval = 0;
for (uint8_t row = 0; row <= 19; row++) {
if (row <= 7) {
DDRROWS1 = (1 << row);
PORTROWS1 = ~(1 << row);
DDRROWS2 = 0x00;
PORTROWS2 = 0xff;
PORTROWS3 |= ((1 << PIND4) | (1 << PIND5) | (1 << PIND6) | (1 << PIND7));
DDRROWS3 &= ~((1 << PIND4) | (1 << PIND5) | (1 << PIND6) | (1 << PIND7));
} else if (row <= 15) {
DDRROWS1 = 0x00;
PORTROWS1 = 0xff;
// (15 - row) looks a bit weird, you would expect (row - 8) here.
// This is because pins on PORTC are ordered in the other direction
// than on PORTA. With (15 - row), we have the bytes in the
// resulting matrix matching the pins of the keyboard connector.
DDRROWS2 = (1 << (15 - row));
PORTROWS2 = ~(1 << (15 - row));
PORTROWS3 |= ((1 << PIND4) | (1 << PIND5) | (1 << PIND6) | (1 << PIND7));
DDRROWS3 &= ~((1 << PIND4) | (1 << PIND5) | (1 << PIND6) | (1 << PIND7));
} else {
DDRROWS1 = 0x00;
PORTROWS1 = 0xff;
DDRROWS2 = 0x00;
PORTROWS2 = 0xff;
// As if the case above wasn't difficult enough, on PORTD we have
// to make sure that the scanning doesn't affect USB
// communications, which occur on PIND0 and PIND2.
PORTROWS3 |= ((1 << PIND4) | (1 << PIND5) | (1 << PIND6) | (1 << PIND7));
DDRROWS3 &= ~((1 << PIND4) | (1 << PIND5) | (1 << PIND6) | (1 << PIND7));
DDRROWS3 |= (1 << (19 - row + 4));
PORTROWS3 &= ~(1 << (19 - row + 4));
}
_delay_us(30);
uint8_t data = ~PINCOLUMNS;
// check if we have to prevent ghost-keys
uint16_t rows = (PINROWS1 << 8) | PINROWS2; // TODO
if (bitcount2(~rows) && bitcount2(data)) {
// ghost-key situation detected
ghostmatrix[row] = data;
} else {
ghostmatrix[row] = 0x00;
}
if (data != curmatrix[row]) {
// if a change was detected
debounce = 10; // activate debounce counter
curmatrix[row] = data; // and store the result
}
}
if (debounce) {
// Count down, but avoid underflow
debounce--;
}
if (debounce == 1) {
/*
if (memcmp(oldmatrix, curmatrix, sizeof(curmatrix)) != 0) {
printMatrix();
memcpy(oldmatrix, curmatrix, sizeof(curmatrix));
return 0;
}
*/
// debounce counter expired, create report
uint8_t reportIndex = 2; // reportBuffer[0] contains modifiers
memset(reportBuffer, 0, sizeOfReportBuffer); // clear report buffer
for (uint8_t row = 0; row <= 19; row++) { // process all rows for key-codes
uint8_t data = curmatrix[row]; // restore buffer
if (data != 0xff) { // anything on this row? - optimization
for (uint8_t col = 0; col <= 7; col++) { // check every bit on this row
uint8_t key, modifier, isghostkey;
if (data & (1 << col)) {
key = pgm_read_byte(&keymatrix[row][col]);
modifier = pgm_read_byte(&modmatrix[row][col]);
isghostkey = (ghostmatrix[row] & (1 << col)) != 0;
} else {
key = KEY_Reserved;
modifier = MOD_NONE;
isghostkey = 0x00;
}
if (key != KEY_Reserved) { // keycode should be added to report
if (reportIndex >= sizeOfReportBuffer) { // too many keycodes
if (!retval & 0x02) { // Only fill buffer once
memset(reportBuffer+2, KEY_ErrorRollOver, sizeOfReportBuffer-2);
retval |= 0x02; // continue decoding to get modifiers
}
} else {
if (isghostkey) {
// we're in a ghost-key situation
if (bufferContains(oldReportBuffer, key)) {
// this key has been pressed before, so we still send it
reportBuffer[reportIndex] = key; // set next available entry
reportIndex++;
}
} else {
reportBuffer[reportIndex] = key; // set next available entry
reportIndex++;
}
}
}
if (modifier != MOD_NONE) { // modifier should be added to report
reportBuffer[0] |= modifier;
}
}
}
}
retval |= 0x01; // must have been a change at some point, since debounce is done
}
return retval;
}

View File

@ -1,317 +0,0 @@
/**
* \file firmware/modelibmmodelm.c
* \brief Hardware specific part for IBM Model M keyboard
* \author Ronald Schaten <ronald@schatenseite.de>
* \version $Id$
*
* License: GNU GPL v2 (see License.txt)
*/
#include <avr/io.h>
#include <avr/pgmspace.h>
#include <util/delay.h>
#include <string.h>
#include <stdio.h>
#include "keycodes.h"
#include "tools.h"
#include "modelinterface.h"
/* ----------------------- hardware I/O abstraction ------------------------ */
#define PORTCOLUMNS PORTB ///< port on which we read the state of the columns
#define PINCOLUMNS PINB ///< port on which we read the state of the columns
#define DDRCOLUMNS DDRB ///< port on which we read the state of the columns
#define PORTROWS1 PORTA ///< first port connected to the matrix rows
#define PINROWS1 PINA ///< first port connected to the matrix rows
#define DDRROWS1 DDRA ///< first port connected to the matrix rows
#define PORTROWS2 PORTC ///< second port connected to the matrix rows
#define PINROWS2 PINC ///< second port connected to the matrix rows
#define DDRROWS2 DDRC ///< second port connected to the matrix rows
#define PORTLEDS PORTD ///< port on which the LEDs are connected
#define PINLEDS PIND ///< port on which the LEDs are connected
#define DDRLEDS DDRD ///< port on which the LEDs are connected
#define LEDSCROLL PIND4 ///< address of the scroll-lock LED
#define LEDCAPS PIND5 ///< address of the caps-lock LED
#define LEDNUM PIND6 ///< address of the num-lock LED
#define PORTJUMPERS PORTD ///< port for additional jumpers
#define PINJUMPERS PIND ///< port for additional jumpers
#define DDRJUMPERS DDRD ///< port for additional jumpers
#define JUMPER0 PD1 ///< address for jumper 0
#define JUMPER1 PD3 ///< address for jumper 1
#define JUMPER2 PD7 ///< address for jumper 2
uint8_t curmatrix[16]; ///< contains current state of the keyboard
uint8_t oldmatrix[16]; ///< contains old state of the keyboard
uint8_t ghostmatrix[16]; ///< contains pressed keys that belong to a ghost-key situation
void hardwareInit(void) {
// column-port is input
PORTCOLUMNS = 0xff;
DDRCOLUMNS = 0x00;
// row-ports are output
PORTROWS1 = 0xff;
DDRROWS1 = 0x00;
PORTROWS2 = 0xff;
DDRROWS2 = 0x00;
// port D contains USB (D0, D2),
// LEDs (D4, D5, D6)
// and Jumpers (D1, D3, D7),
// so we call it PORTD instead of PORTJUMPERS or PORTLEDS
PORTD = 0xfa; // 1000 1010: activate pull-ups except on USB- and LED-lines
DDRD = 0x75; // 0111 0101: all pins input except USB (-> USB reset) and LED-pins
// USB Reset by device only required on Watchdog Reset
_delay_us(11); // delay >10ms for USB reset
DDRD = 0x70; // 0111 0000 bin: remove USB reset condition
// configure timer 0 for a rate of 12M/(1024 * 256) = 45.78Hz (~22ms)
TCCR0 = 5; // timer 0 prescaler: 1024
// blink, to indicate power-on
PORTLEDS &= ~((1 << LEDNUM) | (1 << LEDCAPS) | (1 << LEDSCROLL));
_delay_ms(50);
PORTLEDS |= ((1 << LEDNUM) | (1 << LEDCAPS) | (1 << LEDSCROLL));
}
/**
* Print the current state of the keyboard in a readable form. This function
* is used for debug-purposes only.
*/
void printMatrix(void) {
for (uint8_t i = 0; i <= 15; i++) {
char buffer[10];
/*
sprintf(buffer, "%d%d%d%d%d%d%d%d.",
(curmatrix[i] & (1 << 0) ? 1 : 0),
(curmatrix[i] & (1 << 1) ? 1 : 0),
(curmatrix[i] & (1 << 2) ? 1 : 0),
(curmatrix[i] & (1 << 3) ? 1 : 0),
(curmatrix[i] & (1 << 4) ? 1 : 0),
(curmatrix[i] & (1 << 5) ? 1 : 0),
(curmatrix[i] & (1 << 6) ? 1 : 0),
(curmatrix[i] & (1 << 7) ? 1 : 0));
*/
sprintf(buffer, "%2x", curmatrix[i]);
sendString(buffer);
if (i == 7) {
sendString(":");
} else {
sendString(".");
}
}
sendString("---");
}
void toggle(void) {
// not used in this model/version
}
void setSpeed(uint8_t speed) {
// not used in this model/version
}
void setLeds(uint8_t LEDstate) {
if (LEDstate & LED_NUM) { // light up num lock
PORTLEDS &= ~(1 << LEDNUM);
} else {
PORTLEDS |= (1 << LEDNUM);
}
if (LEDstate & LED_CAPS) { // light up caps lock
PORTLEDS &= ~(1 << LEDCAPS);
} else {
PORTLEDS |= (1 << LEDCAPS);
}
if (LEDstate & LED_SCROLL) { // light up scroll lock
PORTLEDS &= ~(1 << LEDSCROLL);
} else {
PORTLEDS |= (1 << LEDSCROLL);
}
}
/**
* The keymatrix-array contains positions of keys in the matrix. Here you can
* see which row is connected to which column when a key is pressed. This array
* probably has to be modified if this firmware is ported to a different
* keyboard.
* \sa modmatrix
*/
const uint8_t PROGMEM keymatrix[16][8] = {
// 0 1 2 3 4 5 6 7
{KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved }, // 0
{KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved }, // 1
{KEY_ESCAPE, KEY_Tab, KEY_grave, KEY_1, KEY_Q, KEY_A, KEY_Z, KEY_Reserved }, // 2
{KEY_Euro, KEY_capslock, KEY_F1, KEY_2, KEY_W, KEY_S, KEY_X, KEY_Reserved }, // 3
{KEY_F4, KEY_F3, KEY_F2, KEY_3, KEY_E, KEY_D, KEY_C, KEY_Reserved }, // 4
{KEY_G, KEY_T, KEY_5, KEY_4, KEY_R, KEY_F, KEY_V, KEY_B }, // 5
{KEY_F5, KEY_DELETE, KEY_F9, KEY_F10, KEY_Reserved, KEY_Reserved, KEY_Return, KEY_Spacebar }, // 6
{KEY_H, KEY_Y, KEY_6, KEY_7, KEY_U, KEY_J, KEY_M, KEY_N }, // 7
{KEY_F6, KEY_rbracket, KEY_equals, KEY_8, KEY_I, KEY_K, KEY_comma, KEY_Reserved }, // 8
{KEY_Reserved, KEY_F7, KEY_F8, KEY_9, KEY_O, KEY_L, KEY_dot, KEY_Reserved }, // 9
{KEY_apostroph, KEY_lbracket, KEY_minus, KEY_0, KEY_P, KEY_semicolon, KEY_hash, KEY_slash }, // 10
{KEY_Reserved, KEY_KP4, KEY_DeleteForward, KEY_F11, KEY_KP7, KEY_KP1, KEY_NumLock, KEY_DownArrow }, // 11
{KEY_KP0, KEY_KP5, KEY_Insert, KEY_F12, KEY_KP8, KEY_KP2, KEY_KPslash, KEY_RightArrow }, // 12
{KEY_KPcomma, KEY_KP6, KEY_PageUp, KEY_PageDown, KEY_KP9, KEY_KP3, KEY_KPasterisk, KEY_KPminus }, // 13
{KEY_UpArrow, KEY_Reserved, KEY_Home, KEY_End, KEY_KPplus, KEY_KPenter, KEY_Pause, KEY_LeftArrow }, // 14
{KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_PrintScreen, KEY_ScrollLock, KEY_Reserved, KEY_Reserved, KEY_Reserved }, // 15
};
/**
* The modmatrix-array contains positions of the modifier-keys in the matrix.
* It is built in the same way as the keymatrix-array.
* \sa keymatrix
*/
const uint8_t PROGMEM modmatrix[16][8] = { // contains positions of modifiers in the matrix
// 0 1 2 3 4 5 6 7
{MOD_NONE, MOD_NONE, MOD_CONTROL_LEFT, MOD_NONE, MOD_NONE, MOD_NONE, MOD_CONTROL_RIGHT, MOD_NONE }, // 0
{MOD_NONE, MOD_SHIFT_LEFT, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_SHIFT_RIGHT, MOD_NONE }, // 1
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 2
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 3
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 4
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 5
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 6
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 7
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 8
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 9
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 10
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 11
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 12
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 13
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 14
{MOD_ALT_LEFT, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_ALT_RIGHT}, // 15
};
/**
* Checks if more than one bit in data is set.
* \param data value to check
* \return true if more than one bit is set
*/
static uint8_t bitcount2(uint16_t data) {
data &= (data - 1);
return data != 0;
}
/**
* check if reportBuffer contains the key
* \param buffer buffer to check
* \param key key to search
* \return 1 if buffer contains key, 0 otherwise
*/
static uint8_t bufferContains(uint8_t* buffer, uint8_t key) {
for (uint8_t i = 2; i < sizeof(buffer); i++) {
if (buffer[i] == key) {
return 1;
}
}
return 0;
}
/**
* Scan and debounce keypresses. This is the main worker function for normal
* keyboard operation, the code contains lot of comments. Basically, it first
* scans the keyboard state. If a change is detected, it initializes a counter
* that is decreased each time this function is called. If the counter reaches
* 1, that means that the same scan result has been scanned ten times in a row,
* so we can be pretty sure that the keys are in a certain state (as in: not
* bouncing). Then, the codes for keys and modifiers are searched from the two
* arrays, the USB-message to send the state is prepared. The return value of
* this function indicates if the message has to be sent.
* \return flag to indicate whether something has changed
*/
uint8_t scankeys(uint8_t* reportBuffer, uint8_t* oldReportBuffer, uint8_t sizeOfReportBuffer) {
static uint8_t debounce = 5;
uint8_t retval = 0;
for (uint8_t row = 0; row <= 15; row++) {
if (row <= 7) {
DDRROWS1 = (1 << row);
PORTROWS1 = ~(1 << row);
DDRROWS2 = 0x00;
PORTROWS2 = 0xff;
} else {
DDRROWS1 = 0x00;
PORTROWS1 = 0xff;
// (15 - row) looks a bit weird, you would expect (row - 8) here.
// This is because pins on PORTC are ordered in the other direction
// than on PORTA. With (15 - row), we have the bytes in the
// resulting matrix matching the pins of the keyboard connector.
DDRROWS2 = (1 << (15 - row));
PORTROWS2 = ~(1 << (15 - row));
}
_delay_us(30);
uint8_t data = ~PINCOLUMNS;
// check if we have to prevent ghost-keys
uint16_t rows= (PINROWS1 << 8) | PINROWS2;
if (bitcount2(~rows) && bitcount2(data)) {
// ghost-key situation detected
ghostmatrix[row] = data;
} else {
ghostmatrix[row] = 0x00;
}
if (data != curmatrix[row]) {
// if a change was detected
debounce = 10; // activate debounce counter
curmatrix[row] = data; // and store the result
}
}
if (debounce) {
// Count down, but avoid underflow
debounce--;
}
if (debounce == 1) {
/*
if (memcmp(oldmatrix, curmatrix, sizeof(curmatrix)) != 0) {
printMatrix();
memcpy(oldmatrix, curmatrix, sizeof(curmatrix));
}
*/
// debounce counter expired, create report
uint8_t reportIndex = 2; // reportBuffer[0] contains modifiers
memset(reportBuffer, 0, sizeOfReportBuffer); // clear report buffer
for (uint8_t row = 0; row <= 15; row++) { // process all rows for key-codes
uint8_t data = curmatrix[row]; // restore buffer
if (data != 0xff) { // anything on this row? - optimization
for (uint8_t col = 0; col <= 7; col++) { // check every bit on this row
uint8_t key, modifier, isghostkey;
if (data & (1 << col)) {
key = pgm_read_byte(&keymatrix[row][col]);
modifier = pgm_read_byte(&modmatrix[row][col]);
isghostkey = (ghostmatrix[row] & (1 << col)) != 0;
} else {
key = KEY_Reserved;
modifier = MOD_NONE;
isghostkey = 0x00;
}
if (key != KEY_Reserved) { // keycode should be added to report
if (reportIndex >= sizeOfReportBuffer) { // too many keycodes
if (!retval & 0x02) { // Only fill buffer once
memset(reportBuffer+2, KEY_ErrorRollOver, sizeOfReportBuffer-2);
retval |= 0x02; // continue decoding to get modifiers
}
} else {
if (isghostkey) {
// we're in a ghost-key situation
if (bufferContains(oldReportBuffer, key)) {
// this key has been pressed before, so we still send it
reportBuffer[reportIndex] = key; // set next available entry
reportIndex++;
}
} else {
reportBuffer[reportIndex] = key; // set next available entry
reportIndex++;
}
}
}
if (modifier != MOD_NONE) { // modifier should be added to report
reportBuffer[0] |= modifier;
}
}
}
}
retval |= 0x01; // must have been a change at some point, since debounce is done
}
return retval;
}

View File

@ -1,56 +0,0 @@
/**
* \file firmware/modelinterface.h
* \brief Interface for hardware specific functions
* \author Ronald Schaten <ronald@schatenseite.de>
* \version $Id$
*
* License: GNU GPL v2 (see License.txt)
*/
#include <stdint.h>
/**
* Initialize hardware. Configure ports as inputs and outputs, set USB reset
* condition, start timer and blink LEDs.
*/
void hardwareInit(void);
/**
* Print the current state of the keyboard in a readable form. This function
* is used for debug-purposes only.
*/
void printMatrix(void);
/**
* Toggle-function is called as a command, doesn't have to be implemented.
*/
void toggle(void);
/**
* This tells the current writing speed to the keyboard, for whatever it will
* do with the value.
* \param speed speed value between 0 and 255
*/
void setSpeed(uint8_t speed);
/**
* This function sets the LEDs according to the given data.
* \param LEDstate bitfield with LED info
*/
void setLeds(uint8_t LEDstate);
/**
* Scan and debounce keypresses. This is the main worker function for normal
* keyboard operation, the code contains lot of comments. Basically, it first
* scans the keyboard state. If a change is detected, it initializes a counter
* that is decreased each time this function is called. If the counter reaches
* 1, that means that the same scan result has been scanned ten times in a row,
* so we can be pretty sure that the keys are in a certain state (as in: not
* bouncing). Then, the codes for keys and modifiers are searched from the two
* arrays, the USB-message to send the state is prepared. The return value of
* this function indicates if the message has to be sent.
* \param reportBuffer array with the current USB report
* \param oldReportBuffer array with the last USB report
* \return flag to indicate whether something has changed
*/
uint8_t scankeys(uint8_t* reportBuffer, uint8_t* oldReportBuffer, uint8_t sizeOfReportBuffer);

View File

@ -1,343 +0,0 @@
/**
* \file firmware/modelmayhem.c
* \brief Hardware specific part for IBM Model M keyboard, modified to be the
* ultimate geek keyboard. :-)
* \author Ronald Schaten <ronald@schatenseite.de>
* \version $Id$
*
* License: GNU GPL v2 (see License.txt)
*/
#include <avr/io.h>
#include <avr/pgmspace.h>
#include <util/delay.h>
#include <string.h>
#include <stdio.h>
#include "keycodes.h"
#include "tools.h"
#include "modelinterface.h"
/* ----------------------- hardware I/O abstraction ------------------------ */
#define PORTCOLUMNS PORTB ///< port on which we read the state of the columns
#define PINCOLUMNS PINB ///< port on which we read the state of the columns
#define DDRCOLUMNS DDRB ///< port on which we read the state of the columns
#define PORTROWS1 PORTA ///< first port connected to the matrix rows
#define PINROWS1 PINA ///< first port connected to the matrix rows
#define DDRROWS1 DDRA ///< first port connected to the matrix rows
#define PORTROWS2 PORTC ///< second port connected to the matrix rows
#define PINROWS2 PINC ///< second port connected to the matrix rows
#define DDRROWS2 DDRC ///< second port connected to the matrix rows
#define PORTLEDS PORTD ///< port on which the LEDs are connected
#define PINLEDS PIND ///< port on which the LEDs are connected
#define DDRLEDS DDRD ///< port on which the LEDs are connected
#define LEDCOMP PIND1 ///< address of the compose LED
#define LEDNUM PIND3 ///< address of the num-lock LED
#define LEDCAPS PIND6 ///< address of the caps-lock LED
#define LEDSCROLL PIND7 ///< address of the scroll-lock LED
uint8_t curmatrix[16]; ///< contains current state of the keyboard
uint8_t oldmatrix[16]; ///< contains old state of the keyboard
uint8_t ghostmatrix[16]; ///< contains pressed keys that belong to a ghost-key situation
uint8_t backlight = 0;
void hardwareInit(void) {
// column-port is input
PORTCOLUMNS = 0xff;
DDRCOLUMNS = 0x00;
// row-ports are output
PORTROWS1 = 0xff;
DDRROWS1 = 0x00;
PORTROWS2 = 0xff;
DDRROWS2 = 0x00;
// port D contains USB (D0, D2),
// LEDs (D4, D5, D6)
// and Jumpers (D1, D3, D7),
// so we call it PORTD instead of PORTJUMPERS or PORTLEDS
PORTD = 0xfa; // 1111 1010: no pull-ups on USB- and LED-lines
DDRD = 0xff; // 1111 1111: USB reset condition, LED-lines off
// USB Reset by device only required on Watchdog Reset
_delay_us(11); // delay >10ms for USB reset
DDRD = 0xfa; // 1111 1010: remove USB reset condition
// configure timer 0 for a rate of 12M/(1024 * 256) = 45.78Hz (~22ms)
TCCR0 = 5; // timer 0 prescaler: 1024
// blink, to indicate power-on
PORTLEDS &= ~((1 << LEDNUM) | (1 << LEDCAPS) | (1 << LEDSCROLL) | (1 << LEDCOMP));
_delay_ms(50);
PORTLEDS |= ((1 << LEDNUM) | (1 << LEDCAPS) | (1 << LEDSCROLL) | (1 << LEDCOMP));
// initialize timer for pulse width modulation on backlight LED ports
// WGM13=1, WGM12=1, WGM11=1, WGM10=0 -> PWM mode 14
// COM1A1=1, COM1B1=1 -> OC1A and OC1B are set at the bottom and cleared on
// when the counter matches OCR1A or OCR1B
// CS10=1 -> prescaler 1
TCCR1A = (1 << COM1A1) | (1 << COM1B1) | (1 << WGM11);
TCCR1B = (1 << WGM13) | (1 << WGM12) | (1 << CS10);
// the pwm counter counts from 0 to this value
ICR1 = 0xffff;
// both LEDs are switched off on startup
OCR1A = 0xffff; // red
OCR1B = 0xffff; // green
}
/**
* Print the current state of the keyboard in a readable form. This function
* is used for debug-purposes only.
*/
void printMatrix(void) {
for (uint8_t i = 0; i <= 15; i++) {
char buffer[10];
/*
sprintf(buffer, "%d%d%d%d%d%d%d%d.",
(curmatrix[i] & (1 << 0) ? 1 : 0),
(curmatrix[i] & (1 << 1) ? 1 : 0),
(curmatrix[i] & (1 << 2) ? 1 : 0),
(curmatrix[i] & (1 << 3) ? 1 : 0),
(curmatrix[i] & (1 << 4) ? 1 : 0),
(curmatrix[i] & (1 << 5) ? 1 : 0),
(curmatrix[i] & (1 << 6) ? 1 : 0),
(curmatrix[i] & (1 << 7) ? 1 : 0));
*/
sprintf(buffer, "%2x", curmatrix[i]);
sendString(buffer);
if (i == 7) {
sendString(":");
} else {
sendString(".");
}
}
sendString("---");
}
void toggle(void) {
// switch backlight on or off
if (backlight == 0) {
backlight = 1;
} else {
backlight = 0;
OCR1A = 0xffff;
OCR1B = 0xffff;
}
}
void setSpeed(uint8_t speed) {
if (backlight == 1) {
OCR1A = 0xffff - ((256 - speed) * (256 - speed) - 1);
OCR1B = 0xffff - ((speed + 1) * (speed + 1) - 1);
}
}
void setLeds(uint8_t LEDstate) {
if (LEDstate & LED_NUM) { // light up num lock
PORTLEDS &= ~(1 << LEDNUM);
} else {
PORTLEDS |= (1 << LEDNUM);
}
if (LEDstate & LED_CAPS) { // light up caps lock
PORTLEDS &= ~(1 << LEDCAPS);
} else {
PORTLEDS |= (1 << LEDCAPS);
}
if (LEDstate & LED_SCROLL) { // light up scroll lock
PORTLEDS &= ~(1 << LEDSCROLL);
} else {
PORTLEDS |= (1 << LEDSCROLL);
}
if (LEDstate & LED_COMPOSE) { // light up compose
PORTLEDS &= ~(1 << LEDCOMP);
} else {
PORTLEDS |= (1 << LEDCOMP);
}
}
/**
* The keymatrix-array contains positions of keys in the matrix. Here you can
* see which row is connected to which column when a key is pressed. This array
* probably has to be modified if this firmware is ported to a different
* keyboard.
* \sa modmatrix
*/
const uint8_t PROGMEM keymatrix[16][8] = {
// 0 1 2 3 4 5 6 7
{KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved }, // 0
{KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved }, // 1
{KEY_ESCAPE, KEY_Tab, KEY_grave, KEY_1, KEY_Q, KEY_A, KEY_Z, KEY_Reserved }, // 2
{KEY_Euro, KEY_capslock, KEY_F1, KEY_2, KEY_W, KEY_S, KEY_X, KEY_Reserved }, // 3
{KEY_F4, KEY_F3, KEY_F2, KEY_3, KEY_E, KEY_D, KEY_C, KEY_Reserved }, // 4
{KEY_G, KEY_T, KEY_5, KEY_4, KEY_R, KEY_F, KEY_V, KEY_B }, // 5
{KEY_F5, KEY_DELETE, KEY_F9, KEY_F10, KEY_Reserved, KEY_Reserved, KEY_Return, KEY_Spacebar }, // 6
{KEY_H, KEY_Y, KEY_6, KEY_7, KEY_U, KEY_J, KEY_M, KEY_N }, // 7
{KEY_F6, KEY_rbracket, KEY_equals, KEY_8, KEY_I, KEY_K, KEY_comma, KEY_Reserved }, // 8
{KEY_Reserved, KEY_F7, KEY_F8, KEY_9, KEY_O, KEY_L, KEY_dot, KEY_Reserved }, // 9
{KEY_apostroph, KEY_lbracket, KEY_minus, KEY_0, KEY_P, KEY_semicolon, KEY_hash, KEY_slash }, // 10
{KEY_Reserved, KEY_KP4, KEY_DeleteForward, KEY_F11, KEY_KP7, KEY_KP1, KEY_NumLock, KEY_DownArrow }, // 11
{KEY_KP0, KEY_KP5, KEY_Insert, KEY_F12, KEY_KP8, KEY_KP2, KEY_KPslash, KEY_RightArrow }, // 12
{KEY_KPcomma, KEY_KP6, KEY_PageUp, KEY_PageDown, KEY_KP9, KEY_KP3, KEY_KPasterisk, KEY_KPminus }, // 13
{KEY_UpArrow, KEY_Reserved, KEY_Home, KEY_End, KEY_KPplus, KEY_KPenter, KEY_Pause, KEY_LeftArrow }, // 14
{KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_PrintScreen, KEY_ScrollLock, KEY_Reserved, KEY_Reserved, KEY_Reserved }, // 15
};
/**
* The modmatrix-array contains positions of the modifier-keys in the matrix.
* It is built in the same way as the keymatrix-array.
* \sa keymatrix
*/
const uint8_t PROGMEM modmatrix[16][8] = { // contains positions of modifiers in the matrix
// 0 1 2 3 4 5 6 7
{MOD_NONE, MOD_NONE, MOD_CONTROL_LEFT, MOD_NONE, MOD_NONE, MOD_NONE, MOD_CONTROL_RIGHT, MOD_NONE }, // 0
{MOD_NONE, MOD_SHIFT_LEFT, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_SHIFT_RIGHT, MOD_NONE }, // 1
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 2
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 3
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 4
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 5
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 6
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 7
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 8
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 9
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 10
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 11
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 12
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 13
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE }, // 14
{MOD_ALT_LEFT, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_ALT_RIGHT}, // 15
};
/**
* Checks if more than one bit in data is set.
* \param data value to check
* \return true if more than one bit is set
*/
static uint8_t bitcount2(uint16_t data) {
data &= (data - 1);
return data != 0;
}
/**
* check if reportBuffer contains the key
* \param buffer buffer to check
* \param key key to search
* \return 1 if buffer contains key, 0 otherwise
*/
static uint8_t bufferContains(uint8_t* buffer, uint8_t key) {
for (uint8_t i = 2; i < sizeof(buffer); i++) {
if (buffer[i] == key) {
return 1;
}
}
return 0;
}
/**
* Scan and debounce keypresses. This is the main worker function for normal
* keyboard operation, the code contains lot of comments. Basically, it first
* scans the keyboard state. If a change is detected, it initializes a counter
* that is decreased each time this function is called. If the counter reaches
* 1, that means that the same scan result has been scanned ten times in a row,
* so we can be pretty sure that the keys are in a certain state (as in: not
* bouncing). Then, the codes for keys and modifiers are searched from the two
* arrays, the USB-message to send the state is prepared. The return value of
* this function indicates if the message has to be sent.
* \return flag to indicate whether something has changed
*/
uint8_t scankeys(uint8_t* reportBuffer, uint8_t* oldReportBuffer, uint8_t sizeOfReportBuffer) {
static uint8_t debounce = 5;
uint8_t retval = 0;
for (uint8_t row = 0; row <= 15; row++) {
if (row <= 7) {
DDRROWS1 = (1 << row);
PORTROWS1 = ~(1 << row);
DDRROWS2 = 0x00;
PORTROWS2 = 0xff;
} else {
DDRROWS1 = 0x00;
PORTROWS1 = 0xff;
// (15 - row) looks a bit weird, you would expect (row - 8) here.
// This is because pins on PORTC are ordered in the other direction
// than on PORTA. With (15 - row), we have the bytes in the
// resulting matrix matching the pins of the keyboard connector.
DDRROWS2 = (1 << (15 - row));
PORTROWS2 = ~(1 << (15 - row));
}
_delay_us(30);
uint8_t data = ~PINCOLUMNS;
// check if we have to prevent ghost-keys
uint16_t rows= (PINROWS1 << 8) | PINROWS2;
if (bitcount2(~rows) && bitcount2(data)) {
// ghost-key situation detected
ghostmatrix[row] = data;
} else {
ghostmatrix[row] = 0x00;
}
if (data != curmatrix[row]) {
// if a change was detected
debounce = 10; // activate debounce counter
curmatrix[row] = data; // and store the result
}
}
if (debounce) {
// Count down, but avoid underflow
debounce--;
}
if (debounce == 1) {
/*
if (memcmp(oldmatrix, curmatrix, sizeof(curmatrix)) != 0) {
printMatrix();
memcpy(oldmatrix, curmatrix, sizeof(curmatrix));
}
*/
// debounce counter expired, create report
uint8_t reportIndex = 2; // reportBuffer[0] contains modifiers
memset(reportBuffer, 0, sizeOfReportBuffer); // clear report buffer
for (uint8_t row = 0; row <= 15; row++) { // process all rows for key-codes
uint8_t data = curmatrix[row]; // restore buffer
if (data != 0xff) { // anything on this row? - optimization
for (uint8_t col = 0; col <= 7; col++) { // check every bit on this row
uint8_t key, modifier, isghostkey;
if (data & (1 << col)) {
key = pgm_read_byte(&keymatrix[row][col]);
modifier = pgm_read_byte(&modmatrix[row][col]);
isghostkey = (ghostmatrix[row] & (1 << col)) != 0;
} else {
key = KEY_Reserved;
modifier = MOD_NONE;
isghostkey = 0x00;
}
if (key != KEY_Reserved) { // keycode should be added to report
if (reportIndex >= sizeOfReportBuffer) { // too many keycodes
if (!retval & 0x02) { // Only fill buffer once
memset(reportBuffer+2, KEY_ErrorRollOver, sizeOfReportBuffer-2);
retval |= 0x02; // continue decoding to get modifiers
}
} else {
if (isghostkey) {
// we're in a ghost-key situation
if (bufferContains(oldReportBuffer, key)) {
// this key has been pressed before, so we still send it
reportBuffer[reportIndex] = key; // set next available entry
reportIndex++;
}
} else {
reportBuffer[reportIndex] = key; // set next available entry
reportIndex++;
}
}
}
if (modifier != MOD_NONE) { // modifier should be added to report
reportBuffer[0] |= modifier;
}
}
}
}
retval |= 0x01; // must have been a change at some point, since debounce is done
}
return retval;
}

View File

@ -1,311 +0,0 @@
/**
* \file firmware/modelsuntype5.c
* \brief Hardware specific part for Sun Type 5 keyboard
* \author Ronald Schaten <ronald@schatenseite.de>
* \version $Id$
*
* License: GNU GPL v2 (see License.txt)
*/
#include <avr/io.h>
#include <avr/pgmspace.h>
#include <util/delay.h>
#include <string.h>
#include <stdio.h>
#include "keycodes.h"
#include "tools.h"
#include "modelinterface.h"
#include "usbdrv.h"
/* ----------------------- hardware I/O abstraction ------------------------ */
#define PORTLEDS PORTB ///< port on which the LEDs are connected
#define PINLEDS PINB ///< port on which the LEDs are connected
#define DDRLEDS DDRB ///< port on which the LEDs are connected
#define LEDSCROLL PINB7 ///< address of the scroll-lock LED
#define LEDNUM PINB6 ///< address of the num-lock LED
#define LEDCOMP PINB5 ///< address of the compose LED
#define LEDCAPS PINB4 ///< address of the caps-lock LED
#define SRCLOCKON PORTC |= (1 << PC5)
#define SRCLOCKOFF PORTC &= ~(1 << PC5)
#define SRDATAON PORTC |= (1 << PC6)
#define SRDATAOFF PORTC &= ~(1 << PC6)
#define SRSTROBEON PORTC |= (1 << PC7)
#define SRSTROBEOFF PORTC &= ~(1 << PC7)
uint16_t curmatrix[22]; ///< contains current state of the keyboard
uint16_t oldmatrix[22]; ///< contains old state of the keyboard
uint16_t ghostmatrix[22]; ///< contains pressed keys that belong to a ghost-key situation
void hardwareInit(void) {
// configure ports
DDRA = 0x00;
PORTA = 0xff;
DDRB = (1 << PB4) |(1 << PB5) | (1 << PB6) | (1 << PB7);
PORTB = (1 << PB0) | (1 << PB1) | (1 << PB2) | (1 << PB3);
DDRC = (1 << PC5) | (1 << PC6) | (1 << PC7);
PORTC = (1 << PC0) | (1 << PC1) | (1 << PC2) | (1 << PC3) | (1 << PC4);
DDRD &= ~((1 << PD4) | (1 << PD5) | (1 << PD6) | (1 << PD7));
PORTD |= (1 << PD4) | (1 << PD5) | (1 << PD6) | (1 << PD7);
DDRD |= (1 << PD0) | (1 << PD2); // needed for USB reset
_delay_us(11); // delay >10ms for USB reset
DDRD &= ~((1 << PD0) | (1 << PD2)); // remove USB reset condition
// configure timer 0 for a rate of 12M/(1024 * 256) = 45.78Hz (~22ms)
TCCR0 = 5; // timer 0 prescaler: 1024
// blink, to indicate power-on
PORTLEDS &= ~((1 << LEDNUM) | (1 << LEDCAPS) | (1 << LEDSCROLL) | (1 << LEDCOMP));
_delay_ms(50);
PORTLEDS |= ((1 << LEDNUM) | (1 << LEDCAPS) | (1 << LEDSCROLL) | (1 << LEDCOMP));
// clean shift registers -- set all row lines to 1, except for KEYROW
SRDATAON;
SRSTROBEOFF;
for (uint8_t i = 0; i < 21; i++) {
SRCLOCKON; SRCLOCKOFF;
}
SRSTROBEON; SRSTROBEOFF;
}
/**
* Print the current state of the keyboard in a readable form. This function
* is used for debug-purposes only.
*/
void printMatrix(void) {
for (uint8_t i = 0; i < 22; i++) {
char buffer[10];
sprintf(buffer, "%4x", ~(curmatrix[i] | 0xe000));
for(int j= 0; j < strlen(buffer); j++) {
if(buffer[j] == '0')
buffer[j]= ' ';
}
sendString(buffer);
if (i == 11) {
sendString(":");
} else {
sendString(".");
}
}
sendString("\n");
}
void toggle(void) {
// not used in this model/version
}
void setSpeed(uint8_t speed) {
// not used in this model/version
}
void setLeds(uint8_t LEDstate) {
if (LEDstate & LED_NUM) { // light up num lock
PORTLEDS &= ~(1 << LEDNUM);
} else {
PORTLEDS |= (1 << LEDNUM);
}
if (LEDstate & LED_CAPS) { // light up caps lock
PORTLEDS &= ~(1 << LEDCAPS);
} else {
PORTLEDS |= (1 << LEDCAPS);
}
if (LEDstate & LED_SCROLL) { // light up scroll lock
PORTLEDS &= ~(1 << LEDSCROLL);
} else {
PORTLEDS |= (1 << LEDSCROLL);
}
if (LEDstate & LED_COMPOSE) { // light up compose
PORTLEDS &= ~(1 << LEDCOMP);
} else {
PORTLEDS |= (1 << LEDCOMP);
}
}
/**
* The keymatrix-array contains positions of keys in the matrix. Here you can
* see which row is connected to which column when a key is pressed. This array
* probably has to be modified if this firmware is ported to a different
* keyboard.
* \sa modmatrix
*/
const uint8_t PROGMEM keymatrix[22][13] = {
// 0 1 2 3 4 5 6 7 8 9 10 11 12
{KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_dot, KEY_F8, KEY_F10, KEY_Reserved, KEY_9, KEY_minus, KEY_P, KEY_K}, // 0
{KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_slash, KEY_equals, KEY_F11, KEY_Reserved, KEY_0, KEY_lbracket, KEY_semicolon, KEY_L}, // 1
{KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_LeftArrow, KEY_DownArrow, KEY_grave, KEY_F12, KEY_Reserved, KEY_Euro, KEY_DELETE, KEY_rbracket, KEY_apostroph}, // 2
{KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_RightArrow, KEY_UpArrow, KEY_Insert, KEY_PrintScreen, KEY_Reserved, KEY_NumLock, KEY_DeleteForward, KEY_Return, KEY_KP4}, // 3
{KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_KP2, KEY_KP5, KEY_ScrollLock, KEY_Mute, KEY_Reserved, KEY_KPslash, KEY_Home, KEY_End, KEY_KP7}, // 4
{KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_KP3, KEY_KP6, KEY_Pause, KEY_Volume_Down, KEY_Reserved, KEY_KPasterisk, KEY_PageUp, KEY_PageDown, KEY_KP8}, // 5
{KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_KPcomma, KEY_KP0, KEY_KPminus, KEY_Volume_Up, KEY_Reserved, KEY_KP9, KEY_KPplus, KEY_KPenter, KEY_KP1}, // 6
{KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved}, // 7
{KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Application /*compose*/, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved}, // 8
{KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Power, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved}, // 9
{KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved}, // 10
{KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved}, // 11
{KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_capslock, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved}, // 12
{KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Find, KEY_Select /*open*/, KEY_ESCAPE, KEY_Help, KEY_Reserved, KEY_Stop, KEY_Menu /*props*/, KEY_Tab, KEY_Execute /*front*/}, // 13
{KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved}, // 14
{KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Cut, KEY_Paste, KEY_1, KEY_Cancel /*any*/, KEY_Reserved, KEY_Again, KEY_Undo, KEY_Q, KEY_Copy}, // 15
{KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Z, KEY_2, KEY_F1, KEY_Reserved, KEY_3, KEY_E, KEY_W, KEY_D}, // 16
{KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_C, KEY_X, KEY_4, KEY_F2, KEY_Reserved, KEY_5, KEY_R, KEY_F, KEY_A}, // 17
{KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_V, KEY_N, KEY_F3, KEY_F5, KEY_Reserved, KEY_6, KEY_T, KEY_G, KEY_S}, // 18
{KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_B, KEY_M, KEY_F4, KEY_F6, KEY_Reserved, KEY_7, KEY_U, KEY_Y, KEY_H}, // 19
{KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved}, // 20
{KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Spacebar, KEY_comma, KEY_F7, KEY_F9, KEY_Reserved, KEY_8, KEY_O, KEY_I, KEY_J}, // 21
};
/**
* The modmatrix-array contains positions of the modifier-keys in the matrix.
* It is built in the same way as the keymatrix-array.
* \sa keymatrix
*/
const uint8_t PROGMEM modmatrix[22][13] = { // contains positions of modifiers in the matrix
// 0 1 2 3 4 5 6 7 8 9 10 11 12
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE}, // 0
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE}, // 1
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE}, // 2
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE}, // 3
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE}, // 4
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE}, // 5
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE}, // 6
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_ALT_RIGHT, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE}, // 7
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE}, // 8
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE}, // 9
{MOD_NONE, MOD_GUI_RIGHT, MOD_GUI_LEFT, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE}, // 10
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_ALT_LEFT, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE}, // 11
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE}, // 12
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE}, // 13
{MOD_SHIFT_RIGHT, MOD_NONE, MOD_NONE, MOD_SHIFT_LEFT, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE}, // 14
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE}, // 15
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE}, // 16
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE}, // 17
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE}, // 18
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE}, // 19
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_CONTROL_LEFT}, // 20
{MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE, MOD_NONE}, // 21
};
/**
* Checks if more than one bit in data is set.
* \param data value to check
* \return true if more than one bit is set
*/
static uint8_t bitcount2(uint16_t data) {
data &= (data - 1);
return data != 0;
}
/**
* check if reportBuffer contains the key
* \param buffer buffer to check
* \param key key to search
* \return 1 if buffer contains key, 0 otherwise
*/
static uint8_t bufferContains(uint8_t* buffer, uint8_t key) {
for (uint8_t i = 2; i < sizeof(buffer); i++) {
if (buffer[i] == key) {
return 1;
}
}
return 0;
}
/**
* Scan and debounce keypresses. This is the main worker function for normal
* keyboard operation, the code contains lot of comments. Basically, it first
* scans the keyboard state. If a change is detected, it initializes a counter
* that is decreased each time this function is called. If the counter reaches
* 1, that means that the same scan result has been scanned ten times in a row,
* so we can be pretty sure that the keys are in a certain state (as in: not
* bouncing). Then, the codes for keys and modifiers are searched from the two
* arrays, the USB-message to send the state is prepared. The return value of
* this function indicates if the message has to be sent.
* \return flag to indicate whether something has changed
*/
uint8_t scankeys(uint8_t* reportBuffer, uint8_t* oldReportBuffer, uint8_t sizeOfReportBuffer) {
static uint8_t debounce = 5;
uint8_t retval = 0;
SRDATAOFF; // mark first bit as the active one
SRCLOCKON; SRCLOCKOFF; // trigger clock to shift first bit into the register
SRDATAON; // all further bits will be inactive
for (uint8_t row = 0; row < 22; row++) {
SRSTROBEON; SRSTROBEOFF; // copy current register values to output
_delay_us(30);
uint16_t data = ((PINC & 0x1f) << 8) | PINA; // we need the lower five bits of PINC and PINA
if (data != curmatrix[row]) {
// if a change was detected
debounce = 10; // activate debounce counter
curmatrix[row] = data; // and store the result
ghostmatrix[row] = 0;
}
SRCLOCKON; SRCLOCKOFF; // trigger clock to shift register values
}
if (debounce) {
// Count down, but avoid underflow
debounce--;
}
if (debounce == 1) {
memset(ghostmatrix, 0, sizeof(ghostmatrix));
for (uint8_t i = 0; i < 21; i++) {
uint16_t keys = (~curmatrix[i]) & 0x1fff;
if (bitcount2(keys)) { // check if 2 or more keys are pressed
for (uint8_t j = i + 1; j < 22; j++) {
uint16_t common_columns = keys & (~curmatrix[j]);
if (bitcount2(common_columns)) { // 2 or more columns in common => ghostkeys
ghostmatrix[i] |= common_columns;
ghostmatrix[j] |= common_columns;
}
}
}
}
// debounce counter expired, create report
uint8_t reportIndex = 2; // reportBuffer[0] contains modifiers
memset(reportBuffer, 0, sizeOfReportBuffer); // clear report buffer
for (uint8_t row = 0; row < 22; row++) { // process all rows for key-codes
uint16_t data = curmatrix[row]; // restore buffer
if (data != 0x1fff) { // anything on this row? - optimization
for (uint8_t col = 0; col < 13; col++) { // check every bit on this row
uint8_t key, modifier, isghostkey;
if (!(data & (1 << col))) {
key = pgm_read_byte(&keymatrix[row][col]);
modifier = pgm_read_byte(&modmatrix[row][col]);
isghostkey = (ghostmatrix[row] & (1 << col)) != 0;
} else {
key = KEY_Reserved;
modifier = MOD_NONE;
isghostkey = 0x00;
}
if (key != KEY_Reserved) { // keycode should be added to report
if (reportIndex >= sizeOfReportBuffer) { // too many keycodes
if (!retval & 0x02) { // Only fill buffer once
memset(reportBuffer+2, KEY_ErrorRollOver, sizeOfReportBuffer-2);
retval |= 0x02; // continue decoding to get modifiers
}
} else {
if (isghostkey) {
// we're in a ghost-key situation
if (bufferContains(oldReportBuffer, key)) {
// this key has been pressed before, so we still send it
reportBuffer[reportIndex] = key; // set next available entry
reportIndex++;
}
} else {
reportBuffer[reportIndex] = key; // set next available entry
reportIndex++;
}
}
}
if (modifier != MOD_NONE) { // modifier should be added to report
reportBuffer[0] |= modifier;
}
}
}
}
retval |= 0x01; // must have been a change at some point, since debounce is done
}
return retval;
}

View File

@ -1,28 +0,0 @@
/**
* \file tools.h
* \brief Function headers and information that is needed in several places
* \author Ronald Schaten <ronald@schatenseite.de>
* \version $Id$
*
* License: GNU GPL v2 (see License.txt)
*/
#define LED_NUM 0x01 ///< num LED on a boot-protocol keyboard
#define LED_CAPS 0x02 ///< caps LED on a boot-protocol keyboard
#define LED_SCROLL 0x04 ///< scroll LED on a boot-protocol keyboard
#define LED_COMPOSE 0x08 ///< compose LED on a boot-protocol keyboard
#define LED_KANA 0x10 ///< kana LED on a boot-protocol keyboard
/**
* This structure can be used as a container for a single 'key'. It consists of
* the key-code and the modifier-code.
*/
typedef struct {
uint8_t mode;
uint8_t key;
} Key;
void sendString(char* string);
void sendKey(Key keytosend);
void usbSendReportBuffer(uint8_t* reportbuffer, uint8_t size);

View File

@ -8,7 +8,7 @@
* It contains parts of the USB driver which can be configured and can or must
* be adapted to your hardware.
* \author Ronald Schaten <ronald@schatenseite.de>
* \version $Id$
* \version $Id: usbconfig.h,v 1.1 2008/07/09 20:47:12 rschaten Exp $
*
* License: GNU GPL v2 (see License.txt)
*/

View File

@ -1,7 +0,0 @@
all: commands.png
clean:
rm -f commands.png
commands.png: commands.gv
dot -Tpng -ocommands.png commands.gv

View File

@ -1,24 +0,0 @@
digraph finite_state_machine {
rankdir=LR;
node [shape = doublecircle, fixedsize = true, width = 1.2, height = 1.2]; standard;
node [shape = circle];
standard -> standard [ label = "any key" ];
standard -> "command\nmode" [ label = "hotkey" ];
"command\nmode" -> standard [ label = "single key command" ];
"command\nmode" -> standard [ label = "invalid key" ];
"command\nmode" -> "macro\ncommand" [ label = "m" ];
"macro\ncommand" -> "macro\ndefinition" [ label = "macro key" ];
"macro\ndefinition" -> "macro\ndefinition" [ label = "any key" ];
"macro\ndefinition" -> standard [ label = "hotkey" ];
"command\nmode" -> "macro\ndelete" [ label = "M" ];
"macro\ndelete" -> standard [ label = "macro key" ];
"command\nmode" -> "complex\ncommand" [ label = "multi key command" ];
"complex\ncommand" -> "complex\ncommand" [ label = "any key" ];
"complex\ncommand" -> standard [ label = "hotkey" ];
"complex\ncommand" -> standard [ label = "invalid key" ];
}