Block Configuration Functions

group group_seglcd_functions_config

Functions

cy_en_seglcd_status_t Cy_SegLCD_Init(LCD_Type *base, cy_stc_seglcd_config_t const *config)

Initializes/restores the default Segment LCD block configuration.

Side Effects: The block is disabled to change the settings.

Return

cy_en_seglcd_status_t.

Parameters
  • base: The base pointer to the LCD instance registers.

  • config: The pointer to a configuration structure.

Function Usage

/* Scenario: Enable an LCD block */

cy_stc_seglcd_config_t config =
{
    .speed = CY_SEGLCD_SPEED_HIGH,
    .wave = CY_SEGLCD_TYPE_B,
    .drive = CY_SEGLCD_PWM,
    .bias = CY_SEGLCD_BIAS_FOURTH,
    .lsClk = CY_SEGLCD_LSCLK_LF,
    .comNum = 8,
    .frRate = 70,
    .contrast = 70,
  /*.clkFreq is unknown here */
};

const uint32_t commons[8] =
{
    CY_SEGLCD_COMMON(LCD_COM_0, 0UL),
    CY_SEGLCD_COMMON(LCD_COM_1, 1UL),
    CY_SEGLCD_COMMON(LCD_COM_2, 2UL),
    CY_SEGLCD_COMMON(LCD_COM_3, 3UL),
    CY_SEGLCD_COMMON(LCD_COM_4, 4UL),
    CY_SEGLCD_COMMON(LCD_COM_5, 5UL),
    CY_SEGLCD_COMMON(LCD_COM_6, 6UL),
    CY_SEGLCD_COMMON(LCD_COM_7, 7UL)
};
    /* Then in executable code: */

    /* Get the frequency of the assigned peripheral clock divider */
    config.clkFreq  = Cy_SysClk_PeriphGetFrequency(CY_SYSCLK_DIV_8_BIT, 0U);

    if (CY_SEGLCD_SUCCESS == Cy_SegLCD_Init(LCD0, &config))
    {
        if (CY_SEGLCD_SUCCESS == Cy_SegLCD_ClrFrame(LCD0, commons))
        {
            Cy_SegLCD_Enable(LCD0);
            
           /* Now the block generates LCD signals (all the pixels are off) and is ready to turn on any pixel
            * (or many pixels) using any of the frame/pixel/character/display management API functions.
            */
        }
        else
        {
            /* error handling */
        }
    }
    else
    {
        /* error handling */
    }

cy_en_seglcd_status_t Cy_SegLCD_Contrast(LCD_Type *base, uint32_t contrast, cy_stc_seglcd_config_t *config)

Sets a specified contrast.

Side Effects: The configuration structure contrast value is also updated.

Return

cy_en_seglcd_status_t.

Parameters
  • base: The base pointer to the LCD instance registers.

  • contrast: The contrast value to be set.

  • config: The pointer to a configuration structure.

Function Usage

    uint32_t contrast = 70UL; /* Contrast value from 0 to 100 */
    /* Scenario: Adjust the LCD contrast */
    if (CY_SEGLCD_SUCCESS != Cy_SegLCD_Contrast(LCD0, contrast, &config))
    {
        /* error handling */
    }

void Cy_SegLCD_Deinit(LCD_Type *base)

De-initializes the LCD block (resets the block registers to default state).

Function Usage

    /* Scenario: Reset all the block registers to their default values */
    Cy_SegLCD_Deinit(LCD0);

Parameters
  • base: The base pointer to the LCD instance registers.

void Cy_SegLCD_Enable(LCD_Type *base)

Enables the Segment LCD block.

Function Usage

/* Scenario: Enable an LCD block */

cy_stc_seglcd_config_t config =
{
    .speed = CY_SEGLCD_SPEED_HIGH,
    .wave = CY_SEGLCD_TYPE_B,
    .drive = CY_SEGLCD_PWM,
    .bias = CY_SEGLCD_BIAS_FOURTH,
    .lsClk = CY_SEGLCD_LSCLK_LF,
    .comNum = 8,
    .frRate = 70,
    .contrast = 70,
  /*.clkFreq is unknown here */
};

const uint32_t commons[8] =
{
    CY_SEGLCD_COMMON(LCD_COM_0, 0UL),
    CY_SEGLCD_COMMON(LCD_COM_1, 1UL),
    CY_SEGLCD_COMMON(LCD_COM_2, 2UL),
    CY_SEGLCD_COMMON(LCD_COM_3, 3UL),
    CY_SEGLCD_COMMON(LCD_COM_4, 4UL),
    CY_SEGLCD_COMMON(LCD_COM_5, 5UL),
    CY_SEGLCD_COMMON(LCD_COM_6, 6UL),
    CY_SEGLCD_COMMON(LCD_COM_7, 7UL)
};
    /* Then in executable code: */

    /* Get the frequency of the assigned peripheral clock divider */
    config.clkFreq  = Cy_SysClk_PeriphGetFrequency(CY_SYSCLK_DIV_8_BIT, 0U);

    if (CY_SEGLCD_SUCCESS == Cy_SegLCD_Init(LCD0, &config))
    {
        if (CY_SEGLCD_SUCCESS == Cy_SegLCD_ClrFrame(LCD0, commons))
        {
            Cy_SegLCD_Enable(LCD0);
            
           /* Now the block generates LCD signals (all the pixels are off) and is ready to turn on any pixel
            * (or many pixels) using any of the frame/pixel/character/display management API functions.
            */
        }
        else
        {
            /* error handling */
        }
    }
    else
    {
        /* error handling */
    }

Parameters
  • base: The base pointer to the LCD instance registers.

void Cy_SegLCD_Disable(LCD_Type *base)

Disables the Segment LCD block.

Function Usage

    /* Scenario: Stop the LCD signal generation */
    Cy_SegLCD_Disable(LCD0);

Parameters
  • base: The base pointer to the LCD instance registers.