Browse Source

Debut d'ecriture de GPIO.h et de GPIO.c: GPIO_conf partiellement ecrite

Marino Benassai 3 years ago
parent
commit
d34d0f95da
2 changed files with 26 additions and 0 deletions
  1. 16
    0
      MyDrivers/GPIO.c
  2. 10
    0
      MyDrivers/GPIO.h

+ 16
- 0
MyDrivers/GPIO.c View File

@@ -1,2 +1,18 @@
1 1
 #include "GPIO.h"
2
+#include "stm32f1xx_ll_gpio.h"
2 3
 
4
+void GPIO_conf(GPIO_TypeDef * GPIOx, uint32_t PINx, uint32_t mode, uint32_t outputType, uint32_t pullMode){
5
+	
6
+	LL_GPIO_InitTypeDef init;
7
+	
8
+	//Activation de l'horloge
9
+	if (GPIOx == GPIOA) LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOA);
10
+	else if (GPIOx == GPIOB) LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOB);
11
+	else if (GPIOx == GPIOC) LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOC);
12
+	else if (GPIOx == GPIOD) LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOD);
13
+	
14
+	//Configuration de la PIN
15
+	LL_GPIO_StructInit(&init);
16
+	init.Pin = PINx;
17
+	
18
+}

+ 10
- 0
MyDrivers/GPIO.h View File

@@ -1,4 +1,14 @@
1 1
 #ifndef GPIO_H
2 2
 #define GPIO_H
3 3
 
4
+#include "stm32f103xb.h"
5
+#include "stm32f1xx_ll_gpio.h"
6
+#include "stm32f1xx_ll_bus.h"
7
+
8
+void GPIO_conf(GPIO_TypeDef * GPIOx, uint32_t PINx, uint32_t mode, uint32_t outputType, uint32_t pullMode);
9
+
10
+void GPIO_setPin(GPIO_TypeDef GPIOx, uint32_t PINx, int output);
11
+
12
+void GPIO_readPin(GPIO_TypeDef GPIOx, uint32_t PINx);
13
+
4 14
 #endif

Loading…
Cancel
Save