1#[allow(unused_imports)]
15use crate::{
16 base58::Uid,
17 byte_converter::*,
18 converting_receiver::{BrickletError, BrickletRecvTimeoutError},
19 device::*,
20 error::TinkerforgeError,
21 ip_connection::async_io::AsyncIpConnection,
22 low_level_traits::LowLevelRead,
23};
24#[allow(unused_imports)]
25use futures_core::Stream;
26#[allow(unused_imports)]
27use tokio_stream::StreamExt;
28pub enum Lcd128x64BrickletFunction {
29 WritePixelsLowLevel,
30 ReadPixelsLowLevel,
31 ClearDisplay,
32 SetDisplayConfiguration,
33 GetDisplayConfiguration,
34 WriteLine,
35 DrawBufferedFrame,
36 GetTouchPosition,
37 SetTouchPositionCallbackConfiguration,
38 GetTouchPositionCallbackConfiguration,
39 GetTouchGesture,
40 SetTouchGestureCallbackConfiguration,
41 GetTouchGestureCallbackConfiguration,
42 DrawLine,
43 DrawBox,
44 DrawText,
45 SetGuiButton,
46 GetGuiButton,
47 RemoveGuiButton,
48 SetGuiButtonPressedCallbackConfiguration,
49 GetGuiButtonPressedCallbackConfiguration,
50 GetGuiButtonPressed,
51 SetGuiSlider,
52 GetGuiSlider,
53 RemoveGuiSlider,
54 SetGuiSliderValueCallbackConfiguration,
55 GetGuiSliderValueCallbackConfiguration,
56 GetGuiSliderValue,
57 SetGuiTabConfiguration,
58 GetGuiTabConfiguration,
59 SetGuiTabText,
60 GetGuiTabText,
61 SetGuiTabIcon,
62 GetGuiTabIcon,
63 RemoveGuiTab,
64 SetGuiTabSelected,
65 SetGuiTabSelectedCallbackConfiguration,
66 GetGuiTabSelectedCallbackConfiguration,
67 GetGuiTabSelected,
68 SetGuiGraphConfiguration,
69 GetGuiGraphConfiguration,
70 SetGuiGraphDataLowLevel,
71 GetGuiGraphDataLowLevel,
72 RemoveGuiGraph,
73 RemoveAllGui,
74 SetTouchLedConfig,
75 GetTouchLedConfig,
76 GetSpitfpErrorCount,
77 SetBootloaderMode,
78 GetBootloaderMode,
79 SetWriteFirmwarePointer,
80 WriteFirmware,
81 SetStatusLedConfig,
82 GetStatusLedConfig,
83 GetChipTemperature,
84 Reset,
85 WriteUid,
86 ReadUid,
87 GetIdentity,
88 CallbackTouchPosition,
89 CallbackTouchGesture,
90 CallbackGuiButtonPressed,
91 CallbackGuiSliderValue,
92 CallbackGuiTabSelected,
93}
94impl From<Lcd128x64BrickletFunction> for u8 {
95 fn from(fun: Lcd128x64BrickletFunction) -> Self {
96 match fun {
97 Lcd128x64BrickletFunction::WritePixelsLowLevel => 1,
98 Lcd128x64BrickletFunction::ReadPixelsLowLevel => 2,
99 Lcd128x64BrickletFunction::ClearDisplay => 3,
100 Lcd128x64BrickletFunction::SetDisplayConfiguration => 4,
101 Lcd128x64BrickletFunction::GetDisplayConfiguration => 5,
102 Lcd128x64BrickletFunction::WriteLine => 6,
103 Lcd128x64BrickletFunction::DrawBufferedFrame => 7,
104 Lcd128x64BrickletFunction::GetTouchPosition => 8,
105 Lcd128x64BrickletFunction::SetTouchPositionCallbackConfiguration => 9,
106 Lcd128x64BrickletFunction::GetTouchPositionCallbackConfiguration => 10,
107 Lcd128x64BrickletFunction::GetTouchGesture => 12,
108 Lcd128x64BrickletFunction::SetTouchGestureCallbackConfiguration => 13,
109 Lcd128x64BrickletFunction::GetTouchGestureCallbackConfiguration => 14,
110 Lcd128x64BrickletFunction::DrawLine => 16,
111 Lcd128x64BrickletFunction::DrawBox => 17,
112 Lcd128x64BrickletFunction::DrawText => 18,
113 Lcd128x64BrickletFunction::SetGuiButton => 19,
114 Lcd128x64BrickletFunction::GetGuiButton => 20,
115 Lcd128x64BrickletFunction::RemoveGuiButton => 21,
116 Lcd128x64BrickletFunction::SetGuiButtonPressedCallbackConfiguration => 22,
117 Lcd128x64BrickletFunction::GetGuiButtonPressedCallbackConfiguration => 23,
118 Lcd128x64BrickletFunction::GetGuiButtonPressed => 24,
119 Lcd128x64BrickletFunction::SetGuiSlider => 26,
120 Lcd128x64BrickletFunction::GetGuiSlider => 27,
121 Lcd128x64BrickletFunction::RemoveGuiSlider => 28,
122 Lcd128x64BrickletFunction::SetGuiSliderValueCallbackConfiguration => 29,
123 Lcd128x64BrickletFunction::GetGuiSliderValueCallbackConfiguration => 30,
124 Lcd128x64BrickletFunction::GetGuiSliderValue => 31,
125 Lcd128x64BrickletFunction::SetGuiTabConfiguration => 33,
126 Lcd128x64BrickletFunction::GetGuiTabConfiguration => 34,
127 Lcd128x64BrickletFunction::SetGuiTabText => 35,
128 Lcd128x64BrickletFunction::GetGuiTabText => 36,
129 Lcd128x64BrickletFunction::SetGuiTabIcon => 37,
130 Lcd128x64BrickletFunction::GetGuiTabIcon => 38,
131 Lcd128x64BrickletFunction::RemoveGuiTab => 39,
132 Lcd128x64BrickletFunction::SetGuiTabSelected => 40,
133 Lcd128x64BrickletFunction::SetGuiTabSelectedCallbackConfiguration => 41,
134 Lcd128x64BrickletFunction::GetGuiTabSelectedCallbackConfiguration => 42,
135 Lcd128x64BrickletFunction::GetGuiTabSelected => 43,
136 Lcd128x64BrickletFunction::SetGuiGraphConfiguration => 45,
137 Lcd128x64BrickletFunction::GetGuiGraphConfiguration => 46,
138 Lcd128x64BrickletFunction::SetGuiGraphDataLowLevel => 47,
139 Lcd128x64BrickletFunction::GetGuiGraphDataLowLevel => 48,
140 Lcd128x64BrickletFunction::RemoveGuiGraph => 49,
141 Lcd128x64BrickletFunction::RemoveAllGui => 50,
142 Lcd128x64BrickletFunction::SetTouchLedConfig => 51,
143 Lcd128x64BrickletFunction::GetTouchLedConfig => 52,
144 Lcd128x64BrickletFunction::GetSpitfpErrorCount => 234,
145 Lcd128x64BrickletFunction::SetBootloaderMode => 235,
146 Lcd128x64BrickletFunction::GetBootloaderMode => 236,
147 Lcd128x64BrickletFunction::SetWriteFirmwarePointer => 237,
148 Lcd128x64BrickletFunction::WriteFirmware => 238,
149 Lcd128x64BrickletFunction::SetStatusLedConfig => 239,
150 Lcd128x64BrickletFunction::GetStatusLedConfig => 240,
151 Lcd128x64BrickletFunction::GetChipTemperature => 242,
152 Lcd128x64BrickletFunction::Reset => 243,
153 Lcd128x64BrickletFunction::WriteUid => 248,
154 Lcd128x64BrickletFunction::ReadUid => 249,
155 Lcd128x64BrickletFunction::GetIdentity => 255,
156 Lcd128x64BrickletFunction::CallbackTouchPosition => 11,
157 Lcd128x64BrickletFunction::CallbackTouchGesture => 15,
158 Lcd128x64BrickletFunction::CallbackGuiButtonPressed => 25,
159 Lcd128x64BrickletFunction::CallbackGuiSliderValue => 32,
160 Lcd128x64BrickletFunction::CallbackGuiTabSelected => 44,
161 }
162 }
163}
164pub const LCD_128X64_BRICKLET_GESTURE_LEFT_TO_RIGHT: u8 = 0;
165pub const LCD_128X64_BRICKLET_GESTURE_RIGHT_TO_LEFT: u8 = 1;
166pub const LCD_128X64_BRICKLET_GESTURE_TOP_TO_BOTTOM: u8 = 2;
167pub const LCD_128X64_BRICKLET_GESTURE_BOTTOM_TO_TOP: u8 = 3;
168pub const LCD_128X64_BRICKLET_COLOR_WHITE: bool = false;
169pub const LCD_128X64_BRICKLET_COLOR_BLACK: bool = true;
170pub const LCD_128X64_BRICKLET_FONT_6X8: u8 = 0;
171pub const LCD_128X64_BRICKLET_FONT_6X16: u8 = 1;
172pub const LCD_128X64_BRICKLET_FONT_6X24: u8 = 2;
173pub const LCD_128X64_BRICKLET_FONT_6X32: u8 = 3;
174pub const LCD_128X64_BRICKLET_FONT_12X16: u8 = 4;
175pub const LCD_128X64_BRICKLET_FONT_12X24: u8 = 5;
176pub const LCD_128X64_BRICKLET_FONT_12X32: u8 = 6;
177pub const LCD_128X64_BRICKLET_FONT_18X24: u8 = 7;
178pub const LCD_128X64_BRICKLET_FONT_18X32: u8 = 8;
179pub const LCD_128X64_BRICKLET_FONT_24X32: u8 = 9;
180pub const LCD_128X64_BRICKLET_DIRECTION_HORIZONTAL: u8 = 0;
181pub const LCD_128X64_BRICKLET_DIRECTION_VERTICAL: u8 = 1;
182pub const LCD_128X64_BRICKLET_CHANGE_TAB_ON_CLICK: u8 = 1;
183pub const LCD_128X64_BRICKLET_CHANGE_TAB_ON_SWIPE: u8 = 2;
184pub const LCD_128X64_BRICKLET_CHANGE_TAB_ON_CLICK_AND_SWIPE: u8 = 3;
185pub const LCD_128X64_BRICKLET_GRAPH_TYPE_DOT: u8 = 0;
186pub const LCD_128X64_BRICKLET_GRAPH_TYPE_LINE: u8 = 1;
187pub const LCD_128X64_BRICKLET_GRAPH_TYPE_BAR: u8 = 2;
188pub const LCD_128X64_BRICKLET_TOUCH_LED_CONFIG_OFF: u8 = 0;
189pub const LCD_128X64_BRICKLET_TOUCH_LED_CONFIG_ON: u8 = 1;
190pub const LCD_128X64_BRICKLET_TOUCH_LED_CONFIG_SHOW_HEARTBEAT: u8 = 2;
191pub const LCD_128X64_BRICKLET_TOUCH_LED_CONFIG_SHOW_TOUCH: u8 = 3;
192pub const LCD_128X64_BRICKLET_BOOTLOADER_MODE_BOOTLOADER: u8 = 0;
193pub const LCD_128X64_BRICKLET_BOOTLOADER_MODE_FIRMWARE: u8 = 1;
194pub const LCD_128X64_BRICKLET_BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT: u8 = 2;
195pub const LCD_128X64_BRICKLET_BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT: u8 = 3;
196pub const LCD_128X64_BRICKLET_BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT: u8 = 4;
197pub const LCD_128X64_BRICKLET_BOOTLOADER_STATUS_OK: u8 = 0;
198pub const LCD_128X64_BRICKLET_BOOTLOADER_STATUS_INVALID_MODE: u8 = 1;
199pub const LCD_128X64_BRICKLET_BOOTLOADER_STATUS_NO_CHANGE: u8 = 2;
200pub const LCD_128X64_BRICKLET_BOOTLOADER_STATUS_ENTRY_FUNCTION_NOT_PRESENT: u8 = 3;
201pub const LCD_128X64_BRICKLET_BOOTLOADER_STATUS_DEVICE_IDENTIFIER_INCORRECT: u8 = 4;
202pub const LCD_128X64_BRICKLET_BOOTLOADER_STATUS_CRC_MISMATCH: u8 = 5;
203pub const LCD_128X64_BRICKLET_STATUS_LED_CONFIG_OFF: u8 = 0;
204pub const LCD_128X64_BRICKLET_STATUS_LED_CONFIG_ON: u8 = 1;
205pub const LCD_128X64_BRICKLET_STATUS_LED_CONFIG_SHOW_HEARTBEAT: u8 = 2;
206pub const LCD_128X64_BRICKLET_STATUS_LED_CONFIG_SHOW_STATUS: u8 = 3;
207
208#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
209pub struct WritePixelsLowLevel {}
210impl FromByteSlice for WritePixelsLowLevel {
211 fn bytes_expected() -> usize {
212 0
213 }
214 fn from_le_byte_slice(_bytes: &[u8]) -> WritePixelsLowLevel {
215 WritePixelsLowLevel {}
216 }
217}
218
219#[derive(Clone, Copy)]
220pub struct ReadPixelsLowLevel {
221 pub pixels_length: u16,
222 pub pixels_chunk_offset: u16,
223 pub pixels_chunk_data: [bool; 480],
224}
225impl FromByteSlice for ReadPixelsLowLevel {
226 fn bytes_expected() -> usize {
227 64
228 }
229 fn from_le_byte_slice(bytes: &[u8]) -> ReadPixelsLowLevel {
230 ReadPixelsLowLevel {
231 pixels_length: <u16>::from_le_byte_slice(&bytes[0..2]),
232 pixels_chunk_offset: <u16>::from_le_byte_slice(&bytes[2..4]),
233 pixels_chunk_data: <[bool; 480]>::from_le_byte_slice(&bytes[4..64]),
234 }
235 }
236}
237impl LowLevelRead<bool, ReadPixelsResult> for ReadPixelsLowLevel {
238 fn ll_message_length(&self) -> usize {
239 self.pixels_length as usize
240 }
241
242 fn ll_message_chunk_offset(&self) -> usize {
243 self.pixels_chunk_offset as usize
244 }
245
246 fn ll_message_chunk_data(&self) -> &[bool] {
247 &self.pixels_chunk_data
248 }
249
250 fn get_result(&self) -> ReadPixelsResult {
251 ReadPixelsResult {}
252 }
253}
254
255#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
256pub struct DisplayConfiguration {
257 pub contrast: u8,
258 pub backlight: u8,
259 pub invert: bool,
260 pub automatic_draw: bool,
261}
262impl FromByteSlice for DisplayConfiguration {
263 fn bytes_expected() -> usize {
264 4
265 }
266 fn from_le_byte_slice(bytes: &[u8]) -> DisplayConfiguration {
267 DisplayConfiguration {
268 contrast: <u8>::from_le_byte_slice(&bytes[0..1]),
269 backlight: <u8>::from_le_byte_slice(&bytes[1..2]),
270 invert: <bool>::from_le_byte_slice(&bytes[2..3]),
271 automatic_draw: <bool>::from_le_byte_slice(&bytes[3..4]),
272 }
273 }
274}
275
276#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
277pub struct TouchPosition {
278 pub pressure: u16,
279 pub x: u16,
280 pub y: u16,
281 pub age: u32,
282}
283impl FromByteSlice for TouchPosition {
284 fn bytes_expected() -> usize {
285 10
286 }
287 fn from_le_byte_slice(bytes: &[u8]) -> TouchPosition {
288 TouchPosition {
289 pressure: <u16>::from_le_byte_slice(&bytes[0..2]),
290 x: <u16>::from_le_byte_slice(&bytes[2..4]),
291 y: <u16>::from_le_byte_slice(&bytes[4..6]),
292 age: <u32>::from_le_byte_slice(&bytes[6..10]),
293 }
294 }
295}
296
297#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
298pub struct TouchPositionCallbackConfiguration {
299 pub period: u32,
300 pub value_has_to_change: bool,
301}
302impl FromByteSlice for TouchPositionCallbackConfiguration {
303 fn bytes_expected() -> usize {
304 5
305 }
306 fn from_le_byte_slice(bytes: &[u8]) -> TouchPositionCallbackConfiguration {
307 TouchPositionCallbackConfiguration {
308 period: <u32>::from_le_byte_slice(&bytes[0..4]),
309 value_has_to_change: <bool>::from_le_byte_slice(&bytes[4..5]),
310 }
311 }
312}
313
314#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
315pub struct TouchPositionEvent {
316 pub pressure: u16,
317 pub x: u16,
318 pub y: u16,
319 pub age: u32,
320}
321impl FromByteSlice for TouchPositionEvent {
322 fn bytes_expected() -> usize {
323 10
324 }
325 fn from_le_byte_slice(bytes: &[u8]) -> TouchPositionEvent {
326 TouchPositionEvent {
327 pressure: <u16>::from_le_byte_slice(&bytes[0..2]),
328 x: <u16>::from_le_byte_slice(&bytes[2..4]),
329 y: <u16>::from_le_byte_slice(&bytes[4..6]),
330 age: <u32>::from_le_byte_slice(&bytes[6..10]),
331 }
332 }
333}
334
335#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
336pub struct TouchGesture {
337 pub gesture: u8,
338 pub duration: u32,
339 pub pressure_max: u16,
340 pub x_start: u16,
341 pub y_start: u16,
342 pub x_end: u16,
343 pub y_end: u16,
344 pub age: u32,
345}
346impl FromByteSlice for TouchGesture {
347 fn bytes_expected() -> usize {
348 19
349 }
350 fn from_le_byte_slice(bytes: &[u8]) -> TouchGesture {
351 TouchGesture {
352 gesture: <u8>::from_le_byte_slice(&bytes[0..1]),
353 duration: <u32>::from_le_byte_slice(&bytes[1..5]),
354 pressure_max: <u16>::from_le_byte_slice(&bytes[5..7]),
355 x_start: <u16>::from_le_byte_slice(&bytes[7..9]),
356 y_start: <u16>::from_le_byte_slice(&bytes[9..11]),
357 x_end: <u16>::from_le_byte_slice(&bytes[11..13]),
358 y_end: <u16>::from_le_byte_slice(&bytes[13..15]),
359 age: <u32>::from_le_byte_slice(&bytes[15..19]),
360 }
361 }
362}
363
364#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
365pub struct TouchGestureCallbackConfiguration {
366 pub period: u32,
367 pub value_has_to_change: bool,
368}
369impl FromByteSlice for TouchGestureCallbackConfiguration {
370 fn bytes_expected() -> usize {
371 5
372 }
373 fn from_le_byte_slice(bytes: &[u8]) -> TouchGestureCallbackConfiguration {
374 TouchGestureCallbackConfiguration {
375 period: <u32>::from_le_byte_slice(&bytes[0..4]),
376 value_has_to_change: <bool>::from_le_byte_slice(&bytes[4..5]),
377 }
378 }
379}
380
381#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
382pub struct TouchGestureEvent {
383 pub gesture: u8,
384 pub duration: u32,
385 pub pressure_max: u16,
386 pub x_start: u16,
387 pub y_start: u16,
388 pub x_end: u16,
389 pub y_end: u16,
390 pub age: u32,
391}
392impl FromByteSlice for TouchGestureEvent {
393 fn bytes_expected() -> usize {
394 19
395 }
396 fn from_le_byte_slice(bytes: &[u8]) -> TouchGestureEvent {
397 TouchGestureEvent {
398 gesture: <u8>::from_le_byte_slice(&bytes[0..1]),
399 duration: <u32>::from_le_byte_slice(&bytes[1..5]),
400 pressure_max: <u16>::from_le_byte_slice(&bytes[5..7]),
401 x_start: <u16>::from_le_byte_slice(&bytes[7..9]),
402 y_start: <u16>::from_le_byte_slice(&bytes[9..11]),
403 x_end: <u16>::from_le_byte_slice(&bytes[11..13]),
404 y_end: <u16>::from_le_byte_slice(&bytes[13..15]),
405 age: <u32>::from_le_byte_slice(&bytes[15..19]),
406 }
407 }
408}
409
410#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
411pub struct GuiButton {
412 pub active: bool,
413 pub position_x: u8,
414 pub position_y: u8,
415 pub width: u8,
416 pub height: u8,
417 pub text: String,
418}
419impl FromByteSlice for GuiButton {
420 fn bytes_expected() -> usize {
421 21
422 }
423 fn from_le_byte_slice(bytes: &[u8]) -> GuiButton {
424 GuiButton {
425 active: <bool>::from_le_byte_slice(&bytes[0..1]),
426 position_x: <u8>::from_le_byte_slice(&bytes[1..2]),
427 position_y: <u8>::from_le_byte_slice(&bytes[2..3]),
428 width: <u8>::from_le_byte_slice(&bytes[3..4]),
429 height: <u8>::from_le_byte_slice(&bytes[4..5]),
430 text: <String>::from_le_byte_slice(&bytes[5..21]),
431 }
432 }
433}
434
435#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
436pub struct GuiButtonPressedCallbackConfiguration {
437 pub period: u32,
438 pub value_has_to_change: bool,
439}
440impl FromByteSlice for GuiButtonPressedCallbackConfiguration {
441 fn bytes_expected() -> usize {
442 5
443 }
444 fn from_le_byte_slice(bytes: &[u8]) -> GuiButtonPressedCallbackConfiguration {
445 GuiButtonPressedCallbackConfiguration {
446 period: <u32>::from_le_byte_slice(&bytes[0..4]),
447 value_has_to_change: <bool>::from_le_byte_slice(&bytes[4..5]),
448 }
449 }
450}
451
452#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
453pub struct GuiButtonPressedEvent {
454 pub index: u8,
455 pub pressed: bool,
456}
457impl FromByteSlice for GuiButtonPressedEvent {
458 fn bytes_expected() -> usize {
459 2
460 }
461 fn from_le_byte_slice(bytes: &[u8]) -> GuiButtonPressedEvent {
462 GuiButtonPressedEvent { index: <u8>::from_le_byte_slice(&bytes[0..1]), pressed: <bool>::from_le_byte_slice(&bytes[1..2]) }
463 }
464}
465
466#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
467pub struct GuiSlider {
468 pub active: bool,
469 pub position_x: u8,
470 pub position_y: u8,
471 pub length: u8,
472 pub direction: u8,
473 pub value: u8,
474}
475impl FromByteSlice for GuiSlider {
476 fn bytes_expected() -> usize {
477 6
478 }
479 fn from_le_byte_slice(bytes: &[u8]) -> GuiSlider {
480 GuiSlider {
481 active: <bool>::from_le_byte_slice(&bytes[0..1]),
482 position_x: <u8>::from_le_byte_slice(&bytes[1..2]),
483 position_y: <u8>::from_le_byte_slice(&bytes[2..3]),
484 length: <u8>::from_le_byte_slice(&bytes[3..4]),
485 direction: <u8>::from_le_byte_slice(&bytes[4..5]),
486 value: <u8>::from_le_byte_slice(&bytes[5..6]),
487 }
488 }
489}
490
491#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
492pub struct GuiSliderValueCallbackConfiguration {
493 pub period: u32,
494 pub value_has_to_change: bool,
495}
496impl FromByteSlice for GuiSliderValueCallbackConfiguration {
497 fn bytes_expected() -> usize {
498 5
499 }
500 fn from_le_byte_slice(bytes: &[u8]) -> GuiSliderValueCallbackConfiguration {
501 GuiSliderValueCallbackConfiguration {
502 period: <u32>::from_le_byte_slice(&bytes[0..4]),
503 value_has_to_change: <bool>::from_le_byte_slice(&bytes[4..5]),
504 }
505 }
506}
507
508#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
509pub struct GuiSliderValueEvent {
510 pub index: u8,
511 pub value: u8,
512}
513impl FromByteSlice for GuiSliderValueEvent {
514 fn bytes_expected() -> usize {
515 2
516 }
517 fn from_le_byte_slice(bytes: &[u8]) -> GuiSliderValueEvent {
518 GuiSliderValueEvent { index: <u8>::from_le_byte_slice(&bytes[0..1]), value: <u8>::from_le_byte_slice(&bytes[1..2]) }
519 }
520}
521
522#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
523pub struct GuiTabConfiguration {
524 pub change_tab_config: u8,
525 pub clear_gui: bool,
526}
527impl FromByteSlice for GuiTabConfiguration {
528 fn bytes_expected() -> usize {
529 2
530 }
531 fn from_le_byte_slice(bytes: &[u8]) -> GuiTabConfiguration {
532 GuiTabConfiguration {
533 change_tab_config: <u8>::from_le_byte_slice(&bytes[0..1]),
534 clear_gui: <bool>::from_le_byte_slice(&bytes[1..2]),
535 }
536 }
537}
538
539#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
540pub struct GuiTabText {
541 pub active: bool,
542 pub text: String,
543}
544impl FromByteSlice for GuiTabText {
545 fn bytes_expected() -> usize {
546 6
547 }
548 fn from_le_byte_slice(bytes: &[u8]) -> GuiTabText {
549 GuiTabText { active: <bool>::from_le_byte_slice(&bytes[0..1]), text: <String>::from_le_byte_slice(&bytes[1..6]) }
550 }
551}
552
553#[derive(Clone, Copy)]
554pub struct GuiTabIcon {
555 pub active: bool,
556 pub icon: [bool; 168],
557}
558impl FromByteSlice for GuiTabIcon {
559 fn bytes_expected() -> usize {
560 22
561 }
562 fn from_le_byte_slice(bytes: &[u8]) -> GuiTabIcon {
563 GuiTabIcon { active: <bool>::from_le_byte_slice(&bytes[0..1]), icon: <[bool; 168]>::from_le_byte_slice(&bytes[1..22]) }
564 }
565}
566
567#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
568pub struct GuiTabSelectedCallbackConfiguration {
569 pub period: u32,
570 pub value_has_to_change: bool,
571}
572impl FromByteSlice for GuiTabSelectedCallbackConfiguration {
573 fn bytes_expected() -> usize {
574 5
575 }
576 fn from_le_byte_slice(bytes: &[u8]) -> GuiTabSelectedCallbackConfiguration {
577 GuiTabSelectedCallbackConfiguration {
578 period: <u32>::from_le_byte_slice(&bytes[0..4]),
579 value_has_to_change: <bool>::from_le_byte_slice(&bytes[4..5]),
580 }
581 }
582}
583
584#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
585pub struct GuiGraphConfiguration {
586 pub active: bool,
587 pub graph_type: u8,
588 pub position_x: u8,
589 pub position_y: u8,
590 pub width: u8,
591 pub height: u8,
592 pub text_x: String,
593 pub text_y: String,
594}
595impl FromByteSlice for GuiGraphConfiguration {
596 fn bytes_expected() -> usize {
597 14
598 }
599 fn from_le_byte_slice(bytes: &[u8]) -> GuiGraphConfiguration {
600 GuiGraphConfiguration {
601 active: <bool>::from_le_byte_slice(&bytes[0..1]),
602 graph_type: <u8>::from_le_byte_slice(&bytes[1..2]),
603 position_x: <u8>::from_le_byte_slice(&bytes[2..3]),
604 position_y: <u8>::from_le_byte_slice(&bytes[3..4]),
605 width: <u8>::from_le_byte_slice(&bytes[4..5]),
606 height: <u8>::from_le_byte_slice(&bytes[5..6]),
607 text_x: <String>::from_le_byte_slice(&bytes[6..10]),
608 text_y: <String>::from_le_byte_slice(&bytes[10..14]),
609 }
610 }
611}
612
613#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
614pub struct SetGuiGraphDataLowLevel {}
615impl FromByteSlice for SetGuiGraphDataLowLevel {
616 fn bytes_expected() -> usize {
617 0
618 }
619 fn from_le_byte_slice(_bytes: &[u8]) -> SetGuiGraphDataLowLevel {
620 SetGuiGraphDataLowLevel {}
621 }
622}
623
624#[derive(Clone, Copy)]
625pub struct GuiGraphDataLowLevel {
626 pub data_length: u16,
627 pub data_chunk_offset: u16,
628 pub data_chunk_data: [u8; 59],
629}
630impl FromByteSlice for GuiGraphDataLowLevel {
631 fn bytes_expected() -> usize {
632 63
633 }
634 fn from_le_byte_slice(bytes: &[u8]) -> GuiGraphDataLowLevel {
635 GuiGraphDataLowLevel {
636 data_length: <u16>::from_le_byte_slice(&bytes[0..2]),
637 data_chunk_offset: <u16>::from_le_byte_slice(&bytes[2..4]),
638 data_chunk_data: <[u8; 59]>::from_le_byte_slice(&bytes[4..63]),
639 }
640 }
641}
642impl LowLevelRead<u8, GuiGraphDataResult> for GuiGraphDataLowLevel {
643 fn ll_message_length(&self) -> usize {
644 self.data_length as usize
645 }
646
647 fn ll_message_chunk_offset(&self) -> usize {
648 self.data_chunk_offset as usize
649 }
650
651 fn ll_message_chunk_data(&self) -> &[u8] {
652 &self.data_chunk_data
653 }
654
655 fn get_result(&self) -> GuiGraphDataResult {
656 GuiGraphDataResult {}
657 }
658}
659
660#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
661pub struct SpitfpErrorCount {
662 pub error_count_ack_checksum: u32,
663 pub error_count_message_checksum: u32,
664 pub error_count_frame: u32,
665 pub error_count_overflow: u32,
666}
667impl FromByteSlice for SpitfpErrorCount {
668 fn bytes_expected() -> usize {
669 16
670 }
671 fn from_le_byte_slice(bytes: &[u8]) -> SpitfpErrorCount {
672 SpitfpErrorCount {
673 error_count_ack_checksum: <u32>::from_le_byte_slice(&bytes[0..4]),
674 error_count_message_checksum: <u32>::from_le_byte_slice(&bytes[4..8]),
675 error_count_frame: <u32>::from_le_byte_slice(&bytes[8..12]),
676 error_count_overflow: <u32>::from_le_byte_slice(&bytes[12..16]),
677 }
678 }
679}
680
681#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
682pub struct Identity {
683 pub uid: String,
684 pub connected_uid: String,
685 pub position: char,
686 pub hardware_version: [u8; 3],
687 pub firmware_version: [u8; 3],
688 pub device_identifier: u16,
689}
690impl FromByteSlice for Identity {
691 fn bytes_expected() -> usize {
692 25
693 }
694 fn from_le_byte_slice(bytes: &[u8]) -> Identity {
695 Identity {
696 uid: <String>::from_le_byte_slice(&bytes[0..8]),
697 connected_uid: <String>::from_le_byte_slice(&bytes[8..16]),
698 position: <char>::from_le_byte_slice(&bytes[16..17]),
699 hardware_version: <[u8; 3]>::from_le_byte_slice(&bytes[17..20]),
700 firmware_version: <[u8; 3]>::from_le_byte_slice(&bytes[20..23]),
701 device_identifier: <u16>::from_le_byte_slice(&bytes[23..25]),
702 }
703 }
704}
705
706#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
707pub struct WritePixelsResult {}
708
709#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
710pub struct ReadPixelsResult {}
711
712#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
713pub struct SetGuiGraphDataResult {}
714
715#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
716pub struct GuiGraphDataResult {}
717
718#[derive(Clone)]
720pub struct Lcd128x64Bricklet {
721 device: Device,
722}
723impl Lcd128x64Bricklet {
724 pub const DEVICE_IDENTIFIER: u16 = 298;
725 pub const DEVICE_DISPLAY_NAME: &'static str = "LCD 128x64 Bricklet";
726 pub fn new(uid: Uid, connection: AsyncIpConnection) -> Lcd128x64Bricklet {
728 let mut result = Lcd128x64Bricklet { device: Device::new([2, 0, 10], uid, connection, Self::DEVICE_DISPLAY_NAME) };
729 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::WritePixelsLowLevel) as usize] = ResponseExpectedFlag::True;
730 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::ReadPixelsLowLevel) as usize] =
731 ResponseExpectedFlag::AlwaysTrue;
732 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::ClearDisplay) as usize] = ResponseExpectedFlag::False;
733 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::SetDisplayConfiguration) as usize] =
734 ResponseExpectedFlag::False;
735 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::GetDisplayConfiguration) as usize] =
736 ResponseExpectedFlag::AlwaysTrue;
737 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::WriteLine) as usize] = ResponseExpectedFlag::False;
738 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::DrawBufferedFrame) as usize] = ResponseExpectedFlag::False;
739 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::GetTouchPosition) as usize] = ResponseExpectedFlag::AlwaysTrue;
740 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::SetTouchPositionCallbackConfiguration) as usize] =
741 ResponseExpectedFlag::True;
742 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::GetTouchPositionCallbackConfiguration) as usize] =
743 ResponseExpectedFlag::AlwaysTrue;
744 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::GetTouchGesture) as usize] = ResponseExpectedFlag::AlwaysTrue;
745 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::SetTouchGestureCallbackConfiguration) as usize] =
746 ResponseExpectedFlag::True;
747 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::GetTouchGestureCallbackConfiguration) as usize] =
748 ResponseExpectedFlag::AlwaysTrue;
749 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::DrawLine) as usize] = ResponseExpectedFlag::False;
750 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::DrawBox) as usize] = ResponseExpectedFlag::False;
751 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::DrawText) as usize] = ResponseExpectedFlag::False;
752 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::SetGuiButton) as usize] = ResponseExpectedFlag::False;
753 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::GetGuiButton) as usize] = ResponseExpectedFlag::AlwaysTrue;
754 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::RemoveGuiButton) as usize] = ResponseExpectedFlag::False;
755 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::SetGuiButtonPressedCallbackConfiguration) as usize] =
756 ResponseExpectedFlag::True;
757 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::GetGuiButtonPressedCallbackConfiguration) as usize] =
758 ResponseExpectedFlag::AlwaysTrue;
759 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::GetGuiButtonPressed) as usize] =
760 ResponseExpectedFlag::AlwaysTrue;
761 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::SetGuiSlider) as usize] = ResponseExpectedFlag::False;
762 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::GetGuiSlider) as usize] = ResponseExpectedFlag::AlwaysTrue;
763 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::RemoveGuiSlider) as usize] = ResponseExpectedFlag::False;
764 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::SetGuiSliderValueCallbackConfiguration) as usize] =
765 ResponseExpectedFlag::True;
766 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::GetGuiSliderValueCallbackConfiguration) as usize] =
767 ResponseExpectedFlag::AlwaysTrue;
768 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::GetGuiSliderValue) as usize] = ResponseExpectedFlag::AlwaysTrue;
769 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::SetGuiTabConfiguration) as usize] = ResponseExpectedFlag::False;
770 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::GetGuiTabConfiguration) as usize] =
771 ResponseExpectedFlag::AlwaysTrue;
772 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::SetGuiTabText) as usize] = ResponseExpectedFlag::False;
773 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::GetGuiTabText) as usize] = ResponseExpectedFlag::AlwaysTrue;
774 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::SetGuiTabIcon) as usize] = ResponseExpectedFlag::False;
775 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::GetGuiTabIcon) as usize] = ResponseExpectedFlag::AlwaysTrue;
776 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::RemoveGuiTab) as usize] = ResponseExpectedFlag::False;
777 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::SetGuiTabSelected) as usize] = ResponseExpectedFlag::False;
778 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::SetGuiTabSelectedCallbackConfiguration) as usize] =
779 ResponseExpectedFlag::True;
780 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::GetGuiTabSelectedCallbackConfiguration) as usize] =
781 ResponseExpectedFlag::AlwaysTrue;
782 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::GetGuiTabSelected) as usize] = ResponseExpectedFlag::AlwaysTrue;
783 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::SetGuiGraphConfiguration) as usize] =
784 ResponseExpectedFlag::False;
785 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::GetGuiGraphConfiguration) as usize] =
786 ResponseExpectedFlag::AlwaysTrue;
787 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::SetGuiGraphDataLowLevel) as usize] = ResponseExpectedFlag::True;
788 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::GetGuiGraphDataLowLevel) as usize] =
789 ResponseExpectedFlag::AlwaysTrue;
790 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::RemoveGuiGraph) as usize] = ResponseExpectedFlag::False;
791 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::RemoveAllGui) as usize] = ResponseExpectedFlag::False;
792 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::SetTouchLedConfig) as usize] = ResponseExpectedFlag::False;
793 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::GetTouchLedConfig) as usize] = ResponseExpectedFlag::AlwaysTrue;
794 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::GetSpitfpErrorCount) as usize] =
795 ResponseExpectedFlag::AlwaysTrue;
796 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::SetBootloaderMode) as usize] = ResponseExpectedFlag::AlwaysTrue;
797 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::GetBootloaderMode) as usize] = ResponseExpectedFlag::AlwaysTrue;
798 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::SetWriteFirmwarePointer) as usize] =
799 ResponseExpectedFlag::False;
800 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::WriteFirmware) as usize] = ResponseExpectedFlag::AlwaysTrue;
801 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::SetStatusLedConfig) as usize] = ResponseExpectedFlag::False;
802 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::GetStatusLedConfig) as usize] =
803 ResponseExpectedFlag::AlwaysTrue;
804 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::GetChipTemperature) as usize] =
805 ResponseExpectedFlag::AlwaysTrue;
806 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::Reset) as usize] = ResponseExpectedFlag::False;
807 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::WriteUid) as usize] = ResponseExpectedFlag::False;
808 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::ReadUid) as usize] = ResponseExpectedFlag::AlwaysTrue;
809 result.device.response_expected[u8::from(Lcd128x64BrickletFunction::GetIdentity) as usize] = ResponseExpectedFlag::AlwaysTrue;
810 result
811 }
812
813 pub fn get_response_expected(&mut self, fun: Lcd128x64BrickletFunction) -> Result<bool, GetResponseExpectedError> {
828 self.device.get_response_expected(u8::from(fun))
829 }
830
831 pub fn set_response_expected(
840 &mut self,
841 fun: Lcd128x64BrickletFunction,
842 response_expected: bool,
843 ) -> Result<(), SetResponseExpectedError> {
844 self.device.set_response_expected(u8::from(fun), response_expected)
845 }
846
847 pub fn set_response_expected_all(&mut self, response_expected: bool) {
849 self.device.set_response_expected_all(response_expected)
850 }
851
852 pub fn get_api_version(&self) -> [u8; 3] {
855 self.device.api_version
856 }
857
858 pub async fn get_touch_position_callback_receiver(&mut self) -> impl Stream<Item = TouchPositionEvent> {
865 self.device
866 .get_callback_receiver(u8::from(Lcd128x64BrickletFunction::CallbackTouchPosition))
867 .await
868 .map(|p| TouchPositionEvent::from_le_byte_slice(p.body()))
869 }
870
871 pub async fn get_touch_gesture_callback_receiver(&mut self) -> impl Stream<Item = TouchGestureEvent> {
875 self.device
876 .get_callback_receiver(u8::from(Lcd128x64BrickletFunction::CallbackTouchGesture))
877 .await
878 .map(|p| TouchGestureEvent::from_le_byte_slice(p.body()))
879 }
880
881 pub async fn get_gui_button_pressed_callback_receiver(&mut self) -> impl Stream<Item = GuiButtonPressedEvent> {
888 self.device
889 .get_callback_receiver(u8::from(Lcd128x64BrickletFunction::CallbackGuiButtonPressed))
890 .await
891 .map(|p| GuiButtonPressedEvent::from_le_byte_slice(p.body()))
892 }
893
894 pub async fn get_gui_slider_value_callback_receiver(&mut self) -> impl Stream<Item = GuiSliderValueEvent> {
901 self.device
902 .get_callback_receiver(u8::from(Lcd128x64BrickletFunction::CallbackGuiSliderValue))
903 .await
904 .map(|p| GuiSliderValueEvent::from_le_byte_slice(p.body()))
905 }
906
907 pub async fn get_gui_tab_selected_callback_receiver(&mut self) -> impl Stream<Item = i8> {
914 self.device
915 .get_callback_receiver(u8::from(Lcd128x64BrickletFunction::CallbackGuiTabSelected))
916 .await
917 .map(|p| i8::from_le_byte_slice(p.body()))
918 }
919
920 pub async fn write_pixels_low_level(
937 &mut self,
938 x_start: u8,
939 y_start: u8,
940 x_end: u8,
941 y_end: u8,
942 pixels_length: u16,
943 pixels_chunk_offset: u16,
944 pixels_chunk_data: &[bool; 448],
945 ) -> Result<WritePixelsLowLevel, TinkerforgeError> {
946 let mut payload = [0; 64];
947 x_start.write_to_slice(&mut payload[0..1]);
948 y_start.write_to_slice(&mut payload[1..2]);
949 x_end.write_to_slice(&mut payload[2..3]);
950 y_end.write_to_slice(&mut payload[3..4]);
951 pixels_length.write_to_slice(&mut payload[4..6]);
952 pixels_chunk_offset.write_to_slice(&mut payload[6..8]);
953 pixels_chunk_data.write_to_slice(&mut payload[8..64]);
954
955 #[allow(unused_variables)]
956 let result = self.device.set(u8::from(Lcd128x64BrickletFunction::WritePixelsLowLevel), &payload).await?.unwrap();
957 Ok(WritePixelsLowLevel::from_le_byte_slice(result.body()))
958 }
959
960 pub async fn read_pixels_low_level(
974 &mut self,
975 x_start: u8,
976 y_start: u8,
977 x_end: u8,
978 y_end: u8,
979 ) -> Result<ReadPixelsLowLevel, TinkerforgeError> {
980 let mut payload = [0; 4];
981 x_start.write_to_slice(&mut payload[0..1]);
982 y_start.write_to_slice(&mut payload[1..2]);
983 x_end.write_to_slice(&mut payload[2..3]);
984 y_end.write_to_slice(&mut payload[3..4]);
985
986 #[allow(unused_variables)]
987 let result = self.device.get(u8::from(Lcd128x64BrickletFunction::ReadPixelsLowLevel), &payload).await?;
988 Ok(ReadPixelsLowLevel::from_le_byte_slice(result.body()))
989 }
990
991 pub async fn clear_display(&mut self) -> Result<(), TinkerforgeError> {
1003 let payload = [0; 0];
1004
1005 #[allow(unused_variables)]
1006 let result = self.device.set(u8::from(Lcd128x64BrickletFunction::ClearDisplay), &payload).await?;
1007 Ok(())
1008 }
1009
1010 pub async fn set_display_configuration(
1017 &mut self,
1018 contrast: u8,
1019 backlight: u8,
1020 invert: bool,
1021 automatic_draw: bool,
1022 ) -> Result<(), TinkerforgeError> {
1023 let mut payload = [0; 4];
1024 contrast.write_to_slice(&mut payload[0..1]);
1025 backlight.write_to_slice(&mut payload[1..2]);
1026 invert.write_to_slice(&mut payload[2..3]);
1027 automatic_draw.write_to_slice(&mut payload[3..4]);
1028
1029 #[allow(unused_variables)]
1030 let result = self.device.set(u8::from(Lcd128x64BrickletFunction::SetDisplayConfiguration), &payload).await?;
1031 Ok(())
1032 }
1033
1034 pub async fn get_display_configuration(&mut self) -> Result<DisplayConfiguration, TinkerforgeError> {
1036 let payload = [0; 0];
1037
1038 #[allow(unused_variables)]
1039 let result = self.device.get(u8::from(Lcd128x64BrickletFunction::GetDisplayConfiguration), &payload).await?;
1040 Ok(DisplayConfiguration::from_le_byte_slice(result.body()))
1041 }
1042
1043 pub async fn write_line(&mut self, line: u8, position: u8, text: String) -> Result<(), TinkerforgeError> {
1067 let mut payload = [0; 24];
1068 line.write_to_slice(&mut payload[0..1]);
1069 position.write_to_slice(&mut payload[1..2]);
1070 text.try_write_to_slice(22, &mut payload)?;
1071
1072 #[allow(unused_variables)]
1073 let result = self.device.set(u8::from(Lcd128x64BrickletFunction::WriteLine), &payload).await?;
1074 Ok(())
1075 }
1076
1077 pub async fn draw_buffered_frame(&mut self, force_complete_redraw: bool) -> Result<(), TinkerforgeError> {
1087 let mut payload = [0; 1];
1088 force_complete_redraw.write_to_slice(&mut payload[0..1]);
1089
1090 #[allow(unused_variables)]
1091 let result = self.device.set(u8::from(Lcd128x64BrickletFunction::DrawBufferedFrame), &payload).await?;
1092 Ok(())
1093 }
1094
1095 pub async fn get_touch_position(&mut self) -> Result<TouchPosition, TinkerforgeError> {
1102 let payload = [0; 0];
1103
1104 #[allow(unused_variables)]
1105 let result = self.device.get(u8::from(Lcd128x64BrickletFunction::GetTouchPosition), &payload).await?;
1106 Ok(TouchPosition::from_le_byte_slice(result.body()))
1107 }
1108
1109 pub async fn set_touch_position_callback_configuration(
1119 &mut self,
1120 period: u32,
1121 value_has_to_change: bool,
1122 ) -> Result<(), TinkerforgeError> {
1123 let mut payload = [0; 5];
1124 period.write_to_slice(&mut payload[0..4]);
1125 value_has_to_change.write_to_slice(&mut payload[4..5]);
1126
1127 #[allow(unused_variables)]
1128 let result = self.device.set(u8::from(Lcd128x64BrickletFunction::SetTouchPositionCallbackConfiguration), &payload).await?;
1129 Ok(())
1130 }
1131
1132 pub async fn get_touch_position_callback_configuration(&mut self) -> Result<TouchPositionCallbackConfiguration, TinkerforgeError> {
1135 let payload = [0; 0];
1136
1137 #[allow(unused_variables)]
1138 let result = self.device.get(u8::from(Lcd128x64BrickletFunction::GetTouchPositionCallbackConfiguration), &payload).await?;
1139 Ok(TouchPositionCallbackConfiguration::from_le_byte_slice(result.body()))
1140 }
1141
1142 pub async fn get_touch_gesture(&mut self) -> Result<TouchGesture, TinkerforgeError> {
1158 let payload = [0; 0];
1159
1160 #[allow(unused_variables)]
1161 let result = self.device.get(u8::from(Lcd128x64BrickletFunction::GetTouchGesture), &payload).await?;
1162 Ok(TouchGesture::from_le_byte_slice(result.body()))
1163 }
1164
1165 pub async fn set_touch_gesture_callback_configuration(
1175 &mut self,
1176 period: u32,
1177 value_has_to_change: bool,
1178 ) -> Result<(), TinkerforgeError> {
1179 let mut payload = [0; 5];
1180 period.write_to_slice(&mut payload[0..4]);
1181 value_has_to_change.write_to_slice(&mut payload[4..5]);
1182
1183 #[allow(unused_variables)]
1184 let result = self.device.set(u8::from(Lcd128x64BrickletFunction::SetTouchGestureCallbackConfiguration), &payload).await?;
1185 Ok(())
1186 }
1187
1188 pub async fn get_touch_gesture_callback_configuration(&mut self) -> Result<TouchGestureCallbackConfiguration, TinkerforgeError> {
1191 let payload = [0; 0];
1192
1193 #[allow(unused_variables)]
1194 let result = self.device.get(u8::from(Lcd128x64BrickletFunction::GetTouchGestureCallbackConfiguration), &payload).await?;
1195 Ok(TouchGestureCallbackConfiguration::from_le_byte_slice(result.body()))
1196 }
1197
1198 pub async fn draw_line(
1207 &mut self,
1208 position_x_start: u8,
1209 position_y_start: u8,
1210 position_x_end: u8,
1211 position_y_end: u8,
1212 color: bool,
1213 ) -> Result<(), TinkerforgeError> {
1214 let mut payload = [0; 5];
1215 position_x_start.write_to_slice(&mut payload[0..1]);
1216 position_y_start.write_to_slice(&mut payload[1..2]);
1217 position_x_end.write_to_slice(&mut payload[2..3]);
1218 position_y_end.write_to_slice(&mut payload[3..4]);
1219 color.write_to_slice(&mut payload[4..5]);
1220
1221 #[allow(unused_variables)]
1222 let result = self.device.set(u8::from(Lcd128x64BrickletFunction::DrawLine), &payload).await?;
1223 Ok(())
1224 }
1225
1226 pub async fn draw_box(
1238 &mut self,
1239 position_x_start: u8,
1240 position_y_start: u8,
1241 position_x_end: u8,
1242 position_y_end: u8,
1243 fill: bool,
1244 color: bool,
1245 ) -> Result<(), TinkerforgeError> {
1246 let mut payload = [0; 6];
1247 position_x_start.write_to_slice(&mut payload[0..1]);
1248 position_y_start.write_to_slice(&mut payload[1..2]);
1249 position_x_end.write_to_slice(&mut payload[2..3]);
1250 position_y_end.write_to_slice(&mut payload[3..4]);
1251 fill.write_to_slice(&mut payload[4..5]);
1252 color.write_to_slice(&mut payload[5..6]);
1253
1254 #[allow(unused_variables)]
1255 let result = self.device.set(u8::from(Lcd128x64BrickletFunction::DrawBox), &payload).await?;
1256 Ok(())
1257 }
1258
1259 pub async fn draw_text(&mut self, position_x: u8, position_y: u8, font: u8, color: bool, text: String) -> Result<(), TinkerforgeError> {
1282 let mut payload = [0; 26];
1283 position_x.write_to_slice(&mut payload[0..1]);
1284 position_y.write_to_slice(&mut payload[1..2]);
1285 font.write_to_slice(&mut payload[2..3]);
1286 color.write_to_slice(&mut payload[3..4]);
1287 text.try_write_to_slice(22, &mut payload)?;
1288
1289 #[allow(unused_variables)]
1290 let result = self.device.set(u8::from(Lcd128x64BrickletFunction::DrawText), &payload).await?;
1291 Ok(())
1292 }
1293
1294 pub async fn set_gui_button(
1317 &mut self,
1318 index: u8,
1319 position_x: u8,
1320 position_y: u8,
1321 width: u8,
1322 height: u8,
1323 text: String,
1324 ) -> Result<(), TinkerforgeError> {
1325 let mut payload = [0; 21];
1326 index.write_to_slice(&mut payload[0..1]);
1327 position_x.write_to_slice(&mut payload[1..2]);
1328 position_y.write_to_slice(&mut payload[2..3]);
1329 width.write_to_slice(&mut payload[3..4]);
1330 height.write_to_slice(&mut payload[4..5]);
1331 text.try_write_to_slice(16, &mut payload)?;
1332
1333 #[allow(unused_variables)]
1334 let result = self.device.set(u8::from(Lcd128x64BrickletFunction::SetGuiButton), &payload).await?;
1335 Ok(())
1336 }
1337
1338 pub async fn get_gui_button(&mut self, index: u8) -> Result<GuiButton, TinkerforgeError> {
1346 let mut payload = [0; 1];
1347 index.write_to_slice(&mut payload[0..1]);
1348
1349 #[allow(unused_variables)]
1350 let result = self.device.get(u8::from(Lcd128x64BrickletFunction::GetGuiButton), &payload).await?;
1351 Ok(GuiButton::from_le_byte_slice(result.body()))
1352 }
1353
1354 pub async fn remove_gui_button(&mut self, index: u8) -> Result<(), TinkerforgeError> {
1361 let mut payload = [0; 1];
1362 index.write_to_slice(&mut payload[0..1]);
1363
1364 #[allow(unused_variables)]
1365 let result = self.device.set(u8::from(Lcd128x64BrickletFunction::RemoveGuiButton), &payload).await?;
1366 Ok(())
1367 }
1368
1369 pub async fn set_gui_button_pressed_callback_configuration(
1382 &mut self,
1383 period: u32,
1384 value_has_to_change: bool,
1385 ) -> Result<(), TinkerforgeError> {
1386 let mut payload = [0; 5];
1387 period.write_to_slice(&mut payload[0..4]);
1388 value_has_to_change.write_to_slice(&mut payload[4..5]);
1389
1390 #[allow(unused_variables)]
1391 let result = self.device.set(u8::from(Lcd128x64BrickletFunction::SetGuiButtonPressedCallbackConfiguration), &payload).await?;
1392 Ok(())
1393 }
1394
1395 pub async fn get_gui_button_pressed_callback_configuration(
1401 &mut self,
1402 ) -> Result<GuiButtonPressedCallbackConfiguration, TinkerforgeError> {
1403 let payload = [0; 0];
1404
1405 #[allow(unused_variables)]
1406 let result = self.device.get(u8::from(Lcd128x64BrickletFunction::GetGuiButtonPressedCallbackConfiguration), &payload).await?;
1407 Ok(GuiButtonPressedCallbackConfiguration::from_le_byte_slice(result.body()))
1408 }
1409
1410 pub async fn get_gui_button_pressed(&mut self, index: u8) -> Result<bool, TinkerforgeError> {
1417 let mut payload = [0; 1];
1418 index.write_to_slice(&mut payload[0..1]);
1419
1420 #[allow(unused_variables)]
1421 let result = self.device.get(u8::from(Lcd128x64BrickletFunction::GetGuiButtonPressed), &payload).await?;
1422 Ok(bool::from_le_byte_slice(result.body()))
1423 }
1424
1425 pub async fn set_gui_slider(
1456 &mut self,
1457 index: u8,
1458 position_x: u8,
1459 position_y: u8,
1460 length: u8,
1461 direction: u8,
1462 value: u8,
1463 ) -> Result<(), TinkerforgeError> {
1464 let mut payload = [0; 6];
1465 index.write_to_slice(&mut payload[0..1]);
1466 position_x.write_to_slice(&mut payload[1..2]);
1467 position_y.write_to_slice(&mut payload[2..3]);
1468 length.write_to_slice(&mut payload[3..4]);
1469 direction.write_to_slice(&mut payload[4..5]);
1470 value.write_to_slice(&mut payload[5..6]);
1471
1472 #[allow(unused_variables)]
1473 let result = self.device.set(u8::from(Lcd128x64BrickletFunction::SetGuiSlider), &payload).await?;
1474 Ok(())
1475 }
1476
1477 pub async fn get_gui_slider(&mut self, index: u8) -> Result<GuiSlider, TinkerforgeError> {
1489 let mut payload = [0; 1];
1490 index.write_to_slice(&mut payload[0..1]);
1491
1492 #[allow(unused_variables)]
1493 let result = self.device.get(u8::from(Lcd128x64BrickletFunction::GetGuiSlider), &payload).await?;
1494 Ok(GuiSlider::from_le_byte_slice(result.body()))
1495 }
1496
1497 pub async fn remove_gui_slider(&mut self, index: u8) -> Result<(), TinkerforgeError> {
1504 let mut payload = [0; 1];
1505 index.write_to_slice(&mut payload[0..1]);
1506
1507 #[allow(unused_variables)]
1508 let result = self.device.set(u8::from(Lcd128x64BrickletFunction::RemoveGuiSlider), &payload).await?;
1509 Ok(())
1510 }
1511
1512 pub async fn set_gui_slider_value_callback_configuration(
1525 &mut self,
1526 period: u32,
1527 value_has_to_change: bool,
1528 ) -> Result<(), TinkerforgeError> {
1529 let mut payload = [0; 5];
1530 period.write_to_slice(&mut payload[0..4]);
1531 value_has_to_change.write_to_slice(&mut payload[4..5]);
1532
1533 #[allow(unused_variables)]
1534 let result = self.device.set(u8::from(Lcd128x64BrickletFunction::SetGuiSliderValueCallbackConfiguration), &payload).await?;
1535 Ok(())
1536 }
1537
1538 pub async fn get_gui_slider_value_callback_configuration(&mut self) -> Result<GuiSliderValueCallbackConfiguration, TinkerforgeError> {
1544 let payload = [0; 0];
1545
1546 #[allow(unused_variables)]
1547 let result = self.device.get(u8::from(Lcd128x64BrickletFunction::GetGuiSliderValueCallbackConfiguration), &payload).await?;
1548 Ok(GuiSliderValueCallbackConfiguration::from_le_byte_slice(result.body()))
1549 }
1550
1551 pub async fn get_gui_slider_value(&mut self, index: u8) -> Result<u8, TinkerforgeError> {
1556 let mut payload = [0; 1];
1557 index.write_to_slice(&mut payload[0..1]);
1558
1559 #[allow(unused_variables)]
1560 let result = self.device.get(u8::from(Lcd128x64BrickletFunction::GetGuiSliderValue), &payload).await?;
1561 Ok(u8::from_le_byte_slice(result.body()))
1562 }
1563
1564 pub async fn set_gui_tab_configuration(&mut self, change_tab_config: u8, clear_gui: bool) -> Result<(), TinkerforgeError> {
1578 let mut payload = [0; 2];
1579 change_tab_config.write_to_slice(&mut payload[0..1]);
1580 clear_gui.write_to_slice(&mut payload[1..2]);
1581
1582 #[allow(unused_variables)]
1583 let result = self.device.set(u8::from(Lcd128x64BrickletFunction::SetGuiTabConfiguration), &payload).await?;
1584 Ok(())
1585 }
1586
1587 pub async fn get_gui_tab_configuration(&mut self) -> Result<GuiTabConfiguration, TinkerforgeError> {
1597 let payload = [0; 0];
1598
1599 #[allow(unused_variables)]
1600 let result = self.device.get(u8::from(Lcd128x64BrickletFunction::GetGuiTabConfiguration), &payload).await?;
1601 Ok(GuiTabConfiguration::from_le_byte_slice(result.body()))
1602 }
1603
1604 pub async fn set_gui_tab_text(&mut self, index: u8, text: String) -> Result<(), TinkerforgeError> {
1613 let mut payload = [0; 6];
1614 index.write_to_slice(&mut payload[0..1]);
1615 text.try_write_to_slice(5, &mut payload)?;
1616
1617 #[allow(unused_variables)]
1618 let result = self.device.set(u8::from(Lcd128x64BrickletFunction::SetGuiTabText), &payload).await?;
1619 Ok(())
1620 }
1621
1622 pub async fn get_gui_tab_text(&mut self, index: u8) -> Result<GuiTabText, TinkerforgeError> {
1630 let mut payload = [0; 1];
1631 index.write_to_slice(&mut payload[0..1]);
1632
1633 #[allow(unused_variables)]
1634 let result = self.device.get(u8::from(Lcd128x64BrickletFunction::GetGuiTabText), &payload).await?;
1635 Ok(GuiTabText::from_le_byte_slice(result.body()))
1636 }
1637
1638 pub async fn set_gui_tab_icon(&mut self, index: u8, icon: &[bool; 168]) -> Result<(), TinkerforgeError> {
1648 let mut payload = [0; 22];
1649 index.write_to_slice(&mut payload[0..1]);
1650 icon.write_to_slice(&mut payload[1..22]);
1651
1652 #[allow(unused_variables)]
1653 let result = self.device.set(u8::from(Lcd128x64BrickletFunction::SetGuiTabIcon), &payload).await?;
1654 Ok(())
1655 }
1656
1657 pub async fn get_gui_tab_icon(&mut self, index: u8) -> Result<GuiTabIcon, TinkerforgeError> {
1665 let mut payload = [0; 1];
1666 index.write_to_slice(&mut payload[0..1]);
1667
1668 #[allow(unused_variables)]
1669 let result = self.device.get(u8::from(Lcd128x64BrickletFunction::GetGuiTabIcon), &payload).await?;
1670 Ok(GuiTabIcon::from_le_byte_slice(result.body()))
1671 }
1672
1673 pub async fn remove_gui_tab(&mut self, index: u8) -> Result<(), TinkerforgeError> {
1680 let mut payload = [0; 1];
1681 index.write_to_slice(&mut payload[0..1]);
1682
1683 #[allow(unused_variables)]
1684 let result = self.device.set(u8::from(Lcd128x64BrickletFunction::RemoveGuiTab), &payload).await?;
1685 Ok(())
1686 }
1687
1688 pub async fn set_gui_tab_selected(&mut self, index: u8) -> Result<(), TinkerforgeError> {
1693 let mut payload = [0; 1];
1694 index.write_to_slice(&mut payload[0..1]);
1695
1696 #[allow(unused_variables)]
1697 let result = self.device.set(u8::from(Lcd128x64BrickletFunction::SetGuiTabSelected), &payload).await?;
1698 Ok(())
1699 }
1700
1701 pub async fn set_gui_tab_selected_callback_configuration(
1714 &mut self,
1715 period: u32,
1716 value_has_to_change: bool,
1717 ) -> Result<(), TinkerforgeError> {
1718 let mut payload = [0; 5];
1719 period.write_to_slice(&mut payload[0..4]);
1720 value_has_to_change.write_to_slice(&mut payload[4..5]);
1721
1722 #[allow(unused_variables)]
1723 let result = self.device.set(u8::from(Lcd128x64BrickletFunction::SetGuiTabSelectedCallbackConfiguration), &payload).await?;
1724 Ok(())
1725 }
1726
1727 pub async fn get_gui_tab_selected_callback_configuration(&mut self) -> Result<GuiTabSelectedCallbackConfiguration, TinkerforgeError> {
1733 let payload = [0; 0];
1734
1735 #[allow(unused_variables)]
1736 let result = self.device.get(u8::from(Lcd128x64BrickletFunction::GetGuiTabSelectedCallbackConfiguration), &payload).await?;
1737 Ok(GuiTabSelectedCallbackConfiguration::from_le_byte_slice(result.body()))
1738 }
1739
1740 pub async fn get_gui_tab_selected(&mut self) -> Result<i8, TinkerforgeError> {
1746 let payload = [0; 0];
1747
1748 #[allow(unused_variables)]
1749 let result = self.device.get(u8::from(Lcd128x64BrickletFunction::GetGuiTabSelected), &payload).await?;
1750 Ok(i8::from_le_byte_slice(result.body()))
1751 }
1752
1753 pub async fn set_gui_graph_configuration(
1779 &mut self,
1780 index: u8,
1781 graph_type: u8,
1782 position_x: u8,
1783 position_y: u8,
1784 width: u8,
1785 height: u8,
1786 text_x: String,
1787 text_y: String,
1788 ) -> Result<(), TinkerforgeError> {
1789 let mut payload = [0; 14];
1790 index.write_to_slice(&mut payload[0..1]);
1791 graph_type.write_to_slice(&mut payload[1..2]);
1792 position_x.write_to_slice(&mut payload[2..3]);
1793 position_y.write_to_slice(&mut payload[3..4]);
1794 width.write_to_slice(&mut payload[4..5]);
1795 height.write_to_slice(&mut payload[5..6]);
1796 text_x.try_write_to_slice(4, &mut payload)?;
1797 text_y.try_write_to_slice(4, &mut payload)?;
1798
1799 #[allow(unused_variables)]
1800 let result = self.device.set(u8::from(Lcd128x64BrickletFunction::SetGuiGraphConfiguration), &payload).await?;
1801 Ok(())
1802 }
1803
1804 pub async fn get_gui_graph_configuration(&mut self, index: u8) -> Result<GuiGraphConfiguration, TinkerforgeError> {
1817 let mut payload = [0; 1];
1818 index.write_to_slice(&mut payload[0..1]);
1819
1820 #[allow(unused_variables)]
1821 let result = self.device.get(u8::from(Lcd128x64BrickletFunction::GetGuiGraphConfiguration), &payload).await?;
1822 Ok(GuiGraphConfiguration::from_le_byte_slice(result.body()))
1823 }
1824
1825 pub async fn set_gui_graph_data_low_level(
1841 &mut self,
1842 index: u8,
1843 data_length: u16,
1844 data_chunk_offset: u16,
1845 data_chunk_data: &[u8; 59],
1846 ) -> Result<SetGuiGraphDataLowLevel, TinkerforgeError> {
1847 let mut payload = [0; 64];
1848 index.write_to_slice(&mut payload[0..1]);
1849 data_length.write_to_slice(&mut payload[1..3]);
1850 data_chunk_offset.write_to_slice(&mut payload[3..5]);
1851 data_chunk_data.write_to_slice(&mut payload[5..64]);
1852
1853 #[allow(unused_variables)]
1854 let result = self.device.set(u8::from(Lcd128x64BrickletFunction::SetGuiGraphDataLowLevel), &payload).await?.unwrap();
1855 Ok(SetGuiGraphDataLowLevel::from_le_byte_slice(result.body()))
1856 }
1857
1858 pub async fn get_gui_graph_data_low_level(&mut self, index: u8) -> Result<GuiGraphDataLowLevel, TinkerforgeError> {
1863 let mut payload = [0; 1];
1864 index.write_to_slice(&mut payload[0..1]);
1865
1866 #[allow(unused_variables)]
1867 let result = self.device.get(u8::from(Lcd128x64BrickletFunction::GetGuiGraphDataLowLevel), &payload).await?;
1868 Ok(GuiGraphDataLowLevel::from_le_byte_slice(result.body()))
1869 }
1870
1871 pub async fn remove_gui_graph(&mut self, index: u8) -> Result<(), TinkerforgeError> {
1878 let mut payload = [0; 1];
1879 index.write_to_slice(&mut payload[0..1]);
1880
1881 #[allow(unused_variables)]
1882 let result = self.device.set(u8::from(Lcd128x64BrickletFunction::RemoveGuiGraph), &payload).await?;
1883 Ok(())
1884 }
1885
1886 pub async fn remove_all_gui(&mut self) -> Result<(), TinkerforgeError> {
1891 let payload = [0; 0];
1892
1893 #[allow(unused_variables)]
1894 let result = self.device.set(u8::from(Lcd128x64BrickletFunction::RemoveAllGui), &payload).await?;
1895 Ok(())
1896 }
1897
1898 pub async fn set_touch_led_config(&mut self, config: u8) -> Result<(), TinkerforgeError> {
1914 let mut payload = [0; 1];
1915 config.write_to_slice(&mut payload[0..1]);
1916
1917 #[allow(unused_variables)]
1918 let result = self.device.set(u8::from(Lcd128x64BrickletFunction::SetTouchLedConfig), &payload).await?;
1919 Ok(())
1920 }
1921
1922 pub async fn get_touch_led_config(&mut self) -> Result<u8, TinkerforgeError> {
1933 let payload = [0; 0];
1934
1935 #[allow(unused_variables)]
1936 let result = self.device.get(u8::from(Lcd128x64BrickletFunction::GetTouchLedConfig), &payload).await?;
1937 Ok(u8::from_le_byte_slice(result.body()))
1938 }
1939
1940 pub async fn get_spitfp_error_count(&mut self) -> Result<SpitfpErrorCount, TinkerforgeError> {
1952 let payload = [0; 0];
1953
1954 #[allow(unused_variables)]
1955 let result = self.device.get(u8::from(Lcd128x64BrickletFunction::GetSpitfpErrorCount), &payload).await?;
1956 Ok(SpitfpErrorCount::from_le_byte_slice(result.body()))
1957 }
1958
1959 pub async fn set_bootloader_mode(&mut self, mode: u8) -> Result<u8, TinkerforgeError> {
1982 let mut payload = [0; 1];
1983 mode.write_to_slice(&mut payload[0..1]);
1984
1985 #[allow(unused_variables)]
1986 let result = self.device.get(u8::from(Lcd128x64BrickletFunction::SetBootloaderMode), &payload).await?;
1987 Ok(u8::from_le_byte_slice(result.body()))
1988 }
1989
1990 pub async fn get_bootloader_mode(&mut self) -> Result<u8, TinkerforgeError> {
1999 let payload = [0; 0];
2000
2001 #[allow(unused_variables)]
2002 let result = self.device.get(u8::from(Lcd128x64BrickletFunction::GetBootloaderMode), &payload).await?;
2003 Ok(u8::from_le_byte_slice(result.body()))
2004 }
2005
2006 pub async fn set_write_firmware_pointer(&mut self, pointer: u32) -> Result<(), TinkerforgeError> {
2013 let mut payload = [0; 4];
2014 pointer.write_to_slice(&mut payload[0..4]);
2015
2016 #[allow(unused_variables)]
2017 let result = self.device.set(u8::from(Lcd128x64BrickletFunction::SetWriteFirmwarePointer), &payload).await?;
2018 Ok(())
2019 }
2020
2021 pub async fn write_firmware(&mut self, data: &[u8; 64]) -> Result<u8, TinkerforgeError> {
2030 let mut payload = [0; 64];
2031 data.write_to_slice(&mut payload[0..64]);
2032
2033 #[allow(unused_variables)]
2034 let result = self.device.get(u8::from(Lcd128x64BrickletFunction::WriteFirmware), &payload).await?;
2035 Ok(u8::from_le_byte_slice(result.body()))
2036 }
2037
2038 pub async fn set_status_led_config(&mut self, config: u8) -> Result<(), TinkerforgeError> {
2052 let mut payload = [0; 1];
2053 config.write_to_slice(&mut payload[0..1]);
2054
2055 #[allow(unused_variables)]
2056 let result = self.device.set(u8::from(Lcd128x64BrickletFunction::SetStatusLedConfig), &payload).await?;
2057 Ok(())
2058 }
2059
2060 pub async fn get_status_led_config(&mut self) -> Result<u8, TinkerforgeError> {
2068 let payload = [0; 0];
2069
2070 #[allow(unused_variables)]
2071 let result = self.device.get(u8::from(Lcd128x64BrickletFunction::GetStatusLedConfig), &payload).await?;
2072 Ok(u8::from_le_byte_slice(result.body()))
2073 }
2074
2075 pub async fn get_chip_temperature(&mut self) -> Result<i16, TinkerforgeError> {
2082 let payload = [0; 0];
2083
2084 #[allow(unused_variables)]
2085 let result = self.device.get(u8::from(Lcd128x64BrickletFunction::GetChipTemperature), &payload).await?;
2086 Ok(i16::from_le_byte_slice(result.body()))
2087 }
2088
2089 pub async fn reset(&mut self) -> Result<(), TinkerforgeError> {
2096 let payload = [0; 0];
2097
2098 #[allow(unused_variables)]
2099 let result = self.device.set(u8::from(Lcd128x64BrickletFunction::Reset), &payload).await?;
2100 Ok(())
2101 }
2102
2103 pub async fn write_uid(&mut self, uid: u32) -> Result<(), TinkerforgeError> {
2109 let mut payload = [0; 4];
2110 uid.write_to_slice(&mut payload[0..4]);
2111
2112 #[allow(unused_variables)]
2113 let result = self.device.set(u8::from(Lcd128x64BrickletFunction::WriteUid), &payload).await?;
2114 Ok(())
2115 }
2116
2117 pub async fn read_uid(&mut self) -> Result<u32, TinkerforgeError> {
2120 let payload = [0; 0];
2121
2122 #[allow(unused_variables)]
2123 let result = self.device.get(u8::from(Lcd128x64BrickletFunction::ReadUid), &payload).await?;
2124 Ok(u32::from_le_byte_slice(result.body()))
2125 }
2126
2127 pub async fn get_identity(&mut self) -> Result<Identity, TinkerforgeError> {
2138 let payload = [0; 0];
2139
2140 #[allow(unused_variables)]
2141 let result = self.device.get(u8::from(Lcd128x64BrickletFunction::GetIdentity), &payload).await?;
2142 Ok(Identity::from_le_byte_slice(result.body()))
2143 }
2144}