/* usb test for communications between host and device
designed by takefuji on Dec.27, 2007 */

#include <avr/io.h>
#include <avr/wdt.h>
#include <avr/eeprom.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
#include <util/delay.h>

#include "usbdrv.h"
#include "oddebug.h"

uchar usbFunctionSetup(uchar data[8])
{
static uchar replybuf[8];	
usbMsgPtr = replybuf;
unsigned char c=data[1];

if(c=='0'){
	DDRB=0x02;
	PORTB=0x0;
	replybuf[0]=c; 
	return 1;}
else if(c=='1'){
	DDRB=0x02;
	PORTB=0x02;
	replybuf[0]=c; 
	return 1;}
return 0;
}


int main(void)
{ 
    usbInit();
    sei();
    for(;;){    /* main event loop */
        usbPoll();
        }
    return 0;
}

