Newer
Older
mbed-os / targets / TARGET_Cypress / TARGET_PSOC6 / mtb-pdl-cat1 / personalities / peripheral / seglcd-1.1.cypersonality
@Dustin Crossman Dustin Crossman on 4 Jun 2021 17 KB Fix file modes.
<?xml version="1.0" encoding="utf-8"?>


<!--****************************************************************************
* \file seglcd.cypersonality
* \version 1.1.1
*
* \brief
* LCD personality description file.
*
********************************************************************************
* \copyright
* Copyright 2019-2020 Cypress Semiconductor Corporation
* SPDX-License-Identifier: Apache-2.0
*
* 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
*
* 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 express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************-->

<Personality id="seglcd" name="Segment LCD" version="1.1" path="System" xmlns="http://cypress.com/xsd/cyhwpersonality_v1">
  <Dependencies>
    <IpBlock name="mxlcd,mxlcd_ver2" />
    <Resource name="lcd\.drive" used="true" />
  </Dependencies>
  <ExposedMembers>
    <ExposedMember key="configured" paramId="configured" />
  </ExposedMembers>
  <Parameters>
    <!-- PDL documentation -->
    <ParamDoc id="pdlDoc" name="Configuration Help" group="Peripheral Documentation" default="file:///`${cy_libs_path()}`/docs/pdl_api_reference_manual/html/group__group__seglcd.html" linkText="Open SegLCD Documentation" visible="true" desc="Opens the Peripheral Driver Library Documentation" />

    <ParamRange id="maxComNum" name="maxComNum" group="Internal" default="`${CHIP_TOP.COM_NR}`" min="0" max="100" resolution="1" visible="false" editable="false" desc="" />
    <ParamRange id="maxPinNum" name="maxPinNum" group="Internal" default="`${CHIP_TOP.PIN_NR}`" min="0" max="100" resolution="1" visible="false" editable="false" desc="" />
    <ParamRange id="comNum" name="Commons" group="Internal" default="0" min="0" max="`${CHIP_TOP.COM_NR}`" resolution="1" visible="false" editable="true" desc="" />
    <ParamRange id="segNum" name="Segments" group="Internal" default="0" min="0" max="`${CHIP_TOP.PIN_NR}`" resolution="1" visible="false" editable="true" desc="" />
    <ParamBool id="configured" name="configured" group="Internal" default="`${1 &lt; comNum}`" visible="false" editable="false" desc="" />
    <ParamString id="cfgFileName" name="cfgFileName" group="External Tools" default="design.cyseglcd" visible="false" editable="false" desc="" />
    <ParamString id="cfgFilePath" name="cfgFilePath" group="External Tools" default="`${cy_design_path() . &quot;/&quot; . cfgFileName}`" visible="false" editable="false" desc="" />

    <ParamCustom id="configurator" name="SegLCD Configurator" group="External Tools" default="0" path="`${cy_tools_path(&quot;seglcd-configurator&quot;) . &quot;/seglcd-configurator&quot;}`" modal="true" visible="true" editable="true" desc="Launch SegLCD Configurator.">
      <Arg value="`${&quot;--config=&quot; . cfgFilePath}`" />
      <Arg value="`${&quot;--output-dir=&quot; . cy_codegen_path()}`" />
      <Arg value="`${&quot;--design=&quot; . cy_design_file()}`" />
      <Arg value="`${&quot;--library=&quot; . cy_libs_file()}`" />
      <Arg value="`${&quot;-n=&quot; . INST_NAME}`" />
    </ParamCustom>

    <ParamChoice id="speed" name="Speed Mode" group="General" default="CY_SEGLCD_SPEED_LOW" visible="true" editable="true" desc="The Speed Mode: Low Speed or High Speed.">
      <Entry name="Low Speed" value="CY_SEGLCD_SPEED_LOW" visible="true" />
      <Entry name="High Speed" value="CY_SEGLCD_SPEED_HIGH" visible="true" />
    </ParamChoice>
    <ParamBool id="speedLow" name="speedLow" group="Internal" default="`${speed eq CY_SEGLCD_SPEED_LOW}`" visible="false" editable="false" desc="" />
    <ParamSignal port="clock[0]" name="Clock" group="General" visible="true" desc="High speed clock source" canBeEmpty="`${speed eq CY_SEGLCD_SPEED_LOW}`" />

    <ParamBool id="ipver1" name="IP Version 1" group="Internal" default="`${1 eq getVersion()}`" visible="false" editable="false" desc="" />
    <ParamBool id="ipver2" name="IP Version 2" group="Internal" default="`${2 eq getVersion()}`" visible="false" editable="false" desc="" />

    <ParamChoice id="lsClk" name="Low Speed Clock Input" group="General" default="CY_SEGLCD_LSCLK_LF" visible="`${speedLow &amp;&amp; ipver2}`" editable="true" desc="The Low Speed Clock Source selection.">
      <Entry name="Low Frequency"    value="CY_SEGLCD_LSCLK_LF" visible="true" />
      <Entry name="Medium Frequency" value="CY_SEGLCD_LSCLK_MF" visible="true" />
    </ParamChoice>

    <ParamSignal port="clk_mf[0]" name="MF Clock" group="General" visible="`${ipver2}`" desc="Low speed medium frequency slock source" canBeEmpty="`${ipver1 || (lsClk eq CY_SEGLCD_LSCLK_LF)}`" />

    <ParamChoice id="drive" name="Driving Mode" group="General" default="CY_SEGLCD_CORRELATION" visible="true" editable="true" desc="Driving mode configuration">
      <Entry name="Digital Correlation" value="CY_SEGLCD_CORRELATION" visible="true" />
      <Entry name="PWM" value="CY_SEGLCD_PWM" visible="true" />
    </ParamChoice>

    <ParamChoice id="bias" name="PWM Bias" group="General" default="CY_SEGLCD_BIAS_HALF" visible="`${drive eq CY_SEGLCD_PWM}`" editable="true" desc="PWM bias selection">
      <Entry name="1/2 Bias" value="CY_SEGLCD_BIAS_HALF" visible="true" />
      <Entry name="1/3 Bias" value="CY_SEGLCD_BIAS_THIRD" visible="true" />
      <Entry name="1/4 Bias" value="CY_SEGLCD_BIAS_FOURTH" visible="`${(speed eq CY_SEGLCD_SPEED_HIGH) || ipver2}`" />
      <Entry name="1/5 Bias" value="CY_SEGLCD_BIAS_FIFTH" visible="`${(speed eq CY_SEGLCD_SPEED_HIGH) || ipver2}`" />
    </ParamChoice>

    <ParamChoice id="wave" name="Waveform Type" group="General" default="CY_SEGLCD_TYPE_A" visible="true" editable="true" desc="Type A - Each frame addresses each COM pin only once with a balanced (DC=0) waveform. Type B - Each frame addresses each COM pin twice in sequence with a positive and negative waveform that together are balanced (DC=0).">
      <Entry name="Type A" value="CY_SEGLCD_TYPE_A" visible="true"/>
      <Entry name="Type B" value="CY_SEGLCD_TYPE_B" visible="true"/>
    </ParamChoice>

    <ParamChoice id="frRate" name="Frame Rate (Hz)" group="General" default="60" visible="true" editable="true" desc="The desired LCD frame rate">
      <Entry name="30" value="30" visible="true" />
      <Entry name="40" value="40" visible="true" />
      <Entry name="50" value="50" visible="true" />
      <Entry name="60" value="60" visible="true" />
      <Entry name="70" value="70" visible="true" />
      <Entry name="80" value="80" visible="true" />
      <Entry name="90" value="90" visible="true" />
      <Entry name="100" value="100" visible="true" />
      <Entry name="110" value="110" visible="true" />
      <Entry name="120" value="120" visible="true" />
      <Entry name="130" value="130" visible="true" />
      <Entry name="140" value="140" visible="true" />
      <Entry name="150" value="150" visible="true" />
    </ParamChoice>

    <ParamRange id="contrast" name="Contrast (%)" group="General" default="60" min="0" max="100" resolution="1" visible="true" editable="true" desc="The desired LCD contrast" />

    <Repeat count="16">
        <ParamSignal port="comP[$idx]" name="Com[$idx]" group="Connections" visible="`${$idx &lt; comNum}`" desc="The LCD common line" canBeEmpty="`${$idx &gt; comNum - 1}`" multiSelect="false">
          <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" >
            <Parameter id="DriveModes" severity="DEFAULT" reason="">
              <Fixed value="CY_GPIO_DM_PULLUP_DOWN_IN_OFF" />
            </Parameter>
            <Parameter id="driveStrength" severity="DEFAULT" reason="">
              <Fixed value="CY_GPIO_DRIVE_1_8" />
            </Parameter>
          </Constraint>
          <Constraint type="ACCEPT" targetLocation=".*" valid="true" />
        </ParamSignal>
    </Repeat>

    <Repeat count="62">
        <ParamSignal port="segP[$idx]" name="Seg[$idx]" group="Connections" visible="`${$idx &lt; segNum}`" desc="The LCD segment line" canBeEmpty="`${$idx &gt; segNum - 1}`" multiSelect="false">
          <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" >
            <Parameter id="DriveModes" severity="DEFAULT" reason="">
              <Fixed value="CY_GPIO_DM_PULLUP_DOWN_IN_OFF" />
            </Parameter>
            <Parameter id="driveStrength" severity="DEFAULT" reason="">
              <Fixed value="CY_GPIO_DRIVE_1_8" />
            </Parameter>
          </Constraint>
          <Constraint type="ACCEPT" targetLocation=".*" valid="true" />
        </ParamSignal>
    </Repeat>

    <ParamString id="clkLf" name="clkLf" group="Internal" default="srss[0].clock[0].lfclk[0]" visible="false" editable="false" desc="" />
    <ParamString id="clkMf" name="clkMf" group="Internal" default="srss[0].clock[0].mfclk[0]" visible="false" editable="false" desc="" />
    <ParamString id="clkHsRsc" name="clkHsRsc" group="Internal" default="`${getBlockFromSignal(&quot;clock[0]&quot;)}`" visible="false" editable="false" desc="" />
    <ParamString id="clkLsRsc" name="clkLsRsc" group="Internal" default="`${(lsClk eq CY_SEGLCD_LSCLK_MF) ? clkMf : clkLf}`" visible="false" editable="false" desc="" />
    <ParamBool id="clkHsOk" name="clkHsOk" group="Internal" default="`${hasConnection(&quot;clock&quot;, 0) &amp;&amp; isBlockUsed(clkHsRsc)}`" visible="false" editable="false" desc="" />
    <ParamBool id="clkLsOk" name="clkLsOk" group="Internal" default="`${isBlockUsed(clkLsRsc)}`" visible="false" editable="false" desc="" />
    <ParamBool id="clkOk" name="clkOk" group="Internal" default="`${speedLow ? clkLsOk : clkHsOk}`" visible="false" editable="false" desc="" />
    <ParamRange  id="frqHs" name="frqHs" group="Internal" default="`${(clkHsOk) ? getExposedMember(clkHsRsc, &quot;frequency&quot;) : 0}`" min="0" max="200000000" resolution="1" visible="false" editable="false" desc="" />
    <ParamRange  id="frqLs" name="frqLs" group="Internal" default="`${(clkLsOk) ? getExposedMember(clkLsRsc, &quot;frequency&quot;) : 0}`" min="0" max="200000000" resolution="1" visible="false" editable="false" desc="" />
    <ParamString id="accHs" name="AccHs" group="Internal" default="`${(clkHsOk) ? getExposedMember(clkHsRsc, &quot;accuracy&quot;) : 0}`" visible="false" editable="false" desc="" />
    <ParamString id="accLs" name="AccLs" group="Internal" default="`${(clkLsOk) ? getExposedMember(clkLsRsc, &quot;accuracy&quot;) : 0}`" visible="false" editable="false" desc="" />
    <ParamRange  id="frequency" name="frequency" group="Internal" default="`${speedLow ? frqLs : frqHs}`" min="0" max="200000000" resolution="1" visible="false" editable="false" desc="" />
    <ParamString id="accuracy"  name="accuracy"  group="Internal" default="`${speedLow ? accLs : accHs}`" visible="false" editable="false" desc="" />
    <ParamString id="frequencyInfo" name="Clock Frequency" group="General" default="`${formatFrequency(frequency,accuracy)}`" visible="true" editable="false" desc="The input clocking frequency" />
    <ParamRange id="instance" name="instance" group="Internal" default="`${getInstNumber(&quot;lcd&quot;)}`" min="0" max="10" resolution="1" visible="false" editable="false" desc="" />
    <ParamRange id="subfrDiv" name="Sub-Frame Divider" group="General" default="`${clkOk &amp;&amp; configured ? ((frequency / (frRate * 4.0 * comNum) - 1.0) * contrast / 100.0) : 0}`" min="0" max="1000000000" resolution="1" visible="true" editable="false" desc="The LCD signal generator divider for sub-frame timing generation, depends on the number of common lines, input clocking frequency and the desired contrast and frame rate" />
    <ParamRange id="deadDiv" name="Dead Divider" group="General" default="`${clkOk &amp;&amp; configured ? ((frequency / frRate) * (1.0 - (contrast / 100.0))) : 0}`" min="0" max="1000000000" resolution="1" visible="true" editable="false" desc="The LCD signal generator divider for dead time period generation, depends on the input clocking frequency and the desired contrast and frame rate" />

    <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)." />
  </Parameters>
  <DRCs>
    <DRC type="ERROR" text="The Sub-Frame Divider should not exceed 16-bit in High Speed Mode, please decrease the input clock frequency or increase the contrast or frame rate or number of common lines using SegLCD Configurator" condition="`${(subfrDiv &gt; 65535) &amp;&amp; ((speed eq CY_SEGLCD_SPEED_HIGH) || ipver2)}`" />
    <DRC type="ERROR" text="The Dead Divider should not exceed 16-bit in High Speed Mode, please decrease the contrast or input clock frequency or increase the frame rate" condition="`${(deadDiv &gt; 65535) &amp;&amp; ((speed eq CY_SEGLCD_SPEED_HIGH) || ipver2)}`" />

    <DRC type="ERROR" text="The Sub-Frame Divider should not exceed 8-bit in Low Speed Mode, please decrease the input clock frequency or increase the contrast or frame rate or number of common lines using SegLCD Configurator" condition="`${(subfrDiv &gt; 255) &amp;&amp; speedLow &amp;&amp; ipver1}`" />
    <DRC type="ERROR" text="The Dead Divider should not exceed 8-bit in Low Speed Mode, please decrease the contrast or input clock frequency or increase the frame rate" condition="`${(deadDiv &gt; 255) &amp;&amp; speedLow &amp;&amp; ipver1}`" />

    <DRC type="ERROR" text="The Low Frequency Clock Source (CLK_LF) should be enabled" condition="`${speedLow &amp;&amp; (lsClk eq CY_SEGLCD_LSCLK_LF) &amp;&amp; !isBlockUsed(clkLf)}`" />
    <DRC type="ERROR" text="The Meduim Frequency Clock Source (typically CLK_MF) should be enabled" condition="`${speedLow &amp;&amp; (lsClk eq CY_SEGLCD_LSCLK_MF) &amp;&amp; !isBlockUsed(clkMf)}`" />

    <DRC type="INFO" text="Launch the SegLCD Configurator to configure your displays" condition="`${!configured}`" />
  </DRCs>
  <ConfigFirmware>
    <!-- External tools -->
    <ConfigTool value="`${cy_tools_path(&quot;seglcd-configurator&quot;) . &quot;/seglcd-configurator-cli&quot;}`" include="`${configured}`">
      <Arg value="`${&quot;--config=&quot; . cfgFilePath}`" />
      <Arg value="`${&quot;--output-dir=&quot; . cy_codegen_path()}`" />
      <Arg value="`${&quot;-n=&quot; . INST_NAME}`" />
    </ConfigTool>

    <ConfigInclude value="cy_seglcd.h" include="true" />
    <ConfigInclude value="cy_sysclk.h" include="`${clkHsOk}`" />
    <ConfigInclude value="cycfg_routing.h" include="true" />
    <ConfigInclude value="cyhal_hwmgr.h" include="true" guard="defined (CY_USING_HAL)" />

    <ConfigDefine name="`${INST_NAME}`_HW" value="LCD0" public="true" include="true" />
    <ConfigDefine name="`${INST_NAME}`_COM_NUM" value="`${comNum}`" public="true" include="`${configured}`" />
    <ConfigDefine name="`${INST_NAME}`_SEG_NUM" value="`${segNum}`" public="true" include="`${configured}`" />
    <ConfigDefine name="`${INST_NAME}`_FRAME_RATE" value="`${frRate}`" public="true" include="true" />
    <ConfigDefine name="`${INST_NAME}`_CONTRAST" value="`${contrast}`" public="true" include="true" />
    <ConfigDefine name="`${INST_NAME}`_CLOCK_FREQ" value="`${frequency}`" public="true" include="true" />
    <ConfigDefine name="`${INST_NAME}`_CONST_MODIFIER" value="`${inFlash ? &quot;const&quot; : &quot;&quot;}`" public="true" include="true" />

    <ConfigDefine name="`${INST_NAME . &quot;_COM_&quot; . $idx}`" value="`${&quot;LCD&quot; . instance . &quot;_DRIVE0_COM&quot; . $idx}`" public="true" include="`${$idx &lt; comNum}`" repeatCount="16"/>
    <ConfigDefine name="`${INST_NAME . &quot;_SEG_&quot; . $idx}`" value="`${&quot;LCD&quot; . instance . &quot;_DRIVE0_SEG&quot; . $idx}`" public="true" include="`${$idx &lt; segNum}`" repeatCount="62"/>

    <!--ConfigStruct name="`${INST_NAME}`_commons" type="uint32_t" const="true" isArray="true" public="true" include="true">
      <Member name="`${##}`"
             value="`${&quot;CY_SEGLCD_COMMON(&quot; . INST_NAME . &quot;_COM_&quot; . ## . &quot;,&quot; . ## . &quot;UL)&quot;}`"
           include="`${## &lt; comNum}`"
             count="16"/>
    </ConfigStruct-->

    <ConfigStruct name="`${INST_NAME . &quot;_config&quot;}`" type="cy_stc_seglcd_config_t" const="`${inFlash}`" public="true" include="`${configured}`">
      <Member name="speed"    value="`${speed}`" />
      <Member name="wave"     value="`${wave}`"  />
      <Member name="drive"    value="`${drive}`" />
      <Member name="bias"     value="`${bias}`"  />
      <Member name="lsClk"    value="`${lsClk}`"  />
      <Member name="comNum"   value="`${INST_NAME}`_COM_NUM"    />
      <Member name="frRate"   value="`${INST_NAME}`_FRAME_RATE" />
      <Member name="contrast" value="`${INST_NAME}`_CONTRAST"   />
      <Member name="clkFreq"  value="`${INST_NAME}`_CLOCK_FREQ" />
    </ConfigStruct>

    <ConfigStruct name="`${INST_NAME}`_obj" type="cyhal_resource_inst_t" const="true" public="true" include="true" guard="defined (CY_USING_HAL)">
      <Member name="type" value="CYHAL_RSC_LCD" />
      <Member name="block_num" value="`${getInstNumber(&quot;lcd&quot;)}`U" />
      <Member name="channel_num" value="0" />
    </ConfigStruct>

    <ConfigInstruction value="Cy_SysClk_PeriphAssignDivider(PCLK_LCD_CLOCK, `${getExposedMember(clkHsRsc, &quot;clockSel&quot;)}`);" include="`${clkHsOk &amp;&amp; configured}`" />
    <ConfigInstruction value="cyhal_hwmgr_reserve(&amp;`${INST_NAME}`_obj);" include="true" guard="defined (CY_USING_HAL)" />
  </ConfigFirmware>
</Personality>