Author: There is a fairy wife Xie the shopkeeper
Date: 2021/2/18
A series of small four-axis drones will be updated this year, from functional design → mind map → schematic design → PCB Layout → welding PCB → programming code → debugging of the whole machine to record their own growth process!
This small four-axis drone was made during the university years, and now I have a deeper understanding of embedded in work and study, so I want to reorganize the small four-axis, and then realize the flight control design of the large four-axis on this basis. , These will all be done after work!
//小四轴无人机设计,需要LED灯作为提示
#include "GPIO.h"
/*******************************************************************************
* fuction Led_gpio_init
* brief gpio配置初始化
* param 无
* return 无
*******************************************************************************/
void Led_gpio_init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
/*开启引脚时钟*/
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOC|RCC_AHBPeriph_GPIOB|RCC_AHBPeriph_GPIOD, ENABLE);//开的是IO口的时钟
/*引脚的配置PPC15/PB4/PB2/PD8*/
/*引脚的配置PC*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_Init(GPIOC,&GPIO_InitStructure);
/*引脚的配置PB*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4|GPIO_Pin_2;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_Init(GPIOB,&GPIO_InitStructure);
/*引脚的配置PD*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_Init(GPIOD,&GPIO_InitStructure);
}
#ifndef _GPIO_H__
#define _GPIO_H__
#include "board_define.h"
//void uart1_init(void);
void Led_gpio_init(void);
#endif