Documentation

Overview

7.1cm (2.8") display with 128x64 pixel and touch screen.

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

Index

Constants

View Source
const DeviceDisplayName = "LCD 128x64 Bricklet"
View Source
const DeviceIdentifier = 298

Variables

This section is empty.

Functions

This section is empty.

Types

type BootloaderMode

type BootloaderMode = uint8
const (
	BootloaderModeBootloader                    BootloaderMode = 0
	BootloaderModeFirmware                      BootloaderMode = 1
	BootloaderModeBootloaderWaitForReboot       BootloaderMode = 2
	BootloaderModeFirmwareWaitForReboot         BootloaderMode = 3
	BootloaderModeFirmwareWaitForEraseAndReboot BootloaderMode = 4
)

type BootloaderStatus

type BootloaderStatus = uint8
const (
	BootloaderStatusOK                        BootloaderStatus = 0
	BootloaderStatusInvalidMode               BootloaderStatus = 1
	BootloaderStatusNoChange                  BootloaderStatus = 2
	BootloaderStatusEntryFunctionNotPresent   BootloaderStatus = 3
	BootloaderStatusDeviceIdentifierIncorrect BootloaderStatus = 4
	BootloaderStatusCRCMismatch               BootloaderStatus = 5
)

type ChangeTabOn

type ChangeTabOn = uint8
const (
	ChangeTabOnClick         ChangeTabOn = 1
	ChangeTabOnSwipe         ChangeTabOn = 2
	ChangeTabOnClickAndSwipe ChangeTabOn = 3
)

type Color

type Color = bool
const (
	ColorWhite Color = false
	ColorBlack Color = true
)

type Direction

type Direction = uint8
const (
	DirectionHorizontal Direction = 0
	DirectionVertical   Direction = 1
)

type Font

type Font = uint8
const (
	Font6x8   Font = 0
	Font6x16  Font = 1
	Font6x24  Font = 2
	Font6x32  Font = 3
	Font12x16 Font = 4
	Font12x24 Font = 5
	Font12x32 Font = 6
	Font18x24 Font = 7
	Font18x32 Font = 8
	Font24x32 Font = 9
)

type Function

type Function = uint8
const (
	FunctionWritePixelsLowLevel                      Function = 1
	FunctionReadPixelsLowLevel                       Function = 2
	FunctionClearDisplay                             Function = 3
	FunctionSetDisplayConfiguration                  Function = 4
	FunctionGetDisplayConfiguration                  Function = 5
	FunctionWriteLine                                Function = 6
	FunctionDrawBufferedFrame                        Function = 7
	FunctionGetTouchPosition                         Function = 8
	FunctionSetTouchPositionCallbackConfiguration    Function = 9
	FunctionGetTouchPositionCallbackConfiguration    Function = 10
	FunctionGetTouchGesture                          Function = 12
	FunctionSetTouchGestureCallbackConfiguration     Function = 13
	FunctionGetTouchGestureCallbackConfiguration     Function = 14
	FunctionDrawLine                                 Function = 16
	FunctionDrawBox                                  Function = 17
	FunctionDrawText                                 Function = 18
	FunctionSetGUIButton                             Function = 19
	FunctionGetGUIButton                             Function = 20
	FunctionRemoveGUIButton                          Function = 21
	FunctionSetGUIButtonPressedCallbackConfiguration Function = 22
	FunctionGetGUIButtonPressedCallbackConfiguration Function = 23
	FunctionGetGUIButtonPressed                      Function = 24
	FunctionSetGUISlider                             Function = 26
	FunctionGetGUISlider                             Function = 27
	FunctionRemoveGUISlider                          Function = 28
	FunctionSetGUISliderValueCallbackConfiguration   Function = 29
	FunctionGetGUISliderValueCallbackConfiguration   Function = 30
	FunctionGetGUISliderValue                        Function = 31
	FunctionSetGUITabConfiguration                   Function = 33
	FunctionGetGUITabConfiguration                   Function = 34
	FunctionSetGUITabText                            Function = 35
	FunctionGetGUITabText                            Function = 36
	FunctionSetGUITabIcon                            Function = 37
	FunctionGetGUITabIcon                            Function = 38
	FunctionRemoveGUITab                             Function = 39
	FunctionSetGUITabSelected                        Function = 40
	FunctionSetGUITabSelectedCallbackConfiguration   Function = 41
	FunctionGetGUITabSelectedCallbackConfiguration   Function = 42
	FunctionGetGUITabSelected                        Function = 43
	FunctionSetGUIGraphConfiguration                 Function = 45
	FunctionGetGUIGraphConfiguration                 Function = 46
	FunctionSetGUIGraphDataLowLevel                  Function = 47
	FunctionGetGUIGraphDataLowLevel                  Function = 48
	FunctionRemoveGUIGraph                           Function = 49
	FunctionRemoveAllGUI                             Function = 50
	FunctionSetTouchLEDConfig                        Function = 51
	FunctionGetTouchLEDConfig                        Function = 52
	FunctionGetSPITFPErrorCount                      Function = 234
	FunctionSetBootloaderMode                        Function = 235
	FunctionGetBootloaderMode                        Function = 236
	FunctionSetWriteFirmwarePointer                  Function = 237
	FunctionWriteFirmware                            Function = 238
	FunctionSetStatusLEDConfig                       Function = 239
	FunctionGetStatusLEDConfig                       Function = 240
	FunctionGetChipTemperature                       Function = 242
	FunctionReset                                    Function = 243
	FunctionWriteUID                                 Function = 248
	FunctionReadUID                                  Function = 249
	FunctionGetIdentity                              Function = 255
	FunctionCallbackTouchPosition                    Function = 11
	FunctionCallbackTouchGesture                     Function = 15
	FunctionCallbackGUIButtonPressed                 Function = 25
	FunctionCallbackGUISliderValue                   Function = 32
	FunctionCallbackGUITabSelected                   Function = 44
)

type Gesture

type Gesture = uint8
const (
	GestureLeftToRight Gesture = 0
	GestureRightToLeft Gesture = 1
	GestureTopToBottom Gesture = 2
	GestureBottomToTop Gesture = 3
)

type GraphType

type GraphType = uint8
const (
	GraphTypeDot  GraphType = 0
	GraphTypeLine GraphType = 1
	GraphTypeBar  GraphType = 2
)

type LCD128x64Bricklet

type LCD128x64Bricklet 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 (*LCD128x64Bricklet) ClearDisplay

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

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 DrawBufferedFrame is called. This can be used to avoid flicker when drawing a complex frame in multiple steps.

Automatic draw can be configured with the SetDisplayConfiguration function.

func (*LCD128x64Bricklet) DeregisterGUIButtonPressedCallback

func (device *LCD128x64Bricklet) DeregisterGUIButtonPressedCallback(registrationId uint64)

Remove a registered GUI Button Pressed callback.

func (*LCD128x64Bricklet) DeregisterGUISliderValueCallback

func (device *LCD128x64Bricklet) DeregisterGUISliderValueCallback(registrationId uint64)

Remove a registered GUI Slider Value callback.

func (*LCD128x64Bricklet) DeregisterGUITabSelectedCallback

func (device *LCD128x64Bricklet) DeregisterGUITabSelectedCallback(registrationId uint64)

Remove a registered GUI Tab Selected callback.

func (*LCD128x64Bricklet) DeregisterTouchGestureCallback

func (device *LCD128x64Bricklet) DeregisterTouchGestureCallback(registrationId uint64)

Remove a registered Touch Gesture callback.

func (*LCD128x64Bricklet) DeregisterTouchPositionCallback

func (device *LCD128x64Bricklet) DeregisterTouchPositionCallback(registrationId uint64)

Remove a registered Touch Position callback.

func (*LCD128x64Bricklet) DrawBox

func (device *LCD128x64Bricklet) DrawBox(positionXStart uint8, positionYStart uint8, positionXEnd uint8, positionYEnd uint8, fill bool, color Color) (err error)

Draws a white or black box from (x, y)-start to (x, y)-end.

If you set fill to true, the box will be filled with the color. Otherwise only the outline will be drawn.

.. versionadded:: 2.0.2$nbsp;(Plugin)

Associated constants:

* ColorWhite
* ColorBlack

func (*LCD128x64Bricklet) DrawBufferedFrame

func (device *LCD128x64Bricklet) DrawBufferedFrame(forceCompleteRedraw bool) (err error)

Draws the currently buffered frame. Normally each call of WritePixels and WriteLine draws directly onto the display. If you turn automatic draw off (SetDisplayConfiguration), 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.

func (*LCD128x64Bricklet) DrawLine

func (device *LCD128x64Bricklet) DrawLine(positionXStart uint8, positionYStart uint8, positionXEnd uint8, positionYEnd uint8, color Color) (err error)

Draws a white or black line from (x, y)-start to (x, y)-end.

.. versionadded:: 2.0.2$nbsp;(Plugin)

Associated constants:

* ColorWhite
* ColorBlack

func (*LCD128x64Bricklet) DrawText

func (device *LCD128x64Bricklet) DrawText(positionX uint8, positionY uint8, font Font, color Color, text string) (err error)

Draws a text at the pixel position (x, y).

You can use one of 9 different font sizes and draw the text in white or black.

.. versionadded:: 2.0.2$nbsp;(Plugin)

Associated constants:

* Font6x8
* Font6x16
* Font6x24
* Font6x32
* Font12x16
* Font12x24
* Font12x32
* Font18x24
* Font18x32
* Font24x32
* ColorWhite
* ColorBlack

func (*LCD128x64Bricklet) GetAPIVersion

func (device *LCD128x64Bricklet) 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 (*LCD128x64Bricklet) GetBootloaderMode

func (device *LCD128x64Bricklet) GetBootloaderMode() (mode BootloaderMode, err error)

Returns the current bootloader mode, see SetBootloaderMode.

Associated constants:

* BootloaderModeBootloader
* BootloaderModeFirmware
* BootloaderModeBootloaderWaitForReboot
* BootloaderModeFirmwareWaitForReboot
* BootloaderModeFirmwareWaitForEraseAndReboot

func (*LCD128x64Bricklet) GetChipTemperature

func (device *LCD128x64Bricklet) GetChipTemperature() (temperature int16, err error)

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.

func (*LCD128x64Bricklet) GetDisplayConfiguration

func (device *LCD128x64Bricklet) GetDisplayConfiguration() (contrast uint8, backlight uint8, invert bool, automaticDraw bool, err error)

Returns the configuration as set by SetDisplayConfiguration.

func (*LCD128x64Bricklet) GetGUIButton

func (device *LCD128x64Bricklet) GetGUIButton(index uint8) (active bool, positionX uint8, positionY uint8, width uint8, height uint8, text string, err error)

Returns the button properties for a given `Index` as set by SetGUIButton.

Additionally the `Active` parameter shows if a button is currently active/visible or not.

.. versionadded:: 2.0.2$nbsp;(Plugin)

func (*LCD128x64Bricklet) GetGUIButtonPressed

func (device *LCD128x64Bricklet) GetGUIButtonPressed(index uint8) (pressed bool, err error)

Returns the state of the button for the given index.

The state can either be pressed (true) or released (false).

.. versionadded:: 2.0.2$nbsp;(Plugin)

func (*LCD128x64Bricklet) GetGUIButtonPressedCallbackConfiguration

func (device *LCD128x64Bricklet) GetGUIButtonPressedCallbackConfiguration() (period uint32, valueHasToChange bool, err error)

Returns the callback configuration as set by SetGUIButtonPressedCallbackConfiguration.

.. versionadded:: 2.0.2$nbsp;(Plugin)

func (*LCD128x64Bricklet) GetGUIGraphConfiguration

func (device *LCD128x64Bricklet) GetGUIGraphConfiguration(index uint8) (active bool, graphType GraphType, positionX uint8, positionY uint8, width uint8, height uint8, textX string, textY string, err error)

Returns the graph properties for a given `Index` as set by SetGUIGraphConfiguration.

Additionally the `Active` parameter shows if a graph is currently active/visible or not.

.. versionadded:: 2.0.2$nbsp;(Plugin)

Associated constants:

* GraphTypeDot
* GraphTypeLine
* GraphTypeBar

func (*LCD128x64Bricklet) GetGUIGraphData

func (device *LCD128x64Bricklet) GetGUIGraphData(index uint8) (data []uint8, err error)

Returns the graph data for a given index as set by SetGUIGraphData.

.. versionadded:: 2.0.2$nbsp;(Plugin)

func (*LCD128x64Bricklet) GetGUIGraphDataLowLevel

func (device *LCD128x64Bricklet) GetGUIGraphDataLowLevel(index uint8) (dataLength uint16, dataChunkOffset uint16, dataChunkData [59]uint8, err error)

Returns the graph data for a given index as set by SetGUIGraphData.

.. versionadded:: 2.0.2$nbsp;(Plugin)

func (*LCD128x64Bricklet) GetGUISlider

func (device *LCD128x64Bricklet) GetGUISlider(index uint8) (active bool, positionX uint8, positionY uint8, length uint8, direction Direction, value uint8, err error)

Returns the slider properties for a given `Index` as set by SetGUISlider.

Additionally the `Active` parameter shows if a button is currently active/visible or not.

.. versionadded:: 2.0.2$nbsp;(Plugin)

Associated constants:

* DirectionHorizontal
* DirectionVertical

func (*LCD128x64Bricklet) GetGUISliderValue

func (device *LCD128x64Bricklet) GetGUISliderValue(index uint8) (value uint8, err error)

Returns the current slider value for the given index.

.. versionadded:: 2.0.2$nbsp;(Plugin)

func (*LCD128x64Bricklet) GetGUISliderValueCallbackConfiguration

func (device *LCD128x64Bricklet) GetGUISliderValueCallbackConfiguration() (period uint32, valueHasToChange bool, err error)

Returns the callback configuration as set by SetGUISliderValueCallbackConfiguration.

.. versionadded:: 2.0.2$nbsp;(Plugin)

func (*LCD128x64Bricklet) GetGUITabConfiguration

func (device *LCD128x64Bricklet) GetGUITabConfiguration() (changeTabConfig ChangeTabOn, clearGUI bool, err error)

Returns the tab configuration as set by SetGUITabConfiguration.

.. versionadded:: 2.0.2$nbsp;(Plugin)

Associated constants:

* ChangeTabOnClick
* ChangeTabOnSwipe
* ChangeTabOnClickAndSwipe

func (*LCD128x64Bricklet) GetGUITabIcon

func (device *LCD128x64Bricklet) GetGUITabIcon(index uint8) (active bool, icon [168]bool, err error)

Returns the icon for a given index as set by SetGUITabIcon.

Additionally the `Active` parameter shows if the tab is currently active/visible or not.

.. versionadded:: 2.0.2$nbsp;(Plugin)

func (*LCD128x64Bricklet) GetGUITabSelected

func (device *LCD128x64Bricklet) GetGUITabSelected() (index int8, err error)

Returns the index of the currently selected tab. If there are not tabs, the returned index is -1.

.. versionadded:: 2.0.2$nbsp;(Plugin)

func (*LCD128x64Bricklet) GetGUITabSelectedCallbackConfiguration

func (device *LCD128x64Bricklet) GetGUITabSelectedCallbackConfiguration() (period uint32, valueHasToChange bool, err error)

Returns the callback configuration as set by SetGUITabSelectedCallbackConfiguration.

.. versionadded:: 2.0.2$nbsp;(Plugin)

func (*LCD128x64Bricklet) GetGUITabText

func (device *LCD128x64Bricklet) GetGUITabText(index uint8) (active bool, text string, err error)

Returns the text for a given index as set by SetGUITabText.

Additionally the `Active` parameter shows if the tab is currently active/visible or not.

.. versionadded:: 2.0.2$nbsp;(Plugin)

func (*LCD128x64Bricklet) GetIdentity

func (device *LCD128x64Bricklet) 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 (*LCD128x64Bricklet) GetResponseExpected

func (device *LCD128x64Bricklet) 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 (*LCD128x64Bricklet) GetSPITFPErrorCount

func (device *LCD128x64Bricklet) GetSPITFPErrorCount() (errorCountAckChecksum uint32, errorCountMessageChecksum uint32, errorCountFrame uint32, errorCountOverflow uint32, err error)

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.

func (*LCD128x64Bricklet) GetStatusLEDConfig

func (device *LCD128x64Bricklet) GetStatusLEDConfig() (config StatusLEDConfig, err error)

Returns the configuration as set by SetStatusLEDConfig

Associated constants:

* StatusLEDConfigOff
* StatusLEDConfigOn
* StatusLEDConfigShowHeartbeat
* StatusLEDConfigShowStatus

func (*LCD128x64Bricklet) GetTouchGesture

func (device *LCD128x64Bricklet) GetTouchGesture() (gesture Gesture, duration uint32, pressureMax uint16, xStart uint16, yStart uint16, xEnd uint16, yEnd uint16, age uint32, err error)

Returns one of four touch gestures that can be automatically detected by the Bricklet.

The gestures are swipes from left to right, right to left, top to bottom and bottom to top.

Additionally to the gestures a vector with a start and end position of the gesture is provided. You can use this vector do determine a more exact location of the gesture (e.g. the swipe from top to bottom was on the left or right part of the screen).

The age parameter corresponds to the age of gesture (how long ago it was).

Associated constants:

* GestureLeftToRight
* GestureRightToLeft
* GestureTopToBottom
* GestureBottomToTop

func (*LCD128x64Bricklet) GetTouchGestureCallbackConfiguration

func (device *LCD128x64Bricklet) GetTouchGestureCallbackConfiguration() (period uint32, valueHasToChange bool, err error)

Returns the callback configuration as set by SetTouchGestureCallbackConfiguration.

func (*LCD128x64Bricklet) GetTouchLEDConfig

func (device *LCD128x64Bricklet) GetTouchLEDConfig() (config TouchLEDConfig, err error)

Returns the configuration as set by SetTouchLEDConfig

.. versionadded:: 2.0.2$nbsp;(Plugin)

Associated constants:

* TouchLEDConfigOff
* TouchLEDConfigOn
* TouchLEDConfigShowHeartbeat
* TouchLEDConfigShowTouch

func (*LCD128x64Bricklet) GetTouchPosition

func (device *LCD128x64Bricklet) GetTouchPosition() (pressure uint16, x uint16, y uint16, age uint32, err error)

Returns the last valid touch position:

* Pressure: Amount of pressure applied by the user * X: Touch position on x-axis * Y: Touch position on y-axis * Age: Age of touch press (how long ago it was)

func (*LCD128x64Bricklet) GetTouchPositionCallbackConfiguration

func (device *LCD128x64Bricklet) GetTouchPositionCallbackConfiguration() (period uint32, valueHasToChange bool, err error)

Returns the callback configuration as set by SetTouchPositionCallbackConfiguration.

func (*LCD128x64Bricklet) ReadPixels

func (device *LCD128x64Bricklet) ReadPixels(xStart uint8, yStart uint8, xEnd uint8, yEnd uint8) (pixels []bool, err error)

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 DrawBufferedFrame).

