From 8b8d9f558dc6b9dedf0d53189b0cfe0ab8ef91b0 Mon Sep 17 00:00:00 2001 From: Yohan Boujon Date: Mon, 20 Mar 2023 16:50:50 +0100 Subject: [PATCH] Clock et timer fonctionnel --- ProjetsKEIL/Drivers/Source/Principale.c | 16 ++++--- ProjetsKEIL/Drivers/gpiodriver.c | 1 - ProjetsKEIL/Drivers/gpiodriver.uvoptx | 56 ++----------------------- 3 files changed, 11 insertions(+), 62 deletions(-) diff --git a/ProjetsKEIL/Drivers/Source/Principale.c b/ProjetsKEIL/Drivers/Source/Principale.c index 038fe2a..1110976 100644 --- a/ProjetsKEIL/Drivers/Source/Principale.c +++ b/ProjetsKEIL/Drivers/Source/Principale.c @@ -1,20 +1,18 @@ #include "stm32f10x.h" #include "../gpiodriver.h" +#define CEN 0x0 -int main ( void ) +int main (void) { int returnValue; MyGPIO_Struct_TypeDef led = {GPIOA,5,Out_PullUp}; //led - MyGPIO_Struct_TypeDef bouton = {GPIOC,13,In_PullDown}; //bouton poussoir MyGPIO_Init(&led); - MyGPIO_Init(&bouton); + TIM2->PSC = 7199; + TIM2->ARR = 499; + TIM2->CR1 = TIM2->CR1 | (0x01<CNT; }while(1) ; } diff --git a/ProjetsKEIL/Drivers/gpiodriver.c b/ProjetsKEIL/Drivers/gpiodriver.c index 4d69645..3228fc7 100644 --- a/ProjetsKEIL/Drivers/gpiodriver.c +++ b/ProjetsKEIL/Drivers/gpiodriver.c @@ -2,7 +2,6 @@ void MyGPIO_Init(MyGPIO_Struct_TypeDef * GPIOStructPtr) { - uint8_t voyons = GPIOStructPtr->GPIO_Pin; RCC->APB2ENR |= GPIO2Int(GPIOStructPtr->GPIO); //We get the pointer of the CRH/CRL depending on the IO_Pin number volatile uint32_t * CRAny = GPIOStructPtr->GPIO_Pin >= 0x08 ? &(GPIOStructPtr->GPIO->CRH):&(GPIOStructPtr->GPIO->CRL); diff --git a/ProjetsKEIL/Drivers/gpiodriver.uvoptx b/ProjetsKEIL/Drivers/gpiodriver.uvoptx index b3f96d1..bdb47fa 100644 --- a/ProjetsKEIL/Drivers/gpiodriver.uvoptx +++ b/ProjetsKEIL/Drivers/gpiodriver.uvoptx @@ -75,7 +75,7 @@ 1 0 - 0 + 1 18 @@ -125,7 +125,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=-1,-1,-1,-1,0)(110=-1,-1,-1,-1,0)(111=-1,-1,-1,-1,0)(1011=-1,-1,-1,-1,0)(180=-1,-1,-1,-1,0)(120=1468,53,1889,480,1)(121=1469,437,1890,864,1)(122=875,109,1296,536,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=-1,-1,-1,-1,0)(131=-1,-1,-1,-1,0)(132=-1,-1,-1,-1,0)(133=-1,-1,-1,-1,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=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(100=-1,-1,-1,-1,0)(110=-1,-1,-1,-1,0)(111=-1,-1,-1,-1,0)(1011=-1,-1,-1,-1,0)(180=-1,-1,-1,-1,0)(120=1468,53,1889,480,1)(121=1469,437,1890,864,1)(122=875,109,1296,536,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=-1,-1,-1,-1,0)(131=1285,87,1879,838,1)(132=-1,-1,-1,-1,0)(133=-1,-1,-1,-1,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 @@ -144,7 +144,7 @@ 0 15 1 -
134218832
+
134218740
0 0 0 @@ -155,54 +155,6 @@ \\cool_Simule\Source/Principale.c\15 - - 1 - 0 - 13 - 1 -
134218816
- 0 - 0 - 0 - 0 - 0 - 1 - .\Source\Principale.c - - \\cool_Simule\Source/Principale.c\13 -
- - 2 - 0 - 14 - 1 -
134218824
- 0 - 0 - 0 - 0 - 0 - 1 - .\Source\Principale.c - - \\cool_Simule\Source/Principale.c\14 -
- - 3 - 0 - 12 - 1 -
134218808
- 0 - 0 - 0 - 0 - 0 - 1 - .\Source\Principale.c - - \\cool_Simule\Source/Principale.c\12 -
@@ -332,7 +284,7 @@ 1 0 - 1 + 0 18