Hello !!
This is code that i wrote to read the state of switches. I would add it to the facedetect program :
/**
* \file switches.c
*
* \ this file is to call functions when the switches are selected
when the switch 1 is selected we call the horizontal flip function from the cxcore header file
when the switch 2 is selected we call the vertical flip function from the cxcore header file
when the switch 3 is selected we call the horizontal and the vertical function from the cxcore file
*/
#include "gpio.h"
#include "psc.h"
#include "soc_C6748.h"
#include "lcdkC6748.h"
/****************************************************************************/
/* LOCAL FUNCTION PROTOTYPES */
/****************************************************************************/
/****************************************************************************/
/* GLOBAL VARIABLES */
/****************************************************************************/
/****************************************************************************/
/* LOCAL FUNCTION DEFINITIONS */
/****************************************************************************/
int main(void)
{
/* The Local PSC number for GPIO is 3. GPIO belongs to PSC1 module.*/
PSCModuleControl(SOC_PSC_1_REGS, HW_PSC_GPIO, PSC_POWERDOMAIN_ALWAYS_ON, // I don't know how to modify this
PSC_MDCTL_NEXT_ENABLE);
/* Sets the pin 0,1,2,3 and for of GPIO0 as input.*/
GPIODirModeSet(SOC_GPIO_0_REGS, 1, GPIO_DIR_OUTPUT);
GPIODirModeSet(SOC_GPIO_0_REGS, 2, GPIO_DIR_OUTPUT);
GPIODirModeSet(SOC_GPIO_0_REGS, 3, GPIO_DIR_OUTPUT);
while(1)
{
int state_switch_1 =GPIOPinRead(unsigned int baseAdd, 1) // // to read the value of the pin 1 Bank 0
int state_switch_2 =GPIOPinRead(unsigned int baseAdd, 2) // // to read the value of the pin 1 Bank 0
int state_switch_3 =GPIOPinRead(unsigned int baseAdd, 3) // // to read the value of the pin 1 Bank 0
int state_switch_4 =GPIOPinRead(unsigned int baseAdd, 4) // // to read the value of the pin 1 Bank 0
if (state_switch_1==GPIO_PIN_HIGH)
{
// Call the horizontal flip function
}
else if(state_switch_2==GPIO_PIN_HIGH)
{
// call the vertical flip function
}
else (state_switch_3==GPIO_PIN_HIGH)
{
// call the horizontal an d the vertical flip function
}
}
}
It seem correct ?. I dont know how to get baseAdd of each pin.?
Regards
Mus