ws0010_print ws0010_set_character navigation bar

Table of Contents

ws0010_wprint

Prints to the Surenoo WS0010 OLED display using wide characters.

Description

The ws0010_wprint function prints text to the Surenoo WS0010 OLED display using wide characters.

Unrecognized characters are skipped. If more than 16 characters would be printed on a line then the line is truncated. A newline will cause the characters to be displayed on the next line. Up to two lines may be displayed.

Printing starts at the given line and column. Line 0 is the first line and column 0 is the first column. For example:

    ws0010_wprint(display, 0, 0, L"Hello world", 12);
        

will print "Hello world" starting in the top, left corner of the display. The format string is Unicode and supports some Katakana characters.

Prototype

t_int
ws0010_wprint(t_ws0010 display, t_uint line, t_uint column, const wchar_t* message, size_t length);
    

Parameters

t_ws0010 display

A handle to the display returned by the ws0010_open function.

t_uint line

The line number at which to start printing. Line numbers may range from 0 to 1.

t_uint column

The column number at which to start printing. Column numbers may range from 0 to 15. If the text extends beyond the last column it is truncated.

const wchar_t * message

The message to print as a Unicode wide-character string. Some Katakana characters are supported. Printing will stop if an invalid character is encountered.

A newline, L'\n', in the message will cause the output to move to the next line of the display. Hence, the string L"Hello\nworld" will print "world" below "Hello".

If a formfeed, L'\f', character is encountered in the message it will cause the display to be cleared. Hence, a formfeed is usually only used as the first character in the message text.

A character in the range L'\020' to L'\027' will use the corresponding user-defined glyph created using the ws0010_set_character function.

size_t length

The maximum number of code units to print from the message argument.

Return value

The return value is the number of code units printed 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.

QERR_DISPLAY_NOT_IN_TEXT_MODE

The display was opened in graphics mode so the text functions cannot be used.

Requirements

Include Files

Libraries

quanser_lcd_display.h

quanser_devices.lib;quanser_communications.lib;quanser_runtime.lib;quanser_common.lib

Examples

t_ws0010 display;
t_error result = 
    ws0010_open("lcd://qbot_platform:1", false, &display);
if (result == 0) {
    const wchar_t message[] = L"Hello amigo!\nCiao for now!";
    ws0010_wprint(display, 0, 0, message, ARRAY_LENGTH(message));
    ...
    ws0010_close(display);
} else {
    TCHAR message[512];
    msg_get_error_message(NULL, result, message, sizeof(message));
    _tprintf(_T("Failed to open OLED display. %s (error %d)\n"), message, -result);
}
    

See Also

 

navigation bar