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 outputs
14
16
  class BrickletIndustrialDigitalOut4V2 < Device
@@ -65,7 +67,7 @@ module Tinkerforge
65
67
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
66
68
  # the IP Connection <tt>ipcon</tt>.
67
69
  def initialize(uid, ipcon)
68
- super uid, ipcon
70
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
69
71
 
70
72
  @api_version = [2, 0, 0]
71
73
 
@@ -91,8 +93,9 @@ module Tinkerforge
91
93
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
92
94
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
93
95
 
94
- @callback_formats[CALLBACK_MONOFLOP_DONE] = 'C ?'
96
+ @callback_formats[CALLBACK_MONOFLOP_DONE] = [10, 'C ?']
95
97
 
98
+ @ipcon.add_device self
96
99
  end
97
100
 
98
101
  # Sets the output value of all four channels. A value of *true* or *false* outputs
@@ -105,12 +108,16 @@ module Tinkerforge
105
108
  # For example: (True, True, False, False) will turn the channels 0-1 high and the
106
109
  # channels 2-3 low.
107
110
  def set_value(value)
108
- send_request FUNCTION_SET_VALUE, [value], '?4', 0, ''
111
+ check_validity
112
+
113
+ send_request FUNCTION_SET_VALUE, [value], '?4', 8, ''
109
114
  end
110
115
 
111
116
  # Returns the logic levels that are currently output on the channels.
112
117
  def get_value
113
- send_request FUNCTION_GET_VALUE, [], '', 4, '?4'
118
+ check_validity
119
+
120
+ send_request FUNCTION_GET_VALUE, [], '', 9, '?4'
114
121
  end
115
122
 
116
123
  # Sets the output value of a specific channel without affecting the other channels.
@@ -118,7 +125,9 @@ module Tinkerforge
118
125
  # A running monoflop timer or PWM for the specified channel will be aborted if this
119
126
  # function is called.
120
127
  def set_selected_value(channel, value)
121
- send_request FUNCTION_SET_SELECTED_VALUE, [channel, value], 'C ?', 0, ''
128
+ check_validity
129
+
130
+ send_request FUNCTION_SET_SELECTED_VALUE, [channel, value], 'C ?', 8, ''
122
131
  end
123
132
 
124
133
  # The first parameter is the desired state of the channel (*true* means output *high*
@@ -136,7 +145,9 @@ module Tinkerforge
136
145
  # of two seconds. The channel will be *high* all the time. If now the RS485
137
146
  # connection is lost, the channel will turn *low* in at most two seconds.
138
147
  def set_monoflop(channel, value, time)
139
- send_request FUNCTION_SET_MONOFLOP, [channel, value, time], 'C ? L', 0, ''
148
+ check_validity
149
+
150
+ send_request FUNCTION_SET_MONOFLOP, [channel, value, time], 'C ? L', 8, ''
140
151
  end
141
152
 
142
153
  # Returns (for the given channel) the current value and the time as set by
@@ -145,7 +156,9 @@ module Tinkerforge
145
156
  # If the timer is not running currently, the remaining time will be returned
146
157
  # as 0.
147
158
  def get_monoflop(channel)
148
- send_request FUNCTION_GET_MONOFLOP, [channel], 'C', 9, '? L L'
159
+ check_validity
160
+
161
+ send_request FUNCTION_GET_MONOFLOP, [channel], 'C', 17, '? L L'
149
162
  end
150
163
 
151
164
  # Each channel has a corresponding LED. You can turn the LED off, on or show a
@@ -154,12 +167,16 @@ module Tinkerforge
154
167
  #
155
168
  # By default all channel LEDs are configured as "Channel Status".
156
169
  def set_channel_led_config(channel, config)
157
- send_request FUNCTION_SET_CHANNEL_LED_CONFIG, [channel, config], 'C C', 0, ''
170
+ check_validity
171
+
172
+ send_request FUNCTION_SET_CHANNEL_LED_CONFIG, [channel, config], 'C C', 8, ''
158
173
  end
