Display/Character Management Functions

group group_seglcd_functions_display

Functions

cy_en_seglcd_status_t Cy_SegLCD_WriteChar(LCD_Type *base, char_t character, uint32_t position, cy_stc_seglcd_disp_t const *display)

Writes a specified character onto a specified display.

Supports all display types except CY_SEGLCD_BAR.

Return

cy_en_seglcd_status_t.

Function Usage

        /* Scenario: Write characters so that there the word 'char' is created */
        /* Set up the custom alphanumerical font for 7-segment display */
        display.font = &customAsciiFont7Seg; /* Set up the alphanumerical font */
        (void) Cy_SegLCD_WriteChar(LCD0, 'c', 0, &display);
        (void) Cy_SegLCD_WriteChar(LCD0, 'h', 1, &display);
        (void) Cy_SegLCD_WriteChar(LCD0, 'a', 2, &display);
        (void) Cy_SegLCD_WriteChar(LCD0, 'r', 3, &display);

Parameters

cy_en_seglcd_status_t Cy_SegLCD_WriteString(LCD_Type *base, char_t const *string, uint32_t position, cy_stc_seglcd_disp_t const *display)

Writes a specified zero-terminated char string onto a specified display.

Supports all display types except CY_SEGLCD_BAR.

Return

cy_en_seglcd_status_t.

Function Usage

        /* Scenario: Write a string starting at the most left symbol on display */
        char_t * string = "Font";
        /* Set up the custom alphanumerical font for 7-segment display */
        display.font = &customAsciiFont7Seg;
        if (CY_SEGLCD_SUCCESS != Cy_SegLCD_WriteString(LCD0, string, 0, &display))
        {
            /* error handling */
        }

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

  • string: The pointer to the ASCII-coded null-terminated character string.

  • position: The position of the first string character at the display as counted left to right starting at 0 - the first symbol on the left of the specified display. If the specified display contains fewer symbols than the string requires to be displayed, the extra character(s) is(are) not displayed and the CY_SEGLCD_EXCEED value is returned.

  • display: The pointer to the display structure cy_stc_seglcd_disp_t.

cy_en_seglcd_status_t Cy_SegLCD_WriteNumber(LCD_Type *base, uint32_t value, uint32_t position, cy_stc_seglcd_disp_t const *display, bool zeroes, bool hex)

Displays an integer value onto a specified display.

Supports all display types except CY_SEGLCD_BAR.

note

The sign conversion, sign display, decimal points, and other special segments outside the display symbols themselves should be handled on upper layer code.

Return

cy_en_seglcd_status_t.

Function Usage

        /* Scenario: Write a decimal number starting at the most right symbol on display: */
        if (CY_SEGLCD_SUCCESS != Cy_SegLCD_WriteNumber(LCD0, 12, 3, &display, false, false))
        {
            /* error handling */
        }
        /* Scenario: Write a hexadecimal number with trailing zeroes: */
        if (CY_SEGLCD_SUCCESS != Cy_SegLCD_WriteNumber(LCD0, 12, 3, &display, true, true))
        {
            /* error handling */
        }

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

  • value: The unsigned integer number to be displayed.

  • position: The position of the least significant digit of the number as counted left to right starting at 0 - the first symbol on the left of the specified display. If the specified display contains fewer symbols than the number requires to be displayed, the extra (more significant) digit(s) is(are) not displayed and the CY_SEGLCD_EXCEED value is returned.

  • display: The pointer to the display structure cy_stc_seglcd_disp_t.

  • zeroes:

    • true - all the unused digits on the left of the displayed value are zeroes.

    • false - all the above mentioned digits are blank.

  • hex:

    • true - the value is displayed in the hexadecimal format.

    • false - the value is displayed in the decimal format.

cy_en_seglcd_status_t Cy_SegLCD_BarGraph(LCD_Type *base, uint32_t value, uint32_t position, cy_stc_seglcd_disp_t const *display)

Draws a bar onto a specified bar graph / dial display.

Only the CY_SEGLCD_BAR display type is supported.

Return

cy_en_seglcd_status_t.

Function Usage

#define BAR_LENGTH (4)
const uint32_t barGraphPixMap[BAR_LENGTH] =
{
    CY_SEGLCD_PIXEL(LCD_SEG_6,  7UL),
    CY_SEGLCD_PIXEL(LCD_SEG_5,  7UL),
    CY_SEGLCD_PIXEL(LCD_SEG_4,  7UL),
    CY_SEGLCD_PIXEL(LCD_SEG_2,  7UL)
};

const cy_stc_seglcd_disp_t barGraph =
{
    .type   = CY_SEGLCD_BAR,
    .symNum = BAR_LENGTH,
    .invert = false,
    .pixMap = (uint32_t*)barGraphPixMap,
    .font   = NULL
};
    uint32_t barGraphValue = 3UL; /* the value from 0 to barGraph.symNum */
    /* Scenario: Write a bar graph starting from the first pixel of the barGraph display */
    if (CY_SEGLCD_SUCCESS != Cy_SegLCD_BarGraph(LCD0, barGraphValue, 0UL, &barGraph))
    {
        /* error handling */
    }

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

  • value: The length of the bar in pixels.

  • position: The position of the first bar pixel as counted from the beginning (‘0’ is the first pixel) of the specified display. If the specified display contains fewer pixels than the bar requires to be displayed, the extra pixel(s) is(are) not displayed and the CY_SEGLCD_EXCEED value is returned.

  • display: The pointer to the display structure cy_stc_seglcd_disp_t.