Prusa MINI Firmware overview

HAL Control functions. More...

Collaboration diagram for HAL Control functions:

Functions

void HAL_IncTick (void)
 This function is called to increment a global variable "uwTick" used as application time base. More...
 
void HAL_Delay (uint32_t Delay)
 This function provides minimum delay (in milliseconds) based on variable incremented. More...
 
uint32_t HAL_GetTick (void)
 Provides a tick value in millisecond. More...
 
uint32_t HAL_GetTickPrio (void)
 This function returns a tick priority. More...
 
HAL_StatusTypeDef HAL_SetTickFreq (HAL_TickFreqTypeDef Freq)
 Set new tick Freq. More...
 
HAL_TickFreqTypeDef HAL_GetTickFreq (void)
 Return tick frequency. More...
 
void HAL_SuspendTick (void)
 Suspend Tick increment. More...
 
void HAL_ResumeTick (void)
 Resume Tick increment. More...
 
uint32_t HAL_GetHalVersion (void)
 Returns the HAL revision. More...
 
uint32_t HAL_GetREVID (void)
 Returns the device revision identifier. More...
 
uint32_t HAL_GetDEVID (void)
 Returns the device identifier. More...
 
void HAL_DBGMCU_EnableDBGSleepMode (void)
 Enable the Debug Module during SLEEP mode. More...
 
void HAL_DBGMCU_DisableDBGSleepMode (void)
 Disable the Debug Module during SLEEP mode. More...
 
void HAL_DBGMCU_EnableDBGStopMode (void)
 Enable the Debug Module during STOP mode. More...
 
void HAL_DBGMCU_DisableDBGStopMode (void)
 Disable the Debug Module during STOP mode. More...
 
void HAL_DBGMCU_EnableDBGStandbyMode (void)
 Enable the Debug Module during STANDBY mode. More...
 
void HAL_DBGMCU_DisableDBGStandbyMode (void)
 Disable the Debug Module during STANDBY mode. More...
 
void HAL_EnableCompensationCell (void)
 Enables the I/O Compensation Cell. More...
 
void HAL_DisableCompensationCell (void)
 Power-down the I/O Compensation Cell. More...
 
void HAL_GetUID (uint32_t *UID)
 Return the unique device identifier (UID based on 96 bits) More...
 

Detailed Description

HAL Control functions.

 ===============================================================================
                      ##### HAL Control functions #####
 ===============================================================================
    [..]  This section provides functions allowing to:
      (+) Provide a tick value in millisecond
      (+) Provide a blocking delay in millisecond
      (+) Suspend the time base source interrupt
      (+) Resume the time base source interrupt
      (+) Get the HAL API driver version
      (+) Get the device identifier
      (+) Get the device revision identifier
      (+) Enable/Disable Debug module during SLEEP mode
      (+) Enable/Disable Debug module during STOP mode
      (+) Enable/Disable Debug module during STANDBY mode

Function Documentation

◆ HAL_IncTick()

__weak void HAL_IncTick ( void  )

This function is called to increment a global variable "uwTick" used as application time base.

Note
In the default implementation, this variable is incremented each 1ms in SysTick ISR.
This function is declared as __weak to be overwritten in case of other implementations in user file.
Return values
None
329 {
330  uwTick += uwTickFreq;
331 }
Here is the caller graph for this function:

◆ HAL_Delay()

__weak void HAL_Delay ( uint32_t  Delay)

This function provides minimum delay (in milliseconds) based on variable incremented.

