Code: Select all
usbMsgLen_t usbFunctionSetup(uchar setupData[8])
{
usbRequest_t *rq = (void *)setupData; // cast to structured data for parsing
switch(rq->bRequest){
case 1:
setLEDStatus(rq->wValue.bytes[0]); // evaluate low byte only
return 0; // no data block sent or received
}
return 0; // ignore all unknown requests
}
I know this is basic stuff,I'm trying to figure out how this function receives 8 separate bytes and stores it in to this structure:
Code: Select all
typedef struct usbRequest{
uchar bmRequestType;
uchar bRequest;
usbWord_t wValue;
usbWord_t wIndex;
usbWord_t wLength;
}usbRequest_t;
My guess is that it takes 1 byte at a time until an ACK is received. Each time a byte is received how is the data parsed separately into its appropriate place?
Code: Select all
switch(rq->bRequest)
Does this line point to the structure usbRequest and not usbRequest_t?