Subversion Repositories group.electronics

Rev

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

Rev 63 Rev 64
Line 183... Line 183...
183
	PD5	- Input, Pullup		- Keypad 3
183
	PD5	- Input, Pullup		- Keypad 3
184
	PD6	- Input, Pullup		- Keypad 1
184
	PD6	- Input, Pullup		- Keypad 1
185
	PD7	- Input, Pullup		- Keypad 5
185
	PD7	- Input, Pullup		- Keypad 5
186
  */
186
  */
187
  DDRD		= 0B00010000;
187
  DDRD		= 0B00010000;
188
  PORTD		= 0B11100011;
188
  PORTD		= 0B11110011;
189
 
189
 
190
  PCMSK2 |= (( 1 << PCINT16 ) | ( 1 << PCINT17 )); //enable encoder pins interrupt sources
190
  PCMSK2 |= (( 1 << PCINT16 ) | ( 1 << PCINT17 )); //enable encoder pins interrupt sources
191
  PCICR |= ( 1 << PCIE2 ); //enable pin change interupts
191
  PCICR |= ( 1 << PCIE2 ); //enable pin change interupts
192
 
192
 
193
  // Timers not used for the moment
193
  // Timers not used for the moment
Line 198... Line 198...
198
 
198
 
199
	TIMSK2 = (1<<TOIE2);
199
	TIMSK2 = (1<<TOIE2);
200
	TCNT2 = 0x00;
200
	TCNT2 = 0x00;
201
	TCCR2B = (1<<CS21 | 1<<CS20);
201
	TCCR2B = (1<<CS21 | 1<<CS20);
202
 
202
 
-
 
203
	sei();
203
	i2c_master();
204
	i2c_master();
204
	lcd_init();
205
	lcd_init();
205
	lcd_createChar(0x00, emblock);
206
	lcd_createChar(0x00, emblock);
206
 
207
 
207
	char strTime[] = {'T', 'i', 'm', 'e', ':', 0x00};
208
	char strTime[] = {'T', 'i', 'm', 'e', ':', 0x00};
Line 212... Line 213...
212
	_delay_ms(500);
213
	_delay_ms(500);
213
	usbDeviceConnect();
214
	usbDeviceConnect();
214
 
215
 
215
	wdt_enable(WDTO_1S);
216
	wdt_enable(WDTO_1S);
216
	usbInit();
217
	usbInit();
217
	sei();
218
	//sei();
218
 
219
 
219
	reportKeyboard.report_id = 1;
220
	reportKeyboard.report_id = 1;
220
	reportJoystick.report_id = 2;
221
	reportJoystick.report_id = 2;
221
 
222
 
-
 
223
	cbi(PORTD, PD4);
222
  for(;;) {
224
  for(;;) {
223
    wdt_reset();
225
    wdt_reset();
224
    usbPoll();
226
    usbPoll();
225
 
227
 
226
	/*
228
	/*
Line 329... Line 331...
329
	usbSendHidReport(&reportKeyboard, sizeof(reportKeyboard));
331
	usbSendHidReport(&reportKeyboard, sizeof(reportKeyboard));
330
	usbSendHidReport(&reportJoystick, sizeof(reportJoystick));
332
	usbSendHidReport(&reportJoystick, sizeof(reportJoystick));
331
 
333
 
332
    }
334
    }
333
 
335
 
334
	usbPoll();
-
 
335
	if (lcdupdate) {
336
	if (lcdupdate) {
-
 
337
		usbPoll();
336
		lcdupdate = 0;
338
		lcdupdate = 0;
337
 
339
 
338
                char syschar[10];
340
                char syschar[10];
339
                ultoa(systime, syschar, 10);
341
                ultoa(systime, syschar, 10);
340
                lcd_overprint_right(syschar, 10, 5, 1);
342
                lcd_overprint_right(syschar, 10, 5, 1);
Line 351... Line 353...
351
                        // Set percentage
353
                        // Set percentage
352
                        lcd_setCursor(15, 0);
354
                        lcd_setCursor(15, 0);
353
                        lcd_char(0x25);
355
                        lcd_char(0x25);
354
                }
356
                }
355
 
357
 
356
 
-
 
357
	}
358
	}
358
 
359
 
359
  }
360
  }
360
}
361
}
361
 
362
 
Line 437... Line 438...
437
ISR(TIMER2_OVF_vect) {
438
ISR(TIMER2_OVF_vect) {
438
        tmr2_ovf++;
439
        tmr2_ovf++;
439
        if (tmr2_ovf>=58) {
440
        if (tmr2_ovf>=58) {
440
                lcdupdate=1;
441
                lcdupdate=1;
441
                tmr2_ovf = 0;
442
                tmr2_ovf = 0;
-
 
443
	//xbi(PORTD, PD4);
442
        }
444
        }
443
}
445
}
444
 
446
 
445
 
447
 
446
ISR(PCINT0_vect) {
448
ISR(PCINT0_vect) {