TM STM32Fxxx HAL Libraries  v1.0.0
Libraries for STM32Fxxx (F0, F4 and F7 series) devices based on HAL drivers from ST from Tilen Majerle

Library Functions. More...

Functions

FRESULT TM_FATFS_GetDriveSize (char *str, TM_FATFS_Size_t *SizeStruct)
 
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...
 
FRESULT TM_FATFS_Search (char *Folder, char *tmp_buffer, uint16_t tmp_buffer_size, TM_FATFS_Search_t *FindStructure)
 Searches on SD card for files and folders. More...
 
uint8_t TM_FATFS_SearchCallback (char *path, uint8_t is_file, TM_FATFS_Search_t *FindStructure)
 Search procedure callback function with filename result. 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_Search ( char *  Folder,
char *  tmp_buffer,
uint16_t  tmp_buffer_size,
TM_FATFS_Search_t FindStructure 
)

Searches on SD card for files and folders.

Note
It will search recursive till the end of everything or if tmp_buffer is full
Parameters
*FolderFolder start location where search will be performed
*tmp_bufferPointer to empty buffer where temporary data for filepath will be stored. It's size must be larger than bigest filepath on FATFS. Set this parameter to NULL and function will use LIB_ALLOC_FUNC() to allocate memory for tmp buffer of size
  • tmp_buffer_size
tmp_buffer_sizeNumber of bytes reserver for tmp_buffer so we won't overlaps buffer
*FindStructurePointer to TM_FATFS_Search_t structure
Return values
Memberof FRESULT enumeration
uint8_t TM_FATFS_SearchCallback ( char *  path,
uint8_t  is_file,
TM_FATFS_Search_t FindStructure 
)

Search procedure callback function with filename result.

Parameters
*pathFull path and file/folder name from search operation
is_fileIs item a file or directory:
  • 0: Item is folder
  • > 0: Item is file
Pointerto TM_FATFS_Search_t structure which was passed to TM_FATFS_Search with updated data
Return values
Searchstatus:
  • 0: Stop search operation
  • > 0: Continue with search
Note
With __weak parameter to prevent link errors if not defined by user
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
Memberof FRESULT enumeration