tinkerforge/bindings/
io4_bricklet.rs

1/* ***********************************************************
2 * This file was automatically generated on 2024-02-27.      *
3 *                                                           *
4 * Rust Bindings Version 2.0.21                              *
5 *                                                           *
6 * If you have a bugfix for this file and want to commit it, *
7 * please fix the bug in the generator. You can find a link  *
8 * to the generators git repository on tinkerforge.com       *
9 *************************************************************/
10
11//! 4-channel digital input/output.
12//!
13//! See also the documentation [here](https://www.tinkerforge.com/en/doc/Software/Bricklets/IO4_Bricklet_Rust.html).
14use crate::{
15    byte_converter::*, converting_callback_receiver::ConvertingCallbackReceiver, converting_receiver::ConvertingReceiver, device::*,
16    ip_connection::GetRequestSender,
17};
18pub enum Io4BrickletFunction {
19    SetValue,
20    GetValue,
21    SetConfiguration,
22    GetConfiguration,
23    SetDebouncePeriod,
24    GetDebouncePeriod,
25    SetInterrupt,
26    GetInterrupt,
27    SetMonoflop,
28    GetMonoflop,
29    SetSelectedValues,
30    GetEdgeCount,
31    SetEdgeCountConfig,
32    GetEdgeCountConfig,
33    GetIdentity,
34    CallbackInterrupt,
35    CallbackMonoflopDone,
36}
37impl From<Io4BrickletFunction> for u8 {
38    fn from(fun: Io4BrickletFunction) -> Self {
39        match fun {
40            Io4BrickletFunction::SetValue => 1,
41            Io4BrickletFunction::GetValue => 2,
42            Io4BrickletFunction::SetConfiguration => 3,
43            Io4BrickletFunction::GetConfiguration => 4,
44            Io4BrickletFunction::SetDebouncePeriod => 5,
45            Io4BrickletFunction::GetDebouncePeriod => 6,
46            Io4BrickletFunction::SetInterrupt => 7,
47            Io4BrickletFunction::GetInterrupt => 8,
48            Io4BrickletFunction::SetMonoflop => 10,
49            Io4BrickletFunction::GetMonoflop => 11,
50            Io4BrickletFunction::SetSelectedValues => 13,
51            Io4BrickletFunction::GetEdgeCount => 14,
52            Io4BrickletFunction::SetEdgeCountConfig => 15,
53            Io4BrickletFunction::GetEdgeCountConfig => 16,
54            Io4BrickletFunction::GetIdentity => 255,
55            Io4BrickletFunction::CallbackInterrupt => 9,
56            Io4BrickletFunction::CallbackMonoflopDone => 12,
57        }
58    }
59}
60pub const IO4_BRICKLET_DIRECTION_IN: char = 'i';
61pub const IO4_BRICKLET_DIRECTION_OUT: char = 'o';
62pub const IO4_BRICKLET_EDGE_TYPE_RISING: u8 = 0;
63pub const IO4_BRICKLET_EDGE_TYPE_FALLING: u8 = 1;
64pub const IO4_BRICKLET_EDGE_TYPE_BOTH: u8 = 2;
65
66#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
67pub struct Configuration {
68    pub direction_mask: u8,
69    pub value_mask: u8,
70}
71impl FromByteSlice for Configuration {
72    fn bytes_expected() -> usize { 2 }
73    fn from_le_byte_slice(bytes: &[u8]) -> Configuration {
74        Configuration { direction_mask: <u8>::from_le_byte_slice(&bytes[0..1]), value_mask: <u8>::from_le_byte_slice(&bytes[1..2]) }
75    }
76}
77
78#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
79pub struct InterruptEvent {
80    pub interrupt_mask: u8,
81    pub value_mask: u8,
82}
83impl FromByteSlice for InterruptEvent {
84    fn bytes_expected() -> usize { 2 }
85    fn from_le_byte_slice(bytes: &[u8]) -> InterruptEvent {
86        InterruptEvent { interrupt_mask: <u8>::from_le_byte_slice(&bytes[0..1]), value_mask: <u8>::from_le_byte_slice(&bytes[1..2]) }
87    }
88}
89
90#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
91pub struct Monoflop {
92    pub value: u8,
93    pub time: u32,
94    pub time_remaining: u32,
95}
96impl FromByteSlice for Monoflop {
97    fn bytes_expected() -> usize { 9 }
98    fn from_le_byte_slice(bytes: &[u8]) -> Monoflop {
99        Monoflop {
100            value: <u8>::from_le_byte_slice(&bytes[0..1]),
101            time: <u32>::from_le_byte_slice(&bytes[1..5]),
102            time_remaining: <u32>::from_le_byte_slice(&bytes[5..9]),
103        }
104    }
105}
106
107#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
108pub struct MonoflopDoneEvent {
109    pub selection_mask: u8,
110    pub value_mask: u8,
111}
112impl FromByteSlice for MonoflopDoneEvent {
113    fn bytes_expected() -> usize { 2 }
114    fn from_le_byte_slice(bytes: &[u8]) -> MonoflopDoneEvent {
115        MonoflopDoneEvent { selection_mask: <u8>::from_le_byte_slice(&bytes[0..1]), value_mask: <u8>::from_le_byte_slice(&bytes[1..2]) }
116    }
117}
118
119#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
120pub struct EdgeCountConfig {
121    pub edge_type: u8,
122    pub debounce: u8,
123}
124impl FromByteSlice for EdgeCountConfig {
125    fn bytes_expected() -> usize { 2 }
126    fn from_le_byte_slice(bytes: &[u8]) -> EdgeCountConfig {
127        EdgeCountConfig { edge_type: <u8>::from_le_byte_slice(&bytes[0..1]), debounce: <u8>::from_le_byte_slice(&bytes[1..2]) }
128    }
129}
130
131#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
132pub struct Identity {
133    pub uid: String,
134    pub connected_uid: String,
135    pub position: char,
136    pub hardware_version: [u8; 3],
137    pub firmware_version: [u8; 3],
138    pub device_identifier: u16,
139}
140impl FromByteSlice for Identity {
141    fn bytes_expected() -> usize { 25 }
142    fn from_le_byte_slice(bytes: &[u8]) -> Identity {
143        Identity {
144            uid: <String>::from_le_byte_slice(&bytes[0..8]),
145            connected_uid: <String>::from_le_byte_slice(&bytes[8..16]),
146            position: <char>::from_le_byte_slice(&bytes[16..17]),
147            hardware_version: <[u8; 3]>::from_le_byte_slice(&bytes[17..20]),
148            firmware_version: <[u8; 3]>::from_le_byte_slice(&bytes[20..23]),
149            device_identifier: <u16>::from_le_byte_slice(&bytes[23..25]),
150        }
151    }
152}
153
154/// 4-channel digital input/output
155#[derive(Clone)]
156pub struct Io4Bricklet {
157    device: Device,
158}
159impl Io4Bricklet {
160    pub const DEVICE_IDENTIFIER: u16 = 29;
161    pub const DEVICE_DISPLAY_NAME: &'static str = "IO-4 Bricklet";
162    /// Creates an object with the unique device ID `uid`. This object can then be used after the IP Connection `ip_connection` is connected.
163    pub fn new<T: GetRequestSender>(uid: &str, req_sender: T) -> Io4Bricklet {
164        let mut result = Io4Bricklet { device: Device::new([2, 0, 1], uid, req_sender, 0) };
165        result.device.response_expected[u8::from(Io4BrickletFunction::SetValue) as usize] = ResponseExpectedFlag::False;
166        result.device.response_expected[u8::from(Io4BrickletFunction::GetValue) as usize] = ResponseExpectedFlag::AlwaysTrue;
167        result.device.response_expected[u8::from(Io4BrickletFunction::SetConfiguration) as usize] = ResponseExpectedFlag::False;
168        result.device.response_expected[u8::from(Io4BrickletFunction::GetConfiguration) as usize] = ResponseExpectedFlag::AlwaysTrue;
169        result.device.response_expected[u8::from(Io4BrickletFunction::SetDebouncePeriod) as usize] = ResponseExpectedFlag::True;
170        result.device.response_expected[u8::from(Io4BrickletFunction::GetDebouncePeriod) as usize] = ResponseExpectedFlag::AlwaysTrue;
171        result.device.response_expected[u8::from(Io4BrickletFunction::SetInterrupt) as usize] = ResponseExpectedFlag::True;
172        result.device.response_expected[u8::from(Io4BrickletFunction::GetInterrupt) as usize] = ResponseExpectedFlag::AlwaysTrue;
173        result.device.response_expected[u8::from(Io4BrickletFunction::SetMonoflop) as usize] = ResponseExpectedFlag::False;
174        result.device.response_expected[u8::from(Io4BrickletFunction::GetMonoflop) as usize] = ResponseExpectedFlag::AlwaysTrue;
175        result.device.response_expected[u8::from(Io4BrickletFunction::SetSelectedValues) as usize] = ResponseExpectedFlag::False;
176        result.device.response_expected[u8::from(Io4BrickletFunction::GetEdgeCount) as usize] = ResponseExpectedFlag::AlwaysTrue;
177        result.device.response_expected[u8::from(Io4BrickletFunction::SetEdgeCountConfig) as usize] = ResponseExpectedFlag::False;
178        result.device.response_expected[u8::from(Io4BrickletFunction::GetEdgeCountConfig) as usize] = ResponseExpectedFlag::AlwaysTrue;
179        result.device.response_expected[u8::from(Io4BrickletFunction::GetIdentity) as usize] = ResponseExpectedFlag::AlwaysTrue;
180        result
181    }
182
183    /// Returns the response expected flag for the function specified by the function ID parameter.
184    /// It is true if the function is expected to send a response, false otherwise.
185    ///
186    /// For getter functions this is enabled by default and cannot be disabled, because those
187    /// functions will always send a response. For callback configuration functions it is enabled
188    /// by default too, but can be disabled by [`set_response_expected`](crate::io4_bricklet::Io4Bricklet::set_response_expected).
189    /// For setter functions it is disabled by default and can be enabled.
190    ///
191    /// Enabling the response expected flag for a setter function allows to detect timeouts
192    /// and other error conditions calls of this setter as well. The device will then send a response
193    /// for this purpose. If this flag is disabled for a setter function then no response is sent
194    /// and errors are silently ignored, because they cannot be detected.
195    ///
196    /// See [`set_response_expected`](crate::io4_bricklet::Io4Bricklet::set_response_expected) for the list of function ID constants available for this function.
197    pub fn get_response_expected(&mut self, fun: Io4BrickletFunction) -> Result<bool, GetResponseExpectedError> {
198        self.device.get_response_expected(u8::from(fun))
199    }
200
201    /// Changes the response expected flag of the function specified by the function ID parameter.
202    /// This flag can only be changed for setter (default value: false) and callback configuration
203    /// functions (default value: true). For getter functions it is always enabled.
204    ///
205    /// Enabling the response expected flag for a setter function allows to detect timeouts and
206    /// other error conditions calls of this setter as well. The device will then send a response
207    /// for this purpose. If this flag is disabled for a setter function then no response is sent
208    /// and errors are silently ignored, because they cannot be detected.
209    pub fn set_response_expected(&mut self, fun: Io4BrickletFunction, response_expected: bool) -> Result<(), SetResponseExpectedError> {
210        self.device.set_response_expected(u8::from(fun), response_expected)
211    }
212
213    /// Changes the response expected flag for all setter and callback configuration functions of this device at once.
214    pub fn set_response_expected_all(&mut self, response_expected: bool) { self.device.set_response_expected_all(response_expected) }
215
216    /// Returns the version of the API definition (major, minor, revision) implemented by this API bindings.
217    /// This is neither the release version of this API bindings nor does it tell you anything about the represented Brick or Bricklet.
218    pub fn get_api_version(&self) -> [u8; 3] { self.device.api_version }
219
220    /// This receiver is triggered whenever a change of the voltage level is detected
221    /// on pins where the interrupt was activated with [`set_interrupt`].
222    ///
223    /// The values are a bitmask that specifies which interrupts occurred
224    /// and the current value bitmask.
225    ///
226    /// For example:
227    ///
228    /// * (1, 1) or (0b0001, 0b0001) means that an interrupt on pin 0 occurred and
229    ///   currently pin 0 is high and pins 1-3 are low.
230    /// * (9, 14) or (0b1001, 0b1110) means that interrupts on pins 0 and 3
231    ///   occurred and currently pin 0 is low and pins 1-3 are high.
232    ///
233    /// [`set_interrupt`]: #method.set_interrupt
234    pub fn get_interrupt_callback_receiver(&self) -> ConvertingCallbackReceiver<InterruptEvent> {
235        self.device.get_callback_receiver(u8::from(Io4BrickletFunction::CallbackInterrupt))
236    }
237
238    /// This receiver is triggered whenever a monoflop timer reaches 0. The
239    /// parameters contain the involved pins and the current value of the pins
240    /// (the value after the monoflop).
241    pub fn get_monoflop_done_callback_receiver(&self) -> ConvertingCallbackReceiver<MonoflopDoneEvent> {
242        self.device.get_callback_receiver(u8::from(Io4BrickletFunction::CallbackMonoflopDone))
243    }
244
245    /// Sets the output value (high or low) with a bitmask (4bit). A 1 in the bitmask
246    /// means high and a 0 in the bitmask means low.
247    ///
248    /// For example: The value 3 or 0b0011 will turn the pins 0-1 high and the
249    /// pins 2-3 low.
250    ///
251    /// All running monoflop timers will be aborted if this function is called.
252    ///
253    /// # Note
254    ///  This function does nothing for pins that are configured as input.
255    ///  Pull-up resistors can be switched on with [`set_configuration`].
256    pub fn set_value(&self, value_mask: u8) -> ConvertingReceiver<()> {
257        let mut payload = vec![0; 1];
258        payload[0..1].copy_from_slice(&<u8>::to_le_byte_vec(value_mask));
259
260        self.device.set(u8::from(Io4BrickletFunction::SetValue), payload)
261    }
262
263    /// Returns a bitmask of the values that are currently measured.
264    /// This function works if the pin is configured to input
265    /// as well as if it is configured to output.
266    pub fn get_value(&self) -> ConvertingReceiver<u8> {
267        let payload = vec![0; 0];
268
269        self.device.get(u8::from(Io4BrickletFunction::GetValue), payload)
270    }
271
272    /// Configures the value and direction of the specified pins. Possible directions
273    /// are 'i' and 'o' for input and output.
274    ///
275    /// If the direction is configured as output, the value is either high or low
276    /// (set as *true* or *false*).
277    ///
278    /// If the direction is configured as input, the value is either pull-up or
279    /// default (set as *true* or *false*).
280    ///
281    /// For example:
282    ///
283    /// * (15, 'i', true) or (0b1111, 'i', true) will set all pins of as input pull-up.
284    /// * (8, 'i', false) or (0b1000, 'i', false) will set pin 3 of as input default (floating if nothing is connected).
285    /// * (3, 'o', false) or (0b0011, 'o', false) will set pins 0 and 1 as output low.
286    /// * (4, 'o', true) or (0b0100, 'o', true) will set pin 2 of as output high.
287    ///
288    /// Running monoflop timers for the specified pins will be aborted if this
289    /// function is called.
290    ///
291    /// Associated constants:
292    /// * IO4_BRICKLET_DIRECTION_IN
293    ///	* IO4_BRICKLET_DIRECTION_OUT
294    pub fn set_configuration(&self, selection_mask: u8, direction: char, value: bool) -> ConvertingReceiver<()> {
295        let mut payload = vec![0; 3];
296        payload[0..1].copy_from_slice(&<u8>::to_le_byte_vec(selection_mask));
297        payload[1..2].copy_from_slice(&<char>::to_le_byte_vec(direction));
298        payload[2..3].copy_from_slice(&<bool>::to_le_byte_vec(value));
299
300        self.device.set(u8::from(Io4BrickletFunction::SetConfiguration), payload)
301    }
302
303    /// Returns a value bitmask and a direction bitmask. A 1 in the direction bitmask
304    /// means input and a 0 in the bitmask means output.
305    ///
306    /// For example: A return value of (3, 5) or (0b0011, 0b0101) for direction and
307    /// value means that:
308    ///
309    /// * pin 0 is configured as input pull-up,
310    /// * pin 1 is configured as input default,
311    /// * pin 2 is configured as output high and
312    /// * pin 3 is are configured as output low.
313    pub fn get_configuration(&self) -> ConvertingReceiver<Configuration> {
314        let payload = vec![0; 0];
315
316        self.device.get(u8::from(Io4BrickletFunction::GetConfiguration), payload)
317    }
318
319    /// Sets the debounce period of the [`get_interrupt_callback_receiver`] receiver.
320    ///
321    /// For example: If you set this value to 100, you will get the interrupt
322    /// maximal every 100ms. This is necessary if something that bounces is
323    /// connected to the IO-4 Bricklet, such as a button.
324    pub fn set_debounce_period(&self, debounce: u32) -> ConvertingReceiver<()> {
325        let mut payload = vec![0; 4];
326        payload[0..4].copy_from_slice(&<u32>::to_le_byte_vec(debounce));
327
328        self.device.set(u8::from(Io4BrickletFunction::SetDebouncePeriod), payload)
329    }
330
331    /// Returns the debounce period as set by [`set_debounce_period`].
332    pub fn get_debounce_period(&self) -> ConvertingReceiver<u32> {
333        let payload = vec![0; 0];
334
335        self.device.get(u8::from(Io4BrickletFunction::GetDebouncePeriod), payload)
336    }
337
338    /// Sets the pins on which an interrupt is activated with a bitmask.
339    /// Interrupts are triggered on changes of the voltage level of the pin,
340    /// i.e. changes from high to low and low to high.
341    ///
342    /// For example: An interrupt bitmask of 10 or 0b1010 will enable the interrupt for
343    /// pins 1 and 3.
344    ///
345    /// The interrupt is delivered with the [`get_interrupt_callback_receiver`] receiver.
346    pub fn set_interrupt(&self, interrupt_mask: u8) -> ConvertingReceiver<()> {
347        let mut payload = vec![0; 1];
348        payload[0..1].copy_from_slice(&<u8>::to_le_byte_vec(interrupt_mask));
349
350        self.device.set(u8::from(Io4BrickletFunction::SetInterrupt), payload)
351    }
352
353    /// Returns the interrupt bitmask as set by [`set_interrupt`].
354    pub fn get_interrupt(&self) -> ConvertingReceiver<u8> {
355        let payload = vec![0; 0];
356
357        self.device.get(u8::from(Io4BrickletFunction::GetInterrupt), payload)
358    }
359
360    /// Configures a monoflop of the pins specified by the first parameter as 4 bit
361    /// long bitmask. The specified pins must be configured for output. Non-output
362    /// pins will be ignored.
363    ///
364    /// The second parameter is a bitmask with the desired value of the specified
365    /// output pins. A 1 in the bitmask means high and a 0 in the bitmask means low.
366    ///
367    /// The third parameter indicates the time that the pins should hold
368    /// the value.
369    ///
370    /// If this function is called with the parameters (9, 1, 1500) or
371    /// (0b1001, 0b0001, 1500): Pin 0 will get high and pin 3 will get low. In 1.5s pin
372    /// 0 will get low and pin 3 will get high again.
373    ///
374    /// A monoflop can be used as a fail-safe mechanism. For example: Lets assume you
375    /// have a RS485 bus and an IO-4 Bricklet connected to one of the slave
376    /// stacks. You can now call this function every second, with a time parameter
377    /// of two seconds and pin 0 set to high. Pin 0 will be high all the time. If now
378    /// the RS485 connection is lost, then pin 0 will get low in at most two seconds.
379    pub fn set_monoflop(&self, selection_mask: u8, value_mask: u8, time: u32) -> ConvertingReceiver<()> {
380        let mut payload = vec![0; 6];
381        payload[0..1].copy_from_slice(&<u8>::to_le_byte_vec(selection_mask));
382        payload[1..2].copy_from_slice(&<u8>::to_le_byte_vec(value_mask));
383        payload[2..6].copy_from_slice(&<u32>::to_le_byte_vec(time));
384
385        self.device.set(u8::from(Io4BrickletFunction::SetMonoflop), payload)
386    }
387
388    /// Returns (for the given pin) the current value and the time as set by
389    /// [`set_monoflop`] as well as the remaining time until the value flips.
390    ///
391    /// If the timer is not running currently, the remaining time will be returned
392    /// as 0.
393    pub fn get_monoflop(&self, pin: u8) -> ConvertingReceiver<Monoflop> {
394        let mut payload = vec![0; 1];
395        payload[0..1].copy_from_slice(&<u8>::to_le_byte_vec(pin));
396
397        self.device.get(u8::from(Io4BrickletFunction::GetMonoflop), payload)
398    }
399
400    /// Sets the output value (high or low) with a bitmask, according to
401    /// the selection mask. The bitmask is 4 bit long, *true* refers to high
402    /// and *false* refers to low.
403    ///
404    /// For example: The parameters (9, 4) or (0b0110, 0b0100) will turn
405    /// pin 1 low and pin 2 high, pin 0 and 3 will remain untouched.
406    ///
407    /// Running monoflop timers for the selected pins will be aborted if this
408    /// function is called.
409    ///
410    /// # Note
411    ///  This function does nothing for pins that are configured as input.
412    ///  Pull-up resistors can be switched on with [`set_configuration`].
413    pub fn set_selected_values(&self, selection_mask: u8, value_mask: u8) -> ConvertingReceiver<()> {
414        let mut payload = vec![0; 2];
415        payload[0..1].copy_from_slice(&<u8>::to_le_byte_vec(selection_mask));
416        payload[1..2].copy_from_slice(&<u8>::to_le_byte_vec(value_mask));
417
418        self.device.set(u8::from(Io4BrickletFunction::SetSelectedValues), payload)
419    }
420
421    /// Returns the current value of the edge counter for the selected pin. You can
422    /// configure the edges that are counted with [`set_edge_count_config`].
423    ///
424    /// If you set the reset counter to *true*, the count is set back to 0
425    /// directly after it is read.
426    ///
427    ///
428    /// .. versionadded:: 2.0.1$nbsp;(Plugin)
429    pub fn get_edge_count(&self, pin: u8, reset_counter: bool) -> ConvertingReceiver<u32> {
430        let mut payload = vec![0; 2];
431        payload[0..1].copy_from_slice(&<u8>::to_le_byte_vec(pin));
432        payload[1..2].copy_from_slice(&<bool>::to_le_byte_vec(reset_counter));
433
434        self.device.get(u8::from(Io4BrickletFunction::GetEdgeCount), payload)
435    }
436
437    /// Configures the edge counter for the selected pins.
438    ///
439    /// The edge type parameter configures if rising edges, falling edges or
440    /// both are counted if the pin is configured for input. Possible edge types are:
441    ///
442    /// * 0 = rising (default)
443    /// * 1 = falling
444    /// * 2 = both
445    ///
446    /// Configuring an edge counter resets its value to 0.
447    ///
448    /// If you don't know what any of this means, just leave it at default. The
449    /// default configuration is very likely OK for you.
450    ///
451    ///
452    /// .. versionadded:: 2.0.1$nbsp;(Plugin)
453    ///
454    /// Associated constants:
455    /// * IO4_BRICKLET_EDGE_TYPE_RISING
456    ///	* IO4_BRICKLET_EDGE_TYPE_FALLING
457    ///	* IO4_BRICKLET_EDGE_TYPE_BOTH
458    pub fn set_edge_count_config(&self, selection_mask: u8, edge_type: u8, debounce: u8) -> ConvertingReceiver<()> {
459        let mut payload = vec![0; 3];
460        payload[0..1].copy_from_slice(&<u8>::to_le_byte_vec(selection_mask));
461        payload[1..2].copy_from_slice(&<u8>::to_le_byte_vec(edge_type));
462        payload[2..3].copy_from_slice(&<u8>::to_le_byte_vec(debounce));
463
464        self.device.set(u8::from(Io4BrickletFunction::SetEdgeCountConfig), payload)
465    }
466
467    /// Returns the edge type and debounce time for the selected pin as set by
468    /// [`set_edge_count_config`].
469    ///
470    ///
471    /// .. versionadded:: 2.0.1$nbsp;(Plugin)
472    ///
473    /// Associated constants:
474    /// * IO4_BRICKLET_EDGE_TYPE_RISING
475    ///	* IO4_BRICKLET_EDGE_TYPE_FALLING
476    ///	* IO4_BRICKLET_EDGE_TYPE_BOTH
477    pub fn get_edge_count_config(&self, pin: u8) -> ConvertingReceiver<EdgeCountConfig> {
478        let mut payload = vec![0; 1];
479        payload[0..1].copy_from_slice(&<u8>::to_le_byte_vec(pin));
480
481        self.device.get(u8::from(Io4BrickletFunction::GetEdgeCountConfig), payload)
482    }
483
484    /// Returns the UID, the UID where the Bricklet is connected to,
485    /// the position, the hardware and firmware version as well as the
486    /// device identifier.
487    ///
488    /// The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
489    /// A Bricklet connected to an [Isolator Bricklet](isolator_bricklet) is always at
490    /// position 'z'.
491    ///
492    /// The device identifier numbers can be found [here](device_identifier).
493    /// |device_identifier_constant|
494    pub fn get_identity(&self) -> ConvertingReceiver<Identity> {
495        let payload = vec![0; 0];
496
497        self.device.get(u8::from(Io4BrickletFunction::GetIdentity), payload)
498    }
499}