Hierodule 1.6.2
Utility module set for STM32 MCUs
Loading...
Searching...
No Matches

Elements of the module that are confined to the scope of the compilation unit. Perfectly corresponds to the module's source file, except the IRQ handlers. More...

Typedefs

typedef void(* T2V_Function_Pointer) (TIM_TypeDef *)
 Used to reference a clear-flag routine for Check_IT.
 

Functions

static uint32_t GetBaseFreq (TIM_TypeDef *Timer)
 Returns the base frequency of a timer.
 
static uint32_t * ChannelSelector (TIM_TypeDef *Timer, uint32_t ChannelOffset)
 Returns the pointer to the target channel's capture compare register.
 
static void Check_IT (TIM_TypeDef *Timer, FUNC_POINTER Handler, T2V_Function_Pointer ClearFlag)
 Performs a routine if it's not NULL, and clears the flag of a timer as specified with the clear-flag routine.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
 
static void InfiniteLoopOfError (void)
 Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 

Variables

static const uint32_t APB1_DIV1_SINGLE = (RCC_CFGR_PPRE_DIV1>>RCC_CFGR_PPRE_Pos)
 Constant to check if non-unitary prescaling has been applied to advanced peripheral bus 1.
Requires the device specific macro __STM32F030x6_H to be defined.
 
static const uint32_t APB1_DIV1 = (RCC_CFGR_PPRE1_DIV1>>RCC_CFGR_PPRE1_Pos)
 Constant to check if non-unitary prescaling has been applied to advanced peripheral bus 1.
Requires the device specific macro __STM32F103xB_H or __STM32F401xC_H to be defined.
 
static const uint32_t APB2_DIV1 = (RCC_CFGR_PPRE2_DIV1>>RCC_CFGR_PPRE2_Pos)
 Constant to check if non-unitary prescaling has been applied to advanced peripheral bus 2.
Requires the device specific macro __STM32F103xB_H or __STM32F401xC_H to be defined.
 
static FUNC_POINTER UPD_Handler_TIM1 = NULL
 ISR handler for update interrupt flag of timer 1
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 
static FUNC_POINTER CC1_Handler_TIM1 = NULL
 ISR handler for capture compare channel 1 interrupt flag of timer 1
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 
static FUNC_POINTER CC2_Handler_TIM1 = NULL
 ISR handler for capture compare channel 2 interrupt flag of timer 1
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 
static FUNC_POINTER CC3_Handler_TIM1 = NULL
 ISR handler for capture compare channel 3 interrupt flag of timer 1
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 
static FUNC_POINTER CC4_Handler_TIM1 = NULL
 ISR handler for capture compare channel 4 interrupt flag of timer 1
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 
static FUNC_POINTER BRK_Handler_TIM1 = NULL
 ISR handler for break interrupt flag of timer 1
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 
static FUNC_POINTER UPD_Handler_TIM2 = NULL
 ISR handler for update interrupt flag of timer 2
Requires the device specific macro __STM32F103xB_H or __STM32F401xC_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 
static FUNC_POINTER CC1_Handler_TIM2 = NULL
 ISR handler for capture compare channel 1 interrupt flag of timer 2
Requires the device specific macro __STM32F103xB_H or __STM32F401xC_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 
static FUNC_POINTER CC2_Handler_TIM2 = NULL
 ISR handler for capture compare channel 2 interrupt flag of timer 2
Requires the device specific macro __STM32F103xB_H or __STM32F401xC_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 
static FUNC_POINTER CC3_Handler_TIM2 = NULL
 ISR handler for capture compare channel 3 interrupt flag of timer 2
Requires the device specific macro __STM32F103xB_H or __STM32F401xC_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 
static FUNC_POINTER CC4_Handler_TIM2 = NULL
 ISR handler for capture compare channel 4 interrupt flag of timer 2