159
174
 
160
175
  # Returns the channel LED configuration as set by BrickletIndustrialDigitalOut4V2#set_channel_led_config
161
176
  def get_channel_led_config(channel)
162
- send_request FUNCTION_GET_CHANNEL_LED_CONFIG, [channel], 'C', 1, 'C'
177
+ check_validity
178
+
179
+ send_request FUNCTION_GET_CHANNEL_LED_CONFIG, [channel], 'C', 9, 'C'
163
180
  end
164
181
 
165
182
  # Activates a PWM for the given channel.
@@ -174,12 +191,16 @@ module Tinkerforge
174
191
  # A running monoflop timer for the given channel will be aborted if this function
175
192
  # is called.
176
193
  def set_pwm_configuration(channel, frequency, duty_cycle)
177
- send_request FUNCTION_SET_PWM_CONFIGURATION, [channel, frequency, duty_cycle], 'C L S', 0, ''
194
+ check_validity
195
+
196
+ send_request FUNCTION_SET_PWM_CONFIGURATION, [channel, frequency, duty_cycle], 'C L S', 8, ''
178
197
  end
179
198
 
180
199
  # Returns the PWM configuration as set by BrickletIndustrialDigitalOut4V2#set_pwm_configuration.
181
200
  def get_pwm_configuration(channel)
182
- send_request FUNCTION_GET_PWM_CONFIGURATION, [channel], 'C', 6, 'L S'
201
+ check_validity
202
+
203
+ send_request FUNCTION_GET_PWM_CONFIGURATION, [channel], 'C', 14, 'L S'
183
204
  end
184
205
 
185
206
  # Returns the error count for the communication between Brick and Bricklet.
@@ -194,7 +215,9 @@ module Tinkerforge
194
215
  # The errors counts are for errors that occur on the Bricklet side. All
195
216
  # Bricks have a similar function that returns the errors on the Brick side.
196
217
  def get_spitfp_error_count
197
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
218
+ check_validity
219
+
220
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
198
221
  end
199
222
 
200
223
  # Sets the bootloader mode and returns the status after the requested
@@ -207,12 +230,16 @@ module Tinkerforge
207
230
  # This function is used by Brick Viewer during flashing. It should not be
208
231
  # necessary to call it in a normal user program.
209
232
  def set_bootloader_mode(mode)
210
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
233
+ check_validity
234
+
235
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
211
236
  end
212
237
 
213
238
  # Returns the current bootloader mode, see BrickletIndustrialDigitalOut4V2#set_bootloader_mode.
214
239
  def get_bootloader_mode
215
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
240
+ check_validity
241
+
242
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
216
243
  end
217
244
 
218
245
  # Sets the firmware pointer for BrickletIndustrialDigitalOut4V2#write_firmware. The pointer has
@@ -222,7 +249,9 @@ module Tinkerforge
222
249
  # This function is used by Brick Viewer during flashing. It should not be
223
250
  # necessary to call it in a normal user program.
224
251
  def set_write_firmware_pointer(pointer)
225
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
252
+ check_validity
253
+
254
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
226
255
  end
227
256
 
228
257
  # Writes 64 Bytes of firmware at the position as written by
@@ -234,7 +263,9 @@ module Tinkerforge
234
263
  # This function is used by Brick Viewer during flashing. It should not be
235
264
  # necessary to call it in a normal user program.
236
265
  def write_firmware(data)
237
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
266
+ check_validity
267
+
268
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
238
269
  end
239
270
 
240
271
  # Sets the status LED configuration. By default the LED shows
@@ -245,22 +276,28 @@ module Tinkerforge
245
276
  #
246
277
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
247
278
  def set_status_led_config(config)
248
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
279
+ check_validity
280
+
281
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
249
282
  end
250
283
 
