Table of Contents
ls027b7dh01_set_character
Defines a custom character for the Sharp LS027B7DH01 LCD display.
Description
The ls027b7dh01_set_character function defines a custom character for the Sharp LS027B7DH01 LCD display. Up to eight custom character glyphs may be defined, corresponding to the characters '\020' through '\027' or 0x10 to 0x17. Using these characters will produce the bitmap defined in the pattern for that character.
The pattern defines each line of the character being defined, with the sixteen bits in each t_uint16 defining the pixels of that line. For example, to define the letter T on a hill, the pattern would be:
pattern[0] = 0b0000000000000000 (0x0000) pattern[1] = 0b0000000000000000 (0x0000) pattern[2] = 0b0000000000000000 (0x0000) pattern[3] = 0b0001111111111000 (0x1FF8) pattern[4] = 0b0000000010000000 (0x0080) pattern[5] = 0b0000000010000000 (0x0080) pattern[6] = 0b0000000010000000 (0x0080) pattern[7] = 0b0000000010000000 (0x0080) pattern[8] = 0b0000000010000000 (0x0080) pattern[9] = 0b0000000010000000 (0x0080) pattern[10] = 0b0000000010000000 (0x0080) pattern[11] = 0b0000000010000000 (0x0080) pattern[12] = 0b0000000010000000 (0x0080) pattern[13] = 0b0000000010000000 (0x0080) pattern[14] = 0b0000000010000000 (0x0080) pattern[15] = 0b0000000101000000 (0x0140) pattern[16] = 0b0000001000100000 (0x0220) pattern[17] = 0b0001110000011100 (0x1E1C) pattern[18] = 0b0000000000000000 (0x0000) pattern[19] = 0b0000000000000000 (0x0000)
Note that all 16 bits are used. Bit 0 is the rightmost pixel and bit 15 is the leftmost pixel. The baseline is in pattern[14]. The top of a typical character is in pattern[3], although some characters go higher.
Prototype
t_error ls027b7dh01_set_character(t_ls027b7dh01 display, t_int code, const t_uint16 pattern[20]);
Parameters
t_ls027b7dh01 display
A handle to the display returned by the ls027b7dh01_open function.
t_int code
The character whose glyph is being defined. The character code must lie between '\020' and '\027' inclusive. Calling this function twice using the same character code will overwrite the previous glyph.
t_uint16 pattern[20]
The glyph pattern for the character. Each element of the array defines one pixel row
of the character. The least-significant bit in each element represents the rightmost
pixel and the most-significant bit represents the leftmost pixel. The top of the character
is typically in pattern[3]
but some characters may go higher. The baseline for
the character should be in pattern[14]
.
Return value
The return value is zero if the operation is successful. Otherwise a negative
error code is returned. Error codes are
defined in quanser_errors.h
. A suitable error message
may be retrieved using msg_get_error_message.
Error codes
QERR_INVALID_ARGUMENT
One of the arguments is invalid.
Requirements
Include Files |
Libraries |
---|---|
quanser_lcd_display.h |
quanser_devices.lib;quanser_communications.lib;quanser_runtime.lib;quanser_common.lib |
Examples
t_ls027b7dh01 display; t_error result = ls027b7dh01_open("spi-cpu://localhost:1?word='8',baud='45000000',polarity='on',phase='on',memsize='8192',frame='0'", LCD_ACCESS_EXCLUSIVE, &display); if (result == 0) { static const t_uint16 pattern[20] = { 0x0000, /* 0b0000000000000000 */ 0x0000, /* 0b0000000000000000 */ 0x0000, /* 0b0000000000000000 */ 0x1FF8, /* 0b0001111111111000 */ 0x0080, /* 0b0000000010000000 */ 0x0080, /* 0b0000000010000000 */ 0x0080, /* 0b0000000010000000 */ 0x0080, /* 0b0000000010000000 */ 0x0080, /* 0b0000000010000000 */ 0x0080, /* 0b0000000010000000 */ 0x0080, /* 0b0000000010000000 */ 0x0080, /* 0b0000000010000000 */ 0x0080, /* 0b0000000010000000 */ 0x0080, /* 0b0000000010000000 */ 0x0080, /* 0b0000000010000000 */ 0x0140, /* 0b0000000101000000 */ 0x0220, /* 0b0000001000100000 */ 0x1E1C, /* 0b0001110000011100 */ 0x0000, /* 0b0000000000000000 */ 0x0000 /* 0b0000000000000000 */ }; const char message[] = "Here it is: \020!"; ls027b7dh01_set_character(display, '\020', pattern); ls027b7dh01_print(display, 0, 0, message, ARRAY_LENGTH(message)); ... ls027b7dh01_close(display); } else { TCHAR message[512]; msg_get_error_message(NULL, result, message, sizeof(message)); _tprintf(_T("Failed to open LCD display. %s (error %d)\n"), message, -result); }
See Also
Copyright ©2024 Quanser Inc. This page was generated 2024-10-17. Submit feedback to Quanser about this page.
Link to this page.