Automatic draw can be configured with the SetDisplayConfiguration function.

func (*LCD128x64Bricklet) ReadPixelsLowLevel

func (device *LCD128x64Bricklet) ReadPixelsLowLevel(xStart uint8, yStart uint8, xEnd uint8, yEnd uint8) (pixelsLength uint16, pixelsChunkOffset uint16, pixelsChunkData [480]bool, err error)

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 DrawBufferedFrame).

Automatic draw can be configured with the SetDisplayConfiguration function.

func (*LCD128x64Bricklet) ReadUID

func (device *LCD128x64Bricklet) ReadUID() (uid uint32, err error)

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

func (*LCD128x64Bricklet) RegisterGUIButtonPressedCallback

func (device *LCD128x64Bricklet) RegisterGUIButtonPressedCallback(fn func(uint8, bool)) uint64

This callback is triggered periodically with the period that is set by SetGUIButtonPressedCallbackConfiguration. The parameters are the same as for GetGUIButtonPressed.

.. versionadded:: 2.0.2$nbsp;(Plugin)

func (*LCD128x64Bricklet) RegisterGUISliderValueCallback

func (device *LCD128x64Bricklet) RegisterGUISliderValueCallback(fn func(uint8, uint8)) uint64

This callback is triggered periodically with the period that is set by SetGUISliderValueCallbackConfiguration. The parameters are the same as for GetGUISliderValue.

