当前位置:首页 > 技术学院 > 技术前线
[导读]AD7606的并行采集

#include "bsp_ad7606.h"

#include "bsp_GPIO.h"

MYGPIO AD_Control_GPIO[] =

{

{GPIO_PORT_OS0,GPIO_PIN_OS0,OUTPUT},

{GPIO_PORT_OS1,GPIO_PIN_OS1,OUTPUT},

{GPIO_PORT_OS2,GPIO_PIN_OS2,OUTPUT},

{GPIO_PORT_AD_RANGE,GPIO_PIN_AD_RANGE,OUTPUT},

{GPIO_PORT_AD_CONA,GPIO_PIN_AD_CONA,OUTPUT},

{GPIO_PORT_AD_CONB,GPIO_PIN_AD_CONB,OUTPUT},

{GPIO_PORT_AD_RST,GPIO_PIN_AD_RST,OUTPUT},

{GPIO_PORT_AD_RD,GPIO_PIN_AD_RD,OUTPUT},

{GPIO_PORT_AD_CS,GPIO_PIN_AD_CS,OUTPUT},

{GPIO_PORT_AD_BUSY,GPIO_PIN_AD_BUSY,INPUT},

{GPIO_PORT_AD_FD,GPIO_PIN_AD_FD,INPUT}

};

MYGPIO AD_Data_GPIO[] =

{

{GPIO_PORT_AD_DB0,GPIO_PIN_AD_DB0,INPUT},

{GPIO_PORT_AD_DB1,GPIO_PIN_AD_DB1,INPUT},

{GPIO_PORT_AD_DB2,GPIO_PIN_AD_DB2,INPUT},

{GPIO_PORT_AD_DB3,GPIO_PIN_AD_DB3,INPUT},

{GPIO_PORT_AD_DB4,GPIO_PIN_AD_DB4,INPUT},

{GPIO_PORT_AD_DB5,GPIO_PIN_AD_DB5,INPUT},

{GPIO_PORT_AD_DB6,GPIO_PIN_AD_DB6,INPUT},

{GPIO_PORT_AD_DB7,GPIO_PIN_AD_DB7,INPUT},

{GPIO_PORT_AD_DB8,GPIO_PIN_AD_DB8,INPUT},

{GPIO_PORT_AD_DB9,GPIO_PIN_AD_DB9,INPUT},

{GPIO_PORT_AD_DB10,GPIO_PIN_AD_DB10,INPUT},

{GPIO_PORT_AD_DB11,GPIO_PIN_AD_DB11,INPUT},

{GPIO_PORT_AD_DB12,GPIO_PIN_AD_DB12,INPUT},

{GPIO_PORT_AD_DB13,GPIO_PIN_AD_DB13,INPUT},

{GPIO_PORT_AD_DB14,GPIO_PIN_AD_DB14,INPUT},

{GPIO_PORT_AD_DB15,GPIO_PIN_AD_DB15,INPUT}

};

/* 设置过采样率 */

#define OS0_1() GPIO_WriteBit(GPIO_PORT_OS0,GPIO_PIN_OS0,(BitAction )(1))

#define OS0_0() GPIO_WriteBit(GPIO_PORT_OS0,GPIO_PIN_OS0,(BitAction )(0))

#define OS1_1() GPIO_WriteBit(GPIO_PORT_OS1,GPIO_PIN_OS1,(BitAction )(1))

#define OS1_0() GPIO_WriteBit(GPIO_PORT_OS1,GPIO_PIN_OS1,(BitAction )(0))

#define OS2_1() GPIO_WriteBit(GPIO_PORT_OS2,GPIO_PIN_OS2,(BitAction )(1))

#define OS2_0() GPIO_WriteBit(GPIO_PORT_OS2,GPIO_PIN_OS2,(BitAction )(0))

#define AD_OS_NO {OS2_0(); OS1_0(); OS0_0();}

#define AD_OS_X2 {OS2_0(); OS1_0(); OS0_1();}

#define AD_OS_X4 {OS2_0(); OS1_1(); OS0_0();}

#define AD_OS_X8 {OS2_0(); OS1_1(); OS0_1();}

#define AD_OS_X16 {OS2_1(); OS1_0(); OS0_0();}

#define AD_OS_X32 {OS2_1(); OS1_0(); OS0_1();}

#define AD_OS_X64 {OS2_1(); OS1_1(); OS0_0();}

