42 lines
538 B
C
42 lines
538 B
C
#include "stm32f10x.h"
|
|
#include "Driver_GPIO.h"
|
|
|
|
MyGPIO_Struct_TypeDef LED_2;
|
|
MyGPIO_Struct_TypeDef Bouton_13;
|
|
|
|
int main(void)
|
|
{
|
|
int test;
|
|
|
|
//Init LED 2
|
|
|
|
LED_2.GPIO=GPIOA;
|
|
LED_2.GPIO_Pin=5;
|
|
LED_2.GPIO_Conf=Out_Ppull;
|
|
|
|
MyGPIO_Init(&LED_2);
|
|
|
|
//Init bouton
|
|
|
|
Bouton_13.GPIO=GPIOC;
|
|
Bouton_13.GPIO_Pin=13;
|
|
Bouton_13.GPIO_Conf=InPullDown;
|
|
|
|
MyGPIO_Init(&Bouton_13);
|
|
|
|
do
|
|
{
|
|
test =MyGPIO_Read(GPIOC,13);
|
|
|
|
if(test==1)
|
|
{
|
|
MyGPIO_Reset(GPIOA,5);
|
|
}else
|
|
{
|
|
MyGPIO_Set(GPIOA,5);
|
|
}
|
|
|
|
|
|
}while(1);
|
|
|
|
}
|