.. versionadded:: 2.0.2$nbsp;(Plugin)

func (*LCD128x64Bricklet) RegisterGUITabSelectedCallback

func (device *LCD128x64Bricklet) RegisterGUITabSelectedCallback(fn func(int8)) uint64

This callback is triggered periodically with the period that is set by SetGUITabSelectedCallbackConfiguration. The parameters are the same as for GetGUITabSelected.

.. versionadded:: 2.0.2$nbsp;(Plugin)

func (*LCD128x64Bricklet) RegisterTouchGestureCallback

func (device *LCD128x64Bricklet) RegisterTouchGestureCallback(fn func(Gesture, uint32, uint16, uint16, uint16, uint16, uint16, uint32)) uint64

This callback is triggered periodically with the period that is set by SetTouchGestureCallbackConfiguration. The parameters are the same as for GetTouchGesture.

func (*LCD128x64Bricklet) RegisterTouchPositionCallback

func (device *LCD128x64Bricklet) RegisterTouchPositionCallback(fn func(uint16, uint16, uint16, uint32)) uint64

This callback is triggered periodically with the period that is set by SetTouchPositionCallbackConfiguration. The parameters are the same as for GetTouchPosition.

func (*LCD128x64Bricklet) RemoveAllGUI

func (device *LCD128x64Bricklet) RemoveAllGUI() (err error)

