tinkerforge 2.1.24 → 2.1.25

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tinkerforge/brick_dc.rb +155 -74
  3. data/lib/tinkerforge/brick_hat.rb +70 -30
  4. data/lib/tinkerforge/brick_hat_zero.rb +56 -22
  5. data/lib/tinkerforge/brick_imu.rb +184 -77
  6. data/lib/tinkerforge/brick_imu_v2.rb +208 -105
  7. data/lib/tinkerforge/brick_master.rb +484 -182
  8. data/lib/tinkerforge/brick_red.rb +197 -74
  9. data/lib/tinkerforge/brick_servo.rb +185 -101
  10. data/lib/tinkerforge/brick_silent_stepper.rb +246 -166
  11. data/lib/tinkerforge/brick_stepper.rb +210 -98
  12. data/lib/tinkerforge/bricklet_accelerometer.rb +58 -23
  13. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +105 -54
  14. data/lib/tinkerforge/bricklet_air_quality.rb +117 -59
  15. data/lib/tinkerforge/bricklet_ambient_light.rb +51 -21
  16. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +40 -22
  17. data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -25
  18. data/lib/tinkerforge/bricklet_analog_in.rb +63 -25
  19. data/lib/tinkerforge/bricklet_analog_in_v2.rb +57 -23
  20. data/lib/tinkerforge/bricklet_analog_in_v3.rb +67 -25
  21. data/lib/tinkerforge/bricklet_analog_out.rb +23 -9
  22. data/lib/tinkerforge/bricklet_analog_out_v2.rb +20 -8
  23. data/lib/tinkerforge/bricklet_analog_out_v3.rb +54 -20
  24. data/lib/tinkerforge/bricklet_barometer.rb +66 -26
  25. data/lib/tinkerforge/bricklet_barometer_v2.rb +99 -37
  26. data/lib/tinkerforge/bricklet_can.rb +83 -18
  27. data/lib/tinkerforge/bricklet_can_v2.rb +172 -38
  28. data/lib/tinkerforge/bricklet_co2.rb +34 -14
  29. data/lib/tinkerforge/bricklet_co2_v2.rb +97 -37
  30. data/lib/tinkerforge/bricklet_color.rb +69 -27
  31. data/lib/tinkerforge/bricklet_color_v2.rb +87 -33
  32. data/lib/tinkerforge/bricklet_compass.rb +78 -30
  33. data/lib/tinkerforge/bricklet_current12.rb +58 -24
  34. data/lib/tinkerforge/bricklet_current25.rb +58 -24
  35. data/lib/tinkerforge/bricklet_distance_ir.rb +57 -23
  36. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +83 -31
  37. data/lib/tinkerforge/bricklet_distance_us.rb +40 -16
  38. data/lib/tinkerforge/bricklet_distance_us_v2.rb +67 -25
  39. data/lib/tinkerforge/bricklet_dmx.rb +88 -34
  40. data/lib/tinkerforge/bricklet_dual_button.rb +24 -10
  41. data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -24
  42. data/lib/tinkerforge/bricklet_dual_relay.rb +27 -11
  43. data/lib/tinkerforge/bricklet_dust_detector.rb +40 -16
  44. data/lib/tinkerforge/bricklet_e_paper_296x128.rb +88 -32
  45. data/lib/tinkerforge/bricklet_energy_monitor.rb +73 -27
  46. data/lib/tinkerforge/bricklet_gps.rb +64 -26
  47. data/lib/tinkerforge/bricklet_gps_v2.rb +117 -47
  48. data/lib/tinkerforge/bricklet_hall_effect.rb +43 -23
  49. data/lib/tinkerforge/bricklet_hall_effect_v2.rb +71 -27
  50. data/lib/tinkerforge/bricklet_humidity.rb +51 -21
  51. data/lib/tinkerforge/bricklet_humidity_v2.rb +83 -31
  52. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +38 -14
  53. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +81 -29
  54. data/lib/tinkerforge/bricklet_industrial_counter.rb +101 -39
  55. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +45 -17
  56. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +77 -29
  57. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -14
  58. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +73 -27
  59. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +40 -16
  60. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +79 -29
  61. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +49 -19
  62. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +82 -30
  63. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +61 -23
  64. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -14
  65. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -25
  66. data/lib/tinkerforge/bricklet_io16.rb +55 -21
  67. data/lib/tinkerforge/bricklet_io16_v2.rb +90 -34
  68. data/lib/tinkerforge/bricklet_io4.rb +55 -23
  69. data/lib/tinkerforge/bricklet_io4_v2.rb +96 -36
  70. data/lib/tinkerforge/bricklet_isolator.rb +72 -28
  71. data/lib/tinkerforge/bricklet_joystick.rb +59 -25
  72. data/lib/tinkerforge/bricklet_joystick_v2.rb +68 -26
  73. data/lib/tinkerforge/bricklet_laser_range_finder.rb +82 -32
  74. data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +96 -36
  75. data/lib/tinkerforge/bricklet_lcd_128x64.rb +192 -70
  76. data/lib/tinkerforge/bricklet_lcd_16x2.rb +45 -18
  77. data/lib/tinkerforge/bricklet_lcd_20x4.rb +58 -23
  78. data/lib/tinkerforge/bricklet_led_strip.rb +60 -22
  79. data/lib/tinkerforge/bricklet_led_strip_v2.rb +91 -46
  80. data/lib/tinkerforge/bricklet_line.rb +34 -14
  81. data/lib/tinkerforge/bricklet_linear_poti.rb +51 -21
  82. data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -21
  83. data/lib/tinkerforge/bricklet_load_cell.rb +61 -23
  84. data/lib/tinkerforge/bricklet_load_cell_v2.rb +80 -30
  85. data/lib/tinkerforge/bricklet_moisture.rb +40 -16
  86. data/lib/tinkerforge/bricklet_motion_detector.rb +22 -10
  87. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -24
  88. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -27
  89. data/lib/tinkerforge/bricklet_multi_touch.rb +31 -13
  90. data/lib/tinkerforge/bricklet_multi_touch_v2.rb +76 -28
  91. data/lib/tinkerforge/bricklet_nfc.rb +123 -58
  92. data/lib/tinkerforge/bricklet_nfc_rfid.rb +33 -13
  93. data/lib/tinkerforge/bricklet_oled_128x64.rb +29 -11
  94. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +66 -24
  95. data/lib/tinkerforge/bricklet_oled_64x48.rb +29 -11
  96. data/lib/tinkerforge/bricklet_one_wire.rb +66 -24
  97. data/lib/tinkerforge/bricklet_outdoor_weather.rb +71 -27
  98. data/lib/tinkerforge/bricklet_particulate_matter.rb +75 -30
  99. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -9
  100. data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -10
  101. data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +80 -42
  102. data/lib/tinkerforge/bricklet_ptc.rb +74 -42
  103. data/lib/tinkerforge/bricklet_ptc_v2.rb +95 -48
  104. data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -33
  105. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -44
  106. data/lib/tinkerforge/bricklet_remote_switch.rb +39 -29
  107. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +87 -49
  108. data/lib/tinkerforge/bricklet_rgb_led.rb +18 -8
  109. data/lib/tinkerforge/bricklet_rgb_led_button.rb +62 -30
  110. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +79 -33
  111. data/lib/tinkerforge/bricklet_rgb_led_v2.rb +52 -20
  112. data/lib/tinkerforge/bricklet_rotary_encoder.rb +39 -19
  113. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -24
  114. data/lib/tinkerforge/bricklet_rotary_poti.rb +53 -28
  115. data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +57 -23
  116. data/lib/tinkerforge/bricklet_rs232.rb +90 -28
  117. data/lib/tinkerforge/bricklet_rs232_v2.rb +118 -44
  118. data/lib/tinkerforge/bricklet_rs485.rb +223 -95
  119. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +25 -14
  120. data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -35
  121. data/lib/tinkerforge/bricklet_solid_state_relay.rb +25 -13
  122. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +59 -25
  123. data/lib/tinkerforge/bricklet_sound_intensity.rb +35 -18
  124. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +72 -31
  125. data/lib/tinkerforge/bricklet_temperature.rb +40 -16
  126. data/lib/tinkerforge/bricklet_temperature_ir.rb +57 -23
  127. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +71 -27
  128. data/lib/tinkerforge/bricklet_temperature_v2.rb +61 -25
  129. data/lib/tinkerforge/bricklet_thermal_imaging.rb +105 -44
  130. data/lib/tinkerforge/bricklet_thermocouple.rb +45 -24
  131. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -27
  132. data/lib/tinkerforge/bricklet_tilt.rb +24 -10
  133. data/lib/tinkerforge/bricklet_uv_light.rb +36 -18
  134. data/lib/tinkerforge/bricklet_uv_light_v2.rb +85 -37
  135. data/lib/tinkerforge/bricklet_voltage.rb +52 -28
  136. data/lib/tinkerforge/bricklet_voltage_current.rb +91 -73
  137. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +90 -68
  138. data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +80 -30
  139. data/lib/tinkerforge/device_display_names.rb +163 -0
  140. data/lib/tinkerforge/ip_connection.rb +151 -32
  141. data/lib/tinkerforge/version.rb +1 -1
  142. metadata +3 -2
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-11-25. #
3
+ # This file was automatically generated on 2020-04-07. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.25 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # 4 galvanically isolated digital inputs
14
16
  class BrickletIndustrialDigitalIn4 < Device
