Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Simple USB Read with callback question
PostPosted: Fri Aug 12, 2011 4:59 pm 
Offline

Joined: Thu Jul 28, 2011 4:14 pm
Posts: 8
I have a very simple question about USB reads with call backs.

I want to set up a read to a buffer then wait until the transfer is complete before using the data in the buffer. This is how I am currently doing it:

volatile unsigned char readArrayLock = 0;

//USB read callback
void readNextDataArrayCallback(void *pArg, unsigned char status, unsigned int transfered, unsigned int remaining){
readArrayLock = 0;
}

//To read the usb data
readArrayLock = ! USBD_Read(0x2, g_pucDataArray, g_iDataPacketSize, (TransferCallback)readNextDataArrayCallback, 0);
// waiting
while (readArrayLocked);
//Then use data

The problem I am having is that the interupt never seems to be called whilst in the while loop. If i comment out the while loop the interupt is called.

How can I fix this? Or is there a better method for achiving the same thing?

Thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron