TM STM32F4xx Libraries  v1.0.0
Libraries for STM32F4xx devices from Tilen Majerle
TM_FATFS_Functions

Library Functions. More...

Functions

FRESULT TM_FATFS_GetDriveSize (char *str, TM_FATFS_Size_t *SizeStruct)
 
FRESULT TM_FATFS_DriveSize (uint32_t *total, uint32_t *free)
 Gets SDCARD drive size and free space. More...
 
FRESULT TM_FATFS_USBDriveSize (uint32_t *total, uint32_t *free)
 Gets USB drive size and free space. More...
 
FRESULT TM_FATFS_TruncateBeginning (FIL *fil, uint32_t index)
 Truncates beginning of file. More...
 
uint8_t TM_FATFS_CheckCardDetectPin (void)
 Checks card detect pin (if activated) if card is inserted. More...
 

Detailed Description

Library Functions.

Function Documentation

uint8_t TM_FATFS_CheckCardDetectPin ( void  )

Checks card detect pin (if activated) if card is inserted.

Note
Pin must be set low in order to get card inserted, otherwise card is not inserted
Card detect pin must be activated in order to get this functionality to work
Parameters
None
Return values
Carddetected status:
  • 0: Card is not inserted
  • > 0: Card is inserted
FRESULT TM_FATFS_DriveSize ( uint32_t *  total,
uint32_t *  free 
)

Gets SDCARD drive size and free space.

Note
Function is deprecated and will be removed, use TM_FATFS_GetDriveSize instead!
Parameters
*totalPointer to variable to store total size of SDCARD
*freePointer to variable to store free space on SDCARD
Return values
FRESULTstructure members. If data are valid, FR_OK is returned
FRESULT TM_FATFS_TruncateBeginning ( FIL *  fil,
uint32_t  index 
)

Truncates beginning of file.

Example:

  • You have a file, its content is: "abcdefghijklmnoprstuvwxyz",
  • You want to truncate first 5 bytes,
  • Call TM_FATFS_TruncateBeginning(&opened_file, 5);
  • You will get new file data: "fghijklmnoprstuvwxyz"
Parameters
*filPointer to already opened file
indexNumber of characters that will be truncated from beginning
Note
If index is more than file size, everything will be truncated, but file will not be deleted
Return values
FRESULTstruct members. If everything ok, FR_OK is returned
FRESULT TM_FATFS_USBDriveSize ( uint32_t *  total,
uint32_t *  free 
)

Gets USB drive size and free space.

Note
Function is deprecated and will be removed, use TM_FATFS_GetDriveSize instead!
Parameters
*totalPointer to variable to store total size of USB disk
*freePointer to variable to store free space on USB disk
Return values
FRESULTstructure members. If data are valid, FR_OK is returned