void GpioModuleEnable(unsigned int module_addr) { /* Enabling the GPIO module. */ GPIOModuleEnable(module_addr); /* Resetting the GPIO module. */ GPIOModuleReset(module_addr); }
void gpioLedInit() { /* Enabling the GPIO module. */ GPIOModuleEnable(GPIO_INSTANCE_ADDRESS); /* Perform a module reset of the GPIO module. */ GPIOModuleReset(GPIO_INSTANCE_ADDRESS); /* Set the specified pin as an output pin. */ GPIODirModeSet(GPIO_INSTANCE_ADDRESS, GPIO_INSTANCE_PIN_NUMBER, GPIO_DIR_OUTPUT); }
void gpioInit(void) { // enable clock for gpio 0,1,2 GPIO0ModuleClkConfig(); GPIO1ModuleClkConfig(); GPIO2ModuleClkConfig(); // select gpio pins for use gpioPinMux(); /* Enabling the GPIO module. */ GPIOModuleEnable(GPIO_BASE1); GPIOModuleEnable(GPIO_BASE0); GPIOModuleEnable(GPIO_BASE2); /* Resetting the GPIO module. */ GPIOModuleReset(GPIO_BASE0); GPIOModuleReset(GPIO_BASE1); GPIOModuleReset(GPIO_BASE2); // set directions for the gpio pins in use gpioDirModeSet(); }
/*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); }
int main(void) { /* unsigned int count = 0; */ /* Configuring the functional clock for GPIO0 instance. */ GPIO0ModuleClkConfig(); /* Doing a pin multiplexing and selecting GPIO0[7] for use. */ GPIO0Pin7PinMuxSetup(); /* Enabling the GPIO module. */ GPIOModuleEnable(SOC_GPIO_0_REGS); /* Resetting the GPIO module. */ GPIOModuleReset(SOC_GPIO_0_REGS); /* Configuring GPIO0[7] pin as an output pin. */ GPIODirModeSet(SOC_GPIO_0_REGS, GPIO_INSTANCE_PIN_NUMBER, GPIO_DIR_OUTPUT); while(1) { /* Driving GPIO0[7] pin to logic HIGH. */ GPIOPinWrite(SOC_GPIO_0_REGS, GPIO_INSTANCE_PIN_NUMBER, GPIO_PIN_HIGH); Delay(0xFFFFF); /* Driving GPIO0[7] pin to logic LOW. */ GPIOPinWrite(SOC_GPIO_0_REGS, GPIO_INSTANCE_PIN_NUMBER, GPIO_PIN_LOW); Delay(0xFFFFF); } }