Requires the device specific macro __STM32F103xB_H or __STM32F401xC_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 
static FUNC_POINTER UPD_Handler_TIM3 = NULL
 ISR handler for update interrupt flag of timer 3
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 
static FUNC_POINTER CC1_Handler_TIM3 = NULL
 ISR handler for capture compare channel 1 interrupt flag of timer 3
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 
static FUNC_POINTER CC2_Handler_TIM3 = NULL
 ISR handler for capture compare channel 2 interrupt flag of timer 3
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 
static FUNC_POINTER CC3_Handler_TIM3 = NULL
 ISR handler for capture compare channel 3 interrupt flag of timer 3
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 
static FUNC_POINTER CC4_Handler_TIM3 = NULL
 ISR handler for capture compare channel 4 interrupt flag of timer 3
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 
static FUNC_POINTER UPD_Handler_TIM4 = NULL
 ISR handler for update interrupt flag of timer 4
Requires the device specific macro __STM32F103xB_H or __STM32F401xC_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 
static FUNC_POINTER CC1_Handler_TIM4 = NULL
 ISR handler for capture compare channel 1 interrupt flag of timer 4
Requires the device specific macro __STM32F103xB_H or __STM32F401xC_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 
static FUNC_POINTER CC2_Handler_TIM4 = NULL
 ISR handler for capture compare channel 2 interrupt flag of timer 4
Requires the device specific macro __STM32F103xB_H or __STM32F401xC_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 
static FUNC_POINTER CC3_Handler_TIM4 = NULL
 ISR handler for capture compare channel 3 interrupt flag of timer 4
Requires the device specific macro __STM32F103xB_H or __STM32F401xC_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 
static FUNC_POINTER CC4_Handler_TIM4 = NULL
 ISR handler for capture compare channel 4 interrupt flag of timer 4
Requires the device specific macro __STM32F103xB_H or __STM32F401xC_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 
static FUNC_POINTER UPD_Handler_TIM5 = NULL
 ISR handler for update interrupt flag of timer 5
Requires the device specific macro __STM32F401xC_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 
static FUNC_POINTER CC1_Handler_TIM5 = NULL
 ISR handler for capture compare channel 1 interrupt flag of timer 5
Requires the device specific macro __STM32F401xC_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 
static FUNC_POINTER CC2_Handler_TIM5 = NULL
 ISR handler for capture compare channel 2 interrupt flag of timer 5
Requires the device specific macro __STM32F401xC_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 
static FUNC_POINTER CC3_Handler_TIM5 = NULL
 ISR handler for capture compare channel 3 interrupt flag of timer 5
Requires the device specific macro __STM32F401xC_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 
static FUNC_POINTER CC4_Handler_TIM5 = NULL
 ISR handler for capture compare channel 4 interrupt flag of timer 5
Requires the device specific macro __STM32F401xC_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 
static FUNC_POINTER UPD_Handler_TIM9 = NULL
 ISR handler for update interrupt flag of timer 9
Requires the device specific macro __STM32F401xC_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 
static FUNC_POINTER CC1_Handler_TIM9 = NULL
 ISR handler for capture compare channel 1 interrupt flag of timer 9
Requires the device specific macro __STM32F401xC_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 
static FUNC_POINTER CC2_Handler_TIM9 = NULL
 ISR handler for capture compare channel 2 interrupt flag of timer 9
Requires the device specific macro __STM32F401xC_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 
static FUNC_POINTER UPD_Handler_TIM10 = NULL
 ISR handler for update interrupt flag of timer 10
Requires the device specific macro __STM32F401xC_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 
static FUNC_POINTER CC1_Handler_TIM10 = NULL
 ISR handler for capture compare channel 1 interrupt flag of timer 10
Requires the device specific macro __STM32F401xC_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 
static FUNC_POINTER UPD_Handler_TIM11 = NULL
 ISR handler for update interrupt flag of timer 11
Requires the device specific macro __STM32F401xC_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 
static FUNC_POINTER CC1_Handler_TIM11 = NULL
 ISR handler for capture compare channel 1 interrupt flag of timer 11
Requires the device specific macro __STM32F401xC_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 
static FUNC_POINTER UPD_Handler_TIM14 = NULL
 ISR handler for update interrupt flag of timer 14
