Esempio n. 1
0
/*FUNCTION*-------------------------------------------------------
*
* Function Name : ledToggle
* Comments      :
*END*-----------------------------------------------------------*/
void ledToggle(int nGpio, int GPIOModule){
    
    flagToggle^=TOGGLE;

    if(flagToggle){
        /* Driving a logic HIGH on the GPIO pin. */
        GPIOPinWrite(GPIO_INSTANCE_ADDRESS(GPIOModule),
                GPIO_INSTANCE_PIN_NUMBER(nGpio),
                PIN_HIGH);
    }else{
         /* Driving a logic LOW on the GPIO pin. */
        GPIOPinWrite(GPIO_INSTANCE_ADDRESS(GPIOModule),
                GPIO_INSTANCE_PIN_NUMBER(nGpio),
                PIN_LOW);
    }
}
Esempio n. 2
0
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);
}