openHAB - OLED 128x64 Bricklet

Warning

The openHAB bindings are still in beta, but the development was stopped.

This is the description of the openHAB API bindings for the OLED 128x64 Bricklet. General information and technical specifications for the OLED 128x64 Bricklet are summarized in its hardware description.

An installation guide for the openHAB API bindings is part of their general description.

Thing

UID:
  • tinkerforge:brickletoled128x64:[UID]
Required firmware version:
  • 2.0.0
Firmware update supported:
  • yes
Channels:
Actions:
Parameters:
  • Contrast – Type: integer, Default: 143, Min: 0, Max: 255
  • Sets the contrast of the display (0-255).

  • Invert – Type: boolean, Default: false
  • Inverts the color (black/white) of the display.

Channels

Text

Text to display on the LCD. Command format is [line],[position],[text].

Additional ',' are handled as part of the text. Unicode characters are converted to the LCD character set if possible. Additionally you can use \x[two hex digits] to use a character of the LCD character set directly.

Type:
  • String
UID:
  • tinkerforge:brickletoled128x64:[UID]:BrickletOLED128x64Text
Read only:
  • No
Clear Display

Deletes all characters from the display.

Type:
  • Commands (String)
UID:
  • tinkerforge:brickletoled128x64:[UID]:BrickletOLED128x64ClearDisplay
Read only:
  • No
Commands:
  • Accepts any string

Actions

Actions can be used in rules by creating an action object. All actions return a Map<String, Object>. Returned values can be accessed by name, sometimes the type deduction needs some hints, as shown below:

val actions = getActions("tinkerforge", "tinkerforge:brickletoled128x64:[UID]")
val hwVersion = actions.brickletOLED128x64GetIdentity().get("hardwareVersion") as short[]
logInfo("Example", "Hardware version: " + hwVersion.get(0) + "." + hwVersion.get(1) + "." + hwVersion.get(2))

Basic Actions

brickletOLED128x64Write(short[] data)
Parameters:
  • data – Type: short[], Length: 64, Range: [0 to 255]

Appends 64 byte of data to the window as set by NewWindow().

Each row has a height of 8 pixels which corresponds to one byte of data.

Example: if you call NewWindow() with column from 0 to 127 and row from 0 to 7 (the whole display) each call of Write() (red arrow) will write half of a row.

Display pixel order

The LSB (D0) of each data byte is at the top and the MSB (D7) is at the bottom of the row.

The next call of Write() will write the second half of the row and the next two the second row and so on. To fill the whole display you need to call Write() 16 times.

brickletOLED128x64NewWindow(short columnFrom, short columnTo, short rowFrom, short rowTo)
Parameters:
  • columnFrom – Type: short, Range: [0 to 127]
  • columnTo – Type: short, Range: [0 to 127]
  • rowFrom – Type: short, Range: [0 to 7]
  • rowTo – Type: short, Range: [0 to 7]

Sets the window in which you can write with Write(). One row has a height of 8 pixels.

brickletOLED128x64ClearDisplay()

Clears the current content of the window as set by NewWindow().

brickletOLED128x64WriteLine(short line, short position, String text)
Parameters:
  • line – Type: short, Range: [0 to 7]
  • position – Type: short, Range: [0 to 25]
  • text – Type: String, Length: up to 26

Writes text to a specific line with a specific position. The text can have a maximum of 26 characters.

For example: (1, 10, "Hello") will write Hello in the middle of the second line of the display.

You can draw to the display with Write() and then add text to it afterwards.

The display uses a special 5x7 pixel charset. You can view the characters of the charset in Brick Viewer.

The font conforms to code page 437.

Advanced Actions

brickletOLED128x64GetDisplayConfiguration()
Return Map:
  • contrast – Type: short, Range: [0 to 255], Default: 143
  • invert – Type: boolean, Default: false

Returns the configuration as set by the thing configuration.

brickletOLED128x64GetIdentity()
Return Map:
  • uid – Type: String, Length: up to 8
  • connectedUid – Type: String, Length: up to 8
  • position – Type: char, Range: ['a' to 'h', 'z']
  • hardwareVersion – Type: short[], Length: 3
    • 0: major – Type: short, Range: [0 to 255]
    • 1: minor – Type: short, Range: [0 to 255]
    • 2: revision – Type: short, Range: [0 to 255]
  • firmwareVersion – Type: short[], Length: 3
    • 0: major – Type: short, Range: [0 to 255]
    • 1: minor – Type: short, Range: [0 to 255]
    • 2: revision – Type: short, Range: [0 to 255]
  • deviceIdentifier – Type: int, Range: [0 to 216 - 1]

Returns the UID, the UID where the Bricklet is connected to, the position, the hardware and firmware version as well as the device identifier.

The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port). A Bricklet connected to an Isolator Bricklet is always at position 'z'.

The device identifier numbers can be found here