Removes all GUI elements (buttons, slider, graphs, tabs).

.. versionadded:: 2.0.2$nbsp;(Plugin)

func (*LCD128x64Bricklet) RemoveGUIButton

func (device *LCD128x64Bricklet) RemoveGUIButton(index uint8) (err error)

Removes the button with the given index.

You can use index 255 to remove all buttons.

.. versionadded:: 2.0.2$nbsp;(Plugin)

func (*LCD128x64Bricklet) RemoveGUIGraph

func (device *LCD128x64Bricklet) RemoveGUIGraph(index uint8) (err error)

Removes the graph with the given index.

You can use index 255 to remove all graphs.

.. versionadded:: 2.0.2$nbsp;(Plugin)

func (*LCD128x64Bricklet) RemoveGUISlider

func (device *LCD128x64Bricklet) RemoveGUISlider(index uint8) (err error)

Removes the slider with the given index.

You can use index 255 to remove all slider.

.. versionadded:: 2.0.2$nbsp;(Plugin)

func (*LCD128x64Bricklet) RemoveGUITab

func (device *LCD128x64Bricklet) RemoveGUITab(index uint8) (err error)

Removes the tab with the given index.

You can use index 255 to remove all tabs.

.. versionadded:: 2.0.2$nbsp;(Plugin)