Requires the device specific macro __STM32F030x6_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 
static FUNC_POINTER CC1_Handler_TIM14 = NULL
 ISR handler for capture compare channel 1 interrupt flag of timer 14
Requires the device specific macro __STM32F030x6_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 
static FUNC_POINTER UPD_Handler_TIM16 = NULL
 ISR handler for update interrupt flag of timer 16
Requires the device specific macro __STM32F030x6_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 
static FUNC_POINTER CC1_Handler_TIM16 = NULL
 ISR handler for capture compare channel 1 interrupt flag of timer 16
Requires the device specific macro __STM32F030x6_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 
static FUNC_POINTER BRK_Handler_TIM17 = NULL
 ISR handler for break interrupt flag of timer 17
Requires the device specific macro __STM32F030x6_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 
static FUNC_POINTER UPD_Handler_TIM17 = NULL
 ISR handler for update interrupt flag of timer 17
Requires the device specific macro __STM32F030x6_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 
static FUNC_POINTER CC1_Handler_TIM17 = NULL
 ISR handler for capture compare channel 1 interrupt flag of timer 17
Requires the device specific macro __STM32F030x6_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
 
static FUNC_POINTER TIM1_CC_ISR = NULL
 Pointer to the Timer 1 Capture Compare IRQ routine.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be NOT defined.
 
static FUNC_POINTER TIM2_ISR = NULL
 Pointer to the Timer 2 IRQ routine.
Requires the device specific macro __STM32F103xB_H or __STM32F401xC_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be NOT defined.
 
static FUNC_POINTER TIM3_ISR = NULL
 Pointer to the Timer 3 IRQ routine.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be NOT defined.
 
static FUNC_POINTER TIM4_ISR = NULL
 Pointer to the Timer 4 IRQ routine.
Requires the device specific macro __STM32F103xB_H or __STM32F401xC_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be NOT defined.
 
static FUNC_POINTER TIM1_UP_ISR = NULL
 Pointer to the Timer 1 update IRQ routine.
Requires the device specific macro __STM32F103xB_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be NOT defined.
 
static FUNC_POINTER TIM1_BRK_ISR = NULL
 Pointer to the Timer 1 break IRQ routine.
Requires the device specific macro __STM32F103xB_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be NOT defined.
 
static FUNC_POINTER TIM1_UP_TIM10_ISR = NULL
 Pointer to the Timer 1 update - timer 10 IRQ routine.
Requires the device specific macro __STM32F401xC_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be NOT defined.
 
static FUNC_POINTER TIM1_BRK_TIM9_ISR = NULL
 Pointer to the Timer 1 break - timer 9 IRQ routine.
Requires the device specific macro __STM32F401xC_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be NOT defined.
 
static FUNC_POINTER TIM5_ISR = NULL
 Pointer to the Timer 5 IRQ routine.
Requires the device specific macro __STM32F401xC_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be NOT defined.
 
static FUNC_POINTER TIM1_TRG_COM_TIM11_ISR = NULL
 Pointer to the Timer 1 trigger comm - timer 11 IRQ routine.
Requires the device specific macro __STM32F401xC_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be NOT defined.
 
static FUNC_POINTER TIM1_BRK_UP_TRG_COM_ISR = NULL
 Pointer to the Timer 1 break - update - trigger - comm IRQ routine.
Requires the device specific macro __STM32F030x6_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be NOT defined.
 
static FUNC_POINTER TIM14_ISR = NULL
 Pointer to the Timer 14 IRQ routine.
Requires the device specific macro __STM32F030x6_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be NOT defined.
 
static FUNC_POINTER TIM16_ISR = NULL
 Pointer to the Timer 16 IRQ routine.
Requires the device specific macro __STM32F030x6_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be NOT defined.
 
static FUNC_POINTER TIM17_ISR = NULL
 Pointer to the Timer 17 IRQ routine.
Requires the device specific macro __STM32F030x6_H to be defined.
Requires HIERODULE_TIM_HANDLE_IRQ to be defined.
Requires HIERODULE_TIM_CONVENIENT_IRQ to be NOT defined.
 