/*启动AD转换*/

#define CONVST_1() { GPIO_WriteBit(GPIO_PORT_AD_CONA,GPIO_PIN_AD_CONA,(BitAction )(1));\

GPIO_WriteBit(GPIO_PORT_AD_CONB,GPIO_PIN_AD_CONB,(BitAction )(1));}

#define CONVST_0() { GPIO_WriteBit(GPIO_PORT_AD_CONA,GPIO_PIN_AD_CONA,(BitAction )(0));\

GPIO_WriteBit(GPIO_PORT_AD_CONB,GPIO_PIN_AD_CONB,(BitAction )(0));}

#define GET_BUSY() GPIO_ReadInputDataBit(GPIO_PORT_AD_BUSY,GPIO_PIN_AD_BUSY)

#define GET_FD() GPIO_ReadInputDataBit(GPIO_PORT_AD_FD,GPIO_PIN_AD_FD)

#define GET_DATA() GPIO_ReadInputData(GPIO_PORT_AD_DB0)

#define SET_CS(x) GPIO_WriteBit(GPIO_PORT_AD_CS,GPIO_PIN_AD_CS,(BitAction )(x))

#define SET_RD(x) GPIO_WriteBit(GPIO_PORT_AD_RD,GPIO_PIN_AD_RD,(BitAction )(x))

#define SET_RST(x) GPIO_WriteBit(GPIO_PORT_AD_RST,GPIO_PIN_AD_RST,(BitAction )(x)) /*设置复位*/

#define RANGE(x) GPIO_WriteBit(GPIO_PORT_AD_RANGE,GPIO_PIN_AD_RANGE,(BitAction )(x)) /*设置输入量*/

/*

*********************************************************************************************************

* 函 数 名: BUSY_EXTI_TriggerMode

* 功能说明: 设置 BUSY 引脚设置为中断模式

*********************************************************************************************************

*/

static void BUSY_EXTI_TriggerMode(void )

{

EXTI_InitTypeDef EXTI_InitStructure;

GPIO_InitTypeDef GPIO_InitStructure;

NVIC_InitTypeDef NVIC_InitStructure;

#if AD7606_STM32F429

//PI10

RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOI, ENABLE); /* Enable GPIOI clock */

RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);/* Enable SYSCFG clock */

/* Configure PI10 pin as input floating */

GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;

GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;

GPIO_Init(GPIOI, &GPIO_InitStructure);

/* Connect EXTI Line10 to PI10 pin */

SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOI, EXTI_PinSource10);

/* Configure EXTI Line10 */

EXTI_InitStructure.EXTI_Line = EXTI_Line10;

EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;

EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;

//EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;

EXTI_InitStructure.EXTI_LineCmd = ENABLE;

EXTI_Init(&EXTI_InitStructure);

/* Enable and set EXTI Line10 Interrupt to the lowest priority */

NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn;

NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x06;

NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x00;

NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;

NVIC_Init(&NVIC_InitStructure);

#endif

#if AD7606_STM32F429

RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOF, ENABLE);/* Enable GPIOF clock */

RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);/* Enable SYSCFG clock */

/* Configure PF6 pin as input floating */

GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;

GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6;

GPIO_Init(GPIOF, &GPIO_InitStructure);

/* Connect EXTI Line6 to PF6 pin */

SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOF, EXTI_PinSource6);

/* Configure EXTI Line6 */

EXTI_InitStructure.EXTI_Line = EXTI_Line6;

EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;

EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;

//EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;

EXTI_InitStructure.EXTI_LineCmd = ENABLE;

EXTI_Init(&EXTI_InitStructure);

/* Enable and set EXTI Line6 Interrupt to the lowest priority */

NVIC_InitStructure.NVIC_IRQChannel = EXTI9_5_IRQn;

NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x06;

NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x00;

NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;

NVIC_Init(&NVIC_InitStructure);

#endif

}

/*设备操作函数*/

void bsp_DelayWithNOP(u32 cnt)

