Hi, Daniel,
Regarding the GPIO pin, each GPIO port is given an index,the GPIOA is defined as 0, GPIOB is defined as 1, GPIOC is defined as 2, GPIOD is defined as 3..., for the code, kGpioLED1 = GPIO_MAKE_PIN(GPIOE_IDX, 31u), , pls refer to the file fsl_gpio_driver.h, which is located at:
C:\DriverE\Freescale\KSDK_1.3.0\platform\drivers\inc
/*! @brief Indicates the end of a pin configuration structure.*/
#define GPIO_PINS_OUT_OF_RANGE (0xFFFFFFFFU)
/*! @brief Bits shifted for the GPIO port number. */
#define GPIO_PORT_SHIFT (0x8U)
/*! @brief Combines the port number and the pin number into a single scalar value. */
#define GPIO_MAKE_PIN(r,p) (((r)<< GPIO_PORT_SHIFT) | (p))
/*! @brief Extracts the port number from a combined port and pin value.*/
#define GPIO_EXTRACT_PORT(v) (((v) >> GPIO_PORT_SHIFT) & 0xFFU)
/*! @brief Extracts the pin number from a combined port and pin value.*/
#define GPIO_EXTRACT_PIN(v) ((v) & 0xFFU)
In other words, GPIO pin number is defined as a 16 bits word(byte1,byte0 ), the byte0 is the pin index which ranges from 0 to 31, the byte1 is the GPIO port index, GPIOA is 0, GPIOB is 1, GPIOC is 2..., In the fsl_gpio_driver.c which is located at:C:\DriverE\Freescale\KSDK_1.3.0\platform\drivers\src, you can find the code:
void GPIO_DRV_SetPinDir(uint32_t pinName, gpio_pin_direction_t direction)
{
GPIO_Type * gpioBase = g_gpioBase[GPIO_EXTRACT_PORT(pinName)];
uint32_t pin = GPIO_EXTRACT_PIN(pinName);
GPIO_HAL_SetPinDir(gpioBase, pin, direction);
}
Hope it can help you.
BTW, I suggest you use SDK2.0, which use totally different structure for GPIO.
BR
Xiangjun Rong