#include "stm32f10x.h" #include "Driver_GPIO.h" int main(void){ //la LED MyGPIO_Struct_TypeDef greenLed ; MyGPIO_Struct_TypeDef blueButton ; greenLed.GPIO = GPIOA; greenLed.GPIO_Pin = 5 ; greenLed.GPIO_Conf = Out_Ppull ; //le bouton blueButton.GPIO = GPIOC; blueButton.GPIO_Pin = 13 ; blueButton.GPIO_Conf = In_Floating ; //activation des clocks MyGPIO_Activate(1); //GPIOA MyGPIO_Activate(3); //GPIOC MyGPIO_Init(&greenLed); MyGPIO_Init(&blueButton); while(1){ if(MyGPIO_Read(blueButton.GPIO, blueButton.GPIO_Pin)){ //bouton non pressé, il faut éteindre la led MyGPIO_Reset(greenLed.GPIO, greenLed.GPIO_Pin); } else { //bouton pressé, il faut allumer la led MyGPIO_Set(greenLed.GPIO, greenLed.GPIO_Pin); } } }