From 4d895d45b642521b0fda01f4ff838e98a79432a6 Mon Sep 17 00:00:00 2001 From: orvik Date: Tue, 4 Nov 2025 09:36:58 +0100 Subject: [PATCH] =?UTF-8?q?T=C3=A9l=C3=A9verser=20les=20fichiers=20vers=20?= =?UTF-8?q?"CantoOrvikPilotes/Source"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CantoOrvikPilotes/Source/GPIO.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/CantoOrvikPilotes/Source/GPIO.c b/CantoOrvikPilotes/Source/GPIO.c index c407c49..89de2cb 100644 --- a/CantoOrvikPilotes/Source/GPIO.c +++ b/CantoOrvikPilotes/Source/GPIO.c @@ -14,7 +14,20 @@ void SetBroche(uint32_t GPIO, int Broche){ } void ConfigureGPIO(uint32_t GPIO, int Broche, int IO, char Mode){ - RCC->APB2ENR |= RCC_APB2ENR_IOPAEN; // Clock GPIOA enable + //Start clock +if(GPIO == GPIOA){ + RCC -> APB2ENR |= RCC_APB2ENR_IOPAEN; +} +else if(GPIO == GPIOB){ + RCC -> APB2ENR |= RCC_APB2ENR_IOPBEN; +} +else if(GPIO == GPIOC){ + RCC -> APB2ENR |= RCC_APB2ENR_IOPCEN; +} +else if(GPIO == GPIOD){ + RCC -> APB2ENR |= RCC_APB2ENR_IOPDEN; +} + if (Broche < 8) { GPIO -> CRL &= ~(0x1 << Broche *4) & ~(0x1 << Broche *4 +1) & ~(0x1 << Broche *4 + 2) & ~(0x1 << Broche *4 + 3); // Clean bits if (IO == 0){ //Input