优化中,生成HEX文件
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* gpio.c
|
||||
*
|
||||
* Created on: Oct 24, 2021
|
||||
* Author: wuwenfeng
|
||||
*/
|
||||
#include "gpio.h"
|
||||
|
||||
void change_io_function(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin,char a)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStruct;
|
||||
GPIO_InitStruct.Pin = GPIO_Pin;
|
||||
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||
if(a==1)
|
||||
{
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
||||
}
|
||||
if(a==0)
|
||||
{
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
}
|
||||
HAL_GPIO_Init(GPIOx, &GPIO_InitStruct);
|
||||
}
|
||||
Reference in New Issue
Block a user