-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcy_capsense_structure.h
2096 lines (1905 loc) · 184 KB
/
cy_capsense_structure.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_structure.h
* \version 6.10.0
*
* \brief
* This file provides the top-level declarations of the CAPSENSE™ data
* structure. Also, the file declares the functions for data access.
*
********************************************************************************
* \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.
*******************************************************************************/
#if !defined(CY_CAPSENSE_STRUCTURE_H)
#define CY_CAPSENSE_STRUCTURE_H
#include "cy_syslib.h"
#include "cy_device_headers.h"
#include "cycfg_capsense_defines.h"
#include "cy_capsense_lib.h"
#include "cy_capsense_gesture_lib.h"
#include "cy_capsense_common.h"
#if (CY_CAPSENSE_PLATFORM_BLOCK_FOURTH_GEN)
#include "cy_csd.h"
#elif (CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN_LP)
#include "cy_msclp.h"
#else /* (CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN) */
#include "cy_msc.h"
#endif
#if (defined(CY_IP_MXCSDV2) || defined(CY_IP_M0S8CSDV2) || defined(CY_IP_M0S8MSCV3) || defined(CY_IP_M0S8MSCV3LP))
#if defined(__cplusplus)
extern "C" {
#endif
/*******************************************************************************
* CAPSENSE™ Enumerated Types
*******************************************************************************/
/******************************************************************************/
/** \addtogroup group_capsense_enums *//** \{ */
/******************************************************************************/
/** Defines MW Tuner module states */
typedef enum
{
CY_CAPSENSE_TU_FSM_RUNNING = 0x00u, /**< Running state is a state when CAPSENSE™ middleware is not
* blocked by the CAPSENSE™ Tuner tool and application program continuously scans */
CY_CAPSENSE_TU_FSM_SUSPENDED = 0x01u, /**< Scanning is suspended */
CY_CAPSENSE_TU_FSM_ONE_SCAN = 0x03u, /**< Scanning is suspended after one scan cycle */
} cy_en_capsense_tuner_state_t;
/** Defines the Tuner command codes */
typedef enum
{
CY_CAPSENSE_TU_CMD_NONE_E = 0u, /**< No command */
CY_CAPSENSE_TU_CMD_SUSPEND_E = 1u, /**< Suspend command */
CY_CAPSENSE_TU_CMD_RESUME_E = 2u, /**< Resume command switches state from suspend to running */
CY_CAPSENSE_TU_CMD_RESTART_E = 3u, /**< Restart command requests to perform CAPSENSE™ re-initialization and switches state to running */
CY_CAPSENSE_TU_CMD_RUN_SNR_TEST_E = 4u, /**< Reserved */
CY_CAPSENSE_TU_CMD_PING_E = 5u, /**< Ping command to check whether application program calls Cy_CapSense_RunTuner() */
CY_CAPSENSE_TU_CMD_ONE_SCAN_E = 6u, /**< Execute one scan cycle and then switch to suspend state */
CY_CAPSENSE_TU_CMD_WRITE_E = 7u, /**< Writes specified data with offset into cy_capsense_tuner */
CY_CAPSENSE_TU_CMD_COMM_DIS_E = 8u, /**< Disables the communication mode (used in the fifth-generation low power CAPSENSE™ only):
* * Low power sensors rawcounts does not copied to communication structure
* * Communication of CapSense data structure to Tuner does not happen (in case of UART or protocol-agnostic method) */
CY_CAPSENSE_TU_CMD_COMM_EN_E = 9u, /**< Enables the communication mode (used in the fifth-generation low power CAPSENSE™ only):
* * Low power sensors rawcounts are copied to communication structure
* * Data is transferred to Tuner (in case of UART or protocol-agnostic method) */
CY_CAPSENSE_TU_CMD_RESTART_ONLY_E = 10u, /**< Restart command requests to perform CAPSENSE™ re-initialization and keeps state unchanged */
CY_CAPSENSE_TU_CMD_SET_DUTY_CYCLE_AND_SCAN_E = 11u, /**< Sets duty cycle and executes one scan (used only when foam-rejection is enabled for LLW) */
CY_CAPSENSE_TU_CMD_LAST_E = 12u, /**< The last command */
} cy_en_capsense_tuner_cmd_t;
/** Defines widget types */
typedef enum
{
CY_CAPSENSE_WD_BUTTON_E = 0x01u, /**< Button widget */
CY_CAPSENSE_WD_LINEAR_SLIDER_E = 0x02u, /**< Linear Slider widget */
CY_CAPSENSE_WD_RADIAL_SLIDER_E = 0x03u, /**< Radial Slider widget */
CY_CAPSENSE_WD_MATRIX_BUTTON_E = 0x04u, /**< Matrix Buttons widget */
CY_CAPSENSE_WD_TOUCHPAD_E = 0x05u, /**< Touchpad widget */
CY_CAPSENSE_WD_PROXIMITY_E = 0x06u, /**< Proximity widget */
CY_CAPSENSE_WD_LOW_POWER_E = 0x07u, /**< Low Power widget, used in the fifth-generation low power CAPSENSE™ only */
CY_CAPSENSE_WD_LIQUID_LEVEL_E = 0x08u, /**< Liquid level widget, used in the fifth-generation low power CAPSENSE™ only */
CY_CAPSENSE_WD_LIQUID_DETECTION_E = 0x09u, /**< Liquid detection widget, used in the fifth-generation low power CAPSENSE™ only */
} cy_en_capsense_widget_type_t;
/** Defines CAPSENSE™ return statuses types */
typedef enum
{
CY_CAPSENSE_SUCCESS_E = 0x00u, /**< The success return status */
CY_CAPSENSE_BAD_PARAM_E = 0x01u, /**< One or more invalid input parameters */
CY_CAPSENSE_HW_LOCKED_E = 0x02u, /**< The sensing HW block is captured by another middleware */
CY_CAPSENSE_HW_BUSY_E = 0x03u, /**< The sensing HW block is busy by previous operation */
CY_CAPSENSE_TIMEOUT_E = 0x04u, /**< The sensing HW block operation was not finished correctly */
} cy_en_capsense_return_status_t;
/** Defines types of electrode */
typedef enum
{
CY_CAPSENSE_ELTD_TYPE_SELF_E = 0x01u, /**< Electrode used as a sensor in CSD sensing method */
CY_CAPSENSE_ELTD_TYPE_MUT_TX_E = 0x02u, /**< Electrode used as a TX in CSX sensing method */
CY_CAPSENSE_ELTD_TYPE_MUT_RX_E = 0x03u, /**< Electrode used as a RX in CSX sensing method */
} cy_en_capsense_eltd_t;
/** Defines connections of sensing capacitors */
typedef enum
{
CY_CAPSENSE_CMODPAD_E = 0x01u, /**< External capacitor is connected to dedicated CMOD pad */
CY_CAPSENSE_CTANKPAD_E = 0x02u, /**< External capacitor is connected to dedicated CSH pad */
CY_CAPSENSE_CSHIELDPAD_E = 0x03u, /**< External capacitor is connected to dedicated SHIELD pad */
CY_CAPSENSE_VREFEXTPAD_E = 0x04u, /**< External capacitor is connected to dedicated VREF pad */
} cy_en_capsense_cap_connection_t;
/** Defines CAPSENSE™ middleware execution events
* when the CAPSENSE™ callback can be executed. */
typedef enum
{
CY_CAPSENSE_START_SAMPLE_E = 0x01u, /**< Start Sample Callback. The callback will be executed before each sensor
*scan triggering */
CY_CAPSENSE_END_OF_SCAN_E = 0x02u, /**< End Of Scan Callback. The callback will be executed when sensor scan
* is finished and there is no other sensors in the queue to be scanned. */
} cy_en_capsense_callback_event_t;
/** Defines HW configurations types for BIST operations */
typedef enum
{
CY_CAPSENSE_BIST_HW_UNDEFINED_E = 0x00u, /**< Initialization or releasing of the CAPSENSE™ HW block */
CY_CAPSENSE_BIST_HW_SHORT_E = 0x01u, /**< Short tests */
CY_CAPSENSE_BIST_HW_ELTD_CAP_E = 0x02u, /**< Sensor and shield electrodes capacitance measurements with disabled shield */
CY_CAPSENSE_BIST_HW_EXTERNAL_CAP_E = 0x03u, /**< External capacitors capacitance measurements */
CY_CAPSENSE_BIST_HW_VDDA_E = 0x04u, /**< VDDA measurement */
CY_CAPSENSE_BIST_HW_ELTD_CAP_SH_E = 0x05u, /**< Sensor electrodes capacitance measurements with configured shield */
} cy_en_capsense_bist_hw_config_t;
/** Defines BIST IO Configuration */
typedef enum
{
CY_CAPSENSE_BIST_IO_UNDEFINED_E = 0x00u, /**< The undefined state. Pins are disconnected from AMuxBus */
CY_CAPSENSE_BIST_IO_STRONG_E = 0x01u, /**< The drive mode is set to Strong in off - Low.
* The HSIOM is set to GPIO */
CY_CAPSENSE_BIST_IO_HIGHZA_E = 0x02u, /**< The drive mode is set to High-Z.
* The HSIOM is set to GPIO */
CY_CAPSENSE_BIST_IO_SENSE_E = 0x03u, /**< The drive mode is set to High-Z/Strong in off (depending on the device platform).
* The HSIOM is set to CSD sense connection. */
CY_CAPSENSE_BIST_IO_SHIELD_E = 0x04u, /**< The drive mode is set to High-Z/Strong in off (depending on the device platform).
* The HSIOM is set to CSD shield connection. */
CY_CAPSENSE_BIST_IO_STRONG_HIGH_E = 0x05u, /**< The drive mode is set to Strong in off - High.
* The HSIOM is set to GPIO */
CY_CAPSENSE_BIST_IO_VDDA2_E = 0x06u, /**< The drive mode is set to High-Z/Strong in off.
* The HSIOM is set to VDDA/2 */
} cy_en_capsense_bist_io_state_t;
/** Defines BIST result statuses */
typedef enum
{
CY_CAPSENSE_BIST_SUCCESS_E = 0x00u, /**< The success test status */
CY_CAPSENSE_BIST_BAD_PARAM_E = 0x01u, /**< The bad input parameters test status */
CY_CAPSENSE_BIST_HW_BUSY_E = 0x02u, /**< The CAPSENSE™ HW block is busy by previous operation */
CY_CAPSENSE_BIST_LOW_LIMIT_E = 0x03u, /**< The status for a low limit reached during the test */
CY_CAPSENSE_BIST_HIGH_LIMIT_E = 0x04u, /**< The status for a high limit reached during the test */
CY_CAPSENSE_BIST_ERROR_E = 0x05u, /**< The status for an error occurred during the test.
The test is not completed */
CY_CAPSENSE_BIST_FEATURE_DISABLED_E = 0x06u, /**< The BIST feature is disabled. */
CY_CAPSENSE_BIST_TIMEOUT_E = 0x07u, /**< The status for a timeout occurred during the test */
CY_CAPSENSE_BIST_BAD_CONFIG_E = 0x08u, /**< The bad configuration parameters test status */
CY_CAPSENSE_BIST_FAIL_E = 0x0Fu, /**< The failed test status */
} cy_en_capsense_bist_status_t;
#if ((CY_CAPSENSE_PLATFORM_BLOCK_FOURTH_GEN) || (CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN_LP))
/** Defines IDs of the external capacitors */
typedef enum
{
#if (CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN_LP)
CY_CAPSENSE_BIST_CMOD01_ID_E = 0x00u, /**< ID for the MSC0 Cmod1 external capacitor \note This value is available for the fifth-generation low power CAPSENSE™.*/
CY_CAPSENSE_BIST_CMOD02_ID_E = 0x01u, /**< ID for the MSC0 Cmod2 external capacitor \note This value is available for the fifth-generation low power CAPSENSE™.*/
#endif
#if (CY_CAPSENSE_PLATFORM_BLOCK_FOURTH_GEN)
CY_CAPSENSE_BIST_CMOD_ID_E = 0x00u, /**< ID for Cmod external capacitor \note This value is available only for the fourth-generation CAPSENSE™.*/
CY_CAPSENSE_BIST_CINTA_ID_E = 0x01u, /**< ID for CintA external capacitor \note This value is available only for the fourth-generation CAPSENSE™.*/
CY_CAPSENSE_BIST_CINTB_ID_E = 0x02u, /**< ID for CintB external capacitor \note This value is available only for the fourth-generation CAPSENSE™.*/
CY_CAPSENSE_BIST_CSH_ID_E = 0x03u, /**< ID for Csh external capacitor \note This value is available only for the fourth-generation CAPSENSE™.*/
#endif
} cy_en_capsense_bist_external_cap_id_t;
#endif
/** Defines the raw count accumulation mode for MSC HW block */
typedef enum
{
CY_CAPSENSE_MSC_RAW_SATURATE_E = 0x00u, /**< In this scenario, RAW_COUNT is clamped at 0xFFFF and RESULT_FIFO_RD.OVERFLOW is set. */
CY_CAPSENSE_MSC_RAW_OVERFLOW_E = 0x01u, /**< In this scenario, RAW_COUNT rolls over and RESULT_FIFO_RD.OVERFLOW is set. This mode allows more sensitive tuning if measuring baseline capacitance */
} cy_en_capsense_msc_raw_mode_t;
/** \} */
/*******************************************************************************
* CAPSENSE™ Data Structures
*******************************************************************************/
/******************************************************************************/
/** \addtogroup group_capsense_structures *//** \{ */
/******************************************************************************/
/** Unified return status of CAPSENSE™ operation:
* * CY_CAPSENSE_STATUS_SUCCESS
* * CY_CAPSENSE_STATUS_BAD_PARAM
* * CY_CAPSENSE_STATUS_BAD_DATA
* * CY_CAPSENSE_STATUS_TIMEOUT
* * CY_CAPSENSE_STATUS_INVALID_STATE
* * CY_CAPSENSE_STATUS_BAD_CONFIG
* * CY_CAPSENSE_STATUS_CONFIG_OVERFLOW
* * CY_CAPSENSE_STATUS_HW_BUSY
*/
typedef uint32_t cy_capsense_status_t;
/** Unified return state of CAPSENSE™ Middleware:
*
* * CY_CAPSENSE_MW_STATE_BIST_MASK - The BIST is in progress.
* The next scan frame cannot be started.
* * CY_CAPSENSE_MW_STATE_CALIBRATION_MASK - The auto-calibration is in progress.
* The next scan frame cannot be started.
* * CY_CAPSENSE_MW_STATE_SMARTSENSE_MASK - The smart sensing algorithm is
* in progress.
* The next scan frame cannot be started.
* * CY_CAPSENSE_MW_STATE_INITIALIZATION_MASK - Middleware initialization is
* in progress and a next scan frame
* can be initiated.
* * CY_CAPSENSE_MW_STATE_SCAN_SLOT_MASK[x] - The set [x] number of the result
* means that the previously initiated
* scan for the [x] slot is completed
* or in progress. In CS-DMA mode, this
* field is set only for the first
* scanned slot.
*/
typedef uint32_t cy_capsense_mw_state_t;
/** Sensor context structure */
typedef struct
{
uint16_t raw; /**< Sensor raw count */
uint16_t bsln; /**< Sensor baseline */
uint16_t diff; /**< Sensor difference count */
uint8_t status; /**< Sensor status, contains masks:
* * bit[0] - Regular Sensor Touched (CY_CAPSENSE_SNS_TOUCH_STATUS_MASK) or Proximity Sensor is active (CY_CAPSENSE_SNS_PROX_STATUS_MASK)
* * bit[1] - Proximity Sensor Touched (CY_CAPSENSE_SNS_TOUCH_PROX_STATUS_MASK)
* * bit[2] - Overflow during scanning (CY_CAPSENSE_SNS_OVERFLOW_MASK) */
uint8_t negBslnRstCnt; /**< Negative baseline reset counter */
#if (CY_CAPSENSE_PLATFORM_BLOCK_FOURTH_GEN)
uint8_t idacComp; /**< Compensation IDAC of CSD or IDAC in CSX
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
#endif
uint8_t bslnExt; /**< Sensor baseline fractional */
#if (CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN || CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN_LP)
uint8_t cdacComp; /**< Compensation CDAC
* \note This field is available for the fifth-generation CAPSENSE™ and fifth-generation low power CAPSENSE™.
*/
#endif /* CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN || CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN_LP */
} cy_stc_capsense_sensor_context_t;
/** CSX Touchpad touch tracking history */
typedef struct
{
uint32_t velocity; /**< The square of the "speed" (maximum distance change per refresh interval) threshold
* distinguishing a fast finger movement from separate finger touches
* (in [pixels/refresh interval]).
* Squared speeds exceeding this value indicate separate finger touches.
* Squared speeds below this value indicate fast single finger movement. */
cy_stc_capsense_position_t oldPeak[CY_CAPSENSE_CSX_TOUCHPAD_MAX_PEAKS];
/**< Touch Positions */
uint8_t oldPeakNumber; /**< Number of detected peaks */
uint8_t oldActiveIdsMask; /**< Mask of used IDs */
} cy_stc_capsense_csx_touch_history_t;
/** Internal CSX Touchpad buffer structure for CSX for Touchpads' processing */
typedef struct
{
int32_t distanceMap[CY_CAPSENSE_CSX_TOUCHPAD_MAX_PEAKS * CY_CAPSENSE_CSX_TOUCHPAD_MAX_PEAKS];
/**< Buffer for distance map data */
int32_t colMap[CY_CAPSENSE_CSX_TOUCHPAD_MAX_PEAKS]; /**< Buffer for column map data */
int32_t rowMap[CY_CAPSENSE_CSX_TOUCHPAD_MAX_PEAKS]; /**< Buffer for row map data */
int32_t minsMap[CY_CAPSENSE_CSX_TOUCHPAD_MAX_PEAKS]; /**< Buffer for minimums map data */
cy_stc_capsense_position_t newPeak[CY_CAPSENSE_CSX_TOUCHPAD_MAX_PEAKS];
/**< Touch Positions */
int8_t fingerPosIndexMap[CY_CAPSENSE_CSX_TOUCHPAD_MAX_PEAKS + 3u];
/**< Buffer for index map data */
int8_t linksMap[CY_CAPSENSE_CSX_TOUCHPAD_MAX_PEAKS]; /**< Buffer for linked map data */
int8_t visitedMap[CY_CAPSENSE_CSX_TOUCHPAD_MAX_PEAKS]; /**< Buffer for visited map data */
int8_t markIndicesMap[CY_CAPSENSE_CSX_TOUCHPAD_MAX_PEAKS]; /**< Buffer for mark map data */
uint8_t newPeakNumber; /**< Number of detected peaks */
uint8_t newActiveIdsMask; /**< Mask of used IDs */
} cy_stc_capsense_csx_touch_buffer_t;
/** Widget context structure */
typedef struct
{
uint16_t fingerCap; /**< Touch sensitivity used when full auto-tuning mode is enabled:
* * For CSD widgets is a finger capacitance introduced at touch
* * For ISX widgets is a coil inductance change at touch */
uint16_t sigPFC; /**< The 75% of signal per the user-defined touch sensitivity parameter */
#if (CY_CAPSENSE_PLATFORM_BLOCK_FOURTH_GEN)
uint16_t resolution; /**< Provides scan resolution for the CSD Widgets.
* Provides number of sub-conversions for the CSX Widgets
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
#endif
uint16_t maxRawCount; /**< Calculated maximum raw count of widget */
uint16_t maxRawCountRow; /**< Calculated row maximum raw count of widget */
uint16_t fingerTh; /**< Widget Finger Threshold */
uint16_t proxTh; /**< Widget Proximity Threshold or Foam Correction Coefficient for Liquid level widget */
uint16_t lowBslnRst; /**< The widget low baseline reset count. Specifies the number
* of samples the sensor signal must be below the Negative
* Noise Threshold \ref nNoiseTh to trigger a baseline reset */
uint16_t snsClk; /**< Sense Clock Divider. For the Matrix Buttons and Touchpad widgets
* specifies the column sense clock divider */
uint16_t rowSnsClk; /**< Row Sense Clock Divider for the Matrix Buttons and Touchpad widgets */
uint16_t gestureDetected; /**< Mask of detected gestures */
uint16_t gestureDirection; /**< Mask of directions of detected gestures */
int16_t xDelta; /**< The filtered by Ballistic Multiplier X-displacement */
int16_t yDelta; /**< The filtered by Ballistic Multiplier Y-displacement */
uint16_t noiseTh; /**< Widget Noise Threshold */
uint16_t nNoiseTh; /**< Widget Negative Noise Threshold */
uint16_t hysteresis; /**< Widget Hysteresis for the signal crossing finger threshold */
uint8_t onDebounce; /**< Widget Debounce for the signal above the finger threshold 1 to 255.
* * 1 - touch reported immediately as soon as detected
* * 2 - touch reported on the second consecutive detection
* * 3 - touch reported on the third consecutive detection */
uint8_t snsClkSource; /**< Widget clock source.
* For fourth-generation CAPSENSE™:
* * bit[7] - Indicates auto mode of clock source selection
* * bit[0:6] - Clock source:
* * 0 - Direct (CY_CAPSENSE_CLK_SOURCE_DIRECT)
* * 1 - SSC6 (CY_CAPSENSE_CLK_SOURCE_SSC6)
* * 2 - SSC7 (CY_CAPSENSE_CLK_SOURCE_SSC7)
* * 3 - SSC9 (CY_CAPSENSE_CLK_SOURCE_SSC9)
* * 4 - SSC10 (CY_CAPSENSE_CLK_SOURCE_SSC10)
* * 5 - PRS8 (CY_CAPSENSE_CLK_SOURCE_PRS8)
* * 6 - PRS12 (CY_CAPSENSE_CLK_SOURCE_PRS12)
*
* For fifth-generation and fifth-generation low power CAPSENSE™:
* bit[3] - Indicates auto mode of PRS clock source
* bit[2] - Indicates auto mode of SSC clock source
* * bit[0:1] - Clock source:
* * 0 - Direct (CY_CAPSENSE_CLK_SOURCE_DIRECT)
* * 1 - SSC (CY_CAPSENSE_CLK_SOURCE_SSC)
* * 2 - PRS (CY_CAPSENSE_CLK_SOURCE_PRS)
*/
#if (CY_CAPSENSE_PLATFORM_BLOCK_FOURTH_GEN)
uint8_t idacMod[CY_CAPSENSE_MAX_SUPPORTED_FREQ_NUM]; /**< Sets the current of the modulation IDAC for the CSD widgets.
* For the CSD Touchpad and Matrix Button widgets sets the current of the
* modulation IDAC for the column sensors. Not used for the CSX widgets.
* \note This field is available only for the fourth-generation CAPSENSE™.*/
uint8_t idacGainIndex; /**< Index of IDAC gain in table \ref cy_stc_capsense_idac_gain_table_t
* \note This field is available only for the fourth-generation CAPSENSE™.
* */
uint8_t rowIdacMod[CY_CAPSENSE_MAX_SUPPORTED_FREQ_NUM]; /**< Sets the current of the modulation IDAC for the row sensors
* for the CSD Touchpad and Matrix Button widgets. Not used for the CSX widgets.
* \note This field is available only for the fourth-generation CAPSENSE™.*/
#endif
uint8_t bslnCoeff; /**< Baseline IIR filter coefficient. Lower value leads to higher filtering. */
uint8_t status; /**< Contains masks:
* * bit[0] - Widget Active (CY_CAPSENSE_WD_ACTIVE_MASK)
* * bit[1] - Widget Enable (CY_CAPSENSE_WD_ENABLE_MASK)
* * bit[2] - Widget Working (CY_CAPSENSE_WD_WORKING_MASK)
* * bit[3] - Widget maximum raw count calculation enabled (CY_CAPSENSE_WD_MAXCOUNT_CALC_MASK)
* * bit[4] - Widget row maximum raw count calculation enable (CY_CAPSENSE_WD_MAXCOUNT_ROW_CALC_MASK) */
cy_stc_capsense_touch_t wdTouch; /**< Widget touch structure used for Matrix Buttons, Sliders, and Touchpads */
#if ((CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN) || (CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN_LP))
uint16_t numSubConversions; /**< Number of sub-conversions in a scan
* \note This field is available for the fifth-generation CAPSENSE™ and fifth-generation low power CAPSENSE™.
*/
uint8_t cdacRef; /**< Sets the capacitance of the reference CDAC
* \note This field is available for the fifth-generation CAPSENSE™ and fifth-generation low power CAPSENSE™.
*/
uint8_t rowCdacRef; /**< Sets the capacitance of the row reference CDAC for CSD
* Touchpad and CSD Matrix buttons widgets
* \note This field is available for the fifth-generation CAPSENSE™ and fifth-generation low power CAPSENSE™.
*/
#if ((CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN_LP) && \
((CY_CAPSENSE_ENABLE == CY_CAPSENSE_CSD_CDAC_FINE_EN) || \
(CY_CAPSENSE_ENABLE == CY_CAPSENSE_CSX_CDAC_FINE_EN) || \
(CY_CAPSENSE_ENABLE == CY_CAPSENSE_ISX_CDAC_FINE_EN)))
uint8_t cdacFine; /**< Sets the capacitance of the fine CDAC
* \note This field is available for the fifth-generation low power CAPSENSE™.
*/
uint8_t rowCdacFine; /**< Sets the capacitance of the row fine CDAC for CSD
* Touchpad and CSD Matrix buttons widgets
* \note This field is available for the fifth-generation low power CAPSENSE™.
*/
#endif
uint8_t cicRate; /**< Sets decimation rate when CIC2 is enabled
* \note This field is available for the fifth-generation CAPSENSE™ and fifth-generation low power CAPSENSE™.
*/
#if (CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN)
uint8_t cdacDitherEn; /**< Enabled CDAC dithering
* \note This field is available only for the fifth-generation CAPSENSE™.
*/
#endif /* CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN */
uint8_t cdacDitherValue; /**< CDAC dither scale value in bits
* \note This field is available for the fifth-generation CAPSENSE™ and fifth-generation low power CAPSENSE™.
*/
uint8_t coarseInitBypassEn; /**< Skip Cmod coarse initialization sensors scan within widget
* \note This field is available for the fifth-generation CAPSENSE™ and fifth-generation low power CAPSENSE™.
*/
uint16_t cdacCompDivider; /**< Number of time DAC switched in sense clock period
* \note This field is available for the fifth-generation CAPSENSE™ and fifth-generation low power CAPSENSE™.
*/
uint8_t lfsrBits; /**< Defines the number of LSB bits to use by the LSFR unit to achieve
* the desired clock dithering variation.
* \note This field is available for the fifth-generation CAPSENSE™ and fifth-generation low power CAPSENSE™.
*/
#endif /* CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN || CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN_LP */
#if (CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN_LP)
uint8_t cicShift; /**< Sets the right shift value applied to CIC2 accumulator to form rawcounts when CIC2 is enabled
* \note This field is available for the fifth-generation low power CAPSENSE™.
*/
uint8_t rowCicShift; /**< Sets the right shift value applied to CIC2 accumulator to form rawcounts when CIC2 is enabled
* \note This field is available for the fifth-generation low power CAPSENSE™.
*/
#endif
} cy_stc_capsense_widget_context_t;
/** Legacy mode pin configuration structure */
typedef struct
{
GPIO_PRT_Type * pcPtr; /**< Pointer to the base port register of the IO */
uint8_t pinNumber; /**< Position of the IO in the port */
#if ((CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN) || (CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN_LP))
uint8_t padNumber; /**< Control Mux pad number
* \note This field is available for the fifth-generation CAPSENSE™ and fifth-generation low power CAPSENSE™.
*/
#endif
#if (CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN)
uint8_t chId; /**< Channel Id the pin belongs to
* \note This field is available only for the fifth-generation CAPSENSE™.
*/
#endif
} cy_stc_capsense_pin_config_t;
/** Electrode objects configuration structure */
typedef struct
{
const cy_stc_capsense_pin_config_t * ptrPin; /**< Pointer to pin configuration structure */
uint8_t type; /**< Electrode type \ref cy_en_capsense_eltd_t */
uint8_t numPins; /**< Total number of pins in this sensor */
#if (CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN)
uint8_t chId; /**< Channel Id the electrode belongs to
* \note This field is available only for the fifth-generation CAPSENSE™.
*/
#endif
} cy_stc_capsense_electrode_config_t;
/** Configuration structure of advanced touchpad */
typedef struct
{
uint16_t penultimateTh; /**< Defines a threshold for determining arrival at edges. This
* value may have to be increased for small diamonds, so that the edge handling is
* initiated sooner. If this number is too high, there is jumping at the edge with
* a smaller finger. If this number is too low, there is jumping at the edge with a
* larger finger. */
uint16_t virtualSnsTh; /**< Defines a virtual sensor signal. This value should be set
* to the value of any sensor when a medium-sized finger is placed directly over
* it. If this value is too high, a position is reported nearer the edge than ideal
* position. If this value is too low, a position is reported nearer the middle of
* touchpad. */
uint8_t crossCouplingTh; /**< Defines cross coupling threshold. It is subtracted from
* sensor signals at centroid position calculation to improve the accuracy.
* The threshold should be equal to a sensor signal when your finger is near the
* sensor, but not touching the sensor. This can be determined by slowly dragging
* your finger across the panel and finding the inflection point of the difference
* counts at the base of the curve. The difference value at this point should be
* the Cross-coupling threshold. */
uint8_t reserved0; /**< Reserved field */
uint8_t reserved1; /**< Reserved field */
uint8_t reserved2; /**< Reserved field */
} cy_stc_capsense_advanced_touchpad_config_t;
#if ((CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN) || (CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN_LP))
/** Multi-phase table for de-convolution structure
* \note This structure is available for the fifth-generation CAPSENSE™ and fifth-generation low power CAPSENSE™.
*/
typedef struct
{
uint32_t vector; /**< Vector / pattern */
int16_t deconvCoef[32u]; /**< De-convolution coefficients */
} cy_stc_capsense_mp_table_t;
#endif
/** Widget configuration structure */
typedef struct
{
cy_stc_capsense_widget_context_t * ptrWdContext; /**< Pointer to context structure of this widget */
cy_stc_capsense_sensor_context_t * ptrSnsContext; /**< Pointer to the first object of sensor context structure that belongs to this widget */
const cy_stc_capsense_electrode_config_t * ptrEltdConfig; /**< Pointer to the first object of electrode configuration structure that belongs to this widget */
uint32_t * ptrEltdCapacitance; /**< Pointer to the first object in the electrode capacitance array that belongs to this widget */
#if ((CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN) || (CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN_LP))
uint32_t * ptrSnsCapacitance; /**< Pointer to the first object in the sensor capacitance array that belongs to this widget.
* \note This field is available only for the fifth-generation CAPSENSE™ and fifth-generation low power CAPSENSE™.
*/
#endif
uint16_t * ptrBslnInv; /**< Pointer to the first object in the sensor baseline inversion array that belongs to this widget */
cy_stc_capsense_smartsense_csd_noise_envelope_t * ptrNoiseEnvelope;
/**< Pointer to the noise envelope filter used by smart sensing algorithm */
uint16_t * ptrRawFilterHistory; /**< Pointer to the raw count filter history of the widget */
uint8_t * ptrRawFilterHistoryLow; /**< Pointer to the raw count filter history extended of the widget */
uint32_t iirCoeff; /**< Raw count IIR filter coefficient. Smaller value leads to higher filtering */
uint8_t * ptrDebounceArr; /**< Pointer to the debounce array of the widget */
const uint8_t * ptrDiplexTable; /**< Pointer to the diplex table used for Linear slider when Diplex option is enabled */
uint32_t centroidConfig; /**< Bit mask defining centroid configuration including centroid type, number of touches,
* diplexing, foam rejection, edge correction, etc. */
uint16_t xResolution; /**< Keeps maximum position value. For Touchpads X-axis maximum position */
uint16_t yResolution; /**< For Touchpads Y-Axis maximum position */
uint16_t numSns; /**< The total number of sensors:
* For CSD widgets: WD_NUM_ROWS + WD_NUM_COLS.
* For CSX widgets: WD_NUM_ROWS * WD_NUM_COLS.
* For ISX widgets: (WD_NUM_ROWS + WD_NUM_COLS) / 2 */
uint8_t numCols; /**< For CSD Button and Proximity Widgets, the number of sensors.
* For CSD Slider Widget, the number of segments.
* For CSD Touchpad and Matrix Button, the number of the column sensors.
* For CSX Button, Slider, Touchpad, and Matrix Button, the number of the Rx electrodes.
* For ISX Button and Linear Slider, the number of the Rx electrodes. */
uint8_t numRows; /**< For CSD Touchpad and Matrix Buttons, the number of the row sensors.
* For the CSX Button and Slider, the number of the Tx electrodes (constant 1u).
* For CSX Touchpad and Matrix Button, the number of the Tx electrodes.
* For ISX Button and Linear Slider, the number of the Lx electrodes. */
cy_stc_capsense_touch_t * ptrPosFilterHistory; /**< Pointer to the position filter history */
cy_stc_capsense_csx_touch_history_t * ptrCsxTouchHistory; /**< Pointer to the CSX touchpad history */
cy_stc_capsense_csx_touch_buffer_t * ptrCsxTouchBuffer; /**< Pointer to the single CSX buffer needed for CSX touchpad processing */
uint16_t * ptrCsdTouchBuffer; /**< Pointer to the CSD buffer needed for advanced CSD touchpad processing */
cy_stc_capsense_gesture_config_t * ptrGestureConfig; /**< Pointer to Gesture configuration structure */
cy_stc_capsense_gesture_context_t * ptrGestureContext; /**< Pointer to Gesture context structure */
cy_stc_capsense_ballistic_config_t ballisticConfig; /**< The configuration data for position ballistic filter */
cy_stc_capsense_ballistic_context_t * ptrBallisticContext; /**< Pointer to Ballistic filter context structure */
cy_stc_capsense_adaptive_filter_config_t aiirConfig; /**< The configuration of position adaptive filter */
cy_stc_capsense_advanced_touchpad_config_t advConfig; /**< The configuration of CSD advanced touchpad */
#if ((CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN) || (CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN_LP))
cy_stc_capsense_mp_table_t * ptrMpTable; /**< Pointer to the multi-phase vector and de-convolution coefficients
* \note This field is available for the fifth-generation CAPSENSE™ and fifth-generation low power CAPSENSE™.
*/
#endif
uint32_t posFilterConfig; /**< Position filters configuration */
uint16_t rawFilterConfig; /**< Raw count filters configuration */
uint16_t alpOnThreshold; /**< ALP Filter ON threshold */
uint16_t alpOffThreshold; /**< ALP Filter OFF threshold */
uint16_t cmfThreshold; /**< CMF threshold */
#if (CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN_LP)
uint16_t cdacConfig; /**< Bit-mask for widget CDAC configuration:
* * bit[0..1] - Reference CDAC mode (CY_CAPSENSE_CDAC_REF_MODE_MASK)
* * 0 (CY_CAPSENSE_CDAC_MODE_DISABLED) - The reference CDAC is disabled
* * 1 (CY_CAPSENSE_CDAC_MODE_MANUAL) - The value of reference CDAC set manually
* * 2 (CY_CAPSENSE_CDAC_MODE_AUTO) - The value of reference CDAC set automatically
* * bit[2..3] - Fine CDAC mode (CY_CAPSENSE_CDAC_FINE_MODE_MASK)
* * 0 (CY_CAPSENSE_CDAC_MODE_DISABLED) - The fine CDAC is disabled
* * 1 (CY_CAPSENSE_CDAC_MODE_MANUAL) - The value of fine CDAC set manually
* * 2 (CY_CAPSENSE_CDAC_MODE_AUTO) - The value of fine CDAC set automatically
* * bit[4..5] - Compensation CDAC mode (CY_CAPSENSE_CDAC_COMP_MODE_MASK)
* * 0 (CY_CAPSENSE_CDAC_MODE_DISABLED) - The compensation CDAC is disabled
* * 1 (CY_CAPSENSE_CDAC_MODE_MANUAL) - The value of compensation CDAC set manually
* * 2 (CY_CAPSENSE_CDAC_MODE_AUTO) - The value of compensation CDAC set automatically
* * bit[6..7] - Compensation CDAC divider mode (CY_CAPSENSE_CDAC_COMP_DIV_MODE_MASK)
* * 0 (CY_CAPSENSE_CDAC_MODE_MANUAL) - The value of compensation CDAC divider set manually
* * 2 (CY_CAPSENSE_CDAC_MODE_AUTO) - The value of compensation CDAC divider set automatically
* * bit[8..9] - Sensitivity boost (CY_CAPSENSE_CDAC_BOOST_VAL_MASK)
* * 1 (CY_CAPSENSE_CDAC_BOOST_DISABLED) - Boost disabled
* * 2 (CY_CAPSENSE_CDAC_BOOST_2X) - 2X Boost
* * 3 (CY_CAPSENSE_CDAC_BOOST_3X) - 3X Boost
* * 4 (CY_CAPSENSE_CDAC_BOOST_4X) - 4X Boost
* \note This field is available for the fifth-generation low power CAPSENSE™.
*/
uint16_t foamCoefficient; /**< Foam rejection coefficient. This decides the scanning cycle for foam sensing mechanism.
* \note This field is available for the fifth-generation low power CAPSENSE™.
*/
#endif
#if ((CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN) || (CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN_LP))
uint16_t firstSlotId; /**< The slot ID in the widget to start scan from
* \note This field is available for the fifth-generation CAPSENSE™ and fifth-generation low power CAPSENSE™.
*/
uint16_t numSlots; /**< The number of slots in the widget
* \note This field is available for the fifth-generation CAPSENSE™ and fifth-generation low power CAPSENSE™.
*/
#endif
uint8_t senseMethod; /**< Specifies the widget sensing method:
* * 0 - UNDEFINED (CY_CAPSENSE_UNDEFINED_GROUP)
* * 1 - CSD (CY_CAPSENSE_CSD_GROUP)
* * 2 - CSX (CY_CAPSENSE_CSX_GROUP)
* * 3 - ISX (CY_CAPSENSE_ISX_GROUP) */
uint8_t wdType; /**< Specifies the widget type */
#if ((CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN) || (CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN_LP))
uint8_t numChopCycles; /**< Defines number of chopping cycles. One cycle means the feature is disabled
* \note This field is available for the fifth-generation CAPSENSE™ and fifth-generation low power CAPSENSE™.
*/
uint8_t mpOrder; /**< Multi-phase order
* \note This field is available for the fifth-generation CAPSENSE™ and fifth-generation low power CAPSENSE™.
*/
#if (CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN_LP)
uint8_t mpOrderRows; /**< Multi-phase order for rows in CSD widgets
* \note This field is available for the fifth-generation low power CAPSENSE™.
*/
#endif
uint8_t lfsrDitherLimit; /**< Max dither in percentage. The input parameter for the LFSR range auto-selection algorithm
* \note This field is available for the fifth-generation CAPSENSE™and fifth-generation low power CAPSENSE™.
*/
uint8_t snsClkSourceAutoSelMode; /**< Defines set of rules that are used by clock source auto-selection algorithm
* \note This field is available for the fifth-generation CAPSENSE™ and fifth-generation low power CAPSENSE™.
*/
uint8_t mfsConfig; /**< Multi-frequency Scan (MFS) widget configuration
** Contains masks:
* * bit[0:3] - Number of MFS Channels (CY_CAPSENSE_MFS_FREQ_CHANNELS_NUM_MASK).
* * bit[4] - MFS Configuration (CY_CAPSENSE_MFS_EN_MASK):
* * 0 - MFS Disabled.
* * 1 - MFS Enabled (Base or Frequency channel widget).
* * bit[5:6] - Widget attribute (CY_CAPSENSE_MFS_WIDGET_FREQ_ALL_CH_MASK):
* * 0 - Base widget
* * 1 - Frequency channel 1 widget (CY_CAPSENSE_MFS_WIDGET_FREQ_CH_1_MASK)
* * 2 - Frequency channel 2 widget (CY_CAPSENSE_MFS_WIDGET_FREQ_CH_2_MASK)
* \note This field is available for the fifth-generation CAPSENSE™ and fifth-generation low power CAPSENSE™.
*/
uint8_t cdacDitherScaleMode; /**< CDAC dither scale mode
* * 0 (CY_CAPSENSE_CDAC_DITHERING_MODE_DISABLE) - CDAC dithering is disabled
* * 1 (CY_CAPSENSE_CDAC_DITHERING_MODE_MANUAL) - CDAC dither value set manually
* * 2 (CY_CAPSENSE_CDAC_DITHERING_MODE_AUTO) - CDAC dither value set automatically
* \note This field is available for the fifth-generation CAPSENSE™ and fifth-generation low power CAPSENSE™.
*/
#endif
#if (CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN_LP)
uint8_t cicRateMode; /**< CIC2 filter decimation rate mode
* * 0 (CY_CAPSENSE_CIC_RATE_MODE_MANUAL) - The cicRate value set by users
* * 1 (CY_CAPSENSE_CIC_RATE_MODE_AUTO) - The cicRate value configured by middleware
* * 2 (CY_CAPSENSE_CIC_RATE_MODE_SMARTSENSE) - The cicRate value configured by SMARTSENSE™ algorithm
* \note This field is available for the fifth-generation CAPSENSE™ and fifth-generation low power CAPSENSE™.
*/
uint8_t iirCoeffHw; /**< Raw count HW IIR filter coefficient. Smaller value leads to lower filtering.
* \note This field is available only for the fifth-generation low power CAPSENSE™.
*/
#endif
} cy_stc_capsense_widget_config_t;
#if (CY_CAPSENSE_PLATFORM_BLOCK_FOURTH_GEN)
/** Declares the IDAC gain table
* \note This structure is available only for the fourth-generation CAPSENSE™.
*/
typedef struct
{
uint32_t gainReg; /**< Register value of IDAC gain */
uint32_t gainValue; /**< Absolute gain value in pA */
} cy_stc_capsense_idac_gain_table_t;
#endif
#if ((CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN) || (CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN_LP))
/** Declares the scan order of widget and sensor
* \note This structure is available for the fifth-generation CAPSENSE™ and fifth-generation low power CAPSENSE™.
*/
typedef struct
{
uint16_t wdId; /**< Specifies the widget ID for the current scan slot */
uint16_t snsId; /**< Specifies the sensor ID for the current scan slot */
} cy_stc_capsense_scan_slot_t;
#endif
#if ((CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN) || (CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN_LP))
/** Declares MSC channel (HW block) configuration
* \note This structure is available for the fifth-generation CAPSENSE™ and fifth-generation low power CAPSENSE™.
*/
typedef struct
{
#if (CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN)
MSC_Type * ptrHwBase; /**< Pointer to the MSC HW block register
* \note This structure is available only for the fifth-generation CAPSENSE™
*/
cy_stc_msc_context_t * ptrHwContext; /**< Pointer to the MSC driver context
* \note This structure is available only for the fifth-generation CAPSENSE™
*/
#endif /* CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN */
#if (CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN_LP)
MSCLP_Type * ptrHwBase; /**< Pointer to the MSCLP HW block register
* \note This structure is available only for the fifth-generation low power CAPSENSE™
*/
cy_stc_msclp_context_t * ptrHwContext; /**< Pointer to the MSCLP driver context
* \note This structure is available only for the fifth-generation low power CAPSENSE™
*/
#endif /* CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN_LP */
GPIO_PRT_Type * portCmod1; /**< The pointer to the Cmod1 pin base port register */
uint8_t pinCmod1; /**< The Cmod1 pin position (bit number) in the port */
GPIO_PRT_Type * portCmod2; /**< The pointer to the Cmod2 pin base port register */
uint8_t pinCmod2; /**< The Cmod2 pin position (bit number) in the port */
#if (CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN)
uint8_t dmaWrChIndex; /**< Specifies the DMA Write channel index
* \note This structure is available only for the fifth-generation CAPSENSE™
*/
uint8_t dmaChainWrChIndex; /**< Specifies the DMA Chain Write channel index
* \note This structure is available only for the fifth-generation CAPSENSE™
*/
uint8_t dmaRdChIndex; /**< Specifies the DMA Read channel index
* \note This structure is available only for the fifth-generation CAPSENSE™
*/
uint8_t dmaChainRdChIndex; /**< Specifies the DMA Chain Read channel index
* \note This structure is available only for the fifth-generation CAPSENSE™
*/
#endif /* CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN */
const cy_stc_capsense_electrode_config_t * ptrShieldEltdConfig; /**< Pointer to the first object of shield electrode configuration */
} cy_stc_capsense_channel_config_t;
#endif /* CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN || CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN_LP */
/** Common configuration structure */
typedef struct
{
uint32_t cpuClkHz; /**< CPU clock in Hz */
uint32_t periClkHz; /**< Peripheral clock in Hz */
#if (CY_CAPSENSE_PLATFORM_BLOCK_FOURTH_GEN)
cy_stc_capsense_idac_gain_table_t idacGainTable[CY_CAPSENSE_IDAC_GAIN_TABLE_SIZE];
/**< Table with the supported IDAC gains and corresponding register values
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
CSD_Type * ptrCsdBase; /**< Pointer to the CSD HW block register
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
cy_stc_csd_context_t * ptrCsdContext; /**< Pointer to the CSD driver context
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
GPIO_PRT_Type * portCmod; /**< Pointer to the base port register of the Cmod pin
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
GPIO_PRT_Type * portCsh; /**< Pointer to the base port register of the Csh pin
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
GPIO_PRT_Type * portCintA; /**< Pointer to the base port register of the CintA pin
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
GPIO_PRT_Type * portCintB; /**< Pointer to the base port register of the CintB pin
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
#endif /* CY_CAPSENSE_PLATFORM_BLOCK_FOURTH_GEN */
#if ((CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN) || (CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN_LP))
cy_stc_capsense_channel_config_t * ptrChConfig; /**< The pointer to the CAPSENSE™ enabled channel (HW block) configuration
* \note This field is available for the fifth-generation CAPSENSE™ and fifth-generation low power CAPSENSE™.
*/
#endif /* (CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN) || (CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN_LP) */
#if (CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN)
DMAC_Type * ptrDmacBase; /**< Pointer to the DMAC HW block base register
* \note This field is available only for the fifth-generation CAPSENSE™.
*/
const uint32_t * const * ptrDmaWrChSnsCfgAddr; /**< Pointer to the array containing the addresses of sensor configurations
* used as a source for the DMA Chain Write channel
* \note This field is available only for the fifth-generation CAPSENSE™.
*/
const uint16_t * const * ptrDmaRdChSnsCfgAddr; /**< Pointer to the array containing the addresses of sensor configurations
* used as a source for the DMA Chain Read channel
* \note This field is available only for the fifth-generation CAPSENSE™.
*/
const uint32_t ** ptrDmaWrChSnsCfgAddrLocal; /**< Pointer to the array containing the addresses of sensor configurations
* used as a source for the DMA Chain Write channel
* \note This field is available only for the fifth-generation CAPSENSE™.
*/
const uint16_t ** ptrDmaRdChSnsCfgAddrLocal; /**< Pointer to the array containing the addresses of sensor configurations
* used as a source for the DMA Chain Read channel
* \note This field is available only for the fifth-generation CAPSENSE™.
*/
uint16_t * ptrEmptyRawCount; /**< Pointer to the empty storage for raw count in case widget is disabled.
* \note This field is available only for the fifth-generation CAPSENSE™.
*/
#endif /* CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN */
uint16_t numPin; /**< Total number of IOs. */
uint16_t numSns; /**< The total number of sensors. It is equal to the number of objects with raw count.
* * For CSD widgets: WD_NUM_ROWS + WD_NUM_COLS
* * For CSX widgets: WD_NUM_ROWS * WD_NUM_COLS */
uint16_t proxTouchCoeff; /**< Proximity touch coefficient in percentage used in smart sensing algorithm */
uint16_t csdRConst; /**< Sensor resistance in series used by smart sensing algorithm */
#if (CY_CAPSENSE_PLATFORM_BLOCK_FOURTH_GEN)
uint16_t vdda; /**< VDDA in mV */
uint16_t csdVref; /**< Vref for CSD method
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
#endif /* CY_CAPSENSE_PLATFORM_BLOCK_FOURTH_GEN */
#if ((CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN) || (CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN_LP))
uint16_t numEpiCycles; /**< Number of clk_mod cycles to be run during EPILOGUE
* \note This field is available for the fifth-generation CAPSENSE™ and fifth-generation low power CAPSENSE™.
*/
uint16_t numCoarseInitChargeCycles; /**< Configure duration of Cmod initialization, phase 1
* \note This field is available for the fifth-generation CAPSENSE™ and fifth-generation low power CAPSENSE™.
*/
uint16_t numCoarseInitSettleCycles; /**< Configure duration of Cmod initialization, phase 2
* \note This field is available for the fifth-generation CAPSENSE™ and fifth-generation low power CAPSENSE™.
*/
uint16_t numSlots; /**< Total number of slots
* \note This field is available for the fifth-generation CAPSENSE™ and fifth-generation low power CAPSENSE™.
*/
#endif /* (CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN) || (CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN_LP) */
#if (CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN_LP)
uint16_t numProWaitKrefDelayPrs; /**< Number of Kref/4 ProDummy Wait Cycles if PRS is enabled
* \note This field is available only for the fifth-generation low power CAPSENSE™.
*/
uint16_t numProWaitKrefDelay; /**< Number of Kref/4 ProDummy Wait Cycles if PRS is disabled
* \note This field is available only for the fifth-generation low power CAPSENSE™.
*/
uint16_t numEpiKrefDelayPrs; /**< Number of Kref/4 cycles to be run during EPILOGUE if PRS is enabled
* \note This field is available only for the fifth-generation low power CAPSENSE™.
*/
uint16_t numEpiKrefDelay; /**< Number of Kref/4 cycles to be run during EPILOGUE if PRS is disabled
* \note This field is available only for the fifth-generation pow power CAPSENSE™.
*/
#endif /* CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN_LP */
uint8_t numWd; /**< Total number of widgets */
uint8_t periDividerType; /**< Peripheral clock type (8- or 16-bit type) */
uint8_t periDividerIndex; /**< Peripheral divider index */
uint8_t analogWakeupDelay; /**< Time needed to establish correct operation of CAPSENSE™ HW block block after power up or System Deep Sleep. */
uint8_t swSensorAutoResetEn; /**< Sensor auto reset enabled */
uint8_t csdInactiveSnsConnection; /**< Inactive sensor connection for CSD scan:
* * CY_CAPSENSE_SNS_CONNECTION_HIGHZ
* * CY_CAPSENSE_SNS_CONNECTION_SHIELD
* * CY_CAPSENSE_SNS_CONNECTION_GROUND */
uint8_t csxInactiveSnsConnection; /**< Inactive sensor connection for CSX scan:
* * CY_CAPSENSE_SNS_CONNECTION_HIGHZ
* * CY_CAPSENSE_SNS_CONNECTION_GROUND
* * CY_CAPSENSE_SNS_CONNECTION_VDDA_BY_2
*
* CY_CAPSENSE_SNS_CONNECTION_VDDA_BY_2 is only available for fifth-generation
* and fifth-generation low power CAPSENSE™.
*/
uint8_t isxInactiveSnsConnection; /**< Inactive sensor connection for ISX scan:
* * CY_CAPSENSE_SNS_CONNECTION_HIGHZ
*
* Applicable only for fifth-generation low power CAPSENSE™.
*/
uint8_t csdShieldNumPin; /**< Number of shield IOs */
uint8_t csxRawTarget; /**< Raw count target in percentage for CSX calibration */
uint8_t csxCalibrationError; /**< Acceptable calibration error */
uint8_t csdRawTarget; /**< Raw count target in percentage for CSD calibration */
uint8_t csdCalibrationError; /**< Acceptable calibration error */
#if (CY_CAPSENSE_PLATFORM_BLOCK_FOURTH_GEN)
uint8_t ssIrefSource; /**< Iref source
* \note This field is available only for the fourth-generation CAPSENSE™.
* */
uint8_t ssVrefSource; /**< Vref source
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
uint8_t portCmodPadNum; /**< Number of port of dedicated Cmod pad
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
uint8_t pinCmodPad; /**< Position of the dedicated Cmod pad in the port
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
uint8_t portCshPadNum; /**< Number of port of dedicated Csh pad
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
uint8_t pinCshPad; /**< Position of the dedicated Csh pad in the port
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
uint8_t portShieldPadNum; /**< Number of port of dedicated Shield pad
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
uint8_t pinShieldPad; /**< Position of the dedicated Shield pad in the port
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
uint8_t portVrefExtPadNum; /**< Number of port of dedicated VrefExt pad
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
uint8_t pinVrefExtPad; /**< Position of the dedicated VrefExt pad in the port
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
uint8_t portCmodNum; /**< Number of port of Cmod pin
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
uint8_t pinCmod; /**< Position of the Cmod pin in the port
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
uint8_t portCshNum; /**< Number of port of Csh pin
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
uint8_t pinCsh; /**< Position of the Csh pin in the port
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
uint8_t pinCintA; /**< Position of the CintA pin in the port
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
uint8_t pinCintB; /**< Position of the CintB pin in the port
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
uint8_t csdShieldDelay; /**< Shield signal delay
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
uint8_t csdShieldSwRes; /**< Shield switch resistance
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
uint8_t csdInitSwRes; /**< Switch resistance at coarse initialization
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
uint8_t csdChargeTransfer; /**< IDAC sensing configuration
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
uint8_t csdIdacGainInitIndex; /**< IDAC gain index per \ref idacGainTable
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
uint8_t csdIdacMin; /**< Min acceptable IDAC value in CSD calibration
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
uint8_t csdFineInitTime; /**< Number of dummy SnsClk periods at fine initialization
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
uint8_t csdMfsDividerOffsetF1; /**< Frequency divider offset for channel 1. This value is added to
* base (channel 0) SnsClk divider to form channel 1 frequency
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
uint8_t csdMfsDividerOffsetF2; /**< Frequency divider offset for channel 2. This value is added to
* base (channel 0) SnsClk divider to form channel 2 frequency
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
uint8_t csxFineInitTime; /**< Number of dummy TX periods at fine initialization
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
uint8_t csxInitSwRes; /**< Switch resistance at fine initialization
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
uint8_t csxScanSwRes; /**< Switch resistance at scanning
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
uint8_t csxInitShieldSwRes; /**< Switch resistance at fine initialization
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
uint8_t csxScanShieldSwRes; /**< Switch resistance at scanning
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
uint8_t csxMfsDividerOffsetF1; /**< Frequency divider offset for channel 1. This value is added to
* base (channel 0) Tx divider to form channel 1 frequency
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
uint8_t csxMfsDividerOffsetF2; /**< Frequency divider offset for channel 2. This value is added to
* base (channel 0) Tx divider to form channel 2 frequency
* \note This field is available only for the fourth-generation CAPSENSE™.
*/
#endif
#if ((CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN) || (CY_CAPSENSE_PLATFORM_BLOCK_FIFTH_GEN_LP))
uint8_t isxRawTarget; /**< Raw count target in percentage for ISX calibration
* \note This structure is available only for the fifth-generation low power CAPSENSE™
*/
uint8_t isxCalibrationError; /**< Acceptable calibration error
* \note This structure is available only for the fifth-generation low power CAPSENSE™
*/
uint8_t csdShieldMode; /**< Shield mode