@@ -51,7 +53,7 @@ module Tinkerforge
51
53
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
52
54
  # the IP Connection <tt>ipcon</tt>.
53
55
  def initialize(uid, ipcon)
54
- super uid, ipcon
56
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
55
57
 
56
58
  @api_version = [2, 0, 1]
57
59
 
@@ -68,8 +70,9 @@ module Tinkerforge
68
70
  @response_expected[FUNCTION_GET_EDGE_COUNT_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
69
71
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
70
72
 
71
- @callback_formats[CALLBACK_INTERRUPT] = 'S S'
73
+ @callback_formats[CALLBACK_INTERRUPT] = [12, 'S S']
72
74
 
75
+ @ipcon.add_device self
73
76
  end
74
77
 
75
78
  # Returns the input value with a bitmask. The bitmask is 16bit long, *true*
@@ -85,7 +88,9 @@ module Tinkerforge
85
88
  # Element 1 in the group will get pins 0-3, element 2 pins 4-7, element 3
86
89
  # pins 8-11 and element 4 pins 12-15.
87
90
  def get_value
88
- send_request FUNCTION_GET_VALUE, [], '', 2, 'S'
91
+ check_validity
92
+
93
+ send_request FUNCTION_GET_VALUE, [], '', 10, 'S'
89
94
  end
90
95
 
91
96
  # Sets a group of Digital In 4 Bricklets that should work together. You can
@@ -107,19 +112,25 @@ module Tinkerforge
107
112
  # Changing the group configuration resets all edge counter configurations
108
113
  # and values.
109
114
  def set_group(group)
110
- send_request FUNCTION_SET_GROUP, [group], 'k4', 0, ''
115
+ check_validity
116
+
117
+ send_request FUNCTION_SET_GROUP, [group], 'k4', 8, ''
111
118
  end
112
119
 
113
120
  # Returns the group as set by BrickletIndustrialDigitalIn4#set_group
114
121
  def get_group
115
- send_request FUNCTION_GET_GROUP, [], '', 4, 'k4'
122
+ check_validity
123
+
124
+ send_request FUNCTION_GET_GROUP, [], '', 12, 'k4'
116
125
  end
117
126
 
118
127
  # Returns a bitmask of ports that are available for grouping. For example the
119
128
  # value 5 or 0b0101 means: Port A and port C are connected to Bricklets that
120
129
  # can be grouped together.
121
130
  def get_available_for_group
122
- send_request FUNCTION_GET_AVAILABLE_FOR_GROUP, [], '', 1, 'C'
131
+ check_validity
132
+
133
+ send_request FUNCTION_GET_AVAILABLE_FOR_GROUP, [], '', 9, 'C'
123
134
  end
124
135
 
125
136
  # Sets the debounce period of the CALLBACK_INTERRUPT callback.
@@ -128,12 +139,16 @@ module Tinkerforge
128
139
  # maximal every 100ms. This is necessary if something that bounces is
129
140
  # connected to the Digital In 4 Bricklet, such as a button.
130
141
  def set_debounce_period(debounce)
131
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
142
+ check_validity
143
+
144
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
132
145
  end
133
146
 
134
147
  # Returns the debounce period as set by BrickletIndustrialDigitalIn4#set_debounce_period.
135
148
  def get_debounce_period
136
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
149
+ check_validity
150
+
151
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
137
152
  end
138
153
 
139
154
  # Sets the pins on which an interrupt is activated with a bitmask.
@@ -147,12 +162,16 @@ module Tinkerforge
147
162
  #
148
163
  # The interrupt is delivered with the CALLBACK_INTERRUPT callback.
149
164
  def set_interrupt(interrupt_mask)
150
- send_request FUNCTION_SET_INTERRUPT, [interrupt_mask], 'S', 0, ''
165
+ check_validity
166
+
167
+ send_request FUNCTION_SET_INTERRUPT, [interrupt_mask], 'S', 8, ''
151
168
  end
152
169
 
153
170
  # Returns the interrupt bitmask as set by BrickletIndustrialDigitalIn4#set_interrupt.
154
171
  def get_interrupt
155
- send_request FUNCTION_GET_INTERRUPT, [], '', 2, 'S'
172
+ check_validity
173
+
174
+ send_request FUNCTION_GET_INTERRUPT, [], '', 10, 'S'
156
175
  end
157
176
 
158
177
  # Returns the current value of the edge counter for the selected pin. You can
@@ -165,7 +184,9 @@ module Tinkerforge
165
184
  #
166
185
  # .. versionadded:: 2.0.1$nbsp;(Plugin)
167
186
  def get_edge_count(pin, reset_counter)
168
- send_request FUNCTION_GET_EDGE_COUNT, [pin, reset_counter], 'C ?', 4, 'L'
187
+ check_validity
188
+
189
+ send_request FUNCTION_GET_EDGE_COUNT, [pin, reset_counter], 'C ?', 12, 'L'
169
190
  end
170
191
 
171
192
  # Configures the edge counter for the selected pins. A bitmask of 9 or 0b1001 will
@@ -187,7 +208,9 @@ module Tinkerforge
187
208
  #
188
209
  # .. versionadded:: 2.0.1$nbsp;(Plugin)
189
210
  def set_edge_count_config(selection_mask, edge_type, debounce)
190
- send_request FUNCTION_SET_EDGE_COUNT_CONFIG, [selection_mask, edge_type, debounce], 'S C C', 0, ''
211
+ check_validity
212
+
213
+ send_request FUNCTION_SET_EDGE_COUNT_CONFIG, [selection_mask, edge_type, debounce], 'S C C', 8, ''
191
214
  end
192
215
 
193
216
  # Returns the edge type and debounce time for the selected pin as set by
@@ -195,19 +218,24 @@ module Tinkerforge
195
218
  #
196
219
  # .. versionadded:: 2.0.1$nbsp;(Plugin)
197
220
  def get_edge_count_config(pin)
198
- send_request FUNCTION_GET_EDGE_COUNT_CONFIG, [pin], 'C', 2, 'C C'
221
+ check_validity
222
+
223
+ send_request FUNCTION_GET_EDGE_COUNT_CONFIG, [pin], 'C', 10, 'C C'
199
224
  end
200
225
 
201
226
  # Returns the UID, the UID where the Bricklet is connected to,
202
227
  # the position, the hardware and firmware version as well as the
203
228
  # device identifier.
204
229
  #
205
- # The position can be 'a', 'b', 'c' or 'd'.
230
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
231
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
232
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
233
+ # position 'z'.
206
234
  #
207
235
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
208
236
  # |device_identifier_constant|
209
237
  def get_identity
210
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
238
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
211
239
  end
212
240
 
213
241
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-11-25. #
3
+ # This file was automatically generated on 2020-04-07. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.25 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # 4 galvanically isolated digital inputs
14
16
  class BrickletIndustrialDigitalIn4V2 < Device
@@ -84,7 +86,7 @@ module Tinkerforge
84
86
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
85
87
  # the IP Connection <tt>ipcon</tt>.
86
88
  def initialize(uid, ipcon)
87
- super uid, ipcon
89
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
88
90
 
89
91
  @api_version = [2, 0, 0]
90
92
 
@@ -111,14 +113,17 @@ module Tinkerforge
111
113
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
112
114
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
113
115
 
114
- @callback_formats[CALLBACK_VALUE] = 'C ? ?'
115
- @callback_formats[CALLBACK_ALL_VALUE] = '?4 ?4'
116
+ @callback_formats[CALLBACK_VALUE] = [11, 'C ? ?']
117
+ @callback_formats[CALLBACK_ALL_VALUE] = [10, '?4 ?4']
116
118
 
119
+ @ipcon.add_device self
117
120
  end
118
121
 
119
122
  # Returns the input value as bools, *true* refers to high and *false* refers to low.
120
123
  def get_value
121
- send_request FUNCTION_GET_VALUE, [], '', 4, '?4'
124
+ check_validity
125
+
126
+ send_request FUNCTION_GET_VALUE, [], '', 9, '?4'
122
127
  end
123
128
 
124
129
  # This callback can be configured per channel.
@@ -133,13 +138,17 @@ module Tinkerforge
133
138
  # If it is set to false, the callback is continuously triggered with the period,
134
139
  # independent of the value.
135
140
  def set_value_callback_configuration(channel, period, value_has_to_change)
136
- send_request FUNCTION_SET_VALUE_CALLBACK_CONFIGURATION, [channel, period, value_has_to_change], 'C L ?', 0, ''
141
+ check_validity
142
+
143
+ send_request FUNCTION_SET_VALUE_CALLBACK_CONFIGURATION, [channel, period, value_has_to_change], 'C L ?', 8, ''
137
144
  end
138
145
 
139
146
  # Returns the callback configuration for the given channel as set by
140
147
  # BrickletIndustrialDigitalIn4V2#set_value_callback_configuration.
141
148
  def get_value_callback_configuration(channel)
142
- send_request FUNCTION_GET_VALUE_CALLBACK_CONFIGURATION, [channel], 'C', 5, 'L ?'
149
+ check_validity
150
+
151
+ send_request FUNCTION_GET_VALUE_CALLBACK_CONFIGURATION, [channel], 'C', 13, 'L ?'
143
152
  end
144
153
 
145
154
  # The period is the period with which the CALLBACK_ALL_VALUE
@@ -152,13 +161,17 @@ module Tinkerforge
152
161
  # If it is set to false, the callback is continuously triggered with the period,
153
162
  # independent of the value.
154
163
  def set_all_value_callback_configuration(period, value_has_to_change)
155
- send_request FUNCTION_SET_ALL_VALUE_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 0, ''
164
+ check_validity
165
+
166
+ send_request FUNCTION_SET_ALL_VALUE_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
156
167
  end
157
168
 
158
169
  # Returns the callback configuration as set by
159
170
  # BrickletIndustrialDigitalIn4V2#set_all_value_callback_configuration.
160
171
  def get_all_value_callback_configuration
161
- send_request FUNCTION_GET_ALL_VALUE_CALLBACK_CONFIGURATION, [], '', 5, 'L ?'
172
+ check_validity
173
+
174
+ send_request FUNCTION_GET_ALL_VALUE_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
162
175
  end
163
176
 
164
177
  # Returns the current value of the edge counter for the selected channel. You can
@@ -167,7 +180,9 @@ module Tinkerforge
167
180
  # If you set the reset counter to *true*, the count is set back to 0
168
181
  # directly after it is read.
169
182
  def get_edge_count(channel, reset_counter)
170
- send_request FUNCTION_GET_EDGE_COUNT, [channel, reset_counter], 'C ?', 4, 'L'
183
+ check_validity
184
+
185
+ send_request FUNCTION_GET_EDGE_COUNT, [channel, reset_counter], 'C ?', 12, 'L'
171
186
  end
172
187
 
173
188
  # Configures the edge counter for a specific channel.
@@ -184,13 +199,17 @@ module Tinkerforge
184
199
  # If you don't know what any of this means, just leave it at default. The
185
200
  # default configuration is very likely OK for you.
186
201
  def set_edge_count_configuration(channel, edge_type, debounce)
187
- send_request FUNCTION_SET_EDGE_COUNT_CONFIGURATION, [channel, edge_type, debounce], 'C C C', 0, ''
202
+ check_validity
203
+
204
+ send_request FUNCTION_SET_EDGE_COUNT_CONFIGURATION, [channel, edge_type, debounce], 'C C C', 8, ''
188
205
  end
189
206
 
190
207
  # Returns the edge type and debounce time for the selected channel as set by
191
208
  # BrickletIndustrialDigitalIn4V2#set_edge_count_configuration.
192
209
  def get_edge_count_configuration(channel)
193
- send_request FUNCTION_GET_EDGE_COUNT_CONFIGURATION, [channel], 'C', 2, 'C C'
210
+ check_validity
211
+
212
+ send_request FUNCTION_GET_EDGE_COUNT_CONFIGURATION, [channel], 'C', 10, 'C C'
194
213
  end
195
214
 
196
215
  # Each channel has a corresponding LED. You can turn the LED off, on or show a
@@ -199,12 +218,16 @@ module Tinkerforge
199
218
  #
200
219
  # By default all channel LEDs are configured as "Channel Status".
201
220
  def set_channel_led_config(channel, config)
202
- send_request FUNCTION_SET_CHANNEL_LED_CONFIG, [channel, config], 'C C', 0, ''
221
+ check_validity
222
+
223
+ send_request FUNCTION_SET_CHANNEL_LED_CONFIG, [channel, config], 'C C', 8, ''
203
224
  end
204
225
 
205
226
  # Returns the channel LED configuration as set by BrickletIndustrialDigitalIn4V2#set_channel_led_config
206
227
  def get_channel_led_config(channel)
207
- send_request FUNCTION_GET_CHANNEL_LED_CONFIG, [channel], 'C', 1, 'C'
228
+ check_validity
229
+
230
+ send_request FUNCTION_GET_CHANNEL_LED_CONFIG, [channel], 'C', 9, 'C'
208
231
  end
209
232
 
210
233
  # Returns the error count for the communication between Brick and Bricklet.
@@ -219,7 +242,9 @@ module Tinkerforge
219
242
  # The errors counts are for errors that occur on the Bricklet side. All
220
243
  # Bricks have a similar function that returns the errors on the Brick side.
221
244
  def get_spitfp_error_count
222
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
245
+ check_validity
246
+
247
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
223
248
  end
224
249
 
225
250
  # Sets the bootloader mode and returns the status after the requested
@@ -232,12 +257,16 @@ module Tinkerforge
232
257
  # This function is used by Brick Viewer during flashing. It should not be
233
258
  # necessary to call it in a normal user program.
234
259
  def set_bootloader_mode(mode)
235
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
260
+ check_validity
261
+
262
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
236
263
  end
237
264
 
238
265
  # Returns the current bootloader mode, see BrickletIndustrialDigitalIn4V2#set_bootloader_mode.
239
266
  def get_bootloader_mode
240
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
267
+ check_validity
268
+
269
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
241
270
  end
242
271
 
243
272
  # Sets the firmware pointer for BrickletIndustrialDigitalIn4V2#write_firmware. The pointer has
@@ -247,7 +276,9 @@ module Tinkerforge
247
276
  # This function is used by Brick Viewer during flashing. It should not be
248
277
  # necessary to call it in a normal user program.
249
278
  def set_write_firmware_pointer(pointer)
250
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
279
+ check_validity
280
+
281
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
251
282
  end
252
283
 
253
284
  # Writes 64 Bytes of firmware at the position as written by
@@ -259,7 +290,9 @@ module Tinkerforge
259
290
  # This function is used by Brick Viewer during flashing. It should not be
260
291
  # necessary to call it in a normal user program.
261
292
  def write_firmware(data)
262
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
293
+ check_validity
294
+
295
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
263
296
  end
264
297
 
265
298
  # Sets the status LED configuration. By default the LED shows
@@ -270,22 +303,28 @@ module Tinkerforge
270
303
  #
271
304
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
272
305
  def set_status_led_config(config)
273
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
306
+ check_validity
307
+
308
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
274
309
  end
275
310
 
276
311
  # Returns the configuration as set by BrickletIndustrialDigitalIn4V2#set_status_led_config
277
312
  def get_status_led_config
278
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
313
+ check_validity
314
+
315
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
279
316
  end
280
317
 
281
- # Returns the temperature in °C as measured inside the microcontroller. The
318
+ # Returns the temperature as measured inside the microcontroller. The
282
319
  # value returned is not the ambient temperature!
283
320
  #
284
321
  # The temperature is only proportional to the real temperature and it has bad
285
322
  # accuracy. Practically it is only useful as an indicator for
286
323
  # temperature changes.
287
324
  def get_chip_temperature
288
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
325
+ check_validity
326
+
327
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
289
328
  end
290
329
 
291
330
  # Calling this function will reset the Bricklet. All configurations
@@ -295,7 +334,9 @@ module Tinkerforge
295
334
  # calling functions on the existing ones will result in
296
335
  # undefined behavior!
297
336
  def reset
298
- send_request FUNCTION_RESET, [], '', 0, ''
337
+ check_validity
338
+
339
+ send_request FUNCTION_RESET, [], '', 8, ''
299
340
  end
300
341
 
301
342
  # Writes a new UID into flash. If you want to set a new UID
@@ -304,25 +345,32 @@ module Tinkerforge
304
345
  #
305
346
  # We recommend that you use Brick Viewer to change the UID.
306
347
  def write_uid(uid)
307
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
348
+ check_validity
349
+
350
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
308
351
  end
309
352
 
310
353
  # Returns the current UID as an integer. Encode as
311
354
  # Base58 to get the usual string version.
312
355
  def read_uid
313
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
356
+ check_validity
357
+
358
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
314
359
  end
315
360
 
316
361
  # Returns the UID, the UID where the Bricklet is connected to,
317
362
  # the position, the hardware and firmware version as well as the
318
363
  # device identifier.
319
364
  #
320
- # The position can be 'a', 'b', 'c' or 'd'.
365
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
366
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
367
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
368
+ # position 'z'.
321
369
  #
322
370
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
323
371
  # |device_identifier_constant|
324
372
  def get_identity
325
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
373
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
326
374
  end
327
375
 
328
376
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-11-25. #
3
+ # This file was automatically generated on 2020-04-07. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.25 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # 4 galvanically isolated digital outputs
14
16
  class BrickletIndustrialDigitalOut4 < Device
@@ -34,7 +36,7 @@ module Tinkerforge
34
36
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
35
37
  # the IP Connection <tt>ipcon</tt>.
36
38
  def initialize(uid, ipcon)
37
- super uid, ipcon
39
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
38
40
 
39
41
  @api_version = [2, 0, 0]
40
42
 
@@ -48,8 +50,9 @@ module Tinkerforge
48
50
  @response_expected[FUNCTION_SET_SELECTED_VALUES] = RESPONSE_EXPECTED_FALSE
49
51
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
50
52
 
51
- @callback_formats[CALLBACK_MONOFLOP_DONE] = 'S S'
53
+ @callback_formats[CALLBACK_MONOFLOP_DONE] = [12, 'S S']
52
54
 
55
+ @ipcon.add_device self
53
56
  end
54
57
 
55
58
  # Sets the output value with a bitmask (16bit). A 1 in the bitmask means high
@@ -67,12 +70,16 @@ module Tinkerforge
67
70
  #
68
71
  # All running monoflop timers will be aborted if this function is called.
69
72
  def set_value(value_mask)
70
- send_request FUNCTION_SET_VALUE, [value_mask], 'S', 0, ''
73
+ check_validity
74
+
75
+ send_request FUNCTION_SET_VALUE, [value_mask], 'S', 8, ''
71
76
  end
72
77
 
73
78
  # Returns the bitmask as set by BrickletIndustrialDigitalOut4#set_value.
74
79
  def get_value
75
- send_request FUNCTION_GET_VALUE, [], '', 2, 'S'
80
+ check_validity
81
+
82
+ send_request FUNCTION_GET_VALUE, [], '', 10, 'S'
76
83
  end
77
84
 
78
85
  # Configures a monoflop of the pins specified by the first parameter
@@ -94,7 +101,9 @@ module Tinkerforge
94
101
  # of two seconds and pin 0 high. Pin 0 will be high all the time. If now
95
102
  # the RS485 connection is lost, then pin 0 will turn low in at most two seconds.
96
103
  def set_monoflop(selection_mask, value_mask, time)
97
- send_request FUNCTION_SET_MONOFLOP, [selection_mask, value_mask, time], 'S S L', 0, ''
104
+ check_validity
105
+
106
+ send_request FUNCTION_SET_MONOFLOP, [selection_mask, value_mask, time], 'S S L', 8, ''
98
107
  end
99
108
 
100
109
  # Returns (for the given pin) the current value and the time as set by
@@ -103,7 +112,9 @@ module Tinkerforge
103
112
  # If the timer is not running currently, the remaining time will be returned
104
113
  # as 0.
105
114
  def get_monoflop(pin)
106
- send_request FUNCTION_GET_MONOFLOP, [pin], 'C', 10, 'S L L'
115
+ check_validity
116
+
117
+ send_request FUNCTION_GET_MONOFLOP, [pin], 'C', 18, 'S L L'
107
118
  end
108
119
 
109
120
  # Sets a group of Digital Out 4 Bricklets that should work together. You can
@@ -122,19 +133,25 @@ module Tinkerforge
122
133
  # pins on the Digital Out 4 on port B are assigned to 4-7. It is now possible
123
134
  # to call BrickletIndustrialDigitalOut4#set_value and control two Bricklets at the same time.
124
135
  def set_group(group)
125
- send_request FUNCTION_SET_GROUP, [group], 'k4', 0, ''
136
+ check_validity
137
+
138
+ send_request FUNCTION_SET_GROUP, [group], 'k4', 8, ''
126
139
  end
127
140
 
128
141
  # Returns the group as set by BrickletIndustrialDigitalOut4#set_group
129
142
  def get_group
130
- send_request FUNCTION_GET_GROUP, [], '', 4, 'k4'
143
+ check_validity
144
+
145
+ send_request FUNCTION_GET_GROUP, [], '', 12, 'k4'
131
146
  end
132
147
 
133
148
  # Returns a bitmask of ports that are available for grouping. For example the
134
149
  # value 5 or 0b0101 means: Port A and port C are connected to Bricklets that
135
150
  # can be grouped together.
136
151
  def get_available_for_group
137
- send_request FUNCTION_GET_AVAILABLE_FOR_GROUP, [], '', 1, 'C'
152
+ check_validity
153
+
154
+ send_request FUNCTION_GET_AVAILABLE_FOR_GROUP, [], '', 9, 'C'
138
155
  end
139
156
 
140
157
  # Sets the output value with a bitmask, according to the selection mask.
@@ -154,19 +171,24 @@ module Tinkerforge
154
171
  # Running monoflop timers for the selected pins will be aborted if this function
155
172
  # is called.
156
173
  def set_selected_values(selection_mask, value_mask)
157
- send_request FUNCTION_SET_SELECTED_VALUES, [selection_mask, value_mask], 'S S', 0, ''
174
+ check_validity
175
+
176
+ send_request FUNCTION_SET_SELECTED_VALUES, [selection_mask, value_mask], 'S S', 8, ''
158
177
  end
159
178
 
160
179
  # Returns the UID, the UID where the Bricklet is connected to,
161
180
  # the position, the hardware and firmware version as well as the
162
181
  # device identifier.
163
182
  #
164
- # The position can be 'a', 'b', 'c' or 'd'.
183
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
184
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
185
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
186
+ # position 'z'.
165
187
  #
166
188
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
167
189
  # |device_identifier_constant|
168
190
  def get_identity
169
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
191
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
170
192
  end
171
193
 
172
194
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.