Hello all
Just a quick heads-up. I just helped @trelemar to get his little “Pocket Wargame” to load a map from SD and I noticed I had dropped an important function from the library by accident.
So, if you need to read data from a file on hardware call
pokInitSD();
before you try to fileOpen a file. pokInitSD is a low level call that initializes the GPIO needed to read the SD. It can be called many times, but the main thing is it needs to be called at least once before reading the SD card. I will make it automatic in the future library updates, but for the time being you can add it to your code - there is no harm.
Also, be aware of the following PetitFatFS limitations (PetitFatFS is used because its memory footprint is very small):
- PetitFatFS can not create files. They need to exist on the SD card
- PetitFatFS can not change the file size. So if you need 1mb of data for you game, make a 1mb file on the SD beforehand
- PetitFatFS can not rename/delete files
Good news is that @trelemar’s game is now reading the data from the SD card and it looks absolutely yummy. We’re getting the first AAA release on Pokitto soon!