7.25

今日学习任务

 

GPIO

时钟

SysTick系统定时器

日任务完成情况

 

(详细说明本日任务是否按计划完成,开发的代码量)

  1. 基本完成

日开发中出现的问题汇总

由于路径未添加,编译不成功

日未解决问题

 

基本解决

 

今日开发收获

1.学会了固件库模板的搭建,以及运用模板点亮一个灯

2.了解了如何在32单片机程序上,用systick定时器编写一个延时函数

作业

#ifndef _LED_H

#define _LED_H

 

#include "stm32f4xx_gpio.h"

 

#define GPIO_LED_RCC RCC_AHB1Periph_GPIOC

 

#define GPIO_LED_Blue GPIOC

#define GPIO_LED_PIN_Blue GPIO_Pin_1

 

#define GPIO_LED_PIN_Yellow GPIO_Pin_2

#define GPIO_LED_PIN_Red GPIO_Pin_3

#define GPIO_LED_PIN_Green GPIO_Pin_4

 

void GPIO_LED_Config(void);

 

#endif

main文件

#include "stm32f4xx.h"

 

#include "LED.h"

 

int main(void)

{

GPIO_LED_Config();

}

#include "LED.h"

 

void GPIO_LED_Config()

{

   GPIO_InitTypeDef GPIO_InitStruct;

   RCC_AHB1PeriphClockCmd(GPIO_LED_RCC,ENABLE);

 

   GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT;

   GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;

   GPIO_InitStruct.GPIO_OType = GPIO_OType_PP;

   GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_UP;

 

   while(1)

 {

   GPIO_InitStruct.GPIO_Pin = GPIO_LED_PIN_Bule;

   GPIO_SetBits(GPIOC , GPIO_LED_PIN_Bule);

 GPIO_Init(GPIOC,&GPIO_InitStruct);

 

   GPIO_InitStruct.GPIO_Pin = GPIO_LED_PIN_Yellow;

 GPIO_SetBits(GPIOC , GPIO_LED_PIN_Yellow);

 GPIO_Init(GPIOC,&GPIO_InitStruct);

 

     GPIO_InitStruct.GPIO_Pin = GPIO_LED_PIN_Red;

 GPIO_SetBits(GPIOC , GPIO_LED_PIN_Red);

 GPIO_Init(GPIOC,&GPIO_InitStruct);

 

     GPIO_InitStruct.GPIO_Pin = GPIO_LED_PIN_Green;

 GPIO_SetBits(GPIOC , GPIO_LED_PIN_Green);

 GPIO_Init(GPIOC,&GPIO_InitStruct);

 }

}

 

 

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值