Note
In the default implementation , SysTick timer is the source of time base. It is used to generate interrupts at regular time intervals where uwTick is incremented.
This function is declared as __weak to be overwritten in case of other implementations in user file.
Parameters
Delayspecifies the delay time length, in milliseconds.
Return values
None
394 {
395  uint32_t tickstart = HAL_GetTick();
396  uint32_t wait = Delay;
397 
398  /* Add a freq to guarantee minimum wait */
399  if (wait < HAL_MAX_DELAY)
400  {
401  wait += (uint32_t)(uwTickFreq);
402  }
403 
404  while((HAL_GetTick() - tickstart) < wait)
405  {
406  }
407 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ HAL_GetTick()

__weak uint32_t HAL_GetTick ( void  )

Provides a tick value in millisecond.

Note
This function is declared as __weak to be overwritten in case of other implementations in user file.
Return values
tickvalue
340 {
341  return uwTick;
342 }
Here is the caller graph for this function:

◆ HAL_GetTickPrio()

uint32_t HAL_GetTickPrio ( void  )

This function returns a tick priority.

Return values
tickpriority
349 {
350  return uwTickPrio;
351 }

◆ HAL_SetTickFreq()

HAL_StatusTypeDef HAL_SetTickFreq ( HAL_TickFreqTypeDef  Freq)

Set new tick Freq.

Return values
Status
358 {
361 
362  if (uwTickFreq != Freq)
363  {
364  uwTickFreq = Freq;
365 
366  /* Apply the new tick Freq */
368  }
369 
370  return status;
371 }
Here is the call graph for this function:

◆ HAL_GetTickFreq()

HAL_TickFreqTypeDef HAL_GetTickFreq ( void  )

Return tick frequency.

Return values
tickperiod in Hz
378 {
379  return uwTickFreq;
380 }

◆ HAL_SuspendTick()

__weak void HAL_SuspendTick ( void  )

Suspend Tick increment.

Note
In the default implementation , SysTick timer is the source of time base. It is used to generate interrupts at regular time intervals. Once HAL_SuspendTick() is called, the SysTick interrupt will be disabled and so Tick increment is suspended.
This function is declared as __weak to be overwritten in case of other implementations in user file.
Return values
None
420 {
421  /* Disable SysTick Interrupt */
422  SysTick->CTRL &= ~SysTick_CTRL_TICKINT_Msk;
423 }

◆ HAL_ResumeTick()

__weak void HAL_ResumeTick ( void  )

Resume Tick increment.

Note
In the default implementation , SysTick timer is the source of time base. It is used to generate interrupts at regular time intervals. Once HAL_ResumeTick() is called, the SysTick interrupt will be enabled and so Tick increment is resumed.
This function is declared as __weak to be overwritten in case of other implementations in user file.
Return values
None
436 {
437  /* Enable SysTick Interrupt */
438  SysTick->CTRL |= SysTick_CTRL_TICKINT_Msk;
439 }

◆ HAL_GetHalVersion()

uint32_t HAL_GetHalVersion ( void  )

Returns the HAL revision.

Return values
version: 0xXYZR (8bits for each decimal, R for RC)
446 {
448 }

◆ HAL_GetREVID()

uint32_t HAL_GetREVID ( void  )

Returns the device revision identifier.

Return values
Devicerevision identifier
455 {
456  return((DBGMCU->IDCODE) >> 16U);
457 }

◆ HAL_GetDEVID()

uint32_t HAL_GetDEVID ( void  )

Returns the device identifier.

Return values
Deviceidentifier
464 {
465  return((DBGMCU->IDCODE) & IDCODE_DEVID_MASK);
466 }

◆ HAL_DBGMCU_EnableDBGSleepMode()

void HAL_DBGMCU_EnableDBGSleepMode ( void  )

Enable the Debug Module during SLEEP mode.

Return values
None
473 {
474  SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_SLEEP);
475 }

◆ HAL_DBGMCU_DisableDBGSleepMode()

void HAL_DBGMCU_DisableDBGSleepMode ( void  )

Disable the Debug Module during SLEEP mode.

Return values
None
482 {
483  CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_SLEEP);
484 }

◆ HAL_DBGMCU_EnableDBGStopMode()

void HAL_DBGMCU_EnableDBGStopMode ( void  )

