pub struct Lcd128x64Bricklet { /* private fields */ }
Expand description
7.1cm (2.8“) display with 128x64 pixel and touch screen
Implementations§
Source§impl Lcd128x64Bricklet
impl Lcd128x64Bricklet
pub const DEVICE_IDENTIFIER: u16 = 298u16
pub const DEVICE_DISPLAY_NAME: &'static str = "LCD 128x64 Bricklet"
Sourcepub fn new(uid: Uid, connection: AsyncIpConnection) -> Lcd128x64Bricklet
pub fn new(uid: Uid, connection: AsyncIpConnection) -> Lcd128x64Bricklet
Creates an object with the unique device ID uid
. This object can then be used after the IP Connection ip_connection
is connected.
Sourcepub fn get_response_expected(
&mut self,
fun: Lcd128x64BrickletFunction,
) -> Result<bool, GetResponseExpectedError>
pub fn get_response_expected( &mut self, fun: Lcd128x64BrickletFunction, ) -> Result<bool, GetResponseExpectedError>
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 set_response_expected
.
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 set_response_expected
for the list of function ID constants available for this function.
Sourcepub fn set_response_expected(
&mut self,
fun: Lcd128x64BrickletFunction,
response_expected: bool,
) -> Result<(), SetResponseExpectedError>
pub fn set_response_expected( &mut self, fun: Lcd128x64BrickletFunction, response_expected: bool, ) -> Result<(), SetResponseExpectedError>
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.
Sourcepub fn set_response_expected_all(&mut self, response_expected: bool)
pub fn set_response_expected_all(&mut self, response_expected: bool)
Changes the response expected flag for all setter and callback configuration functions of this device at once.
Sourcepub fn get_api_version(&self) -> [u8; 3]
pub fn get_api_version(&self) -> [u8; 3]
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.
Sourcepub async fn get_touch_position_callback_receiver(
&mut self,
) -> impl Stream<Item = TouchPositionEvent>
pub async fn get_touch_position_callback_receiver( &mut self, ) -> impl Stream<Item = TouchPositionEvent>
This receiver is triggered periodically with the period that is set by
set_touch_position_callback_configuration
. The parameters are the
same as for get_touch_position
.
Sourcepub async fn get_touch_gesture_callback_receiver(
&mut self,
) -> impl Stream<Item = TouchGestureEvent>
pub async fn get_touch_gesture_callback_receiver( &mut self, ) -> impl Stream<Item = TouchGestureEvent>
This receiver is triggered periodically with the period that is set by
[set_touch_gesture_callback_configuration
]. The parameters are the
same as for [get_touch_gesture
].
This receiver is triggered periodically with the period that is set by
[set_gui_button_pressed_callback_configuration
]. The parameters are the
same as for [get_gui_button_pressed
].
.. versionadded:: 2.0.2$nbsp;(Plugin)
Sourcepub async fn get_gui_slider_value_callback_receiver(
&mut self,
) -> impl Stream<Item = GuiSliderValueEvent>
pub async fn get_gui_slider_value_callback_receiver( &mut self, ) -> impl Stream<Item = GuiSliderValueEvent>
This receiver is triggered periodically with the period that is set by
[set_gui_slider_value_callback_configuration
]. The parameters are the
same as for [get_gui_slider_value
].
.. versionadded:: 2.0.2$nbsp;(Plugin)
Sourcepub async fn get_gui_tab_selected_callback_receiver(
&mut self,
) -> impl Stream<Item = i8>
pub async fn get_gui_tab_selected_callback_receiver( &mut self, ) -> impl Stream<Item = i8>
This receiver is triggered periodically with the period that is set by
[set_gui_tab_selected_callback_configuration
]. The parameters are the
same as for [get_gui_tab_selected
].
.. versionadded:: 2.0.2$nbsp;(Plugin)
Sourcepub async fn write_pixels_low_level(
&mut self,
x_start: u8,
y_start: u8,
x_end: u8,
y_end: u8,
pixels_length: u16,
pixels_chunk_offset: u16,
pixels_chunk_data: &[bool; 448],
) -> Result<WritePixelsLowLevel, TinkerforgeError>
pub async fn write_pixels_low_level( &mut self, x_start: u8, y_start: u8, x_end: u8, y_end: u8, pixels_length: u16, pixels_chunk_offset: u16, pixels_chunk_data: &[bool; 448], ) -> Result<WritePixelsLowLevel, TinkerforgeError>
Writes pixels to the specified window.
The pixels are written into the window line by line top to bottom and each line is written from left to right.
If automatic draw is enabled (default) the pixels are directly written to the screen. Only pixels that have actually changed are updated on the screen, the rest stays the same.
If automatic draw is disabled the pixels are written to an internal buffer and
the buffer is transferred to the display only after [draw_buffered_frame
]
is called. This can be used to avoid flicker when drawing a complex frame in
multiple steps.
Automatic draw can be configured with the [set_display_configuration
]
function.
Sourcepub async fn read_pixels_low_level(
&mut self,
x_start: u8,
y_start: u8,
x_end: u8,
y_end: u8,
) -> Result<ReadPixelsLowLevel, TinkerforgeError>
pub async fn read_pixels_low_level( &mut self, x_start: u8, y_start: u8, x_end: u8, y_end: u8, ) -> Result<ReadPixelsLowLevel, TinkerforgeError>
Reads pixels from the specified window.
The pixels are read from the window line by line top to bottom and each line is read from left to right.
If automatic draw is enabled (default) the pixels that are read are always the same that are shown on the display.
If automatic draw is disabled the pixels are read from the internal buffer
(see [draw_buffered_frame
]).
Automatic draw can be configured with the [set_display_configuration
]
function.
Sourcepub async fn clear_display(&mut self) -> Result<(), TinkerforgeError>
pub async fn clear_display(&mut self) -> Result<(), TinkerforgeError>
Clears the complete content of the display.
If automatic draw is enabled (default) the pixels are directly cleared.
If automatic draw is disabled the the internal buffer is cleared and
the buffer is transferred to the display only after [draw_buffered_frame
]
is called. This can be used to avoid flicker when drawing a complex frame in
multiple steps.
Automatic draw can be configured with the [set_display_configuration
]
function.
Sourcepub async fn set_display_configuration(
&mut self,
contrast: u8,
backlight: u8,
invert: bool,
automatic_draw: bool,
) -> Result<(), TinkerforgeError>
pub async fn set_display_configuration( &mut self, contrast: u8, backlight: u8, invert: bool, automatic_draw: bool, ) -> Result<(), TinkerforgeError>
Sets the configuration of the display.
If automatic draw is set to true, the display is automatically updated with every
call of [write_pixels
] and [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 [draw_buffered_frame
].
Sourcepub async fn get_display_configuration(
&mut self,
) -> Result<DisplayConfiguration, TinkerforgeError>
pub async fn get_display_configuration( &mut self, ) -> Result<DisplayConfiguration, TinkerforgeError>
Returns the configuration as set by [set_display_configuration
].
Sourcepub async fn write_line(
&mut self,
line: u8,
position: u8,
text: String,
) -> Result<(), TinkerforgeError>
pub async fn write_line( &mut self, line: u8, position: u8, text: String, ) -> Result<(), TinkerforgeError>
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 [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 [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 [draw_text
] function.
Sourcepub async fn draw_buffered_frame(
&mut self,
force_complete_redraw: bool,
) -> Result<(), TinkerforgeError>
pub async fn draw_buffered_frame( &mut self, force_complete_redraw: bool, ) -> Result<(), TinkerforgeError>
Draws the currently buffered frame. Normally each call of [write_pixels
] and
[write_line
] draws directly onto the display. If you turn automatic draw off
([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.
Sourcepub async fn get_touch_position(
&mut self,
) -> Result<TouchPosition, TinkerforgeError>
pub async fn get_touch_position( &mut self, ) -> Result<TouchPosition, TinkerforgeError>
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)
Sourcepub async fn set_touch_position_callback_configuration(
&mut self,
period: u32,
value_has_to_change: bool,
) -> Result<(), TinkerforgeError>
pub async fn set_touch_position_callback_configuration( &mut self, period: u32, value_has_to_change: bool, ) -> Result<(), TinkerforgeError>
The period is the period with which the [get_touch_position_callback_receiver
] receiver
is triggered periodically. A value of 0 turns the receiver off.
If the value has to change
-parameter is set to true, the receiver is only
triggered after the value has changed. If the value didn’t change within the
period, the receiver is triggered immediately on change.
If it is set to false, the receiver is continuously triggered with the period, independent of the value.
Sourcepub async fn get_touch_position_callback_configuration(
&mut self,
) -> Result<TouchPositionCallbackConfiguration, TinkerforgeError>
pub async fn get_touch_position_callback_configuration( &mut self, ) -> Result<TouchPositionCallbackConfiguration, TinkerforgeError>
Returns the receiver configuration as set by
[set_touch_position_callback_configuration
].
Sourcepub async fn get_touch_gesture(
&mut self,
) -> Result<TouchGesture, TinkerforgeError>
pub async fn get_touch_gesture( &mut self, ) -> Result<TouchGesture, TinkerforgeError>
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:
- LCD_128X64_BRICKLET_GESTURE_LEFT_TO_RIGHT
- LCD_128X64_BRICKLET_GESTURE_RIGHT_TO_LEFT
- LCD_128X64_BRICKLET_GESTURE_TOP_TO_BOTTOM
- LCD_128X64_BRICKLET_GESTURE_BOTTOM_TO_TOP
Sourcepub async fn set_touch_gesture_callback_configuration(
&mut self,
period: u32,
value_has_to_change: bool,
) -> Result<(), TinkerforgeError>
pub async fn set_touch_gesture_callback_configuration( &mut self, period: u32, value_has_to_change: bool, ) -> Result<(), TinkerforgeError>
The period is the period with which the [get_touch_gesture_callback_receiver
] receiver
is triggered periodically. A value of 0 turns the receiver off.
If the value has to change
-parameter is set to true, the receiver is only
triggered after the value has changed. If the value didn’t change within the
period, the receiver is triggered immediately on change.
If it is set to false, the receiver is continuously triggered with the period, independent of the value.
Sourcepub async fn get_touch_gesture_callback_configuration(
&mut self,
) -> Result<TouchGestureCallbackConfiguration, TinkerforgeError>
pub async fn get_touch_gesture_callback_configuration( &mut self, ) -> Result<TouchGestureCallbackConfiguration, TinkerforgeError>
Returns the receiver configuration as set by
[set_touch_gesture_callback_configuration
].
Sourcepub async fn draw_line(
&mut self,
position_x_start: u8,
position_y_start: u8,
position_x_end: u8,
position_y_end: u8,
color: bool,
) -> Result<(), TinkerforgeError>
pub async fn draw_line( &mut self, position_x_start: u8, position_y_start: u8, position_x_end: u8, position_y_end: u8, color: bool, ) -> Result<(), TinkerforgeError>
Draws a white or black line from (x, y)-start to (x, y)-end.
.. versionadded:: 2.0.2$nbsp;(Plugin)
Associated constants:
- LCD_128X64_BRICKLET_COLOR_WHITE
- LCD_128X64_BRICKLET_COLOR_BLACK
Sourcepub async fn draw_box(
&mut self,
position_x_start: u8,
position_y_start: u8,
position_x_end: u8,
position_y_end: u8,
fill: bool,
color: bool,
) -> Result<(), TinkerforgeError>
pub async fn draw_box( &mut self, position_x_start: u8, position_y_start: u8, position_x_end: u8, position_y_end: u8, fill: bool, color: bool, ) -> Result<(), TinkerforgeError>
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:
- LCD_128X64_BRICKLET_COLOR_WHITE
- LCD_128X64_BRICKLET_COLOR_BLACK
Sourcepub async fn draw_text(
&mut self,
position_x: u8,
position_y: u8,
font: u8,
color: bool,
text: String,
) -> Result<(), TinkerforgeError>
pub async fn draw_text( &mut self, position_x: u8, position_y: u8, font: u8, color: bool, text: String, ) -> Result<(), TinkerforgeError>
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)
Associated constants:
- LCD_128X64_BRICKLET_FONT_6X8
- LCD_128X64_BRICKLET_FONT_6X16
- LCD_128X64_BRICKLET_FONT_6X24
- LCD_128X64_BRICKLET_FONT_6X32
- LCD_128X64_BRICKLET_FONT_12X16
- LCD_128X64_BRICKLET_FONT_12X24
- LCD_128X64_BRICKLET_FONT_12X32
- LCD_128X64_BRICKLET_FONT_18X24
- LCD_128X64_BRICKLET_FONT_18X32
- LCD_128X64_BRICKLET_FONT_24X32
- LCD_128X64_BRICKLET_COLOR_WHITE
- LCD_128X64_BRICKLET_COLOR_BLACK
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 receiver for a button press with
[set_gui_button_pressed_callback_configuration
]. The receiver 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 [write_pixels
]. To
remove the button use [remove_gui_button
].
If you want an icon instead of text, you can draw the icon inside of the
button with [write_pixels
].
.. versionadded:: 2.0.2$nbsp;(Plugin)
Returns the button properties for a given Index
as set by [set_gui_button
].
Additionally the Active
parameter shows if a button is currently active/visible
or not.
.. versionadded:: 2.0.2$nbsp;(Plugin)
Removes the button with the given index.
You can use index 255 to remove all buttons.
.. versionadded:: 2.0.2$nbsp;(Plugin)
The period is the period with which the [get_gui_button_pressed_callback_receiver
] receiver
is triggered periodically. A value of 0 turns the receiver off.
If the value has to change
-parameter is set to true, the receiver is only
triggered after the value has changed. If the value didn’t change within the
period, the receiver is triggered immediately on change.
If it is set to false, the receiver is continuously triggered with the period, independent of the value.
.. versionadded:: 2.0.2$nbsp;(Plugin)
Returns the receiver configuration as set by
[set_gui_button_pressed_callback_configuration
].
.. versionadded:: 2.0.2$nbsp;(Plugin)
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)
Sourcepub async fn set_gui_slider(
&mut self,
index: u8,
position_x: u8,
position_y: u8,
length: u8,
direction: u8,
value: u8,
) -> Result<(), TinkerforgeError>
pub async fn set_gui_slider( &mut self, index: u8, position_x: u8, position_y: u8, length: u8, direction: u8, value: u8, ) -> Result<(), TinkerforgeError>
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 receiver for the slider value with
[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 [write_pixels
]. To
remove the button use [remove_gui_slider
].
.. versionadded:: 2.0.2$nbsp;(Plugin)
Associated constants:
- LCD_128X64_BRICKLET_DIRECTION_HORIZONTAL
- LCD_128X64_BRICKLET_DIRECTION_VERTICAL
Sourcepub async fn get_gui_slider(
&mut self,
index: u8,
) -> Result<GuiSlider, TinkerforgeError>
pub async fn get_gui_slider( &mut self, index: u8, ) -> Result<GuiSlider, TinkerforgeError>
Returns the slider properties for a given Index
as set by [set_gui_slider
].
Additionally the Active
parameter shows if a button is currently active/visible
or not.
.. versionadded:: 2.0.2$nbsp;(Plugin)
Associated constants:
- LCD_128X64_BRICKLET_DIRECTION_HORIZONTAL
- LCD_128X64_BRICKLET_DIRECTION_VERTICAL
Sourcepub async fn remove_gui_slider(
&mut self,
index: u8,
) -> Result<(), TinkerforgeError>
pub async fn remove_gui_slider( &mut self, index: u8, ) -> Result<(), TinkerforgeError>
Removes the slider with the given index.
You can use index 255 to remove all slider.
.. versionadded:: 2.0.2$nbsp;(Plugin)
Sourcepub async fn set_gui_slider_value_callback_configuration(
&mut self,
period: u32,
value_has_to_change: bool,
) -> Result<(), TinkerforgeError>
pub async fn set_gui_slider_value_callback_configuration( &mut self, period: u32, value_has_to_change: bool, ) -> Result<(), TinkerforgeError>
The period is the period with which the [get_gui_slider_value_callback_receiver
] receiver
is triggered periodically. A value of 0 turns the receiver off.
If the value has to change
-parameter is set to true, the receiver is only
triggered after the value has changed. If the value didn’t change within the
period, the receiver is triggered immediately on change.
If it is set to false, the receiver is continuously triggered with the period, independent of the value.
.. versionadded:: 2.0.2$nbsp;(Plugin)
Sourcepub async fn get_gui_slider_value_callback_configuration(
&mut self,
) -> Result<GuiSliderValueCallbackConfiguration, TinkerforgeError>
pub async fn get_gui_slider_value_callback_configuration( &mut self, ) -> Result<GuiSliderValueCallbackConfiguration, TinkerforgeError>
Returns the receiver configuration as set by
[set_gui_slider_value_callback_configuration
].
.. versionadded:: 2.0.2$nbsp;(Plugin)
Sourcepub async fn get_gui_slider_value(
&mut self,
index: u8,
) -> Result<u8, TinkerforgeError>
pub async fn get_gui_slider_value( &mut self, index: u8, ) -> Result<u8, TinkerforgeError>
Returns the current slider value for the given index.
.. versionadded:: 2.0.2$nbsp;(Plugin)
Sourcepub async fn set_gui_tab_configuration(
&mut self,
change_tab_config: u8,
clear_gui: bool,
) -> Result<(), TinkerforgeError>
pub async fn set_gui_tab_configuration( &mut self, change_tab_config: u8, clear_gui: bool, ) -> Result<(), TinkerforgeError>
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:
- LCD_128X64_BRICKLET_CHANGE_TAB_ON_CLICK
- LCD_128X64_BRICKLET_CHANGE_TAB_ON_SWIPE
- LCD_128X64_BRICKLET_CHANGE_TAB_ON_CLICK_AND_SWIPE
Sourcepub async fn get_gui_tab_configuration(
&mut self,
) -> Result<GuiTabConfiguration, TinkerforgeError>
pub async fn get_gui_tab_configuration( &mut self, ) -> Result<GuiTabConfiguration, TinkerforgeError>
Returns the tab configuration as set by [set_gui_tab_configuration
].
.. versionadded:: 2.0.2$nbsp;(Plugin)
Associated constants:
- LCD_128X64_BRICKLET_CHANGE_TAB_ON_CLICK
- LCD_128X64_BRICKLET_CHANGE_TAB_ON_SWIPE
- LCD_128X64_BRICKLET_CHANGE_TAB_ON_CLICK_AND_SWIPE
Sourcepub async fn set_gui_tab_text(
&mut self,
index: u8,
text: String,
) -> Result<(), TinkerforgeError>
pub async fn set_gui_tab_text( &mut self, index: u8, text: String, ) -> Result<(), TinkerforgeError>
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)
Sourcepub async fn get_gui_tab_text(
&mut self,
index: u8,
) -> Result<GuiTabText, TinkerforgeError>
pub async fn get_gui_tab_text( &mut self, index: u8, ) -> Result<GuiTabText, TinkerforgeError>
Returns the text for a given index as set by [set_gui_tab_text
].
Additionally the Active
parameter shows if the tab is currently active/visible
or not.
.. versionadded:: 2.0.2$nbsp;(Plugin)
Sourcepub async fn set_gui_tab_icon(
&mut self,
index: u8,
icon: &[bool; 168],
) -> Result<(), TinkerforgeError>
pub async fn set_gui_tab_icon( &mut self, index: u8, icon: &[bool; 168], ) -> Result<(), TinkerforgeError>
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)
Sourcepub async fn get_gui_tab_icon(
&mut self,
index: u8,
) -> Result<GuiTabIcon, TinkerforgeError>
pub async fn get_gui_tab_icon( &mut self, index: u8, ) -> Result<GuiTabIcon, TinkerforgeError>
Returns the icon for a given index as set by [set_gui_tab_icon
].
Additionally the Active
parameter shows if the tab is currently active/visible
or not.
.. versionadded:: 2.0.2$nbsp;(Plugin)
Sourcepub async fn remove_gui_tab(
&mut self,
index: u8,
) -> Result<(), TinkerforgeError>
pub async fn remove_gui_tab( &mut self, index: u8, ) -> Result<(), TinkerforgeError>
Removes the tab with the given index.
You can use index 255 to remove all tabs.
.. versionadded:: 2.0.2$nbsp;(Plugin)
Sourcepub async fn set_gui_tab_selected(
&mut self,
index: u8,
) -> Result<(), TinkerforgeError>
pub async fn set_gui_tab_selected( &mut self, index: u8, ) -> Result<(), TinkerforgeError>
Sets the tab with the given index as selected (drawn as selected on the display).
.. versionadded:: 2.0.2$nbsp;(Plugin)
Sourcepub async fn set_gui_tab_selected_callback_configuration(
&mut self,
period: u32,
value_has_to_change: bool,
) -> Result<(), TinkerforgeError>
pub async fn set_gui_tab_selected_callback_configuration( &mut self, period: u32, value_has_to_change: bool, ) -> Result<(), TinkerforgeError>
The period is the period with which the [get_gui_tab_selected_callback_receiver
] receiver
is triggered periodically. A value of 0 turns the receiver off.
If the value has to change
-parameter is set to true, the receiver is only
triggered after the value has changed. If the value didn’t change within the
period, the receiver is triggered immediately on change.
If it is set to false, the receiver is continuously triggered with the period, independent of the value.
.. versionadded:: 2.0.2$nbsp;(Plugin)
Sourcepub async fn get_gui_tab_selected_callback_configuration(
&mut self,
) -> Result<GuiTabSelectedCallbackConfiguration, TinkerforgeError>
pub async fn get_gui_tab_selected_callback_configuration( &mut self, ) -> Result<GuiTabSelectedCallbackConfiguration, TinkerforgeError>
Returns the receiver configuration as set by
[set_gui_tab_selected_callback_configuration
].
.. versionadded:: 2.0.2$nbsp;(Plugin)
Sourcepub async fn get_gui_tab_selected(&mut self) -> Result<i8, TinkerforgeError>
pub async fn get_gui_tab_selected(&mut self) -> Result<i8, TinkerforgeError>
Returns the index of the currently selected tab. If there are not tabs, the returned index is -1.
.. versionadded:: 2.0.2$nbsp;(Plugin)
Sourcepub async fn set_gui_graph_configuration(
&mut self,
index: u8,
graph_type: u8,
position_x: u8,
position_y: u8,
width: u8,
height: u8,
text_x: String,
text_y: String,
) -> Result<(), TinkerforgeError>
pub async fn set_gui_graph_configuration( &mut self, index: u8, graph_type: u8, position_x: u8, position_y: u8, width: u8, height: u8, text_x: String, text_y: String, ) -> Result<(), TinkerforgeError>
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 [draw_text
] to draw the caption
outside of the graph.
The data of the graph can be set and updated with [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 [write_pixels
]. To
remove the graph use [remove_gui_graph
].
.. versionadded:: 2.0.2$nbsp;(Plugin)
Associated constants:
- LCD_128X64_BRICKLET_GRAPH_TYPE_DOT
- LCD_128X64_BRICKLET_GRAPH_TYPE_LINE
- LCD_128X64_BRICKLET_GRAPH_TYPE_BAR
Sourcepub async fn get_gui_graph_configuration(
&mut self,
index: u8,
) -> Result<GuiGraphConfiguration, TinkerforgeError>
pub async fn get_gui_graph_configuration( &mut self, index: u8, ) -> Result<GuiGraphConfiguration, TinkerforgeError>
Returns the graph properties for a given Index
as set by [set_gui_graph_configuration
].
Additionally the Active
parameter shows if a graph is currently active/visible
or not.
.. versionadded:: 2.0.2$nbsp;(Plugin)
Associated constants:
- LCD_128X64_BRICKLET_GRAPH_TYPE_DOT
- LCD_128X64_BRICKLET_GRAPH_TYPE_LINE
- LCD_128X64_BRICKLET_GRAPH_TYPE_BAR
Sourcepub async fn set_gui_graph_data_low_level(
&mut self,
index: u8,
data_length: u16,
data_chunk_offset: u16,
data_chunk_data: &[u8; 59],
) -> Result<SetGuiGraphDataLowLevel, TinkerforgeError>
pub async fn set_gui_graph_data_low_level( &mut self, index: u8, data_length: u16, data_chunk_offset: u16, data_chunk_data: &[u8; 59], ) -> Result<SetGuiGraphDataLowLevel, TinkerforgeError>
Sets the data for a graph with the given index. You have to configure the graph with
[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 [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)
Sourcepub async fn get_gui_graph_data_low_level(
&mut self,
index: u8,
) -> Result<GuiGraphDataLowLevel, TinkerforgeError>
pub async fn get_gui_graph_data_low_level( &mut self, index: u8, ) -> Result<GuiGraphDataLowLevel, TinkerforgeError>
Returns the graph data for a given index as set by [set_gui_graph_data
].
.. versionadded:: 2.0.2$nbsp;(Plugin)
Sourcepub async fn remove_gui_graph(
&mut self,
index: u8,
) -> Result<(), TinkerforgeError>
pub async fn remove_gui_graph( &mut self, index: u8, ) -> Result<(), TinkerforgeError>
Removes the graph with the given index.
You can use index 255 to remove all graphs.
.. versionadded:: 2.0.2$nbsp;(Plugin)
Sourcepub async fn remove_all_gui(&mut self) -> Result<(), TinkerforgeError>
pub async fn remove_all_gui(&mut self) -> Result<(), TinkerforgeError>
Removes all GUI elements (buttons, slider, graphs, tabs).
.. versionadded:: 2.0.2$nbsp;(Plugin)
Sourcepub async fn set_touch_led_config(
&mut self,
config: u8,
) -> Result<(), TinkerforgeError>
pub async fn set_touch_led_config( &mut self, config: u8, ) -> Result<(), TinkerforgeError>
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:
- LCD_128X64_BRICKLET_TOUCH_LED_CONFIG_OFF
- LCD_128X64_BRICKLET_TOUCH_LED_CONFIG_ON
- LCD_128X64_BRICKLET_TOUCH_LED_CONFIG_SHOW_HEARTBEAT
- LCD_128X64_BRICKLET_TOUCH_LED_CONFIG_SHOW_TOUCH
Sourcepub async fn get_touch_led_config(&mut self) -> Result<u8, TinkerforgeError>
pub async fn get_touch_led_config(&mut self) -> Result<u8, TinkerforgeError>
Returns the configuration as set by [set_touch_led_config
]
.. versionadded:: 2.0.2$nbsp;(Plugin)
Associated constants:
- LCD_128X64_BRICKLET_TOUCH_LED_CONFIG_OFF
- LCD_128X64_BRICKLET_TOUCH_LED_CONFIG_ON
- LCD_128X64_BRICKLET_TOUCH_LED_CONFIG_SHOW_HEARTBEAT
- LCD_128X64_BRICKLET_TOUCH_LED_CONFIG_SHOW_TOUCH
Sourcepub async fn get_spitfp_error_count(
&mut self,
) -> Result<SpitfpErrorCount, TinkerforgeError>
pub async fn get_spitfp_error_count( &mut self, ) -> Result<SpitfpErrorCount, TinkerforgeError>
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.
Sourcepub async fn set_bootloader_mode(
&mut self,
mode: u8,
) -> Result<u8, TinkerforgeError>
pub async fn set_bootloader_mode( &mut self, mode: u8, ) -> Result<u8, TinkerforgeError>
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:
- LCD_128X64_BRICKLET_BOOTLOADER_MODE_BOOTLOADER
- LCD_128X64_BRICKLET_BOOTLOADER_MODE_FIRMWARE
- LCD_128X64_BRICKLET_BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT
- LCD_128X64_BRICKLET_BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT
- LCD_128X64_BRICKLET_BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT
- LCD_128X64_BRICKLET_BOOTLOADER_STATUS_OK
- LCD_128X64_BRICKLET_BOOTLOADER_STATUS_INVALID_MODE
- LCD_128X64_BRICKLET_BOOTLOADER_STATUS_NO_CHANGE
- LCD_128X64_BRICKLET_BOOTLOADER_STATUS_ENTRY_FUNCTION_NOT_PRESENT
- LCD_128X64_BRICKLET_BOOTLOADER_STATUS_DEVICE_IDENTIFIER_INCORRECT
- LCD_128X64_BRICKLET_BOOTLOADER_STATUS_CRC_MISMATCH
Sourcepub async fn get_bootloader_mode(&mut self) -> Result<u8, TinkerforgeError>
pub async fn get_bootloader_mode(&mut self) -> Result<u8, TinkerforgeError>
Returns the current bootloader mode, see [set_bootloader_mode
].
Associated constants:
- LCD_128X64_BRICKLET_BOOTLOADER_MODE_BOOTLOADER
- LCD_128X64_BRICKLET_BOOTLOADER_MODE_FIRMWARE
- LCD_128X64_BRICKLET_BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT
- LCD_128X64_BRICKLET_BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT
- LCD_128X64_BRICKLET_BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT
Sourcepub async fn set_write_firmware_pointer(
&mut self,
pointer: u32,
) -> Result<(), TinkerforgeError>
pub async fn set_write_firmware_pointer( &mut self, pointer: u32, ) -> Result<(), TinkerforgeError>
Sets the firmware pointer for [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.
Sourcepub async fn write_firmware(
&mut self,
data: &[u8; 64],
) -> Result<u8, TinkerforgeError>
pub async fn write_firmware( &mut self, data: &[u8; 64], ) -> Result<u8, TinkerforgeError>
Writes 64 Bytes of firmware at the position as written by
[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.
Sourcepub async fn set_status_led_config(
&mut self,
config: u8,
) -> Result<(), TinkerforgeError>
pub async fn set_status_led_config( &mut self, config: u8, ) -> Result<(), TinkerforgeError>
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:
- LCD_128X64_BRICKLET_STATUS_LED_CONFIG_OFF
- LCD_128X64_BRICKLET_STATUS_LED_CONFIG_ON
- LCD_128X64_BRICKLET_STATUS_LED_CONFIG_SHOW_HEARTBEAT
- LCD_128X64_BRICKLET_STATUS_LED_CONFIG_SHOW_STATUS
Sourcepub async fn get_status_led_config(&mut self) -> Result<u8, TinkerforgeError>
pub async fn get_status_led_config(&mut self) -> Result<u8, TinkerforgeError>
Returns the configuration as set by [set_status_led_config
]
Associated constants:
- LCD_128X64_BRICKLET_STATUS_LED_CONFIG_OFF
- LCD_128X64_BRICKLET_STATUS_LED_CONFIG_ON
- LCD_128X64_BRICKLET_STATUS_LED_CONFIG_SHOW_HEARTBEAT
- LCD_128X64_BRICKLET_STATUS_LED_CONFIG_SHOW_STATUS
Sourcepub async fn get_chip_temperature(&mut self) -> Result<i16, TinkerforgeError>
pub async fn get_chip_temperature(&mut self) -> Result<i16, TinkerforgeError>
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.
Sourcepub async fn reset(&mut self) -> Result<(), TinkerforgeError>
pub async fn reset(&mut self) -> Result<(), TinkerforgeError>
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!
Sourcepub async fn write_uid(&mut self, uid: u32) -> Result<(), TinkerforgeError>
pub async fn write_uid(&mut self, uid: u32) -> Result<(), TinkerforgeError>
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.
Sourcepub async fn read_uid(&mut self) -> Result<u32, TinkerforgeError>
pub async fn read_uid(&mut self) -> Result<u32, TinkerforgeError>
Returns the current UID as an integer. Encode as Base58 to get the usual string version.
Sourcepub async fn get_identity(&mut self) -> Result<Identity, TinkerforgeError>
pub async fn get_identity(&mut self) -> Result<Identity, TinkerforgeError>
Returns the UID, the UID where the Bricklet is connected to, the position, the hardware and firmware version as well as the device identifier.
The position can be ‘a’, ‘b’, ‘c’, ‘d’, ‘e’, ‘f’, ‘g’ or ‘h’ (Bricklet Port). A Bricklet connected to an Isolator Bricklet is always at position ‘z’.
The device identifier numbers can be found here. |device_identifier_constant|
Trait Implementations§
Source§impl Clone for Lcd128x64Bricklet
impl Clone for Lcd128x64Bricklet
Source§fn clone(&self) -> Lcd128x64Bricklet
fn clone(&self) -> Lcd128x64Bricklet
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more