forked from trocache/RefKEIL
61 lines
1.2 KiB
C
61 lines
1.2 KiB
C
#include "stm32f10x.h"
|
|
#include "stdio.h"
|
|
#include "Driver_GPIO.h"
|
|
#include "Driver_Timer.h"
|
|
void clignote_led(void)
|
|
{
|
|
//GPIO structure definition
|
|
MyGPIO_Struct_TypeDef GPIO_led;
|
|
//MyGPIO_Struct_TypeDef GPIO_button;
|
|
|
|
//PA5 (LED) configurated in output
|
|
GPIO_led.GPIO_Pin = 5;
|
|
GPIO_led.GPIO_Conf = Out_Ppull;
|
|
GPIO_led.GPIO = GPIOA;
|
|
MyGPIO_Init(&GPIO_led);
|
|
|
|
MyGPIO_Toggle(GPIO_led.GPIO , GPIO_led.GPIO_Pin);
|
|
|
|
}
|
|
int main (void)
|
|
{
|
|
|
|
MyTimer_Struct_TypeDef Timer3;
|
|
Timer3.Timer = TIM3;
|
|
Timer3.ARR = 2000;
|
|
Timer3.PSC = 35981;
|
|
MyTimer_Base_Init(&Timer3);
|
|
MyTimer_Start(TIM3);
|
|
|
|
MyTimer_ActiveIT(Timer3.Timer, 0x1, &clignote_led);
|
|
|
|
/*//PC13 (Button) configurated in input
|
|
GPIO_button.GPIO_Pin = 13;
|
|
GPIO_button.GPIO_Conf = In_Floating;
|
|
GPIO_button.GPIO = GPIOC;
|
|
MyGPIO_Init(&GPIO_button);
|
|
|
|
//PA5 (LED) configurated in output
|
|
GPIO_led.GPIO_Pin = 5;
|
|
GPIO_led.GPIO_Conf = Out_Ppull;
|
|
GPIO_led.GPIO = GPIOA;
|
|
MyGPIO_Init(&GPIO_led);
|
|
|
|
do
|
|
{
|
|
if(MyGPIO_Read(GPIO_button.GPIO, GPIO_button.GPIO_Pin) == 0x0)
|
|
{
|
|
MyGPIO_Set (GPIO_led.GPIO , GPIO_led.GPIO_Pin) ;
|
|
}
|
|
else
|
|
{
|
|
//MyGPIO_Set (GPIO_led.GPIO , GPIO_led.GPIO_Pin) ;
|
|
MyGPIO_Reset (GPIO_led.GPIO , GPIO_led.GPIO_Pin) ;
|
|
}
|
|
}while(1);
|
|
*/
|
|
|
|
while (1)
|
|
{
|
|
}
|
|
}
|