static const uint32_t TimerChannel_EN [7]
 The array the timer PWM output channel enable bitmasks are kept.
 
static const uint32_t TimerChannel_CCR [4]
 Keeps the offsets to capture compare registers within a TIM_Typedef for all four channels.
 

Detailed Description

Consists of definitions for routines declared in the header file, as well as typedefs, variables and routines that are used to implement those.
IRQ definitions with custom ISR implementations are also included at the end of the file.

Typedef Documentation

◆ T2V_Function_Pointer

typedef void(* T2V_Function_Pointer) (TIM_TypeDef *)

Definition at line 32 of file hierodule_tim.c.

Function Documentation

◆ ChannelSelector()

static uint32_t * ChannelSelector ( TIM_TypeDef * Timer,
uint32_t ChannelOffset )
inlinestatic
Parameters
TimerPointer to timer struct.
ChannelOffsetOffset of the targeted register within the struct.
Returns
Pointer to the targeted CCR

This function is meant to be used with the array TimerChannel_CCR.

Definition at line 604 of file hierodule_tim.c.

605{
606 return (uint32_t*)((char*)Timer + (size_t)ChannelOffset);
607}

Referenced by HIERODULE_TIM_GetDutyCycle(), and HIERODULE_TIM_SetDutyCycle().

◆ Check_IT()

static void Check_IT ( TIM_TypeDef * Timer,
FUNC_POINTER Handler,
T2V_Function_Pointer ClearFlag )
static
Parameters
TimerPointer to timer struct.
HandlerPointer to the assigned void function
ClearFlagPointer to the clear-flag routine
Returns
None

Self-explanatory code, nothing to elaborate.

Definition at line 622 of file hierodule_tim.c.

628 {
629 if(Handler != NULL)
630 {
631 Handler();
632 }
633 ClearFlag(Timer);
634 }

Referenced by TIM14_IRQHandler(), TIM16_IRQHandler(), TIM17_IRQHandler(), TIM1_BRK_IRQHandler(), TIM1_BRK_TIM9_IRQHandler(), TIM1_BRK_UP_TRG_COM_IRQHandler(), TIM1_CC_IRQHandler(), TIM1_TRG_COM_TIM11_IRQHandler(), TIM1_UP_IRQHandler(), TIM1_UP_TIM10_IRQHandler(), TIM2_IRQHandler(), TIM3_IRQHandler(), TIM4_IRQHandler(), and TIM5_IRQHandler().

◆ GetBaseFreq()

static uint32_t GetBaseFreq ( TIM_TypeDef * Timer)
static
Parameters
TimerPointer to timer struct.
Returns
Frequency in Hertz.

Base frequency is basically the peripheral bus clock prescaled.
Timers are driven by the different advanced peripheral bus clocks, depending on the device and type of the timer, that's configured here via device specific macro constant checks.
Secondly, the bus clock is by default doubled if the peripheral bus divider is greater than unity, which is also managed in the function with constants APB1_DIV1, APB2_DIV1 and APB1_DIV1_SINGLE.
Finally, the peripheral clock is divided by the prescaler value to get the clock frequency to be scaled by ARR, in turn, to set frequency and period.

\(Base Frequency = System Clock / (APB Prescaler * (PSC+1)*(ARR+1)) \)

Definition at line 535 of file hierodule_tim.c.

