Hi,
I am trying to read sensor value using the sensor controller. The sensor enable pin is pull up. And can be enabled when GPIO is "Output"-"Low" and disabled when changed to "Input" mode. It works once and then the GPIO pin is in "Input" mode - it is not changing to "Output" in the next execution cycle.
Below is the code. Please guide.
gpioCfgMode(AUXIO_O_SENSOR_EN_PIN, GPIO_MODE_OUTPUT); gpioClearOutput(AUXIO_O_SENSOR_EN_PIN); fwDelayUs(20); adcSelectGpioInput(AUXIO_A_SENSOR_OUTPUT); adcEnableSync(ADC_REF_FIXED, ADC_SAMPLE_TIME_2P7_US, ADC_TRIGGER_MANUAL); // Sample the sensor S16 adcValue = 0; adcGenManualTrigger(); adcReadFifo(adcValue); output.mwVoltage=adcValue; // Disable the ADC adcFlushFifo(); adcDisable(); gpioCfgMode(AUXIO_O_SENSOR_EN_PIN,GPIO_MODE_INPUT); fwDelayUs(20); gpioDisableInputBuf(AUXIO_O_SENSOR_EN_PIN); // Schedule the next execution fwScheduleTask(1);
Regards,
BD