func (*LCD128x64Bricklet) Reset

func (device *LCD128x64Bricklet) Reset() (err error)

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!

func (*LCD128x64Bricklet) SetBootloaderMode

func (device *LCD128x64Bricklet) SetBootloaderMode(mode BootloaderMode) (status BootloaderStatus, err error)

Sets the bootloader mode and returns the status after the requested mode change was instigated.

You can change from bootloader mode to firmware mode and vice versa. A change from bootloader mode to firmware mode will only take place if the entry function, device identifier and CRC are present and correct.

This function is used by Brick Viewer during flashing. It should not be necessary to call it in a normal user program.

Associated constants:

* BootloaderModeBootloader
* BootloaderModeFirmware
* BootloaderModeBootloaderWaitForReboot
* BootloaderModeFirmwareWaitForReboot
* BootloaderModeFirmwareWaitForEraseAndReboot
* BootloaderStatusOK
* BootloaderStatusInvalidMode
* BootloaderStatusNoChange
* BootloaderStatusEntryFunctionNotPresent
* BootloaderStatusDeviceIdentifierIncorrect
* BootloaderStatusCRCMismatch

func (*LCD128x64Bricklet) SetDisplayConfiguration

func (device *LCD128x64Bricklet) SetDisplayConfiguration(contrast uint8, backlight uint8, invert bool, automaticDraw bool) (err error)