251
284
  # Returns the configuration as set by BrickletIndustrialDigitalOut4V2#set_status_led_config
252
285
  def get_status_led_config
253
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
286
+ check_validity
287
+
288
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
254
289
  end
255
290
 
256
- # Returns the temperature in °C as measured inside the microcontroller. The
291
+ # Returns the temperature as measured inside the microcontroller. The
257
292
  # value returned is not the ambient temperature!
258
293
  #
259
294
  # The temperature is only proportional to the real temperature and it has bad
260
295
  # accuracy. Practically it is only useful as an indicator for
261
296
  # temperature changes.
262
297
  def get_chip_temperature
263
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
298
+ check_validity
299
+
300
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
264
301
  end
265
302
 
266
303
  # Calling this function will reset the Bricklet. All configurations
@@ -270,7 +307,9 @@ module Tinkerforge
270
307
  # calling functions on the existing ones will result in
271
308
  # undefined behavior!
272
309
  def reset
273
- send_request FUNCTION_RESET, [], '', 0, ''
310
+ check_validity
311
+
312
+ send_request FUNCTION_RESET, [], '', 8, ''
274
313
  end
275
314
 
276
315
  # Writes a new UID into flash. If you want to set a new UID
@@ -279,25 +318,32 @@ module Tinkerforge
279
318
  #
280
319
  # We recommend that you use Brick Viewer to change the UID.
281
320
  def write_uid(uid)
282
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
321
+ check_validity
322
+
323
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
283
324
  end
284
325
 
285
326
  # Returns the current UID as an integer. Encode as
286
327
  # Base58 to get the usual string version.
287
328
  def read_uid
288
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
329
+ check_validity
330
+
331
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
289
332
  end
290
333
 
291
334
  # Returns the UID, the UID where the Bricklet is connected to,
292
335
  # the position, the hardware and firmware version as well as the
293
336
  # device identifier.
294
337
  #
295
- # The position can be 'a', 'b', 'c' or 'd'.
338
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
339
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
340
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
341
+ # position 'z'.
296
342
  #
297
343
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
298
344
  # |device_identifier_constant|
299
345
  def get_identity
300
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
346
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
301
347
  end
302
348
 
303
349
  # 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
  # Measures two DC currents between 0mA and 20mA (IEC 60381-1)
14
16
  class BrickletIndustrialDual020mA < Device
@@ -55,7 +57,7 @@ module Tinkerforge
55
57
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
56
58
  # the IP Connection <tt>ipcon</tt>.
57
59
  def initialize(uid, ipcon)
58
- super uid, ipcon
60
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
59
61
 
60
62
  @api_version = [2, 0, 0]
61
63
 
@@ -70,9 +72,10 @@ module Tinkerforge
70
72
  @response_expected[FUNCTION_GET_SAMPLE_RATE] = RESPONSE_EXPECTED_ALWAYS_TRUE
71
73
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
72
74
 
73
- @callback_formats[CALLBACK_CURRENT] = 'C l'
74
- @callback_formats[CALLBACK_CURRENT_REACHED] = 'C l'
75
+ @callback_formats[CALLBACK_CURRENT] = [13, 'C l']
76
+ @callback_formats[CALLBACK_CURRENT_REACHED] = [13, 'C l']
75
77
 
78
+ @ipcon.add_device self
76
79
  end
77
80
 
78
81
  # Returns the current of the specified sensor.
@@ -88,7 +91,9 @@ module Tinkerforge
88
91
  # CALLBACK_CURRENT callback and set the period with
89
92
  # BrickletIndustrialDual020mA#set_current_callback_period.
90
93
  def get_current(sensor)
91
- send_request FUNCTION_GET_CURRENT, [sensor], 'C', 4, 'l'
94
+ check_validity
95
+
96
+ send_request FUNCTION_GET_CURRENT, [sensor], 'C', 12, 'l'
92
97
  end
93
98
 