Enable the Debug Module during STOP mode.

Return values
None
491 {
492  SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STOP);
493 }

◆ HAL_DBGMCU_DisableDBGStopMode()

void HAL_DBGMCU_DisableDBGStopMode ( void  )

Disable the Debug Module during STOP mode.

Return values
None
500 {
501  CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STOP);
502 }

◆ HAL_DBGMCU_EnableDBGStandbyMode()

void HAL_DBGMCU_EnableDBGStandbyMode ( void  )

Enable the Debug Module during STANDBY mode.

Return values
None
509 {
510  SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STANDBY);
511 }

◆ HAL_DBGMCU_DisableDBGStandbyMode()

void HAL_DBGMCU_DisableDBGStandbyMode ( void  )

Disable the Debug Module during STANDBY mode.

Return values
None
518 {
519  CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STANDBY);
520 }

◆ HAL_EnableCompensationCell()

void HAL_EnableCompensationCell ( void  )

Enables the I/O Compensation Cell.

Note
The I/O compensation cell can be used only when the device supply voltage ranges from 2.4 to 3.6 V.
Return values
None
529 {
530  *(__IO uint32_t *)CMPCR_CMP_PD_BB = (uint32_t)ENABLE;
531 }

◆ HAL_DisableCompensationCell()

void HAL_DisableCompensationCell ( void  )

Power-down the I/O Compensation Cell.

Note
The I/O compensation cell can be used only when the device supply voltage ranges from 2.4 to 3.6 V.
Return values
None
540 {
541  *(__IO uint32_t *)CMPCR_CMP_PD_BB = (uint32_t)DISABLE;
542 }

◆ HAL_GetUID()

void HAL_GetUID ( uint32_t *  UID)

Return the unique device identifier (UID based on 96 bits)

Parameters
UIDpointer to 3 words array.
Return values
Deviceidentifier
550 {
551  UID[0] = (uint32_t)(READ_REG(*((uint32_t *)UID_BASE)));
552  UID[1] = (uint32_t)(READ_REG(*((uint32_t *)(UID_BASE + 4U))));
553  UID[2] = (uint32_t)(READ_REG(*((uint32_t *)(UID_BASE + 8U))));
554 }
CMPCR_CMP_PD_BB
#define CMPCR_CMP_PD_BB
Definition: stm32f4xx_hal.c:94
HAL_OK
Definition: stm32f4xx_hal_def.h:57
HAL_InitTick
HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
This function configures the source of the time base. The time source is configured to have 1ms time ...
Definition: stm32f4xx_hal.c:269
IDCODE_DEVID_MASK
#define IDCODE_DEVID_MASK
Definition: stm32f4xx_hal.c:80
HAL_GetTick
uint32_t HAL_GetTick(void)
Provides a tick value in millisecond.
Definition: stm32f4xx_hal.c:339
HAL_StatusTypeDef
HAL_StatusTypeDef
HAL Status structures definition.
Definition: stm32f4xx_hal_def.h:55
uwTickPrio
uint32_t uwTickPrio
Definition: stm32f4xx_hal.c:111
uwTickFreq
HAL_TickFreqTypeDef uwTickFreq
Definition: stm32f4xx_hal.c:112
assert_param
#define assert_param(expr)
Include module's header file.
Definition: stm32f4xx_hal_conf.h:444
Freq
#define Freq
Definition: deflate.h:79
__STM32F4xx_HAL_VERSION
#define __STM32F4xx_HAL_VERSION
Definition: stm32f4xx_hal.c:75
status
static status_t status
Definition: filament_sensor.c:37
uwTick
__IO uint32_t uwTick
Definition: stm32f4xx_hal.c:110
IS_TICKFREQ
#define IS_TICKFREQ(FREQ)
Definition: stm32f4xx_hal.h:209
HAL_MAX_DELAY
#define HAL_MAX_DELAY
Definition: stm32f4xx_hal_def.h:76