#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 du PIN LL_GPIO_StructInit(&init); init.Pin = PINx; init.Mode = mode; //init.Speed = ; init.OutputType = outputType; init.Pull = pullMode; LL_GPIO_Init(GPIOx, &init); } void GPIO_setPin(GPIO_TypeDef * GPIOx, uint32_t PINx, int output){ if (output) LL_GPIO_SetOutputPin(GPIOx, PINx); else LL_GPIO_ResetOutputPin(GPIOx,PINx); }; int GPIO_readPin(GPIO_TypeDef * GPIOx, uint32_t PINx){ return LL_GPIO_IsOutputPinSet(GPIOx, PINx); }