94
99
  # Sets the period with which the CALLBACK_CURRENT callback is triggered
@@ -97,12 +102,16 @@ module Tinkerforge
97
102
  # The CALLBACK_CURRENT callback is only triggered if the current has changed since the
98
103
  # last triggering.
99
104
  def set_current_callback_period(sensor, period)
100
- send_request FUNCTION_SET_CURRENT_CALLBACK_PERIOD, [sensor, period], 'C L', 0, ''
105
+ check_validity
106
+
107
+ send_request FUNCTION_SET_CURRENT_CALLBACK_PERIOD, [sensor, period], 'C L', 8, ''
101
108
  end
102
109
 
103
110
  # Returns the period as set by BrickletIndustrialDual020mA#set_current_callback_period.
104
111
  def get_current_callback_period(sensor)
105
- send_request FUNCTION_GET_CURRENT_CALLBACK_PERIOD, [sensor], 'C', 4, 'L'
112
+ check_validity
113
+
114
+ send_request FUNCTION_GET_CURRENT_CALLBACK_PERIOD, [sensor], 'C', 12, 'L'
106
115
  end
107
116
 
108
117
  # Sets the thresholds for the CALLBACK_CURRENT_REACHED callback for the given
@@ -118,12 +127,16 @@ module Tinkerforge
118
127
  # "'<'", "Callback is triggered when the current is smaller than the min value (max is ignored)"
119
128
  # "'>'", "Callback is triggered when the current is greater than the min value (max is ignored)"
120
129
  def set_current_callback_threshold(sensor, option, min, max)
121
- send_request FUNCTION_SET_CURRENT_CALLBACK_THRESHOLD, [sensor, option, min, max], 'C k l l', 0, ''
130
+ check_validity
131
+
132
+ send_request FUNCTION_SET_CURRENT_CALLBACK_THRESHOLD, [sensor, option, min, max], 'C k l l', 8, ''
122
133
  end
123
134
 
124
135
  # Returns the threshold as set by BrickletIndustrialDual020mA#set_current_callback_threshold.
125
136
  def get_current_callback_threshold(sensor)
126
- send_request FUNCTION_GET_CURRENT_CALLBACK_THRESHOLD, [sensor], 'C', 9, 'k l l'
137
+ check_validity
138
+
139
+ send_request FUNCTION_GET_CURRENT_CALLBACK_THRESHOLD, [sensor], 'C', 17, 'k l l'
127
140
  end
128
141
 
129
142
  # Sets the period with which the threshold callback
@@ -136,12 +149,16 @@ module Tinkerforge
136
149
  #
137
150
  # keeps being reached.
138
151
  def set_debounce_period(debounce)
139
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
152
+ check_validity
153
+
154
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
140
155
  end
141
156
 
142
157
  # Returns the debounce period as set by BrickletIndustrialDual020mA#set_debounce_period.
143
158
  def get_debounce_period
144
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
159
+ check_validity
160
+
161
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
145
162
  end
146
163
 
147
164
  # Sets the sample rate to either 240, 60, 15 or 4 samples per second.
@@ -154,24 +171,31 @@ module Tinkerforge
154
171
  # "2", "15 samples per second, 16 bit resolution"
155
172
  # "3", "4 samples per second, 18 bit resolution"
156
173
  def set_sample_rate(rate)
157
- send_request FUNCTION_SET_SAMPLE_RATE, [rate], 'C', 0, ''
174
+ check_validity
175
+
176
+ send_request FUNCTION_SET_SAMPLE_RATE, [rate], 'C', 8, ''
158
177
  end
159
178
 
160
179
  # Returns the sample rate as set by BrickletIndustrialDual020mA#set_sample_rate.
161
180
  def get_sample_rate
162
- send_request FUNCTION_GET_SAMPLE_RATE, [], '', 1, 'C'
181
+ check_validity
182
+
183
+ send_request FUNCTION_GET_SAMPLE_RATE, [], '', 9, 'C'
163
184
  end
