I tried to copy the whole content of "data" to global array to deal with it as shown in the for loop below :
Code: Select all
volatile static uchar myData[8];
uchar usbFunctionWrite(uchar *data, uchar len)
{
if(bytesRemaining == 0)
return 1; /* end of transfer */
if(len > bytesRemaining)
len = bytesRemaining;
currentAddress += len;
bytesRemaining -= len;
// copy the whole content of "data"
uchar i;
for ( i=0 ; i<len ; i++ ){
myData[i] = data[i];
}
return bytesRemaining == 0; /* return 1 if this was the last chunk */
}
But when trying to send it to the host it seems that my array "myData" is empty and the host prints all zeros, the code below shows how I tried to send it to the host :
Code: Select all
uchar usbFunctionRead(uchar *data, uchar len)
{
if(len > bytesRemaining)
len = bytesRemaining;
uchar i;
for ( i=0 ; i<len ; i++ ){
data[i] = myData[i];
}
currentAddress += len;
bytesRemaining -= len;
return len;
}
Am I doing something wrongly?
Thanks for the advice.