Sets the configuration of the display.

If automatic draw is set to *true*, the display is automatically updated with every call of WritePixels and WriteLine. If it is set to false, the changes are written into an internal buffer and only shown on the display after a call of DrawBufferedFrame.

func (*LCD128x64Bricklet) SetGUIButton

func (device *LCD128x64Bricklet) SetGUIButton(index uint8, positionX uint8, positionY uint8, width uint8, height uint8, text string) (err error)

Draws a clickable button at position (x, y) with the given text.

You can use up to 12 buttons.

The x position + width has to be within the range of 1 to 128 and the y position + height has to be within the range of 1 to 64.

The minimum useful width/height of a button is 3.

You can enable a callback for a button press with SetGUIButtonPressedCallbackConfiguration. The callback will be triggered for press and release-events.

The button is drawn in a separate GUI buffer and the button-frame will always stay on top of the graphics drawn with WritePixels. To remove the button use RemoveGUIButton.

If you want an icon instead of text, you can draw the icon inside of the button with WritePixels.

.. versionadded:: 2.0.2$nbsp;(Plugin)

func (*LCD128x64Bricklet) SetGUIButtonPressedCallbackConfiguration

func (device *LCD128x64Bricklet) SetGUIButtonPressedCallbackConfiguration(period uint32, valueHasToChange bool) (err error)

The period is the period with which the RegisterGUIButtonPressedCallback callback is triggered periodically. A value of 0 turns the callback off.

If the `value has to change`-parameter is set to true, the callback is only triggered after the value has changed. If the value didn't change within the period, the callback is triggered immediately on change.

If it is set to false, the callback is continuously triggered with the period, independent of the value.

.. versionadded:: 2.0.2$nbsp;(Plugin)

func (*LCD128x64Bricklet) SetGUIGraphConfiguration

func (device *LCD128x64Bricklet) SetGUIGraphConfiguration(index uint8, graphType GraphType, positionX uint8, positionY uint8, width uint8, height uint8, textX string, textY string) (err error)

Sets the configuration for up to four graphs.

The graph type can be dot-, line- or bar-graph.

The x and y position are pixel positions.

You can add a text for the x and y axis. The text is drawn at the inside of the graph and it can overwrite some of the graph data. If you need the text outside of the graph you can leave this text here empty and use DrawText to draw the caption outside of the graph.

The data of the graph can be set and updated with SetGUIGraphData.

The graph is drawn in a separate GUI buffer and the graph-frame and data will always stay on top of the graphics drawn with WritePixels. To remove the graph use RemoveGUIGraph.

.. versionadded:: 2.0.2$nbsp;(Plugin)

Associated constants:

* GraphTypeDot
* GraphTypeLine
* GraphTypeBar

func (*LCD128x64Bricklet) SetGUIGraphData

func (device *LCD128x64Bricklet) SetGUIGraphData(index uint8, data []uint8) (err error)

Sets the data for a graph with the given index. You have to configure the graph with SetGUIGraphConfiguration before you can set the first data.

The graph will show the first n values of the data that you set, where n is the width set with SetGUIGraphConfiguration. If you set less then n values it will show the rest of the values as zero.

The maximum number of data-points you can set is 118 (which also corresponds to the maximum width of the graph).

You have to scale your values to be between 0 and 255. 0 will be shown at the bottom of the graph and 255 at the top.

.. versionadded:: 2.0.2$nbsp;(Plugin)

func (*LCD128x64Bricklet) SetGUIGraphDataLowLevel

func (device *LCD128x64Bricklet) SetGUIGraphDataLowLevel(index uint8, dataLength uint16, dataChunkOffset uint16, dataChunkData [59]uint8) (err error)

Sets the data for a graph with the given index. You have to configure the graph with SetGUIGraphConfiguration before you can set the first data.

The graph will show the first n values of the data that you set, where n is the width set with SetGUIGraphConfiguration. If you set less then n values it will show the rest of the values as zero.

The maximum number of data-points you can set is 118 (which also corresponds to the maximum width of the graph).

You have to scale your values to be between 0 and 255. 0 will be shown at the bottom of the graph and 255 at the top.