164
185
 
165
186
  # Returns the UID, the UID where the Bricklet is connected to,
166
187
  # the position, the hardware and firmware version as well as the
167
188
  # device identifier.
168
189
  #
169
- # The position can be 'a', 'b', 'c' or 'd'.
190
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
191
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
192
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
193
+ # position 'z'.
170
194
  #
171
195
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
172
196
  # |device_identifier_constant|
173
197
  def get_identity
174
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
198
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
175
199
  end
176
200
 
177
201
  # 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
  # Measures two DC currents between 0mA and 20mA (IEC 60381-1)
14
16
  class BrickletIndustrialDual020mAV2 < Device
@@ -83,7 +85,7 @@ module Tinkerforge
83
85
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
84
86
  # the IP Connection <tt>ipcon</tt>.
85
87
  def initialize(uid, ipcon)
86
- super uid, ipcon
88
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
87
89
 
88
90
  @api_version = [2, 0, 0]
89
91
 
@@ -111,8 +113,9 @@ 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_CURRENT] = 'C l'
116
+ @callback_formats[CALLBACK_CURRENT] = [13, 'C l']
115
117
 
118
+ @ipcon.add_device self
116
119
  end
117
120
 
118
121
  # Returns the current of the specified channel.
@@ -129,7 +132,9 @@ module Tinkerforge
129
132
  # CALLBACK_CURRENT callback. You can set the callback configuration
130
133
  # with BrickletIndustrialDual020mAV2#set_current_callback_configuration.
131
134
  def get_current(channel)
132
- send_request FUNCTION_GET_CURRENT, [channel], 'C', 4, 'l'
135
+ check_validity
136
+
137
+ send_request FUNCTION_GET_CURRENT, [channel], 'C', 12, 'l'
133
138
  end
134
139
 
135
140
  # The period is the period with which the CALLBACK_CURRENT callback is triggered
@@ -158,12 +163,16 @@ module Tinkerforge
158
163
  #
159
164
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
160
165
  def set_current_callback_configuration(channel, period, value_has_to_change, option, min, max)
161
- send_request FUNCTION_SET_CURRENT_CALLBACK_CONFIGURATION, [channel, period, value_has_to_change, option, min, max], 'C L ? k l l', 0, ''
166
+ check_validity
167
+
168
+ send_request FUNCTION_SET_CURRENT_CALLBACK_CONFIGURATION, [channel, period, value_has_to_change, option, min, max], 'C L ? k l l', 8, ''
162
169
  end
163
170
 
164
171
  # Returns the callback configuration as set by BrickletIndustrialDual020mAV2#set_current_callback_configuration.
165
172
  def get_current_callback_configuration(channel)
166
- send_request FUNCTION_GET_CURRENT_CALLBACK_CONFIGURATION, [channel], 'C', 14, 'L ? k l l'
173
+ check_validity
174
+
175
+ send_request FUNCTION_GET_CURRENT_CALLBACK_CONFIGURATION, [channel], 'C', 22, 'L ? k l l'
167
176
  end
168
177
 
169
178
  # Sets the sample rate to either 240, 60, 15 or 4 samples per second.
@@ -176,12 +185,16 @@ module Tinkerforge
176
185
  # "2", "15 samples per second, 16 bit resolution"
177
186
  # "3", "4 samples per second, 18 bit resolution"
178
187
  def set_sample_rate(rate)
179
- send_request FUNCTION_SET_SAMPLE_RATE, [rate], 'C', 0, ''
188
+ check_validity
189
+
190
+ send_request FUNCTION_SET_SAMPLE_RATE, [rate], 'C', 8, ''
180
191
  end
181
192
 
182
193
  # Returns the gain as set by BrickletIndustrialDual020mAV2#set_sample_rate.
183
194
  def get_sample_rate