536{
537 volatile uint32_t BaseFreq;
539 #ifdef __STM32F103xB_H
540 if(Timer != TIM1)
541 {
542 BaseFreq = (SystemCoreClock >>
543 APBPrescTable[(RCC->CFGR & RCC_CFGR_PPRE1) >> RCC_CFGR_PPRE1_Pos]);
544
545 if( (READ_REG(RCC->CFGR) & RCC_CFGR_PPRE1) != APB1_DIV1 )
546 {
547 BaseFreq *= 2;
548 }
549 }
550 else
551 {
552 BaseFreq = (SystemCoreClock >>
553 APBPrescTable[(RCC->CFGR & RCC_CFGR_PPRE2) >> RCC_CFGR_PPRE2_Pos]);
554
555 if( (READ_REG(RCC->CFGR) & RCC_CFGR_PPRE2) != APB2_DIV1 )
556 {
557 BaseFreq *= 2;
558 }
559 }
561 #elif defined __STM32F401xC_H
562 if(Timer != TIM1 && Timer != TIM9 && Timer != TIM10 && Timer != TIM11)
563 {
564 BaseFreq = (SystemCoreClock >>
565 APBPrescTable[(RCC->CFGR & RCC_CFGR_PPRE1) >> RCC_CFGR_PPRE1_Pos]);
566
567 if( (READ_REG(RCC->CFGR) & RCC_CFGR_PPRE1) != APB1_DIV1 )
568 {
569 BaseFreq *= 2;
570 }
571 }
572 else
573 {
574 BaseFreq = (SystemCoreClock >>
575 APBPrescTable[(RCC->CFGR & RCC_CFGR_PPRE2) >> RCC_CFGR_PPRE2_Pos]);
576
577 if( (READ_REG(RCC->CFGR) & RCC_CFGR_PPRE2) != APB2_DIV1 )
578 {
579 BaseFreq *= 2;
580 }
581 }
583 #elif defined __STM32F030x6_H
584 BaseFreq = (SystemCoreClock >>
585 APBPrescTable[(RCC->CFGR & RCC_CFGR_PPRE) >> RCC_CFGR_PPRE_Pos]);
586
587 if( (READ_REG(RCC->CFGR) & RCC_CFGR_PPRE) != APB1_DIV1_SINGLE )
588 {
589 BaseFreq *= 2;
590 }
592 #endif
593 BaseFreq /= (Timer->PSC+1);
594 return BaseFreq;
595}
static const uint32_t APB1_DIV1
Constant to check if non-unitary prescaling has been applied to advanced peripheral bus 1....
static const uint32_t APB2_DIV1
Constant to check if non-unitary prescaling has been applied to advanced peripheral bus 2....
static const uint32_t APB1_DIV1_SINGLE
Constant to check if non-unitary prescaling has been applied to advanced peripheral bus 1....

References APB1_DIV1, APB1_DIV1_SINGLE, and APB2_DIV1.

Referenced by HIERODULE_TIM_GetFrequency(), HIERODULE_TIM_GetPeriod(), HIERODULE_TIM_SetFrequency(), and HIERODULE_TIM_SetPeriod().

◆ InfiniteLoopOfError()

static void InfiniteLoopOfError ( void )
static
Returns
None

Self-explanatory code, nothing to elaborate.

Definition at line 641 of file hierodule_tim.c.

642 {
643 while(1);
644 }

Referenced by HIERODULE_TIM_Assign_ISR_BRK(), HIERODULE_TIM_Assign_ISR_CC1(), HIERODULE_TIM_Assign_ISR_CC2(), HIERODULE_TIM_Assign_ISR_CC3(), HIERODULE_TIM_Assign_ISR_CC4(), and HIERODULE_TIM_Assign_ISR_UPD().

Variable Documentation

◆ APB1_DIV1

const uint32_t APB1_DIV1 = (RCC_CFGR_PPRE1_DIV1>>RCC_CFGR_PPRE1_Pos)
static

Definition at line 48 of file hierodule_tim.c.

Referenced by GetBaseFreq().

◆ APB1_DIV1_SINGLE

const uint32_t APB1_DIV1_SINGLE = (RCC_CFGR_PPRE_DIV1>>RCC_CFGR_PPRE_Pos)
static

Definition at line 42 of file hierodule_tim.c.

Referenced by GetBaseFreq().

◆ APB2_DIV1

const uint32_t APB2_DIV1 = (RCC_CFGR_PPRE2_DIV1>>RCC_CFGR_PPRE2_Pos)
static

Definition at line 53 of file hierodule_tim.c.

Referenced by GetBaseFreq().

◆ BRK_Handler_TIM1

