From d34d0f95da20326eb851f7f25953297c80e96ceb Mon Sep 17 00:00:00 2001 From: benassai Date: Fri, 6 Nov 2020 09:09:21 +0100 Subject: [PATCH] Debut d'ecriture de GPIO.h et de GPIO.c: GPIO_conf partiellement ecrite --- MyDrivers/GPIO.c | 16 ++++++++++++++++ MyDrivers/GPIO.h | 10 ++++++++++ 2 files changed, 26 insertions(+) diff --git a/MyDrivers/GPIO.c b/MyDrivers/GPIO.c index 93bf04a..820a14f 100644 --- a/MyDrivers/GPIO.c +++ b/MyDrivers/GPIO.c @@ -1,2 +1,18 @@ #include "GPIO.h" +#include "stm32f1xx_ll_gpio.h" +void GPIO_conf(GPIO_TypeDef * GPIOx, uint32_t PINx, uint32_t mode, uint32_t outputType, uint32_t pullMode){ + + LL_GPIO_InitTypeDef init; + + //Activation de l'horloge + if (GPIOx == GPIOA) LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOA); + else if (GPIOx == GPIOB) LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOB); + else if (GPIOx == GPIOC) LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOC); + else if (GPIOx == GPIOD) LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOD); + + //Configuration de la PIN + LL_GPIO_StructInit(&init); + init.Pin = PINx; + +} \ No newline at end of file diff --git a/MyDrivers/GPIO.h b/MyDrivers/GPIO.h index 8e3c489..9a0178e 100644 --- a/MyDrivers/GPIO.h +++ b/MyDrivers/GPIO.h @@ -1,4 +1,14 @@ #ifndef GPIO_H #define GPIO_H +#include "stm32f103xb.h" +#include "stm32f1xx_ll_gpio.h" +#include "stm32f1xx_ll_bus.h" + +void GPIO_conf(GPIO_TypeDef * GPIOx, uint32_t PINx, uint32_t mode, uint32_t outputType, uint32_t pullMode); + +void GPIO_setPin(GPIO_TypeDef GPIOx, uint32_t PINx, int output); + +void GPIO_readPin(GPIO_TypeDef GPIOx, uint32_t PINx); + #endif