I recently purchased an Atmel USBkey dev kit (AT90USB1287) and have been trying to under stand how the mass storage example works so I can modify it (and save the USB driver-foo I do not understand) to work when not connected to a computer and display text files to an LCD display. The example code is the demo project the board comes programmed with (also found here I think http://www.atmel.com/dyn/resourc... ) My general idea at the moment is just to display text to the lcd and "page" up and down via buttons on GPIO.
As far as I understand, the current setup loops forever in the scheduler waiting for USB stuff to happen from the host computer. The driver stuff is really confusing to me. Can I detect if the device is not connected to the computer and if so break to my own code?
Also, is it even going to be possible to use the FAT code in the example to manually open a file/show files in a directory? Looking through the code I don't see an easy way to list all the files in a directory or even work with a directory but maybe I just need to read the code a bit more. I could switch to an SD cad with Fatfs which I have read about but then it looks like I would lose USB support which would be nice.
Thank you for your advice