当前位置:网站首页>华大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();
}边栏推荐
猜你喜欢
![[notes of Wu Enda] convolutional neural network](/img/19/2cac17010c29cbd5ba245de105d6c1.png)
[notes of Wu Enda] convolutional neural network

虚拟人的产业发展现状

二叉搜索树模板

排查到解决问题的过程:浏览器突然无法访问网页,错误代码:0x80004005,最终定位:“电脑打开热点,电脑就不能上网了”

Detailed installation and use of performance test tool wrk

Binary search tree template

Cannot find reference 'imread' in 'appears in pycharm__ init__. py‘

性能测试工具wrk安装使用详解

Opengauss kernel: simple query execution

Redis+caffeine two-level cache enables smooth access speed
随机推荐
Xinlou: Huawei's seven-year building journey of sports health
旅行商问题(TSP)的相关论文总结
LeetCode-513. Find the value in the lower left corner of the tree
You are using pip version 21.1.2; however, version 22.1.2 is available
Redis+caffeine two-level cache enables smooth access speed
机器学习:梯度下降法
DAO 中常见的投票治理方式
PyCharm 中出现Cannot find reference ‘imread‘ in ‘__init__.py‘
解决dataframe报错ValueError: Cannot take a larger sample than population when ‘replace=False‘
The logic of "Ali health" has long changed
DP problem set
Flutter 如何使用在线转码工具将 JSON 转为 Model
嵌入式开发:技巧和窍门——干净地从引导加载程序跳转到应用程序代码
Practice of hierarchical management based on kubesphere
Réduire le PIP à la version spécifiée (mettre à jour le PIP avec pycharm avant de le réduire à la version originale)
【OpenCV 例程200篇】209. HSV 颜色空间的彩色图像分割
03--- antireflective film
排查到解决问题的过程:浏览器突然无法访问网页,错误代码:0x80004005,最终定位:“电脑打开热点,电脑就不能上网了”
openGauss内核:简单查询的执行
面试官:你说你精通Redis,你看过持久化的配置吗?