当前位置:网站首页>华大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();
}边栏推荐
- 队列实现原理和应用
- Reduce the pip to the specified version (upgrade the PIP through CMP and reduce it to the original version)
- A deep learning model for urban traffic flow prediction with traffic events mined from twitter
- leetcode1720_ 2021-10-14
- 树莓派初步使用
- Binary search tree template
- 理想L9,智能座舱新潮流
- leetcode:45. 跳跃游戏 II【经典贪心】
- [theory] deep learning in the covid-19 epic: a deep model for urban traffic revitalization index
- Practice of hierarchical management based on kubesphere
猜你喜欢

leetcode-201_ 2021_ 10_ seventeen

嵌入式开发:技巧和窍门——干净地从引导加载程序跳转到应用程序代码

First order model realizes photo moving (with tool code) | machine learning

刷题笔记(十八)--二叉树:公共祖先问题

“阿里健康”们的逻辑早就变了
![[notes of Wu Enda] convolutional neural network](/img/19/2cac17010c29cbd5ba245de105d6c1.png)
[notes of Wu Enda] convolutional neural network

系统测试主要步骤

零代码即可将数据可视化应用到企业管理中

LeetCode-513. Find the value in the lower left corner of the tree

字符串习题总结2
随机推荐
dp问题集
【OpenCV 例程200篇】209. HSV 颜色空间的彩色图像分割
Drag drag drag
想当测试Leader,这6项技能你会吗?
Double linked list implementation
双链表实现
基于kruskal的最小生成树
01--- conditions for interference of two trains of waves at the meeting place
Two implementation methods of stack
【无标题】
Reduce the pip to the specified version (upgrade the PIP through CMP and reduce it to the original version)
机器学习:线性回归
Detailed installation and use of performance test tool wrk
leetcode:1504. 统计全 1 子矩形的个数
leetcode_ 1470_ 2021.10.12
LeetCode-513. Find the value in the lower left corner of the tree
心楼:华为运动健康的七年筑造之旅
Flutter-使用 typedef的注意事项
基于 KubeSphere 的分级管理实践
The logic of "Ali health" has long changed