forked from Infineon/capsense
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cy_capsense_filter.h
149 lines (120 loc) · 5.98 KB
/
cy_capsense_filter.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
/***************************************************************************//**
* \file cy_capsense_filter.h
* \version 2.0
*
* \brief
* This file contains the definitions for all the filters implementation.
*
********************************************************************************
* \copyright
* Copyright 2018-2019, 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_FILTER_H)
#define CY_CAPSENSE_FILTER_H
#include "cy_syslib.h"
#include "cy_capsense_structure.h"
#include "cy_capsense_structure.h"
#include "cy_capsense_common.h"
#if defined(CY_IP_MXCSDV2)
#if defined(__cplusplus)
extern "C" {
#endif
/***************************************
* Function Prototypes
***************************************/
/*******************************************************************************
* LOW LEVEL FUNCTIONS
*******************************************************************************/
/******************************************************************************/
/** \addtogroup group_capsense_low_level *//** \{ */
/******************************************************************************/
void Cy_CapSense_InitializeAllBaselines(cy_stc_capsense_context_t * context);
void Cy_CapSense_InitializeWidgetBaseline(uint32_t widgetId, cy_stc_capsense_context_t * context);
void Cy_CapSense_InitializeSensorBaseline(uint32_t widgetId, uint32_t sensorId, cy_stc_capsense_context_t * context);
void Cy_CapSense_InitializeAllFilters(const cy_stc_capsense_context_t * context);
void Cy_CapSense_InitializeWidgetFilter(uint32_t widgetId, const cy_stc_capsense_context_t * context);
cy_status Cy_CapSense_UpdateAllBaselines(const cy_stc_capsense_context_t * context);
cy_status Cy_CapSense_UpdateWidgetBaseline(uint32_t widgetId, const cy_stc_capsense_context_t * context);
cy_status Cy_CapSense_UpdateSensorBaseline(uint32_t widgetId, uint32_t sensorId, const cy_stc_capsense_context_t * context);
/** \} */
/*******************************************************************************
* Function Prototypes - Internal functions
*******************************************************************************/
/******************************************************************************/
/** \cond SECTION_CAPSENSE_INTERNAL */
/** \addtogroup group_capsense_internal *//** \{ */
/******************************************************************************/
void Cy_CapSense_InitializeIIR(
uint32_t widgetId,
uint32_t sensorId,
const cy_stc_capsense_context_t * context);
void Cy_CapSense_RunIIR(
uint32_t widgetId,
uint32_t sensorId,
const cy_stc_capsense_context_t * context);
void Cy_CapSense_InitializeMedian(
uint32_t widgetId,
uint32_t sensorId,
const cy_stc_capsense_context_t * context);
void Cy_CapSense_RunMedian(
uint32_t widgetId,
uint32_t sensorId,
const cy_stc_capsense_context_t * context);
void Cy_CapSense_InitializeAverage(
uint32_t widgetId,
uint32_t sensorId,
const cy_stc_capsense_context_t * context);
void Cy_CapSense_RunAverage(
uint32_t widgetId,
uint32_t sensorId,
const cy_stc_capsense_context_t * context);
void Cy_CapSense_FtInitializeBaseline(
cy_stc_capsense_sensor_context_t * ptrSnsContext);
uint32_t Cy_CapSense_FtUpdateBaseline(
const cy_stc_capsense_widget_context_t * ptrWdContext,
cy_stc_capsense_sensor_context_t * ptrSnsContext,
const cy_stc_capsense_context_t * context);
uint32_t Cy_CapSense_FtMedian(uint32_t x1, uint32_t x2, uint32_t x3);
uint32_t Cy_CapSense_FtIIR1stOrder(uint32_t input, uint32_t prevOutput, uint32_t n);
uint32_t Cy_CapSense_FtJitter(uint32_t input, uint32_t prevOutput);
void Cy_CapSense_FtRunEnabledFiltersInternal(
const cy_stc_capsense_widget_config_t * ptrWdConfig,
cy_stc_capsense_sensor_context_t * ptrSnsContext,
uint16_t * ptrSnsRawHistory,
uint8_t * ptrSnsRawHistoryLow);
void Cy_CapSense_InitializeIIRInternal(
const cy_stc_capsense_widget_config_t * ptrWdConfig,
const cy_stc_capsense_sensor_context_t * ptrSnsContext,
uint16_t * ptrSnsRawHistory,
uint8_t * ptrSnsRawHistoryLow);
void Cy_CapSense_RunIIRInternal(
const cy_stc_capsense_widget_config_t * ptrWdConfig,
cy_stc_capsense_sensor_context_t * ptrSnsContext,
uint16_t * ptrSnsRawHistory,
uint8_t * ptrSnsRawHistoryLow);
void Cy_CapSense_InitializeMedianInternal(
const cy_stc_capsense_widget_config_t * ptrWdConfig,
const cy_stc_capsense_sensor_context_t * ptrSnsContext,
uint16_t * ptrSnsRawHistory);
void Cy_CapSense_RunMedianInternal(
const cy_stc_capsense_widget_config_t * ptrWdConfig,
cy_stc_capsense_sensor_context_t * ptrSnsContext,
uint16_t * ptrSnsRawHistory);
void Cy_CapSense_InitializeAverageInternal(
const cy_stc_capsense_widget_config_t * ptrWdConfig,
const cy_stc_capsense_sensor_context_t * ptrSnsContext,
uint16_t * ptrSnsRawHistory);
void Cy_CapSense_RunAverageInternal(
const cy_stc_capsense_widget_config_t * ptrWdConfig,
cy_stc_capsense_sensor_context_t * ptrSnsContext,
uint16_t * ptrSnsRawHistory);
/** \} \endcond */
#if defined(__cplusplus)
}
#endif
#endif /* CY_IP_MXCSDV2 */
#endif /* CY_CAPSENSE_FILTER_H */
/* [] END OF FILE */