PSoC 6 Peripheral Driver Library
Block Configuration Functions

General Description

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. More...
 
cy_en_seglcd_status_t Cy_SegLCD_Contrast (LCD_Type *base, uint32_t contrast, cy_stc_seglcd_config_t *config)
 Sets a specified contrast. More...
 
void Cy_SegLCD_Deinit (LCD_Type *base)
 De-initializes the LCD block (resets the block registers to default state). More...
 
void Cy_SegLCD_Enable (LCD_Type *base)
 Enables the Segment LCD block. More...
 
void Cy_SegLCD_Disable (LCD_Type *base)
 Disables the Segment LCD block. More...
 

Function Documentation

◆ Cy_SegLCD_Init()

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.

Parameters
baseThe base pointer to the LCD instance registers.
configThe pointer to a configuration structure.
Returns
cy_en_seglcd_status_t.

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

Function Usage
/* Scenario: Enable an LCD block */
{
.drive = CY_SEGLCD_PWM,
.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 */
if (CY_SEGLCD_SUCCESS == Cy_SegLCD_Init(LCD0, &config))
{
if (CY_SEGLCD_SUCCESS == Cy_SegLCD_ClrFrame(LCD0, commons))
{
/* 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_SegLCD_Contrast()

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

Sets a specified contrast.

Parameters
baseThe base pointer to the LCD instance registers.
contrastThe contrast value to be set.
configThe pointer to a configuration structure.
Returns
cy_en_seglcd_status_t.

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

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 */
}

◆ Cy_SegLCD_Deinit()

void Cy_SegLCD_Deinit ( LCD_Type *  base)

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

Parameters
baseThe base pointer to the LCD instance registers.
Function Usage
/* Scenario: Reset all the block registers to their default values */

◆ Cy_SegLCD_Enable()

void Cy_SegLCD_Enable ( LCD_Type *  base)

Enables the Segment LCD block.

Parameters
baseThe base pointer to the LCD instance registers.
Function Usage
/* Scenario: Enable an LCD block */
{
.drive = CY_SEGLCD_PWM,
.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 */
if (CY_SEGLCD_SUCCESS == Cy_SegLCD_Init(LCD0, &config))
{
if (CY_SEGLCD_SUCCESS == Cy_SegLCD_ClrFrame(LCD0, commons))
{
/* 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_SegLCD_Disable()

void Cy_SegLCD_Disable ( LCD_Type *  base)

Disables the Segment LCD block.

Parameters
baseThe base pointer to the LCD instance registers.
Function Usage
/* Scenario: Stop the LCD signal generation */