MTB CAT1 Peripheral driver library
Display/Character Management Functions

General Description

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. More...
 
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. More...
 
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. More...
 
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. More...
 

Function Documentation

◆ Cy_SegLCD_WriteChar()

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.

Parameters
baseThe base pointer to the LCD instance registers.
characterThe code of the character to display. Should be within the font symbol codes range specified by cy_stc_seglcd_font_t::first and cy_stc_seglcd_font_t::last
positionThe position of the character/digit on display. Zero is the most left character/digit of the specified display cy_stc_seglcd_disp_t.
displayThe pointer to the display structure cy_stc_seglcd_disp_t.
Returns
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);

◆ Cy_SegLCD_WriteString()

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.

Parameters
baseThe base pointer to the LCD instance registers.
stringThe pointer to the ASCII-coded null-terminated character string.
positionThe 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.
displayThe pointer to the display structure cy_stc_seglcd_disp_t.
Returns
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 */
}

◆ Cy_SegLCD_WriteNumber()

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.
Parameters
baseThe base pointer to the LCD instance registers.
valueThe unsigned integer number to be displayed.
positionThe 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.
displayThe 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.
Returns
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 */
}

◆ Cy_SegLCD_BarGraph()

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.

Parameters
baseThe base pointer to the LCD instance registers.
valueThe length of the bar in pixels.
positionThe 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.
displayThe pointer to the display structure cy_stc_seglcd_disp_t.
Returns
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 =
{
.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 */
}