{

u32 i=0;

for(i=0 ; i

{

__NOP();

}

}

/*

*********************************************************************************************************

* 函 数 名: bsp_InitAD7606

* 功能说明: 配置连接外部SRAM的GPIO和FSMC

* 形 参: 无

* 返 回 值: 无

*********************************************************************************************************

*/

void bsp_InitAD7606(void)

{

//初始化GPIO

Gpio_Open(AD_Control_GPIO,11);

Gpio_Open(AD_Data_GPIO,16);

BUSY_EXTI_TriggerMode();

AD_OS_NO; /* 无过采样 */

RANGE(1);

SET_CS(1);

SET_RD(1);

SET_RST(0);

bsp_DelayWithNOP(10);

SET_RST(1);

bsp_DelayWithNOP(60);

SET_RST(0);

}

/*

*********************************************************************************************************

* 函 数 名: AD7606_StartConvst

* 功能说明: 启动1次ADC转换

* 形 参: 无

* 返 回 值: 无

*********************************************************************************************************

*/

void AD7606_StartConvst(void)

{

/* page 7: CONVST 高电平脉冲宽度和低电平脉冲宽度最短 25ns */

/* CONVST平时为高 */

CONVST_0();

CONVST_0();

CONVST_0();

CONVST_1();

}

/*

*********************************************************************************************************

* 函数名: AD7606_ISR

* 功能说明:定时器采样中断程序

* 形 参:

* 返回值: 无

*********************************************************************************************************

*/

short AD_Value[4] = {0};

static void AD7606_ISR(void)

{

SET_CS(0);//12

SET_RD(0);//12

__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();//24ns

if(GET_FD()==1)//18

{

AD_Value[0] = (short)GET_DATA();

}

else

{

SET_RD(1);//12

SET_CS(1);//12

return;

}

SET_RD(1);//12

__NOP();__NOP();__NOP();__NOP();__NOP();//24

SET_RD(0);//12

__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();//24

AD_Value[1] = (short)GET_DATA();

SET_RD(1);//12

__NOP();__NOP();__NOP();__NOP();__NOP();//24

SET_RD(0);//12

__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();//24

AD_Value[2] = (short)GET_DATA();

SET_RD(1);//12

__NOP();__NOP();__NOP();__NOP();__NOP();//24

SET_RD(0);//12

__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();//24

AD_Value[3] = (short)GET_DATA();

SET_RD(1);//12

__NOP();__NOP();__NOP();__NOP();__NOP();//24

SET_CS(1);//12

}

/*

*********************************************************************************************************

* 函数名: AD7606_EXTI_IRQHandler

* 功能说明:定时器采样中断程序

* 形 参:

* 返回值: 无

*********************************************************************************************************

*/

#if AD7606_STM32F429

#define AD7606_EXTI_IRQHandler EXTI15_10_IRQHandler

#define AD7606_EXTI_Line EXTI_Line10

#endif

#if AD7606_STM32F407

#define AD7606_EXTI_IRQHandler EXTI9_5_IRQHandler

#define AD7606_EXTI_Line EXTI_Line6

#endif

void AD7606_EXTI_IRQHandler(void)

{

if (EXTI_GetITStatus(AD7606_EXTI_Line) != RESET)

{

AD7606_ISR();

/* Clear the EXTI line 6 pending bit */

EXTI_ClearITPendingBit(AD7606_EXTI_Line);

}

}

/*

*********************************************************************************************************

* 函数名: bsp_GetADValue

* 功能说明: 返回采样结果

* 形 参:

* 返回值: 无

*********************************************************************************************************

*/

int bsp_GetADValue(u8 i)

{

if(i<4)

{

return AD_Value[i];

}

else

{

return 0;

}

}

#define KALMAN_Q 0.02

#define KALMAN_R 16.0000

static double KalmanFilter(const double ResrcData,double ProcessNiose_Q,double MeasureNoise_R,u8 ch);

/*

*********************************************************************************************************

* 函数名: bsp_GetKalADVal

* 功能说明: 返回经过滤波的采样结果

* 形 参:

* 返回值: 无

*********************************************************************************************************

*/

int bsp_GetKalADVal(u8 i)

{

int kalAD = 0;

if(i<4)

{

kalAD = (int)KalmanFilter(AD_Value[i],KALMAN_Q,KALMAN_R,i);

return kalAD;

}

else

{

return 0;

}

}

static double KalmanFilter(const double ResrcData,double ProcessNiose_Q,double MeasureNoise_R,u8 ch)

{

double R = MeasureNoise_R;

double Q = ProcessNiose_Q;

static double x_last[4];

double x_mid = x_last[ch];

double x_now;

static double p_last[4];

double p_mid ;

double p_now;

double kg;

x_mid=x_last[ch]; //x_last=x(k-1|k-1),x_mid=x(k|k-1)

p_mid=p_last[ch]+Q; //p_mid=p(k|k-1),p_last=p(k-1|k-1),Q=??

/*

* 卡尔曼滤波的五个重要公式

*/

kg=p_mid/(p_mid+R);   //kg为kalman filter,R 为噪声

x_now=x_mid+kg*(ResrcData-x_mid);   //估计出的最优值

p_now=(1-kg)*p_mid; //最优值对应的covariance

p_last[ch] = p_now; //更新covariance 值

x_last[ch] = x_now; //更新系统状态值

return x_now;

}

/*

*********************************************************************************************************

*

*模块名称: AD7606数据采集块

*文件名称: bsp_ad7606.h

*版 本: V1.0

*

*

*********************************************************************************************************

*/

#ifndef _BSP_AD7606_H

#define _BSP_AD7606_H

#include "stm32f4xx.h"

void bsp_InitAD7606(void);

void AD7606_StartConvst(void);

#define AD7606_STM32F429 1

#define AD7606_STM32F407 0

#if AD7606_STM32F429

#define GPIO_PORT_OS0 GPIOC

#define GPIO_PIN_OS0 GPIO_Pin_0

#define GPIO_PORT_OS1 GPIOC

#define GPIO_PIN_OS1 GPIO_Pin_1

#define GPIO_PORT_OS2 GPIOC

#define GPIO_PIN_OS2 GPIO_Pin_2

#define GPIO_PORT_AD_RANGE GPIOE

#define GPIO_PIN_AD_RANGE GPIO_Pin_4

#define GPIO_PORT_AD_RST GPIOI

#define GPIO_PIN_AD_RST GPIO_Pin_8

#define GPIO_PORT_AD_CS GPIOI

#define GPIO_PIN_AD_CS GPIO_Pin_9

#define GPIO_PORT_AD_CONA GPIOE

#define GPIO_PIN_AD_CONA GPIO_Pin_5

#define GPIO_PORT_AD_CONB GPIOE

#define GPIO_PIN_AD_CONB GPIO_Pin_6

#define GPIO_PORT_AD_RD GPIOC

#define GPIO_PIN_AD_RD GPIO_Pin_13

#define GPIO_PORT_AD_BUSY GPIOI

#define GPIO_PIN_AD_BUSY GPIO_Pin_10

#define GPIO_PORT_AD_FD GPIOI

#define GPIO_PIN_AD_FD GPIO_Pin_11

#define GPIO_PORT_AD_DB0 GPIOF

#define GPIO_PIN_AD_DB0 GPIO_Pin_0

#define GPIO_PORT_AD_DB1 GPIOF

#define GPIO_PIN_AD_DB1 GPIO_Pin_1

#define GPIO_PORT_AD_DB2 GPIOF

#define GPIO_PIN_AD_DB2 GPIO_Pin_2

#define GPIO_PORT_AD_DB3 GPIOF

#define GPIO_PIN_AD_DB3 GPIO_Pin_3

#define GPIO_PORT_AD_DB4 GPIOF

#define GPIO_PIN_AD_DB4 GPIO_Pin_4

#define GPIO_PORT_AD_DB5 GPIOF

#define GPIO_PIN_AD_DB5 GPIO_Pin_5

#define GPIO_PORT_AD_DB6 GPIOF

#define GPIO_PIN_AD_DB6 GPIO_Pin_6

#define GPIO_PORT_AD_DB7 GPIOF

#define GPIO_PIN_AD_DB7 GPIO_Pin_7

#define GPIO_PORT_AD_DB8 GPIOF

#define GPIO_PIN_AD_DB8 GPIO_Pin_8

#define GPIO_PORT_AD_DB9 GPIOF

#define GPIO_PIN_AD_DB9 GPIO_Pin_9

#define GPIO_PORT_AD_DB10 GPIOF

#define GPIO_PIN_AD_DB10 GPIO_Pin_10

#define GPIO_PORT_AD_DB11 GPIOF

#define GPIO_PIN_AD_DB11 GPIO_Pin_11

#define GPIO_PORT_AD_DB12 GPIOF

#define GPIO_PIN_AD_DB12 GPIO_Pin_12

#define GPIO_PORT_AD_DB13 GPIOF

#define GPIO_PIN_AD_DB13 GPIO_Pin_13

#define GPIO_PORT_AD_DB14 GPIOF

#define GPIO_PIN_AD_DB14 GPIO_Pin_14

#define GPIO_PORT_AD_DB15 GPIOF

#define GPIO_PIN_AD_DB15 GPIO_Pin_15

#endif

#if AD7606_STM32F407

#define GPIO_PORT_OS0 GPIOC

#define GPIO_PIN_OS0 GPIO_Pin_0

#define GPIO_PORT_OS1 GPIOC

#define GPIO_PIN_OS1 GPIO_Pin_1

#define GPIO_PORT_OS2 GPIOC

#define GPIO_PIN_OS2 GPIO_Pin_2

#define GPIO_PORT_AD_RANGE GPIOF

#define GPIO_PIN_AD_RANGE GPIO_Pin_0

#define GPIO_PORT_AD_RST GPIOF

#define GPIO_PIN_AD_RST GPIO_Pin_1

#define GPIO_PORT_AD_CS GPIOF

#define GPIO_PIN_AD_CS GPIO_Pin_2

#define GPIO_PORT_AD_CONA GPIOF

#define GPIO_PIN_AD_CONA GPIO_Pin_3

#define GPIO_PORT_AD_CONB GPIOF

#define GPIO_PIN_AD_CONB GPIO_Pin_4

#define GPIO_PORT_AD_RD GPIOF

#define GPIO_PIN_AD_RD GPIO_Pin_5

#define GPIO_PORT_AD_BUSY GPIOF

#define GPIO_PIN_AD_BUSY GPIO_Pin_6

#define GPIO_PORT_AD_FD GPIOF

#define GPIO_PIN_AD_FD GPIO_Pin_7

#define GPIO_PORT_AD_DB0 GPIOE

#define GPIO_PIN_AD_DB0 GPIO_Pin_0

#define GPIO_PORT_AD_DB1 GPIOE

#define GPIO_PIN_AD_DB1 GPIO_Pin_1

#define GPIO_PORT_AD_DB2 GPIOE

#define GPIO_PIN_AD_DB2 GPIO_Pin_2

#define GPIO_PORT_AD_DB3 GPIOE

#define GPIO_PIN_AD_DB3 GPIO_Pin_3

#define GPIO_PORT_AD_DB4 GPIOE

#define GPIO_PIN_AD_DB4 GPIO_Pin_4

#define GPIO_PORT_AD_DB5 GPIOE

#define GPIO_PIN_AD_DB5 GPIO_Pin_5

#define GPIO_PORT_AD_DB6 GPIOE

#define GPIO_PIN_AD_DB6 GPIO_Pin_6

#define GPIO_PORT_AD_DB7 GPIOE

#define GPIO_PIN_AD_DB7 GPIO_Pin_7

#define GPIO_PORT_AD_DB8 GPIOE

#define GPIO_PIN_AD_DB8 GPIO_Pin_8

#define GPIO_PORT_AD_DB9 GPIOE

#define GPIO_PIN_AD_DB9 GPIO_Pin_9

#define GPIO_PORT_AD_DB10 GPIOE

#define GPIO_PIN_AD_DB10 GPIO_Pin_10

#define GPIO_PORT_AD_DB11 GPIOE

#define GPIO_PIN_AD_DB11 GPIO_Pin_11

#define GPIO_PORT_AD_DB12 GPIOE

#define GPIO_PIN_AD_DB12 GPIO_Pin_12

#define GPIO_PORT_AD_DB13 GPIOE

#define GPIO_PIN_AD_DB13 GPIO_Pin_13

#define GPIO_PORT_AD_DB14 GPIOE

#define GPIO_PIN_AD_DB14 GPIO_Pin_14

#define GPIO_PORT_AD_DB15 GPIOE

#define GPIO_PIN_AD_DB15 GPIO_Pin_15

#endif

#endif

/***************************** (END OF FILE) *********************************/

#include "bsp_GPIO.h"

static void GPIO_SetRCC(GPIO_TypeDef* GPIOx)

{

assert_param(IS_GPIO_ALL_PERIPH(GPIOx));

if (GPIOx == GPIOA)

{

RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);

}

else if (GPIOx == GPIOB)

{

RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB, ENABLE);

}

