Part Number: MSP430FR5994
I am struggling understanding how the struct FIL gets its pointer to the filesystem (FATFS).
In the code sample, SDCardLib instantiates the filesystem with:
FATFS fatfs; //FatFs handle for current FatFs operation session
and just prior to that, the FIL struct was instantiated as
static FIL fil;
fil holds the *fs pointer to the FATFS filesystem.
I understand that f_open() is suppose to populate an empty fil object (It takes an empty fil object and a pointer to the path/filename),
If so, then how does f_open() get the filesystem fatfs handle (created in SdCardLib) so that it can assign it to the *fs pointer in fil? If f_open() doesn't fill in the fs pointer, then how did FIL know where the pointer was if the SDCardLib object (holding the fatfs handle) was instantiated afterwards?
The ChaN website has a lot of useful information but I haven't found where it describes how FIL interacts with FATFS.
Some guidance here is most welcomed. thank you.