Debut d'ecriture de GPIO.h et de GPIO.c: GPIO_conf partiellement ecrite
This commit is contained in:
parent
6497b71a60
commit
d34d0f95da
2 changed files with 26 additions and 0 deletions
|
@ -1,2 +1,18 @@
|
||||||
#include "GPIO.h"
|
#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;
|
||||||
|
|
||||||
|
}
|
|
@ -1,4 +1,14 @@
|
||||||
#ifndef GPIO_H
|
#ifndef GPIO_H
|
||||||
#define 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
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue