pub struct IndustrialDigitalIn4Bricklet { /* private fields */ }
Expand description

4 galvanically isolated digital inputs

Implementations

Creates an object with the unique device ID uid. This object can then be used after the IP Connection ip_connection is connected.

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

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 send and errors are silently ignored, because they cannot be detected.

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

This receiver is triggered whenever a change of the voltage level is detected on pins where the interrupt was activated with Set Interrupt.

The values are a bitmask that specifies which interrupts occurred and the current value bitmask.

For example:

  • (1, 1) or (0b0001, 0b0001) means that an interrupt on pin 0 occurred and currently pin 0 is high and pins 1-3 are low.
  • (9, 14) or (0b1001, 0b1110) means that interrupts on pins 0 and 3 occurred and currently pin 0 is low and pins 1-3 are high.

Returns the input value with a bitmask. The bitmask is 16bit long, true refers to high and false refers to low.

For example: The value 3 or 0b0011 means that pins 0-1 are high and the other pins are low.

If no groups are used (see Set Group), the pins correspond to the markings on the Digital In 4 Bricklet.

If groups are used, the pins correspond to the element in the group. Element 1 in the group will get pins 0-3, element 2 pins 4-7, element 3 pins 8-11 and element 4 pins 12-15.

Sets a group of Digital In 4 Bricklets that should work together. You can find Bricklets that can be grouped together with Get Available For Group.

The group consists of 4 elements. Element 1 in the group will get pins 0-3, element 2 pins 4-7, element 3 pins 8-11 and element 4 pins 12-15.

Each element can either be one of the ports (‘a’ to ‘d’) or ‘n’ if it should not be used.

For example: If you have two Digital In 4 Bricklets connected to port A and port B respectively, you could call with ['a', 'b', 'n', 'n'].

Now the pins on the Digital In 4 on port A are assigned to 0-3 and the pins on the Digital In 4 on port B are assigned to 4-7. It is now possible to call Get Value and read out two Bricklets at the same time.

Changing the group configuration resets all edge counter configurations and values.

Returns the group as set by Set Group

Returns a bitmask of ports that are available for grouping. For example the value 5 or 0b0101 means: Port A and port C are connected to Bricklets that can be grouped together.

Sets the debounce period of the get_interrupt_callback_receiver receiver in ms.

For example: If you set this value to 100, you will get the interrupt maximal every 100ms. This is necessary if something that bounces is connected to the Digital In 4 Bricklet, such as a button.

The default value is 100.

Returns the debounce period as set by Set Debounce Period.

Sets the pins on which an interrupt is activated with a bitmask. Interrupts are triggered on changes of the voltage level of the pin, i.e. changes from high to low and low to high.

For example: An interrupt bitmask of 9 or 0b1001 will enable the interrupt for pins 0 and 3.

The interrupts use the grouping as set by Set Group.

The interrupt is delivered with the get_interrupt_callback_receiver receiver.

Returns the interrupt bitmask as set by Set Interrupt.

Returns the current value of the edge counter for the selected pin. You can configure the edges that are counted with Set Edge Count Config.

If you set the reset counter to true, the count is set back to 0 directly after it is read.

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

Configures the edge counter for the selected pins. A bitmask of 9 or 0b1001 will enable the edge counter for pins 0 and 3.

The edge type parameter configures if rising edges, falling edges or both are counted if the pin is configured for input. Possible edge types are:

  • 0 = rising (default)
  • 1 = falling
  • 2 = both

The debounce time is given in ms.

Configuring an edge counter resets its value to 0.

If you don’t know what any of this means, just leave it at default. The default configuration is very likely OK for you.

Default values: 0 (edge type) and 100ms (debounce time)

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

Associated constants:

  • INDUSTRIAL_DIGITAL_IN_4BRICKLET_EDGE_TYPE_RISING
  • INDUSTRIAL_DIGITAL_IN_4BRICKLET_EDGE_TYPE_FALLING
  • INDUSTRIAL_DIGITAL_IN_4BRICKLET_EDGE_TYPE_BOTH

Returns the edge type and debounce time for the selected pin as set by Set Edge Count Config.

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

Associated constants:

  • INDUSTRIAL_DIGITAL_IN_4BRICKLET_EDGE_TYPE_RISING
  • INDUSTRIAL_DIGITAL_IN_4BRICKLET_EDGE_TYPE_FALLING
  • INDUSTRIAL_DIGITAL_IN_4BRICKLET_EDGE_TYPE_BOTH

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’ or ‘d’.

The device identifier numbers can be found here. |device_identifier_constant|

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.