历史上的今天
今天是:2024年08月29日(星期四)
2019年08月29日 | STM32F429 >> 4. 使用固件库点亮LED
2019-08-29 来源:eefocus
本工程板级支持包文件适用于野火stm32f429 开发板。
在这一节的当中,最核心的内容就两点:
学会创建自己的项目;
学会创建板级支持包;

STARTUP :放置启动文件
STM32F4xx_StdPeriph_Driver 和CMSIS :放置库文件,不需要改动
DOC :放置说明文件
USER :放置用户创建或要进行改动的文件
bsp_led.h
/**
******************************************************************************
* @file bsp_led.h
* @author Waao
* @version V1.0.0
* @date 20-Dec-2018
* @brief This file contains some board support package's definition for the LED.
*
******************************************************************************
* @attention
*
* None
*
******************************************************************************
*/
#ifndef __BSP_LED_H_
#define __BSP_LED_H_
#include /************* Define every LEDs' pin, port and clock *************/ #define LED1_PIN GPIO_Pin_10 #define LED1_GPIO_PORT GPIOH #define LED1_GPIO_CLK RCC_AHB1Periph_GPIOH #define LED2_PIN GPIO_Pin_11 #define LED2_GPIO_PORT GPIOH #define LED2_GPIO_CLK RCC_AHB1Periph_GPIOH #define LED3_PIN GPIO_Pin_12 #define LED3_GPIO_PORT GPIOH #define LED3_GPIO_CLK RCC_AHB1Periph_GPIOH /*-------------------------------------------------------------*/ /************* Define the digital operational micro *************/ #define digitalHi(p, i) {p->BSRRL = i;} #define digitalLo(p, i) {p->BSRRH = i;} #define digitalToggle(p, i) {p->ODR ^= i;} /*-------------------------------------------------------------*/ /************* Define every leds' on/off micro *************/ #define LED1_ON digitalLo(LED1_GPIO_PORT,LED1_PIN) #define LED1_OFF digitalHi(LED1_GPIO_PORT,LED1_PIN) #define LED1_TOGGLE digitalToggle(LED1_GPIO_PORT,LED1_PIN) #define LED2_ON digitalLo(LED2_GPIO_PORT,LED2_PIN) #define LED2_OFF digitalHi(LED2_GPIO_PORT,LED2_PIN) #define LED2_TOGGLE digitalToggle(LED2_GPIO_PORT,LED2_PIN) #define LED3_ON digitalLo(LED3_GPIO_PORT,LED3_PIN) #define LED3_OFF digitalHi(LED3_GPIO_PORT,LED3_PIN) #define LED3_TOGGLE digitalToggle(LED3_GPIO_PORT,LED3_PIN) /*-------------------------------------------------------------*/ /************* Define every colors' micro *************/ #define LED_RED LED1_ON; LED2_OFF; LED3_OFF #define LED_GREEN LED1_OFF; LED2_ON; LED3_OFF #define LED_BLUE LED1_OFF; LED2_OFF; LED3_ON #define LED_YELLOW LED1_ON; LED2_ON; LED3_OFF #define LED_PURPLE LED1_ON; LED2_OFF; LED3_ON #define LED_CYAN LED1_OFF; LED2_ON; LED3_ON #define LED_WHITE LED1_ON; LED2_ON; LED3_ON /*---------------------------------------------------------------*/ void LED_GPIO_Config(void); #endif bsp_led.c /** ****************************************************************************** * @file bsp_led.c * @author Waao * @version V1.0.0 * @date 20-Dec-2018 * @brief This file contains some board support package's functions for the LED. * ****************************************************************************** * @attention * * None * ****************************************************************************** */ #include "bsp_led.h" #include "stm32f4xx_gpio.h" #include "stm32f4xx_rcc.h" /** * @brief Initialize the led. * @note None * @param None * @retval None */ void LED_GPIO_Config(void) { //Establish the structure GPIO_InitTypeDef GPIO_InitStructure; //Enable the clock of the Peripheral RCC_AHB1PeriphClockCmd(LED1_GPIO_CLK| LED2_GPIO_CLK| LED3_GPIO_CLK, ENABLE); //Config the structure GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStructure.GPIO_Speed = GPIO_Medium_Speed; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN; //Initialize the led GPIO_InitStructure.GPIO_Pin = LED1_PIN; GPIO_Init(LED1_GPIO_PORT, &GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = LED2_PIN; GPIO_Init(LED2_GPIO_PORT, &GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = LED3_PIN; GPIO_Init(LED3_GPIO_PORT, &GPIO_InitStructure); }
史海拾趣
|
NRF2401 NRF24L01 NRF905 RF903 CC1100 CC2500无线收发模块编程指南 NRF2401 NRF24L01 NRF905 RF903 CC1100 CC2500无线收发模块编程指南 你好,我们是无线制造供应商, 公司主页www.newmsg.com 电话:13704018223 陈工 欢迎交流 RF903 特点: (1) 433Mhz 开放ISM 频段免许可证使用 (2) 最高工作速率50kbp ...… 查看全部问答> |
|
各位大虾,我刚开始做vxworks 在broadcom上开发,急需tornado for mips版本,先行谢过!!! QQ: 510765226 谢谢! … 查看全部问答> |
|
现在有一个bluez植入uclinux的课题,本人能力有限,想请大家帮帮忙,当然是有偿帮忙的。哪位有兴趣可以与我联系。vonsavant@163.com… 查看全部问答> |
|
Windows Embedded CE 6.0 R3 Product Update Rollup, December 31, 2012 How to install this updateAll updates for Windows Embedded CE 6.0 R3 require the following: 1) Platform Builder 6.0 is installed on the machine.2) Upon install ...… 查看全部问答> |
|
这篇帖子是写给入门者的,要解决一个问题:初学者应重点掌握什么电子知识,大学阶段如何学习? 先说点貌似题外的东西——3个谬论。 谬论一:高中老师常对我们说 ...… 查看全部问答> |