else if (GPIOx == GPIOC)

{

RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC, ENABLE);

}

else if (GPIOx == GPIOD)

{

RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);

}

else if (GPIOx == GPIOE)

{

RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOE, ENABLE);

}

else if (GPIOx == GPIOF)

{

RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOF, ENABLE);

}

else if (GPIOx == GPIOG)

{

RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOG, ENABLE);

}

else if (GPIOx == GPIOH)

{

RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOH, ENABLE);

}

else

{

if (GPIOx == GPIOI)

{

RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOI, ENABLE);

}

}

}

void Gpio_Open(MYGPIO * prt ,uint8_t num)

{

uint8_t index;

for(index=0;index

{

GPIO_InitTypeDef GPIO_InitStructure;

GPIO_SetRCC(prt[index].GPIOx);

GPIO_InitStructure.GPIO_Mode = prt[index].Mode;

if( prt[index].Mode == OUTPUT )

{

GPIO_InitStructure.GPIO_OType=GPIO_OType_PP;

GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;

}else

{

GPIO_InitStructure.GPIO_OType=GPIO_OType_OD;

GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;

}

GPIO_InitStructure.GPIO_Pin = prt[index].Pin;

GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

GPIO_Init(prt[index].GPIOx, &GPIO_InitStructure);

}

}

#ifndef _BSP_GPIO_H

#define _BSP_GPIO_H

#include "stm32f4xx.h"

typedef enum

{

INPUT = 0x00,

OUTPUT = 0x01,

AIN = 0x03

}PinMode;

typedef struct

{

GPIO_TypeDef* GPIOx;

uint16_t Pin;

PinMode Mode;

}MYGPIO;

void Gpio_Open(MYGPIO * prt ,uint8_t num);

#endif

本站声明: 本文章由作者或相关机构授权发布,目的在于传递更多信息,并不代表本站赞同其观点,本站亦不保证或承诺内容真实性等。需要转载请联系该专栏作者,如若文章内容侵犯您的权益,请及时联系本站删除。
换一批
延伸阅读

9月2日消息,不造车的华为或将催生出更大的独角兽公司,随着阿维塔和赛力斯的入局,华为引望愈发显得引人瞩目。

关键字: 阿维塔 塞力斯 华为

加利福尼亚州圣克拉拉县2024年8月30日 /美通社/ -- 数字化转型技术解决方案公司Trianz今天宣布,该公司与Amazon Web Services (AWS)签订了...

关键字: AWS AN BSP 数字化

伦敦2024年8月29日 /美通社/ -- 英国汽车技术公司SODA.Auto推出其旗舰产品SODA V,这是全球首款涵盖汽车工程师从创意到认证的所有需求的工具,可用于创建软件定义汽车。 SODA V工具的开发耗时1.5...

关键字: 汽车 人工智能 智能驱动 BSP

北京2024年8月28日 /美通社/ -- 越来越多用户希望企业业务能7×24不间断运行,同时企业却面临越来越多业务中断的风险,如企业系统复杂性的增加,频繁的功能更新和发布等。如何确保业务连续性,提升韧性,成...

关键字: 亚马逊 解密 控制平面 BSP

8月30日消息,据媒体报道,腾讯和网易近期正在缩减他们对日本游戏市场的投资。

关键字: 腾讯 编码器 CPU

8月28日消息,今天上午,2024中国国际大数据产业博览会开幕式在贵阳举行,华为董事、质量流程IT总裁陶景文发表了演讲。

关键字: 华为 12nm EDA 半导体

8月28日消息,在2024中国国际大数据产业博览会上,华为常务董事、华为云CEO张平安发表演讲称,数字世界的话语权最终是由生态的繁荣决定的。

关键字: 华为 12nm 手机 卫星通信

要点: 有效应对环境变化,经营业绩稳中有升 落实提质增效举措,毛利润率延续升势 战略布局成效显著,战新业务引领增长 以科技创新为引领,提升企业核心竞争力 坚持高质量发展策略,塑强核心竞争优势...

关键字: 通信 BSP 电信运营商 数字经济

北京2024年8月27日 /美通社/ -- 8月21日,由中央广播电视总台与中国电影电视技术学会联合牵头组建的NVI技术创新联盟在BIRTV2024超高清全产业链发展研讨会上宣布正式成立。 活动现场 NVI技术创新联...

关键字: VI 传输协议 音频 BSP

北京2024年8月27日 /美通社/ -- 在8月23日举办的2024年长三角生态绿色一体化发展示范区联合招商会上,软通动力信息技术(集团)股份有限公司(以下简称"软通动力")与长三角投资(上海)有限...

关键字: BSP 信息技术
关闭
关闭