184
- send_request FUNCTION_GET_SAMPLE_RATE, [], '', 1, 'C'
195
+ check_validity
196
+
197
+ send_request FUNCTION_GET_SAMPLE_RATE, [], '', 9, 'C'
185
198
  end
186
199
 
187
200
  # Sets a gain between 1x and 8x. If you want to measure a very small current,
@@ -190,12 +203,16 @@ module Tinkerforge
190
203
  # Example: If you measure 0.5mA with a gain of 8x the return value will be
191
204
  # 4mA.
192
205
  def set_gain(gain)
193
- send_request FUNCTION_SET_GAIN, [gain], 'C', 0, ''
206
+ check_validity
207
+
208
+ send_request FUNCTION_SET_GAIN, [gain], 'C', 8, ''
194
209
  end
195
210
 
196
211
  # Returns the gain as set by BrickletIndustrialDual020mAV2#set_gain.
197
212
  def get_gain
198
- send_request FUNCTION_GET_GAIN, [], '', 1, 'C'
213
+ check_validity
214
+
215
+ send_request FUNCTION_GET_GAIN, [], '', 9, 'C'
199
216
  end
200
217
 
201
218
  # Each channel has a corresponding LED. You can turn the LED off, on or show a
@@ -205,12 +222,16 @@ module Tinkerforge
205
222
  #
206
223
  # You can configure the channel status behavior with BrickletIndustrialDual020mAV2#set_channel_led_status_config.
207
224
  def set_channel_led_config(channel, config)
208
- send_request FUNCTION_SET_CHANNEL_LED_CONFIG, [channel, config], 'C C', 0, ''
225
+ check_validity
226
+
227
+ send_request FUNCTION_SET_CHANNEL_LED_CONFIG, [channel, config], 'C C', 8, ''
209
228
  end
210
229
 
211
230
  # Returns the channel LED configuration as set by BrickletIndustrialDual020mAV2#set_channel_led_config
212
231
  def get_channel_led_config(channel)
213
- send_request FUNCTION_GET_CHANNEL_LED_CONFIG, [channel], 'C', 1, 'C'
232
+ check_validity
233
+
234
+ send_request FUNCTION_GET_CHANNEL_LED_CONFIG, [channel], 'C', 9, 'C'
214
235
  end
215
236
 
216
237
  # Sets the channel LED status config. This config is used if the channel LED is
@@ -234,13 +255,17 @@ module Tinkerforge
234
255
  # 4mA and 20mA. If the min value is greater than the max value, the LED brightness
235
256
  # is scaled the other way around.
236
257
  def set_channel_led_status_config(channel, min, max, config)
237
- send_request FUNCTION_SET_CHANNEL_LED_STATUS_CONFIG, [channel, min, max, config], 'C l l C', 0, ''
258
+ check_validity
259
+
260
+ send_request FUNCTION_SET_CHANNEL_LED_STATUS_CONFIG, [channel, min, max, config], 'C l l C', 8, ''
238
261
  end
239
262
 
240
263
  # Returns the channel LED status configuration as set by
241
264
  # BrickletIndustrialDual020mAV2#set_channel_led_status_config.
242
265
  def get_channel_led_status_config(channel)
243
- send_request FUNCTION_GET_CHANNEL_LED_STATUS_CONFIG, [channel], 'C', 9, 'l l C'
266
+ check_validity
267
+
268
+ send_request FUNCTION_GET_CHANNEL_LED_STATUS_CONFIG, [channel], 'C', 17, 'l l C'
244
269
  end
245
270
 
246
271
  # Returns the error count for the communication between Brick and Bricklet.
@@ -255,7 +280,9 @@ module Tinkerforge
255
280
  # The errors counts are for errors that occur on the Bricklet side. All
256
281
  # Bricks have a similar function that returns the errors on the Brick side.
257
282
  def get_spitfp_error_count
258
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
283
+ check_validity
284
+
285
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
259
286
  end
260
287
 
261
288
  # Sets the bootloader mode and returns the status after the requested
