I want to transfer data from PC to teensy 3.0 via usb serial.
In my scenario chunks of data are files resident on PC.
My idea is to wrap data in a package like this:
COMMAND | DATA_LENGTH | DATA
COMMAND in my case is e.g. transfer - 0x01
DATA_LENGTH would be number of bytes to be transferred. This value would be then decreased for every byte read and so when it hits 0, data would be completely transfered.
I'm not sure yet about DATA_LENGTH which type should it be, since chunks of data can be up to 5MB.
Is this idea in general ok, or there are other, better ways to accomplish this?
In my scenario chunks of data are files resident on PC.
My idea is to wrap data in a package like this:
COMMAND | DATA_LENGTH | DATA
COMMAND in my case is e.g. transfer - 0x01
DATA_LENGTH would be number of bytes to be transferred. This value would be then decreased for every byte read and so when it hits 0, data would be completely transfered.
I'm not sure yet about DATA_LENGTH which type should it be, since chunks of data can be up to 5MB.
Is this idea in general ok, or there are other, better ways to accomplish this?