GPIO
/* pin PA[10] - USER LED3 (DS4) on DEV-KIT */
#define PORT PTA
#define LED3 10
PTA在定义在 MPC5748G_features.h 文件中,如下源码
PTA:选中了PA这一组IO口的首地址,选择PTA组的不同pin口时直接对相应位的寄存器置1或者0即可
LED_PIN 10:在开发板DEV-KIT中LED3(DS4)为 pin PA[10]
// 以下列出的是 MPC5748G_features.h 官方提供部分源码
/* GPIO - Peripheral instance base addresses */
/** Peripheral PTA base address */
#define PTA_BASE (0xFFFC1700u)
/** Peripheral PTA base pointer */
#define PTA ((GPIO_Type *)PTA_BASE)
/** Peripheral PTB base address */
#define PTB_BASE (0xFFFC1702u)
/** Peripheral PTB base pointer */
#define PTB ((GPIO_Type *)PTB_BASE)
……
……
#define PTP_BASE (0xFFFC171Eu)
/** Peripheral PTP base pointer */
#define PTP ((GPIO_Type *)PTP_BASE)
/** Peripheral PTQ base address */
#define PTQ_BASE (0xFFFC1720u)
/** Peripheral PTQ base pointer */
#define PTQ ((GPIO_Type *)PTQ_BASE)
GPIO的设置方法:
// 0:ON 1:OFF
PINS_DRV_TogglePins(PORT, (0 << LED3 ));
PINS_DRV_TogglePins(PORT, (