void initGPIO(int nGpio, int modulo, int direction){ switch(modulo){ case MODULO_0: GPIO0_ModuleClkConfig(); modulo0(nGpio); break; case MODULO_1: GPIO1_ModuleClkConfig(); modulo1(nGpio); break; case MODULO_2: GPIO2_ModuleClkConfig(); modulo2(nGpio); break; case MODULO_3: GPIO3_ModuleClkConfig(); modulo3(nGpio); break; } /* Enabling the GPIO module. */ GPIOModuleEnable(GPIO_INSTANCE_ADDRESS(modulo)); /* Resetting the GPIO module. */ //GPIOModuleReset(GPIO_INSTANCE_ADDRESS(modulo)); /* Setting the GPIO pin as an output pin. */ GPIODirModeSet(GPIO_INSTANCE_ADDRESS(modulo), GPIO_INSTANCE_PIN_NUMBER(nGpio), direction); }
/*FUNCTION*------------------------------------------------------- * * Function Name : ledInit * Comments : *END*-----------------------------------------------------------*/ int ledInit(){ /* Enabling functional clocks for GPIO1 instance. */ GPIO1_ModuleClkConfig(); /* Selecting GPIO1[23] pin for use. */ /*GPIOPinMuxSetup(CONTROL_CONF_GPMC_A(7), CONTROL_CONF_MUXMODE(7));*/ GetGPIOPinName(); /* Enabling the GPIO module. */ GPIOModuleEnable(GPIO_INSTANCE_ADDRESS); /* Resetting the GPIO module. */ GPIOModuleReset(GPIO_INSTANCE_ADDRESS); /* Setting the GPIO pin as an output pin. */ GPIODirModeSet(GPIO_INSTANCE_ADDRESS, GPIO_INSTANCE_PIN_NUMBER, DIR_OUTPUT); return(0); }