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

Library Functions. More...

Macros

#define TM_DELAY_Time()   (TM_Time)
 Gets the TM_Time variable value. More...
 
#define TM_DELAY_SetTime(time)   (TM_Time = (time))
 Sets value for TM_Time variable. More...
 
#define TM_DELAY_Time2()   (TM_Time2)
 Gets the TM_Time2 variable value. More...
 
#define TM_DELAY_SetTime2(time)   (TM_Time2 = (time))
 Sets value for TM_Time variable. More...
 

Functions

static __INLINE void Delay (uint32_t micros)
 
static __INLINE void Delayms (uint32_t millis)
 
void TM_DELAY_Init (void)
 Initializes timer settings for delay. More...
 
void TM_DELAY_EnableDelayTimer (void)
 Re-enables delay timer It has to be configured before with TM_DELAY_Init() More...
 
void TM_DELAY_DisableDelayTimer (void)
 Disables delay timer. More...
 
TM_DELAY_Timer_tTM_DELAY_TimerCreate (uint32_t ReloadValue, uint8_t AutoReload, uint8_t StartTimer, void(*TM_DELAY_CustomTimerCallback)(void *), void *UserParameters)
 Creates a new custom timer which has 1ms resolution. More...
 
void TM_DELAY_TimerDelete (TM_DELAY_Timer_t *Timer)
 Deletes already allocated timer. More...
 
TM_DELAY_Timer_tTM_DELAY_TimerStop (TM_DELAY_Timer_t *Timer)
 Stops custom timer from counting. More...
 
TM_DELAY_Timer_tTM_DELAY_TimerStart (TM_DELAY_Timer_t *Timer)
 Starts custom timer counting. More...
 
TM_DELAY_Timer_tTM_DELAY_TimerReset (TM_DELAY_Timer_t *Timer)
 Resets custom timer counter value. More...
 
TM_DELAY_Timer_tTM_DELAY_TimerAutoReload (TM_DELAY_Timer_t *Timer, uint8_t AutoReload)
 Sets auto reload feature for timer. More...
 
TM_DELAY_Timer_tTM_DELAY_TimerAutoReloadValue (TM_DELAY_Timer_t *Timer, uint32_t AutoReloadValue)
 Sets auto reload value for timer. More...
 
__weak void TM_DELAY_1msHandler (void)
 User function, called each 1ms when interrupt from timer happen. More...
 

Detailed Description

Library Functions.

Macro Definition Documentation

#define TM_DELAY_SetTime (   time)    (TM_Time = (time))

Sets value for TM_Time variable.

Parameters
timeTime in milliseconds
Return values
None
#define TM_DELAY_SetTime2 (   time)    (TM_Time2 = (time))

Sets value for TM_Time variable.

Parameters
timeTime in milliseconds
Return values
None
Note
This is not meant for public use
#define TM_DELAY_Time ( )    (TM_Time)

Gets the TM_Time variable value.

Parameters
None
Return values
Currenttime in milliseconds
#define TM_DELAY_Time2 ( )    (TM_Time2)

Gets the TM_Time2 variable value.

Parameters
None
Return values
Currenttime in milliseconds
Note
This is not meant for public use

Function Documentation

static __INLINE void Delay ( uint32_t  micros)
static
Parameters
Delaysfor specific amount of microseconds
microsTime in microseconds for delay
Return values
None
Note
Declared as static inline
static __INLINE void Delayms ( uint32_t  millis)
static
Parameters
Delaysfor specific amount of milliseconds
millisTime in milliseconds for delay
Return values
None
Note
Declared as static inline
__weak void TM_DELAY_1msHandler ( void  )

User function, called each 1ms when interrupt from timer happen.

Note
Here user should put things which has to be called periodically
Parameters
None
Return values
None
Note
With __weak parameter to prevent link errors if not defined by user
void TM_DELAY_DisableDelayTimer ( void  )

Disables delay timer.

Note
This function disables delay timer. It can be systick or user selectable timer.
Parameters
None
Return values
None
void TM_DELAY_EnableDelayTimer ( void  )

Re-enables delay timer It has to be configured before with TM_DELAY_Init()

Note
This function enables delay timer. It can be systick or user selectable timer.
Parameters
None
Return values
None
void TM_DELAY_Init ( void  )

Initializes timer settings for delay.

Note
This function will initialize Systick or user timer, according to settings
Parameters
None
Return values
None
TM_DELAY_Timer_t* TM_DELAY_TimerAutoReload ( TM_DELAY_Timer_t Timer,
uint8_t  AutoReload 
)

Sets auto reload feature for timer.

Note
Auto reload features is used for timer which starts again when zero is reached if auto reload active
Parameters
*TimerPointer to TM_DELAY_Timer_t structure uint8_t AutoReload: Set to 1 if you want to enable AutoReload or 0 to disable
Return values
Pointerto TM_DELAY_Timer_t structure
TM_DELAY_Timer_t* TM_DELAY_TimerAutoReloadValue ( TM_DELAY_Timer_t Timer,
uint32_t  AutoReloadValue 
)

Sets auto reload value for timer.

Parameters
*TimerPointer to TM_DELAY_Timer_t structure
AutoReloadValueValue for timer to be set when zero is reached and callback is called
Note
AutoReload feature must be enabled for timer in order to get this to work properly
Return values
Pointerto TM_DELAY_Timer_t structure
TM_DELAY_Timer_t* TM_DELAY_TimerCreate ( uint32_t  ReloadValue,
uint8_t  AutoReload,
uint8_t  StartTimer,
void(*)(void *)  TM_DELAY_CustomTimerCallback,
void *  UserParameters 
)

Creates a new custom timer which has 1ms resolution.

Note
It uses malloc for memory allocation for timer structure
Parameters
ReloadValueNumber of milliseconds when timer reaches zero and callback function is called
AutoReloadIf set to 1, timer will start again when it reaches zero and callback is called
StartTimerIf set to 1, timer will start immediately
*TM_DELAY_CustomTimerCallbackPointer to callback function which will be called when timer reaches zero
*UserParametersPointer to void pointer to user parameters used as first parameter in callback function
Return values
Pointerto allocated timer structure
void TM_DELAY_TimerDelete ( TM_DELAY_Timer_t Timer)

Deletes already allocated timer.

Parameters
*TimerPointer to TM_DELAY_Timer_t structure
Return values
None
TM_DELAY_Timer_t* TM_DELAY_TimerReset ( TM_DELAY_Timer_t Timer)

Resets custom timer counter value.

Parameters
*TimerPointer to TM_DELAY_Timer_t structure
Return values
Pointerto TM_DELAY_Timer_t structure
TM_DELAY_Timer_t* TM_DELAY_TimerStart ( TM_DELAY_Timer_t Timer)

Starts custom timer counting.

Parameters
*TimerPointer to TM_DELAY_Timer_t structure
Return values
Pointerto TM_DELAY_Timer_t structure
TM_DELAY_Timer_t* TM_DELAY_TimerStop ( TM_DELAY_Timer_t Timer)

Stops custom timer from counting.

Parameters
*TimerPointer to TM_DELAY_Timer_t structure
Return values
Pointerto TM_DELAY_Timer_t structure