1<?xml version="1.0" encoding="utf-8"?>
2
3
4<!--****************************************************************************
5* \file lpcomp.cypersonality
6* \version 2.0
7*
8* \brief
9* Low Power Comparator personality description file. Supports CAT1A, CAT1D families of devices.
10*
11********************************************************************************
12* \copyright
13* Copyright (c) (2022), Cypress Semiconductor Corporation (an Infineon company) or
14* an affiliate of Cypress Semiconductor Corporation.
15* SPDX-License-Identifier: Apache-2.0
16*
17* Licensed under the Apache License, Version 2.0 (the "License");
18* you may not use this file except in compliance with the License.
19* You may obtain a copy of the License at
20*
21*     http://www.apache.org/licenses/LICENSE-2.0
22*
23* Unless required by applicable law or agreed to in writing, software
24* distributed under the License is distributed on an "AS IS" BASIS,
25* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26* See the License for the specific language governing permissions and
27* limitations under the License.
28*****************************************************************************-->
29
30<Personality id="lpcomp" name="Low Power Comparator" version="2.0" xmlns="http://cypress.com/xsd/cyhwpersonality_v7">
31  <Dependencies>
32    <IpBlock name="mxlpcomp_s40,mxs22lpcomp" />
33    <Resource name="lpcomp\.comp" />
34  </Dependencies>
35  <ExposedMembers />
36  <Parameters>
37    <!-- PDL documentation -->
38    <ParamDoc id="pdlDoc" name="Configuration Help" group="Overview" default="file:///`${cy_libs_path()}`/docs/pdl_api_reference_manual/html/group__group__lpcomp.html" linkText="Open LPComp Documentation" visible="true" desc="Opens the Peripheral Driver Library Documentation" />
39
40    <ParamBool id="Hysteresis" name="Hysteresis" group="General" default="true" visible="true" editable="true" desc="Allows to add approximately 30 mV of hysteresis to the LPComp. This helps to ensure that slowly moving voltages or slightly noisy voltages will not cause the output of the LPComp to oscillate when the two input voltages are nearly equal." />
41    <ParamChoice id="OutputConfiguration" name="Output Configuration" group="General" default="CY_LPCOMP_OUT_DIRECT" visible="true" editable="true" desc="Defines mode of the LPCOMP output: Direct, Synchronized, or Pulse." >
42      <Entry name="Pulse" value="CY_LPCOMP_OUT_PULSE" visible="true" />
43      <Entry name="Direct" value="CY_LPCOMP_OUT_DIRECT" visible="true" />
44      <Entry name="Synchronized" value="CY_LPCOMP_OUT_SYNC" visible="true" />
45    </ParamChoice>
46    <ParamChoice id="PowerSpeed" name="Power/Speed" group="General" default="CY_LPCOMP_MODE_LP" visible="true" editable="true" desc="The LPCOMP power setting." >
47      <Entry name="Ultra low Power/Slow" value="CY_LPCOMP_MODE_ULP" visible="true" />
48      <Entry name="Low Power/Low" value="CY_LPCOMP_MODE_LP" visible="true" />
49      <Entry name="Normal Power/Fast" value="CY_LPCOMP_MODE_NORMAL" visible="true" />
50    </ParamChoice>
51
52    <!-- Response time -->
53    <ParamString id="CAT1D_ModeNormal_ResponseTime" name="Response time for device CAT1D in Normal power mode" group="General" default="Approx: 100 ns" visible="false" editable="false" desc="" />
54    <ParamString id="CAT1D_ModeLP_ResponseTime" name="Response time for device CAT1D in LP power mode" group="General" default="Approx: 1000 ns" visible="false" editable="false" desc="" />
55    <ParamString id="CAT1D_ModeULP_ResponseTime" name="Response time for device CAT1D in ULP power mode" group="General" default="Approx: 20 us" visible="false" editable="false" desc="" />
56    <ParamString id="ResponseTime" name="Response Time" group="General" default="`${(PowerSpeed eq &quot;CY_LPCOMP_MODE_NORMAL&quot; ? CAT1D_ModeNormal_ResponseTime : (PowerSpeed eq &quot;CY_LPCOMP_MODE_LP&quot; ? CAT1D_ModeLP_ResponseTime : (PowerSpeed eq &quot;CY_LPCOMP_MODE_ULP&quot; ? CAT1D_ModeULP_ResponseTime : 0)))}`" visible="`${&quot;mxlpcomp_s40&quot; eq getIpBlockName() ? false : true}`" editable="false" desc="Display the response time of the comparator based on the Power/Speed setting." />
57
58    <ParamChoice id="PulseInterruptConfiguration" name="Pulse/Interrupt Configuration" group="General" default="CY_LPCOMP_INTR_RISING" visible="true" editable="true" desc="Defines the transition that will cause a pulse to be generated on the interrupt terminal or direct comparator output. Allows to select interrupt/output mode: Disabled, Rising edge, Falling edge, or Both edges." >
59      <Entry name="Rising Edge" value="CY_LPCOMP_INTR_RISING" visible="true" />
60      <Entry name="Falling Edge" value="CY_LPCOMP_INTR_FALLING" visible="true" />
61      <Entry name="Either Edge" value="CY_LPCOMP_INTR_BOTH" visible="true" />
62      <Entry name="Disabled" value="CY_LPCOMP_INTR_DISABLE" visible="true" />
63    </ParamChoice>
64    <ParamBool id="LocalVrefInput" name="Local VREF input" group="General" default="false" visible="true" editable="true" desc="Enables the internal reference voltage as the input to the negative terminal (vminus). This is not the precision reference and it can vary in the range 0.45V - 0.75V." />
65
66    <ParamSignal name="Positive Input (inp)" group="Connections" port="inp[0]" visible="true" desc="This analog input is usually connected to the voltage that is being compared." canBeEmpty="true" />
67    <ParamSignal name="Negative Input (inn)" group="Connections" port="inn[0]" visible="`${!LocalVrefInput}`" desc="This analog input is usually connected to the reference voltage." canBeEmpty="true" />
68    <ParamSignal name="Compare Output (dsi_comp)" group="Connections" port="dsi_comp[0]" visible="true" desc="This digital output is configured by the 'Output Configuration' parameter can be used to trigger an interrupt, routed to digital logic or sent to a pin." canBeEmpty="true" >
69      <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" >
70        <Parameter id="DriveModes" severity="DEFAULT" reason="">
71          <Fixed value="CY_GPIO_DM_STRONG_IN_OFF" />
72        </Parameter>
73      </Constraint>
74      <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" >
75        <Parameter id="DriveModes" severity="INFO" reason="The pin Drive Mode parameter does not match expected.">
76          <Fixed value="CY_GPIO_DM_STRONG_IN_OFF" />
77        </Parameter>
78      </Constraint>
79      <Constraint type="ACCEPT" targetLocation=".*" valid="true" />
80    </ParamSignal>
81
82    <ParamBool id="inFlash" name="Store Config in Flash" group="Advanced" default="true" visible="true" editable="true" desc="Controls whether the configuration structure is stored in flash (const, true) or SRAM (not const, false)." />
83  </Parameters>
84  <ConfigFirmware>
85    <ConfigInclude value="cy_lpcomp.h" include="true" />
86    <ConfigInclude value="cyhal_hwmgr.h" include="true" guard="defined (CY_USING_HAL)" />
87
88    <!-- There can be only one instance of the LPComp block on a device -->
89    <ConfigDefine name="`${INST_NAME . &quot;_HW&quot;}`" value="LPCOMP" public="true" include="true" />
90    <ConfigDefine name="`${INST_NAME . &quot;_CHANNEL&quot;}`" value="CY_LPCOMP_CHANNEL_`${getInstNumber(&quot;comp&quot;)}`" public="true" include="true" />
91    <ConfigDefine name="`${INST_NAME}`_IRQ" value="lpcomp_interrupt_IRQn" public="true" include="true" />
92    <ConfigStruct name="`${INST_NAME . &quot;_config&quot;}`" type="cy_stc_lpcomp_config_t" const="`${inFlash}`" public="true" include="true" >
93      <Member name="outputMode" value="`${OutputConfiguration}`" />
94      <Member name="hysteresis" value="`${Hysteresis ? &quot;CY_LPCOMP_HYST_ENABLE&quot; : &quot;CY_LPCOMP_HYST_DISABLE&quot;}`" />
95      <Member name="power" value="`${PowerSpeed}`" />
96      <Member name="intType" value="`${PulseInterruptConfiguration}`" />
97    </ConfigStruct>
98
99    <ConfigStruct name="`${INST_NAME}`_obj" type="cyhal_resource_inst_t" const="true" public="true" include="true" guard="defined (CY_USING_HAL)">
100      <Member name="type" value="CYHAL_RSC_LPCOMP" />
101      <Member name="block_num" value="`${getInstNumber(&quot;lpcomp&quot;)}`U" />
102      <Member name="channel_num" value="`${getInstNumber(&quot;comp&quot;)}`U" />
103    </ConfigStruct>
104
105    <ConfigInstruction value="Cy_LPComp_UlpReferenceEnable(`${INST_NAME}`_HW);" include="`${LocalVrefInput || (PowerSpeed eq CY_LPCOMP_MODE_ULP)}`"  />
106    <ConfigInstruction value="Cy_LPComp_ConnectULPReference(`${INST_NAME}`_HW, `${INST_NAME . &quot;_CHANNEL&quot;}`);" include="`${LocalVrefInput}`"  />
107    <ConfigInstruction value="cyhal_hwmgr_reserve(&amp;`${INST_NAME}`_obj);" include="true" guard="defined (CY_USING_HAL)" />
108  </ConfigFirmware>
109</Personality>
110