100,7 → 100,7 |
|
void main() |
{ |
|
unsigned int8 data[64]; |
unsigned int8 replyBuf[4]; |
unsigned int8 i=0; |
|
121,7 → 121,21 |
output_high(PIN_B4); |
|
usb_init(); |
usb_wait_for_enumeration(); |
|
|
printf("device enumerated \n\r "); |
|
if(usb_tbe(0)) printf(" endpoint 0 ready \n\r "); |
else printf(" endpoint 0 disabled \n\r "); |
if(usb_tbe(1)) printf(" endpoint 1 ready \n\r "); |
else printf(" endpoint 1 disabled \n\r "); |
if(usb_tbe(2)) printf(" endpoint 2 ready \n\r "); |
else printf(" endpoint 2 disabled \n\r "); |
|
if(usb_puts(0,data,64,1000)) printf(" endpoint 0 inicialized \n\r "); |
else printf("cannot write to endpoint 0 \n\r "); |
|
while (TRUE) { |
if (usb_enumerated()) |
{ |
176,12 → 190,14 |
if(usb_kbhit(i)) |
{ |
printf(" data received at endpoint %d \n\r ", i); |
usb_gets(i,data,64,1000); |
} |
|
delay_ms(10); |
|
output_high(PIN_B4); |
i++; |
if( i==1 )i=0; |
else i=1; |
} |
} |
} |