◆ BRK_Handler_TIM17

FUNC_POINTER BRK_Handler_TIM17 = NULL
static

Definition at line 358 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_ISR_BRK(), and TIM17_IRQHandler().

◆ CC1_Handler_TIM1

FUNC_POINTER CC1_Handler_TIM1 = NULL
static

Definition at line 70 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_ISR_CC1(), and TIM1_CC_IRQHandler().

◆ CC1_Handler_TIM10

FUNC_POINTER CC1_Handler_TIM10 = NULL
static

Definition at line 306 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_ISR_CC1(), and TIM1_UP_TIM10_IRQHandler().

◆ CC1_Handler_TIM11

FUNC_POINTER CC1_Handler_TIM11 = NULL
static

Definition at line 320 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_ISR_CC1(), and TIM1_TRG_COM_TIM11_IRQHandler().

◆ CC1_Handler_TIM14

FUNC_POINTER CC1_Handler_TIM14 = NULL
static

Definition at line 337 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_ISR_CC1(), and TIM14_IRQHandler().

◆ CC1_Handler_TIM16

FUNC_POINTER CC1_Handler_TIM16 = NULL
static

Definition at line 351 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_ISR_CC1(), and TIM16_IRQHandler().

◆ CC1_Handler_TIM17

FUNC_POINTER CC1_Handler_TIM17 = NULL
static

Definition at line 372 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_ISR_CC1(), and TIM17_IRQHandler().

◆ CC1_Handler_TIM2

FUNC_POINTER CC1_Handler_TIM2 = NULL
static

Definition at line 114 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_ISR_CC1(), and TIM2_IRQHandler().

◆ CC1_Handler_TIM3

FUNC_POINTER CC1_Handler_TIM3 = NULL
static

Definition at line 161 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_ISR_CC1(), and TIM3_IRQHandler().

◆ CC1_Handler_TIM4

FUNC_POINTER CC1_Handler_TIM4 = NULL
static

Definition at line 199 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_ISR_CC1(), and TIM4_IRQHandler().

◆ CC1_Handler_TIM5

FUNC_POINTER CC1_Handler_TIM5 = NULL
static

Definition at line 250 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_ISR_CC1(), and TIM5_IRQHandler().

◆ CC1_Handler_TIM9

FUNC_POINTER CC1_Handler_TIM9 = NULL
static

Definition at line 285 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_ISR_CC1(), and TIM1_BRK_TIM9_IRQHandler().

◆ CC2_Handler_TIM1

FUNC_POINTER CC2_Handler_TIM1 = NULL
static

Definition at line 76 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_ISR_CC2(), and TIM1_CC_IRQHandler().

◆ CC2_Handler_TIM2

FUNC_POINTER CC2_Handler_TIM2 = NULL
static

Definition at line 125 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_ISR_CC2(), and TIM2_IRQHandler().

◆ CC2_Handler_TIM3

FUNC_POINTER CC2_Handler_TIM3 = NULL
static

Definition at line 167 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_ISR_CC2(), and TIM3_IRQHandler().

◆ CC2_Handler_TIM4

FUNC_POINTER CC2_Handler_TIM4 = NULL
static

Definition at line 210 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_ISR_CC2(), and TIM4_IRQHandler().

◆ CC2_Handler_TIM5

FUNC_POINTER CC2_Handler_TIM5 = NULL
static

Definition at line 257 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_ISR_CC2(), and TIM5_IRQHandler().

◆ CC2_Handler_TIM9

FUNC_POINTER CC2_Handler_TIM9 = NULL
static

Definition at line 292 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_ISR_CC2(), and TIM1_BRK_TIM9_IRQHandler().

◆ CC3_Handler_TIM1

FUNC_POINTER CC3_Handler_TIM1 = NULL
static

Definition at line 82 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_ISR_CC3(), and TIM1_CC_IRQHandler().

◆ CC3_Handler_TIM2

FUNC_POINTER CC3_Handler_TIM2 = NULL
static

Definition at line 136 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_ISR_CC3(), and TIM2_IRQHandler().

