-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcy_capsense.h
1666 lines (1652 loc) · 69.9 KB
/
cy_capsense.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/***************************************************************************//**
* \file cy_capsense.h
* \version 6.10.0
*
* \brief
* This file includes all the header files of the CAPSENSE™ middleware.
*
********************************************************************************
* \copyright
* Copyright 2018-2025, Cypress Semiconductor Corporation (an Infineon company)
* or an affiliate of Cypress Semiconductor Corporation. All rights reserved.
* You may use this file only in accordance with the license, terms, conditions,
* disclaimers, and limitations in the end user license agreement accompanying
* the software package with which this file was provided.
*******************************************************************************/
/**
********************************************************************************
* \mainpage
********************************************************************************
* CAPSENSE™ is a CYPRESS™ capacitive sensing solution from
* Infineon. Capacitive sensing can be used in a variety of applications
* and products where conventional mechanical buttons can be replaced with
* sleek human interfaces to transform the way users interact with electronic
* systems. These include home appliances, and automotive, IoT, and
* industrial applications. CAPSENSE™ supports multiple interfaces
* (widgets) using CSD, CSX, and ISX sensing methods with robust performance.
*
* CAPSENSE™ has become a popular technology to replace conventional
* mechanical- and optical-based user interfaces. There are fewer parts
* involved, which saves cost and increases reliability with no wear-and-tear.
* The main advantages of CAPSENSE™ compared with other solutions are:
* robust performance in harsh environmental conditions and rejection of a
* wide range of external noise sources.
*
* Use CAPSENSE™ for:
* * Touch and gesture detection for various interfaces
* * Proximity detection for innovative user experiences and low power
* optimization
* * Contactless liquid-level sensing in a variety of applications
* * Touch-free operations in hazardous materials
*
********************************************************************************
* \section section_capsense_general General Description
********************************************************************************
*
* The CAPSENSE™ middleware Library supports operation with fourth-generation,
* fifth-generation and fifth-generation low power of CAPSENSE™ HW.
* CAPSENSE™ HW enables the multiple sensing
* capabilities on PSOC™ devices including the Self-Capacitance (CSD) and Mutual-Capacitance (CSX)
* capacitive touch sensing solutions, inductive sensing (ISX), impedance measurement, and
* other features.
*
* Middleware access available the CAPSENSE™ HW block through the corresponding
* peripheral Driver:
* - CSD (CAPSENSE™ Sigma-Delta) driver for the forth-generation of the
* CAPSENSE™ HW;
* - MSC (Multi-Sensor Converter) driver for the fifth-generation of the
* CAPSENSE™ HW;
* - MSCLP (Multi-Sensor Converter Low Power) driver for the fifth-generation of the
* CAPSENSE™ HW;
*
* The CAPSENSE™ peripheral driver does not provide any system-level functions.
* It only implements the interface to the CAPSENSE™ HW resource.
*
* The supported CAPSENSE™ HW blocks can perform only one function at a time.
* However, all supported functionality (like CAPSENSE™, CSDADC, etc.) can be
* time-multiplexed in a design. I.e. you can save the existing state of
* the CAPSENSE™ middleware, restore the state of the CSDADC middleware, perform
* CSDADC measurements, and then switch back to the CAPSENSE™ functionality.
* For details and code examples, refer to the description of the
* Cy_CapSense_Save() and Cy_CapSense_Restore() functions.
*
* \image html CAPSENSE_SOLUTION_MSCLP.png "CAPSENSE™ Solution" width=800px
* \image latex CAPSENSE_SOLUTION_MSCLP.png
*
* This section describes only the CAPSENSE™ middleware. Refer to the corresponding
* sections of documentation for other middleware supported by the CAPSENSE™ HW.
*
* A CAPSENSE™ solution includes:
* * The CAPSENSE™ Configurator tool to create
* and configure CAPSENSE™ widgets. It can be launched in ModusToolbox™
* from the CAPSENSE™ superblock personality and in Stand-alone mode.
* It contains a separate document about how to create and
* configure widgets, parameters and algorithm descriptions.
* * API to control the design from the application program. This documentation
* describes API with code snippets of how to use them.
* * The CAPSENSE™ Tuner tool for real-time tuning, testing, and debugging,
* for easy and smooth designing of human interfaces on customer products.
* The Tuner tool communicates with a device through a HW bridge and
* communication drivers (EzI2C, UART, etc.) and allows to monitor
* widget statuses, sensor signals, detected touch positions, gestures, etc.
* The application program does not need to interact with the CSD driver
* and/or other drivers such as GPIO, SysClk directly. All of that is
* configured and managed by middleware.
*
* Include cy_capsense.h to get access to all functions and other declarations
* in this library. If you are using the ModusToolbox™ CAPSENSE™ Configurator tool,
* you can include cycfg_capsense.h only.
*
* \subsection subsection_capsense_features Features
*
* * Offers best-in-class signal-to-noise ratio (SNR)
* * Supports Self-Capacitance (CSD) and Mutual-Capacitance (CSX) sensing methods
* * Inductive sensing method (ISX) available for fifth-generation low power CAPSENSE™
* * Fifth-generation low power CAPSENSE™ supports autonomous scanning in Deep Sleep
* power mode
* * Supports various Widgets, such as Buttons, Matrix Buttons, Sliders,
* Touchpads, and Proximity Sensors
* * Provides ultra-low power consumption capacitive
* sensing technology
* * Contains the integrated graphical CAPSENSE™ Tuner tool for real-time tuning,
* testing, and debugging
* * Provides superior immunity against external noise and low-radiated
* emission
* * Offers best-in-class liquid tolerance
* * Supports one-finger and two-finger gestures
*
********************************************************************************
* \section group_capsense_quick_start Quick Start Guide
********************************************************************************
*
* The quickest way to get started with CAPSENSE™ is using code examples.
* Infineon Technologies continuously extends their portfolio of code examples
* at the <a href="http:/\/www.infineon.com"><b>Infineon Technologies</b></a>
* and at the <a href="https:/\/github.com/Infineon">
* <b> Infineon Technologies GitHub</b></a>. The following are the links
* to code examples for different PSOC™ families presented on GitHub.
*
* \subsection group_capsense_quick_start_psoc4_csd_ces Code Examples for PSOC™ 4 Devices with fourth-generation CAPSENSE™
*
* * <a href="https:/\/github.com/Infineon/mtb-example-psoc4-capsense-csd-button-tuning">
* <b>CSD Button Manual Tuning</b></a>
*
* * <a href="https:/\/github.com/Infineon/mtb-example-psoc4-capsense-csx-button-tuning">
* <b>CSX Button Manual Tuning</b></a>
*
* * <a href="https:/\/github.com/Infineon/mtb-example-psoc4-capsense-csd-slider-tuning">
* <b>CSD Slider Manual Tuning</b></a>
*
* \subsection group_capsense_quick_start_psoc4_msc_ces Code Examples for PSOC™ 4 Devices with fifth-generation CAPSENSE™
*
* * <a href="https:/\/github.com/Infineon/mtb-example-psoc4-msc-capsense-csd-button-tuning">
* <b>CSD Button Manual Tuning</b></a>
*
* * <a href="https:/\/github.com/Infineon/mtb-example-psoc4-msc-capsense-csx-button-tuning">
* <b>CSX Button Manual Tuning</b></a>
*
* * <a href="https:/\/github.com/Infineon/mtb-example-psoc4-msc-capsense-csd-slider-tuning">
* <b>CSD Slider Manual Tuning</b></a>
*
* * <a href="https:/\/github.com/Infineon/mtb-example-psoc4-msc-capsense-csd-touchpad-tuning">
* <b>CSD Touchpad Manual Tuning</b></a>
*
* * <a href="https:/\/github.com/Infineon/mtb-example-psoc4-msc-capsense-csx-touchpad-tuning">
* <b>CSX Touchpad Manual Tuning</b></a>
*
* \subsection group_capsense_quick_start_psoc4_msclp_ces Code Examples for PSOC™ 4 Devices with fifth-generation low power CAPSENSE™
*
* * <a href="https:/\/github.com/Infineon/mtb-example-psoc4-msclp-capsense-low-power">
* <b>MSCLP CAPSENSE™ low power</b></a>
*
* * <a href="https:/\/github.com/Infineon/mtb-example-psoc4-msclp-low-power-csd-button">
* <b>MSCLP low-power self-capacitance button</b></a>
*
* * <a href="https:/\/github.com/Infineon/mtb-example-psoc4-msclp-low-power-csx-slider">
* <b>MSCLP low-power mutual-capacitance slider</b></a>
*
* * <a href="https:/\/github.com/Infineon/mtb-example-psoc4-msclp-liquid-tolerant-proximity">
* <b>MSCLP CAPSENSE™ liquid-tolerant proximity-sensing</b></a>
*
* * <a href="https:/\/github.com/Infineon/mtb-example-psoc4-msclp-csx-touchpad">
* <b>MSCLP multitouch mutual-capacitance touchpad tuning</b></a>
*
* \subsection group_capsense_quick_start_psoc6_csd_ces Code Examples for PSOC™ 6 Devices with fourth-generation CAPSENSE™
*
* * <a href="https:/\/github.com/Infineon/mtb-example-psoc6-capsense-buttons-slider">
* <b>Two Buttons and Slider with CAPSENSE™ Tuner</b></a>
*
* * <a href="https:/\/github.com/Infineon/mtb-example-psoc6-low-power-capsense-freertos">
* <b>low power Slider and Ganged Sensors with FreeRTOS</b></a>
*
* * <a href="https:/\/github.com/Infineon/mtb-example-psoc6-capsense-custom-scan">
* <b>Custom Scan</b></a>
*
* * <a href="https:/\/github.com/Infineon/mtb-example-psoc6-ble-capsense-tuner-client">
* <b>BLE Client for CAPSENSE™ Tuning</b></a>
*
* * <a href="https:/\/github.com/Infineon/mtb-example-psoc6-ble-capsense-tuner-server">
* <b>BLE Server for CAPSENSE™ Tuning</b></a>
*
* The CAPSENSE™ middleware can be used in various development environments
* such as ModusToolbox™, MBED, etc. Refer to the \ref section_capsense_toolchain.
* The following are the configuration considerations for the different environments.
*
* \subsection group_capsense_quick_start_modus ModusToolbox™ Configuration Considerations
*
* This quick start guide assumes that the environment is configured:
* * The <a href="https:/\/github.com/Infineon/mtb-pdl-cat1">
* <b>CAT1 Peripheral Driver Library (PDL)</b></a> is included in the project
* in case if the PSOC™ 6 device is used.
* * The <a href="https:/\/github.com/Infineon/mtb-pdl-cat2">
* <b>CAT2 Peripheral Driver Library (PDL)</b></a> is included in the project
* in case if the PSOC™ 4 device is used.
* * <a href="https:/\/www.infineon.com/ModusToolboxDeviceConfig">
* <b>ModusToolbox™ Device Configurator Tool</b></a>,
* <a href="https:/\/www.infineon.com/ModusToolboxCapSenseConfig">
* <b>ModusToolbox™ CAPSENSE™ Configurator Tool</b></a>, and
* <a href="https:/\/www.infineon.com/ModusToolboxCapSenseTuner">
* <b>ModusToolbox™ CAPSENSE™ Tuner Tool</b></a>
* are installed on the machine.
*
* \note
* Ensure to set up the device power voltages correctly
* to the proper operation of the device power domains. The Setup is
* on the System Tab of the Device Configurator tool. Enable the Power check box
* and set up the voltages as they are red-outlined in the picture below.
*
* \image html check_power.png "Power Setup" width=800px
* \image latex check_power.png
*
* \subsection group_capsense_quick_start_mbed MBED OS Configuration Considerations
*
* You can immediately start with the following MBED OS code example available
* at the <a href="https:/\/github.com/Infineon/">
* <b> Infineon GitHub</b></a>:
* * <a href="https:/\/github.com/Infineon/mbed-os-example-capsense">
* <b>CAPSENSE™ buttons and slider for PSOC™ 6 MCU with Mbed OS</b></a>
*
* If you are doing your own project, remember to include cycfg.h file:
* \snippet capsense/snippet/main.c snippet_Cy_CapSense_Resource_Include
*
* and call the resource initialization functions in main() at the beginning:
* \snippet capsense/snippet/main.c snippet_Cy_CapSense_Resource_Initialization
*
********************************************************************************
* \section section_capsense_configuration Summary of Application Programming Interface (API)
********************************************************************************
*
* The CAPSENSE™ middleware operates on the top of the MSCLP/MSC/CSD HW driver.
* Refer to the PDL API Reference Manual.
*
* This document provides descriptions of the functions in the CAPSENSE™
* middleware library, and descriptions of the data structures (register map)
* used by the middleware library.
*
* The Application Programming Interface (API) routines allow controlling and
* executing specific tasks using the CAPSENSE™ middleware. The CAPSENSE™ API
* is described in the following sections:
* * \ref group_capsense_high_level
* * \ref group_capsense_low_level
* * \ref group_capsense_data_structure
* * \ref group_capsense_enums
* * \ref group_capsense_macros
* * \ref group_capsense_callbacks
*
********************************************************************************
* \section section_capsense_toolchain Supported Software and Tools
********************************************************************************
*
* This version of the CAPSENSE™ middleware was validated for compatibility
* with the following Software and Tools:
* <table class="doxtable">
* <tr>
* <th>Software and Tools</th>
* <th>Version</th>
* </tr>
* <tr>
* <td>ModusToolbox™ Software Environment</td>
* <td>3.4.0</td>
* </tr>
* <tr>
* <td>- ModusToolbox™ Device Configurator tool</td>
* <td>5.20</td>
* </tr>
* <tr>
* <td>- ModusToolbox™ MSC Superblock Personality for PSOC™ 4 devices in the Device Configurator tool</td>
* <td>1.0</td>
* </tr>
* <tr>
* <td>- ModusToolbox™ MSCLP Personality for PSOC™ 4 devices in the Device Configurator tool</td>
* <td>3.0</td>
* </tr>
* <tr>
* <td>- ModusToolbox™ MSC Personality for PSOC™ 4 devices in the Device Configurator tool</td>
* <td>1.1</td>
* </tr>
* <tr>
* <td>- ModusToolbox™ CSD Personality for PSOC™ 4 devices in the Device Configurator tool</td>
* <td>2.0</td>
* </tr>
* <tr>
* <td>- ModusToolbox™ CSD Personality for PSOC™ 6 devices in the Device Configurator tool</td>
* <td>3.0</td>
* </tr>
* <tr>
* <td>- ModusToolbox™ CAPSENSE™ Configurator tool</td>
* <td>7.10.0</td>
* </tr>
* <tr>
* <td>- ModusToolbox™ CAPSENSE™ Tuner tool</td>
* <td>7.10.0</td>
* </tr>
* <tr>
* <td>CAT1 Peripheral Driver Library (PDL)</td>
* <td>3.14.0</td>
* </tr>
* <tr>
* <td>CAT2 Peripheral Driver Library (PDL)</td>
* <td>2.15.0</td>
* </tr>
* <tr>
* <td>GCC Compiler</td>
* <td>11.3.1</td>
* </tr>
* <tr>
* <td>IAR Compiler</td>
* <td>9.50.2</td>
* </tr>
* <tr>
* <td>Arm Compiler 6 <sup><b>(Note 1)</b></sup></td>
* <td>6.22.0</td>
* </tr>
* <tr>
* <td>MBED OS (only for PSOC™ 6)</td>
* <td>5.15.8</td>
* </tr>
* </table>
*
* \note
* The CAPSENSE™ middleware includes the pre-compiled libraries for
* Arm Compiler 6. They are built with the following options to be compatible
* with ModusToolbox™ and MBED:
* * -fshort-enums - Set the size of an enumeration type to the smallest
* data type that can hold all enumerator values
* * -fshort-wchar - Set the size of wchar_t to 2 bytes
* \note
* To operate in custom environments with Arm Compiler 6, apply
* the above mentioned build options.
*
********************************************************************************
* \section section_capsense_update Update to Newer Versions
********************************************************************************
* Refer to the \ref section_capsense_changelog to learn about the design impact
* of the newer version. Set up your environment in accordance with
* \ref section_capsense_toolchain.
*
* Ensure:
* * The specified version of the ModusToolbox™ Device Configurator tool and
* the Personality are used to re-generate the device configuration.
* * The specified version of the ModusToolbox™ CAPSENSE™ Configurator tool is used
* to re-generate the middleware configuration.
* * The toolchains are set up properly for your environment per the settings
* outlined in the Supported Software and Tools.
* * The project is re-built once the toolchains are configured and the
* configuration is completed.
*
* You might need to re-generate the configuration structures for either the
* device initialization code or the middleware initialization code.
* * Launch the ModusToolbox™ Device Configurator tool and perform the File->Save command
* to re-generate the device initialization code.
* * From the ModusToolbox™ Device Configurator tool, launch the
* ModusToolbox™ CAPSENSE™ Configurator tool and perform the File->Save command to
* re-generate the middleware initialization code.
*
********************************************************************************
* \section section_capsense_memory_usage Memory Usage
********************************************************************************
*
* The CAPSENSE™ middleware Flash and RAM memory consumption varies:
* * marginally - depending on the compiler and device
* * significantly - depending on the project CAPSENSE™ configuration and
* number of APIs called by the application program.
*
* The table below provides the middleware total memory consumption for
* specific CAPSENSE™ configurations. Memory consumption for any custom
* design/configuration can be determined by analyzing a *.map file
* generated by the compiler.
*
* The measurements were done with GCC compiler configured in
* the Release mode with optimization set for Size.
*
* <table class="doxtable">
* <tr><th>Configuration:</th><th>Mode</th><th>Sensor Connection Type</th><th>Memory Type</th><th>Configuration 1</th><th>Configuration 2</th><th>Configuration 3</th><th>Configuration 4</th><th>Configuration 5</th><th>Configuration 6</th><th>Configuration 7</th><th>Configuration 8</th><th>Configuration 9</th></tr>
* <tr align="center"><td rowspan=2>4th Gen</td><td rowspan=2>IntDrv</td><td rowspan=2>AMUX</td><td>Flash:</td><td>< 6.1 kB</td><td>< 8.7 kB</td><td>< 11.8 kB</td><td>< 5.6 kB</td><td>< 6.3 kB</td><td>< 8.0 kB</td><td>< 9.2 kB</td><td>< 9.6 kB</td><td>< 19.2 kB</td></tr>
* <tr align="center"><td>SRAM:</td><td>< 0.6 kB</td><td>< 0.8 kB</td><td>< 0.9 kB</td><td>< 0.8 kB</td><td>< 0.8 kB</td><td>< 1.1 kB</td><td>< 1.8 kB</td><td>< 0.7 kB</td><td>< 2.5 kB</td></tr>
* <tr align="center"><td rowspan=6>5th Gen</td><td rowspan=4>IntDrv</td><td rowspan=2>AMUX</td><td>Flash:</td><td>< 8.2 kB</td><td>< 11.0 kB</td><td>< 12.4 kB</td><td>< 8.2 kB</td><td>< 9.6 kB</td><td>< 10.7 kB</td><td>< 11.8 kB</td><td>< 12.6 kB</td><td>< 16.3 kB</td></tr>
* <tr align="center"><td>SRAM:</td><td>< 1.1 kB</td><td>< 1.2 kB</td><td>< 1.3 kB</td><td>< 1.3 kB</td><td>< 1.3 kB</td><td>< 1.7 kB</td><td>< 2.3 kB</td><td>< 1.7 kB</td><td>< 3.3 kB</td></tr>
* <tr align="center"><td rowspan=2>CTRL_MUX</td><td>Flash:</td><td>< 7.9 kB</td><td>< 10.9 kB</td><td>< 12.0 kB</td><td>< 7.8 kB</td><td>< 9.7 kB</td><td>< 10.3 kB</td><td>< 11.4 kB</td><td>< 12.4 kB</td><td>< 16.0 kB</td></tr>
* <tr align="center"><td>SRAM:</td><td>< 1.3 kB</td><td>< 1.5 kB</td><td>< 1.5 kB</td><td>< 1.2 kB</td><td>< 1.2 kB</td><td>< 2.6 kB</td><td>< 3.3 kB</td><td>< 2.1 kB</td><td>< 5.4 kB</td></tr>
* <tr align="center"><td rowspan=2>DMA</td><td rowspan=2>CTRL_MUX</td><td>Flash:</td><td>< 8.7 kB</td><td>< 11.7 kB</td><td>< 13.0 kB</td><td>< 8.6 kB</td><td>< 10.4 kB</td><td>< 11.0 kB</td><td>< 12.1 kB</td><td>< 13.1 kB</td><td>< 16.7 kB</td></tr>
* <tr align="center"><td>SRAM:</td><td>< 1.3 kB</td><td>< 1.5 kB</td><td>< 1.5 kB</td><td>< 2.2 kB</td><td>< 2.2 kB</td><td>< 2.6 kB</td><td>< 3.3 kB</td><td>< 2.1 kB</td><td>< 5.4 kB</td></tr>
* <tr align="center"><td rowspan=2>5th Gen Low Power</td><td rowspan=2>LP-AOS</td><td rowspan=2>AMUX</td><td>Flash:</td><td>< 7.9 kB</td><td>< 11.8 kB</td><td>< 12.9 kB</td><td>< 7.7 kB</td><td>< 10.1 kB</td><td>< 10.2 kB</td><td>< 11.6 kB</td><td>< 12.2 kB</td><td>< 15.8 kB</td></tr>
* <tr align="center"><td>SRAM:</td><td>< 1.2 kB</td><td>< 1.4 kB</td><td>< 1.5 kB</td><td>< 2.1 kB</td><td>< 2.1 kB</td><td>< 2.5 kB</td><td>< 3.2 kB</td><td>< 1.5 kB</td><td>< 4.8 kB</td></tr>
* <tr><th colspan=13>Widgets</th></tr>
* <tr><td colspan=4>CSD Button</td><td>3(10 sensors)</td><td>3(10 sensors)</td><td>3(10 sensors)</td><td> </td><td> </td><td> </td><td> </td><td>1(1 sensor)</td><td>1(1 sensor)</td></tr>
* <tr><td colspan=4>CSD Matrix Buttons</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
* <tr><td colspan=4>CSD Slider</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
* <tr><td colspan=4>CSD Touchpad</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td>1(8x8)</td><td>1(8x8)</td></tr>
* <tr><td colspan=4>CSD Proximity</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
* <tr><td colspan=4>CSX Button</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
* <tr><td colspan=4>CSX Matrix Buttons</td><td> </td><td> </td><td> </td><td>1(4x8)</td><td>1(4x8)</td><td> </td><td> </td><td> </td><td> </td></tr>
* <tr><td colspan=4>CSX Touchpad</td><td> </td><td> </td><td> </td><td> </td><td> </td><td>1(9x4)</td><td>1(9x4)</td><td> </td><td>1(8x8)</td></tr>
* <tr><th colspan=13>Features</th></tr>
* <tr><td colspan=4>Gesture</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
* <tr><td colspan=4>Ballistic Multiplier</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
* <tr><td colspan=4>Centroid Type</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
* <tr><td colspan=4>Supported fingers on touchpad</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
* <tr><td colspan=4>Shield</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td>enabled</td><td>enabled</td></tr>
* <tr><td colspan=4>SmartSense</td><td> </td><td>enabled</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
* <tr><td colspan=4>CSD auto-calibration</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
* <tr><td colspan=4>CSX auto-calibration</td><td> </td><td> </td><td> </td><td> </td><td>enabled</td><td> </td><td> </td><td> </td><td> </td></tr>
* <tr><td colspan=4>Self-test</td><td> </td><td> </td><td>enabled</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
* <tr><th colspan=13>Raw Count Filters</th></tr>
* <tr><td colspan=4>IIR</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td>enabled</td><td>enabled</td><td>enabled</td></tr>
* <tr><td colspan=4>Median</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td>enabled</td><td> </td><td> </td></tr>
* <tr><td colspan=4>Average</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td>enabled</td><td> </td><td> </td></tr>
* <tr><th colspan=13>Position Filters</th></tr>
* <tr><td colspan=4>IIR</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td>enabled</td><td> </td><td> </td></tr>
* <tr><td colspan=4>Median</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td>enabled</td><td> </td><td> </td></tr>
* <tr><td colspan=4>Average</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td>enabled</td><td> </td><td> </td></tr>
* <tr><td colspan=4>Adaptive IIR</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td>enabled</td><td> </td><td> </td></tr>
* <tr><td colspan=4>Jitter</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td>enabled</td><td> </td><td> </td></tr>
* </table>
*
* \note
* Configuration considerations:
* * To select values for the Scan mode and Sensor connection method parameters (for the fifth-generation of the CAPSENSE™ HW)
* navigate to the Advanced tab in the CAPSENSE™ Configurator tool, and then select the General settings sub-tab.
*
* * For the forth-generation of the CAPSENSE™ HW, the IntDrv mode with the AMUX sensor connection type is available only.
*
********************************************************************************
* \section section_capsense_misra MISRA-C:2012 Compliance
********************************************************************************
*
* This page describes MISRA-C:2012 compliance and deviations for
* the CAPSENSE™ middleware.
*
* MISRA stands for Motor Industry Software Reliability Association. The MISRA
* specification covers a set of 10 mandatory rules, 110 required rules and
* 39 advisory rules that apply to firmware design and has been put together
* by the Automotive Industry to enhance the quality and robustness of
* the firmware code embedded in automotive devices.
*
* \subsection subsection_capsense_misra-mw CAPSENSE™ Middleware Deviation
*
* <table class="doxtable">
* <tr>
* <th>Rule ID</th>
* <th>Rule Description</th>
* <th>Description of Deviation(s)</th>
* </tr>
* <tr>
* <td>Directive 4.8</td>
* <td>If a pointer to a structure or union is never dereferenced within a translation
* unit, then the implementation of the object should be hidden.
* </td>
* <td>Advisory. The middleware library consists of several modules. One of them
* is CapSense Data Structure. All communication between the other modules
* is performed through CapSense Data Structure.
* </td>
* </tr>
* <tr>
* <td>Rule 2.3</td>
* <td>A project should not contain unused type declarations.
* </td>
* <td>Advisory. The middleware library provides API to the hardware. The type
* is part of API, which is defined for application-level only.
* </td>
* </tr>
* <tr>
* <td>Rule 2.5</td>
* <td>A project should not contain unused macro declarations.
* </td>
* <td>Advisory. The middleware library provides API to the hardware. The macro
* is part of API, which is defined for application-level only.
* </td>
* </tr>
* <tr>
* <td>Rule 5.1</td>
* <td>External identifiers shall be distinct.
* </td>
* <td>Toolchains from Supported Software and Tools documentation section
* are verified to work with functions, names of which have similar first 31 symbols.
* </td>
* </tr>
* <tr>
* <td>Rule 5.4</td>
* <td>Macro identifiers shall be distinct.
* </td>
* <td>Toolchains from Supported Software and Tools documentation section
* are verified to work with macros, names of which have similar first 31 symbols.
* </td>
* </tr>
* <tr>
* <td>Rule 5.6</td>
* <td>A typedef name shall be a unique identifier.
* </td>
* <td>During the code analysis, the same source files are compiled multiple times
* with device-specific options. All typedef names are unique for each specific run.
* </td>
* </tr>
* <tr>
* <td>Rule 5.8</td>
* <td>Identifiers that define objects or functions with external linkage shall be unique.
* </td>
* <td>During the code analysis, the same source files are compiled multiple times
* with device-specific options. All object and function identifiers are unique
* for each specific run.
* </td>
* </tr>
* <tr>
* <td>Rule 5.9</td>
* <td>Identifiers that define objects or functions with internal linkage should be unique.
* </td>
* <td>Advisory. During the code analysis, the same source files are compiled multiple times
* with device-specific options. All object and function identifiers are unique
* for each specific run.
* </td>
* </tr>
* <tr>
* <td>Rule 8.3</td>
* <td>All declarations of an object or function shall use the same names and type qualifiers.
* </td>
* <td>During the code analysis, the same source files are compiled multiple times
* with device-specific options. All object and function identifiers are unique
* for each specific run.
* </td>
* </tr>
* <tr>
* <td>Rule 8.5</td>
* <td>An external object or function shall be declared once in one and only one file.
* </td>
* <td>During the code analysis, the same source files are compiled multiple times
* with device-specific options. All object and function identifiers are unique
* for each specific run.
* </td>
* </tr>
* <tr>
* <td>Rule 8.6</td>
* <td>An identifier with external linkage shall have exactly one external definition.
* </td>
* <td>During the code analysis, the same source files are compiled multiple times
* with device-specific options. All object and function identifiers are unique
* for each specific run.
* </td>
* </tr>
* <tr>
* <td>Rule 8.7</td>
* <td>Functions and objects should not be defined with external linkage if they
* are referenced in only one translation unit.
* </td>
* <td>Advisory. During the code analysis, the same source files are compiled multiple times
* with device-specific options. All object and function identifiers are unique
* for each specific run.
* </td>
* </tr>
* <tr>
* <td>Rule 8.13</td>
* <td>A pointer should point to const-qualified type whenever possible.
* </td>
* <td>Advisory. During the code analysis, the same source files are compiled multiple times
* with device-specific options. A function argument can be const for some specific run.
* </td>
* </tr>
* <tr>
* <td>Rule 11.4</td>
* <td>A conversion should not be performed between a pointer to object and an integer type.
* </td>
* <td>Advisory. There is an issue with a SYSCLK driver (IFXID-10550), due to which integer type
* is cast to an object pointer type. Code is manually checked and reviewed to be safe.
* </td>
* </tr>
* <tr>
* <td>Rule 11.5</td>
* <td>A conversion should not be performed from pointer to void into pointer to object.
* </td>
* <td>Advisory. The cast from void pointer to an object pointer does not have any unintended effect,
* as it is a consequence of the definition of a structure based on function pointers.
* </td>
* </tr>
* <tr>
* <td>Rule 14.2</td>
* <td>A for loop shall be well-formed.
* </td>
* <td>The third clause of the for loop is empty to improve execution time.
* </td>
* </tr>
* <tr>
* <td>Rule 18.4</td>
* <td>The +, -, += and -= operators should not be applied to an expression of pointer type.
* </td>
* <td>Advisory. There are several instances of pointer arithmetic in drivers. They cannot be avoided,
* so are manually checked and reviewed to be safe.
* </td>
* </tr>
* </table>
*
* \subsection subsection_capsense_misra-cfg CAPSENSE™ Configurator Tool Generated Sources Deviation
*
* <table class="doxtable">
* <tr>
* <th>Rule ID</th>
* <th>Rule Description</th>
* <th>Description of Deviation(s)</th>
* </tr>
* <tr>
* <td>Rule 3.1</td>
* <td>The character sequences / * and / / shall not be used within a comment.</td>
* <td>Using of the special comment symbols is need for Doxygen comment
* support, it does not have any impact on functionality. </td>
* </tr>
* <tr>
* <td>Rule 8.4</td>
* <td>A compatible declaration shall be visible when an object or function with external linkage is defined.</td>
* <td>The CAPSENSE™ middleware library consists of several modules. One of them is CAPSENSE™ Built-in Self Test (BIST).
* All the BIST variables are used in other data structures and accessed using pointers.</td>
* </tr>
* <tr>
* <td>Rule 11.4</td>
* <td>A conversion should not be performed between a pointer to object and an integer type.</td>
* <td>Advisory. There are several instances of pointer conversions in Generated Source.
* They are manually checked and reviewed to be safe.</td>
* </tr>
* </table>
*
********************************************************************************
* \section section_capsense_errata Errata
********************************************************************************
*
* This section lists the known problems with the CAPSENSE™ middleware.
*
* <table class="doxtable">
* <tr><th>ID</th><th>Known Issue</th><th>Workaround</th></tr>
* <tr>
* <td>319100</td>
* <td>
* GPIO simultaneous operation with unrestricted strength and frequency
* creates noise that can affect CAPSENSE™ operation. This issue
* is applicable for the fourth CAPSENSE™ generation devices.
* </td>
* <td>
* For detail, refer to the errata section of the device datasheet.
* </td>
* </tr>
* <tr>
* <td>3159</td>
* <td>
* Scanning a sensor with low capacitance (about 8pF and less) with low
* frequency (around 300kHz and less) might lead to raw count variation
* from scan to scan. This issue is applicable for the fourth CAPSENSE™
* generation devices.
* </td>
* <td>
* There are several possible workarounds:
* 1. Increase the Scan resolution.
* 2. Increase the Sense clock frequency. For the best results, perform
* scanning with as high as possible Sense clock frequency.
* 3. If shield is required for a design, enable the shield tank (Csh)
* capacitor.
* 4. Increase the sensor capacitance by changing its layout or introduce
* extra capacitor between the sensor pin and ground.
* 5. Increase number of Fine initialization cycles. Open the cycfg_capsense.c
* file and modify the .csdFineInitTime field of the cy_capsense_commonConfig
* structure.
* 6. Increase the CSD init switch resistance. Open the cycfg_capsense.c file
* and update the .csdInitSwRes field of the cy_capsense_commonConfig structure
* with the CY_CAPSENSE_INIT_SW_RES_HIGH value.
* </td>
* </tr>
* <tr>
* <td>17158</td>
* <td>
* ISX scan followed by BIST measurement or with other sensing methods
* CSD & CSX introduces drift in raw count. This impacts the
* performance and accuracy of the ISX scanning.
* </td>
* <td>
* There are several possible workarounds:
* 1. Use ISX in standalone mode (without other sensing methods)
* 2. Use ISX without built-in self-test (BIST)
* 3. Configure Inactive sensor connection parameter to High-Z
* 4. Introduce a dummy scan before ISX.
* </td>
* </tr>
* </table>
*
* \note Refer to the "Errata" section of the device datasheet to get information
* about the known problems related to the CAPSENSE™ HW IP block.
*
********************************************************************************
* \section section_capsense_changelog Changelog
********************************************************************************
*
* <table class="doxtable">
* <tr><th>Version</th><th>Changes</th><th>Reason for Change</th></tr>
* <tr>
* <td rowspan="9">6.10.0</td>
* <td colspan="2"><i><b>
* This version is compatible to the v5.0,
* however due to switching to MTB 3.4, new Device-DB, PDL,
* compiler versions, etc. a migration of projects created with
* past version might be not possible. In this case a project should be newly created.
* Also, if you use the CAPSENSE™ middleware v6.10.0, you must use
* the CAPSENSE&trade Configurator v7.10.0 tool or later. This MW version is not
* compatible with the previous Configurator tool versions.
* </b></i>
* </tr>
* <tr>
* <td> Added Liquid level sensing method for fifth-generation low power device.
* </td>
* <td>
* Feature enhancement.
* </td>
* </tr>
* </tr>
* <tr>
* <td> Added Inductive sensing method for fifth-generation low power device.
* </td>
* <td>
* Feature enhancement.
* </td>
* </tr>
* <tr>
* <td> Added auto-tuning for Inductive sensing widgets. The ISX auto-tuning
* feature is at the Beta readiness level. It is not fully validated and
* might not work as expected. Use it to start working on the ISX tuning.
* </td>
* <td>
* Feature enhancement.
* </td>
* </tr>
* <tr>
* <td> Added Common mode filter.
* </td>
* <td>
* Feature enhancement.
* </td>
* </tr>
* <tr>
* <td> Added Multi-pin Selection option for fifth-generation low power device.
* </td>
* <td>
* Feature enhancement.
* </td>
* </tr>
* <tr>
* <td>
* Increased supported sensor capacitance range to 275pF and total
* Shield electrode capacitance range to 1160pF (CAPSENSE™ fifth-generation low power device).
* </td>
* <td>
* Feature enhancement.
* </td>
* </tr>
* <tr>
* <td>
* Fixed some non-functional MISRA violations.
* </td>
* <td>
* Defect fixing.
* </td>
* </tr>
* <tr>
* <td> Fixed documentation.
* </td>
* <td>
* User experience improvement.
* </td>
* </tr>
* <tr>
* <td>6.0.0</td>
* <td colspan="2"><i><b>
* This release is for internal purpose.
* </b></i>
* </td>
* </tr>
* <tr>
* <td rowspan="13">5.0</td>
* <td colspan="2"><i><b>
* This version is not backward compatible with the
* previous version due to re-designed CDAC auto-calibration.
* We tried to keep the established API, but your design may need to be
* updated to operate with CAPSENSE™ middleware v5.0.
* Also, if you use the CAPSENSE&trade middleware v5.0, you must use
* the CAPSENSE&trade Configurator v6.20 tool or later. This MW version is not
* compatible with the previous Configurator tool versions.
* </b></i>
* </td>
* </tr>
* <tr>
* <td>
* Re-designed CDAC auto-calibration algorithm for the fifth-generation
* LP devices
* </td>
* <td>
* Feature enhancement
* </td>
* </tr>
* <tr>
* <td>
* Added auto-selection mode of CIC2 decimation rate for the
* fifth-generation low power devices
* </td>
* <td>
* Feature enhancement
* </td>
* </tr>
* <tr>
* <td>
* Added auto-selection mode of CDAC Dither scale value for the
* fifth-generation and fifth-generation low power devices
* </td>
* <td>
* Feature enhancement
* </td>
* </tr>
* <tr>
* <td>
* Added the HW IIR Filter initialization function
* Cy_CapSense_ScanInitializeHwIirAllSlots() and
* Cy_CapSense_ScanInitializeHwIirSlots() for fifth-generation low power devices
* </td>
* <td>
* Feature enhancement
* </td>
* </tr>
* <tr>
* <td>
* Corrected the low power widget scanning flow by excluding waking up at a
* signal detection - only the end of the frame interrupt is kept.
* Condition: multiple low power sensors. This will avoid multiple interrupt
* generation and in some cases prevent the device from hanging.
* </td>
* <td>
* Defect fixing
* </td>
* </tr>
* <tr>
* <td>
* Corrected description of the cy_stc_capsense_position_t structure
* </td>
* <td>
* Defect fixing
* </td>
* </tr>
* <tr>
* <td>
* Removed Epilogue cycles from the maximum Raw Counts definition
* </td>
* <td>
* Defect fixing
* </td>
* </tr>
* <tr>
* <td>
* Hidden a Multi-phase Self feature for fifth-generation low power devices
* </td>
* <td>
* Defect fixing
* </td>
* </tr>
* <tr>
* <td>
* Disabled the External Frame Start in the Cy_CapSense_InitializeMaxRaw()
* function for the fifth-generation devices
* </td>
* <td>
* Defect fixing
* </td>
* </tr>
* <tr>
* <td>
* Corrected description of the BIST measurement function
* </td>
* <td>
* Defect fixing
* </td>
* </tr>
* <tr>
* <td>
* Corrected description of the cy_stc_capsense_touch_t structure
* </td>
* <td>
* Defect fixing
* </td>
* </tr>
* <tr>
* <td>
* Updated description of the software watchdog time calculation for
* the fifth-generation devices
* </td>
* <td>
* Defect fixing
* </td>
* </tr>
* <tr>
* <td rowspan="17" >4.0</td>
* <td colspan="2"><i><b>
* This version is not backward compatible with the
* previous version due to fifth-generation low power devices support
* implementation and defect fixes.
* We tried to keep the established API, but your design may need to be
* updated to operate with CAPSENSE™ middleware v4.0.
* </b></i>
* </td>
* </tr>
* <tr>
* <td>
* Added CAPSENSE™ fifth-generation low power device support
* </td>
* <td>
* Feature enhancement
* </td>
* </tr>
* <tr>
* <td>
* Added the Inductive sensing method support (ISX)
* </td>
* <td>
* Feature enhancement
* </td>
* </tr>
* <tr>
* <td>
* Added the feature of enabling/disabling widgets and built-in
* self-test working/non-working widgets
* </td>
* <td>
* Feature enhancement
* </td>
* </tr>
* <tr>
* <td>
* Added Multi-phase Self support for fifth-generation low power devices
* </td>
* <td>
* Feature enhancement
* </td>
* </tr>
* <tr>
* <td>
* Updated the CIC2 functionality for the fifth-generation devices
* to be consistent with the fifth-generation low power devices.
* </td>
* <td>
* Feature enhancement
* </td>
* </tr>
* <tr>
* <td>
* Added saturated scan during CAPSENSE™ initialization to measure
* maximum rawcounts precisely instead of using equations.
* </td>
* <td>
* Feature enhancement
* </td>
* </tr>
* <tr>
* <td>
* Changed the meaning of bit[2] of the widget status register in the cy_stc_capsense_widget_context_t:
* logical 1 means the widget is enabled. Replaced CY_CAPSENSE_WD_DISABLE_MASK with
* CY_CAPSENSE_WD_ENABLE_MASK for consistency
* </td>
* <td>
* Defect fixing
* </td>
* </tr>
* <tr>
* <td>
* Swapped the position of bit[0] and bit[1] of the sensor status register in the cy_stc_capsense_sensor_context_t:
* bit[0] reports the Proximity sensor status, bit[1] - the regular sensor status.
* Updated values of CY_CAPSENSE_SNS_PROX_STATUS_MASK and CY_CAPSENSE_SNS_TOUCH_STATUS_MASK macros.
* </td>
* <td>
* Defect fixing
* </td>
* </tr>
* <tr>
* <td>
* Renamed cy_stc_active_scan_sns_t to cy_stc_capsense_active_scan_sns_t.
* </td>
* <td>
* Following naming convention. Defect fixing
* </td>
* </tr>
* <tr>
* <td>
* Renamed cy_stc_msc_channel_config_t to cy_stc_capsense_channel_config_t, updated field names
* </td>
* <td>
* Following naming convention. Updated for consistency between fifth-generation and fifth-generation low power devices
* </td>
* </tr>
* <tr>
* <td>
* Renamed Cy_CapSense_ProcessWidgetMptxDeconvolution() to Cy_CapSense_ProcessWidgetMpDeconvolution()
* </td>
* <td>