tp/drivers/Driver_GPIO.h

27 line
No EOL
934 B
C

#ifndef MYGPIO_H
#define MYGPIO_H
#include "stm32f10x.h"
typedef struct {
GPIO_TypeDef * GPIO; // Pointeur vers la structure de regitre GPIO défini dans stm32f10x_gpio.h
char GPIO_Pin; //numero de 0 a 15
char GPIO_Conf; // voir ci dessous
} MyGPIO_Struct_TypeDef;
#define In_Floating 0x4 // 0x0100
#define In_PullDown 0x8 // 0x1000
#define In_PullUp 0x8 // 0x1000 (même valeur que In_PullDown)
#define In_Analog 0x0 // 0x0000
#define Out_Ppull 0x1 // 0x0001
#define Out_OD 0x5 // 0x0101
#define AltOut_Ppull 0x9 // 0x1001
#define AltOut_OD 0xD // 0x1101
void MyGPIO_Init(MyGPIO_Struct_TypeDef * GPIOStructPtr);
int MyGPIO_Read(GPIO_TypeDef * GPIO, char GPIO_Pin); // renvoie 0 ou autre chose different de 0
void MyGPIO_Set(GPIO_TypeDef * GPIO, char GPIO_Pin);
void MyGPIO_Reset(GPIO_TypeDef * GPIO, char GPIO_Pin);
void MyGPIO_Toggle(GPIO_TypeDef * GPIO, char GPIO_Pin);
#endif