1 / 11

HOLTEK 产品训练课程

HPTC-A1-HT32-18. HOLTEK 产品训练课程. GPIO & AFIO 简介 (通用 I/O & 复用 功能 I/O ). GPIO & AFIO 特性. 输入 / 输出直接控制 施密特触发输入功能使能控制 输入弱上拉 / 下拉控制 输出推拉 / 开漏使能控制 输出设置 / 复位控制 输出驱动电流选择 带有可编程触发沿的外部中断 外部中断源选择 模拟输入 / 输出配置 端口配置锁 每个 GPIO 都可配置引脚功能,每个引脚最多有四种 复用 功能. GPIO & AFIO 功能描述 -1.

boris
Download Presentation

HOLTEK 产品训练课程

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. HPTC-A1-HT32-18 HOLTEK 产品训练课程 GPIO & AFIO简介 (通用 I/O& 复用功能 I/O)

  2. GPIO & AFIO 特性 • 输入 / 输出直接控制 • 施密特触发输入功能使能控制 • 输入弱上拉 / 下拉控制 • 输出推拉 / 开漏使能控制 • 输出设置 / 复位控制 • 输出驱动电流选择 • 带有可编程触发沿的外部中断 • 外部中断源选择 • 模拟输入 / 输出配置 • 端口配置锁 • 每个 GPIO 都可配置引脚功能,每个引脚最多有四种复用功能

  3. GPIO & AFIO 功能描述-1 • 大多数 GPIO 的默认引脚配置 • 输入除能和浮空 • PA9 和 PA10 默认引脚配置 • PA9 / BOOT0 :带内部下拉的输入使能 • PA10 / BOOT1 :带内部上拉的输入使能

  4. GPIO & AFIO 功能描述-2 • PA13 和 PA14 默认引脚配置 • PA13 / SWDIO :带内部上拉的输入或输出使能 • PA14 / SWCLK :带内部上拉的输入使能

  5. GPIO & AFIO 功能描述-3 • IOPAD / GPIO / AFIO 控制信号

  6. GPIO & AFIO 功能描述-4 • IOPAD 控制信号

  7. GPIO & AFIO 功能描述-5 • GPIO 控制信号

  8. GPIO & AFIO 功能描述-6 • AFIO 控制信号

  9. GPIO & AFIO 功能描述-7 • AFIO / GPIO / IO PAD 控制信号真值表 注:当相关引脚配置在 GPIO 输入 / 输出模式时,IO PAD 的 IEN 和 OEN 信号分别来自于寄存器位 PxINENn 和 PxDIRn。

  10. GPIO & AFIO 范例 • 按键KEY1 控制LED2 开/关 int main(void) { /* Enable AFIO peripheral clock */ CKCU_APBPerip0ClockConfig(CKCU_APBEN0_AFIO, ENABLE); /* Configure KEY1 pin as the input function */ CKCU_APBPerip0ClockConfig(DVB_GpioClock[KEY1_BUTTON_GPIO_ID], ENABLE); HT32F_DVB_GPxConfig(KEY1_BUTTON_GPIO_ID, KEY1_BUTTON_AFIO_PIN, KEY1_BUTTON_AFIO_MODE); GPIO_DirectionConfig(KEY1_BUTTON_GPIO_PORT, KEY1_BUTTON_GPIO_PIN, GPIO_DIR_IN); GPIO_InputConfig(KEY1_BUTTON_GPIO_PORT, KEY1_BUTTON_GPIO_PIN, ENABLE);} /* Configure LED2 pins as output function */ CKCU_APBPerip0ClockConfig(DVB_GpioClock[LED2_GPIO_ID], ENABLE); HT32F_DVB_GPxConfig(LED2_GPIO_ID, LED2_AFIO_PIN, LED2_AFIO_MODE); GPIO_DirectionConfig(LED2_GPIO_PORT, LED2_GPIO_PIN, GPIO_DIR_OUT); /* Infinite loop to read data from KEY1 and then output to LED2 */ while(1) { TmpStatus = GPIO_ReadInBit(KEY1_BUTTON_GPIO_PORT, KEY1_BUTTON_GPIO_PIN); GPIO_WriteOutBits(LED2_GPIO_PORT, LED2_GPIO_PIN, TmpStatus); } }

  11. 谢谢!

More Related