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

Library Functions. More...

Functions

uint8_t TM_CPULOAD_Init (TM_CPULOAD_t *CPU_Load)
 Initializes DWT functionality for sleep counter and prepares everything for CPU LOAD measurement. More...
 
uint8_t TM_CPULOAD_GoToSleepMode (TM_CPULOAD_t *CPU_Load, TM_LOWPOWERMODE_t PowerMode)
 Goes to low power mode and measures sleeping time and working time using DWT cycle counter. More...
 

Detailed Description

Library Functions.

Function Documentation

uint8_t TM_CPULOAD_GoToSleepMode ( TM_CPULOAD_t CPU_Load,
TM_LOWPOWERMODE_t  PowerMode 
)

Goes to low power mode and measures sleeping time and working time using DWT cycle counter.

Note
You need wake up source, otherwise you might stay forever inside low power mode
Parameters
*CPU_LoadPointer to TM_CPULOAD_t structure
PowerModeSelect power mode you want to use for measure CPU load. Valid parameters are:
  • TM_LOWPOWERMODE_SleepUntilInterrupt: Go to sleep mode with __WFI() instruction
  • TM_LOWPOWERMODE_SleepUntilEvent: Go to sleep mode with __WFE() instruction
Return values
CPUload value updated status.
  • 0: CPU load value is not updated, still old results
  • > 0: CPU load value is updated
uint8_t TM_CPULOAD_Init ( TM_CPULOAD_t CPU_Load)

Initializes DWT functionality for sleep counter and prepares everything for CPU LOAD measurement.

Parameters
*CPU_LoadPointer to empty TM_CPULOAD_t structure
Return values
ReturnsDWT counter status:
  • 0: DWT counter has not started, measurement will fail
  • > 0: DWT counter has started, everything OK