oled_64x48_bricklet

package
Version: v0.0.0-...-57cfa29 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2022 License: CC0-1.0 Imports: 5 Imported by: 0

Documentation

Overview

1.68cm (0.66") OLED display with 64x48 pixels.

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

Index

Constants

View Source
const DeviceDisplayName = "OLED 64x48 Bricklet"
View Source
const DeviceIdentifier = 264

Variables

This section is empty.

Functions

This section is empty.

Types

type Function

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 OLED64x48Bricklet

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

func New

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

func (*OLED64x48Bricklet) ClearDisplay

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

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

func (*OLED64x48Bricklet) GetAPIVersion

func (device *OLED64x48Bricklet) 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 (*OLED64x48Bricklet) GetDisplayConfiguration

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

Returns the configuration as set by SetDisplayConfiguration.

func (*OLED64x48Bricklet) GetIdentity

func (device *OLED64x48Bricklet) 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', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port). A Bricklet connected to an `Isolator Bricklet <isolator_bricklet>` is always at position 'z'.

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

func (*OLED64x48Bricklet) GetResponseExpected

func (device *OLED64x48Bricklet) 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 sent and errors are silently ignored, because they cannot be detected.

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

func (*OLED64x48Bricklet) NewWindow

func (device *OLED64x48Bricklet) 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 (*OLED64x48Bricklet) SetDisplayConfiguration

func (device *OLED64x48Bricklet) 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 (*OLED64x48Bricklet) SetResponseExpected

func (device *OLED64x48Bricklet) 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 sent and errors are silently ignored, because they cannot be detected.

func (*OLED64x48Bricklet) SetResponseExpectedAll

func (device *OLED64x48Bricklet) SetResponseExpectedAll(responseExpected bool)

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

func (*OLED64x48Bricklet) Write

func (device *OLED64x48Bricklet) 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 63 and row from 0 to 5 (the whole display) each call of Write (red arrow) will write one row.

.. image:: /Images/Bricklets/bricklet_oled_64x48_display.png

:scale: 100 %
:alt: Display pixel order
:align: center
:target: ../../_images/Bricklets/bricklet_oled_64x48_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 row and so on. To fill the whole display you need to call Write 6 times.

func (*OLED64x48Bricklet) WriteLine

func (device *OLED64x48Bricklet) 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 13 characters.

For example: (1, 4, 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL