区别:F1(M-3)系列管脚速度只有三种模式 并且管脚的模式配置八种模式全部都在一起定义,直接设置即可 总归还是大同小异,不做过多介绍,看下下方配置即可 void led_init(void) {GPIO_InitTypeDef GPIO_InitStruct; //定义初始化结构体 RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA,EN
void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct); /*第一个参数是用来指定 GPIO,取值范围为 GPIOA~GPIOG。 *第二个参数为初始化参数结构体指针,结构体类型为 GPIO_InitTypeDef */ 初始化 GPIO 的常用格式是: GPIO_InitTypeDef GPIO_InitStructure; GPIO_InitStructure.GPIO_Pin = GPIO...
GPIO_InitTypeDef GPIO_InitStruct; // 设置 GPIO_InitStruct 结构体中的 GPIO_Pin 成员变量为 GPIOB 的第 5 个引脚 GPIO_InitStruct.GPIO_Pin = GPIO_Pin_5; // 设置 GPIO_InitStruct 结构体中的 GPIO_Mode 成员变量为推挽输出模式 GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; // 设置 GPIO_Init...
void GPIO_WriteBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, BitAction BitVal);void GPIO_Write(GPIO_TypeDef* GPIOx, uint16_t PortVal);这两个函数不常用,也是用来设置IO口输出电平。 eg:跑马灯例程: 1、使能IO口时钟。 调用函数RCC_APB2PeriphColckCmd();(不同IO组,调用时钟使能不一样) 2、初始化...
1. 前言 本站之前的三篇文章[1][2][3]介绍了pin controller(对应的pin controller subsystem)、gpio controller(对应的GPIO subsystem)有关的基本概念,包括pin multiplexing、pin configuration等等。本文…
voidGPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct);/*第一个参数是用来指定 GPIO,取值范围为 GPIOA~GPIOG。 *第二个参数为初始化参数结构体指针,结构体类型为 GPIO_InitTypeDef */ 初始化 GPIO 的常用格式是: GPIO_InitTypeDef GPIO_InitStructure; ...
void led_init(void) {GPIO_InitTypeDef GPIO_InitStruct; //定义初始化结构体 RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA,ENABLE); //使能GPIOA时钟 GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; //配置模式 GPIO_InitStruct.GPIO_Pin = GPIO_Pin_0; //配置哪个IO口 ...
PinCount 属性应与通过 驱动程序的 CLIENT_QueryControllerBasicInformation 回调中的 GpioClx 属性返回的值匹配。 选择与电路板现有发布的文档最兼容的编号方案。 例如,Raspberry Pi 使用原生引脚编号,因为许多现有引脚图都使用 BCM2835 引脚编号。 MinnowBoardMax 使用顺序引脚编号,因为现有的引脚排列图很少,顺序引脚编号...
GPIO_ResetBits(GPIOA,GPIO_Pin_5); } }//读取PA5端口的LED状态,进行翻转操作 开关的配置 #include"stm32f10x.h"//Device header#include"Delay.h"voidKey_Init(void){ RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB,ENABLE); GPIO_InitTypeDef GPIO_InitStructure; ...
3.推挽式复用功能GPIO_AF_PP ——片内外设功能(I2C的SCL,SDA) 复用功能模式中,输出使能,输出速度可配置,可工作在推挽模式,但是输出信号源于其它外设,输出数据寄存器 GPIOx_ODR 无效;输入可用,通过输入数据寄存器可获取 I/O 实际状态,但一般直接用外设的寄存器来获取该数据信号。