go-api-bindings: github.com/Tinkerforge/go-api-bindings/oled_128x64_bricklet Index | Files

package oled_128x64_bricklet

import "github.com/Tinkerforge/go-api-bindings/oled_128x64_bricklet"

3.3cm (1.3") OLED display with 128x64 pixels.

See also the documentation here: https://www.tinkerforge.com/en/doc/Software/Bricklets/OLED128x64_Bricklet_Go.html.

Index

Package Files

oled_128x64_bricklet.go

Constants

const DeviceDisplayName = "OLED 128x64 Bricklet"
const DeviceIdentifier = 263

type Function Uses

type Function = uint8
const (
    FunctionWrite                   Function = 1
    FunctionNewWindow               Function = 2
    FunctionClearDisplay            Function = 3
    FunctionSetDisplayConfiguration Function = 4
    FunctionGetDisplayConfiguration Function = 5
    FunctionWriteLine               Function = 6
    FunctionGetIdentity             Function = 255
)

type OLED128x64Bricklet Uses

type OLED128x64Bricklet struct {
    // contains filtered or unexported fields
}

func New Uses

func New(uid string, ipcon *ipconnection.IPConnection) (OLED128x64Bricklet, error)

Creates an object with the unique device ID `uid`. This object can then be used after the IP Connection `ipcon` is connected.

func (*OLED128x64Bricklet) ClearDisplay Uses

func (device *OLED128x64Bricklet) ClearDisplay() (err error)

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

func (*OLED128x64Bricklet) GetAPIVersion Uses

func (device *OLED128x64Bricklet) GetAPIVersion() [3]uint8

Returns the version of the API definition (major, minor, revision) implemented by this API bindings. This is neither the release version of this API bindings nor does it tell you anything about the represented Brick or Bricklet.

func (*OLED128x64Bricklet) GetDisplayConfiguration Uses

func (device *OLED128x64Bricklet) GetDisplayConfiguration() (contrast uint8, invert bool, err error)

Returns the configuration as set by SetDisplayConfiguration.

func (*OLED128x64Bricklet) GetIdentity Uses

func (device *OLED128x64Bricklet) GetIdentity() (uid string, connectedUid string, position rune, hardwareVersion [3]uint8, firmwareVersion [3]uint8, deviceIdentifier uint16, err error)

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' or 'd'.

The device identifier numbers can be found `here <device_identifier>`. |device_identifier_constant|

func (*OLED128x64Bricklet) GetResponseExpected Uses

func (device *OLED128x64Bricklet) GetResponseExpected(functionID Function) (bool, error)

Returns the response expected flag for the function specified by the function ID parameter. It is true if the function is expected to send a response, false otherwise.

For getter functions this is enabled by default and cannot be disabled, because those functions will always send a response. For callback configuration functions it is enabled by default too, but can be disabled by SetResponseExpected. For setter functions it is disabled by default and can be enabled.

Enabling the response expected flag for a setter function allows to detect timeouts and other error conditions calls of this setter as well. The device will then send a response for this purpose. If this flag is disabled for a setter function then no response is send and errors are silently ignored, because they cannot be detected.

See SetResponseExpected for the list of function ID constants available for this function.

func (*OLED128x64Bricklet) NewWindow Uses

func (device *OLED128x64Bricklet) NewWindow(columnFrom uint8, columnTo uint8, rowFrom uint8, rowTo uint8) (err error)

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

func (*OLED128x64Bricklet) SetDisplayConfiguration Uses

func (device *OLED128x64Bricklet) SetDisplayConfiguration(contrast uint8, invert bool) (err error)

Sets the configuration of the display.

You can set a contrast value from 0 to 255 and you can invert the color (black/white) of the display.

func (*OLED128x64Bricklet) SetResponseExpected Uses

func (device *OLED128x64Bricklet) SetResponseExpected(functionID Function, responseExpected bool) error

Changes the response expected flag of the function specified by the function ID parameter. This flag can only be changed for setter (default value: false) and callback configuration functions (default value: true). For getter functions it is always enabled.

Enabling the response expected flag for a setter function allows to detect timeouts and other error conditions calls of this setter as well. The device will then send a response for this purpose. If this flag is disabled for a setter function then no response is send and errors are silently ignored, because they cannot be detected.

func (*OLED128x64Bricklet) SetResponseExpectedAll Uses

func (device *OLED128x64Bricklet) SetResponseExpectedAll(responseExpected bool)

Changes the response expected flag for all setter and callback configuration functions of this device at once.

func (*OLED128x64Bricklet) Write Uses

func (device *OLED128x64Bricklet) Write(data [64]uint8) (err error)

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.

.. image:: /Images/Bricklets/bricklet_oled_128x64_display.png

:scale: 100 %
:alt: Display pixel order
:align: center
:target: ../../_images/Bricklets/bricklet_oled_128x64_display.png

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.

func (*OLED128x64Bricklet) WriteLine Uses

func (device *OLED128x64Bricklet) WriteLine(line uint8, position uint8, text string) (err error)

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.

Package oled_128x64_bricklet imports 4 packages (graph). Updated 2019-12-22. Refresh now. Tools for package owners.