- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
I use CapSense function and create 23 CSD button.
When I press a button. Which API function can let me know which key is pressed ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi ChHs_4614611,
MoTa_728816-san, thanks for your input. i would like to add the following points.
1. We recommend using the latest version of CapSense v6.0 or higher for newer applications since it has better calibration routines and firmware fixes.
2. While checking the widget status if active or not, it is always recommended to do it after processing the widgets. Therefore the flow would be :
CapSense_Start();
CapSense_ScanAllWidgets();
for(;;)
{
if (!CapSense_IsBusy())
{
CapSense_ProcessAllWidgets(); // Same as CapSense_UpdateEnabledBaselines() in older component
check_push_button() ; //Your application to check button status using CapSense_IsWidgetActive(Widget_ID).
#if USE_TUNER
CapSense_RunTuner() ; // Same as CapSense_TunerComm() in older component
#endif
CapSense_ScanAllWidgets(); //Same as CapSense_ScanEnabledWidgets in older component
}
}
It is also possible to assign all the buttons to a single widget (if the parasitic capacitance of all the buttons are similar, since you will be able to set only one hardware parameters for all the sensors in a widget). In that case you can use CapSense_IsSensorActive(WidgetID, SensorID) to check if the sensor in that widget is on or off.
Please go through the capsense component datasheet for detailed information on these APIs.
https://www.cypress.com/documentation/component-datasheets/psoc-4-capacitive-sensing-capsense
Hope this helps!
Regards,
Bragadeesh
Bragadeesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I think that you need check each widget after CapSense_IsBusy() goes to 0.
(Note: I may be wrong)
I made a test sample with CY8CKIT-044 with schematic
the main loop is
===================
int main(void)
{
init_hardware() ;
for(;;) {
if (!CapSense_IsBusy()) {
check_push_button() ;
#if USE_TUNER
CapSense_TunerComm() ;
#endif
CapSense_UpdateEnabledBaselines() ;
CapSense_ScanEnabledWidgets() ;
}
if (sec_flag) {
#if USE_UART
dump_push_button() ;
#endif
sec_flag = 0 ;
}
}
}
===================
define of push_button_ids
===================
#define NUM_PUSH_BUTTON 23
uint8_t push_button_id[NUM_PUSH_BUTTON] = {
CapSense_BUTTON01__BTN,
CapSense_BUTTON02__BTN,
CapSense_BUTTON03__BTN,
CapSense_BUTTON04__BTN,
CapSense_BUTTON05__BTN,
CapSense_BUTTON06__BTN,
CapSense_BUTTON07__BTN,
CapSense_BUTTON08__BTN,
CapSense_BUTTON09__BTN,
CapSense_BUTTON10__BTN,
CapSense_BUTTON11__BTN,
CapSense_BUTTON12__BTN,
CapSense_BUTTON13__BTN,
CapSense_BUTTON14__BTN,
CapSense_BUTTON15__BTN,
CapSense_BUTTON16__BTN,
CapSense_BUTTON17__BTN,
CapSense_BUTTON18__BTN,
CapSense_BUTTON19__BTN,
CapSense_BUTTON20__BTN,
CapSense_BUTTON21__BTN,
CapSense_BUTTON22__BTN,
CapSense_BUTTON23__BTN
} ;
===================
check_push_button() is
===================
uint16_t check_push_button(void)
{
uint16_t num_pushed = 0 ;
int i ;
for (i = 0 ; i < NUM_PUSH_BUTTON ; i++ ) {
if (CapSense_CheckIsWidgetActive(push_button_id)) { // <--- checking each widget here
push_button = 1 ;
num_pushed++ ;
} else {
push_button = 0 ;
}
}
return(num_pushed) ;
}
===================
Tera Term Log
(Note: I have not assigned widget button seriously... only auto assigned...)
I hope that this can be a little hint for you.
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Motoo Tanaka,
Your sample is very useful for me.
Thank you for your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi ChHs_4614611,
MoTa_728816-san, thanks for your input. i would like to add the following points.
1. We recommend using the latest version of CapSense v6.0 or higher for newer applications since it has better calibration routines and firmware fixes.
2. While checking the widget status if active or not, it is always recommended to do it after processing the widgets. Therefore the flow would be :
CapSense_Start();
CapSense_ScanAllWidgets();
for(;;)
{
if (!CapSense_IsBusy())
{
CapSense_ProcessAllWidgets(); // Same as CapSense_UpdateEnabledBaselines() in older component
check_push_button() ; //Your application to check button status using CapSense_IsWidgetActive(Widget_ID).
#if USE_TUNER
CapSense_RunTuner() ; // Same as CapSense_TunerComm() in older component
#endif
CapSense_ScanAllWidgets(); //Same as CapSense_ScanEnabledWidgets in older component
}
}
It is also possible to assign all the buttons to a single widget (if the parasitic capacitance of all the buttons are similar, since you will be able to set only one hardware parameters for all the sensors in a widget). In that case you can use CapSense_IsSensorActive(WidgetID, SensorID) to check if the sensor in that widget is on or off.
Please go through the capsense component datasheet for detailed information on these APIs.
https://www.cypress.com/documentation/component-datasheets/psoc-4-capacitive-sensing-capsense
Hope this helps!
Regards,
Bragadeesh
Bragadeesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for the Bragadeesh-san's suggestion,
I could manage to utilize CapSense (V7.0) for my previous sample!
One thing I noticed was, the Tuner.
With CapSense CSD (v2.60) The tuner showed all buttons
But with CapSense (v7.0) I needed to scroll to see all 23 buttons.
(May be I'm missing something again...)
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi MoTa_728816,
It is just the GUI that is developed like that for the newer components. We will create an enhancement request for this and will be updated based on priority.
Thanks for your continued interest with Cypress products
Regards,
Bragadeesh
Bragadeesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi BragadeeshV_41,
Cypress MCU is used for the first time in our company. So, I have some question~^^
The below photo is our new desgin HMI for vehicle.
I have a question for Touch Key sensitivity.
Now I no touch ,my finger just near touch key it already trigger.
How to adjust Touch Key sensitivity?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi ChHs_4614611,
Reduce the resolution of the widget to reduce the sensitivity of the button. But make sure the SNR > 5 :1
Regards,
Bragadeesh
Bragadeesh