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