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