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...

Macros

#define TM_STRING_GetCount(str)    ((str)->Count)
 Gets number of strings in a string array. More...
 

Functions

TM_STRING_tTM_STRING_Create (uint16_t count)
 Creates and allocated string structure and memory for pointers for desired number of strings. More...
 
uint16_t TM_STRING_AddString (TM_STRING_t *String, char *str)
 Adds new string to main string structure. More...
 
TM_STRING_tTM_STRING_ReplaceString (TM_STRING_t *String, uint16_t pos, char *str)
 Replaces already added string with new string. More...
 
TM_STRING_tTM_STRING_DeleteString (TM_STRING_t *String, uint16_t pos)
 Deletes string from strings array. More...
 
char * TM_STRING_GetString (TM_STRING_t *String, uint16_t pos)
 Gets pointer to string at desired position. More...
 
void TM_STRING_FreeAll (TM_STRING_t *String)
 Free all. It will free all strings, all pointers to strings and also main string structure. More...
 
void TM_STRING_Free (TM_STRING_t *String)
 Free main structure and pointer to all pointers. More...
 

Detailed Description

Library Functions.

Macro Definition Documentation

#define TM_STRING_GetCount (   str)    ((str)->Count)

Gets number of strings in a string array.

Parameters
*StringPointer to TM_STRING_t structure
Return values
Numberof strings in array
Note
Defined as macro for faster execution

Function Documentation

uint16_t TM_STRING_AddString ( TM_STRING_t String,
char *  str 
)

Adds new string to main string structure.

Note
Function uses malloc() to allocate memory for string where it will copy it. Memory size for allocation is string length + 1
Parameters
*StringPointer to TM_STRING_t structure
*strPointer to string to be added to string
Return values
Stringposition in strings array
TM_STRING_t* TM_STRING_Create ( uint16_t  count)

Creates and allocated string structure and memory for pointers for desired number of strings.

Note
Function uses malloc() to allocate main structure and all pointers depending on count variable, so make sure that you have enough HEAP memory reserved
Parameters
countNumber of strings you will use. Set to 1, if you don't know how many of them will be used. It's recommended that you select the number which is greater or equal to count of all strings
Return values
Pointerto allocated TM_STRING_t structure or NULL of malloc() fails
TM_STRING_t* TM_STRING_DeleteString ( TM_STRING_t String,
uint16_t  pos 
)

Deletes string from strings array.

Parameters
*StringPointer to TM_STRING_t structure
posPosition number in string array which string will be deleted. This number can be a value between 0 and number of strings - 1
Return values
Pointerto TM_STRING_t structure
void TM_STRING_Free ( TM_STRING_t String)

Free main structure and pointer to all pointers.

Note
This is not meant for public use unless you know what you are doing. It will deallocate structure, but all strings will stay untouched in heap memory! Use TM_STRING_FreeAll() instead.
Parameters
*StringPointer to TM_STRING_t structure
void TM_STRING_FreeAll ( TM_STRING_t String)

Free all. It will free all strings, all pointers to strings and also main string structure.

Note
Use TM_STRING_DeleteString() to delete only one string if needed
Parameters
*StringPointer to TM_STRING_t structure
Return values
None
char* TM_STRING_GetString ( TM_STRING_t String,
uint16_t  pos 
)

Gets pointer to string at desired position.

Parameters
*StringPointer to TM_STRING_t structure
posPosition number in string array which string pointer will be returned. This number can be a value between 0 and number of strings - 1
Return values
Pointerto string at desired position in string array
TM_STRING_t* TM_STRING_ReplaceString ( TM_STRING_t String,
uint16_t  pos,
char *  str 
)

Replaces already added string with new string.

Note
If new string is larger than string before, new memory is allocated and old is free, but if new string length is smaller than old, only new string is copied to already allocateed memory
Parameters
*StringPointer to TM_STRING_t structure
posPosition in array where to replace string
*strPointer to new string which will be applied to memory
Return values
Pointerto TM_STRING_t structure