Subversion Repositories group.electronics

Rev

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

Rev 34 Rev 35
Line 124... Line 124...
124
  /*
124
  /*
125
	PD0	- Input, Pullup, PCINT16	- Rotary 1a
125
	PD0	- Input, Pullup, PCINT16	- Rotary 1a
126
	PD1	- Input, Pullup, PCINT17	- Rotary 1b
126
	PD1	- Input, Pullup, PCINT17	- Rotary 1b
127
 
127
 
128
 
128
 
129
	PD4	- Input, Pullup		- Keypad 5
129
	PD4	- Output		- Keypad select status led
130
	PD5	- Input, Pullup		- Keypad 6
130
	PD5	- Input, Pullup		- Keypad 6
131
	PD6	- Input, Pullup		- Keypad 7
131
	PD6	- Input, Pullup		- Keypad 7
132
	PD7	- Input, Pullup		- Keypad 8
132
	PD7	- Input, Pullup		- Keypad 8
133
  */
133
  */
134
  DDRD		= 0B00000000;
134
  DDRD		= 0B00010000;
135
  PORTD		= 0B11110011;
135
  PORTD		= 0B11100011;
136
 
136
 
137
  PCMSK2 |= (( 1 << PCINT16 ) | ( 1 << PCINT17 )); //enable encoder pins interrupt sources
137
  PCMSK2 |= (( 1 << PCINT16 ) | ( 1 << PCINT17 )); //enable encoder pins interrupt sources
138
  PCICR |= ( 1 << PCIE2 ); //enable pin change interupts
138
  PCICR |= ( 1 << PCIE2 ); //enable pin change interupts
139
 
139
 
140
  // Timers not used for the moment
140
  // Timers not used for the moment
Line 164... Line 164...
164
	reportJoystick.data2 = 0x0000;
164
	reportJoystick.data2 = 0x0000;
165
 
165
 
166
 
166
 
167
	uint8_t key = getKey();
167
	uint8_t key = getKey();
168
	if (rbi(PINB, PB5)) {
168
	if (rbi(PINB, PB5)) {
-
 
169
		cbi(PORTD, PD5);
169
		// Keypad is joystick
170
		// Keypad is joystick
170
		if (key > 0)
171
		if (key > 0)
171
			reportJoystick.data2 |= (1 << (key -1));
172
			reportJoystick.data2 |= (1 << (key -1));
172
	} else {
173
	} else {
-
 
174
		sbi(PORTD, PD5);
173
		// Keypad is keyboard
175
		// Keypad is keyboard
174
		if (key > 0) {
176
		if (key > 0) {
175
			reportKeyboard.modifier = 0x00;
177
			reportKeyboard.modifier = 0x00;
176
			if (key==10 || key==12)
178
			if (key==10 || key==12)
177
				reportKeyboard.modifier |= (1<<1);	//Left shif
179
				reportKeyboard.modifier |= (1<<1);	//Left shif