栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

灏第二题睿

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

灏第二题睿

Main.c
#include "stm32f10x.h"
#include "led.h"
#include "systick.h"

int main(void)
{
LED_Init();
LED(OFF);
Systick_Init();
while(1)
{

}
}
Led.c
#include "led.h"


void LED_Init(void)
{
GPIO_InitTypeDef g;

RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);

g.GPIO_Pin = GPIO_Pin_0;
g.GPIO_Mode = GPIO_Mode_Out_PP;
g.GPIO_Speed = GPIO_Speed_10MHz;
GPIO_Init(GPIOA,&g);
}


void LED(uint8_t LEDstate)
{
if(LEDstate == ON)
GPIO_ResetBits(GPIOA, GPIO_Pin_0);
else if(LEDstate == OFF)
GPIO_SetBits(GPIOA, GPIO_Pin_0);
}
Led.h
#ifndef __LED_H
#define __LED_H

#include "stm32f10x.h"

#define  ON   1
#define  OFF  0

void LED_Init(void);
void LED(uint8_t LEDstate);




#endif 
Systick.h
#include "systick.h"

void Systick_Init(void)
{
SysTick_Config(100000);
}
Systick.c
#ifndef_SYSTICK_H
#define_SYSTICK_H

#include   "stm32f10x.h"

void Systick_Init(void);


#endif
 

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/960659.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号