◆ CC3_Handler_TIM3

FUNC_POINTER CC3_Handler_TIM3 = NULL
static

Definition at line 173 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_ISR_CC3(), and TIM3_IRQHandler().

◆ CC3_Handler_TIM4

FUNC_POINTER CC3_Handler_TIM4 = NULL
static

Definition at line 221 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_ISR_CC3(), and TIM4_IRQHandler().

◆ CC3_Handler_TIM5

FUNC_POINTER CC3_Handler_TIM5 = NULL
static

Definition at line 264 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_ISR_CC3(), and TIM5_IRQHandler().

◆ CC4_Handler_TIM1

FUNC_POINTER CC4_Handler_TIM1 = NULL
static

Definition at line 88 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_ISR_CC4(), and TIM1_CC_IRQHandler().

◆ CC4_Handler_TIM2

FUNC_POINTER CC4_Handler_TIM2 = NULL
static

Definition at line 147 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_ISR_CC4(), and TIM2_IRQHandler().

◆ CC4_Handler_TIM3

FUNC_POINTER CC4_Handler_TIM3 = NULL
static

Definition at line 179 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_ISR_CC4(), and TIM3_IRQHandler().

◆ CC4_Handler_TIM4

FUNC_POINTER CC4_Handler_TIM4 = NULL
static

Definition at line 232 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_ISR_CC4(), and TIM4_IRQHandler().

◆ CC4_Handler_TIM5

FUNC_POINTER CC4_Handler_TIM5 = NULL
static

Definition at line 271 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_ISR_CC4(), and TIM5_IRQHandler().

◆ TIM14_ISR

FUNC_POINTER TIM14_ISR = NULL
static

Definition at line 472 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_TIM14_ISR(), and TIM14_IRQHandler().

◆ TIM16_ISR

FUNC_POINTER TIM16_ISR = NULL
static

Definition at line 479 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_TIM16_ISR(), and TIM16_IRQHandler().

◆ TIM17_ISR

FUNC_POINTER TIM17_ISR = NULL
static

Definition at line 486 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_TIM17_ISR(), and TIM17_IRQHandler().

◆ TIM1_BRK_ISR

FUNC_POINTER TIM1_BRK_ISR = NULL
static

Definition at line 426 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_TIM1_BRK_ISR(), and TIM1_BRK_IRQHandler().

◆ TIM1_BRK_TIM9_ISR

FUNC_POINTER TIM1_BRK_TIM9_ISR = NULL
static

◆ TIM1_BRK_UP_TRG_COM_ISR

FUNC_POINTER TIM1_BRK_UP_TRG_COM_ISR = NULL
static

◆ TIM1_CC_ISR

FUNC_POINTER TIM1_CC_ISR = NULL
static

Definition at line 383 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_TIM1_CC_ISR(), and TIM1_CC_IRQHandler().

◆ TIM1_TRG_COM_TIM11_ISR

FUNC_POINTER TIM1_TRG_COM_TIM11_ISR = NULL
static

◆ TIM1_UP_ISR

FUNC_POINTER TIM1_UP_ISR = NULL
static

Definition at line 419 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_TIM1_UP_ISR(), and TIM1_UP_IRQHandler().

◆ TIM1_UP_TIM10_ISR

FUNC_POINTER TIM1_UP_TIM10_ISR = NULL
static

◆ TIM2_ISR

FUNC_POINTER TIM2_ISR = NULL
static

Definition at line 392 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_TIM2_ISR(), and TIM2_IRQHandler().

◆ TIM3_ISR

FUNC_POINTER TIM3_ISR = NULL
static

Definition at line 400 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_TIM3_ISR(), and TIM3_IRQHandler().

◆ TIM4_ISR

FUNC_POINTER TIM4_ISR = NULL
static

Definition at line 409 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_TIM4_ISR(), and TIM4_IRQHandler().

◆ TIM5_ISR

FUNC_POINTER TIM5_ISR = NULL
static

Definition at line 449 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_TIM5_ISR(), and TIM5_IRQHandler().

