I'm using the "LaunchPad MSP430F5529 USB Evaluation Kit", and I'm editing the sample code "emulStorageKeyboard" to add a function for append in a file the data read from the adc converter.
the function is :
void saveStrToFile(char* path)
{
FIL fileObj; // FatFs file object
FATFS fileSysObj; // FatFs handle for a volume
FRESULT result; // Stores FatFS result codes
WORD bytesWrite; // Returns the number of bytes actually write
// We fetch the string each button press, in case the user changed it via
// the host OS, which they can do at any time.
// Mount the volume and open the file
f_mount(0, &fileSysObj);
result = f_open(&fileObj, (TCHAR*)path, FA_OPEN_ALWAYS | FA_WRITE);
f_lseek (&fileObj,f_size(&fileObj));
// It's possible the user could delete the file, so we check for this.
if (result == FR_OK)
{
// Write the file and close it
btnStrLen = strlen(btnStr);
result = f_write(&fileObj, btnStr, btnStrLen, &bytesWrite);
f_sync(&fileObj);
f_close(&fileObj);
f_mount(0, NULL);
}
}
with the debugger I see that the data is written to the memory " storageVol []" (address 0x10000" ) but if open the file from Windows Explorer I can not find the data.