GPIO_InitStruct_D5.GPIO_Speed = GPIO_Speed_10MHz; // 引脚速率 /*第三步:调用外设初始化函数,把配置好的结构体成员写到寄存器里面*/ GPIO_Init(GPIO_PORT_D4, &GPIO_InitStruct_D4); GPIO_Init(GPIO_PORT_D5, &GPIO_InitStruct_D5); } bsp_key.h: 1 2 3 4 5 6 7 8 9 10 11 12 13...
GPIO_ReadInputDataBit是一个函数,从名字上看是读取输入数据的bit位值,它有两个输入参数GPIO_KEY1_PORT, GPIO_KEY1,名字上看一个是key的端口,一个是key值,该函数返回值为true或false。具体函数功能要看实现了,要看代码怎么写的。
// 初始化GPIO和中断配置 voidGPIO_Config(void) { // 启用GPIO时钟 RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA,ENABLE); // 配置LED引脚为输出模式 GPIO_InitTypeDef gpioInit; gpioInit.GPIO_Mode=GPIO_Mode_OUT; gpioInit.GPIO_OType=GPIO_OType_PP; gpioInit.GPIO_Pin=LED_RED|LED_GREEN|LED_BLUE...
#define LED1_TOGGLE digitalTOGGLE(GPIO_PORT_D4,GPIO_PIN_D4)#define LED2_TOGGLE digitalTOGGLE(GPIO_PORT_D5,GPIO_PIN_D5)/*配置GPIO*/ void LED_GPIO_Config(void);#endif /*__BSP_LED_H__*/ bsp_led.c:/* 和LED功能模块相关的程序头⽂件 */ #include "./led/bsp_led.h" /*...
你好,我们在用 keyfob 调试时,发现如标题所示问题:无法配置 P0_1为低电平, //*gjy P0SEL |= BV(0); // Configure Port 0 p0.0 as Peripheral P0SEL &= ~ BV(1);// Configure Port 0 p0.1 as GPIO //P0DIR &= ~ BV(0); // Port 0 pins P...
u32 gpio_sel; //port u32 Pin; /*!< Specifies the GPIO pins to be configured. This parameter can be any value of [url=home.php?mod=space&uid=1352397]@ref[/url] GPIO_pins_define */ SYS_GpioModeDef Mode; /*!< Specifies the operating mode for the selected pins. This parameter can...
//queue_work(&key_wq[key], &gpio_key_work[key]);//相同崩掉! 眼下还不清楚原因 源代码例如以下: #include "key.h" #define S3C_ADDR_BASE 0xF6000000 #define S3C_ADDR(x) (S3C_ADDR_BASE + (x)) #define S3C2410_PA_UART (0x50000000) ...
全志D1开发板添加基于中断的 gpio-key 按键驱动 修改output/build/linux-origin_master/arch/riscv/boot/dts/board.dts:在 reg_usb1_vbus: usb1-vbus { compatible = "regulator-fixed"; regulator-name = "usb1-vbus"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; regula...