Skip to content

Display Link (Peripheral)

Kryppers edited this page Nov 17, 2024 · 2 revisions
Method Description
setCursorPos(x, y) Sets the cursor position
getCursorPos() Gets the current cursor position
getSize() Gets the display size of the connected target
isColor() Whether the connected display target supports color
isColour() Whether the connected display target supports colour
write(text) Writes text at the current cursor position
clearLine() Clears the line at the current cursor position
clear() Clears the whole display
update() Pushes an update to the display target

setCursorPos(x, y)

Sets the cursor position. Can be outside the bounds of the connected display.

Parameters

  • x: number The cursor x position.
  • y: number The cursor y position.

getCursorPos()

Gets the current cursor position.

Returns

  • number The cursor x position.
  • number The cursor y position.

getSize()

Gets the size of the connected display target.

Returns

  • number The height of the display.
  • number The width of the display.

isColor()

Checks whether the connected display target supports color.

Returns

  • boolean Whether the display supports color.

isColour()

Checks whether the connected display target supports colour.

Returns

  • boolean Whether the display supports colour.

write(text)

Writes text at the current cursor position, moving the cursor to the end of the text. This only writes to an internal buffer. For the changes to show up on the display update() must be used. If the cursor is outside the bounds of the connected display, the text will not show up on the display.

This will overwrite any text currently at the cursor position.

Parameters

  • text: string The text to write.

See also

  • update() To push the changes to the display target.

clearLine()

Clears the line at the current cursor position.

See also

  • update() To push the changes to the display target.

clear()

Clears the whole display.

See also

  • update() To push the changes to the display target.

update()

Pushes any changes to the connected display target. Any changes made are only made to an internal buffer. For them to show up on the display they must be pushed to the display using this function. This allows for this peripheral to be better multithreaded and for users to be able to change multiple lines at once by using multiple write(text) calls and then one update() call.

See also

Clone this wiki locally