diff --git a/MDK-ARM/Project.uvoptx b/MDK-ARM/Project.uvoptx index dad60dc..7a44afb 100644 --- a/MDK-ARM/Project.uvoptx +++ b/MDK-ARM/Project.uvoptx @@ -456,6 +456,18 @@ 0 0 + + 3 + 3 + 1 + 1 + 0 + 0 + ..\MyDrivers\MyPWM.c + MyPWM.c + 0 + 0 + @@ -466,7 +478,7 @@ 0 4 - 3 + 4 1 0 0 @@ -478,7 +490,7 @@ 4 - 4 + 5 1 0 0 @@ -490,7 +502,7 @@ 4 - 5 + 6 1 0 0 @@ -502,7 +514,7 @@ 4 - 6 + 7 1 0 0 @@ -514,7 +526,7 @@ 4 - 7 + 8 1 0 0 @@ -534,7 +546,7 @@ 0 5 - 8 + 9 5 0 0 @@ -554,7 +566,7 @@ 0 6 - 9 + 10 1 0 0 @@ -574,7 +586,7 @@ 0 7 - 10 + 11 2 0 0 diff --git a/MDK-ARM/Project.uvprojx b/MDK-ARM/Project.uvprojx index cd43e32..a2a6b77 100644 --- a/MDK-ARM/Project.uvprojx +++ b/MDK-ARM/Project.uvprojx @@ -400,6 +400,11 @@ 1 ..\MyDrivers\MyTimer.c + + MyPWM.c + 1 + ..\MyDrivers\MyPWM.c + @@ -861,6 +866,11 @@ 1 ..\MyDrivers\MyTimer.c + + MyPWM.c + 1 + ..\MyDrivers\MyPWM.c + diff --git a/MyDrivers/MyPWM.c b/MyDrivers/MyPWM.c index 1d8a357..2765216 100644 --- a/MyDrivers/MyPWM.c +++ b/MyDrivers/MyPWM.c @@ -14,7 +14,7 @@ void MyPWM_Conf_Output(TIM_TypeDef * Timer) //Configuration du output channel en PWM LL_TIM_OC_StructInit(&My_LL_Tim_OC_Init_Struct); - TIM_OC_InitStruct->OCMode = LL_TIM_OCMODE_PWM1; + My_LL_Tim_OC_Init_Struct.OCMode = LL_TIM_OCMODE_PWM1; LL_TIM_OC_Init(Timer,channel,&My_LL_Tim_OC_Init_Struct); } diff --git a/MyDrivers/MyPWM.h b/MyDrivers/MyPWM.h new file mode 100644 index 0000000..da2ed82 --- /dev/null +++ b/MyDrivers/MyPWM.h @@ -0,0 +1,9 @@ +#include "stm32f1xx_ll_bus.h" // Pour l'activation des horloges +#include "stm32f1xx_ll_tim.h" + + +void MyPWM_Conf_Output(TIM_TypeDef * Timer); + +void MyPWM_Conf_Input(TIM_TypeDef * Timer); + +void MyPWM_Set_Impulse_Duration(TIM_TypeDef * Timer, int Percentage); diff --git a/Src/main.c b/Src/main.c index 165d2e7..362e729 100644 --- a/Src/main.c +++ b/Src/main.c @@ -19,6 +19,7 @@ #include "stm32f1xx_ll_rcc.h" // utile dans la fonction SystemClock_Config #include "stm32f1xx_ll_utils.h" // utile dans la fonction SystemClock_Config #include "stm32f1xx_ll_system.h" // utile dans la fonction SystemClock_Config +#include "MyPWM.h" void SystemClock_Config(void);