Andrew Reed
/
CITY1082-capsense-tft
Capsense buttons and Slider, output to Serial over i2c and tft display
cycfg_capsense.c@1:cf461b359823, 2019-12-02 (annotated)
- Committer:
- reedas
- Date:
- Mon Dec 02 22:55:59 2019 +0000
- Revision:
- 1:cf461b359823
Example of Capacitive Sensitive Buttons and slider from MBED example
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
reedas | 1:cf461b359823 | 1 | /******************************************************************************* |
reedas | 1:cf461b359823 | 2 | * File Name: cycfg_capsense.c |
reedas | 1:cf461b359823 | 3 | * Version: 2.0 |
reedas | 1:cf461b359823 | 4 | * |
reedas | 1:cf461b359823 | 5 | * Description: |
reedas | 1:cf461b359823 | 6 | * CapSense middleware configuration |
reedas | 1:cf461b359823 | 7 | * This file should not be modified. It was automatically generated by |
reedas | 1:cf461b359823 | 8 | * CapSense Configurator 2.0.0 build 566 |
reedas | 1:cf461b359823 | 9 | * |
reedas | 1:cf461b359823 | 10 | ******************************************************************************** |
reedas | 1:cf461b359823 | 11 | * Copyright 2019 Cypress Semiconductor Corporation |
reedas | 1:cf461b359823 | 12 | * SPDX-License-Identifier: Apache-2.0 |
reedas | 1:cf461b359823 | 13 | * |
reedas | 1:cf461b359823 | 14 | * Licensed under the Apache License, Version 2.0 (the "License"); |
reedas | 1:cf461b359823 | 15 | * you may not use this file except in compliance with the License. |
reedas | 1:cf461b359823 | 16 | * You may obtain a copy of the License at |
reedas | 1:cf461b359823 | 17 | * |
reedas | 1:cf461b359823 | 18 | * http://www.apache.org/licenses/LICENSE-2.0 |
reedas | 1:cf461b359823 | 19 | * |
reedas | 1:cf461b359823 | 20 | * Unless required by applicable law or agreed to in writing, software |
reedas | 1:cf461b359823 | 21 | * distributed under the License is distributed on an "AS IS" BASIS, |
reedas | 1:cf461b359823 | 22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
reedas | 1:cf461b359823 | 23 | * See the License for the specific language governing permissions and |
reedas | 1:cf461b359823 | 24 | * limitations under the License. |
reedas | 1:cf461b359823 | 25 | *******************************************************************************/ |
reedas | 1:cf461b359823 | 26 | |
reedas | 1:cf461b359823 | 27 | #include "cycfg_capsense.h" |
reedas | 1:cf461b359823 | 28 | |
reedas | 1:cf461b359823 | 29 | #if (CY_CAPSENSE_CORE == __CORTEX_M) |
reedas | 1:cf461b359823 | 30 | |
reedas | 1:cf461b359823 | 31 | #ifndef CSD_CMODPADS_PORT |
reedas | 1:cf461b359823 | 32 | #define CSD_CMODPADS_PORT 0xFF |
reedas | 1:cf461b359823 | 33 | #endif |
reedas | 1:cf461b359823 | 34 | #ifndef CSD_CMODPADS_PIN |
reedas | 1:cf461b359823 | 35 | #define CSD_CMODPADS_PIN 0xFF |
reedas | 1:cf461b359823 | 36 | #endif |
reedas | 1:cf461b359823 | 37 | #ifndef CSD_CSH_TANKPADS_PORT |
reedas | 1:cf461b359823 | 38 | #define CSD_CSH_TANKPADS_PORT 0xFF |
reedas | 1:cf461b359823 | 39 | #endif |
reedas | 1:cf461b359823 | 40 | #ifndef CSD_CSH_TANKPADS_PIN |
reedas | 1:cf461b359823 | 41 | #define CSD_CSH_TANKPADS_PIN 0xFF |
reedas | 1:cf461b359823 | 42 | #endif |
reedas | 1:cf461b359823 | 43 | #ifndef CSD_CSHIELDPADS_PORT |
reedas | 1:cf461b359823 | 44 | #define CSD_CSHIELDPADS_PORT 0xFF |
reedas | 1:cf461b359823 | 45 | #endif |
reedas | 1:cf461b359823 | 46 | #ifndef CSD_CSHIELDPADS_PIN |
reedas | 1:cf461b359823 | 47 | #define CSD_CSHIELDPADS_PIN 0xFF |
reedas | 1:cf461b359823 | 48 | #endif |
reedas | 1:cf461b359823 | 49 | #ifndef CSD_VREF_EXT_PORT |
reedas | 1:cf461b359823 | 50 | #define CSD_VREF_EXT_PORT 0xFF |
reedas | 1:cf461b359823 | 51 | #endif |
reedas | 1:cf461b359823 | 52 | #ifndef CSD_VREF_EXT_PIN |
reedas | 1:cf461b359823 | 53 | #define CSD_VREF_EXT_PIN 0xFF |
reedas | 1:cf461b359823 | 54 | #endif |
reedas | 1:cf461b359823 | 55 | |
reedas | 1:cf461b359823 | 56 | #define CY_CAPSENSE_WIDGET_COUNT (3u) |
reedas | 1:cf461b359823 | 57 | #define CY_CAPSENSE_SENSOR_COUNT (7u) |
reedas | 1:cf461b359823 | 58 | #define CY_CAPSENSE_ELTD_COUNT (9u) |
reedas | 1:cf461b359823 | 59 | #define CY_CAPSENSE_PIN_COUNT (9u) |
reedas | 1:cf461b359823 | 60 | #define CY_CAPSENSE_SHIELD_PIN_COUNT (0u) |
reedas | 1:cf461b359823 | 61 | #define CY_CAPSENSE_POSITION_SIZE (1u) |
reedas | 1:cf461b359823 | 62 | #define CY_CAPSENSE_DEBOUNCE_SIZE (3u) |
reedas | 1:cf461b359823 | 63 | #define CY_CAPSENSE_NOISE_ENVELOPE_SIZE (0u) |
reedas | 1:cf461b359823 | 64 | #define CY_CAPSENSE_RAW_HISTORY_SIZE (0u) |
reedas | 1:cf461b359823 | 65 | #define CY_CAPSENSE_IIR_HISTORY_LOW_SIZE (0u) |
reedas | 1:cf461b359823 | 66 | #define CY_CAPSENSE_POSITION_FILTER_HISTORY_SIZE (1u) |
reedas | 1:cf461b359823 | 67 | #define CY_CAPSENSE_TOUCH_FILTER_HISTORY_SIZE (1u) |
reedas | 1:cf461b359823 | 68 | #define CY_CAPSENSE_DIPLEX_SIZE (0u) |
reedas | 1:cf461b359823 | 69 | #define CY_CAPSENSE_CSD_TOUCHPAD_MAX_SENSORS_SIZE (0u) |
reedas | 1:cf461b359823 | 70 | #define CY_CAPSENSE_CSX_TOUCH_BUFFER_ENABLE (0u) |
reedas | 1:cf461b359823 | 71 | #define CY_CAPSENSE_CSX_TOUCH_HISTORY_SIZE (0u) |
reedas | 1:cf461b359823 | 72 | #define CY_CAPSENSE_BALLISTIC_WIDGET_COUNT (0u) |
reedas | 1:cf461b359823 | 73 | #define CY_CAPSENSE_GESTURE_WIDGET_COUNT (0u) |
reedas | 1:cf461b359823 | 74 | |
reedas | 1:cf461b359823 | 75 | static cy_stc_capsense_internal_context_t cy_capsense_internalContext; |
reedas | 1:cf461b359823 | 76 | static cy_stc_active_scan_sns_t cy_capsense_activeScanSns; |
reedas | 1:cf461b359823 | 77 | |
reedas | 1:cf461b359823 | 78 | #if (CY_CAPSENSE_DEBOUNCE_SIZE > 0) |
reedas | 1:cf461b359823 | 79 | static uint8_t cy_capsense_debounce[CY_CAPSENSE_DEBOUNCE_SIZE] = {0}; |
reedas | 1:cf461b359823 | 80 | #endif |
reedas | 1:cf461b359823 | 81 | |
reedas | 1:cf461b359823 | 82 | #if (CY_CAPSENSE_NOISE_ENVELOPE_SIZE > 0) |
reedas | 1:cf461b359823 | 83 | static cy_stc_capsense_smartsense_csd_noise_envelope_t cy_capsense_noiseEnvelope[CY_CAPSENSE_NOISE_ENVELOPE_SIZE]; |
reedas | 1:cf461b359823 | 84 | #endif |
reedas | 1:cf461b359823 | 85 | |
reedas | 1:cf461b359823 | 86 | #if (CY_CAPSENSE_RAW_HISTORY_SIZE > 0) |
reedas | 1:cf461b359823 | 87 | static uint16_t cy_capsense_rawFilterHistory[CY_CAPSENSE_RAW_HISTORY_SIZE] = {0}; |
reedas | 1:cf461b359823 | 88 | #endif |
reedas | 1:cf461b359823 | 89 | |
reedas | 1:cf461b359823 | 90 | #if (CY_CAPSENSE_IIR_HISTORY_LOW_SIZE > 0) |
reedas | 1:cf461b359823 | 91 | static uint8_t cy_capsense_iirHistoryLow[CY_CAPSENSE_IIR_HISTORY_LOW_SIZE] = {0}; |
reedas | 1:cf461b359823 | 92 | #endif |
reedas | 1:cf461b359823 | 93 | |
reedas | 1:cf461b359823 | 94 | #if (CY_CAPSENSE_POSITION_FILTER_HISTORY_SIZE > 0) |
reedas | 1:cf461b359823 | 95 | static cy_stc_capsense_position_t cy_capsense_positionFilterHistory[CY_CAPSENSE_POSITION_FILTER_HISTORY_SIZE]; |
reedas | 1:cf461b359823 | 96 | #endif |
reedas | 1:cf461b359823 | 97 | |
reedas | 1:cf461b359823 | 98 | #if (CY_CAPSENSE_TOUCH_FILTER_HISTORY_SIZE > 0) |
reedas | 1:cf461b359823 | 99 | static cy_stc_capsense_touch_t cy_capsense_touchFilterHistory[CY_CAPSENSE_TOUCH_FILTER_HISTORY_SIZE] = |
reedas | 1:cf461b359823 | 100 | { |
reedas | 1:cf461b359823 | 101 | { |
reedas | 1:cf461b359823 | 102 | .ptrPosition = &cy_capsense_positionFilterHistory[0u], |
reedas | 1:cf461b359823 | 103 | .numPosition = 0u, }, |
reedas | 1:cf461b359823 | 104 | }; |
reedas | 1:cf461b359823 | 105 | #endif |
reedas | 1:cf461b359823 | 106 | |
reedas | 1:cf461b359823 | 107 | #if (CY_CAPSENSE_DIPLEX_SIZE > 0) |
reedas | 1:cf461b359823 | 108 | static const uint8_t cy_capsense_diplexTable[CY_CAPSENSE_DIPLEX_SIZE] = |
reedas | 1:cf461b359823 | 109 | { |
reedas | 1:cf461b359823 | 110 | }; |
reedas | 1:cf461b359823 | 111 | #endif |
reedas | 1:cf461b359823 | 112 | |
reedas | 1:cf461b359823 | 113 | #if (CY_CAPSENSE_CSD_TOUCHPAD_MAX_SENSORS_SIZE > 0) |
reedas | 1:cf461b359823 | 114 | static uint16 cy_capsense_csdTouchBuffer[CY_CAPSENSE_CSD_TOUCHPAD_MAX_SENSORS_SIZE] = {0}; |
reedas | 1:cf461b359823 | 115 | #endif |
reedas | 1:cf461b359823 | 116 | |
reedas | 1:cf461b359823 | 117 | #if (CY_CAPSENSE_CSX_TOUCH_BUFFER_ENABLE > 0) |
reedas | 1:cf461b359823 | 118 | static cy_stc_capsense_csx_touch_buffer_t cy_capsense_csxTouchBuffer; |
reedas | 1:cf461b359823 | 119 | #endif |
reedas | 1:cf461b359823 | 120 | |
reedas | 1:cf461b359823 | 121 | #if (CY_CAPSENSE_CSX_TOUCH_HISTORY_SIZE > 0) |
reedas | 1:cf461b359823 | 122 | static cy_stc_capsense_csx_touch_history_t cy_capsense_csxTouchHistory[CY_CAPSENSE_CSX_TOUCH_HISTORY_SIZE] = |
reedas | 1:cf461b359823 | 123 | { |
reedas | 1:cf461b359823 | 124 | }; |
reedas | 1:cf461b359823 | 125 | #endif |
reedas | 1:cf461b359823 | 126 | |
reedas | 1:cf461b359823 | 127 | #if (CY_CAPSENSE_BALLISTIC_WIDGET_COUNT > 0) |
reedas | 1:cf461b359823 | 128 | static cy_stc_capsense_ballistic_context_t cy_capsense_ballisticContext[CY_CAPSENSE_BALLISTIC_WIDGET_COUNT]; |
reedas | 1:cf461b359823 | 129 | #endif |
reedas | 1:cf461b359823 | 130 | |
reedas | 1:cf461b359823 | 131 | #if (CY_CAPSENSE_GESTURE_WIDGET_COUNT > 0) |
reedas | 1:cf461b359823 | 132 | static cy_stc_capsense_gesture_context_t cy_capsense_gestureContext[CY_CAPSENSE_GESTURE_WIDGET_COUNT]; |
reedas | 1:cf461b359823 | 133 | #endif |
reedas | 1:cf461b359823 | 134 | |
reedas | 1:cf461b359823 | 135 | static const cy_stc_capsense_common_config_t cy_capsense_commonConfig = |
reedas | 1:cf461b359823 | 136 | { |
reedas | 1:cf461b359823 | 137 | .cpuClkHz = CY_CAPSENSE_CPU_CLK, |
reedas | 1:cf461b359823 | 138 | .periClkHz = CY_CAPSENSE_PERI_CLK, |
reedas | 1:cf461b359823 | 139 | .vdda = CY_CAPSENSE_VDDA_MV, |
reedas | 1:cf461b359823 | 140 | .numPin = CY_CAPSENSE_PIN_COUNT, |
reedas | 1:cf461b359823 | 141 | .numSns = CY_CAPSENSE_SENSOR_COUNT, |
reedas | 1:cf461b359823 | 142 | .numWd = CY_CAPSENSE_WIDGET_COUNT, |
reedas | 1:cf461b359823 | 143 | .csdEn = CY_CAPSENSE_ENABLE, |
reedas | 1:cf461b359823 | 144 | .csxEn = CY_CAPSENSE_ENABLE, |
reedas | 1:cf461b359823 | 145 | .mfsEn = CY_CAPSENSE_DISABLE, |
reedas | 1:cf461b359823 | 146 | .positionFilterEn = CY_CAPSENSE_ENABLE, |
reedas | 1:cf461b359823 | 147 | .periDividerType = CY_CAPSENSE_PERI_DIV_TYPE, |
reedas | 1:cf461b359823 | 148 | .periDividerIndex = CY_CAPSENSE_PERI_DIV_INDEX, |
reedas | 1:cf461b359823 | 149 | .analogWakeupDelay = 25u, |
reedas | 1:cf461b359823 | 150 | .ssIrefSource = CY_CAPSENSE_IREF_SRSS, |
reedas | 1:cf461b359823 | 151 | .ssVrefSource = CY_CAPSENSE_VREF_SRSS, |
reedas | 1:cf461b359823 | 152 | .proxTouchCoeff = 300u, |
reedas | 1:cf461b359823 | 153 | .swSensorAutoResetEn = CY_CAPSENSE_DISABLE, |
reedas | 1:cf461b359823 | 154 | .portCmodPadNum = CSD_CMODPADS_PORT, |
reedas | 1:cf461b359823 | 155 | .pinCmodPad = CSD_CMODPADS_PIN, |
reedas | 1:cf461b359823 | 156 | .portCshPadNum = CSD_CSH_TANKPADS_PORT, |
reedas | 1:cf461b359823 | 157 | .pinCshPad = CSD_CSH_TANKPADS_PIN, |
reedas | 1:cf461b359823 | 158 | .portShieldPadNum = CSD_CSHIELDPADS_PORT, |
reedas | 1:cf461b359823 | 159 | .pinShieldPad = CSD_CSHIELDPADS_PIN, |
reedas | 1:cf461b359823 | 160 | .portVrefExtPadNum = CSD_VREF_EXT_PORT, |
reedas | 1:cf461b359823 | 161 | .pinVrefExtPad = CSD_VREF_EXT_PIN, |
reedas | 1:cf461b359823 | 162 | .portCmodNum = Cmod_PORT_NUM, |
reedas | 1:cf461b359823 | 163 | .idacGainTable = { |
reedas | 1:cf461b359823 | 164 | {0x01000000u, 37500u}, |
reedas | 1:cf461b359823 | 165 | {0x03000000u, 75000u}, |
reedas | 1:cf461b359823 | 166 | {0x01400000u, 300000u}, |
reedas | 1:cf461b359823 | 167 | {0x03400000u, 600000u}, |
reedas | 1:cf461b359823 | 168 | {0x01800000u, 2400000u}, |
reedas | 1:cf461b359823 | 169 | {0x03800000u, 4800000u}, |
reedas | 1:cf461b359823 | 170 | }, |
reedas | 1:cf461b359823 | 171 | .ptrCsdBase = CSD0, |
reedas | 1:cf461b359823 | 172 | .ptrCsdContext = &cy_csd_0_context, |
reedas | 1:cf461b359823 | 173 | .portCmod = Cmod_PORT, |
reedas | 1:cf461b359823 | 174 | .portCsh = NULL, |
reedas | 1:cf461b359823 | 175 | .portCintA = CintA_PORT, |
reedas | 1:cf461b359823 | 176 | .portCintB = CintB_PORT, |
reedas | 1:cf461b359823 | 177 | .pinCmod = Cmod_PIN, |
reedas | 1:cf461b359823 | 178 | .portCshNum = 0u, |
reedas | 1:cf461b359823 | 179 | .pinCsh = 0u, |
reedas | 1:cf461b359823 | 180 | .pinCintA = CintA_PIN, |
reedas | 1:cf461b359823 | 181 | .pinCintB = CintB_PIN, |
reedas | 1:cf461b359823 | 182 | .csdShieldEn = CY_CAPSENSE_DISABLE, |
reedas | 1:cf461b359823 | 183 | .csdInactiveSnsConnection = CY_CAPSENSE_SNS_CONNECTION_GROUND, |
reedas | 1:cf461b359823 | 184 | .csdShieldDelay = CY_CAPSENSE_SH_DELAY_0NS, |
reedas | 1:cf461b359823 | 185 | .csdVref = 0u, |
reedas | 1:cf461b359823 | 186 | .csdRConst = 1000u, |
reedas | 1:cf461b359823 | 187 | .csdCTankShieldEn = CY_CAPSENSE_DISABLE, |
reedas | 1:cf461b359823 | 188 | .csdShieldNumPin = 0u, |
reedas | 1:cf461b359823 | 189 | .csdShieldSwRes = CY_CAPSENSE_SHIELD_SW_RES_MEDIUM, |
reedas | 1:cf461b359823 | 190 | .csdInitSwRes = CY_CAPSENSE_INIT_SW_RES_MEDIUM, |
reedas | 1:cf461b359823 | 191 | .csdChargeTransfer = CY_CAPSENSE_IDAC_SOURCING, |
reedas | 1:cf461b359823 | 192 | .csdRawTarget = 85u, |
reedas | 1:cf461b359823 | 193 | .csdAutotuneEn = CY_CAPSENSE_CSD_SS_DIS, |
reedas | 1:cf461b359823 | 194 | .csdIdacAutocalEn = CY_CAPSENSE_ENABLE, |
reedas | 1:cf461b359823 | 195 | .csdIdacAutoGainEn = CY_CAPSENSE_ENABLE, |
reedas | 1:cf461b359823 | 196 | .csdCalibrationError = 10u, |
reedas | 1:cf461b359823 | 197 | .csdIdacGainInitIndex = 4u, |
reedas | 1:cf461b359823 | 198 | .csdIdacMin = 20u, |
reedas | 1:cf461b359823 | 199 | .csdIdacCompEn = CY_CAPSENSE_ENABLE, |
reedas | 1:cf461b359823 | 200 | .csdFineInitTime = 10u, |
reedas | 1:cf461b359823 | 201 | .csdIdacRowColAlignEn = CY_CAPSENSE_ENABLE, |
reedas | 1:cf461b359823 | 202 | .csdMfsDividerOffsetF1 = 1u, |
reedas | 1:cf461b359823 | 203 | .csdMfsDividerOffsetF2 = 2u, |
reedas | 1:cf461b359823 | 204 | .csxRawTarget = 40u, |
reedas | 1:cf461b359823 | 205 | .csxIdacGainInitIndex = 2u, |
reedas | 1:cf461b359823 | 206 | .csxIdacAutocalEn = CY_CAPSENSE_ENABLE, |
reedas | 1:cf461b359823 | 207 | .csxCalibrationError = 20u, |
reedas | 1:cf461b359823 | 208 | .csxFineInitTime = 10u, |
reedas | 1:cf461b359823 | 209 | .csxInitSwRes = CY_CAPSENSE_INIT_SW_RES_MEDIUM, |
reedas | 1:cf461b359823 | 210 | .csxScanSwRes = CY_CAPSENSE_INIT_SW_RES_MEDIUM, |
reedas | 1:cf461b359823 | 211 | .csxInitShieldSwRes = CY_CAPSENSE_SHIELD_SW_RES_MEDIUM, |
reedas | 1:cf461b359823 | 212 | .csxScanShieldSwRes = CY_CAPSENSE_SHIELD_SW_RES_MEDIUM, |
reedas | 1:cf461b359823 | 213 | .csxMfsDividerOffsetF1 = 1u, |
reedas | 1:cf461b359823 | 214 | .csxMfsDividerOffsetF2 = 2u, |
reedas | 1:cf461b359823 | 215 | }; |
reedas | 1:cf461b359823 | 216 | |
reedas | 1:cf461b359823 | 217 | static const cy_stc_capsense_fptr_config_t cy_capsense_fptrConfig = |
reedas | 1:cf461b359823 | 218 | { |
reedas | 1:cf461b359823 | 219 | #if (CY_CAPSENSE_CSD_EN == 0) |
reedas | 1:cf461b359823 | 220 | .fptrCSDSetupWidget = NULL, |
reedas | 1:cf461b359823 | 221 | .fptrCSDScan = NULL, |
reedas | 1:cf461b359823 | 222 | .fptrDpProcessCsdWidgetRawCounts = NULL, |
reedas | 1:cf461b359823 | 223 | .fptrDpProcessCsdWidgetStatus = NULL, |
reedas | 1:cf461b359823 | 224 | .fptrCSDDisableMode = NULL, |
reedas | 1:cf461b359823 | 225 | .fptrCSDInitialize = NULL, |
reedas | 1:cf461b359823 | 226 | .fptrCSDScanISR = NULL, |
reedas | 1:cf461b359823 | 227 | #else |
reedas | 1:cf461b359823 | 228 | .fptrCSDSetupWidget = &Cy_CapSense_CSDSetupWidget, |
reedas | 1:cf461b359823 | 229 | .fptrCSDScan = &Cy_CapSense_CSDScan, |
reedas | 1:cf461b359823 | 230 | .fptrDpProcessCsdWidgetRawCounts = &Cy_CapSense_DpProcessCsdWidgetRawCounts, |
reedas | 1:cf461b359823 | 231 | .fptrDpProcessCsdWidgetStatus = &Cy_CapSense_DpProcessCsdWidgetStatus, |
reedas | 1:cf461b359823 | 232 | .fptrCSDDisableMode = &Cy_CapSense_CSDDisableMode, |
reedas | 1:cf461b359823 | 233 | .fptrCSDInitialize = &Cy_CapSense_CSDInitialize, |
reedas | 1:cf461b359823 | 234 | .fptrCSDScanISR = &Cy_CapSense_CSDScanISR, |
reedas | 1:cf461b359823 | 235 | #endif |
reedas | 1:cf461b359823 | 236 | |
reedas | 1:cf461b359823 | 237 | #if (CY_CAPSENSE_CSX_EN == 0) |
reedas | 1:cf461b359823 | 238 | .fptrCSXSetupWidget = NULL, |
reedas | 1:cf461b359823 | 239 | .fptrCSXScan = NULL, |
reedas | 1:cf461b359823 | 240 | .fptrDpProcessCsxWidgetRawCounts = NULL, |
reedas | 1:cf461b359823 | 241 | .fptrDpProcessCsxWidgetStatus = NULL, |
reedas | 1:cf461b359823 | 242 | .fptrCSXInitialize = NULL, |
reedas | 1:cf461b359823 | 243 | .fptrCSXDisableMode = NULL, |
reedas | 1:cf461b359823 | 244 | .fptrCSXScanISR = NULL, |
reedas | 1:cf461b359823 | 245 | #else |
reedas | 1:cf461b359823 | 246 | .fptrCSXSetupWidget = &Cy_CapSense_CSXSetupWidget, |
reedas | 1:cf461b359823 | 247 | .fptrCSXScan = &Cy_CapSense_CSXScan, |
reedas | 1:cf461b359823 | 248 | .fptrDpProcessCsxWidgetRawCounts = &Cy_CapSense_DpProcessCsxWidgetRawCounts, |
reedas | 1:cf461b359823 | 249 | .fptrDpProcessCsxWidgetStatus = &Cy_CapSense_DpProcessCsxWidgetStatus, |
reedas | 1:cf461b359823 | 250 | .fptrCSXInitialize = &Cy_CapSense_CSXInitialize, |
reedas | 1:cf461b359823 | 251 | .fptrCSXDisableMode = &Cy_CapSense_CSXDisableMode, |
reedas | 1:cf461b359823 | 252 | .fptrCSXScanISR = &Cy_CapSense_CSXScanISR, |
reedas | 1:cf461b359823 | 253 | #endif |
reedas | 1:cf461b359823 | 254 | |
reedas | 1:cf461b359823 | 255 | #if (CY_CAPSENSE_ADAPTIVE_FILTER_EN == 0) |
reedas | 1:cf461b359823 | 256 | .fptrAdaptiveFilterInitializeLib = NULL, |
reedas | 1:cf461b359823 | 257 | .fptrAdaptiveFilterRunLib = NULL, |
reedas | 1:cf461b359823 | 258 | #else |
reedas | 1:cf461b359823 | 259 | .fptrAdaptiveFilterInitializeLib = &Cy_CapSense_AdaptiveFilterInitialize_Lib, |
reedas | 1:cf461b359823 | 260 | .fptrAdaptiveFilterRunLib = &Cy_CapSense_AdaptiveFilterRun_Lib, |
reedas | 1:cf461b359823 | 261 | #endif |
reedas | 1:cf461b359823 | 262 | |
reedas | 1:cf461b359823 | 263 | #if (CY_CAPSENSE_BALLISTIC_MULTIPLIER_EN == 0) |
reedas | 1:cf461b359823 | 264 | .fptrBallisticMultiplierLib = NULL, |
reedas | 1:cf461b359823 | 265 | #else |
reedas | 1:cf461b359823 | 266 | .fptrBallisticMultiplierLib = &Cy_CapSense_BallisticMultiplier_Lib, |
reedas | 1:cf461b359823 | 267 | #endif |
reedas | 1:cf461b359823 | 268 | |
reedas | 1:cf461b359823 | 269 | #if (CY_CAPSENSE_RAWCOUNT_FILTER_EN == 0) |
reedas | 1:cf461b359823 | 270 | .fptrInitializeAllFilters = NULL, |
reedas | 1:cf461b359823 | 271 | .fptrFtRunEnabledFiltersInternal = NULL, |
reedas | 1:cf461b359823 | 272 | #else |
reedas | 1:cf461b359823 | 273 | .fptrInitializeAllFilters = &Cy_CapSense_InitializeAllFilters, |
reedas | 1:cf461b359823 | 274 | .fptrFtRunEnabledFiltersInternal = &Cy_CapSense_FtRunEnabledFiltersInternal, |
reedas | 1:cf461b359823 | 275 | #endif |
reedas | 1:cf461b359823 | 276 | |
reedas | 1:cf461b359823 | 277 | #if (CY_CAPSENSE_CSD_POSITION_FILTER_EN == 0) |
reedas | 1:cf461b359823 | 278 | .fptrProcessPositionFilters = NULL, |
reedas | 1:cf461b359823 | 279 | #else |
reedas | 1:cf461b359823 | 280 | .fptrProcessPositionFilters = &Cy_CapSense_ProcessPositionFilters, |
reedas | 1:cf461b359823 | 281 | #endif |
reedas | 1:cf461b359823 | 282 | |
reedas | 1:cf461b359823 | 283 | #if ((CY_CAPSENSE_CSX_POSITION_FILTER_EN == 0) && (CY_CAPSENSE_CSD_POSITION_FILTER_EN == 0)) |
reedas | 1:cf461b359823 | 284 | .fptrRunPositionFilters = NULL, |
reedas | 1:cf461b359823 | 285 | .fptrInitPositionFilters = NULL, |
reedas | 1:cf461b359823 | 286 | #else |
reedas | 1:cf461b359823 | 287 | .fptrRunPositionFilters = &Cy_CapSense_RunPositionFilters, |
reedas | 1:cf461b359823 | 288 | .fptrInitPositionFilters = &Cy_CapSense_InitPositionFilters, |
reedas | 1:cf461b359823 | 289 | #endif |
reedas | 1:cf461b359823 | 290 | |
reedas | 1:cf461b359823 | 291 | #if ((CY_CAPSENSE_CSD_BUTTON_EN == 0) && \ |
reedas | 1:cf461b359823 | 292 | (CY_CAPSENSE_CSX_BUTTON_EN == 0) && (CY_CAPSENSE_CSX_MATRIX_EN == 0)) |
reedas | 1:cf461b359823 | 293 | .fptrDpProcessButton = NULL, |
reedas | 1:cf461b359823 | 294 | #else |
reedas | 1:cf461b359823 | 295 | .fptrDpProcessButton = &Cy_CapSense_DpProcessButton, |
reedas | 1:cf461b359823 | 296 | #endif |
reedas | 1:cf461b359823 | 297 | |
reedas | 1:cf461b359823 | 298 | #if (CY_CAPSENSE_CSD_SLIDER_EN == 0) |
reedas | 1:cf461b359823 | 299 | .fptrDpProcessSlider = NULL, |
reedas | 1:cf461b359823 | 300 | #else |
reedas | 1:cf461b359823 | 301 | .fptrDpProcessSlider = &Cy_CapSense_DpProcessSlider, |
reedas | 1:cf461b359823 | 302 | #endif |
reedas | 1:cf461b359823 | 303 | |
reedas | 1:cf461b359823 | 304 | #if (CY_CAPSENSE_CSD_MATRIX_EN == 0) |
reedas | 1:cf461b359823 | 305 | .fptrDpProcessCsdMatrix = NULL, |
reedas | 1:cf461b359823 | 306 | #else |
reedas | 1:cf461b359823 | 307 | .fptrDpProcessCsdMatrix = &Cy_CapSense_DpProcessCsdMatrix, |
reedas | 1:cf461b359823 | 308 | #endif |
reedas | 1:cf461b359823 | 309 | |
reedas | 1:cf461b359823 | 310 | #if (CY_CAPSENSE_CSD_TOUCHPAD_EN == 0) |
reedas | 1:cf461b359823 | 311 | .fptrDpProcessCsdTouchpad = NULL, |
reedas | 1:cf461b359823 | 312 | #else |
reedas | 1:cf461b359823 | 313 | .fptrDpProcessCsdTouchpad = &Cy_CapSense_DpProcessCsdTouchpad, |
reedas | 1:cf461b359823 | 314 | #endif |
reedas | 1:cf461b359823 | 315 | |
reedas | 1:cf461b359823 | 316 | #if (CY_CAPSENSE_CSD_PROXIMITY_EN == 0) |
reedas | 1:cf461b359823 | 317 | .fptrDpProcessProximity = NULL, |
reedas | 1:cf461b359823 | 318 | #else |
reedas | 1:cf461b359823 | 319 | .fptrDpProcessProximity = &Cy_CapSense_DpProcessProximity, |
reedas | 1:cf461b359823 | 320 | #endif |
reedas | 1:cf461b359823 | 321 | |
reedas | 1:cf461b359823 | 322 | #if (CY_CAPSENSE_CSX_TOUCHPAD_EN == 0) |
reedas | 1:cf461b359823 | 323 | .fptrDpProcessCsxTouchpad = NULL, |
reedas | 1:cf461b359823 | 324 | #else |
reedas | 1:cf461b359823 | 325 | .fptrDpProcessCsxTouchpad = &Cy_CapSense_DpProcessCsxTouchpad, |
reedas | 1:cf461b359823 | 326 | #endif |
reedas | 1:cf461b359823 | 327 | |
reedas | 1:cf461b359823 | 328 | #if (CY_CAPSENSE_ADVANCED_CENTROID_5X5_EN == 0) |
reedas | 1:cf461b359823 | 329 | .fptrDpAdvancedCentroidTouchpad = NULL, |
reedas | 1:cf461b359823 | 330 | #else |
reedas | 1:cf461b359823 | 331 | .fptrDpAdvancedCentroidTouchpad = &Cy_CapSense_DpAdvancedCentroidTouchpad, |
reedas | 1:cf461b359823 | 332 | #endif |
reedas | 1:cf461b359823 | 333 | |
reedas | 1:cf461b359823 | 334 | #if ((CY_CAPSENSE_CSD_CALIBRATION_EN == 0) && (CY_CAPSENSE_SMARTSENSE_FULL_EN == 0)) |
reedas | 1:cf461b359823 | 335 | .fptrCSDCalibrateWidget = NULL, |
reedas | 1:cf461b359823 | 336 | .fptrCalibrateAllCsdWidgets = NULL, |
reedas | 1:cf461b359823 | 337 | #else |
reedas | 1:cf461b359823 | 338 | .fptrCSDCalibrateWidget = &Cy_CapSense_CSDCalibrateWidget, |
reedas | 1:cf461b359823 | 339 | .fptrCalibrateAllCsdWidgets = &Cy_CapSense_CalibrateAllCsdWidgets, |
reedas | 1:cf461b359823 | 340 | #endif |
reedas | 1:cf461b359823 | 341 | |
reedas | 1:cf461b359823 | 342 | #if (CY_CAPSENSE_CSX_CALIBRATION_EN == 0) |
reedas | 1:cf461b359823 | 343 | .fptrCalibrateAllCsxWidgets = NULL, |
reedas | 1:cf461b359823 | 344 | #else |
reedas | 1:cf461b359823 | 345 | .fptrCalibrateAllCsxWidgets = &Cy_CapSense_CalibrateAllCsxWidgets, |
reedas | 1:cf461b359823 | 346 | #endif |
reedas | 1:cf461b359823 | 347 | |
reedas | 1:cf461b359823 | 348 | #if (CY_CAPSENSE_SMARTSENSE_FULL_EN == 0) |
reedas | 1:cf461b359823 | 349 | .fptrRunNoiseEnvelopeLib = NULL, |
reedas | 1:cf461b359823 | 350 | .fptrDpUpdateThresholds = NULL, |
reedas | 1:cf461b359823 | 351 | .fptrInitializeNoiseEnvelopeLib = NULL, |
reedas | 1:cf461b359823 | 352 | #else |
reedas | 1:cf461b359823 | 353 | .fptrRunNoiseEnvelopeLib = &Cy_CapSense_RunNoiseEnvelope_Lib, |
reedas | 1:cf461b359823 | 354 | .fptrDpUpdateThresholds = &Cy_CapSense_DpUpdateThresholds, |
reedas | 1:cf461b359823 | 355 | .fptrInitializeNoiseEnvelopeLib = &Cy_CapSense_InitializeNoiseEnvelope_Lib, |
reedas | 1:cf461b359823 | 356 | #endif |
reedas | 1:cf461b359823 | 357 | |
reedas | 1:cf461b359823 | 358 | #if ((CY_CAPSENSE_SMARTSENSE_HW_EN == 0) && (CY_CAPSENSE_SMARTSENSE_FULL_EN == 0)) |
reedas | 1:cf461b359823 | 359 | .fptrSsAutoTune = NULL, |
reedas | 1:cf461b359823 | 360 | #else |
reedas | 1:cf461b359823 | 361 | .fptrSsAutoTune = &Cy_CapSense_SsAutoTune, |
reedas | 1:cf461b359823 | 362 | #endif |
reedas | 1:cf461b359823 | 363 | }; |
reedas | 1:cf461b359823 | 364 | |
reedas | 1:cf461b359823 | 365 | static const cy_stc_capsense_pin_config_t cy_capsense_pinConfig[CY_CAPSENSE_PIN_COUNT] = |
reedas | 1:cf461b359823 | 366 | { |
reedas | 1:cf461b359823 | 367 | { /* Button0_Rx0 */ |
reedas | 1:cf461b359823 | 368 | Button0_Rx0_PORT, |
reedas | 1:cf461b359823 | 369 | Button0_Rx0_PIN, |
reedas | 1:cf461b359823 | 370 | }, |
reedas | 1:cf461b359823 | 371 | { /* Button0_Tx */ |
reedas | 1:cf461b359823 | 372 | Button0_Tx_PORT, |
reedas | 1:cf461b359823 | 373 | Button0_Tx_PIN, |
reedas | 1:cf461b359823 | 374 | }, |
reedas | 1:cf461b359823 | 375 | { /* Button1_Rx0 */ |
reedas | 1:cf461b359823 | 376 | Button1_Rx0_PORT, |
reedas | 1:cf461b359823 | 377 | Button1_Rx0_PIN, |
reedas | 1:cf461b359823 | 378 | }, |
reedas | 1:cf461b359823 | 379 | { /* Button1_Tx */ |
reedas | 1:cf461b359823 | 380 | Button1_Tx_PORT, |
reedas | 1:cf461b359823 | 381 | Button1_Tx_PIN, |
reedas | 1:cf461b359823 | 382 | }, |
reedas | 1:cf461b359823 | 383 | { /* LinearSlider0_Sns0 */ |
reedas | 1:cf461b359823 | 384 | LinearSlider0_Sns0_PORT, |
reedas | 1:cf461b359823 | 385 | LinearSlider0_Sns0_PIN, |
reedas | 1:cf461b359823 | 386 | }, |
reedas | 1:cf461b359823 | 387 | { /* LinearSlider0_Sns1 */ |
reedas | 1:cf461b359823 | 388 | LinearSlider0_Sns1_PORT, |
reedas | 1:cf461b359823 | 389 | LinearSlider0_Sns1_PIN, |
reedas | 1:cf461b359823 | 390 | }, |
reedas | 1:cf461b359823 | 391 | { /* LinearSlider0_Sns2 */ |
reedas | 1:cf461b359823 | 392 | LinearSlider0_Sns2_PORT, |
reedas | 1:cf461b359823 | 393 | LinearSlider0_Sns2_PIN, |
reedas | 1:cf461b359823 | 394 | }, |
reedas | 1:cf461b359823 | 395 | { /* LinearSlider0_Sns3 */ |
reedas | 1:cf461b359823 | 396 | LinearSlider0_Sns3_PORT, |
reedas | 1:cf461b359823 | 397 | LinearSlider0_Sns3_PIN, |
reedas | 1:cf461b359823 | 398 | }, |
reedas | 1:cf461b359823 | 399 | { /* LinearSlider0_Sns4 */ |
reedas | 1:cf461b359823 | 400 | LinearSlider0_Sns4_PORT, |
reedas | 1:cf461b359823 | 401 | LinearSlider0_Sns4_PIN, |
reedas | 1:cf461b359823 | 402 | }, |
reedas | 1:cf461b359823 | 403 | }; |
reedas | 1:cf461b359823 | 404 | |
reedas | 1:cf461b359823 | 405 | #if (CY_CAPSENSE_SHIELD_PIN_COUNT > 0) |
reedas | 1:cf461b359823 | 406 | static const cy_stc_capsense_pin_config_t cy_capsense_shieldPinConfig[CY_CAPSENSE_SHIELD_PIN_COUNT] = |
reedas | 1:cf461b359823 | 407 | { |
reedas | 1:cf461b359823 | 408 | }; |
reedas | 1:cf461b359823 | 409 | #endif |
reedas | 1:cf461b359823 | 410 | |
reedas | 1:cf461b359823 | 411 | static const cy_stc_capsense_electrode_config_t cy_capsense_electrodeConfig[CY_CAPSENSE_ELTD_COUNT] = |
reedas | 1:cf461b359823 | 412 | { |
reedas | 1:cf461b359823 | 413 | { /* Button0_Rx0 */ |
reedas | 1:cf461b359823 | 414 | .ptrPin = &cy_capsense_pinConfig[0u], |
reedas | 1:cf461b359823 | 415 | .type = CY_CAPSENSE_ELTD_TYPE_MUT_RX_E, |
reedas | 1:cf461b359823 | 416 | .numPins = 1u, |
reedas | 1:cf461b359823 | 417 | }, |
reedas | 1:cf461b359823 | 418 | { /* Button0_Tx */ |
reedas | 1:cf461b359823 | 419 | .ptrPin = &cy_capsense_pinConfig[1u], |
reedas | 1:cf461b359823 | 420 | .type = CY_CAPSENSE_ELTD_TYPE_MUT_TX_E, |
reedas | 1:cf461b359823 | 421 | .numPins = 1u, |
reedas | 1:cf461b359823 | 422 | }, |
reedas | 1:cf461b359823 | 423 | { /* Button1_Rx0 */ |
reedas | 1:cf461b359823 | 424 | .ptrPin = &cy_capsense_pinConfig[2u], |
reedas | 1:cf461b359823 | 425 | .type = CY_CAPSENSE_ELTD_TYPE_MUT_RX_E, |
reedas | 1:cf461b359823 | 426 | .numPins = 1u, |
reedas | 1:cf461b359823 | 427 | }, |
reedas | 1:cf461b359823 | 428 | { /* Button1_Tx */ |
reedas | 1:cf461b359823 | 429 | .ptrPin = &cy_capsense_pinConfig[3u], |
reedas | 1:cf461b359823 | 430 | .type = CY_CAPSENSE_ELTD_TYPE_MUT_TX_E, |
reedas | 1:cf461b359823 | 431 | .numPins = 1u, |
reedas | 1:cf461b359823 | 432 | }, |
reedas | 1:cf461b359823 | 433 | { /* LinearSlider0_Sns0 */ |
reedas | 1:cf461b359823 | 434 | .ptrPin = &cy_capsense_pinConfig[4u], |
reedas | 1:cf461b359823 | 435 | .type = CY_CAPSENSE_ELTD_TYPE_SELF_E, |
reedas | 1:cf461b359823 | 436 | .numPins = 1u, |
reedas | 1:cf461b359823 | 437 | }, |
reedas | 1:cf461b359823 | 438 | { /* LinearSlider0_Sns1 */ |
reedas | 1:cf461b359823 | 439 | .ptrPin = &cy_capsense_pinConfig[5u], |
reedas | 1:cf461b359823 | 440 | .type = CY_CAPSENSE_ELTD_TYPE_SELF_E, |
reedas | 1:cf461b359823 | 441 | .numPins = 1u, |
reedas | 1:cf461b359823 | 442 | }, |
reedas | 1:cf461b359823 | 443 | { /* LinearSlider0_Sns2 */ |
reedas | 1:cf461b359823 | 444 | .ptrPin = &cy_capsense_pinConfig[6u], |
reedas | 1:cf461b359823 | 445 | .type = CY_CAPSENSE_ELTD_TYPE_SELF_E, |
reedas | 1:cf461b359823 | 446 | .numPins = 1u, |
reedas | 1:cf461b359823 | 447 | }, |
reedas | 1:cf461b359823 | 448 | { /* LinearSlider0_Sns3 */ |
reedas | 1:cf461b359823 | 449 | .ptrPin = &cy_capsense_pinConfig[7u], |
reedas | 1:cf461b359823 | 450 | .type = CY_CAPSENSE_ELTD_TYPE_SELF_E, |
reedas | 1:cf461b359823 | 451 | .numPins = 1u, |
reedas | 1:cf461b359823 | 452 | }, |
reedas | 1:cf461b359823 | 453 | { /* LinearSlider0_Sns4 */ |
reedas | 1:cf461b359823 | 454 | .ptrPin = &cy_capsense_pinConfig[8u], |
reedas | 1:cf461b359823 | 455 | .type = CY_CAPSENSE_ELTD_TYPE_SELF_E, |
reedas | 1:cf461b359823 | 456 | .numPins = 1u, |
reedas | 1:cf461b359823 | 457 | }, |
reedas | 1:cf461b359823 | 458 | }; |
reedas | 1:cf461b359823 | 459 | |
reedas | 1:cf461b359823 | 460 | static const cy_stc_capsense_widget_config_t cy_capsense_widgetConfig[CY_CAPSENSE_WIDGET_COUNT] = |
reedas | 1:cf461b359823 | 461 | { |
reedas | 1:cf461b359823 | 462 | { /* Button0 */ |
reedas | 1:cf461b359823 | 463 | .ptrWdContext = &cy_capsense_tuner.widgetContext[0u], |
reedas | 1:cf461b359823 | 464 | .ptrSnsContext = &cy_capsense_tuner.sensorContext[0u], |
reedas | 1:cf461b359823 | 465 | .ptrEltdConfig = &cy_capsense_electrodeConfig[0u], |
reedas | 1:cf461b359823 | 466 | .ptrNoiseEnvelope = NULL, |
reedas | 1:cf461b359823 | 467 | .ptrRawFilterHistory = NULL, |
reedas | 1:cf461b359823 | 468 | .ptrRawFilterHistoryLow = NULL, |
reedas | 1:cf461b359823 | 469 | .iirCoeff = 128u, |
reedas | 1:cf461b359823 | 470 | .ptrDebounceArr = &cy_capsense_debounce[0u], |
reedas | 1:cf461b359823 | 471 | .ptrDiplexTable = NULL, |
reedas | 1:cf461b359823 | 472 | .centroidConfig = 0u, |
reedas | 1:cf461b359823 | 473 | .xResolution = 0u, |
reedas | 1:cf461b359823 | 474 | .yResolution = 0u, |
reedas | 1:cf461b359823 | 475 | .numSns = 1u, |
reedas | 1:cf461b359823 | 476 | .numCols = 1u, |
reedas | 1:cf461b359823 | 477 | .numRows = 1u, |
reedas | 1:cf461b359823 | 478 | .ptrPosFilterHistory = NULL, |
reedas | 1:cf461b359823 | 479 | .ptrCsxTouchHistory = NULL, |
reedas | 1:cf461b359823 | 480 | .ptrCsxTouchBuffer = NULL, |
reedas | 1:cf461b359823 | 481 | .ptrCsdTouchBuffer = NULL, |
reedas | 1:cf461b359823 | 482 | .ptrGestureConfig = NULL, |
reedas | 1:cf461b359823 | 483 | .ptrGestureContext = NULL, |
reedas | 1:cf461b359823 | 484 | .ballisticConfig = { |
reedas | 1:cf461b359823 | 485 | .accelCoeff = 9u, |
reedas | 1:cf461b359823 | 486 | .speedCoeff = 2u, |
reedas | 1:cf461b359823 | 487 | .divisorValue = 4u, |
reedas | 1:cf461b359823 | 488 | .speedThresholdX = 3u, |
reedas | 1:cf461b359823 | 489 | .speedThresholdY = 4u, |
reedas | 1:cf461b359823 | 490 | }, |
reedas | 1:cf461b359823 | 491 | .ptrBallisticContext = NULL, |
reedas | 1:cf461b359823 | 492 | .aiirConfig = { |
reedas | 1:cf461b359823 | 493 | .maxK = 60u, |
reedas | 1:cf461b359823 | 494 | .minK = 1u, |
reedas | 1:cf461b359823 | 495 | .noMovTh = 3u, |
reedas | 1:cf461b359823 | 496 | .littleMovTh = 7u, |
reedas | 1:cf461b359823 | 497 | .largeMovTh = 12u, |
reedas | 1:cf461b359823 | 498 | .divVal = 64u, |
reedas | 1:cf461b359823 | 499 | }, |
reedas | 1:cf461b359823 | 500 | .advConfig = { |
reedas | 1:cf461b359823 | 501 | .penultimateTh = 100u, |
reedas | 1:cf461b359823 | 502 | .virtualSnsTh = 100u, |
reedas | 1:cf461b359823 | 503 | .crossCouplingTh = 5u, |
reedas | 1:cf461b359823 | 504 | }, |
reedas | 1:cf461b359823 | 505 | .posFilterConfig = 0u, |
reedas | 1:cf461b359823 | 506 | .rawFilterConfig = 0u, |
reedas | 1:cf461b359823 | 507 | .senseMethod = CY_CAPSENSE_SENSE_METHOD_CSX_E, |
reedas | 1:cf461b359823 | 508 | .wdType = CY_CAPSENSE_WD_BUTTON_E, |
reedas | 1:cf461b359823 | 509 | }, |
reedas | 1:cf461b359823 | 510 | { /* Button1 */ |
reedas | 1:cf461b359823 | 511 | .ptrWdContext = &cy_capsense_tuner.widgetContext[1u], |
reedas | 1:cf461b359823 | 512 | .ptrSnsContext = &cy_capsense_tuner.sensorContext[1u], |
reedas | 1:cf461b359823 | 513 | .ptrEltdConfig = &cy_capsense_electrodeConfig[2u], |
reedas | 1:cf461b359823 | 514 | .ptrNoiseEnvelope = NULL, |
reedas | 1:cf461b359823 | 515 | .ptrRawFilterHistory = NULL, |
reedas | 1:cf461b359823 | 516 | .ptrRawFilterHistoryLow = NULL, |
reedas | 1:cf461b359823 | 517 | .iirCoeff = 128u, |
reedas | 1:cf461b359823 | 518 | .ptrDebounceArr = &cy_capsense_debounce[1u], |
reedas | 1:cf461b359823 | 519 | .ptrDiplexTable = NULL, |
reedas | 1:cf461b359823 | 520 | .centroidConfig = 0u, |
reedas | 1:cf461b359823 | 521 | .xResolution = 0u, |
reedas | 1:cf461b359823 | 522 | .yResolution = 0u, |
reedas | 1:cf461b359823 | 523 | .numSns = 1u, |
reedas | 1:cf461b359823 | 524 | .numCols = 1u, |
reedas | 1:cf461b359823 | 525 | .numRows = 1u, |
reedas | 1:cf461b359823 | 526 | .ptrPosFilterHistory = NULL, |
reedas | 1:cf461b359823 | 527 | .ptrCsxTouchHistory = NULL, |
reedas | 1:cf461b359823 | 528 | .ptrCsxTouchBuffer = NULL, |
reedas | 1:cf461b359823 | 529 | .ptrCsdTouchBuffer = NULL, |
reedas | 1:cf461b359823 | 530 | .ptrGestureConfig = NULL, |
reedas | 1:cf461b359823 | 531 | .ptrGestureContext = NULL, |
reedas | 1:cf461b359823 | 532 | .ballisticConfig = { |
reedas | 1:cf461b359823 | 533 | .accelCoeff = 9u, |
reedas | 1:cf461b359823 | 534 | .speedCoeff = 2u, |
reedas | 1:cf461b359823 | 535 | .divisorValue = 4u, |
reedas | 1:cf461b359823 | 536 | .speedThresholdX = 3u, |
reedas | 1:cf461b359823 | 537 | .speedThresholdY = 4u, |
reedas | 1:cf461b359823 | 538 | }, |
reedas | 1:cf461b359823 | 539 | .ptrBallisticContext = NULL, |
reedas | 1:cf461b359823 | 540 | .aiirConfig = { |
reedas | 1:cf461b359823 | 541 | .maxK = 60u, |
reedas | 1:cf461b359823 | 542 | .minK = 1u, |
reedas | 1:cf461b359823 | 543 | .noMovTh = 3u, |
reedas | 1:cf461b359823 | 544 | .littleMovTh = 7u, |
reedas | 1:cf461b359823 | 545 | .largeMovTh = 12u, |
reedas | 1:cf461b359823 | 546 | .divVal = 64u, |
reedas | 1:cf461b359823 | 547 | }, |
reedas | 1:cf461b359823 | 548 | .advConfig = { |
reedas | 1:cf461b359823 | 549 | .penultimateTh = 100u, |
reedas | 1:cf461b359823 | 550 | .virtualSnsTh = 100u, |
reedas | 1:cf461b359823 | 551 | .crossCouplingTh = 5u, |
reedas | 1:cf461b359823 | 552 | }, |
reedas | 1:cf461b359823 | 553 | .posFilterConfig = 0u, |
reedas | 1:cf461b359823 | 554 | .rawFilterConfig = 0u, |
reedas | 1:cf461b359823 | 555 | .senseMethod = CY_CAPSENSE_SENSE_METHOD_CSX_E, |
reedas | 1:cf461b359823 | 556 | .wdType = CY_CAPSENSE_WD_BUTTON_E, |
reedas | 1:cf461b359823 | 557 | }, |
reedas | 1:cf461b359823 | 558 | { /* LinearSlider0 */ |
reedas | 1:cf461b359823 | 559 | .ptrWdContext = &cy_capsense_tuner.widgetContext[2u], |
reedas | 1:cf461b359823 | 560 | .ptrSnsContext = &cy_capsense_tuner.sensorContext[2u], |
reedas | 1:cf461b359823 | 561 | .ptrEltdConfig = &cy_capsense_electrodeConfig[4u], |
reedas | 1:cf461b359823 | 562 | .ptrNoiseEnvelope = NULL, |
reedas | 1:cf461b359823 | 563 | .ptrRawFilterHistory = NULL, |
reedas | 1:cf461b359823 | 564 | .ptrRawFilterHistoryLow = NULL, |
reedas | 1:cf461b359823 | 565 | .iirCoeff = 128u, |
reedas | 1:cf461b359823 | 566 | .ptrDebounceArr = &cy_capsense_debounce[2u], |
reedas | 1:cf461b359823 | 567 | .ptrDiplexTable = NULL, |
reedas | 1:cf461b359823 | 568 | .centroidConfig = 1u, |
reedas | 1:cf461b359823 | 569 | .xResolution = 100u, |
reedas | 1:cf461b359823 | 570 | .yResolution = 0u, |
reedas | 1:cf461b359823 | 571 | .numSns = 5u, |
reedas | 1:cf461b359823 | 572 | .numCols = 5u, |
reedas | 1:cf461b359823 | 573 | .numRows = 0u, |
reedas | 1:cf461b359823 | 574 | .ptrPosFilterHistory = &cy_capsense_touchFilterHistory[0u], |
reedas | 1:cf461b359823 | 575 | .ptrCsxTouchHistory = NULL, |
reedas | 1:cf461b359823 | 576 | .ptrCsxTouchBuffer = NULL, |
reedas | 1:cf461b359823 | 577 | .ptrCsdTouchBuffer = NULL, |
reedas | 1:cf461b359823 | 578 | .ptrGestureConfig = NULL, |
reedas | 1:cf461b359823 | 579 | .ptrGestureContext = NULL, |
reedas | 1:cf461b359823 | 580 | .ballisticConfig = { |
reedas | 1:cf461b359823 | 581 | .accelCoeff = 9u, |
reedas | 1:cf461b359823 | 582 | .speedCoeff = 2u, |
reedas | 1:cf461b359823 | 583 | .divisorValue = 4u, |
reedas | 1:cf461b359823 | 584 | .speedThresholdX = 3u, |
reedas | 1:cf461b359823 | 585 | .speedThresholdY = 4u, |
reedas | 1:cf461b359823 | 586 | }, |
reedas | 1:cf461b359823 | 587 | .ptrBallisticContext = NULL, |
reedas | 1:cf461b359823 | 588 | .aiirConfig = { |
reedas | 1:cf461b359823 | 589 | .maxK = 60u, |
reedas | 1:cf461b359823 | 590 | .minK = 1u, |
reedas | 1:cf461b359823 | 591 | .noMovTh = 3u, |
reedas | 1:cf461b359823 | 592 | .littleMovTh = 7u, |
reedas | 1:cf461b359823 | 593 | .largeMovTh = 12u, |
reedas | 1:cf461b359823 | 594 | .divVal = 64u, |
reedas | 1:cf461b359823 | 595 | }, |
reedas | 1:cf461b359823 | 596 | .advConfig = { |
reedas | 1:cf461b359823 | 597 | .penultimateTh = 100u, |
reedas | 1:cf461b359823 | 598 | .virtualSnsTh = 100u, |
reedas | 1:cf461b359823 | 599 | .crossCouplingTh = 5u, |
reedas | 1:cf461b359823 | 600 | }, |
reedas | 1:cf461b359823 | 601 | .posFilterConfig = 272u, |
reedas | 1:cf461b359823 | 602 | .rawFilterConfig = 0u, |
reedas | 1:cf461b359823 | 603 | .senseMethod = CY_CAPSENSE_SENSE_METHOD_CSD_E, |
reedas | 1:cf461b359823 | 604 | .wdType = CY_CAPSENSE_WD_LINEAR_SLIDER_E, |
reedas | 1:cf461b359823 | 605 | }, |
reedas | 1:cf461b359823 | 606 | }; |
reedas | 1:cf461b359823 | 607 | |
reedas | 1:cf461b359823 | 608 | cy_stc_capsense_tuner_t cy_capsense_tuner = |
reedas | 1:cf461b359823 | 609 | { |
reedas | 1:cf461b359823 | 610 | .commonContext = { |
reedas | 1:cf461b359823 | 611 | .configId = 0xca04, |
reedas | 1:cf461b359823 | 612 | .tunerCmd = 0u, |
reedas | 1:cf461b359823 | 613 | .scanCounter = 0u, |
reedas | 1:cf461b359823 | 614 | .tunerSt = 0u, |
reedas | 1:cf461b359823 | 615 | .initDone = 0u, |
reedas | 1:cf461b359823 | 616 | .ptrSSCallback = NULL, |
reedas | 1:cf461b359823 | 617 | .ptrEOSCallback = NULL, |
reedas | 1:cf461b359823 | 618 | .ptrTunerSendCallback = NULL, |
reedas | 1:cf461b359823 | 619 | .ptrTunerReceiveCallback = NULL, |
reedas | 1:cf461b359823 | 620 | .status = 0u, |
reedas | 1:cf461b359823 | 621 | .timestampInterval = 1u, |
reedas | 1:cf461b359823 | 622 | .timestamp = 0u, |
reedas | 1:cf461b359823 | 623 | .modCsdClk = 4u, |
reedas | 1:cf461b359823 | 624 | .modCsxClk = 4u, |
reedas | 1:cf461b359823 | 625 | .tunerCnt = 0u, |
reedas | 1:cf461b359823 | 626 | }, |
reedas | 1:cf461b359823 | 627 | .widgetContext = { |
reedas | 1:cf461b359823 | 628 | { |
reedas | 1:cf461b359823 | 629 | .fingerCap = 300u, |
reedas | 1:cf461b359823 | 630 | .sigPFC = 0u, |
reedas | 1:cf461b359823 | 631 | .resolution = 100u, |
reedas | 1:cf461b359823 | 632 | .maxRawCount = 0u, |
reedas | 1:cf461b359823 | 633 | .fingerTh = 90u, |
reedas | 1:cf461b359823 | 634 | .proxTh = 200u, |
reedas | 1:cf461b359823 | 635 | .lowBslnRst = 30u, |
reedas | 1:cf461b359823 | 636 | .snsClk = 80u, |
reedas | 1:cf461b359823 | 637 | .rowSnsClk = 2u, |
reedas | 1:cf461b359823 | 638 | .gestureDetected = 0u, |
reedas | 1:cf461b359823 | 639 | .gestureDirection = 0u, |
reedas | 1:cf461b359823 | 640 | .xDelta = 0u, |
reedas | 1:cf461b359823 | 641 | .yDelta = 0u, |
reedas | 1:cf461b359823 | 642 | .noiseTh = 40u, |
reedas | 1:cf461b359823 | 643 | .nNoiseTh = 40u, |
reedas | 1:cf461b359823 | 644 | .hysteresis = 20u, |
reedas | 1:cf461b359823 | 645 | .onDebounce = 3u, |
reedas | 1:cf461b359823 | 646 | .snsClkSource = CY_CAPSENSE_CLK_SOURCE_AUTO_MASK, |
reedas | 1:cf461b359823 | 647 | .idacMod = { 32u, 32u, 32u, }, |
reedas | 1:cf461b359823 | 648 | .idacGainIndex = 2u, |
reedas | 1:cf461b359823 | 649 | .rowIdacMod = { 32u, 32u, 32u, }, |
reedas | 1:cf461b359823 | 650 | .bslnCoeff = 1u, |
reedas | 1:cf461b359823 | 651 | .status = 0u, |
reedas | 1:cf461b359823 | 652 | .wdTouch = { |
reedas | 1:cf461b359823 | 653 | .ptrPosition = NULL, |
reedas | 1:cf461b359823 | 654 | .numPosition = 0, |
reedas | 1:cf461b359823 | 655 | }, |
reedas | 1:cf461b359823 | 656 | }, |
reedas | 1:cf461b359823 | 657 | { |
reedas | 1:cf461b359823 | 658 | .fingerCap = 160u, |
reedas | 1:cf461b359823 | 659 | .sigPFC = 0u, |
reedas | 1:cf461b359823 | 660 | .resolution = 100u, |
reedas | 1:cf461b359823 | 661 | .maxRawCount = 0u, |
reedas | 1:cf461b359823 | 662 | .fingerTh = 90u, |
reedas | 1:cf461b359823 | 663 | .proxTh = 200u, |
reedas | 1:cf461b359823 | 664 | .lowBslnRst = 30u, |
reedas | 1:cf461b359823 | 665 | .snsClk = 80u, |
reedas | 1:cf461b359823 | 666 | .rowSnsClk = 16u, |
reedas | 1:cf461b359823 | 667 | .gestureDetected = 0u, |
reedas | 1:cf461b359823 | 668 | .gestureDirection = 0u, |
reedas | 1:cf461b359823 | 669 | .xDelta = 0u, |
reedas | 1:cf461b359823 | 670 | .yDelta = 0u, |
reedas | 1:cf461b359823 | 671 | .noiseTh = 40u, |
reedas | 1:cf461b359823 | 672 | .nNoiseTh = 40u, |
reedas | 1:cf461b359823 | 673 | .hysteresis = 20u, |
reedas | 1:cf461b359823 | 674 | .onDebounce = 3u, |
reedas | 1:cf461b359823 | 675 | .snsClkSource = CY_CAPSENSE_CLK_SOURCE_AUTO_MASK, |
reedas | 1:cf461b359823 | 676 | .idacMod = { 32u, 32u, 32u, }, |
reedas | 1:cf461b359823 | 677 | .idacGainIndex = 2u, |
reedas | 1:cf461b359823 | 678 | .rowIdacMod = { 32u, 32u, 32u, }, |
reedas | 1:cf461b359823 | 679 | .bslnCoeff = 1u, |
reedas | 1:cf461b359823 | 680 | .status = 0u, |
reedas | 1:cf461b359823 | 681 | .wdTouch = { |
reedas | 1:cf461b359823 | 682 | .ptrPosition = NULL, |
reedas | 1:cf461b359823 | 683 | .numPosition = 0, |
reedas | 1:cf461b359823 | 684 | }, |
reedas | 1:cf461b359823 | 685 | }, |
reedas | 1:cf461b359823 | 686 | { |
reedas | 1:cf461b359823 | 687 | .fingerCap = 100u, |
reedas | 1:cf461b359823 | 688 | .sigPFC = 0u, |
reedas | 1:cf461b359823 | 689 | .resolution = 13u, |
reedas | 1:cf461b359823 | 690 | .maxRawCount = 0u, |
reedas | 1:cf461b359823 | 691 | .fingerTh = 100u, |
reedas | 1:cf461b359823 | 692 | .proxTh = 200u, |
reedas | 1:cf461b359823 | 693 | .lowBslnRst = 30u, |
reedas | 1:cf461b359823 | 694 | .snsClk = 34u, |
reedas | 1:cf461b359823 | 695 | .rowSnsClk = 2u, |
reedas | 1:cf461b359823 | 696 | .gestureDetected = 0u, |
reedas | 1:cf461b359823 | 697 | .gestureDirection = 0u, |
reedas | 1:cf461b359823 | 698 | .xDelta = 0u, |
reedas | 1:cf461b359823 | 699 | .yDelta = 0u, |
reedas | 1:cf461b359823 | 700 | .noiseTh = 40u, |
reedas | 1:cf461b359823 | 701 | .nNoiseTh = 40u, |
reedas | 1:cf461b359823 | 702 | .hysteresis = 10u, |
reedas | 1:cf461b359823 | 703 | .onDebounce = 3u, |
reedas | 1:cf461b359823 | 704 | .snsClkSource = CY_CAPSENSE_CLK_SOURCE_DIRECT, |
reedas | 1:cf461b359823 | 705 | .idacMod = { 32u, 32u, 32u, }, |
reedas | 1:cf461b359823 | 706 | .idacGainIndex = 4u, |
reedas | 1:cf461b359823 | 707 | .rowIdacMod = { 32u, 32u, 32u, }, |
reedas | 1:cf461b359823 | 708 | .bslnCoeff = 1u, |
reedas | 1:cf461b359823 | 709 | .status = 0u, |
reedas | 1:cf461b359823 | 710 | .wdTouch = { |
reedas | 1:cf461b359823 | 711 | .ptrPosition = &cy_capsense_tuner.position[0u], |
reedas | 1:cf461b359823 | 712 | .numPosition = 1, |
reedas | 1:cf461b359823 | 713 | }, |
reedas | 1:cf461b359823 | 714 | }, |
reedas | 1:cf461b359823 | 715 | }, |
reedas | 1:cf461b359823 | 716 | .sensorContext = { |
reedas | 1:cf461b359823 | 717 | { |
reedas | 1:cf461b359823 | 718 | .raw = 0u, |
reedas | 1:cf461b359823 | 719 | .bsln = 0u, |
reedas | 1:cf461b359823 | 720 | .diff = 0u, |
reedas | 1:cf461b359823 | 721 | .status = 0u, |
reedas | 1:cf461b359823 | 722 | .negBslnRstCnt = 0u, |
reedas | 1:cf461b359823 | 723 | .idacComp = 32u, |
reedas | 1:cf461b359823 | 724 | .bslnExt = 0u, |
reedas | 1:cf461b359823 | 725 | }, |
reedas | 1:cf461b359823 | 726 | { |
reedas | 1:cf461b359823 | 727 | .raw = 0u, |
reedas | 1:cf461b359823 | 728 | .bsln = 0u, |
reedas | 1:cf461b359823 | 729 | .diff = 0u, |
reedas | 1:cf461b359823 | 730 | .status = 0u, |
reedas | 1:cf461b359823 | 731 | .negBslnRstCnt = 0u, |
reedas | 1:cf461b359823 | 732 | .idacComp = 32u, |
reedas | 1:cf461b359823 | 733 | .bslnExt = 0u, |
reedas | 1:cf461b359823 | 734 | }, |
reedas | 1:cf461b359823 | 735 | { |
reedas | 1:cf461b359823 | 736 | .raw = 0u, |
reedas | 1:cf461b359823 | 737 | .bsln = 0u, |
reedas | 1:cf461b359823 | 738 | .diff = 0u, |
reedas | 1:cf461b359823 | 739 | .status = 0u, |
reedas | 1:cf461b359823 | 740 | .negBslnRstCnt = 0u, |
reedas | 1:cf461b359823 | 741 | .idacComp = 32u, |
reedas | 1:cf461b359823 | 742 | .bslnExt = 0u, |
reedas | 1:cf461b359823 | 743 | }, |
reedas | 1:cf461b359823 | 744 | { |
reedas | 1:cf461b359823 | 745 | .raw = 0u, |
reedas | 1:cf461b359823 | 746 | .bsln = 0u, |
reedas | 1:cf461b359823 | 747 | .diff = 0u, |
reedas | 1:cf461b359823 | 748 | .status = 0u, |
reedas | 1:cf461b359823 | 749 | .negBslnRstCnt = 0u, |
reedas | 1:cf461b359823 | 750 | .idacComp = 32u, |
reedas | 1:cf461b359823 | 751 | .bslnExt = 0u, |
reedas | 1:cf461b359823 | 752 | }, |
reedas | 1:cf461b359823 | 753 | { |
reedas | 1:cf461b359823 | 754 | .raw = 0u, |
reedas | 1:cf461b359823 | 755 | .bsln = 0u, |
reedas | 1:cf461b359823 | 756 | .diff = 0u, |
reedas | 1:cf461b359823 | 757 | .status = 0u, |
reedas | 1:cf461b359823 | 758 | .negBslnRstCnt = 0u, |
reedas | 1:cf461b359823 | 759 | .idacComp = 32u, |
reedas | 1:cf461b359823 | 760 | .bslnExt = 0u, |
reedas | 1:cf461b359823 | 761 | }, |
reedas | 1:cf461b359823 | 762 | { |
reedas | 1:cf461b359823 | 763 | .raw = 0u, |
reedas | 1:cf461b359823 | 764 | .bsln = 0u, |
reedas | 1:cf461b359823 | 765 | .diff = 0u, |
reedas | 1:cf461b359823 | 766 | .status = 0u, |
reedas | 1:cf461b359823 | 767 | .negBslnRstCnt = 0u, |
reedas | 1:cf461b359823 | 768 | .idacComp = 32u, |
reedas | 1:cf461b359823 | 769 | .bslnExt = 0u, |
reedas | 1:cf461b359823 | 770 | }, |
reedas | 1:cf461b359823 | 771 | { |
reedas | 1:cf461b359823 | 772 | .raw = 0u, |
reedas | 1:cf461b359823 | 773 | .bsln = 0u, |
reedas | 1:cf461b359823 | 774 | .diff = 0u, |
reedas | 1:cf461b359823 | 775 | .status = 0u, |
reedas | 1:cf461b359823 | 776 | .negBslnRstCnt = 0u, |
reedas | 1:cf461b359823 | 777 | .idacComp = 32u, |
reedas | 1:cf461b359823 | 778 | .bslnExt = 0u, |
reedas | 1:cf461b359823 | 779 | }, |
reedas | 1:cf461b359823 | 780 | }, |
reedas | 1:cf461b359823 | 781 | .position = { |
reedas | 1:cf461b359823 | 782 | { |
reedas | 1:cf461b359823 | 783 | .x = 0u, |
reedas | 1:cf461b359823 | 784 | .y = 0u, |
reedas | 1:cf461b359823 | 785 | .z = 0u, |
reedas | 1:cf461b359823 | 786 | .id = 0u, |
reedas | 1:cf461b359823 | 787 | }, |
reedas | 1:cf461b359823 | 788 | }, |
reedas | 1:cf461b359823 | 789 | }; |
reedas | 1:cf461b359823 | 790 | |
reedas | 1:cf461b359823 | 791 | cy_stc_capsense_context_t cy_capsense_context = |
reedas | 1:cf461b359823 | 792 | { |
reedas | 1:cf461b359823 | 793 | .ptrCommonConfig = &cy_capsense_commonConfig, |
reedas | 1:cf461b359823 | 794 | .ptrCommonContext = &cy_capsense_tuner.commonContext, |
reedas | 1:cf461b359823 | 795 | .ptrInternalContext = &cy_capsense_internalContext, |
reedas | 1:cf461b359823 | 796 | .ptrWdConfig = &cy_capsense_widgetConfig[0u], |
reedas | 1:cf461b359823 | 797 | .ptrWdContext = &cy_capsense_tuner.widgetContext[0u], |
reedas | 1:cf461b359823 | 798 | .ptrPinConfig = &cy_capsense_pinConfig[0u], |
reedas | 1:cf461b359823 | 799 | .ptrShieldPinConfig = NULL, |
reedas | 1:cf461b359823 | 800 | .ptrActiveScanSns = &cy_capsense_activeScanSns, |
reedas | 1:cf461b359823 | 801 | .ptrFptrConfig = (const void *) &cy_capsense_fptrConfig, |
reedas | 1:cf461b359823 | 802 | }; |
reedas | 1:cf461b359823 | 803 | |
reedas | 1:cf461b359823 | 804 | #endif /* CY_CAPSENSE_CORE == __CORTEX_M */ |
reedas | 1:cf461b359823 | 805 | |
reedas | 1:cf461b359823 | 806 | /* [] END OF FILE */ |