diff --git a/MDK-ARM/Project.uvoptx b/MDK-ARM/Project.uvoptx index aa749d9..15d3e28 100644 --- a/MDK-ARM/Project.uvoptx +++ b/MDK-ARM/Project.uvoptx @@ -317,7 +317,7 @@ 0 DLGDARM - (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(100=504,37,1150,710,0)(110=60,88,280,548,0)(111=752,104,972,564,0)(1011=-1,-1,-1,-1,0)(180=-1,-1,-1,-1,0)(120=864,64,1285,491,0)(121=892,96,1313,523,0)(122=674,103,1095,530,0)(123=-1,-1,-1,-1,0)(140=-1,-1,-1,-1,0)(240=-1,-1,-1,-1,0)(190=-1,-1,-1,-1,0)(200=-1,-1,-1,-1,0)(170=-1,-1,-1,-1,0)(130=709,11,1303,762,0)(131=736,17,1330,768,0)(132=599,17,1193,768,0)(133=295,17,889,768,0)(160=-1,-1,-1,-1,0)(161=-1,-1,-1,-1,0)(162=-1,-1,-1,-1,0)(210=-1,-1,-1,-1,0)(211=-1,-1,-1,-1,0)(220=-1,-1,-1,-1,0)(221=-1,-1,-1,-1,0)(230=-1,-1,-1,-1,0)(234=-1,-1,-1,-1,0)(231=-1,-1,-1,-1,0)(232=-1,-1,-1,-1,0)(233=-1,-1,-1,-1,0)(150=-1,-1,-1,-1,0)(151=-1,-1,-1,-1,0) + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=675,52,1051,288,0)(1009=-1,-1,-1,-1,0)(100=504,37,1150,710,0)(110=60,88,280,548,0)(111=752,104,972,564,0)(1011=-1,-1,-1,-1,0)(180=-1,-1,-1,-1,0)(120=864,64,1285,491,0)(121=892,96,1313,523,0)(122=674,103,1095,530,0)(123=-1,-1,-1,-1,0)(140=-1,-1,-1,-1,0)(240=-1,-1,-1,-1,0)(190=-1,-1,-1,-1,0)(200=-1,-1,-1,-1,0)(170=-1,-1,-1,-1,0)(130=709,11,1303,762,0)(131=736,17,1330,768,0)(132=599,17,1193,768,0)(133=295,17,889,768,0)(160=-1,-1,-1,-1,0)(161=-1,-1,-1,-1,0)(162=-1,-1,-1,-1,0)(210=-1,-1,-1,-1,0)(211=-1,-1,-1,-1,0)(220=-1,-1,-1,-1,0)(221=-1,-1,-1,-1,0)(230=-1,-1,-1,-1,0)(234=-1,-1,-1,-1,0)(231=-1,-1,-1,-1,0)(232=-1,-1,-1,-1,0)(233=-1,-1,-1,-1,0)(150=-1,-1,-1,-1,0)(151=-1,-1,-1,-1,0) 0 @@ -354,18 +354,34 @@ 0 0 - 25 + 42 1 -
134219120
+
134218898
0 0 0 0 0 1 - F:\Etudes\4A\µC - Périphériques\Periph-Voilier\Services\Moteur.c + F:\Etudes\4A\µC - Périphériques\Periph-Voilier\Src\main.c - \\NUCLEO_F103RB\../Services/Moteur.c\25 + \\NUCLEO_F103RB\../Src/main.c\42 +
+ + 1 + 0 + 52 + 1 +
134218878
+ 0 + 0 + 0 + 0 + 0 + 1 + F:\Etudes\4A\µC - Périphériques\Periph-Voilier\Src\main.c + + \\NUCLEO_F103RB\../Src/main.c\52
@@ -391,7 +407,7 @@ 1 1 0 - 0 + 1 0 0 1 @@ -429,12 +445,12 @@ 0 ((porta & 0x00000002) >> 1 & 0x2) >> 1 - 00800000000000000000000000000000E0FFEF400100000000000000000000000000000028706F7274612026203078303030303030303229203E3E2031000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000001000000000000000000E03F0B00000000000000000000000000000000000000320F0008 + 00800000000000000000000000000000E0FFEF400100000000000000000000000000000028706F7274612026203078303030303030303229203E3E2031000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000001000000000000000000E03F1700000000000000000000000000000000000000320F0008 1 ((porta & 0x00000004) >> 2 & 0x4) >> 2 - 00008000000000000000000000000000E0FFEF400100000000000000000000000000000028706F7274612026203078303030303030303429203E3E2032000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000002000000000000000000E03F0B00000000000000000000000000000000000000320F0008 + 00008000000000000000000000000000E0FFEF400100000000000000000000000000000028706F7274612026203078303030303030303429203E3E2032000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000002000000000000000000E03F1700000000000000000000000000000000000000320F0008 @@ -497,7 +513,7 @@ 3 3 1 - 0 + 1 0 0 ..\MyDrivers\MyTimer.c @@ -509,7 +525,7 @@ 3 4 1 - 0 + 1 0 0 ..\MyDrivers\MyPWM.c @@ -517,6 +533,30 @@ 0 0 + + 3 + 5 + 1 + 0 + 0 + 0 + ..\MyDrivers\MySysTick.c + MySysTick.c + 0 + 0 + + + 3 + 6 + 5 + 0 + 0 + 0 + ..\MyDrivers\MySysTick.h + MySysTick.h + 0 + 0 + @@ -527,7 +567,7 @@ 0 4 - 5 + 7 1 0 0 @@ -539,7 +579,7 @@ 4 - 6 + 8 1 0 0 @@ -551,7 +591,7 @@ 4 - 7 + 9 1 0 0 @@ -563,7 +603,7 @@ 4 - 8 + 10 1 0 0 @@ -575,7 +615,7 @@ 4 - 9 + 11 1 0 0 @@ -595,7 +635,7 @@ 0 5 - 10 + 12 5 0 0 @@ -615,7 +655,7 @@ 0 6 - 11 + 13 1 0 0 @@ -635,7 +675,7 @@ 0 7 - 12 + 14 2 0 0 diff --git a/MDK-ARM/Project.uvprojx b/MDK-ARM/Project.uvprojx index 59049c2..8dcd4a2 100644 --- a/MDK-ARM/Project.uvprojx +++ b/MDK-ARM/Project.uvprojx @@ -412,6 +412,16 @@ 1 ..\MyDrivers\MyPWM.c + + MySysTick.c + 1 + ..\MyDrivers\MySysTick.c + + + MySysTick.h + 5 + ..\MyDrivers\MySysTick.h + @@ -885,6 +895,16 @@ 1 ..\MyDrivers\MyPWM.c + + MySysTick.c + 1 + ..\MyDrivers\MySysTick.c + + + MySysTick.h + 5 + ..\MyDrivers\MySysTick.h + diff --git a/MyDrivers/MySysTick.c b/MyDrivers/MySysTick.c new file mode 100644 index 0000000..0db6e80 --- /dev/null +++ b/MyDrivers/MySysTick.c @@ -0,0 +1,43 @@ +#include "MySysTick.h" + +#include "stm32f1xx_ll_bus.h" // Pour l'activation des horloges +#include "stm32f1xx_ll_cortex.h" + + +void (*Ptr_ItFct_SysTick)(void); + +void MySysTick_Conf(uint32_t ticks) { + + SysTick_Config(ticks); + + MySysTick_IT_Disable(); + +} + +void MySysTick_IT_Conf (void (*IT_function)(void), int Prio) { + + //Affectation de la fonction du handler + Ptr_ItFct_SysTick = IT_function; + + //Désactivation des IT + LL_SYSTICK_DisableIT(); + + //Configuration du NVIC + NVIC_SetPriority(SysTick_IRQn, Prio); + NVIC_EnableIRQ(SysTick_IRQn); + +} + +void MySysTick_IT_Enable (void) { + LL_SYSTICK_EnableIT(); +} + +void MySysTick_IT_Disable (void) { + LL_SYSTICK_DisableIT(); +} + +/*========Handler d'IT==========*/ + +void SysTick_Handler (void) { + (*Ptr_ItFct_SysTick)(); +} diff --git a/MyDrivers/MySysTick.h b/MyDrivers/MySysTick.h new file mode 100644 index 0000000..b87a943 --- /dev/null +++ b/MyDrivers/MySysTick.h @@ -0,0 +1,15 @@ +#ifndef MY_SYSTICK_H +#define MY_SYSTICK_H + +#include "stm32f103xb.h" + + + void MySysTick_Conf(uint32_t ticks); + + void MySysTick_IT_Conf (void (*IT_function)(void), int Prio); + + void MySysTick_IT_Enable (void); + + void MySysTick_IT_Disable (void); + +#endif diff --git a/Src/main.c b/Src/main.c index 64a2b92..5fd54f1 100644 --- a/Src/main.c +++ b/Src/main.c @@ -23,6 +23,8 @@ #include "MyTimer.h" #include "MyPWM.h" #include "Moteur.h" +#include "MySysTick.h" +#include void SystemClock_Config(void); @@ -35,26 +37,19 @@ void SystemClock_Config(void); */ + +void test (void) { + printf("ok"); +} + int main(void) { /* Configure the system clock to 72 MHz */ SystemClock_Config(); - /*===Test Moteur===*/ - - //INIT GPIO MARCHE PAS->PB PIN - Moteur_Conf(); - - Moteur_Speed(30); - Moteur_Sens(0); - - /* Infinite loop */ - for (int i =0; i<0xFFFF; i++) - { - } - - Moteur_Speed(60); - Moteur_Sens(1); + MySysTick_Conf(0xAFC80); + MySysTick_IT_Conf(test,3); + MySysTick_IT_Enable(); while (1) { @@ -65,8 +60,6 @@ int main(void) - - /** * @brief System Clock Configuration * The system Clock is configured as follow :