.. versionadded:: 2.0.2$nbsp;(Plugin)

func (*LCD128x64Bricklet) SetGUISlider

func (device *LCD128x64Bricklet) SetGUISlider(index uint8, positionX uint8, positionY uint8, length uint8, direction Direction, value uint8) (err error)

Draws a slider at position (x, y) with the given length.

You can use up to 6 sliders.

If you use the horizontal direction, the x position + length has to be within the range of 1 to 128 and the y position has to be within the range of 0 to 46.

If you use the vertical direction, the y position + length has to be within the range of 1 to 64 and the x position has to be within the range of 0 to 110.

The minimum length of a slider is 8.

The parameter value is the start-position of the slider, it can be between 0 and length-8.

You can enable a callback for the slider value with SetGUISliderValueCallbackConfiguration.

The slider is drawn in a separate GUI buffer and it will always stay on top of the graphics drawn with WritePixels. To remove the button use RemoveGUISlider.

.. versionadded:: 2.0.2$nbsp;(Plugin)

Associated constants:

* DirectionHorizontal
* DirectionVertical

func (*LCD128x64Bricklet) SetGUISliderValueCallbackConfiguration

func (device *LCD128x64Bricklet) SetGUISliderValueCallbackConfiguration(period uint32, valueHasToChange bool) (err error)

The period is the period with which the RegisterGUISliderValueCallback callback is triggered periodically. A value of 0 turns the callback off.

If the `value has to change`-parameter is set to true, the callback is only triggered after the value has changed. If the value didn't change within the period, the callback is triggered immediately on change.

If it is set to false, the callback is continuously triggered with the period, independent of the value.

.. versionadded:: 2.0.2$nbsp;(Plugin)

func (*LCD128x64Bricklet) SetGUITabConfiguration

func (device *LCD128x64Bricklet) SetGUITabConfiguration(changeTabConfig ChangeTabOn, clearGUI bool) (err error)

Sets the general configuration for tabs. You can configure the tabs to only accept clicks or only swipes (gesture left/right and right/left) or both.

Additionally, if you set `Clear GUI` to true, all of the GUI elements (buttons, slider, graphs) will automatically be removed on every tab change.

.. versionadded:: 2.0.2$nbsp;(Plugin)

Associated constants:

* ChangeTabOnClick
* ChangeTabOnSwipe
* ChangeTabOnClickAndSwipe

func (*LCD128x64Bricklet) SetGUITabIcon

func (device *LCD128x64Bricklet) SetGUITabIcon(index uint8, icon [168]bool) (err error)

Adds a icon-tab with the given index. The icon can have a width of 28 pixels with a height of 6 pixels. It is drawn line-by-line from left to right.

You can use up to 10 tabs.

A icon-tab with the same index as a text-tab will overwrite the text-tab.

.. versionadded:: 2.0.2$nbsp;(Plugin)

func (*LCD128x64Bricklet) SetGUITabSelected

func (device *LCD128x64Bricklet) SetGUITabSelected(index uint8) (err error)

Sets the tab with the given index as selected (drawn as selected on the display).

.. versionadded:: 2.0.2$nbsp;(Plugin)

func (*LCD128x64Bricklet) SetGUITabSelectedCallbackConfiguration

func (device *LCD128x64Bricklet) SetGUITabSelectedCallbackConfiguration(period uint32, valueHasToChange bool) (err error)

The period is the period with which the RegisterGUITabSelectedCallback callback is triggered periodically. A value of 0 turns the callback off.

If the `value has to change`-parameter is set to true, the callback is only triggered after the value has changed. If the value didn't change within the period, the callback is triggered immediately on change.

If it is set to false, the callback is continuously triggered with the period, independent of the value.

.. versionadded:: 2.0.2$nbsp;(Plugin)

func (*LCD128x64Bricklet) SetGUITabText

func (device *LCD128x64Bricklet) SetGUITabText(index uint8, text string) (err error)

Adds a text-tab with the given index.

You can use up to 10 tabs.

A text-tab with the same index as a icon-tab will overwrite the icon-tab.

.. versionadded:: 2.0.2$nbsp;(Plugin)

func (*LCD128x64Bricklet) SetResponseExpected

func (device *LCD128x64Bricklet) 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 (*LCD128x64Bricklet) SetResponseExpectedAll

func (device *LCD128x64Bricklet) SetResponseExpectedAll(responseExpected bool)

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

func (*LCD128x64Bricklet) SetStatusLEDConfig

func (device *LCD128x64Bricklet) SetStatusLEDConfig(config StatusLEDConfig) (err error)

Sets 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.

Associated constants:

* StatusLEDConfigOff
* StatusLEDConfigOn
* StatusLEDConfigShowHeartbeat
* StatusLEDConfigShowStatus

func (*LCD128x64Bricklet) SetTouchGestureCallbackConfiguration