◆ TimerChannel_CCR

const uint32_t TimerChannel_CCR[4]
static
Initial value:
=
{
offsetof(TIM_TypeDef, CCR1),
offsetof(TIM_TypeDef, CCR2),
offsetof(TIM_TypeDef, CCR3),
offsetof(TIM_TypeDef, CCR4)
}

This provides some convenience in that it lets the developer use a single call to manage a PWM output channel with the same function, instead of having different functions for each channel.

Definition at line 511 of file hierodule_tim.c.

512{
513 offsetof(TIM_TypeDef, CCR1),
514 offsetof(TIM_TypeDef, CCR2),
515 offsetof(TIM_TypeDef, CCR3),
516 offsetof(TIM_TypeDef, CCR4)
517};

Referenced by HIERODULE_TIM_GetDutyCycle(), and HIERODULE_TIM_SetDutyCycle().

◆ TimerChannel_EN

const uint32_t TimerChannel_EN[7]
static
Initial value:
=
{
TIM_CCER_CC1E,
TIM_CCER_CC2E,
TIM_CCER_CC3E,
TIM_CCER_CC4E,
TIM_CCER_CC1NE,
TIM_CCER_CC2NE,
TIM_CCER_CC3NE
}

This provides some convenience in that it lets the developer use a single call to manage a PWM output channel with the same function, instead of having different functions for each channel.

Definition at line 496 of file hierodule_tim.c.

497{
498 TIM_CCER_CC1E,
499 TIM_CCER_CC2E,
500 TIM_CCER_CC3E,
501 TIM_CCER_CC4E,
502 TIM_CCER_CC1NE,
503 TIM_CCER_CC2NE,
504 TIM_CCER_CC3NE
505};

Referenced by HIERODULE_TIM_DisableChannel(), HIERODULE_TIM_EnableChannel(), and HIERODULE_TIM_IsEnabledChannel().

◆ UPD_Handler_TIM1

◆ UPD_Handler_TIM10

FUNC_POINTER UPD_Handler_TIM10 = NULL
static

Definition at line 299 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_ISR_UPD(), and TIM1_UP_TIM10_IRQHandler().

◆ UPD_Handler_TIM11

FUNC_POINTER UPD_Handler_TIM11 = NULL
static

Definition at line 313 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_ISR_UPD(), and TIM1_TRG_COM_TIM11_IRQHandler().

◆ UPD_Handler_TIM14

FUNC_POINTER UPD_Handler_TIM14 = NULL
static

Definition at line 330 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_ISR_UPD(), and TIM14_IRQHandler().

◆ UPD_Handler_TIM16

FUNC_POINTER UPD_Handler_TIM16 = NULL
static

Definition at line 344 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_ISR_UPD(), and TIM16_IRQHandler().

◆ UPD_Handler_TIM17

FUNC_POINTER UPD_Handler_TIM17 = NULL
static

Definition at line 365 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_ISR_UPD(), and TIM17_IRQHandler().

◆ UPD_Handler_TIM2

FUNC_POINTER UPD_Handler_TIM2 = NULL
static

Definition at line 103 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_ISR_UPD(), and TIM2_IRQHandler().

◆ UPD_Handler_TIM3

FUNC_POINTER UPD_Handler_TIM3 = NULL
static

Definition at line 155 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_ISR_UPD(), and TIM3_IRQHandler().

◆ UPD_Handler_TIM4

FUNC_POINTER UPD_Handler_TIM4 = NULL
static

Definition at line 188 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_ISR_UPD(), and TIM4_IRQHandler().

◆ UPD_Handler_TIM5

FUNC_POINTER UPD_Handler_TIM5 = NULL
static

Definition at line 243 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_ISR_UPD(), and TIM5_IRQHandler().

◆ UPD_Handler_TIM9

FUNC_POINTER UPD_Handler_TIM9 = NULL
static

Definition at line 278 of file hierodule_tim.c.

Referenced by HIERODULE_TIM_Assign_ISR_UPD(), and TIM1_BRK_TIM9_IRQHandler().