嵌入式 库函数编程

#include "stm32f10x.h"

 void Delay(u32 count)  //延时函数 传入参数
 {
   u32 i=0;
   for(;i<count;i++);
 }
 int main(void)                         //主函数
 {    
                // Device header
  GPIO_InitTypeDef  g; 
    g.GPIO_Pin = GPIO_Pin_5;
    g.GPIO_Mode = GPIO_Mode_Out_PP;
  g.GPIO_Speed = GPIO_Speed_10MHz;
  GPIO_Init(GPIOB,&g);     
     

  while(1)
    {
       GPIO_ResetBits(GPIOB,GPIO_Pin_5);
         Delay(300);
         GPIO_SetBits(GPIOB,GPIO_Pin_5);
         Delay(300);
    }
 }

 

posted @ 2019-03-21 08:47  Justice-V  阅读(255)  评论(0)    收藏  举报