cy_csd_8h¶
The header file of the CSD driver.
- Version
1.10.2
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
- Copyright
Copyright 2018-2020 Cypress Semiconductor Corporation SPDX-License-Identifier: Apache-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either expressed or implied. See the License for the specific language governing permissions and limitations under the License.
Defines
-
CY_CSD_DRV_VERSION_MAJOR
¶ Driver major version.
-
CY_CSD_DRV_VERSION_MINOR
¶ Driver minor version.
-
CY_CSD_ID
¶ CSD driver identifier.
-
CY_CSD_CONTEXT_INIT_VALUE
¶ Initialization macro for the driver context variable.
-
CY_CSD_ADC_VREF_0P8
¶ Nominal Vref stored in SFLASH register.
-
CY_CSD_ADC_VREF_1P2
¶ Nominal Vref stored in SFLASH register.
-
CY_CSD_ADC_VREF_1P6
¶ Nominal Vref stored in SFLASH register.
-
CY_CSD_ADC_VREF_2P1
¶ Nominal Vref stored in SFLASH register.
-
CY_CSD_ADC_VREF_2P6
¶ Nominal Vref stored in SFLASH register.
-
CY_CSDADC_PERCENTAGE_100
¶ One hundred percent.
-
CY_CSDADC_VREF_TRIM_MAX_DEVIATION
¶ Max deviation for trim.
-
CY_CSDADC_VREF_GAIN_MAX
¶ Vref max gain.
-
CY_CSD_REG_OFFSET_CONFIG
¶ The register offset.
-
CY_CSD_REG_OFFSET_SPARE
¶ The register offset.
-
CY_CSD_REG_OFFSET_STATUS
¶ The register offset.
-
CY_CSD_REG_OFFSET_STAT_SEQ
¶ The register offset.
-
CY_CSD_REG_OFFSET_STAT_CNTS
¶ The register offset.
-
CY_CSD_REG_OFFSET_STAT_HCNT
¶ The register offset.
-
CY_CSD_REG_OFFSET_RESULT_VAL1
¶ The register offset.
-
CY_CSD_REG_OFFSET_RESULT_VAL2
¶ The register offset.
-
CY_CSD_REG_OFFSET_ADC_RES
¶ The register offset.
-
CY_CSD_REG_OFFSET_INTR
¶ The register offset.
-
CY_CSD_REG_OFFSET_INTR_SET
¶ The register offset.
-
CY_CSD_REG_OFFSET_INTR_MASK
¶ The register offset.
-
CY_CSD_REG_OFFSET_INTR_MASKED
¶ The register offset.
-
CY_CSD_REG_OFFSET_HSCMP
¶ The register offset.
-
CY_CSD_REG_OFFSET_AMBUF
¶ The register offset.
-
CY_CSD_REG_OFFSET_REFGEN
¶ The register offset.
-
CY_CSD_REG_OFFSET_CSDCMP
¶ The register offset.
-
CY_CSD_REG_OFFSET_SW_RES
¶ The register offset.
-
CY_CSD_REG_OFFSET_SENSE_PERIOD
¶ The register offset.
-
CY_CSD_REG_OFFSET_SENSE_DUTY
¶ The register offset.
-
CY_CSD_REG_OFFSET_SW_HS_P_SEL
¶ The register offset.
-
CY_CSD_REG_OFFSET_SW_HS_N_SEL
¶ The register offset.
-
CY_CSD_REG_OFFSET_SW_SHIELD_SEL
¶ The register offset.
-
CY_CSD_REG_OFFSET_SW_AMUXBUF_SEL
¶ The register offset.
-
CY_CSD_REG_OFFSET_SW_BYP_SEL
¶ The register offset.
-
CY_CSD_REG_OFFSET_SW_CMP_P_SEL
¶ The register offset.
-
CY_CSD_REG_OFFSET_SW_CMP_N_SEL
¶ The register offset.
-
CY_CSD_REG_OFFSET_SW_REFGEN_SEL
¶ The register offset.
-
CY_CSD_REG_OFFSET_SW_FW_MOD_SEL
¶ The register offset.
-
CY_CSD_REG_OFFSET_SW_FW_TANK_SEL
¶ The register offset.
-
CY_CSD_REG_OFFSET_SW_DSI_SEL
¶ The register offset.
-
CY_CSD_REG_OFFSET_IO_SEL
¶ The register offset.
-
CY_CSD_REG_OFFSET_SEQ_TIME
¶ The register offset.
-
CY_CSD_REG_OFFSET_SEQ_INIT_CNT
¶ The register offset.
-
CY_CSD_REG_OFFSET_SEQ_NORM_CNT
¶ The register offset.
-
CY_CSD_REG_OFFSET_ADC_CTL
¶ The register offset.
-
CY_CSD_REG_OFFSET_SEQ_START
¶ The register offset.
-
CY_CSD_REG_OFFSET_IDACA
¶ The register offset.
-
CY_CSD_REG_OFFSET_IDACB
¶ The register offset.
Enums
-
enum
cy_en_csd_status_t
¶ cy_en_csd_status_t: CSD status definitions.
Values:
-
enumerator
CY_CSD_SUCCESS
¶ Successful.
-
enumerator
CY_CSD_BAD_PARAM
¶ One or more invalid parameters.
-
enumerator
CY_CSD_BUSY
¶ The CSD HW block performs conversion.
-
enumerator
CY_CSD_LOCKED
¶ The CSD HW block is captured by another middleware.
-
enumerator
-
enum
cy_en_csd_key_t
¶ cy_en_csd_key_t: Definitions of upper level keys that use the driver.
Each middleware has a unique key assigned. When middleware successfully captures the CSD HW block, this key is placed into the CSD driver context structure. All attempts to capture the CSD HW block by other middleware are rejected. When the first middleware releases the CSD HW block, CY_CSD_NONE_KEY is written to the lockKey variable of the CSD driver context structure and any other middleware can capture the CSD HW block.
Values:
-
enumerator
CY_CSD_NONE_KEY
¶ The CSD HW block is unused and not captured by any middleware.
-
enumerator
CY_CSD_USER_DEFINED_KEY
¶ The CSD HW block is captured by the application program directly to implement a customer’s specific case.
-
enumerator
CY_CSD_CAPSENSE_KEY
¶ The CSD HW block is captured by a CapSense middleware.
-
enumerator
CY_CSD_ADC_KEY
¶ The CSD HW block is captured by a ADC middleware.
-
enumerator
CY_CSD_IDAC_KEY
¶ The CSD HW block is captured by a IDAC middleware.
-
enumerator
CY_CSD_CMP_KEY
¶ The CSD HW block is captured by a CMP middleware.
-
enumerator
Functions
-
__STATIC_INLINE cy_en_csd_key_t Cy_CSD_GetLockStatus (const CSD_Type *base, const cy_stc_csd_context_t *context)
Verifies whether the specified CSD HW block is acquired and locked by a higher-level firmware.
cy_en_csd_key_t key; key = Cy_CSD_GetLockStatus(CSD0, &csdContext); if (CY_CSD_NONE_KEY == key) { /* The CSD block is not captured */ }
- Function Usage
- Parameters
base – Pointer to a CSD HW block base address.
context – The pointer to the context structure allocated by a user or middleware.
- Returns
Returns a key code. See cy_en_csd_key_t.
-
__STATIC_INLINE cy_en_csd_status_t Cy_CSD_GetConversionStatus (const CSD_Type *base, const cy_stc_csd_context_t *context)
Verifies whether the specified CSD HW block is busy (performing scan or conversion).
cy_en_csd_status_t status; status = Cy_CSD_GetConversionStatus(CSD0, &csdContext); if (CY_CSD_BUSY == status) { /* The CSD block is performing a conversion */ } else { /* The CSD block is not busy and a new conversion could be started */ }
- Function Usage
- Parameters
base – Pointer to a CSD HW block base address.
context – The pointer to the context structure allocated by a user or middleware.
- Returns
Returns status code. See cy_en_csd_status_t.
-
__STATIC_INLINE uint32_t Cy_CSD_ReadReg (const CSD_Type *base, uint32_t offset)
Reads value from the specified the CSD HW block register.
- Parameters
base – Pointer to a CSD HW block base address.
offset – Register offset relative to base address.
- Returns
Returns a value of the CSD HW block register, specified by the offset parameter.
-
__STATIC_INLINE void Cy_CSD_WriteReg (CSD_Type *base, uint32_t offset, uint32_t value)
Writes a value to the specified CSD HW block register.
- Parameters
base – Pointer to a CSD HW block base address.
offset – Register offset relative to base address.
value – Value to be written to the register.
-
__STATIC_INLINE void Cy_CSD_SetBits (CSD_Type *base, uint32_t offset, uint32_t mask)
Sets bits, specified by the Mask parameter in the CSD HW block register, specified by the Offset parameter.
- Parameters
base – Pointer to a CSD HW block base address.
offset – Register offset relative to base address.
mask – Mask value for register bits to be set.
-
__STATIC_INLINE void Cy_CSD_ClrBits (CSD_Type *base, uint32_t offset, uint32_t mask)
Clears bits, specified by the Mask parameter in the CSD HW block register, specified by the Offset parameter.
- Parameters
base – Pointer to a CSD HW block base address.
offset – Register offset relative to base address.
mask – Mask value for register bits to be cleared.
-
__STATIC_INLINE void Cy_CSD_WriteBits (CSD_Type *base, uint32_t offset, uint32_t mask, uint32_t value)
Writes field, specified by the Mask parameter with the value, specified by the Value parameter.
- Parameters
base – Pointer to a CSD HW block base address.
offset – Register offset relative to base address.
mask – Specifies bits to be modified.
value – Specifies a value to be written to the register.
-
struct
cy_stc_csd_config_t
¶ - #include <>
CSD configuration structure.
This structure contains all register values of the CSD HW block. This structure is provided by middleware through the Cy_CSD_Init() and Cy_CSD_Configure() functions to implement the CSD HW block supported sensing modes like self-cap / mutual-cap scanning, ADC measurement, etc.
Public Members
-
uint32_t
config
¶ Stores the CSD.CONFIG register value.
-
uint32_t
spare
¶ Stores the CSD.SPARE register value.
-
uint32_t
status
¶ Stores the CSD.STATUS register value.
-
uint32_t
statSeq
¶ Stores the CSD.STAT_SEQ register value.
-
uint32_t
statCnts
¶ Stores the CSD.STAT_CNTS register value.
-
uint32_t
statHcnt
¶ Stores the CSD.STAT_HCNT register value.
-
uint32_t
resultVal1
¶ Stores the CSD.RESULT_VAL1 register value.
-
uint32_t
resultVal2
¶ Stores the CSD.RESULT_VAL2 register value.
-
uint32_t
adcRes
¶ Stores the CSD.ADC_RES register value.
-
uint32_t
intr
¶ Stores the CSD.INTR register value.
-
uint32_t
intrSet
¶ Stores the CSD.INTR_SET register value.
-
uint32_t
intrMask
¶ Stores the CSD.INTR_MASK register value.
-
uint32_t
intrMasked
¶ Stores the CSD.INTR_MASKED register value.
-
uint32_t
hscmp
¶ Stores the CSD.HSCMP register value.
-
uint32_t
ambuf
¶ Stores the CSD.AMBUF register value.
-
uint32_t
refgen
¶ Stores the CSD.REFGEN register value.
-
uint32_t
csdCmp
¶ Stores the CSD.CSDCMP register value.
-
uint32_t
swRes
¶ Stores the CSD.SW_RES register value.
-
uint32_t
sensePeriod
¶ Stores the CSD.SENSE_PERIOD register value.
-
uint32_t
senseDuty
¶ Stores the CSD.SENSE_DUTY register value.
-
uint32_t
swHsPosSel
¶ Stores the CSD.SW_HS_P_SEL register value.
-
uint32_t
swHsNegSel
¶ Stores the CSD.SW_HS_N_SEL register value.
-
uint32_t
swShieldSel
¶ Stores the CSD.SW_SHIELD_SEL register value.
-
uint32_t
swAmuxbufSel
¶ Stores the CSD.SW_AMUXBUF_SEL register value.
-
uint32_t
swBypSel
¶ Stores the CSD.SW_BYP_SEL register value.
-
uint32_t
swCmpPosSel
¶ Stores the CSD.SW_CMP_P_SEL register value.
-
uint32_t
swCmpNegSel
¶ Stores the CSD.SW_CMP_N_SEL register value.
-
uint32_t
swRefgenSel
¶ Stores the CSD.SW_REFGEN_SEL register value.
-
uint32_t
swFwModSel
¶ Stores the CSD.SW_FW_MOD_SEL register value.
-
uint32_t
swFwTankSel
¶ Stores the CSD.SW_FW_TANK_SEL register value.
-
uint32_t
swDsiSel
¶ Stores the CSD.SW_DSI_SEL register value.
-
uint32_t
ioSel
¶ Stores the CSD.IO_SEL register value.
-
uint32_t
seqTime
¶ Stores the CSD.SEQ_TIME register value.
-
uint32_t
seqInitCnt
¶ Stores the CSD.SEQ_INIT_CNT register value.
-
uint32_t
seqNormCnt
¶ Stores the CSD.SEQ_NORM_CNT register value.
-
uint32_t
adcCtl
¶ Stores the CSD.ADC_CTL register value.
-
uint32_t
seqStart
¶ Stores the CSD.SEQ_START register value.
-
uint32_t
idacA
¶ Stores the CSD.IDACA register value.
-
uint32_t
idacB
¶ Stores the CSD.IDACB register value.
-
uint32_t
-
struct
cy_stc_csd_context_t
¶ - #include <>
CSD driver context structure.
This structure is an internal structure of the CSD driver and should not be accessed directly by the application program.
Public Members
-
cy_en_csd_key_t
lockKey
¶ Middleware ID that currently captured CSD.
-
cy_en_csd_key_t