Hierodule 1.6.2
Utility module set for STM32 MCUs
Loading...
Searching...
No Matches
hierodule_tim.c
Go to the documentation of this file.
1
12#include <hierodule_tim.h>
13
28#ifdef HIERODULE_TIM_HANDLE_IRQ
29 #ifdef HIERODULE_TIM_CONVENIENT_IRQ
32 typedef void (*T2V_Function_Pointer)(TIM_TypeDef*);
34 #endif
35#endif
41#ifdef __STM32F030x6_H
42static const uint32_t APB1_DIV1_SINGLE = (RCC_CFGR_PPRE_DIV1>>RCC_CFGR_PPRE_Pos);
44#elif ( (defined __STM32F103xB_H) || (defined __STM32F401xC_H) )
48static const uint32_t APB1_DIV1 = (RCC_CFGR_PPRE1_DIV1>>RCC_CFGR_PPRE1_Pos);
49
53static const uint32_t APB2_DIV1 = (RCC_CFGR_PPRE2_DIV1>>RCC_CFGR_PPRE2_Pos);
55#endif
58#ifdef HIERODULE_TIM_HANDLE_IRQ
59 #ifdef HIERODULE_TIM_CONVENIENT_IRQ
65
71
77
83
89
95
102 #if ( (defined __STM32F103xB_H) || (defined __STM32F401xC_H) )
105 #endif
113 #if ( (defined __STM32F103xB_H) || (defined __STM32F401xC_H) )
116 #endif
124 #if ( (defined __STM32F103xB_H) || (defined __STM32F401xC_H) )
127 #endif
135 #if ( (defined __STM32F103xB_H) || (defined __STM32F401xC_H) )
138 #endif
146 #if ( (defined __STM32F103xB_H) || (defined __STM32F401xC_H) )
149 #endif
156
162
168
174
180
187 #if ( (defined __STM32F103xB_H) || (defined __STM32F401xC_H) )
190 #endif
198 #if ( (defined __STM32F103xB_H) || (defined __STM32F401xC_H) )
201 #endif
209 #if ( (defined __STM32F103xB_H) || (defined __STM32F401xC_H) )
212 #endif
220 #if ( (defined __STM32F103xB_H) || (defined __STM32F401xC_H) )
223 #endif
231 #if ( (defined __STM32F103xB_H) || (defined __STM32F401xC_H) )
234 #endif
237 #ifdef __STM32F401xC_H
244
251
258
265
272
279
286
293
300
307
314
321
323 #elif defined __STM32F030x6_H
331
338
345
352
359
366
373
375 #endif
376
377 #else
384
391 #if ( (defined __STM32F103xB_H) || (defined __STM32F401xC_H) )
392 static FUNC_POINTER TIM2_ISR = NULL;
394 #endif
400 static FUNC_POINTER TIM3_ISR = NULL;
401
408 #if ( (defined __STM32F103xB_H) || (defined __STM32F401xC_H) )
409 static FUNC_POINTER TIM4_ISR = NULL;
411 #endif
412
413 #ifdef __STM32F103xB_H
420
428 #elif defined __STM32F401xC_H
436
443
449 static FUNC_POINTER TIM5_ISR = NULL;
450
457
459 #elif defined __STM32F030x6_H
466
472 static FUNC_POINTER TIM14_ISR = NULL;
473
479 static FUNC_POINTER TIM16_ISR = NULL;
480
486 static FUNC_POINTER TIM17_ISR = NULL;
487
489 #endif
490 #endif //HIERODULE_TIM_CONVENIENT_IRQ
491#endif //HIERODULE_TIM_HANDLE_IRQ /** \endcond */
492
496static const uint32_t TimerChannel_EN[7] =
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};
506
511static const uint32_t TimerChannel_CCR[4] =
512{
513 offsetof(TIM_TypeDef, CCR1),
514 offsetof(TIM_TypeDef, CCR2),
515 offsetof(TIM_TypeDef, CCR3),
516 offsetof(TIM_TypeDef, CCR4)
517};
518
535static uint32_t GetBaseFreq(TIM_TypeDef *Timer)
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}
596
604static inline uint32_t *ChannelSelector(TIM_TypeDef *Timer, uint32_t ChannelOffset)
605{
606 return (uint32_t*)((char*)Timer + (size_t)ChannelOffset);
607}
608
610#ifdef HIERODULE_TIM_HANDLE_IRQ
611 #ifdef HIERODULE_TIM_CONVENIENT_IRQ
622 static void Check_IT
623 (
624 TIM_TypeDef *Timer,
625 FUNC_POINTER Handler,
626 T2V_Function_Pointer ClearFlag
627 )
628 {
629 if(Handler != NULL)
630 {
631 Handler();
632 }
633 ClearFlag(Timer);
634 }
635
641 static void InfiniteLoopOfError(void)
642 {
643 while(1);
644 }
646 #endif
647#endif
661void HIERODULE_TIM_SetPeriod(TIM_TypeDef *Timer, double DurationSec)
662{
663 WRITE_REG(Timer->ARR, GetBaseFreq(Timer)*DurationSec-1.0);
664}
665
669double HIERODULE_TIM_GetPeriod(TIM_TypeDef *Timer)
670{
671 return ((double)READ_REG(Timer->ARR)+1.0)/((double)GetBaseFreq(Timer));
672}
673
678void HIERODULE_TIM_SetFrequency(TIM_TypeDef *Timer, double Frequency_Hz)
679{
680 WRITE_REG(Timer->ARR, GetBaseFreq(Timer)/Frequency_Hz-1.0);
681}
682
686double HIERODULE_TIM_GetFrequency(TIM_TypeDef *Timer)
687{
688 return ((double)GetBaseFreq(Timer))/((double)(READ_REG(Timer->ARR)+1.0));
689}
690
693void HIERODULE_TIM_ClearCounter(TIM_TypeDef *Timer)
694{
695 Timer->CNT = 0U;
696}
697
705void HIERODULE_TIM_SetRepetition(TIM_TypeDef *Timer, uint32_t Reps)
706{
707 WRITE_REG(Timer->RCR, Reps);
708}
709
714uint32_t HIERODULE_TIM_GetRepetition(TIM_TypeDef *Timer)
715{
716 return READ_REG(Timer->RCR);
717}
718
722void HIERODULE_TIM_EnableChannel(TIM_TypeDef *Timer, int8_t Channel)
723{
724 if( (Channel > 0) && (Channel < 5) )
725 {
726 SET_BIT(Timer->CCER, TimerChannel_EN[Channel-1]);
727 }
728 else if( (Channel < 0) && (Channel > -4) )
729 {
730 SET_BIT(Timer->CCER, TimerChannel_EN[abs(Channel)+3]);
731 }
732}
733
737void HIERODULE_TIM_DisableChannel(TIM_TypeDef *Timer, int8_t Channel)
738{
739 if( (Channel > 0) && (Channel < 5) )
740 {
741 CLEAR_BIT(Timer->CCER, TimerChannel_EN[Channel-1]);
742 }
743 else if( (Channel < 0) && (Channel > -4) )
744 {
745 CLEAR_BIT(Timer->CCER, TimerChannel_EN[abs(Channel)+3]);
746 }
747}
748
753uint32_t HIERODULE_TIM_IsEnabledChannel(TIM_TypeDef *Timer, int8_t Channel)
754{
755 if( (Channel > 0) && (Channel < 5) )
756 {
757 if( (READ_BIT(Timer->CCER, TimerChannel_EN[Channel-1]))
758 == (TimerChannel_EN[Channel-1]))
759 {
760 return 1UL;
761 }
762 else
763 {
764 return 0UL;
765 }
766 }
767 else if( (Channel < 0) && (Channel > -4) )
768 {
769 if( (READ_BIT(Timer->CCER, TimerChannel_EN[abs(Channel)+3]))
770 == (TimerChannel_EN[abs(Channel)+3]))
771 {
772 return 1UL;
773 }
774 else
775 {
776 return 0UL;
777 }
778 }
779 else
780 {
781 return 0UL;
782 }
783}
784
787void HIERODULE_TIM_EnableMainOutput(TIM_TypeDef *Timer)
788{
789 SET_BIT(Timer->BDTR, TIM_BDTR_MOE);
790}
791
794void HIERODULE_TIM_DisableMainOutput(TIM_TypeDef *Timer)
795{
796 CLEAR_BIT(Timer->BDTR, TIM_BDTR_MOE);
797}
798
804(
805 TIM_TypeDef *Timer,
806 uint8_t Channel,
807 double NormalizedDutyCycle
808)
809{
810 if( (Channel > 0) && (Channel < 5) )
811 {
812 (*(ChannelSelector(Timer, TimerChannel_CCR[Channel-1]))) =
813 ((uint32_t)(READ_REG(Timer->ARR)))*NormalizedDutyCycle;
814 }
815}
816
822double HIERODULE_TIM_GetDutyCycle(TIM_TypeDef *Timer, uint8_t Channel)
823{
824 if( (Channel < 1) && (Channel > 4) )
825 {
826 return -1.0;
827 }
828 else
829 {
830 return
831 ((double)(*(ChannelSelector(Timer, TimerChannel_CCR[Channel-1]))))
832 / ((double)(READ_REG(Timer->ARR)));
833 }
834}
835
838void HIERODULE_TIM_ClearFlag_UPD(TIM_TypeDef *Timer)
839{
840 WRITE_REG(Timer->SR, ~(TIM_SR_UIF));
841}
842
845void HIERODULE_TIM_ClearFlag_CC1(TIM_TypeDef *Timer)
846{
847 WRITE_REG(Timer->SR, ~(TIM_SR_CC1IF));
848}
849
852void HIERODULE_TIM_ClearFlag_CC2(TIM_TypeDef *Timer)
853{
854 WRITE_REG(Timer->SR, ~(TIM_SR_CC2IF));
855}
856
859void HIERODULE_TIM_ClearFlag_CC3(TIM_TypeDef *Timer)
860{
861 WRITE_REG(Timer->SR, ~(TIM_SR_CC3IF));
862}
863
866void HIERODULE_TIM_ClearFlag_CC4(TIM_TypeDef *Timer)
867{
868 WRITE_REG(Timer->SR, ~(TIM_SR_CC4IF));
869}
870
873void HIERODULE_TIM_ClearFlag_BRK(TIM_TypeDef *Timer)
874{
875 WRITE_REG(Timer->SR, ~(TIM_SR_BIF));
876}
877
880uint32_t HIERODULE_TIM_IsSetFlag_UPD(TIM_TypeDef *Timer)
881{
882 return ((READ_BIT(Timer->SR, TIM_SR_UIF) == (TIM_SR_UIF)) ? 1UL : 0UL);
883}
884
887uint32_t HIERODULE_TIM_IsSetFlag_CC1(TIM_TypeDef *Timer)
888{
889 return ((READ_BIT(Timer->SR, TIM_SR_CC1IF) == (TIM_SR_CC1IF)) ? 1UL : 0UL);
890}
891
894uint32_t HIERODULE_TIM_IsSetFlag_CC2(TIM_TypeDef *Timer)
895{
896 return ((READ_BIT(Timer->SR, TIM_SR_CC2IF) == (TIM_SR_CC2IF)) ? 1UL : 0UL);
897}
898
901uint32_t HIERODULE_TIM_IsSetFlag_CC3(TIM_TypeDef *Timer)
902{
903 return ((READ_BIT(Timer->SR, TIM_SR_CC3IF) == (TIM_SR_CC3IF)) ? 1UL : 0UL);
904}
905
908uint32_t HIERODULE_TIM_IsSetFlag_CC4(TIM_TypeDef *Timer)
909{
910 return ((READ_BIT(Timer->SR, TIM_SR_CC4IF) == (TIM_SR_CC4IF)) ? 1UL : 0UL);
911}
912
915uint32_t HIERODULE_TIM_IsSetFlag_BRK(TIM_TypeDef *Timer)
916{
917 return ((READ_BIT(Timer->SR, TIM_SR_BIF) == (TIM_SR_BIF)) ? 1UL : 0UL);
918}
919
922void HIERODULE_TIM_Enable_IT_UPD(TIM_TypeDef *Timer)
923{
925 SET_BIT(Timer->DIER, TIM_DIER_UIE);
926}
927
930void HIERODULE_TIM_Enable_IT_CC1(TIM_TypeDef *Timer)
931{
933 SET_BIT(Timer->DIER, TIM_DIER_CC1IE);
934}
935
938void HIERODULE_TIM_Enable_IT_CC2(TIM_TypeDef *Timer)
939{
941 SET_BIT(Timer->DIER, TIM_DIER_CC2IE);
942}
943
946void HIERODULE_TIM_Enable_IT_CC3(TIM_TypeDef *Timer)
947{
949 SET_BIT(Timer->DIER, TIM_DIER_CC3IE);
950}
951
954void HIERODULE_TIM_Enable_IT_CC4(TIM_TypeDef *Timer)
955{
957 SET_BIT(Timer->DIER, TIM_DIER_CC4IE);
958}
959
962void HIERODULE_TIM_Enable_IT_BRK(TIM_TypeDef *Timer)
963{
965 SET_BIT(Timer->DIER, TIM_DIER_BIE);
966}
967
970void HIERODULE_TIM_Disable_IT_UPD(TIM_TypeDef *Timer)
971{
972 CLEAR_BIT(Timer->DIER, TIM_DIER_UIE);
973}
974
977void HIERODULE_TIM_Disable_IT_CC1(TIM_TypeDef *Timer)
978{
979 CLEAR_BIT(Timer->DIER, TIM_DIER_CC1IE);
980}
981
984void HIERODULE_TIM_Disable_IT_CC2(TIM_TypeDef *Timer)
985{
986 CLEAR_BIT(Timer->DIER, TIM_DIER_CC2IE);
987}
988
991void HIERODULE_TIM_Disable_IT_CC3(TIM_TypeDef *Timer)
992{
993 CLEAR_BIT(Timer->DIER, TIM_DIER_CC3IE);
994}
995
998void HIERODULE_TIM_Disable_IT_CC4(TIM_TypeDef *Timer)
999{
1000 CLEAR_BIT(Timer->DIER, TIM_DIER_CC4IE);
1001}
1002
1005void HIERODULE_TIM_Disable_IT_BRK(TIM_TypeDef *Timer)
1006{
1007 CLEAR_BIT(Timer->DIER, TIM_DIER_BIE);
1008}
1009
1012uint32_t HIERODULE_TIM_IsEnabled_IT_UPD(TIM_TypeDef *Timer)
1013{
1014 return ((READ_BIT(Timer->DIER, TIM_DIER_UIE) == (TIM_DIER_UIE))
1015 ? 1UL : 0UL);
1016}
1017
1020uint32_t HIERODULE_TIM_IsEnabled_IT_CC1(TIM_TypeDef *Timer)
1021{
1022 return ((READ_BIT(Timer->DIER, TIM_DIER_CC1IE) == (TIM_DIER_CC1IE))
1023 ? 1UL : 0UL);
1024}
1025
1028uint32_t HIERODULE_TIM_IsEnabled_IT_CC2(TIM_TypeDef *Timer)
1029{
1030 return ((READ_BIT(Timer->DIER, TIM_DIER_CC2IE) == (TIM_DIER_CC2IE))
1031 ? 1UL : 0UL);
1032}
1033
1036uint32_t HIERODULE_TIM_IsEnabled_IT_CC3(TIM_TypeDef *Timer)
1037{
1038 return ((READ_BIT(Timer->DIER, TIM_DIER_CC3IE) == (TIM_DIER_CC3IE))
1039 ? 1UL : 0UL);
1040}
1041
1044uint32_t HIERODULE_TIM_IsEnabled_IT_CC4(TIM_TypeDef *Timer)
1045{
1046 return ((READ_BIT(Timer->DIER, TIM_DIER_CC4IE) == (TIM_DIER_CC4IE))
1047 ? 1UL : 0UL);
1048}
1049
1052uint32_t HIERODULE_TIM_IsEnabled_IT_BRK(TIM_TypeDef *Timer)
1053{
1054 return ((READ_BIT(Timer->DIER, TIM_DIER_BIE) == (TIM_DIER_BIE))
1055 ? 1UL : 0UL);
1056}
1057
1061{
1062 SET_BIT(Timer->BDTR, TIM_BDTR_AOE);
1063}
1064
1068{
1069 CLEAR_BIT(Timer->BDTR, TIM_BDTR_AOE);
1070}
1071
1074void HIERODULE_TIM_EnableCounter(TIM_TypeDef *Timer)
1075{
1076 SET_BIT(Timer->CR1, TIM_CR1_CEN);
1077}
1078
1081void HIERODULE_TIM_DisableCounter(TIM_TypeDef *Timer)
1082{
1083 CLEAR_BIT(Timer->CR1, TIM_CR1_CEN);
1084}
1085
1088uint32_t HIERODULE_TIM_IsEnabledCounter(TIM_TypeDef *Timer)
1089{
1090 return ((READ_BIT(Timer->CR1, TIM_CR1_CEN) == (TIM_CR1_CEN)) ? 1UL : 0UL);
1091}
1092
1094#ifdef HIERODULE_TIM_HANDLE_IRQ
1095
1096#ifdef HIERODULE_TIM_CONVENIENT_IRQ
1099void HIERODULE_TIM_Assign_ISR_UPD(TIM_TypeDef *Timer, FUNC_POINTER ISR)
1100{
1101 uint32_t TimerAddress = (uint32_t)Timer;
1102
1103 switch(TimerAddress)
1104 {
1105 case ( (uint32_t)TIM1 ):
1106 UPD_Handler_TIM1 = ISR;
1107 break;
1109 #if ( (defined __STM32F103xB_H) || (defined __STM32F401xC_H) )
1110 case ( (uint32_t)TIM2 ):
1111 UPD_Handler_TIM2 = ISR;
1112 break;
1114 #endif
1115 case ( (uint32_t)TIM3 ):
1116 UPD_Handler_TIM3 = ISR;
1117 break;
1119 #if ( (defined __STM32F103xB_H) || (defined __STM32F401xC_H) )
1120 case ( (uint32_t)TIM4 ):
1121 UPD_Handler_TIM4 = ISR;
1122 break;
1124 #endif
1125 #ifdef __STM32F401xC_H
1126 case ( (uint32_t)TIM5 ):
1127 UPD_Handler_TIM5 = ISR;
1128 break;
1129 case ( (uint32_t)TIM9 ):
1130 UPD_Handler_TIM9 = ISR;
1131 break;
1132 case ( (uint32_t)TIM10 ):
1133 UPD_Handler_TIM10 = ISR;
1134 break;
1135 case ( (uint32_t)TIM11 ):
1136 UPD_Handler_TIM11 = ISR;
1137 break;
1139 #elif defined __STM32F030x6_H
1140 case ( (uint32_t)TIM14 ):
1141 UPD_Handler_TIM14 = ISR;
1142 break;
1143 case ( (uint32_t)TIM16 ):
1144 UPD_Handler_TIM16 = ISR;
1145 break;
1146 case ( (uint32_t)TIM17 ):
1147 UPD_Handler_TIM17 = ISR;
1148 break;
1150 #endif
1151 default:
1153 }
1154}
1155
1158void HIERODULE_TIM_Assign_ISR_CC1(TIM_TypeDef *Timer, FUNC_POINTER ISR)
1159{
1160 uint32_t TimerAddress = (uint32_t)Timer;
1161
1162 switch(TimerAddress)
1163 {
1164 case ( (uint32_t)TIM1 ):
1165 CC1_Handler_TIM1 = ISR;
1166 break;
1168 #if ( (defined __STM32F103xB_H) || (defined __STM32F401xC_H) )
1169 case ( (uint32_t)TIM2 ):
1170 CC1_Handler_TIM2 = ISR;
1171 break;
1173 #endif
1174 case ( (uint32_t)TIM3 ):
1175 CC1_Handler_TIM3 = ISR;
1176 break;
1178 #if ( (defined __STM32F103xB_H) || (defined __STM32F401xC_H) )
1179 case ( (uint32_t)TIM4 ):
1180 CC1_Handler_TIM4 = ISR;
1181 break;
1183 #endif
1184 #ifdef __STM32F401xC_H
1185 case ( (uint32_t)TIM5 ):
1186 CC1_Handler_TIM5 = ISR;
1187 break;
1188 case ( (uint32_t)TIM9 ):
1189 CC1_Handler_TIM9 = ISR;
1190 break;
1191 case ( (uint32_t)TIM10 ):
1192 CC1_Handler_TIM10 = ISR;
1193 break;
1194 case ( (uint32_t)TIM11 ):
1195 CC1_Handler_TIM11 = ISR;
1196 break;
1198 #elif defined __STM32F030x6_H
1199 case ( (uint32_t)TIM14 ):
1200 CC1_Handler_TIM14 = ISR;
1201 break;
1202 case ( (uint32_t)TIM16 ):
1203 CC1_Handler_TIM16 = ISR;
1204 break;
1205 case ( (uint32_t)TIM17 ):
1206 CC1_Handler_TIM17 = ISR;
1207 break;
1209 #endif
1210 default:
1212 }
1213}
1214
1217void HIERODULE_TIM_Assign_ISR_CC2(TIM_TypeDef *Timer, FUNC_POINTER ISR)
1218{
1219 uint32_t TimerAddress = (uint32_t)Timer;
1220
1221 switch(TimerAddress)
1222 {
1223 case ( (uint32_t)TIM1 ):
1224 CC2_Handler_TIM1 = ISR;
1225 break;
1227 #if ( (defined __STM32F103xB_H) || (defined __STM32F401xC_H) )
1228 case ( (uint32_t)TIM2 ):
1229 CC2_Handler_TIM2 = ISR;
1230 break;
1232 #endif
1233 case ( (uint32_t)TIM3 ):
1234 CC2_Handler_TIM3 = ISR;
1235 break;
1237 #if ( (defined __STM32F103xB_H) || (defined __STM32F401xC_H) )
1238 case ( (uint32_t)TIM4 ):
1239 CC2_Handler_TIM4 = ISR;
1240 break;
1242 #endif
1243 #ifdef __STM32F401xC_H
1244 case ( (uint32_t)TIM5 ):
1245 CC2_Handler_TIM5 = ISR;
1246 break;
1247 case ( (uint32_t)TIM9 ):
1248 CC2_Handler_TIM9 = ISR;
1249 break;
1251 #endif
1252 default:
1254 }
1255}
1256
1259void HIERODULE_TIM_Assign_ISR_CC3(TIM_TypeDef *Timer, FUNC_POINTER ISR)
1260{
1261 uint32_t TimerAddress = (uint32_t)Timer;
1262
1263 switch(TimerAddress)
1264 {
1265 case ( (uint32_t)TIM1 ):
1266 CC3_Handler_TIM1 = ISR;
1267 break;
1269 #if ( (defined __STM32F103xB_H) || (defined __STM32F401xC_H) )
1270 case ( (uint32_t)TIM2 ):
1271 CC3_Handler_TIM2 = ISR;
1272 break;
1274 #endif
1275 case ( (uint32_t)TIM3 ):
1276 CC3_Handler_TIM3 = ISR;
1277 break;
1279 #if ( (defined __STM32F103xB_H) || (defined __STM32F401xC_H) )
1280 case ( (uint32_t)TIM4 ):
1281 CC3_Handler_TIM4 = ISR;
1282 break;
1284 #endif
1285 #ifdef __STM32F401xC_H
1286 case ( (uint32_t)TIM5 ):
1287 CC3_Handler_TIM5 = ISR;
1288 break;
1290 #endif
1291 default:
1293 }
1294}
1295
1298void HIERODULE_TIM_Assign_ISR_CC4(TIM_TypeDef *Timer, FUNC_POINTER ISR)
1299{
1300 uint32_t TimerAddress = (uint32_t)Timer;
1301
1302 switch(TimerAddress)
1303 {
1304 case ( (uint32_t)TIM1 ):
1305 CC4_Handler_TIM1 = ISR;
1306 break;
1308 #if ( (defined __STM32F103xB_H) || (defined __STM32F401xC_H) )
1309 case ( (uint32_t)TIM2 ):
1310 CC4_Handler_TIM2 = ISR;
1311 break;
1313 #endif
1314 case ( (uint32_t)TIM3 ):
1315 CC4_Handler_TIM3 = ISR;
1316 break;
1318 #if ( (defined __STM32F103xB_H) || (defined __STM32F401xC_H) )
1319 case ( (uint32_t)TIM4 ):
1320 CC4_Handler_TIM4 = ISR;
1321 break;
1323 #endif
1324 #ifdef __STM32F401xC_H
1325 case ( (uint32_t)TIM5 ):
1326 CC4_Handler_TIM5 = ISR;
1327 break;
1329 #endif
1330 default:
1332 }
1333}
1334
1337void HIERODULE_TIM_Assign_ISR_BRK(TIM_TypeDef *Timer, FUNC_POINTER ISR)
1338{
1339 uint32_t TimerAddress = (uint32_t)Timer;
1340
1341 switch(TimerAddress)
1342 {
1343 case ( (uint32_t)TIM1 ):
1344 BRK_Handler_TIM1 = ISR;
1345 break;
1347 #ifdef __STM32F030x6_H
1348 case ( (uint32_t)TIM17 ):
1349 BRK_Handler_TIM17 = ISR;
1350 break;
1352 #endif
1353 default:
1355 }
1356}
1358#else
1362 {
1363 TIM1_CC_ISR = ISR;
1364 }
1365
1369 #if ( (defined __STM32F103xB_H) || (defined __STM32F401xC_H) )
1371 {
1372 TIM2_ISR = ISR;
1373 }
1375 #endif
1380 {
1381 TIM3_ISR = ISR;
1382 }
1383
1387 #if ( (defined __STM32F103xB_H) || (defined __STM32F401xC_H) )
1389 {
1390 TIM4_ISR = ISR;
1391 }
1393 #endif
1394 #ifdef __STM32F103xB_H
1399 {
1400 TIM1_UP_ISR = ISR;
1401 }
1402
1410 #elif defined __STM32F401xC_H
1418
1425
1429 {
1430 TIM5_ISR = ISR;
1431 }
1432
1439
1441 #elif defined __STM32F030x6_H
1449
1453 {
1454 TIM14_ISR = ISR;
1455 }
1456
1460 {
1461 TIM16_ISR = ISR;
1462 }
1463
1467 {
1468 TIM17_ISR = ISR;
1469 }
1471 #endif
1472
1473#endif //HIERODULE_TIM_CONVENIENT_IRQ /** \endcond */
1474
1476#ifdef __STM32F103xB_H
1485#if (HIERODULE_TIM_RESERVED != 1)
1486extern void TIM1_UP_IRQHandler(void)
1487{
1489 #ifdef HIERODULE_TIM_CONVENIENT_IRQ
1492 #else
1493 TIM1_UP_ISR();
1495 #endif
1496}
1498#endif
1499
1500#elif defined __STM32F401xC_H
1509#if ( (HIERODULE_TIM_RESERVED != 1) && (HIERODULE_TIM_RESERVED != 10) )
1511{
1513 #ifdef HIERODULE_TIM_CONVENIENT_IRQ
1515 {
1517 }
1519 {
1521 }
1523 {
1525 }
1527 #else
1530 #endif
1531}
1533#endif
1534
1535#endif
1544#if (HIERODULE_TIM_RESERVED != 1)
1545extern void TIM1_CC_IRQHandler(void)
1546{
1548 #ifdef HIERODULE_TIM_CONVENIENT_IRQ
1550 {
1552 }
1554 {
1556 }
1558 {
1560 }
1562 {
1564 }
1566 #else
1567 TIM1_CC_ISR();
1569 #endif
1570}
1571
1573#endif
1574
1575#ifdef __STM32F103xB_H
1584#if (HIERODULE_TIM_RESERVED != 1)
1585extern void TIM1_BRK_IRQHandler(void)
1586{
1588 #ifdef HIERODULE_TIM_CONVENIENT_IRQ
1591 #else
1592 TIM1_BRK_ISR();
1594 #endif
1595}
1597#endif
1598#elif defined __STM32F401xC_H
1607#if ( (HIERODULE_TIM_RESERVED != 1) && (HIERODULE_TIM_RESERVED != 9) )
1609{
1611 #ifdef HIERODULE_TIM_CONVENIENT_IRQ
1613 {
1615 }
1617 {
1619 }
1621 {
1623 }
1625 {
1627 }
1629 #else
1632 #endif
1633}
1634
1636#endif
1637#elif defined __STM32F030x6_H
1646#if (HIERODULE_TIM_RESERVED != 1)
1648{
1650 #ifdef HIERODULE_TIM_CONVENIENT_IRQ
1652 {
1654 }
1656 {
1658 }
1660 #else
1663 #endif
1664}
1666#endif
1667#endif
1677#if ( (defined __STM32F103xB_H) || (defined __STM32F401xC_H) )
1679#if (HIERODULE_TIM_RESERVED != 2)
1680extern void TIM2_IRQHandler(void)
1681{
1683 #ifdef HIERODULE_TIM_CONVENIENT_IRQ
1685 {
1687 }
1689 {
1691 }
1693 {
1695 }
1697 {
1699 }
1701 {
1703 }
1705 #else
1706 TIM2_ISR();
1708 #endif
1709}
1711#endif
1712#endif
1721#if (HIERODULE_TIM_RESERVED != 3)
1722extern void TIM3_IRQHandler(void)
1723{
1725 #ifdef HIERODULE_TIM_CONVENIENT_IRQ
1727 {
1729 }
1731 {
1733 }
1735 {
1737 }
1739 {
1741 }
1743 {
1745 }
1747 #else
1748 TIM3_ISR();
1750 #endif
1751}
1753#endif
1763#if ( (defined __STM32F103xB_H) || (defined __STM32F401xC_H) )
1765#if (HIERODULE_TIM_RESERVED != 4)
1766extern void TIM4_IRQHandler(void)
1767{
1769 #ifdef HIERODULE_TIM_CONVENIENT_IRQ
1771 {
1773 }
1775 {
1777 }
1779 {
1781 }
1783 {
1785 }
1787 {
1789 }
1791 #else
1792 TIM4_ISR();
1794 #endif
1795}
1797#endif
1798#endif
1801#ifdef __STM32F401xC_H
1810#if (HIERODULE_TIM_RESERVED != 5)
1811extern void TIM5_IRQHandler(void)
1812{
1814 #ifdef HIERODULE_TIM_CONVENIENT_IRQ
1816 {
1818 }
1820 {
1822 }
1824 {
1826 }
1828 {
1830 }
1832 {
1834 }
1836 #else
1837 TIM5_ISR();
1839 #endif
1840}
1842#endif
1852#if ( (HIERODULE_TIM_RESERVED != 1) && (HIERODULE_TIM_RESERVED != 11) )
1854{
1856 #ifdef HIERODULE_TIM_CONVENIENT_IRQ
1858 {
1860 }
1862 {
1864 }
1866 #else
1869 #endif
1870}
1871
1873#endif
1874#elif defined __STM32F030x6_H
1884#if (HIERODULE_TIM_RESERVED != 14)
1885extern void TIM14_IRQHandler(void)
1886{
1888 #ifdef HIERODULE_TIM_CONVENIENT_IRQ
1890 {
1892 }
1894 {
1896 }
1898 #else
1899 TIM14_ISR();
1901 #endif
1902}
1904#endif
1914#if (HIERODULE_TIM_RESERVED != 16)
1915extern void TIM16_IRQHandler(void)
1916{
1918 #ifdef HIERODULE_TIM_CONVENIENT_IRQ
1920 {
1922 }
1924 {
1926 }
1928 #else
1929 TIM16_ISR();
1931 #endif
1932}
1934#endif
1944#if (HIERODULE_TIM_RESERVED != 17)
1945extern void TIM17_IRQHandler(void)
1946{
1948 #ifdef HIERODULE_TIM_CONVENIENT_IRQ
1950 {
1952 }
1954 {
1956 }
1958 {
1960 }
1962 #else
1963 TIM17_ISR();
1965 #endif
1966}
1968#endif
1971#endif
1972#endif
static void InfiniteLoopOfError(void)
Requires HIERODULE_TIM_HANDLE_IRQ to be defined. Requires HIERODULE_TIM_CONVENIENT_IRQ to be defined.
static FUNC_POINTER CC3_Handler_TIM3
ISR handler for capture compare channel 3 interrupt flag of timer 3 Requires HIERODULE_TIM_HANDLE_IRQ...
static FUNC_POINTER TIM5_ISR
Pointer to the Timer 5 IRQ routine. Requires the device specific macro __STM32F401xC_H to be defined....
static FUNC_POINTER CC3_Handler_TIM5
ISR handler for capture compare channel 3 interrupt flag of timer 5 Requires the device specific macr...
static FUNC_POINTER UPD_Handler_TIM10
ISR handler for update interrupt flag of timer 10 Requires the device specific macro __STM32F401xC_H ...
static FUNC_POINTER CC1_Handler_TIM1
ISR handler for capture compare channel 1 interrupt flag of timer 1 Requires HIERODULE_TIM_HANDLE_IRQ...
static FUNC_POINTER CC2_Handler_TIM9
ISR handler for capture compare channel 2 interrupt flag of timer 9 Requires the device specific macr...
static const uint32_t APB1_DIV1
Constant to check if non-unitary prescaling has been applied to advanced peripheral bus 1....
static FUNC_POINTER CC3_Handler_TIM1
ISR handler for capture compare channel 3 interrupt flag of timer 1 Requires HIERODULE_TIM_HANDLE_IRQ...
static FUNC_POINTER TIM3_ISR
Pointer to the Timer 3 IRQ routine. Requires HIERODULE_TIM_HANDLE_IRQ to be defined....
static FUNC_POINTER UPD_Handler_TIM16
ISR handler for update interrupt flag of timer 16 Requires the device specific macro __STM32F030x6_H ...
static FUNC_POINTER TIM16_ISR
Pointer to the Timer 16 IRQ routine. Requires the device specific macro __STM32F030x6_H to be defined...
static FUNC_POINTER CC1_Handler_TIM5
ISR handler for capture compare channel 1 interrupt flag of timer 5 Requires the device specific macr...
static FUNC_POINTER CC4_Handler_TIM3
ISR handler for capture compare channel 4 interrupt flag of timer 3 Requires HIERODULE_TIM_HANDLE_IRQ...
static FUNC_POINTER CC1_Handler_TIM9
ISR handler for capture compare channel 1 interrupt flag of timer 9 Requires the device specific macr...
static FUNC_POINTER CC4_Handler_TIM5
ISR handler for capture compare channel 4 interrupt flag of timer 5 Requires the device specific macr...
static FUNC_POINTER BRK_Handler_TIM17
ISR handler for break interrupt flag of timer 17 Requires the device specific macro __STM32F030x6_H t...
static FUNC_POINTER TIM2_ISR
Pointer to the Timer 2 IRQ routine. Requires the device specific macro __STM32F103xB_H or __STM32F401...
static FUNC_POINTER CC2_Handler_TIM3
ISR handler for capture compare channel 2 interrupt flag of timer 3 Requires HIERODULE_TIM_HANDLE_IRQ...
static FUNC_POINTER UPD_Handler_TIM9
ISR handler for update interrupt flag of timer 9 Requires the device specific macro __STM32F401xC_H t...
static FUNC_POINTER CC1_Handler_TIM14
ISR handler for capture compare channel 1 interrupt flag of timer 14 Requires the device specific mac...
static FUNC_POINTER TIM1_BRK_TIM9_ISR
Pointer to the Timer 1 break - timer 9 IRQ routine. Requires the device specific macro __STM32F401xC_...
static FUNC_POINTER TIM1_BRK_UP_TRG_COM_ISR
Pointer to the Timer 1 break - update - trigger - comm IRQ routine. Requires the device specific macr...
static FUNC_POINTER UPD_Handler_TIM4
ISR handler for update interrupt flag of timer 4 Requires the device specific macro __STM32F103xB_H o...
static const uint32_t APB2_DIV1
Constant to check if non-unitary prescaling has been applied to advanced peripheral bus 2....
static FUNC_POINTER UPD_Handler_TIM5
ISR handler for update interrupt flag of timer 5 Requires the device specific macro __STM32F401xC_H t...
static FUNC_POINTER UPD_Handler_TIM3
ISR handler for update interrupt flag of timer 3 Requires HIERODULE_TIM_HANDLE_IRQ to be defined....
static FUNC_POINTER CC4_Handler_TIM1
ISR handler for capture compare channel 4 interrupt flag of timer 1 Requires HIERODULE_TIM_HANDLE_IRQ...
static FUNC_POINTER TIM17_ISR
Pointer to the Timer 17 IRQ routine. Requires the device specific macro __STM32F030x6_H to be defined...
static FUNC_POINTER CC1_Handler_TIM11
ISR handler for capture compare channel 1 interrupt flag of timer 11 Requires the device specific mac...
static FUNC_POINTER TIM1_TRG_COM_TIM11_ISR
Pointer to the Timer 1 trigger comm - timer 11 IRQ routine. Requires the device specific macro __STM3...
static FUNC_POINTER CC4_Handler_TIM2
ISR handler for capture compare channel 4 interrupt flag of timer 2 Requires the device specific macr...
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 ...
static FUNC_POINTER TIM1_UP_TIM10_ISR
Pointer to the Timer 1 update - timer 10 IRQ routine. Requires the device specific macro __STM32F401x...
static FUNC_POINTER UPD_Handler_TIM14
ISR handler for update interrupt flag of timer 14 Requires the device specific macro __STM32F030x6_H ...
static uint32_t * ChannelSelector(TIM_TypeDef *Timer, uint32_t ChannelOffset)
Returns the pointer to the target channel's capture compare register.
static FUNC_POINTER TIM1_BRK_ISR
Pointer to the Timer 1 break IRQ routine. Requires the device specific macro __STM32F103xB_H to be de...
static FUNC_POINTER BRK_Handler_TIM1
ISR handler for break interrupt flag of timer 1 Requires HIERODULE_TIM_HANDLE_IRQ to be defined....
static FUNC_POINTER TIM1_CC_ISR
Pointer to the Timer 1 Capture Compare IRQ routine. Requires HIERODULE_TIM_HANDLE_IRQ to be defined....
static FUNC_POINTER CC2_Handler_TIM2
ISR handler for capture compare channel 2 interrupt flag of timer 2 Requires the device specific macr...
static FUNC_POINTER CC1_Handler_TIM17
ISR handler for capture compare channel 1 interrupt flag of timer 17 Requires the device specific mac...
static FUNC_POINTER CC1_Handler_TIM3
ISR handler for capture compare channel 1 interrupt flag of timer 3 Requires HIERODULE_TIM_HANDLE_IRQ...
static FUNC_POINTER CC3_Handler_TIM4
ISR handler for capture compare channel 3 interrupt flag of timer 4 Requires the device specific macr...
static FUNC_POINTER CC1_Handler_TIM2
ISR handler for capture compare channel 1 interrupt flag of timer 2 Requires the device specific macr...
static uint32_t GetBaseFreq(TIM_TypeDef *Timer)
Returns the base frequency of a timer.
static FUNC_POINTER CC3_Handler_TIM2
ISR handler for capture compare channel 3 interrupt flag of timer 2 Requires the device specific macr...
static FUNC_POINTER CC2_Handler_TIM4
ISR handler for capture compare channel 2 interrupt flag of timer 4 Requires the device specific macr...
static FUNC_POINTER CC1_Handler_TIM16
ISR handler for capture compare channel 1 interrupt flag of timer 16 Requires the device specific mac...
static const uint32_t TimerChannel_EN[7]
The array the timer PWM output channel enable bitmasks are kept.
static FUNC_POINTER TIM14_ISR
Pointer to the Timer 14 IRQ routine. Requires the device specific macro __STM32F030x6_H to be defined...
static FUNC_POINTER CC2_Handler_TIM5
ISR handler for capture compare channel 2 interrupt flag of timer 5 Requires the device specific macr...
static FUNC_POINTER CC4_Handler_TIM4
ISR handler for capture compare channel 4 interrupt flag of timer 4 Requires the device specific macr...
void(* T2V_Function_Pointer)(TIM_TypeDef *)
Used to reference a clear-flag routine for Check_IT.
static FUNC_POINTER CC1_Handler_TIM10
ISR handler for capture compare channel 1 interrupt flag of timer 10 Requires the device specific mac...
static FUNC_POINTER TIM4_ISR
Pointer to the Timer 4 IRQ routine. Requires the device specific macro __STM32F103xB_H or __STM32F401...
static FUNC_POINTER UPD_Handler_TIM17
ISR handler for update interrupt flag of timer 17 Requires the device specific macro __STM32F030x6_H ...
static FUNC_POINTER UPD_Handler_TIM2
ISR handler for update interrupt flag of timer 2 Requires the device specific macro __STM32F103xB_H o...
static FUNC_POINTER UPD_Handler_TIM11
ISR handler for update interrupt flag of timer 11 Requires the device specific macro __STM32F401xC_H ...
static const uint32_t TimerChannel_CCR[4]
Keeps the offsets to capture compare registers within a TIM_Typedef for all four channels.
static const uint32_t APB1_DIV1_SINGLE
Constant to check if non-unitary prescaling has been applied to advanced peripheral bus 1....
static FUNC_POINTER UPD_Handler_TIM1
ISR handler for update interrupt flag of timer 1 Requires HIERODULE_TIM_HANDLE_IRQ to be defined....
static FUNC_POINTER TIM1_UP_ISR
Pointer to the Timer 1 update IRQ routine. Requires the device specific macro __STM32F103xB_H to be d...
static FUNC_POINTER CC2_Handler_TIM1
ISR handler for capture compare channel 2 interrupt flag of timer 1 Requires HIERODULE_TIM_HANDLE_IRQ...
static FUNC_POINTER CC1_Handler_TIM4
ISR handler for capture compare channel 1 interrupt flag of timer 4 Requires the device specific macr...
void HIERODULE_TIM_SetRepetition(TIM_TypeDef *Timer, uint32_t Reps)
Sets the additional period repetitions of a timer.
void TIM1_TRG_COM_TIM11_IRQHandler(void)
Timer 1 trigger comm interrupt - timer 11 IRQ implementation. Requires the device specific macro __ST...
void TIM1_BRK_UP_TRG_COM_IRQHandler(void)
Timer 1 break - update - trigger comm IRQ implementation. Requires the device specific macro __STM32F...
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.
void TIM2_IRQHandler(void)
Timer 2 IRQ implementation. Requires the device specific macro __STM32F103xB_H or __STM32F401xC_H to ...
void TIM1_BRK_TIM9_IRQHandler(void)
Timer 1 break interrupt - timer 9 IRQ implementation. Requires the device specific macro __STM32F401x...
uint32_t HIERODULE_TIM_IsEnabledCounter(TIM_TypeDef *Timer)
Checks the status of the counter of a timer.
void TIM14_IRQHandler(void)
Timer 14 IRQ implementation. Requires the device specific macro __STM32F030x6_H to be defined....
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.
void TIM1_UP_IRQHandler(void)
Timer 1 update interrupt IRQ implementation. Requires the device specific macro __STM32F103xB_H to be...
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 TIM5_IRQHandler(void)
Timer 5 IRQ implementation. Requires the device specific macro __STM32F401xC_H to be defined....
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 TIM4_IRQHandler(void)
Timer 4 IRQ implementation. Requires the device specific macro __STM32F103xB_H or __STM32F401xC_H to ...
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 TIM17_IRQHandler(void)
Timer 17 IRQ implementation. Requires the device specific macro __STM32F030x6_H to be defined....
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 TIM3_IRQHandler(void)
Timer 3 IRQ implementation. Requires HIERODULE_TIM_HANDLE_IRQ to be defined. Won't be compiled if HIE...
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 TIM1_BRK_IRQHandler(void)
Timer 1 break interrupt IRQ implementation. Requires the device specific macro __STM32F103xB_H to be ...
void TIM1_UP_TIM10_IRQHandler(void)
Timer 1 update interrupt - timer 10 IRQ implementation. Requires the device specific macro __STM32F40...
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 TIM16_IRQHandler(void)
Timer 16 IRQ implementation. Requires the device specific macro __STM32F030x6_H to be defined....
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 TIM1_CC_IRQHandler(void)
Timer 1 capture compare interrupt IRQ implementation. Requires HIERODULE_TIM_HANDLE_IRQ to be defined...
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.
: Header file for the timer module.