映射公式(外设寄存器和SRAM可被映射): bit_word_addr=bit_band_base+(byte_offset×32)+(bit_number∗4)bit_word_addr=bit_band
port->ctx)return-ENOMEM;#endifdat= gpio->regs + GPIO_EXT_PORTA + pp->idx * GPIO_EXT_PORT_STRIDE;//读取状态寄存器set= gpio->regs + GPIO_SWPORTA_DR + pp->idx *GPIO_SWPORT_DR_STRIDE;//设置状态寄存器dirout = gpio->regs + GPIO_SWPORTA_DDR + pp->idx *GPIO_SWPORT_DDR_STRIDE;//...
GPIOPinTypeI2CSCL(GPIO_PORTA_BASE,GPIO_PIN_6); //选择PA6作为SCL 设置PORT F4作为中断接口 SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);GPIOIntRegister(GPIO_PORTF_BASE, PortDIntHandler);GPIOPinTypeGPIOInput(GPIO_PORTF_BASE, GPIO_PIN_4);GPIOIntTypeSet(GPIO_PORTF_BASE, GPIO_PIN...
1:voidGPIODirModeSet(unsignedlongulPort,unsignedcharucPins,unsignedlongulPinIO) 设置所选GPIO端口指定管脚的方向和模式 如GPIODirModeSe(GPIO_PORTA_BASE,GPIO_PIN_2,GPIO_DIR_MODE_IN)函数设置PA2为输入,但第三个参数为“GPIO_DIR_MODE_HW//硬件控制”时指此管脚启用第二功能; 2:unsignedlong...
登录后复制#ifndef__LED_H#define__LED_H#includetypedefunsignedintuint32_t;#define_IO volatile#define_I volatile const#define_O volatile#definePERIPH_BASE 0x40000000UL#defineAPB1_BASE PERIPH_BASE#defineAPB2_BASE (PERIPH_BASE + 0x10000)#defineAHB_BASE (PERIPH_BASE + 0x20000)#defineGPIOA_BASE...
ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); // // Configure the UART for 115,200, 8-N-1 operation. // ROM_UARTConfigSetExpClk(UART0_BASE, ROM_SysCtlClockGet(), 115200, (UART_CONFIG_WLEN_...
}}void LED_Init(void){RCC->APB2ENR|=1<<2; //使能PORTA时钟RCC->APB2ENR|=1<<5; /...
If I write to an address referenced to the GPIO_PORTA_BASE which is 0x40004000, does the hardware actually route this to 0x40058000 which is the GPIO_PORTA_AHB_BASE address? If so, will this behavior be the same on all of the current '129x parts and future revisions?
ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); ROM_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_2); ROM_GPIOPinConfigure我认为操作的不是gpio的寄存器,操作的是对应的外设功能的寄存器。 ROM_GPIOPinTypeGPIOOutput、ROM_GPIOPinTypeUART这种操作的是gpio的寄存器,...
GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_0, ucVal),这个函数在厂商库里面定义了的,所以实现了Pin写的功能。 另外Short Pin对GPIO管脚的外设多功能复用操作也带来了极大的方便,比如配置PD5为I2C的clock脚功能,如下: xSPinTypeI2C(I2C0SCK, PD5); 是不是很简单上面的实现如下: #define xSPinTypeI2C(ePeriphera...