reg
1、
/** GPIO - Register Layout Typedef */ typedef struct { __IO uint32_t DR; /**< GPIO data register, offset: 0x0 */ __IO uint32_t GDIR; /**< GPIO direction register, offset: 0x4 */ __I uint32_t PSR; /**< GPIO pad status register, offset: 0x8 */ __IO uint32_t ICR1; /**< GPIO interrupt configuration register1, offset: 0xC */ __IO uint32_t ICR2; /**< GPIO interrupt configuration register2, offset: 0x10 */ __IO uint32_t IMR; /**< GPIO interrupt mask register, offset: 0x14 */ __IO uint32_t ISR; /**< GPIO interrupt status register, offset: 0x18 */ __IO uint32_t EDGE_SEL; /**< GPIO edge select register, offset: 0x1C */ } GPIO_Type;
led /* 3、初始化GPIO,GPIO1_IO03设置为输出*/ GPIO1->GDIR |= (1 << 3); /* 4、设置GPIO1_IO03输出低电平,打开LED0*/ GPIO1->DR &= ~(1 << 3); GPIO1->DR |= (1<<3); /* 关闭LED0 */ beep /* 3、初始化GPIO,GPIO5_IO01设置为输出 */ GPIO5->GDIR |= (1 << 1); /* 4、设置GPIO5_IO01输出高电平,关闭蜂鸣器 */ GPIO5->DR |= (1 << 1); GPIO5->DR &= ~(1 << 1); /* 打开蜂鸣器 */
2、
/** EPIT - Register Layout Typedef */ typedef struct { __IO uint32_t CR; /**< Control register, offset: 0x0 */ __IO uint32_t SR; /**< Status register, offset: 0x4 */ __IO uint32_t LR; /**< Load register, offset: 0x8 */ __IO uint32_t CMPR; /**< Compare register, offset: 0xC */ __I uint32_t CNR; /**< Counter register, offset: 0x10 */ } EPIT_Type;
3、
/** UART - Register Layout Typedef */ typedef struct { __I uint32_t URXD; /**< UART Receiver Register, offset: 0x0 */ uint8_t RESERVED_0[60]; __IO uint32_t UTXD; /**< UART Transmitter Register, offset: 0x40 */ uint8_t RESERVED_1[60]; __IO uint32_t UCR1; /**< UART Control Register 1, offset: 0x80 */ __IO uint32_t UCR2; /**< UART Control Register 2, offset: 0x84 */ __IO uint32_t UCR3; /**< UART Control Register 3, offset: 0x88 */ __IO uint32_t UCR4; /**< UART Control Register 4, offset: 0x8C */ __IO uint32_t UFCR; /**< UART FIFO Control Register, offset: 0x90 */ __IO uint32_t USR1; /**< UART Status Register 1, offset: 0x94 */ __IO uint32_t USR2; /**< UART Status Register 2, offset: 0x98 */ __IO uint32_t UESC; /**< UART Escape Character Register, offset: 0x9C */ __IO uint32_t UTIM; /**< UART Escape Timer Register, offset: 0xA0 */ __IO uint32_t UBIR; /**< UART BRM Incremental Register, offset: 0xA4 */ __IO uint32_t UBMR; /**< UART BRM Modulator Register, offset: 0xA8 */ __I uint32_t UBRC; /**< UART Baud Rate Count Register, offset: 0xAC */ __IO uint32_t ONEMS; /**< UART One Millisecond Register, offset: 0xB0 */ __IO uint32_t UTS; /**< UART Test Register, offset: 0xB4 */ __IO uint32_t UMCR; /**< UART RS-485 Mode Control Register, offset: 0xB8 */ } UART_Type;
4、
/** I2C - Register Layout Typedef */ typedef struct { __IO uint16_t IADR; /**< I2C Address Register, offset: 0x0 */ uint8_t RESERVED_0[2]; __IO uint16_t IFDR; /**< I2C Frequency Divider Register, offset: 0x4 */ uint8_t RESERVED_1[2]; __IO uint16_t I2CR; /**< I2C Control Register, offset: 0x8 */ uint8_t RESERVED_2[2]; __IO uint16_t I2SR; /**< I2C Status Register, offset: 0xC */ uint8_t RESERVED_3[2]; __IO uint16_t I2DR; /**< I2C Data I/O Register, offset: 0x10 */ } I2C_Type;
5、
/** ECSPI - Register Layout Typedef */ typedef struct { __I uint32_t RXDATA; /**< Receive Data Register, offset: 0x0 */ __O uint32_t TXDATA; /**< Transmit Data Register, offset: 0x4 */ __IO uint32_t CONREG; /**< Control Register, offset: 0x8 */ __IO uint32_t CONFIGREG; /**< Config Register, offset: 0xC */ __IO uint32_t INTREG; /**< Interrupt Control Register, offset: 0x10 */ __IO uint32_t DMAREG; /**< DMA Control Register, offset: 0x14 */ __IO uint32_t STATREG; /**< Status Register, offset: 0x18 */ __IO uint32_t PERIODREG; /**< Sample Period Control Register, offset: 0x1C */ __IO uint32_t TESTREG; /**< Test Control Register, offset: 0x20 */ uint8_t RESERVED_0[28]; __O uint32_t MSGDATA; /**< Message Data Register, offset: 0x40 */ } ECSPI_Type;
二、
最后一个是IO几那后面设置的时候就是io多少
void led_init(void) { /* 1、初始化IO复用 */ IOMUXC_SetPinMux(IOMUXC_GPIO1_IO03_GPIO1_IO03,0); /* 复用为GPIO1_IO03 */ /* 2、、配置GPIO1_IO03的IO属性 *bit 16:0 HYS关闭 *bit [15:14]: 00 默认下拉 *bit [13]: 0 kepper功能 *bit [12]: 1 pull/keeper使能 *bit [11]: 0 关闭开路输出 *bit [7:6]: 10 速度100Mhz *bit [5:3]: 110 R0/6驱动能力 *bit [0]: 0 低转换率 */ IOMUXC_SetPinConfig(IOMUXC_GPIO1_IO03_GPIO1_IO03,0X10B0); /* 3、初始化GPIO,GPIO1_IO03设置为输出*/ GPIO1->GDIR |= (1 << 3); /* 4、设置GPIO1_IO03输出低电平,打开LED0*/ GPIO1->DR &= ~(1 << 3); }