Hierodule 1.6.2
Utility module set for STM32 MCUs
Loading...
Searching...
No Matches
hierodule_tim.h
Go to the documentation of this file.
1
12#ifndef __HIERODULE_TIM_H
13#define __HIERODULE_TIM_H
14
15#ifdef __cplusplus
16extern "C"
17{
18#endif
19
39#define HIERODULE_TIM_HANDLE_IRQ
40
48#define HIERODULE_TIM_RESERVED 0
49
56#define HIERODULE_TIM_CONVENIENT_IRQ
57
58#include <main.h>
59#include <stdlib.h>
60
66typedef void (*FUNC_POINTER)(void);
67
73void HIERODULE_TIM_SetPeriod(TIM_TypeDef *Timer, double DurationSec);
74
79double HIERODULE_TIM_GetPeriod(TIM_TypeDef *Timer);
80
86void HIERODULE_TIM_SetFrequency(TIM_TypeDef *Timer, double Frequency_Hz);
87
92double HIERODULE_TIM_GetFrequency(TIM_TypeDef *Timer);
93
98void HIERODULE_TIM_ClearCounter(TIM_TypeDef *Timer);
99
105void HIERODULE_TIM_SetRepetition(TIM_TypeDef *Timer, uint32_t Reps);
106
111uint32_t HIERODULE_TIM_GetRepetition(TIM_TypeDef *Timer);
112
118void HIERODULE_TIM_EnableChannel(TIM_TypeDef *Timer, int8_t Channel);
119
125void HIERODULE_TIM_DisableChannel(TIM_TypeDef *Timer, int8_t Channel);
126
132uint32_t HIERODULE_TIM_IsEnabledChannel(TIM_TypeDef *Timer, int8_t Channel);
133
138void HIERODULE_TIM_EnableMainOutput(TIM_TypeDef *Timer);
139
144void HIERODULE_TIM_DisableMainOutput(TIM_TypeDef *Timer);
145
153void HIERODULE_TIM_SetDutyCycle(TIM_TypeDef *Timer, uint8_t Channel,
154 double NormalizedDutyCycle);
155
162double HIERODULE_TIM_GetDutyCycle(TIM_TypeDef *Timer, uint8_t Channel);
163
168void HIERODULE_TIM_ClearFlag_UPD(TIM_TypeDef *Timer);
169
174void HIERODULE_TIM_ClearFlag_CC1(TIM_TypeDef *Timer);
175
180void HIERODULE_TIM_ClearFlag_CC2(TIM_TypeDef *Timer);
181
186void HIERODULE_TIM_ClearFlag_CC3(TIM_TypeDef *Timer);
187
192void HIERODULE_TIM_ClearFlag_CC4(TIM_TypeDef *Timer);
193
198void HIERODULE_TIM_ClearFlag_BRK(TIM_TypeDef *Timer);
199
204uint32_t HIERODULE_TIM_IsSetFlag_UPD(TIM_TypeDef *Timer);
205
210uint32_t HIERODULE_TIM_IsSetFlag_CC1(TIM_TypeDef *Timer);
211
216uint32_t HIERODULE_TIM_IsSetFlag_CC2(TIM_TypeDef *Timer);
217
222uint32_t HIERODULE_TIM_IsSetFlag_CC3(TIM_TypeDef *Timer);
223
228uint32_t HIERODULE_TIM_IsSetFlag_CC4(TIM_TypeDef *Timer);
229
234uint32_t HIERODULE_TIM_IsSetFlag_BRK(TIM_TypeDef *Timer);
235
240void HIERODULE_TIM_Enable_IT_UPD(TIM_TypeDef *Timer);
241
246void HIERODULE_TIM_Enable_IT_CC1(TIM_TypeDef *Timer);
247
252void HIERODULE_TIM_Enable_IT_CC2(TIM_TypeDef *Timer);
253
258void HIERODULE_TIM_Enable_IT_CC3(TIM_TypeDef *Timer);
259
264void HIERODULE_TIM_Enable_IT_CC4(TIM_TypeDef *Timer);
265
270void HIERODULE_TIM_Enable_IT_BRK(TIM_TypeDef *Timer);
271
276void HIERODULE_TIM_Disable_IT_UPD(TIM_TypeDef *Timer);
277
282void HIERODULE_TIM_Disable_IT_CC1(TIM_TypeDef *Timer);
283
288void HIERODULE_TIM_Disable_IT_CC2(TIM_TypeDef *Timer);
289
294void HIERODULE_TIM_Disable_IT_CC3(TIM_TypeDef *Timer);
295
300void HIERODULE_TIM_Disable_IT_CC4(TIM_TypeDef *Timer);
301
306void HIERODULE_TIM_Disable_IT_BRK(TIM_TypeDef *Timer);
307
312uint32_t HIERODULE_TIM_IsEnabled_IT_UPD(TIM_TypeDef *Timer);
313
318uint32_t HIERODULE_TIM_IsEnabled_IT_CC1(TIM_TypeDef *Timer);
319
324uint32_t HIERODULE_TIM_IsEnabled_IT_CC2(TIM_TypeDef *Timer);
325
330uint32_t HIERODULE_TIM_IsEnabled_IT_CC3(TIM_TypeDef *Timer);
331
336uint32_t HIERODULE_TIM_IsEnabled_IT_CC4(TIM_TypeDef *Timer);
337
342uint32_t HIERODULE_TIM_IsEnabled_IT_BRK(TIM_TypeDef *Timer);
343
348void HIERODULE_TIM_EnableAutomaticOutput(TIM_TypeDef *Timer);
349
354void HIERODULE_TIM_DisableAutomaticOutput(TIM_TypeDef *Timer);
355
360void HIERODULE_TIM_EnableCounter(TIM_TypeDef *Timer);
361
366void HIERODULE_TIM_DisableCounter(TIM_TypeDef *Timer);
367
372uint32_t HIERODULE_TIM_IsEnabledCounter(TIM_TypeDef *Timer);
373
375#ifdef HIERODULE_TIM_HANDLE_IRQ
376 #ifdef HIERODULE_TIM_CONVENIENT_IRQ
384 void HIERODULE_TIM_Assign_ISR_UPD(TIM_TypeDef *Timer, FUNC_POINTER ISR);
385
393 void HIERODULE_TIM_Assign_ISR_CC1(TIM_TypeDef *Timer, FUNC_POINTER ISR);
394
402 void HIERODULE_TIM_Assign_ISR_CC2(TIM_TypeDef *Timer, FUNC_POINTER ISR);
403
411 void HIERODULE_TIM_Assign_ISR_CC3(TIM_TypeDef *Timer, FUNC_POINTER ISR);
412
420 void HIERODULE_TIM_Assign_ISR_CC4(TIM_TypeDef *Timer, FUNC_POINTER ISR);
421
429 void HIERODULE_TIM_Assign_ISR_BRK(TIM_TypeDef *Timer, FUNC_POINTER ISR);
431 #else
439
448 #if ( (defined __STM32F103xB_H) || (defined __STM32F401xC_H) )
451 #endif
460
469 #if ( (defined __STM32F103xB_H) || (defined __STM32F401xC_H) )
472 #endif
475 #ifdef __STM32F103xB_H
484
494 #elif defined __STM32F401xC_H
503
512
521
530
532 #elif defined __STM32F030x6_H
542
551
560
569
571 #endif
572 #endif //HIERODULE_TIM_CONVENIENT_IRQ
573#endif //HIERODULE_TIM_HANDLE_IRQ /** \endcond */
574
582#ifdef __cplusplus
583}
584#endif
585
586#endif /* __HIERODULE_TIM_H */
587
void HIERODULE_TIM_SetRepetition(TIM_TypeDef *Timer, uint32_t Reps)
Sets the additional period repetitions of a timer.
uint32_t HIERODULE_TIM_IsSetFlag_CC1(TIM_TypeDef *Timer)
Checks the status of the capture compare channel 1 interrupt flag of the timer.
void HIERODULE_TIM_ClearFlag_CC3(TIM_TypeDef *Timer)
Clears the capture compare channel 3 interrupt flag of the timer.
uint32_t HIERODULE_TIM_IsSetFlag_CC4(TIM_TypeDef *Timer)
Checks the status of the capture compare channel 4 interrupt flag of the timer.
void HIERODULE_TIM_Enable_IT_UPD(TIM_TypeDef *Timer)
Enables the update interrupt of the timer.
void HIERODULE_TIM_SetPeriod(TIM_TypeDef *Timer, double DurationSec)
Sets the period duration of a timer.
void HIERODULE_TIM_Disable_IT_UPD(TIM_TypeDef *Timer)
Disables the update interrupt of the timer.
double HIERODULE_TIM_GetFrequency(TIM_TypeDef *Timer)
Returns the frequency of a timer in Hertz.
void HIERODULE_TIM_Assign_TIM1_UP_TIM10_ISR(FUNC_POINTER ISR)
Assigns a function to the timer 1 update - timer 10 IRQ handler. Requires the device specific macro _...
void HIERODULE_TIM_Assign_TIM3_ISR(FUNC_POINTER ISR)
Assigns a function to the timer 3 IRQ handler. Requires HIERODULE_TIM_HANDLE_IRQ to be defined....
void HIERODULE_TIM_ClearFlag_CC4(TIM_TypeDef *Timer)
Clears the capture compare channel 4 interrupt flag of the timer.
double HIERODULE_TIM_GetDutyCycle(TIM_TypeDef *Timer, uint8_t Channel)
Returns the duty cycle of the specified PWM output channel of a timer.
void HIERODULE_TIM_Disable_IT_CC4(TIM_TypeDef *Timer)
Disables the capture compare channel 4 interrupt of the timer.
uint32_t HIERODULE_TIM_IsEnabledCounter(TIM_TypeDef *Timer)
Checks the status of the counter of a timer.
void HIERODULE_TIM_Assign_TIM16_ISR(FUNC_POINTER ISR)
Assigns a function to the timer 16 IRQ handler. Requires the device specific macro __STM32F030x6_H to...
uint32_t HIERODULE_TIM_IsSetFlag_UPD(TIM_TypeDef *Timer)
Checks the status of the update interrupt flag of the timer.
uint32_t HIERODULE_TIM_IsEnabled_IT_UPD(TIM_TypeDef *Timer)
Checks the update interrupt of the timer.
uint32_t HIERODULE_TIM_IsSetFlag_BRK(TIM_TypeDef *Timer)
Checks the status of the break interrupt flag of the timer.
void HIERODULE_TIM_SetDutyCycle(TIM_TypeDef *Timer, uint8_t Channel, double NormalizedDutyCycle)
Sets the duty cycle of the specified PWM output channel of a timer.
uint32_t HIERODULE_TIM_IsSetFlag_CC2(TIM_TypeDef *Timer)
Checks the status of the capture compare channel 2 interrupt flag of the timer.
void HIERODULE_TIM_Assign_TIM1_BRK_ISR(FUNC_POINTER ISR)
Assigns a function to the timer 1 break IRQ handler. Requires the device specific macro __STM32F103xB...
void HIERODULE_TIM_Assign_TIM5_ISR(FUNC_POINTER ISR)
Assigns a function to the timer 5 IRQ handler. Requires the device specific macro __STM32F401xC_H to ...
void HIERODULE_TIM_Enable_IT_BRK(TIM_TypeDef *Timer)
Enables the break interrupt of the timer.
void HIERODULE_TIM_EnableCounter(TIM_TypeDef *Timer)
Enables the counter of a timer.
void HIERODULE_TIM_EnableAutomaticOutput(TIM_TypeDef *Timer)
Sets the automatic output enable bit in the break and dead time register of the timer.
void HIERODULE_TIM_DisableChannel(TIM_TypeDef *Timer, int8_t Channel)
Disables the PWM output channel of a timer.
void HIERODULE_TIM_Assign_TIM1_BRK_UP_TRG_COM_ISR(FUNC_POINTER ISR)
Assigns a function to the timer 1 break - update - trigger comm IRQ handler. Requires the device spec...
uint32_t HIERODULE_TIM_IsEnabled_IT_CC2(TIM_TypeDef *Timer)
Checks the capture compare channel 2 interrupt of the timer.
void HIERODULE_TIM_Enable_IT_CC3(TIM_TypeDef *Timer)
Enables the capture compare channel 3 interrupt of the timer.
void HIERODULE_TIM_SetFrequency(TIM_TypeDef *Timer, double Frequency_Hz)
Sets the frequency of a timer.
void HIERODULE_TIM_Enable_IT_CC2(TIM_TypeDef *Timer)
Enables the capture compare channel 2 interrupt of the timer.
void HIERODULE_TIM_Enable_IT_CC1(TIM_TypeDef *Timer)
Enables the capture compare channel 1 interrupt of the timer.
uint32_t HIERODULE_TIM_IsEnabledChannel(TIM_TypeDef *Timer, int8_t Channel)
Checks the status of the PWM output channel of a timer.
uint32_t HIERODULE_TIM_IsEnabled_IT_BRK(TIM_TypeDef *Timer)
Checks the break interrupt of the timer.
void HIERODULE_TIM_EnableChannel(TIM_TypeDef *Timer, int8_t Channel)
Enables the PWM output channel of a timer.
void HIERODULE_TIM_Disable_IT_CC3(TIM_TypeDef *Timer)
Disables the capture compare channel 3 interrupt of the timer.
double HIERODULE_TIM_GetPeriod(TIM_TypeDef *Timer)
Returns the period duration of a timer in seconds.
void HIERODULE_TIM_Disable_IT_BRK(TIM_TypeDef *Timer)
Disables the break interrupt of the timer.
void(* FUNC_POINTER)(void)
Typedef as for an alias for the void function pointer.
uint32_t HIERODULE_TIM_IsSetFlag_CC3(TIM_TypeDef *Timer)
Checks the status of the capture compare channel 3 interrupt flag of the timer.
void HIERODULE_TIM_EnableMainOutput(TIM_TypeDef *Timer)
Sets the main output enable bit in the break and dead time register of the timer.
void HIERODULE_TIM_Assign_TIM17_ISR(FUNC_POINTER ISR)
Assigns a function to the timer 17 IRQ handler. Requires the device specific macro __STM32F030x6_H to...
void HIERODULE_TIM_Assign_TIM1_CC_ISR(FUNC_POINTER ISR)
Assigns a function to the timer 1 capture compare IRQ handler. Requires HIERODULE_TIM_HANDLE_IRQ to b...
void HIERODULE_TIM_DisableMainOutput(TIM_TypeDef *Timer)
Clears the main output enable bit in the break and dead time register of the timer.
void HIERODULE_TIM_ClearFlag_CC1(TIM_TypeDef *Timer)
Clears the capture compare channel 1 interrupt flag of the timer.
void HIERODULE_TIM_Disable_IT_CC1(TIM_TypeDef *Timer)
Disables the capture compare channel 1 interrupt of the timer.
void HIERODULE_TIM_Assign_ISR_CC1(TIM_TypeDef *Timer, FUNC_POINTER ISR)
Assigns a function to the designated flag handler for the capture compare channel 1 interrupt of a ti...
void HIERODULE_TIM_Assign_ISR_CC2(TIM_TypeDef *Timer, FUNC_POINTER ISR)
Assigns a function to the designated flag handler for the capture compare channel 2 interrupt of a ti...
void HIERODULE_TIM_Assign_ISR_UPD(TIM_TypeDef *Timer, FUNC_POINTER ISR)
Assigns a function to the designated flag handler for the update interrupt of a timer....
void HIERODULE_TIM_Assign_TIM14_ISR(FUNC_POINTER ISR)
Assigns a function to the timer 14 IRQ handler. Requires the device specific macro __STM32F030x6_H to...
void HIERODULE_TIM_ClearFlag_CC2(TIM_TypeDef *Timer)
Clears the capture compare channel 2 interrupt flag of the timer.
void HIERODULE_TIM_Assign_TIM1_BRK_TIM9_ISR(FUNC_POINTER ISR)
Assigns a function to the timer 1 break - timer 9 IRQ handler. Requires the device specific macro __S...
void HIERODULE_TIM_Disable_IT_CC2(TIM_TypeDef *Timer)
Disables the capture compare channel 2 interrupt of the timer.
uint32_t HIERODULE_TIM_GetRepetition(TIM_TypeDef *Timer)
Returns the number of additional period repetitions of a timer.
uint32_t HIERODULE_TIM_IsEnabled_IT_CC4(TIM_TypeDef *Timer)
Checks the capture compare channel 4 interrupt of the timer.
void HIERODULE_TIM_ClearFlag_BRK(TIM_TypeDef *Timer)
Clears the break interrupt flag of the timer.
void HIERODULE_TIM_DisableCounter(TIM_TypeDef *Timer)
Disables the counter of a timer.
void HIERODULE_TIM_DisableAutomaticOutput(TIM_TypeDef *Timer)
Clears the automatic output enable bit in the break and dead time register of the timer.
void HIERODULE_TIM_Assign_TIM2_ISR(FUNC_POINTER ISR)
Assigns a function to the timer 2 IRQ handler. Requires the device specific macro __STM32F103xB_H or ...
uint32_t HIERODULE_TIM_IsEnabled_IT_CC1(TIM_TypeDef *Timer)
Checks the capture compare channel 1 interrupt of the timer.
void HIERODULE_TIM_Assign_ISR_CC4(TIM_TypeDef *Timer, FUNC_POINTER ISR)
Assigns a function to the designated flag handler for the capture compare channel 4 interrupt of a ti...
void HIERODULE_TIM_Assign_TIM4_ISR(FUNC_POINTER ISR)
Assigns a function to the timer 4 IRQ handler. Requires the device specific macro __STM32F103xB_H or ...
void HIERODULE_TIM_ClearCounter(TIM_TypeDef *Timer)
Clears the counter register of a timer.
void HIERODULE_TIM_Assign_TIM1_UP_ISR(FUNC_POINTER ISR)
Assigns a function to the timer 1 update IRQ handler. Requires the device specific macro __STM32F103x...
void HIERODULE_TIM_ClearFlag_UPD(TIM_TypeDef *Timer)
Clears the update interrupt flag of the timer.
void HIERODULE_TIM_Assign_ISR_CC3(TIM_TypeDef *Timer, FUNC_POINTER ISR)
Assigns a function to the designated flag handler for the capture compare channel 3 interrupt of a ti...
void HIERODULE_TIM_Assign_TIM1_TRG_COM_TIM11_ISR(FUNC_POINTER ISR)
Assigns a function to the timer 1 trigger comm - timer 11 IRQ handler. Requires the device specific m...
void HIERODULE_TIM_Assign_ISR_BRK(TIM_TypeDef *Timer, FUNC_POINTER ISR)
Assigns a function to the designated flag handler for the break interrupt of a timer....
uint32_t HIERODULE_TIM_IsEnabled_IT_CC3(TIM_TypeDef *Timer)
Checks the capture compare channel 3 interrupt of the timer.
void HIERODULE_TIM_Enable_IT_CC4(TIM_TypeDef *Timer)
Enables the capture compare channel 4 interrupt of the timer.