openHAB - OLED 128x64 Bricklet 2.0

Bemerkung

Die openHAB-Dokumentation ist nur auf Englisch verfügbar.

Warnung

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 2.0. General information and technical specifications for the OLED 128x64 Bricklet 2.0 are summarized in its hardware description.

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

Thing

UID:
  • tinkerforge:brickletoled128x64v2:[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.

  • Automatic Draw – Type: boolean, Default: true
  • If automatic draw is enabled, the display is automatically updated when writing text or clearing the display. If it is disabled, the changes are written into an internal buffer and only shown on the display after triggering the Draw Buffered Frame channel.

  • Status LED Configuration – Type: Choice, Default: Show Status
  • The status LED configuration. By default the LED shows communication traffic between Brick and Bricklet, it flickers once for every 10 received data packets. You can also turn the LED permanently on/off or show a heartbeat. If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
  • Options: Off, On, Show Heartbeat, Show Status

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:brickletoled128x64v2:[UID]:BrickletOLED128x64V2Text
Read only:
  • No
Clear Display

Deletes all characters from the display.

Type:
  • Commands (String)
UID:
  • tinkerforge:brickletoled128x64v2:[UID]:BrickletOLED128x64V2ClearDisplay
Read only:
  • No
Commands:
  • Accepts any string
Draw Buffered Frame

Draws the currently buffered frame.

Type:
  • Commands (String)
UID:
  • tinkerforge:brickletoled128x64v2:[UID]:BrickletOLED128x64V2DrawBufferedFrame
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:brickletoled128x64v2:[UID]")
val hwVersion = actions.brickletOLED128x64V2GetIdentity().get("hardwareVersion") as short[]
logInfo("Example", "Hardware version: " + hwVersion.get(0) + "." + hwVersion.get(1) + "." + hwVersion.get(2))

Basic Actions

brickletOLED128x64V2WritePixels(int xStart, int yStart, int xEnd, int yEnd, boolean[] pixels)
Parameters:
  • xStart – Type: int, Range: [0 to 127]
  • yStart – Type: int, Range: [0 to 63]
  • xEnd – Type: int, Range: [0 to 127]
  • yEnd – Type: int, Range: [0 to 63]
  • pixels – Type: boolean[], Length: variable

Writes pixels to the specified window.

The pixels are written into the window line by line top to bottom and each line is written from left to right.

If automatic draw is enabled (default) the pixels are directly written to the screen. Only pixels that have actually changed are updated on the screen, the rest stays the same.

If automatic draw is disabled the pixels are written to an internal buffer and the buffer is transferred to the display only after Draw Buffered Frame is called. This can be used to avoid flicker when drawing a complex frame in multiple steps.

Automatic draw can be configured with the the thing configuration function.

brickletOLED128x64V2ReadPixels(int xStart, int yStart, int xEnd, int yEnd)
Parameters:
  • xStart – Type: int, Range: [0 to 127]
  • yStart – Type: int, Range: [0 to 63]
  • xEnd – Type: int, Range: [0 to 127]
  • yEnd – Type: int, Range: [0 to 63]
Return Map:
  • pixels – Type: boolean[], Length: variable

Reads pixels from the specified window.

The pixels are read from the window line by line top to bottom and each line is read from left to right.

If automatic draw is enabled (default) the pixels that are read are always the same that are shown on the display.

If automatic draw is disabled the pixels are read from the internal buffer (see Draw Buffered Frame).

Automatic draw can be configured with the the thing configuration function.

brickletOLED128x64V2ClearDisplay()

Clears the complete content of the display.

If automatic draw is enabled (default) the pixels are directly cleared.

If automatic draw is disabled the the internal buffer is cleared and the buffer is transferred to the display only after Draw Buffered Frame is called. This can be used to avoid flicker when drawing a complex frame in multiple steps.

Automatic draw can be configured with the the thing configuration function.

brickletOLED128x64V2DrawBufferedFrame(boolean forceCompleteRedraw)
Parameters:
  • forceCompleteRedraw – Type: boolean

Draws the currently buffered frame. Normally each call of WritePixels() and Text draws directly onto the display. If you turn automatic draw off (the thing configuration), the data is written in an internal buffer and only transferred to the display by calling this function. This can be used to avoid flicker when drawing a complex frame in multiple steps.

Set the force complete redraw to true to redraw the whole display instead of only the changed parts. Normally it should not be necessary to set this to true. It may only become necessary in case of stuck pixels because of errors.

brickletOLED128x64V2WriteLine(int line, int position, String text)
Parameters:
  • line – Type: int, Range: [0 to 7]
  • position – Type: int, Range: [0 to 21]
  • text – Type: String, Length: up to 22

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

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

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

If automatic draw is enabled (default) the text is directly written to the screen. Only pixels that have actually changed are updated on the screen, the rest stays the same.

If automatic draw is disabled the text is written to an internal buffer and the buffer is transferred to the display only after Draw Buffered Frame is called. This can be used to avoid flicker when drawing a complex frame in multiple steps.

Automatic draw can be configured with the the thing configuration function.

The font conforms to code page 437.

Advanced Actions

brickletOLED128x64V2GetDisplayConfiguration()
Return Map:
  • contrast – Type: int, Range: [0 to 255], Default: 143
  • invert – Type: boolean, Default: false
  • automaticDraw – Type: boolean, Default: true

Returns the configuration as set by the thing configuration.

brickletOLED128x64V2GetChipTemperature()
Return Map:
  • temperature – Type: int, Unit: 1 °C, Range: [-215 to 215 - 1]

Returns the temperature as measured inside the microcontroller. The value returned is not the ambient temperature!

The temperature is only proportional to the real temperature and it has bad accuracy. Practically it is only useful as an indicator for temperature changes.

brickletOLED128x64V2GetStatusLEDConfig()
Return Map:
  • config – Type: int, Range: See constants, Default: 3

Returns the configuration as set by the thing configuration

The following constants are available for this function:

For config:

  • val STATUS_LED_CONFIG_OFF = 0
  • val STATUS_LED_CONFIG_ON = 1
  • val STATUS_LED_CONFIG_SHOW_HEARTBEAT = 2
  • val STATUS_LED_CONFIG_SHOW_STATUS = 3
brickletOLED128x64V2GetSPITFPErrorCount()
Return Map:
  • errorCountAckChecksum – Type: long, Range: [0 to 232 - 1]
  • errorCountMessageChecksum – Type: long, Range: [0 to 232 - 1]
  • errorCountFrame – Type: long, Range: [0 to 232 - 1]
  • errorCountOverflow – Type: long, Range: [0 to 232 - 1]

Returns the error count for the communication between Brick and Bricklet.

The errors are divided into

  • ACK checksum errors,
  • message checksum errors,
  • framing errors and
  • overflow errors.

The errors counts are for errors that occur on the Bricklet side. All Bricks have a similar function that returns the errors on the Brick side.

brickletOLED128x64V2Reset()

Calling this function will reset the Bricklet. All configurations will be lost.

After a reset you have to create new device objects, calling functions on the existing ones will result in undefined behavior!

brickletOLED128x64V2GetIdentity()
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

Internal Actions

brickletOLED128x64V2ReadUID()
Return Map:
  • uid – Type: long, Range: [0 to 232 - 1]

Returns the current UID as an integer. Encode as Base58 to get the usual string version.