Class: Tinkerforge::BrickletLCD128x64
- Defined in:
- lib/tinkerforge/bricklet_lcd_128x64.rb
Overview
7.1cm (2.8“) display with 128x64 pixel and touch screen
Constant Summary collapse
- DEVICE_IDENTIFIER =
:nodoc:
298
- DEVICE_DISPLAY_NAME =
:nodoc:
'LCD 128x64 Bricklet'
- CALLBACK_TOUCH_POSITION =
This callback is triggered periodically with the period that is set by BrickletLCD128x64#set_touch_position_callback_configuration. The parameters are the same as for BrickletLCD128x64#get_touch_position.
11
- CALLBACK_TOUCH_GESTURE =
This callback is triggered periodically with the period that is set by BrickletLCD128x64#set_touch_gesture_callback_configuration. The parameters are the same as for BrickletLCD128x64#get_touch_gesture.
15
- CALLBACK_GUI_BUTTON_PRESSED =
This callback is triggered periodically with the period that is set by BrickletLCD128x64#set_gui_button_pressed_callback_configuration. The parameters are the same as for BrickletLCD128x64#get_gui_button_pressed.
- .. versionadded
-
2.0.2$nbsp;(Plugin)
25
- CALLBACK_GUI_SLIDER_VALUE =
This callback is triggered periodically with the period that is set by BrickletLCD128x64#set_gui_slider_value_callback_configuration. The parameters are the same as for BrickletLCD128x64#get_gui_slider_value.
- .. versionadded
-
2.0.2$nbsp;(Plugin)
32
- CALLBACK_GUI_TAB_SELECTED =
This callback is triggered periodically with the period that is set by BrickletLCD128x64#set_gui_tab_selected_callback_configuration. The parameters are the same as for BrickletLCD128x64#get_gui_tab_selected.
- .. versionadded
-
2.0.2$nbsp;(Plugin)
44
- FUNCTION_WRITE_PIXELS_LOW_LEVEL =
:nodoc:
1
- FUNCTION_READ_PIXELS_LOW_LEVEL =
:nodoc:
2
- FUNCTION_CLEAR_DISPLAY =
:nodoc:
3
- FUNCTION_SET_DISPLAY_CONFIGURATION =
:nodoc:
4
- FUNCTION_GET_DISPLAY_CONFIGURATION =
:nodoc:
5
- FUNCTION_WRITE_LINE =
:nodoc:
6
- FUNCTION_DRAW_BUFFERED_FRAME =
:nodoc:
7
- FUNCTION_GET_TOUCH_POSITION =
:nodoc:
8
- FUNCTION_SET_TOUCH_POSITION_CALLBACK_CONFIGURATION =
:nodoc:
9
- FUNCTION_GET_TOUCH_POSITION_CALLBACK_CONFIGURATION =
:nodoc:
10
- FUNCTION_GET_TOUCH_GESTURE =
:nodoc:
12
- FUNCTION_SET_TOUCH_GESTURE_CALLBACK_CONFIGURATION =
:nodoc:
13
- FUNCTION_GET_TOUCH_GESTURE_CALLBACK_CONFIGURATION =
:nodoc:
14
- FUNCTION_DRAW_LINE =
:nodoc:
16
- FUNCTION_DRAW_BOX =
:nodoc:
17
- FUNCTION_DRAW_TEXT =
:nodoc:
18
- FUNCTION_SET_GUI_BUTTON =
:nodoc:
19
- FUNCTION_GET_GUI_BUTTON =
:nodoc:
20
- FUNCTION_REMOVE_GUI_BUTTON =
:nodoc:
21
- FUNCTION_SET_GUI_BUTTON_PRESSED_CALLBACK_CONFIGURATION =
:nodoc:
22
- FUNCTION_GET_GUI_BUTTON_PRESSED_CALLBACK_CONFIGURATION =
:nodoc:
23
- FUNCTION_GET_GUI_BUTTON_PRESSED =
:nodoc:
24
- FUNCTION_SET_GUI_SLIDER =
:nodoc:
26
- FUNCTION_GET_GUI_SLIDER =
:nodoc:
27
- FUNCTION_REMOVE_GUI_SLIDER =
:nodoc:
28
- FUNCTION_SET_GUI_SLIDER_VALUE_CALLBACK_CONFIGURATION =
:nodoc:
29
- FUNCTION_GET_GUI_SLIDER_VALUE_CALLBACK_CONFIGURATION =
:nodoc:
30
- FUNCTION_GET_GUI_SLIDER_VALUE =
:nodoc:
31
- FUNCTION_SET_GUI_TAB_CONFIGURATION =
:nodoc:
33
- FUNCTION_GET_GUI_TAB_CONFIGURATION =
:nodoc:
34
- FUNCTION_SET_GUI_TAB_TEXT =
:nodoc:
35
- FUNCTION_GET_GUI_TAB_TEXT =
:nodoc:
36
- FUNCTION_SET_GUI_TAB_ICON =
:nodoc:
37
- FUNCTION_GET_GUI_TAB_ICON =
:nodoc:
38
- FUNCTION_REMOVE_GUI_TAB =
:nodoc:
39
- FUNCTION_SET_GUI_TAB_SELECTED =
:nodoc:
40
- FUNCTION_SET_GUI_TAB_SELECTED_CALLBACK_CONFIGURATION =
:nodoc:
41
- FUNCTION_GET_GUI_TAB_SELECTED_CALLBACK_CONFIGURATION =
:nodoc:
42
- FUNCTION_GET_GUI_TAB_SELECTED =
:nodoc:
43
- FUNCTION_SET_GUI_GRAPH_CONFIGURATION =
:nodoc:
45
- FUNCTION_GET_GUI_GRAPH_CONFIGURATION =
:nodoc:
46
- FUNCTION_SET_GUI_GRAPH_DATA_LOW_LEVEL =
:nodoc:
47
- FUNCTION_GET_GUI_GRAPH_DATA_LOW_LEVEL =
:nodoc:
48
- FUNCTION_REMOVE_GUI_GRAPH =
:nodoc:
49
- FUNCTION_REMOVE_ALL_GUI =
:nodoc:
50
- FUNCTION_SET_TOUCH_LED_CONFIG =
:nodoc:
51
- FUNCTION_GET_TOUCH_LED_CONFIG =
:nodoc:
52
- FUNCTION_GET_SPITFP_ERROR_COUNT =
:nodoc:
234
- FUNCTION_SET_BOOTLOADER_MODE =
:nodoc:
235
- FUNCTION_GET_BOOTLOADER_MODE =
:nodoc:
236
- FUNCTION_SET_WRITE_FIRMWARE_POINTER =
:nodoc:
237
- FUNCTION_WRITE_FIRMWARE =
:nodoc:
238
- FUNCTION_SET_STATUS_LED_CONFIG =
:nodoc:
239
- FUNCTION_GET_STATUS_LED_CONFIG =
:nodoc:
240
- FUNCTION_GET_CHIP_TEMPERATURE =
:nodoc:
242
- FUNCTION_RESET =
:nodoc:
243
- FUNCTION_WRITE_UID =
:nodoc:
248
- FUNCTION_READ_UID =
:nodoc:
249
- FUNCTION_GET_IDENTITY =
:nodoc:
255
- GESTURE_LEFT_TO_RIGHT =
:nodoc:
0
- GESTURE_RIGHT_TO_LEFT =
:nodoc:
1
- GESTURE_TOP_TO_BOTTOM =
:nodoc:
2
- GESTURE_BOTTOM_TO_TOP =
:nodoc:
3
- COLOR_WHITE =
:nodoc:
false
- COLOR_BLACK =
:nodoc:
true
- FONT_6X8 =
:nodoc:
0
- FONT_6X16 =
:nodoc:
1
- FONT_6X24 =
:nodoc:
2
- FONT_6X32 =
:nodoc:
3
- FONT_12X16 =
:nodoc:
4
- FONT_12X24 =
:nodoc:
5
- FONT_12X32 =
:nodoc:
6
- FONT_18X24 =
:nodoc:
7
- FONT_18X32 =
:nodoc:
8
- FONT_24X32 =
:nodoc:
9
- DIRECTION_HORIZONTAL =
:nodoc:
0
- DIRECTION_VERTICAL =
:nodoc:
1
- CHANGE_TAB_ON_CLICK =
:nodoc:
1
- CHANGE_TAB_ON_SWIPE =
:nodoc:
2
- CHANGE_TAB_ON_CLICK_AND_SWIPE =
:nodoc:
3
- GRAPH_TYPE_DOT =
:nodoc:
0
- GRAPH_TYPE_LINE =
:nodoc:
1
- GRAPH_TYPE_BAR =
:nodoc:
2
- TOUCH_LED_CONFIG_OFF =
:nodoc:
0
- TOUCH_LED_CONFIG_ON =
:nodoc:
1
- TOUCH_LED_CONFIG_SHOW_HEARTBEAT =
:nodoc:
2
- TOUCH_LED_CONFIG_SHOW_TOUCH =
:nodoc:
3
- BOOTLOADER_MODE_BOOTLOADER =
:nodoc:
0
- BOOTLOADER_MODE_FIRMWARE =
:nodoc:
1
- BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT =
:nodoc:
2
- BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT =
:nodoc:
3
- BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT =
:nodoc:
4
- BOOTLOADER_STATUS_OK =
:nodoc:
0
- BOOTLOADER_STATUS_INVALID_MODE =
:nodoc:
1
- BOOTLOADER_STATUS_NO_CHANGE =
:nodoc:
2
- BOOTLOADER_STATUS_ENTRY_FUNCTION_NOT_PRESENT =
:nodoc:
3
- BOOTLOADER_STATUS_DEVICE_IDENTIFIER_INCORRECT =
:nodoc:
4
- BOOTLOADER_STATUS_CRC_MISMATCH =
:nodoc:
5
- STATUS_LED_CONFIG_OFF =
:nodoc:
0
- STATUS_LED_CONFIG_ON =
:nodoc:
1
- STATUS_LED_CONFIG_SHOW_HEARTBEAT =
:nodoc:
2
- STATUS_LED_CONFIG_SHOW_STATUS =
:nodoc:
3
Constants inherited from Device
Device::DEVICE_IDENTIFIER_CHECK_MATCH, Device::DEVICE_IDENTIFIER_CHECK_MISMATCH, Device::DEVICE_IDENTIFIER_CHECK_PENDING, Device::RESPONSE_EXPECTED_ALWAYS_TRUE, Device::RESPONSE_EXPECTED_FALSE, Device::RESPONSE_EXPECTED_INVALID_FUNCTION_ID, Device::RESPONSE_EXPECTED_TRUE
Instance Attribute Summary
Attributes inherited from Device
#callback_formats, #expected_response_function_id, #expected_response_sequence_number, #high_level_callbacks, #registered_callbacks, #replaced, #uid
Instance Method Summary collapse
-
#clear_display ⇒ Object
Clears the complete content of the display.
-
#draw_box(position_x_start, position_y_start, position_x_end, position_y_end, fill, color) ⇒ Object
Draws a white or black box from (x, y)-start to (x, y)-end.
-
#draw_buffered_frame(force_complete_redraw) ⇒ Object
Draws the currently buffered frame.
-
#draw_line(position_x_start, position_y_start, position_x_end, position_y_end, color) ⇒ Object
Draws a white or black line from (x, y)-start to (x, y)-end.
-
#draw_text(position_x, position_y, font, color, text) ⇒ Object
Draws a text at the pixel position (x, y).
-
#get_bootloader_mode ⇒ Object
Returns the current bootloader mode, see BrickletLCD128x64#set_bootloader_mode.
-
#get_chip_temperature ⇒ Object
Returns the temperature as measured inside the microcontroller.
-
#get_display_configuration ⇒ Object
Returns the configuration as set by BrickletLCD128x64#set_display_configuration.
-
#get_gui_button(index) ⇒ Object
Returns the button properties for a given ‘Index` as set by BrickletLCD128x64#set_gui_button.
-
#get_gui_button_pressed(index) ⇒ Object
Returns the state of the button for the given index.
-
#get_gui_button_pressed_callback_configuration ⇒ Object
Returns the callback configuration as set by BrickletLCD128x64#set_gui_button_pressed_callback_configuration.
-
#get_gui_graph_configuration(index) ⇒ Object
Returns the graph properties for a given ‘Index` as set by BrickletLCD128x64#set_gui_graph_configuration.
-
#get_gui_graph_data(index) ⇒ Object
Returns the graph data for a given index as set by BrickletLCD128x64#set_gui_graph_data.
-
#get_gui_graph_data_low_level(index) ⇒ Object
Returns the graph data for a given index as set by BrickletLCD128x64#set_gui_graph_data.
-
#get_gui_slider(index) ⇒ Object
Returns the slider properties for a given ‘Index` as set by BrickletLCD128x64#set_gui_slider.
-
#get_gui_slider_value(index) ⇒ Object
Returns the current slider value for the given index.
-
#get_gui_slider_value_callback_configuration ⇒ Object
Returns the callback configuration as set by BrickletLCD128x64#set_gui_slider_value_callback_configuration.
-
#get_gui_tab_configuration ⇒ Object
Returns the tab configuration as set by BrickletLCD128x64#set_gui_tab_configuration.
-
#get_gui_tab_icon(index) ⇒ Object
Returns the icon for a given index as set by BrickletLCD128x64#set_gui_tab_icon.
-
#get_gui_tab_selected ⇒ Object
Returns the index of the currently selected tab.
-
#get_gui_tab_selected_callback_configuration ⇒ Object
Returns the callback configuration as set by BrickletLCD128x64#set_gui_tab_selected_callback_configuration.
-
#get_gui_tab_text(index) ⇒ Object
Returns the text for a given index as set by BrickletLCD128x64#set_gui_tab_text.
-
#get_identity ⇒ Object
Returns the UID, the UID where the Bricklet is connected to, the position, the hardware and firmware version as well as the device identifier.
-
#get_spitfp_error_count ⇒ Object
Returns the error count for the communication between Brick and Bricklet.
-
#get_status_led_config ⇒ Object
Returns the configuration as set by BrickletLCD128x64#set_status_led_config.
-
#get_touch_gesture ⇒ Object
Returns one of four touch gestures that can be automatically detected by the Bricklet.
-
#get_touch_gesture_callback_configuration ⇒ Object
Returns the callback configuration as set by BrickletLCD128x64#set_touch_gesture_callback_configuration.
-
#get_touch_led_config ⇒ Object
Returns the configuration as set by BrickletLCD128x64#set_touch_led_config.
-
#get_touch_position ⇒ Object
Returns the last valid touch position:.
-
#get_touch_position_callback_configuration ⇒ Object
Returns the callback configuration as set by BrickletLCD128x64#set_touch_position_callback_configuration.
-
#initialize(uid, ipcon) ⇒ BrickletLCD128x64
constructor
Creates an object with the unique device ID
uid
and adds it to the IP Connectionipcon
. -
#read_pixels(x_start, y_start, x_end, y_end) ⇒ Object
Reads pixels from the specified window.
-
#read_pixels_low_level(x_start, y_start, x_end, y_end) ⇒ Object
Reads pixels from the specified window.
-
#read_uid ⇒ Object
Returns the current UID as an integer.
-
#register_callback(id, &block) ⇒ Object
Registers a callback with ID
id
to the blockblock
. -
#remove_all_gui ⇒ Object
Removes all GUI elements (buttons, slider, graphs, tabs).
-
#remove_gui_button(index) ⇒ Object
Removes the button with the given index.
-
#remove_gui_graph(index) ⇒ Object
Removes the graph with the given index.
-
#remove_gui_slider(index) ⇒ Object
Removes the slider with the given index.
-
#remove_gui_tab(index) ⇒ Object
Removes the tab with the given index.
-
#reset ⇒ Object
Calling this function will reset the Bricklet.
-
#set_bootloader_mode(mode) ⇒ Object
Sets the bootloader mode and returns the status after the requested mode change was instigated.
-
#set_display_configuration(contrast, backlight, invert, automatic_draw) ⇒ Object
Sets the configuration of the display.
-
#set_gui_button(index, position_x, position_y, width, height, text) ⇒ Object
Draws a clickable button at position (x, y) with the given text.
-
#set_gui_button_pressed_callback_configuration(period, value_has_to_change) ⇒ Object
The period is the period with which the CALLBACK_GUI_BUTTON_PRESSED callback is triggered periodically.
-
#set_gui_graph_configuration(index, graph_type, position_x, position_y, width, height, text_x, text_y) ⇒ Object
Sets the configuration for up to four graphs.
-
#set_gui_graph_data(index, data) ⇒ Object
Sets the data for a graph with the given index.
-
#set_gui_graph_data_low_level(index, data_length, data_chunk_offset, data_chunk_data) ⇒ Object
Sets the data for a graph with the given index.
-
#set_gui_slider(index, position_x, position_y, length, direction, value) ⇒ Object
Draws a slider at position (x, y) with the given length.
-
#set_gui_slider_value_callback_configuration(period, value_has_to_change) ⇒ Object
The period is the period with which the CALLBACK_GUI_SLIDER_VALUE callback is triggered periodically.
-
#set_gui_tab_configuration(change_tab_config, clear_gui) ⇒ Object
Sets the general configuration for tabs.
-
#set_gui_tab_icon(index, icon) ⇒ Object
Adds a icon-tab with the given index.
-
#set_gui_tab_selected(index) ⇒ Object
Sets the tab with the given index as selected (drawn as selected on the display).
-
#set_gui_tab_selected_callback_configuration(period, value_has_to_change) ⇒ Object
The period is the period with which the CALLBACK_GUI_TAB_SELECTED callback is triggered periodically.
-
#set_gui_tab_text(index, text) ⇒ Object
Adds a text-tab with the given index.
-
#set_status_led_config(config) ⇒ Object
Sets the status LED configuration.
-
#set_touch_gesture_callback_configuration(period, value_has_to_change) ⇒ Object
The period is the period with which the CALLBACK_TOUCH_GESTURE callback is triggered periodically.
-
#set_touch_led_config(config) ⇒ Object
Sets the touch LED configuration.
-
#set_touch_position_callback_configuration(period, value_has_to_change) ⇒ Object
The period is the period with which the CALLBACK_TOUCH_POSITION callback is triggered periodically.
-
#set_write_firmware_pointer(pointer) ⇒ Object
Sets the firmware pointer for BrickletLCD128x64#write_firmware.
-
#write_firmware(data) ⇒ Object
Writes 64 Bytes of firmware at the position as written by BrickletLCD128x64#set_write_firmware_pointer before.
-
#write_line(line, position, text) ⇒ Object
Writes text to a specific line with a specific position.
-
#write_pixels(x_start, y_start, x_end, y_end, pixels) ⇒ Object
Writes pixels to the specified window.
-
#write_pixels_low_level(x_start, y_start, x_end, y_end, pixels_length, pixels_chunk_offset, pixels_chunk_data) ⇒ Object
Writes pixels to the specified window.
-
#write_uid(uid) ⇒ Object
Writes a new UID into flash.
Methods inherited from Device
#check_validity, #dequeue_response, #enqueue_response, #get_api_version, #get_response_expected, #send_request, #set_response_expected, #set_response_expected_all
Constructor Details
#initialize(uid, ipcon) ⇒ BrickletLCD128x64
Creates an object with the unique device ID uid
and adds it to the IP Connection ipcon
.
Instance Method Details
#clear_display ⇒ Object
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 BrickletLCD128x64#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 BrickletLCD128x64#set_display_configuration function.
283 284 285 286 287 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 283 def clear_display check_validity send_request FUNCTION_CLEAR_DISPLAY, [], '', 8, '' end |
#draw_box(position_x_start, position_y_start, position_x_end, position_y_end, fill, color) ⇒ Object
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)
440 441 442 443 444 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 440 def draw_box(position_x_start, position_y_start, position_x_end, position_y_end, fill, color) check_validity send_request FUNCTION_DRAW_BOX, [position_x_start, position_y_start, position_x_end, position_y_end, fill, color], 'C C C C ? ?', 8, '' end |
#draw_buffered_frame(force_complete_redraw) ⇒ Object
Draws the currently buffered frame. Normally each call of BrickletLCD128x64#write_pixels and BrickletLCD128x64#write_line draws directly onto the display. If you turn automatic draw off (BrickletLCD128x64#set_display_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.
346 347 348 349 350 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 346 def draw_buffered_frame(force_complete_redraw) check_validity send_request FUNCTION_DRAW_BUFFERED_FRAME, [force_complete_redraw], '?', 8, '' end |
#draw_line(position_x_start, position_y_start, position_x_end, position_y_end, color) ⇒ Object
Draws a white or black line from (x, y)-start to (x, y)-end.
- .. versionadded
-
2.0.2$nbsp;(Plugin)
428 429 430 431 432 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 428 def draw_line(position_x_start, position_y_start, position_x_end, position_y_end, color) check_validity send_request FUNCTION_DRAW_LINE, [position_x_start, position_y_start, position_x_end, position_y_end, color], 'C C C C ?', 8, '' end |
#draw_text(position_x, position_y, font, color, text) ⇒ Object
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.
The font conforms to code page 437.
- .. versionadded
-
2.0.2$nbsp;(Plugin)
453 454 455 456 457 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 453 def draw_text(position_x, position_y, font, color, text) check_validity send_request FUNCTION_DRAW_TEXT, [position_x, position_y, font, color, text], 'C C C ? Z22', 8, '' end |
#get_bootloader_mode ⇒ Object
Returns the current bootloader mode, see BrickletLCD128x64#set_bootloader_mode.
909 910 911 912 913 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 909 def get_bootloader_mode check_validity send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C' end |
#get_chip_temperature ⇒ Object
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.
967 968 969 970 971 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 967 def get_chip_temperature check_validity send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's' end |
#get_display_configuration ⇒ Object
Returns the configuration as set by BrickletLCD128x64#set_display_configuration.
302 303 304 305 306 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 302 def get_display_configuration check_validity send_request FUNCTION_GET_DISPLAY_CONFIGURATION, [], '', 12, 'C C ? ?' end |
#get_gui_button(index) ⇒ Object
Returns the button properties for a given ‘Index` as set by BrickletLCD128x64#set_gui_button.
Additionally the ‘Active` parameter shows if a button is currently active/visible or not.
- .. versionadded
-
2.0.2$nbsp;(Plugin)
492 493 494 495 496 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 492 def (index) check_validity send_request FUNCTION_GET_GUI_BUTTON, [index], 'C', 29, '? C C C C Z16' end |
#get_gui_button_pressed(index) ⇒ Object
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)
541 542 543 544 545 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 541 def (index) check_validity send_request FUNCTION_GET_GUI_BUTTON_PRESSED, [index], 'C', 9, '?' end |
#get_gui_button_pressed_callback_configuration ⇒ Object
Returns the callback configuration as set by BrickletLCD128x64#set_gui_button_pressed_callback_configuration.
- .. versionadded
-
2.0.2$nbsp;(Plugin)
530 531 532 533 534 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 530 def check_validity send_request FUNCTION_GET_GUI_BUTTON_PRESSED_CALLBACK_CONFIGURATION, [], '', 13, 'L ?' end |
#get_gui_graph_configuration(index) ⇒ Object
Returns the graph properties for a given ‘Index` as set by BrickletLCD128x64#set_gui_graph_configuration.
Additionally the ‘Active` parameter shows if a graph is currently active/visible or not.
- .. versionadded
-
2.0.2$nbsp;(Plugin)
798 799 800 801 802 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 798 def get_gui_graph_configuration(index) check_validity send_request FUNCTION_GET_GUI_GRAPH_CONFIGURATION, [index], 'C', 22, '? C C C C C Z4 Z4' end |
#get_gui_graph_data(index) ⇒ Object
Returns the graph data for a given index as set by BrickletLCD128x64#set_gui_graph_data.
- .. versionadded
-
2.0.2$nbsp;(Plugin)
1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 1159 def get_gui_graph_data(index) data_length = nil # assigned in block data_data = nil # assigned in block @stream_mutex.synchronize { ret = get_gui_graph_data_low_level index data_length = ret[0] data_chunk_offset = ret[1] data_out_of_sync = data_chunk_offset != 0 data_data = ret[2] while not data_out_of_sync and data_data.length < data_length ret = get_gui_graph_data_low_level index data_length = ret[0] data_chunk_offset = ret[1] data_out_of_sync = data_chunk_offset != data_data.length data_data += ret[2] end if data_out_of_sync # discard remaining stream to bring it back in-sync while data_chunk_offset + 59 < data_length ret = get_gui_graph_data_low_level index data_length = ret[0] data_chunk_offset = ret[1] end raise StreamOutOfSyncException, 'Data stream is out-of-sync' end } data_data[0, data_length] end |
#get_gui_graph_data_low_level(index) ⇒ Object
Returns the graph data for a given index as set by BrickletLCD128x64#set_gui_graph_data.
- .. versionadded
-
2.0.2$nbsp;(Plugin)
827 828 829 830 831 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 827 def get_gui_graph_data_low_level(index) check_validity send_request FUNCTION_GET_GUI_GRAPH_DATA_LOW_LEVEL, [index], 'C', 71, 'S S C59' end |
#get_gui_slider(index) ⇒ Object
Returns the slider properties for a given ‘Index` as set by BrickletLCD128x64#set_gui_slider.
Additionally the ‘Active` parameter shows if a button is currently active/visible or not.
- .. versionadded
-
2.0.2$nbsp;(Plugin)
584 585 586 587 588 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 584 def (index) check_validity send_request FUNCTION_GET_GUI_SLIDER, [index], 'C', 14, '? C C C C C' end |
#get_gui_slider_value(index) ⇒ Object
Returns the current slider value for the given index.
- .. versionadded
-
2.0.2$nbsp;(Plugin)
631 632 633 634 635 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 631 def (index) check_validity send_request FUNCTION_GET_GUI_SLIDER_VALUE, [index], 'C', 9, 'C' end |
#get_gui_slider_value_callback_configuration ⇒ Object
Returns the callback configuration as set by BrickletLCD128x64#set_gui_slider_value_callback_configuration.
- .. versionadded
-
2.0.2$nbsp;(Plugin)
622 623 624 625 626 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 622 def check_validity send_request FUNCTION_GET_GUI_SLIDER_VALUE_CALLBACK_CONFIGURATION, [], '', 13, 'L ?' end |
#get_gui_tab_configuration ⇒ Object
Returns the tab configuration as set by BrickletLCD128x64#set_gui_tab_configuration.
- .. versionadded
-
2.0.2$nbsp;(Plugin)
653 654 655 656 657 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 653 def get_gui_tab_configuration check_validity send_request FUNCTION_GET_GUI_TAB_CONFIGURATION, [], '', 10, 'C ?' end |
#get_gui_tab_icon(index) ⇒ Object
Returns the icon for a given index as set by BrickletLCD128x64#set_gui_tab_icon.
Additionally the ‘Active` parameter shows if the tab is currently active/visible or not.
- .. versionadded
-
2.0.2$nbsp;(Plugin)
704 705 706 707 708 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 704 def get_gui_tab_icon(index) check_validity send_request FUNCTION_GET_GUI_TAB_ICON, [index], 'C', 30, '? ?168' end |
#get_gui_tab_selected ⇒ Object
Returns the index of the currently selected tab. If there are not tabs, the returned index is -1.
- .. versionadded
-
2.0.2$nbsp;(Plugin)
761 762 763 764 765 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 761 def get_gui_tab_selected check_validity send_request FUNCTION_GET_GUI_TAB_SELECTED, [], '', 9, 'c' end |
#get_gui_tab_selected_callback_configuration ⇒ Object
Returns the callback configuration as set by BrickletLCD128x64#set_gui_tab_selected_callback_configuration.
- .. versionadded
-
2.0.2$nbsp;(Plugin)
751 752 753 754 755 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 751 def get_gui_tab_selected_callback_configuration check_validity send_request FUNCTION_GET_GUI_TAB_SELECTED_CALLBACK_CONFIGURATION, [], '', 13, 'L ?' end |
#get_gui_tab_text(index) ⇒ Object
Returns the text for a given index as set by BrickletLCD128x64#set_gui_tab_text.
Additionally the ‘Active` parameter shows if the tab is currently active/visible or not.
- .. versionadded
-
2.0.2$nbsp;(Plugin)
678 679 680 681 682 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 678 def get_gui_tab_text(index) check_validity send_request FUNCTION_GET_GUI_TAB_TEXT, [index], 'C', 14, '? Z5' end |
#get_identity ⇒ Object
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 :ref:‘Isolator Bricklet <isolator_bricklet>` is always at position ’z’.
The device identifier numbers can be found :ref:‘here <device_identifier>`. |device_identifier_constant|
1014 1015 1016 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 1014 def get_identity send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S' end |
#get_spitfp_error_count ⇒ Object
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.
887 888 889 890 891 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 887 def get_spitfp_error_count check_validity send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L' end |
#get_status_led_config ⇒ Object
Returns the configuration as set by BrickletLCD128x64#set_status_led_config
955 956 957 958 959 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 955 def get_status_led_config check_validity send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C' end |
#get_touch_gesture ⇒ Object
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).
396 397 398 399 400 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 396 def get_touch_gesture check_validity send_request FUNCTION_GET_TOUCH_GESTURE, [], '', 27, 'C L S S S S S L' end |
#get_touch_gesture_callback_configuration ⇒ Object
Returns the callback configuration as set by BrickletLCD128x64#set_touch_gesture_callback_configuration.
419 420 421 422 423 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 419 def get_touch_gesture_callback_configuration check_validity send_request FUNCTION_GET_TOUCH_GESTURE_CALLBACK_CONFIGURATION, [], '', 13, 'L ?' end |
#get_touch_led_config ⇒ Object
Returns the configuration as set by BrickletLCD128x64#set_touch_led_config
- .. versionadded
-
2.0.2$nbsp;(Plugin)
870 871 872 873 874 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 870 def get_touch_led_config check_validity send_request FUNCTION_GET_TOUCH_LED_CONFIG, [], '', 9, 'C' end |
#get_touch_position ⇒ Object
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)
358 359 360 361 362 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 358 def get_touch_position check_validity send_request FUNCTION_GET_TOUCH_POSITION, [], '', 18, 'S S S L' end |
#get_touch_position_callback_configuration ⇒ Object
Returns the callback configuration as set by BrickletLCD128x64#set_touch_position_callback_configuration.
381 382 383 384 385 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 381 def get_touch_position_callback_configuration check_validity send_request FUNCTION_GET_TOUCH_POSITION_CALLBACK_CONFIGURATION, [], '', 13, 'L ?' end |
#read_pixels(x_start, y_start, x_end, y_end) ⇒ Object
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 BrickletLCD128x64#draw_buffered_frame).
Automatic draw can be configured with the BrickletLCD128x64#set_display_configuration function.
1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 1078 def read_pixels(x_start, y_start, x_end, y_end) pixels_length = nil # assigned in block pixels_data = nil # assigned in block @stream_mutex.synchronize { ret = read_pixels_low_level x_start, y_start, x_end, y_end pixels_length = ret[0] pixels_chunk_offset = ret[1] pixels_out_of_sync = pixels_chunk_offset != 0 pixels_data = ret[2] while not pixels_out_of_sync and pixels_data.length < pixels_length ret = read_pixels_low_level x_start, y_start, x_end, y_end pixels_length = ret[0] pixels_chunk_offset = ret[1] pixels_out_of_sync = pixels_chunk_offset != pixels_data.length pixels_data += ret[2] end if pixels_out_of_sync # discard remaining stream to bring it back in-sync while pixels_chunk_offset + 480 < pixels_length ret = read_pixels_low_level x_start, y_start, x_end, y_end pixels_length = ret[0] pixels_chunk_offset = ret[1] end raise StreamOutOfSyncException, 'Pixels stream is out-of-sync' end } pixels_data[0, pixels_length] end |
#read_pixels_low_level(x_start, y_start, x_end, y_end) ⇒ Object
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 BrickletLCD128x64#draw_buffered_frame).
Automatic draw can be configured with the BrickletLCD128x64#set_display_configuration function.
266 267 268 269 270 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 266 def read_pixels_low_level(x_start, y_start, x_end, y_end) check_validity send_request FUNCTION_READ_PIXELS_LOW_LEVEL, [x_start, y_start, x_end, y_end], 'C C C C', 72, 'S S ?480' end |
#read_uid ⇒ Object
Returns the current UID as an integer. Encode as Base58 to get the usual string version.
998 999 1000 1001 1002 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 998 def read_uid check_validity send_request FUNCTION_READ_UID, [], '', 12, 'L' end |
#register_callback(id, &block) ⇒ Object
Registers a callback with ID id
to the block block
.
1193 1194 1195 1196 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 1193 def register_callback(id, &block) callback = block @registered_callbacks[id] = callback end |
#remove_all_gui ⇒ Object
Removes all GUI elements (buttons, slider, graphs, tabs).
- .. versionadded
-
2.0.2$nbsp;(Plugin)
847 848 849 850 851 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 847 def remove_all_gui check_validity send_request FUNCTION_REMOVE_ALL_GUI, [], '', 8, '' end |
#remove_gui_button(index) ⇒ Object
Removes the button with the given index.
You can use index 255 to remove all buttons.
- .. versionadded
-
2.0.2$nbsp;(Plugin)
503 504 505 506 507 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 503 def (index) check_validity send_request FUNCTION_REMOVE_GUI_BUTTON, [index], 'C', 8, '' end |
#remove_gui_graph(index) ⇒ Object
Removes the graph with the given index.
You can use index 255 to remove all graphs.
- .. versionadded
-
2.0.2$nbsp;(Plugin)
838 839 840 841 842 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 838 def remove_gui_graph(index) check_validity send_request FUNCTION_REMOVE_GUI_GRAPH, [index], 'C', 8, '' end |
#remove_gui_slider(index) ⇒ Object
Removes the slider with the given index.
You can use index 255 to remove all slider.
- .. versionadded
-
2.0.2$nbsp;(Plugin)
595 596 597 598 599 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 595 def (index) check_validity send_request FUNCTION_REMOVE_GUI_SLIDER, [index], 'C', 8, '' end |
#remove_gui_tab(index) ⇒ Object
Removes the tab with the given index.
You can use index 255 to remove all tabs.
- .. versionadded
-
2.0.2$nbsp;(Plugin)
715 716 717 718 719 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 715 def remove_gui_tab(index) check_validity send_request FUNCTION_REMOVE_GUI_TAB, [index], 'C', 8, '' end |
#reset ⇒ Object
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!
979 980 981 982 983 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 979 def reset check_validity send_request FUNCTION_RESET, [], '', 8, '' end |
#set_bootloader_mode(mode) ⇒ Object
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.
902 903 904 905 906 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 902 def set_bootloader_mode(mode) check_validity send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C' end |
#set_display_configuration(contrast, backlight, invert, automatic_draw) ⇒ Object
Sets the configuration of the display.
If automatic draw is set to true, the display is automatically updated with every call of BrickletLCD128x64#write_pixels and BrickletLCD128x64#write_line. If it is set to false, the changes are written into an internal buffer and only shown on the display after a call of BrickletLCD128x64#draw_buffered_frame.
295 296 297 298 299 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 295 def set_display_configuration(contrast, backlight, invert, automatic_draw) check_validity send_request FUNCTION_SET_DISPLAY_CONFIGURATION, [contrast, backlight, invert, automatic_draw], 'C C ? ?', 8, '' end |
#set_gui_button(index, position_x, position_y, width, height, text) ⇒ Object
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 BrickletLCD128x64#set_gui_button_pressed_callback_configuration. 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 BrickletLCD128x64#write_pixels. To remove the button use BrickletLCD128x64#remove_gui_button.
If you want an icon instead of text, you can draw the icon inside of the button with BrickletLCD128x64#write_pixels.
- .. versionadded
-
2.0.2$nbsp;(Plugin)
480 481 482 483 484 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 480 def (index, position_x, position_y, width, height, text) check_validity send_request FUNCTION_SET_GUI_BUTTON, [index, position_x, position_y, width, height, text], 'C C C C C Z16', 8, '' end |
#set_gui_button_pressed_callback_configuration(period, value_has_to_change) ⇒ Object
The period is the period with which the CALLBACK_GUI_BUTTON_PRESSED 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)
520 521 522 523 524 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 520 def (period, value_has_to_change) check_validity send_request FUNCTION_SET_GUI_BUTTON_PRESSED_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, '' end |
#set_gui_graph_configuration(index, graph_type, position_x, position_y, width, height, text_x, text_y) ⇒ Object
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 BrickletLCD128x64#draw_text to draw the caption outside of the graph.
The data of the graph can be set and updated with BrickletLCD128x64#set_gui_graph_data.
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 BrickletLCD128x64#write_pixels. To remove the graph use BrickletLCD128x64#remove_gui_graph.
- .. versionadded
-
2.0.2$nbsp;(Plugin)
786 787 788 789 790 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 786 def set_gui_graph_configuration(index, graph_type, position_x, position_y, width, height, text_x, text_y) check_validity send_request FUNCTION_SET_GUI_GRAPH_CONFIGURATION, [index, graph_type, position_x, position_y, width, height, text_x, text_y], 'C C C C C C Z4 Z4', 8, '' end |
#set_gui_graph_data(index, data) ⇒ Object
Sets the data for a graph with the given index. You have to configure the graph with BrickletLCD128x64#set_gui_graph_configuration 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 BrickletLCD128x64#set_gui_graph_configuration. 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)
1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 1125 def set_gui_graph_data(index, data) if data.length > 65535 raise ArgumentError, 'Data can be at most 65535 items long' end data_length = data.length data_chunk_offset = 0 if data_length == 0 data_chunk_data = [0] * 59 ret = set_gui_graph_data_low_level index, data_length, data_chunk_offset, data_chunk_data else ret = nil # assigned in block @stream_mutex.synchronize { while data_chunk_offset < data_length data_chunk_data = data[data_chunk_offset, 59] if data_chunk_data.length < 59 data_chunk_data += [0] * (59 - data_chunk_data.length) end ret = set_gui_graph_data_low_level index, data_length, data_chunk_offset, data_chunk_data data_chunk_offset += 59 end } end ret end |
#set_gui_graph_data_low_level(index, data_length, data_chunk_offset, data_chunk_data) ⇒ Object
Sets the data for a graph with the given index. You have to configure the graph with BrickletLCD128x64#set_gui_graph_configuration 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 BrickletLCD128x64#set_gui_graph_configuration. 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)
818 819 820 821 822 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 818 def set_gui_graph_data_low_level(index, data_length, data_chunk_offset, data_chunk_data) check_validity send_request FUNCTION_SET_GUI_GRAPH_DATA_LOW_LEVEL, [index, data_length, data_chunk_offset, data_chunk_data], 'C S S C59', 8, '' end |
#set_gui_slider(index, position_x, position_y, length, direction, value) ⇒ Object
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 BrickletLCD128x64#set_gui_slider_value_callback_configuration.
The slider is drawn in a separate GUI buffer and it will always stay on top of the graphics drawn with BrickletLCD128x64#write_pixels. To remove the button use BrickletLCD128x64#remove_gui_slider.
- .. versionadded
-
2.0.2$nbsp;(Plugin)
572 573 574 575 576 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 572 def (index, position_x, position_y, length, direction, value) check_validity send_request FUNCTION_SET_GUI_SLIDER, [index, position_x, position_y, length, direction, value], 'C C C C C C', 8, '' end |
#set_gui_slider_value_callback_configuration(period, value_has_to_change) ⇒ Object
The period is the period with which the CALLBACK_GUI_SLIDER_VALUE 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)
612 613 614 615 616 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 612 def (period, value_has_to_change) check_validity send_request FUNCTION_SET_GUI_SLIDER_VALUE_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, '' end |
#set_gui_tab_configuration(change_tab_config, clear_gui) ⇒ Object
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)
644 645 646 647 648 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 644 def set_gui_tab_configuration(change_tab_config, clear_gui) check_validity send_request FUNCTION_SET_GUI_TAB_CONFIGURATION, [change_tab_config, clear_gui], 'C ?', 8, '' end |
#set_gui_tab_icon(index, icon) ⇒ Object
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)
692 693 694 695 696 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 692 def set_gui_tab_icon(index, icon) check_validity send_request FUNCTION_SET_GUI_TAB_ICON, [index, icon], 'C ?168', 8, '' end |
#set_gui_tab_selected(index) ⇒ Object
Sets the tab with the given index as selected (drawn as selected on the display).
- .. versionadded
-
2.0.2$nbsp;(Plugin)
724 725 726 727 728 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 724 def set_gui_tab_selected(index) check_validity send_request FUNCTION_SET_GUI_TAB_SELECTED, [index], 'C', 8, '' end |
#set_gui_tab_selected_callback_configuration(period, value_has_to_change) ⇒ Object
The period is the period with which the CALLBACK_GUI_TAB_SELECTED 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)
741 742 743 744 745 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 741 def set_gui_tab_selected_callback_configuration(period, value_has_to_change) check_validity send_request FUNCTION_SET_GUI_TAB_SELECTED_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, '' end |
#set_gui_tab_text(index, text) ⇒ Object
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)
666 667 668 669 670 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 666 def set_gui_tab_text(index, text) check_validity send_request FUNCTION_SET_GUI_TAB_TEXT, [index, text], 'C Z5', 8, '' end |
#set_status_led_config(config) ⇒ Object
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.
948 949 950 951 952 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 948 def set_status_led_config(config) check_validity send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, '' end |
#set_touch_gesture_callback_configuration(period, value_has_to_change) ⇒ Object
The period is the period with which the CALLBACK_TOUCH_GESTURE 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.
411 412 413 414 415 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 411 def set_touch_gesture_callback_configuration(period, value_has_to_change) check_validity send_request FUNCTION_SET_TOUCH_GESTURE_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, '' end |
#set_touch_led_config(config) ⇒ Object
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)
861 862 863 864 865 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 861 def set_touch_led_config(config) check_validity send_request FUNCTION_SET_TOUCH_LED_CONFIG, [config], 'C', 8, '' end |
#set_touch_position_callback_configuration(period, value_has_to_change) ⇒ Object
The period is the period with which the CALLBACK_TOUCH_POSITION 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.
373 374 375 376 377 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 373 def set_touch_position_callback_configuration(period, value_has_to_change) check_validity send_request FUNCTION_SET_TOUCH_POSITION_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, '' end |
#set_write_firmware_pointer(pointer) ⇒ Object
Sets the firmware pointer for BrickletLCD128x64#write_firmware. 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.
921 922 923 924 925 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 921 def set_write_firmware_pointer(pointer) check_validity send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, '' end |
#write_firmware(data) ⇒ Object
Writes 64 Bytes of firmware at the position as written by BrickletLCD128x64#set_write_firmware_pointer 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.
935 936 937 938 939 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 935 def write_firmware(data) check_validity send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C' end |
#write_line(line, position, text) ⇒ Object
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 BrickletLCD128x64#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 BrickletLCD128x64#set_display_configuration 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 BrickletLCD128x64#draw_text function.
331 332 333 334 335 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 331 def write_line(line, position, text) check_validity send_request FUNCTION_WRITE_LINE, [line, position, text], 'C C Z22', 8, '' end |
#write_pixels(x_start, y_start, x_end, y_end, pixels) ⇒ Object
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 BrickletLCD128x64#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 BrickletLCD128x64#set_display_configuration function.
1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 1034 def write_pixels(x_start, y_start, x_end, y_end, pixels) if pixels.length > 65535 raise ArgumentError, 'Pixels can be at most 65535 items long' end pixels_length = pixels.length pixels_chunk_offset = 0 if pixels_length == 0 pixels_chunk_data = [false] * 448 ret = write_pixels_low_level x_start, y_start, x_end, y_end, pixels_length, pixels_chunk_offset, pixels_chunk_data else ret = nil # assigned in block @stream_mutex.synchronize { while pixels_chunk_offset < pixels_length pixels_chunk_data = pixels[pixels_chunk_offset, 448] if pixels_chunk_data.length < 448 pixels_chunk_data += [false] * (448 - pixels_chunk_data.length) end ret = write_pixels_low_level x_start, y_start, x_end, y_end, pixels_length, pixels_chunk_offset, pixels_chunk_data pixels_chunk_offset += 448 end } end ret end |
#write_pixels_low_level(x_start, y_start, x_end, y_end, pixels_length, pixels_chunk_offset, pixels_chunk_data) ⇒ Object
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 BrickletLCD128x64#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 BrickletLCD128x64#set_display_configuration function.
247 248 249 250 251 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 247 def write_pixels_low_level(x_start, y_start, x_end, y_end, pixels_length, pixels_chunk_offset, pixels_chunk_data) check_validity send_request FUNCTION_WRITE_PIXELS_LOW_LEVEL, [x_start, y_start, x_end, y_end, pixels_length, pixels_chunk_offset, pixels_chunk_data], 'C C C C S S ?448', 8, '' end |
#write_uid(uid) ⇒ Object
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.
990 991 992 993 994 |
# File 'lib/tinkerforge/bricklet_lcd_128x64.rb', line 990 def write_uid(uid) check_validity send_request FUNCTION_WRITE_UID, [uid], 'L', 8, '' end |