Could you please provide more information on your request? Let us know the sequence of steps, when will you scan the sensors and when you will do the ADC conversion?
The Capsense and ADC operation in controlled by the CSD sequencer and the ADC sequencer. The ADC sequencer cannot be started unless the CSD sequencer has entered the normal sample state or is idle (ie after coarse and fine initialization of the sensors). You may have to take care of this.
You can also refer to the below code example where they have used Capsense and ADC together.
sorry for the late response.
Following is the example in pseudo-code of my approach.
== TIMER 2 ms INTERRUPT HANDLER BEGIN ==
// should not be busy - previous sampling not terminated
widgetIdx = (widgetIdx+1)%WIDGET_NUM;
// other stuff
CapSense_AdcStartConvert(0); // blocking conversion of adc channel 0
CapSense_AdcStartConvert(1); // blocking conversion of adc channel 1
CapSense_Scan(widgetIdx); // scan of single button (of index widgetIdx)
== TIMER 2 ms INTERRUPT HANDLER END ==
How can I achieve the scan of a single button thourhg the CapSense_ADC
Thanks for your time.
Il 27/02/2019 10:43 BragadeeshV_41 ha scritto:
CYPRESS DEVELOPER COMMUNITY
CY8C4024AZI-S413 QUESTION ABOUT CAPSENSE/ADC
reply from BragadeeshV_41 in PSoC 4 MCU Community - View the
Thanks for the update.
I assume that you want to complete this entire process in 2 mS.
If all those buttons are similar with respect to hardware settings, you could put all of them in one particular widget and perform a scan either using CapSense_SetupWidget(WidgetID) and CapSense_Scan() together or simply CapSense_ScanAllWidgets(). You can measure the approx time it takes for scanning using a timer. This method will scan faster.
But if it is okay for your application to scan only sensor in every interrupt trigger, then you can connect each of the sensor to a separate widget and use CapSense_SetupWidget(WidgetID) and CapSense_Scan() together. You can vary the WidgetID to scan the other sensors.
There is a third option to scan a particular sensor, (ie) CapSense_CSDSetupWidgetExt (uint32 widgetId, uint32 sensorId). This will connect the sensor to the AMUX bus, you need to call CapSense_CSDScanExt() to start the scanning process.
Also, it is best practice to not have any application code in your ISR. Please implement something like below:
flag = 1;
//Your application goes here
Please let me know if anything wasn't clear.
thanks for all the info. I'll close the thread.