31 #define TM_GENERAL_H 140
97 #include "stm32f4xx.h"
98 #include "stm32f4xx_rcc.h"
100 #include "attributes.h"
221 #define TM_GENERAL_IsIRQMode() (SCB->ICSR & SCB_ICSR_VECTACTIVE_Msk)
236 #define TM_GENERAL_GetSystemClockMHz() ((uint16_t)(SystemCoreClock * (float)0.000001))
257 #define TM_GENERAL_DWTCounterDisable() (DWT->CTRL &= ~0x00000001)
265 #define TM_GENERAL_DWTCounterGetValue() (DWT->CYCCNT)
273 #define TM_GENERAL_DWTCounterSetValue(x) (DWT->CYCCNT = (x))
285 micros *= (SystemCoreClock / 1000000);
302 millis *= (SystemCoreClock / 1000);
317 #define TM_GENERAL_IsNumberEven(number) ((number & 1) == 0)
350 #define TM_GENERAL_IsNumberPowerOfTwo(number) (number && !(number & (number - 1)))
uint8_t TM_GENERAL_DWTCounterEnable(void)
Enables DWT counter in Cortex-M4 core.
uint32_t TM_GENERAL_NextPowerOf2(uint32_t number)
Calculates next power of 2 from given number.
static __INLINE void TM_GENERAL_DWTCounterDelayus(uint32_t micros)
Delays for amount of microseconds using DWT counter.
Definition: tm_stm32f4_general.h:281
Definition: tm_stm32f4_general.h:154
Definition: tm_stm32f4_general.h:149
static __INLINE void TM_GENERAL_DWTCounterDelayms(uint32_t millis)
Delays for amount of milliseconds using DWT counter.
Definition: tm_stm32f4_general.h:298
Definition: tm_stm32f4_general.h:153
void TM_GENERAL_DisableInterrupts(void)
Disables all interrupts in system.
TM_GENERAL_ResetSource_t TM_GENERAL_GetResetSource(uint8_t reset_flags)
Gets reset source why system was reset.
void TM_GENERAL_SystemResetCallback(void)
System reset callback.
Definition: tm_stm32f4_general.h:137
uint16_t GENERAL_SystemSpeedInMHz
System speed in MHz.
Definition: tm_stm32f4_general.h:156
uint8_t TM_GENERAL_EnableInterrupts(void)
Enables interrupts in system.
Definition: tm_stm32f4_general.h:139
uint32_t Decimal
Definition: tm_stm32f4_general.h:164
void TM_GENERAL_ForceHardFaultError(void)
Forces processor to jump to Hard-fault handler.
Definition: tm_stm32f4_general.h:155
Definition: tm_stm32f4_general.h:150
Definition: tm_stm32f4_general.h:152
Definition: tm_stm32f4_general.h:151
uint32_t TM_GENERAL_GetClockSpeed(TM_GENERAL_Clock_t clock)
Gets specific clock speed value from STM32F4xx device.
Definition: tm_stm32f4_general.h:142
void TM_GENERAL_SystemReset(void)
Performs a system reset.
Definition: tm_stm32f4_general.h:141
float TM_GENERAL_RoundFloat(float Number, uint8_t decimals)
Round float number to nearest number with custom number of decimal places.
Float number operation structure.
Definition: tm_stm32f4_general.h:162
void TM_GENERAL_ConvertFloat(TM_GENERAL_Float_t *Float_Struct, float Number, uint8_t decimals)
Converts float coded number into integer and decimal part.
TM_GENERAL_Clock_t
Clock speed enumeration.
Definition: tm_stm32f4_general.h:136
#define TM_GENERAL_DWTCounterGetValue()
Gets current DWT counter value.
Definition: tm_stm32f4_general.h:265
Definition: tm_stm32f4_general.h:140
int32_t Integer
Definition: tm_stm32f4_general.h:163
TM_GENERAL_ResetSource_t
All possible reset sources.
Definition: tm_stm32f4_general.h:148
Definition: tm_stm32f4_general.h:138