当前位置:网站首页>华大4A0GPIO设置
华大4A0GPIO设置
2022-06-24 19:32:00 【纸带】
typedef struct
{
uint16_t u16PinState; /*!< Set pin state to High or Low, @ref GPIO_PinState_Sel for details */
uint16_t u16PinDir; /*!< Pin mode setting, @ref GPIO_PinDirection_Sel for details */
uint16_t u16PinOType; /*!< Output type setting, @ref GPIO_PinOutType_Sel for details */
uint16_t u16PinDrv; /*!< Pin drive capacity setting, @ref GPIO_PinDrv_Sel for details */
uint16_t u16Latch; /*!< Pin latch setting, @ref GPIO_PinLatch_Sel for details */
uint16_t u16PullUp; /*!< Internal pull-up resistor setting, @ref GPIO_PinPU_Sel for details */
uint16_t u16Invert; /*!< Pin input/output invert setting, @ref GPIO_PinInvert_Sel */
uint16_t u16PinIType; /*!< Input type setting, @ref GPIO_PinInType_Sel */
uint16_t u16ExInt; /*!< External interrupt pin setting, @ref GPIO_PinExInt_Sel for details */
uint16_t u16PinAttr; /*!< Digital or analog attribute setting, @ref GPIO_PinMode_Sel for details */
} stc_gpio_init_t;pstcGpioInit->u16PinState = PIN_STATE_RESET;//设置引脚状态是高低电平 pstcGpioInit->u16PinDir = PIN_DIR_IN;//设置输入还是输出 pstcGpioInit->u16PinOType = PIN_OTYPE_CMOS;//设置是NMOS还是PMOS输出 pstcGpioInit->u16PinDrv = PIN_DRV_LOW;//设置推挽输出方式,是高低中速输出 pstcGpioInit->u16Latch = PIN_LATCH_OFF;//锁存使能//锁存失能 pstcGpioInit->u16PullUp = PIN_PU_OFF;/内部上拉的使能调节 pstcGpioInit->u16Invert = PIN_INVERT_OFF;//输入输出。反转使能 pstcGpioInit->u16PinIType = PIN_ITYPE_SMT;//输入的方式分为SMT输入CMOS的输入 pstcGpioInit->u16ExInt = PIN_EXINT_OFF;//外部中断 pstcGpioInit->u16PinAttr = PIN_ATTR_DIGITAL;//数字和模拟属性
关于4A0的一个运用的一般步骤:
stc_gpio_init_t stcGpioInit;//声明一个gpio的配置struct.
/* Register write enable for some required peripherals. */
Peripheral_WE();
/* LED initialize */
(void)GPIO_StructInit(&stcGpioInit);//关于gpio各个属性的设置。
(void)GPIO_Init(LED_GREEN_PORT, LED_GREEN_PIN, &stcGpioInit);//某一个引脚的设置,在来一个初始化。
/* Register write protected for some required peripherals. */
Peripheral_WP();
/* "Turn off" LED before set to output */
GPIO_ResetPins(LED_GREEN_PORT, LED_GREEN_PIN);//设置单独的高低电平输出输入
/* Output enable */
GPIO_OE(LED_GREEN_PORT, LED_GREEN_PIN, Enable);//设置高低电平的输出
for (;;)
{
/* LED */
GPIO_SetPins(LED_GREEN_PORT, LED_GREEN_PIN);//
DDL_DelayMS(2000UL);//延时
GPIO_ResetPins(LED_GREEN_PORT, LED_GREEN_PIN);//
DDL_DelayMS(2000UL);//延时
/* De-init port if necessary */
//GPIO_DeInit();
}边栏推荐
猜你喜欢

Multithreaded finalization

Kubernetes 集群中流量暴露的几种方案

基于 KubeSphere 的分级管理实践

60 个神级 VS Code 插件!!
![[notes of wuenda] fundamentals of machine learning](/img/71/6192a75446fa7f79469a5483ececc6.jpg)
[notes of wuenda] fundamentals of machine learning

Machine learning: linear regression
![Find the maximum value in each tree row [extension of one of the hierarchical traversals]](/img/5b/81ff20b61c0719ceb6873e44878859.png)
Find the maximum value in each tree row [extension of one of the hierarchical traversals]

Want to be a test leader, do you know these 6 skills?

C language - keyword 1

【OpenCV 例程200篇】209. HSV 颜色空间的彩色图像分割
随机推荐
I really want to send a bunch of flowers
leetcode:55. 跳跃游戏【经典贪心】
Graduation design of phase 6 of the construction practice camp
堆排序和快速排序原理实现
最大流问题
我国SaaS产业的发展趋势与路径
The logic of "Ali health" has long changed
代理模式详解
基于 KubeSphere 的分级管理实践
TKKC round#3
平衡二叉搜索树
leetcode:45. 跳跃游戏 II【经典贪心】
03--- antireflective film
linq查询集合类入门 案例武林高手类
LINQ query collection class introductory cases Wulin expert class
first-order-model实现照片动起来(附工具代码) | 机器学习
DAO 中常见的投票治理方式
想当测试Leader,这6项技能你会吗?
Flutter 如何使用在线转码工具将 JSON 转为 Model
You are using pip version 21.1.2; however, version 22.1.2 is available