@@ -268,12 +295,16 @@ module Tinkerforge
268
295
  # This function is used by Brick Viewer during flashing. It should not be
269
296
  # necessary to call it in a normal user program.
270
297
  def set_bootloader_mode(mode)
271
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
298
+ check_validity
299
+
300
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
272
301
  end
273
302
 
274
303
  # Returns the current bootloader mode, see BrickletIndustrialDual020mAV2#set_bootloader_mode.
275
304
  def get_bootloader_mode
276
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
305
+ check_validity
306
+
307
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
277
308
  end
278
309
 
279
310
  # Sets the firmware pointer for BrickletIndustrialDual020mAV2#write_firmware. The pointer has
@@ -283,7 +314,9 @@ module Tinkerforge
283
314
  # This function is used by Brick Viewer during flashing. It should not be
284
315
  # necessary to call it in a normal user program.
285
316
  def set_write_firmware_pointer(pointer)
286
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
317
+ check_validity
318
+
319
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
287
320
  end
288
321
 
289
322
  # Writes 64 Bytes of firmware at the position as written by
@@ -295,7 +328,9 @@ module Tinkerforge
295
328
  # This function is used by Brick Viewer during flashing. It should not be
296
329
  # necessary to call it in a normal user program.
297
330
  def write_firmware(data)
298
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
331
+ check_validity
332
+
333
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
299
334
  end
300
335
 
301
336
  # Sets the status LED configuration. By default the LED shows
@@ -306,22 +341,28 @@ module Tinkerforge
306
341
  #
307
342
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
308
343
  def set_status_led_config(config)
309
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
344
+ check_validity
345
+
346
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
310
347
  end
311
348
 
312
349
  # Returns the configuration as set by BrickletIndustrialDual020mAV2#set_status_led_config
313
350
  def get_status_led_config
314
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
351
+ check_validity
352
+
353
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
315
354
  end
316
355
 
317
- # Returns the temperature in °C as measured inside the microcontroller. The
356
+ # Returns the temperature as measured inside the microcontroller. The
318
357
  # value returned is not the ambient temperature!
319
358
  #
320
359
  # The temperature is only proportional to the real temperature and it has bad
321
360
  # accuracy. Practically it is only useful as an indicator for
322
361
  # temperature changes.
323
362
  def get_chip_temperature
324
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
363
+ check_validity
364
+
365
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
325
366
  end
326
367
 
327
368
  # Calling this function will reset the Bricklet. All configurations
@@ -331,7 +372,9 @@ module Tinkerforge
331
372
  # calling functions on the existing ones will result in
332
373
  # undefined behavior!
333
374
  def reset
334
- send_request FUNCTION_RESET, [], '', 0, ''
375
+ check_validity
376
+
377
+ send_request FUNCTION_RESET, [], '', 8, ''
335
378
  end
336
379
 
337
380
  # Writes a new UID into flash. If you want to set a new UID
@@ -340,25 +383,32 @@ module Tinkerforge
340
383
  #
341
384
  # We recommend that you use Brick Viewer to change the UID.
342
385
  def write_uid(uid)
343
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
386
+ check_validity
387
+
388
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
344
389
  end
345
390
 
346
391
  # Returns the current UID as an integer. Encode as
347
392
  # Base58 to get the usual string version.
348
393
  def read_uid
349
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
394
+ check_validity
395
+
396
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
350
397
  end
351
398
 
352
399
  # Returns the UID, the UID where the Bricklet is connected to,
353
400
  # the position, the hardware and firmware version as well as the
354
401
  # device identifier.
355
402
  #
356
- # The position can be 'a', 'b', 'c' or 'd'.
403
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
404
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
405
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
406
+ # position 'z'.
357
407
  #
358
408
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
359
409
  # |device_identifier_constant|
360
410
  def get_identity
361
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
411
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
362
412
  end
363
413
 
364
414
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.