It was initially based on (stolen from) Fernando Rodriguez's implementation and is pretty thoroughly tested. The two big changes I made were to rewrite it in C++ with a focus on shorter more readable methods and adding a cache behind the file system. I've used it for reading SD cards on a Raspberry Pi Pico but it's ultimately supposed to be the file system for a 65C816 based computer.
A good starting point is:
FatFile.h
FatFile.cpp
that includes the Open, Close, Write, Read, Seek, Flush, Truncate, Tell and Size methods.
and from there backing up to the:
FatCommon.h
file that defines all of the FAT file structures.
then if you're brave take a look in:
FatVolume.h
FatVolume.cpp
that finally do the work to deal with the awful mangled cluster system that is FAT.
a FAT Volume sits on top of an implementation of a:
FileDrive.h
FileDrive.cpp
that is some form of block device. In my case an SD card whose implementation is in another library.
Tests can be found in:
TestFat32.cpp
TestFatCache.cpp
If you want to get this compiling and running you'll need Windows with Visual Studio 2019 and then clone the two repositories:
Code: Select all
git@github.com:andrewpaterson/Codaphela.Library.gitCode: Select all
git@github.com:andrewpaterson/Codaphela.Test.git