-
Notifications
You must be signed in to change notification settings - Fork 4
/
cy_capsense_tuner.h
143 lines (115 loc) · 5.38 KB
/
cy_capsense_tuner.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
/***************************************************************************//**
* \file cy_capsense_tuner.h
* \version 5.0
*
* \brief
* This file provides CAPSENSE™ MW Tuner module function prototypes.
*
********************************************************************************
* \copyright
* Copyright 2018-2024, 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_TUNER_H)
#define CY_CAPSENSE_TUNER_H
#include "cy_syslib.h"
#include "cy_capsense_structure.h"
#if (defined(CY_IP_MXCSDV2) || defined(CY_IP_M0S8CSDV2) || defined(CY_IP_M0S8MSCV3) || defined(CY_IP_M0S8MSCV3LP))
#if defined(__cplusplus)
extern "C" {
#endif
/*******************************************************************************
* Macros Definitions
*******************************************************************************/
#define CY_CAPSENSE_COMMAND_PACKET_SIZE (16u)
#define CY_CAPSENSE_COMMAND_CRC_DATA_SIZE (11u)
#define CY_CAPSENSE_COMMAND_HEAD_0_IDX (0u)
#define CY_CAPSENSE_COMMAND_HEAD_1_IDX (1u)
#define CY_CAPSENSE_COMMAND_CODE_0_IDX (2u)
#define CY_CAPSENSE_COMMAND_CNTR_0_IDX (3u)
#define CY_CAPSENSE_COMMAND_SIZE_0_IDX (4u)
#define CY_CAPSENSE_COMMAND_OFFS_0_IDX (5u)
#define CY_CAPSENSE_COMMAND_OFFS_1_IDX (6u)
#define CY_CAPSENSE_COMMAND_DATA_0_IDX (7u)
#define CY_CAPSENSE_COMMAND_DATA_1_IDX (8u)
#define CY_CAPSENSE_COMMAND_DATA_2_IDX (9u)
#define CY_CAPSENSE_COMMAND_DATA_3_IDX (10u)
#define CY_CAPSENSE_COMMAND_CRC_0_IDX (11u)
#define CY_CAPSENSE_COMMAND_CRC_1_IDX (12u)
#define CY_CAPSENSE_COMMAND_TAIL_0_IDX (13u)
#define CY_CAPSENSE_COMMAND_TAIL_1_IDX (14u)
#define CY_CAPSENSE_COMMAND_TAIL_2_IDX (15u)
#define CY_CAPSENSE_COMMAND_HEAD_0 (0x0Du)
#define CY_CAPSENSE_COMMAND_HEAD_1 (0x0Au)
#define CY_CAPSENSE_COMMAND_TAIL_0 (0x00u)
#define CY_CAPSENSE_COMMAND_TAIL_1 (0xFFu)
#define CY_CAPSENSE_COMMAND_TAIL_2 (0xFFu)
#define CY_CAPSENSE_COMMAND_OK (0u)
#define CY_CAPSENSE_WRONG_HEADER (1u)
#define CY_CAPSENSE_WRONG_CRC (2u)
#define CY_CAPSENSE_WRONG_TAIL (3u)
#define CY_CAPSENSE_WRONG_CODE (4u)
#define CY_CAPSENSE_MSB_SHIFT (8u)
/*******************************************************************************
* Function Prototypes
*******************************************************************************/
/******************************************************************************/
/** \addtogroup group_capsense_high_level *//** \{ */
/******************************************************************************/
uint32_t Cy_CapSense_RunTuner(cy_stc_capsense_context_t * context);
uint32_t Cy_CapSense_CheckTunerCmdIntegrity(const uint8_t * commandPacket);
/** \} */
/******************************************************************************/
/** \cond SECTION_CAPSENSE_INTERNAL */
/** \addtogroup group_capsense_internal *//** \{ */
/******************************************************************************/
void Cy_CapSense_TuInitialize(cy_stc_capsense_context_t * context);
/*******************************************************************************
* Function Name: Cy_CapSense_CheckCommandIntegrity
****************************************************************************//**
*
* \deprecated This function is obsolete and kept for backward compatibility only.
* The Cy_CapSense_CheckTunerCmdIntegrity() function should be used instead.
*
* \param commandPacket
* The pointer to the data packet that should be verified.
*
* \return
* Returns the result of the command verification.
*
*******************************************************************************/
__STATIC_INLINE uint32_t Cy_CapSense_CheckCommandIntegrity(const uint8_t * commandPacket)
{
return(Cy_CapSense_CheckTunerCmdIntegrity(commandPacket));
}
/*******************************************************************************
* Function Name: Cy_CapSense_CalculateCrc16
****************************************************************************//**
*
* \deprecated This function is obsolete and kept for backward compatibility only.
* The Cy_CapSense_GetCRC() function should be used instead.
*
* \param ptrData
* The pointer to the data.
*
* \param len
* The length of the data in bytes.
*
* \return
* Returns a calculated CRC-16 value.
*
*******************************************************************************/
__STATIC_INLINE uint16_t Cy_CapSense_CalculateCrc16(const uint8_t *ptrData, uint32_t len)
{
return(Cy_CapSense_GetCRC(ptrData, len));
}
/** \} \endcond */
#if defined(__cplusplus)
}
#endif
#endif /* (defined(CY_IP_MXCSDV2) || defined(CY_IP_M0S8CSDV2) || defined(CY_IP_M0S8MSCV3) || defined(CY_IP_M0S8MSCV3LP)) */
#endif /* CY_CAPSENSE_TUNER_H */
/* [] END OF FILE */