func (device *LCD128x64Bricklet) SetTouchGestureCallbackConfiguration(period uint32, valueHasToChange bool) (err error)

The period is the period with which the RegisterTouchGestureCallback callback is triggered periodically. A value of 0 turns the callback off.

If the `value has to change`-parameter is set to true, the callback is only triggered after the value has changed. If the value didn't change within the period, the callback is triggered immediately on change.

If it is set to false, the callback is continuously triggered with the period, independent of the value.

func (*LCD128x64Bricklet) SetTouchLEDConfig

func (device *LCD128x64Bricklet) SetTouchLEDConfig(config TouchLEDConfig) (err error)

Sets the touch LED configuration. By default the LED is on if the LCD is touched.

You can also turn the LED permanently on/off or show a heartbeat.

If the Bricklet is in bootloader mode, the LED is off.

.. versionadded:: 2.0.2$nbsp;(Plugin)

Associated constants:

* TouchLEDConfigOff
* TouchLEDConfigOn
* TouchLEDConfigShowHeartbeat
* TouchLEDConfigShowTouch

func (*LCD128x64Bricklet) SetTouchPositionCallbackConfiguration

func (device *LCD128x64Bricklet) SetTouchPositionCallbackConfiguration(period uint32, valueHasToChange bool) (err error)

The period is the period with which the RegisterTouchPositionCallback callback is triggered periodically. A value of 0 turns the callback off.

If the `value has to change`-parameter is set to true, the callback is only triggered after the value has changed. If the value didn't change within the period, the callback is triggered immediately on change.

If it is set to false, the callback is continuously triggered with the period, independent of the value.

func (*LCD128x64Bricklet) SetWriteFirmwarePointer

func (device *LCD128x64Bricklet) SetWriteFirmwarePointer(pointer uint32) (err error)

Sets the firmware pointer for WriteFirmware. The pointer has to be increased by chunks of size 64. The data is written to flash every 4 chunks (which equals to one page of size 256).

This function is used by Brick Viewer during flashing. It should not be necessary to call it in a normal user program.

func (*LCD128x64Bricklet) WriteFirmware

func (device *LCD128x64Bricklet) WriteFirmware(data [64]uint8) (status uint8, err error)

Writes 64 Bytes of firmware at the position as written by SetWriteFirmwarePointer before. The firmware is written to flash every 4 chunks.

You can only write firmware in bootloader mode.

This function is used by Brick Viewer during flashing. It should not be necessary to call it in a normal user program.

func (*LCD128x64Bricklet) WriteLine

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

Writes text to a specific line with a specific position.

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 DrawBufferedFrame is called. This can be used to avoid flicker when drawing a complex frame in multiple steps.

Automatic draw can be configured with the SetDisplayConfiguration function.

This function is a 1:1 replacement for the function with the same name in the LCD 20x4 Bricklet. You can draw text at a specific pixel position and with different font sizes with the DrawText function.

func (*LCD128x64Bricklet) WritePixels

func (device *LCD128x64Bricklet) WritePixels(xStart uint8, yStart uint8, xEnd uint8, yEnd uint8, pixels []bool) (err error)

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 DrawBufferedFrame is called. This can be used to avoid flicker when drawing a complex frame in multiple steps.

Automatic draw can be configured with the SetDisplayConfiguration function.

func (*LCD128x64Bricklet) WritePixelsLowLevel

func (device *LCD128x64Bricklet) WritePixelsLowLevel(xStart uint8, yStart uint8, xEnd uint8, yEnd uint8, pixelsLength uint16, pixelsChunkOffset uint16, pixelsChunkData [448]bool) (err error)

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 DrawBufferedFrame is called. This can be used to avoid flicker when drawing a complex frame in multiple steps.

Automatic draw can be configured with the SetDisplayConfiguration function.

func (*LCD128x64Bricklet) WriteUID

func (device *LCD128x64Bricklet) WriteUID(uid uint32) (err error)

Writes a new UID into flash. If you want to set a new UID you have to decode the Base58 encoded UID string into an integer first.

We recommend that you use Brick Viewer to change the UID.

type StatusLEDConfig

type StatusLEDConfig = uint8
const (
	StatusLEDConfigOff           StatusLEDConfig = 0
	StatusLEDConfigOn            StatusLEDConfig = 1
	StatusLEDConfigShowHeartbeat StatusLEDConfig = 2
	StatusLEDConfigShowStatus    StatusLEDConfig = 3
)

type TouchLEDConfig

type TouchLEDConfig = uint8
const (
	TouchLEDConfigOff           TouchLEDConfig = 0
	TouchLEDConfigOn            TouchLEDConfig = 1
	TouchLEDConfigShowHeartbeat TouchLEDConfig = 2
	TouchLEDConfigShowTouch     TouchLEDConfig = 3
)