fmq.c
#include"fmq.h"
void Fmq_Init(void)
{
GPIO_InitTypeDef GPIO_VALUE;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC,ENABLE);
GPIO_VALUE.GPIO_Mode=GPIO_Mode_Out_PP;
GPIO_VALUE.GPIO_Pin=GPIO_Pin_7;
GPIO_VALUE.GPIO_Speed=GPIO_Speed_50MHz;
GPIO_Init(GPIOC,&GPIO_VALUE);
}
void Fmq_On(void)
{
GPIO_SetBits(GPIOC,GPIO_Pin_7);
}
void Fmq_Off(void)
{
GPIO_ResetBits(GPIOC,GPIO_Pin_7);
}
fmq.h
#ifndef __FMQ_H
#define __FMQ_H
#include "stm32f10x_conf.h"
extern void Fmq_Init(void);
extern void Fmq_On(void);
extern void Fmq_Off(void);
#endif
main.c
#include"fmq.h"
int main(void)
{
int i=0,j=0;
Fmq_Init();
for(i=0;i<3;i=(i+1)%3)
{
Fmq_On();
for(j=0;j<1000000;j++);
Fmq_Off();
for(j=0;j<1000000;j++);
}
return 0;
}