Page 1 of 1

check if device is ready to recieve

Posted: Sat Feb 11, 2012 8:11 pm
by ageurtse
hello is there a way to check if my device is ready to recieve the next portion of data.
i need to send 8 portion's of 128 bytes.

now i wan't to know if the device is ready to recieve the next portion of 128 byte's.

i think that my host transmits to much data to the device. so i wan't to control it by telling it to wait for the device.

but how can i do that.

Re: check if device is ready to recieve

Posted: Mon Feb 13, 2012 3:59 am
by ulao
Well normal you wait for the host, then send 8 at a time. This is using a interrupt end point.

while (!usbInterruptIsReady()){usbPoll(); } usbSetInterrupt((void *)&reportBuffer + 0, 8 ); //once ready send 8 bytes
while (!usbInterruptIsReady()){usbPoll(); } usbSetInterrupt((void *)&reportBuffer + 8, 5); // now wait for ready again and send 5 more.

I have only ever taken this up to 16 but I dont see why it wont go to 128.

while (!usbInterruptIsReady()){usbPoll(); } usbSetInterrupt((void *)&reportBuffer + 0, 8 );
while (!usbInterruptIsReady()){usbPoll(); } usbSetInterrupt((void *)&reportBuffer + 8, 8 );
while (!usbInterruptIsReady()){usbPoll(); } usbSetInterrupt((void *)&reportBuffer + 16, 8 );
while (!usbInterruptIsReady()){usbPoll(); } usbSetInterrupt((void *)&reportBuffer + 24, 8 );
...