tinkerforge 2.1.22 → 2.1.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. checksums.yaml +5 -5
  2. data/lib/tinkerforge/brick_dc.rb +157 -76
  3. data/lib/tinkerforge/brick_hat.rb +115 -32
  4. data/lib/tinkerforge/brick_hat_zero.rb +119 -21
  5. data/lib/tinkerforge/brick_imu.rb +192 -87
  6. data/lib/tinkerforge/brick_imu_v2.rb +220 -119
  7. data/lib/tinkerforge/brick_master.rb +498 -198
  8. data/lib/tinkerforge/brick_red.rb +197 -74
  9. data/lib/tinkerforge/brick_servo.rb +187 -103
  10. data/lib/tinkerforge/brick_silent_stepper.rb +249 -169
  11. data/lib/tinkerforge/brick_stepper.rb +214 -102
  12. data/lib/tinkerforge/bricklet_accelerometer.rb +61 -36
  13. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +167 -48
  14. data/lib/tinkerforge/bricklet_air_quality.rb +123 -76
  15. data/lib/tinkerforge/bricklet_ambient_light.rb +62 -46
  16. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +41 -28
  17. data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -28
  18. data/lib/tinkerforge/bricklet_analog_in.rb +66 -45
  19. data/lib/tinkerforge/bricklet_analog_in_v2.rb +60 -43
  20. data/lib/tinkerforge/bricklet_analog_in_v3.rb +68 -32
  21. data/lib/tinkerforge/bricklet_analog_out.rb +25 -16
  22. data/lib/tinkerforge/bricklet_analog_out_v2.rb +21 -10
  23. data/lib/tinkerforge/bricklet_analog_out_v3.rb +55 -22
  24. data/lib/tinkerforge/bricklet_barometer.rb +108 -58
  25. data/lib/tinkerforge/bricklet_barometer_v2.rb +109 -67
  26. data/lib/tinkerforge/bricklet_can.rb +84 -24
  27. data/lib/tinkerforge/bricklet_can_v2.rb +173 -72
  28. data/lib/tinkerforge/bricklet_co2.rb +36 -25
  29. data/lib/tinkerforge/bricklet_co2_v2.rb +119 -60
  30. data/lib/tinkerforge/bricklet_color.rb +77 -49
  31. data/lib/tinkerforge/bricklet_color_v2.rb +493 -0
  32. data/lib/tinkerforge/bricklet_compass.rb +397 -0
  33. data/lib/tinkerforge/bricklet_current12.rb +61 -40
  34. data/lib/tinkerforge/bricklet_current25.rb +61 -40
  35. data/lib/tinkerforge/bricklet_distance_ir.rb +60 -38
  36. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +85 -45
  37. data/lib/tinkerforge/bricklet_distance_us.rb +43 -30
  38. data/lib/tinkerforge/bricklet_distance_us_v2.rb +335 -0
  39. data/lib/tinkerforge/bricklet_dmx.rb +92 -48
  40. data/lib/tinkerforge/bricklet_dual_button.rb +23 -12
  41. data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -29
  42. data/lib/tinkerforge/bricklet_dual_relay.rb +27 -14
  43. data/lib/tinkerforge/bricklet_dust_detector.rb +43 -30
  44. data/lib/tinkerforge/bricklet_e_paper_296x128.rb +115 -63
  45. data/lib/tinkerforge/bricklet_energy_monitor.rb +416 -0
  46. data/lib/tinkerforge/bricklet_gps.rb +72 -48
  47. data/lib/tinkerforge/bricklet_gps_v2.rb +124 -73
  48. data/lib/tinkerforge/bricklet_hall_effect.rb +43 -28
  49. data/lib/tinkerforge/bricklet_hall_effect_v2.rb +76 -44
  50. data/lib/tinkerforge/bricklet_humidity.rb +54 -38
  51. data/lib/tinkerforge/bricklet_humidity_v2.rb +86 -49
  52. data/lib/tinkerforge/bricklet_imu_v3.rb +784 -0
  53. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +41 -18
  54. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +84 -40
  55. data/lib/tinkerforge/bricklet_industrial_counter.rb +102 -59
  56. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +51 -24
  57. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +79 -40
  58. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -15
  59. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +75 -33
  60. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +43 -29
  61. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +81 -44
  62. data/lib/tinkerforge/bricklet_industrial_dual_ac_relay.rb +325 -0
  63. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +51 -30
  64. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +139 -40
  65. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +63 -28
  66. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -15
  67. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -28
  68. data/lib/tinkerforge/bricklet_io16.rb +57 -32
  69. data/lib/tinkerforge/bricklet_io16_v2.rb +93 -48
  70. data/lib/tinkerforge/bricklet_io4.rb +56 -31
  71. data/lib/tinkerforge/bricklet_io4_v2.rb +109 -57
  72. data/lib/tinkerforge/bricklet_isolator.rb +111 -35
  73. data/lib/tinkerforge/bricklet_joystick.rb +63 -42
  74. data/lib/tinkerforge/bricklet_joystick_v2.rb +71 -35
  75. data/lib/tinkerforge/bricklet_laser_range_finder.rb +87 -59
  76. data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +101 -53
  77. data/lib/tinkerforge/bricklet_lcd_128x64.rb +241 -131
  78. data/lib/tinkerforge/bricklet_lcd_16x2.rb +49 -25
  79. data/lib/tinkerforge/bricklet_lcd_20x4.rb +59 -29
  80. data/lib/tinkerforge/bricklet_led_strip.rb +69 -47
  81. data/lib/tinkerforge/bricklet_led_strip_v2.rb +105 -48
  82. data/lib/tinkerforge/bricklet_line.rb +35 -22
  83. data/lib/tinkerforge/bricklet_linear_poti.rb +53 -35
  84. data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -24
  85. data/lib/tinkerforge/bricklet_load_cell.rb +64 -40
  86. data/lib/tinkerforge/bricklet_load_cell_v2.rb +81 -41
  87. data/lib/tinkerforge/bricklet_moisture.rb +43 -30
  88. data/lib/tinkerforge/bricklet_motion_detector.rb +21 -10
  89. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -29
  90. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -32
  91. data/lib/tinkerforge/bricklet_multi_touch.rb +30 -17
  92. data/lib/tinkerforge/bricklet_multi_touch_v2.rb +371 -0
  93. data/lib/tinkerforge/bricklet_nfc.rb +130 -80
  94. data/lib/tinkerforge/bricklet_nfc_rfid.rb +32 -13
  95. data/lib/tinkerforge/bricklet_oled_128x64.rb +30 -17
  96. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +97 -40
  97. data/lib/tinkerforge/bricklet_oled_64x48.rb +30 -17
  98. data/lib/tinkerforge/bricklet_one_wire.rb +65 -24
  99. data/lib/tinkerforge/bricklet_outdoor_weather.rb +84 -41
  100. data/lib/tinkerforge/bricklet_particulate_matter.rb +85 -37
  101. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -13
  102. data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -19
  103. data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +84 -57
  104. data/lib/tinkerforge/bricklet_ptc.rb +76 -51
  105. data/lib/tinkerforge/bricklet_ptc_v2.rb +96 -54
  106. data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -36
  107. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -47
  108. data/lib/tinkerforge/bricklet_remote_switch.rb +38 -29
  109. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +86 -49
  110. data/lib/tinkerforge/bricklet_rgb_led.rb +17 -8
  111. data/lib/tinkerforge/bricklet_rgb_led_button.rb +61 -30
  112. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +78 -33
  113. data/lib/tinkerforge/bricklet_rgb_led_v2.rb +51 -20
  114. data/lib/tinkerforge/bricklet_rotary_encoder.rb +40 -25
  115. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -27
  116. data/lib/tinkerforge/bricklet_rotary_poti.rb +55 -37
  117. data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +290 -0
  118. data/lib/tinkerforge/bricklet_rs232.rb +89 -28
  119. data/lib/tinkerforge/bricklet_rs232_v2.rb +121 -47
  120. data/lib/tinkerforge/bricklet_rs485.rb +303 -207
  121. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
  122. data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -36
  123. data/lib/tinkerforge/bricklet_solid_state_relay.rb +24 -13
  124. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +58 -25
  125. data/lib/tinkerforge/bricklet_sound_intensity.rb +36 -24
  126. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +77 -41
  127. data/lib/tinkerforge/bricklet_temperature.rb +43 -28
  128. data/lib/tinkerforge/bricklet_temperature_ir.rb +63 -47
  129. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +75 -53
  130. data/lib/tinkerforge/bricklet_temperature_v2.rb +62 -31
  131. data/lib/tinkerforge/bricklet_thermal_imaging.rb +118 -68
  132. data/lib/tinkerforge/bricklet_thermocouple.rb +46 -30
  133. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -30
  134. data/lib/tinkerforge/bricklet_tilt.rb +23 -10
  135. data/lib/tinkerforge/bricklet_uv_light.rb +37 -24
  136. data/lib/tinkerforge/bricklet_uv_light_v2.rb +87 -46
  137. data/lib/tinkerforge/bricklet_voltage.rb +54 -37
  138. data/lib/tinkerforge/bricklet_voltage_current.rb +94 -85
  139. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +103 -77
  140. data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +410 -0
  141. data/lib/tinkerforge/device_display_names.rb +165 -0
  142. data/lib/tinkerforge/ip_connection.rb +155 -33
  143. data/lib/tinkerforge/version.rb +1 -1
  144. metadata +14 -4
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-05-21. #
3
+ # This file was automatically generated on 2020-11-02. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.22 #
5
+ # Ruby Bindings Version 2.1.27 #
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 DC voltage between 0V and 42V
14
16
  class BrickletAnalogInV3 < Device
@@ -75,7 +77,7 @@ module Tinkerforge
75
77
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
76
78
  # the IP Connection <tt>ipcon</tt>.
77
79
  def initialize(uid, ipcon)
78
- super uid, ipcon
80
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
79
81
 
80
82
  @api_version = [2, 0, 0]
81
83
 
@@ -99,12 +101,12 @@ module Tinkerforge
99
101
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
100
102
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
101
103
 
102
- @callback_formats[CALLBACK_VOLTAGE] = 'S'
104
+ @callback_formats[CALLBACK_VOLTAGE] = [10, 'S']
103
105
 
106
+ @ipcon.add_device self
104
107
  end
105
108
 
106
- # Returns the measured voltage. The value is in mV and
107
- # between 0V and 42V. The resolution is approximately 10mV to 1mV
109
+ # Returns the measured voltage. The resolution is approximately 10mV to 1mV
108
110
  # depending on the oversampling configuration (BrickletAnalogInV3#set_oversampling).
109
111
  #
110
112
  #
@@ -112,10 +114,12 @@ module Tinkerforge
112
114
  # CALLBACK_VOLTAGE callback. You can set the callback configuration
113
115
  # with BrickletAnalogInV3#set_voltage_callback_configuration.
114
116
  def get_voltage
115
- send_request FUNCTION_GET_VOLTAGE, [], '', 2, 'S'
117
+ check_validity
118
+
119
+ send_request FUNCTION_GET_VOLTAGE, [], '', 10, 'S'
116
120
  end
117
121
 
118
- # The period in ms is the period with which the CALLBACK_VOLTAGE callback is triggered
122
+ # The period is the period with which the CALLBACK_VOLTAGE callback is triggered
119
123
  # periodically. A value of 0 turns the callback off.
120
124
  #
121
125
  # If the `value has to change`-parameter is set to true, the callback is only
@@ -140,15 +144,17 @@ module Tinkerforge
140
144
  # "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
141
145
  #
142
146
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
143
- #
144
- # The default value is (0, false, 'x', 0, 0).
145
147
  def set_voltage_callback_configuration(period, value_has_to_change, option, min, max)
146
- send_request FUNCTION_SET_VOLTAGE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k S S', 0, ''
148
+ check_validity
149
+
150
+ send_request FUNCTION_SET_VOLTAGE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k S S', 8, ''
147
151
  end
148
152
 
149
153
  # Returns the callback configuration as set by BrickletAnalogInV3#set_voltage_callback_configuration.
150
154
  def get_voltage_callback_configuration
151
- send_request FUNCTION_GET_VOLTAGE_CALLBACK_CONFIGURATION, [], '', 10, 'L ? k S S'
155
+ check_validity
156
+
157
+ send_request FUNCTION_GET_VOLTAGE_CALLBACK_CONFIGURATION, [], '', 18, 'L ? k S S'
152
158
  end
153
159
 
154
160
  # Sets the oversampling between 32x and 16384x. The Bricklet
@@ -163,15 +169,17 @@ module Tinkerforge
163
169
  # With increased oversampling the noise decreases. With decreased
164
170
  # oversampling the reaction time increases (changes in voltage will be
165
171
  # measured faster).
166
- #
167
- # The default value is 4096x.
168
172
  def set_oversampling(oversampling)
169
- send_request FUNCTION_SET_OVERSAMPLING, [oversampling], 'C', 0, ''
173
+ check_validity
174
+
175
+ send_request FUNCTION_SET_OVERSAMPLING, [oversampling], 'C', 8, ''
170
176
  end
171
177
 
172
178
  # Returns the oversampling value as set by BrickletAnalogInV3#set_oversampling.
173
179
  def get_oversampling
174
- send_request FUNCTION_GET_OVERSAMPLING, [], '', 1, 'C'
180
+ check_validity
181
+
182
+ send_request FUNCTION_GET_OVERSAMPLING, [], '', 9, 'C'
175
183
  end
176
184
 
177
185
  # Sets a calibration for the measured voltage value.
@@ -183,12 +191,16 @@ module Tinkerforge
183
191
  # the Bricklet. The calibration will be saved internally and only
184
192
  # has to be done once.
185
193
  def set_calibration(offset, multiplier, divisor)
186
- send_request FUNCTION_SET_CALIBRATION, [offset, multiplier, divisor], 's S S', 0, ''
194
+ check_validity
195
+
196
+ send_request FUNCTION_SET_CALIBRATION, [offset, multiplier, divisor], 's S S', 8, ''
187
197
  end
188
198
 
189
199
  # Returns the calibration as set by BrickletAnalogInV3#set_calibration.
190
200
  def get_calibration
191
- send_request FUNCTION_GET_CALIBRATION, [], '', 6, 's S S'
201
+ check_validity
202
+
203
+ send_request FUNCTION_GET_CALIBRATION, [], '', 14, 's S S'
192
204
  end
193
205
 
194
206
  # Returns the error count for the communication between Brick and Bricklet.
@@ -203,7 +215,9 @@ module Tinkerforge
203
215
  # The errors counts are for errors that occur on the Bricklet side. All
204
216
  # Bricks have a similar function that returns the errors on the Brick side.
205
217
  def get_spitfp_error_count
206
- 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'
207
221
  end
208
222
 
209
223
  # Sets the bootloader mode and returns the status after the requested
@@ -216,12 +230,16 @@ module Tinkerforge
216
230
  # This function is used by Brick Viewer during flashing. It should not be
217
231
  # necessary to call it in a normal user program.
218
232
  def set_bootloader_mode(mode)
219
- 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'
220
236
  end
221
237
 
222
238
  # Returns the current bootloader mode, see BrickletAnalogInV3#set_bootloader_mode.
223
239
  def get_bootloader_mode
224
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
240
+ check_validity
241
+
242
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
225
243
  end
226
244
 
227
245
  # Sets the firmware pointer for BrickletAnalogInV3#write_firmware. The pointer has
@@ -231,7 +249,9 @@ module Tinkerforge
231
249
  # This function is used by Brick Viewer during flashing. It should not be
232
250
  # necessary to call it in a normal user program.
233
251
  def set_write_firmware_pointer(pointer)
234
- 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, ''
235
255
  end
236
256
 
237
257
  # Writes 64 Bytes of firmware at the position as written by
@@ -243,7 +263,9 @@ module Tinkerforge
243
263
  # This function is used by Brick Viewer during flashing. It should not be
244
264
  # necessary to call it in a normal user program.
245
265
  def write_firmware(data)
246
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
266
+ check_validity
267
+
268
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
247
269
  end
248
270
 
249
271
  # Sets the status LED configuration. By default the LED shows
@@ -254,22 +276,28 @@ module Tinkerforge
254
276
  #
255
277
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
256
278
  def set_status_led_config(config)
257
- 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, ''
258
282
  end
259
283
 
260
284
  # Returns the configuration as set by BrickletAnalogInV3#set_status_led_config
261
285
  def get_status_led_config
262
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
286
+ check_validity
287
+
288
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
263
289
  end
264
290
 
265
- # Returns the temperature in °C as measured inside the microcontroller. The
291
+ # Returns the temperature as measured inside the microcontroller. The
266
292
  # value returned is not the ambient temperature!
267
293
  #
268
294
  # The temperature is only proportional to the real temperature and it has bad
269
295
  # accuracy. Practically it is only useful as an indicator for
270
296
  # temperature changes.
271
297
  def get_chip_temperature
272
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
298
+ check_validity
299
+
300
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
273
301
  end
274
302
 
275
303
  # Calling this function will reset the Bricklet. All configurations
@@ -279,7 +307,9 @@ module Tinkerforge
279
307
  # calling functions on the existing ones will result in
280
308
  # undefined behavior!
281
309
  def reset
282
- send_request FUNCTION_RESET, [], '', 0, ''
310
+ check_validity
311
+
312
+ send_request FUNCTION_RESET, [], '', 8, ''
283
313
  end
284
314
 
285
315
  # Writes a new UID into flash. If you want to set a new UID
@@ -288,25 +318,31 @@ module Tinkerforge
288
318
  #
289
319
  # We recommend that you use Brick Viewer to change the UID.
290
320
  def write_uid(uid)
291
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
321
+ check_validity
322
+
323
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
292
324
  end
293
325
 
294
326
  # Returns the current UID as an integer. Encode as
295
327
  # Base58 to get the usual string version.
296
328
  def read_uid
297
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
329
+ check_validity
330
+
331
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
298
332
  end
299
333
 
300
334
  # Returns the UID, the UID where the Bricklet is connected to,
301
335
  # the position, the hardware and firmware version as well as the
302
336
  # device identifier.
303
337
  #
304
- # 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
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
340
+ # position 'z'.
305
341
  #
306
342
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
307
343
  # |device_identifier_constant|
308
344
  def get_identity
309
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
345
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
310
346
  end
311
347
 
312
348
  # 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-05-21. #
3
+ # This file was automatically generated on 2020-11-02. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.22 #
5
+ # Ruby Bindings Version 2.1.27 #
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
  # Generates configurable DC voltage between 0V and 5V
14
16
  class BrickletAnalogOut < Device
@@ -29,7 +31,7 @@ module Tinkerforge
29
31
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
30
32
  # the IP Connection <tt>ipcon</tt>.
31
33
  def initialize(uid, ipcon)
32
- super uid, ipcon
34
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
33
35
 
34
36
  @api_version = [2, 0, 0]
35
37
 
@@ -40,19 +42,22 @@ module Tinkerforge
40
42
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
41
43
 
42
44
 
45
+ @ipcon.add_device self
43
46
  end
44
47
 
45
- # Sets the voltage in mV. The possible range is 0V to 5V (0-5000).
46
- # Calling this function will set the mode to 0 (see BrickletAnalogOut#set_mode).
47
- #
48
- # The default value is 0 (with mode 1).
48
+ # Sets the voltage. Calling this function will set
49
+ # the mode to 0 (see BrickletAnalogOut#set_mode).
49
50
  def set_voltage(voltage)
50
- send_request FUNCTION_SET_VOLTAGE, [voltage], 'S', 0, ''
51
+ check_validity
52
+
53
+ send_request FUNCTION_SET_VOLTAGE, [voltage], 'S', 8, ''
51
54
  end
52
55
 
53
56
  # Returns the voltage as set by BrickletAnalogOut#set_voltage.
54
57
  def get_voltage
55
- send_request FUNCTION_GET_VOLTAGE, [], '', 2, 'S'
58
+ check_validity
59
+
60
+ send_request FUNCTION_GET_VOLTAGE, [], '', 10, 'S'
56
61
  end
57
62
 
58
63
  # Sets the mode of the analog value. Possible modes:
@@ -62,29 +67,33 @@ module Tinkerforge
62
67
  # * 2: 100k Ohm resistor to ground
63
68
  # * 3: 500k Ohm resistor to ground
64
69
  #
65
- # Setting the mode to 0 will result in an output voltage of 0. You can jump
70
+ # Setting the mode to 0 will result in an output voltage of 0 V. You can jump
66
71
  # to a higher output voltage directly by calling BrickletAnalogOut#set_voltage.
67
- #
68
- # The default mode is 1.
69
72
  def set_mode(mode)
70
- send_request FUNCTION_SET_MODE, [mode], 'C', 0, ''
73
+ check_validity
74
+
75
+ send_request FUNCTION_SET_MODE, [mode], 'C', 8, ''
71
76
  end
72
77
 
73
78
  # Returns the mode as set by BrickletAnalogOut#set_mode.
74
79
  def get_mode
75
- send_request FUNCTION_GET_MODE, [], '', 1, 'C'
80
+ check_validity
81
+
82
+ send_request FUNCTION_GET_MODE, [], '', 9, 'C'
76
83
  end
77
84
 
78
85
  # Returns the UID, the UID where the Bricklet is connected to,
79
86
  # the position, the hardware and firmware version as well as the
80
87
  # device identifier.
81
88
  #
82
- # The position can be 'a', 'b', 'c' or 'd'.
89
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
90
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
91
+ # position 'z'.
83
92
  #
84
93
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
85
94
  # |device_identifier_constant|
86
95
  def get_identity
87
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
96
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
88
97
  end
89
98
 
90
99
  end
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-05-21. #
3
+ # This file was automatically generated on 2020-11-02. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.22 #
5
+ # Ruby Bindings Version 2.1.27 #
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
  # Generates configurable DC voltage between 0V and 12V
14
16
  class BrickletAnalogOutV2 < Device
@@ -24,7 +26,7 @@ module Tinkerforge
24
26
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
25
27
  # the IP Connection <tt>ipcon</tt>.
26
28
  def initialize(uid, ipcon)
27
- super uid, ipcon
29
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
28
30
 
29
31
  @api_version = [2, 0, 0]
30
32
 
@@ -34,33 +36,42 @@ module Tinkerforge
34
36
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
35
37
 
36
38
 
39
+ @ipcon.add_device self
37
40
  end
38
41
 
39
- # Sets the voltage in mV. The possible range is 0V to 12V (0-12000).
42
+ # Sets the voltage.
40
43
  def set_output_voltage(voltage)
41
- send_request FUNCTION_SET_OUTPUT_VOLTAGE, [voltage], 'S', 0, ''
44
+ check_validity
45
+
46
+ send_request FUNCTION_SET_OUTPUT_VOLTAGE, [voltage], 'S', 8, ''
42
47
  end
43
48
 
44
49
  # Returns the voltage as set by BrickletAnalogOutV2#set_output_voltage.
45
50
  def get_output_voltage
46
- send_request FUNCTION_GET_OUTPUT_VOLTAGE, [], '', 2, 'S'
51
+ check_validity
52
+
53
+ send_request FUNCTION_GET_OUTPUT_VOLTAGE, [], '', 10, 'S'
47
54
  end
48
55
 
49
- # Returns the input voltage in mV.
56
+ # Returns the input voltage.
50
57
  def get_input_voltage
51
- send_request FUNCTION_GET_INPUT_VOLTAGE, [], '', 2, 'S'
58
+ check_validity
59
+
60
+ send_request FUNCTION_GET_INPUT_VOLTAGE, [], '', 10, 'S'
52
61
  end
53
62
 
54
63
  # Returns the UID, the UID where the Bricklet is connected to,
55
64
  # the position, the hardware and firmware version as well as the
56
65
  # device identifier.
57
66
  #
58
- # The position can be 'a', 'b', 'c' or 'd'.
67
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
68
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
69
+ # position 'z'.
59
70
  #
60
71
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
61
72
  # |device_identifier_constant|
62
73
  def get_identity
63
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
74
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
64
75
  end
65
76
 
66
77
  end
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-05-21. #
3
+ # This file was automatically generated on 2020-11-02. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.22 #
5
+ # Ruby Bindings Version 2.1.27 #
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
  # Generates configurable DC voltage between 0V and 12V
14
16
  class BrickletAnalogOutV3 < Device
@@ -50,7 +52,7 @@ module Tinkerforge
50
52
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
51
53
  # the IP Connection <tt>ipcon</tt>.
52
54
  def initialize(uid, ipcon)
53
- super uid, ipcon
55
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
54
56
 
55
57
  @api_version = [2, 0, 0]
56
58
 
@@ -71,21 +73,28 @@ module Tinkerforge
71
73
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
72
74
 
73
75
 
76
+ @ipcon.add_device self
74
77
  end
75
78
 
76
- # Sets the voltage in mV. The possible range is 0V to 12V (0-12000).
79
+ # Sets the voltage.
77
80
  def set_output_voltage(voltage)
78
- send_request FUNCTION_SET_OUTPUT_VOLTAGE, [voltage], 'S', 0, ''
81
+ check_validity
82
+
83
+ send_request FUNCTION_SET_OUTPUT_VOLTAGE, [voltage], 'S', 8, ''
79
84
  end
80
85
 
81
86
  # Returns the voltage as set by BrickletAnalogOutV3#set_output_voltage.
82
87
  def get_output_voltage
83
- send_request FUNCTION_GET_OUTPUT_VOLTAGE, [], '', 2, 'S'
88
+ check_validity
89
+
90
+ send_request FUNCTION_GET_OUTPUT_VOLTAGE, [], '', 10, 'S'
84
91
  end
85
92
 
86
- # Returns the input voltage in mV.
93
+ # Returns the input voltage.
87
94
  def get_input_voltage
88
- send_request FUNCTION_GET_INPUT_VOLTAGE, [], '', 2, 'S'
95
+ check_validity
96
+
97
+ send_request FUNCTION_GET_INPUT_VOLTAGE, [], '', 10, 'S'
89
98
  end
90
99
 
91
100
  # Returns the error count for the communication between Brick and Bricklet.
@@ -100,7 +109,9 @@ module Tinkerforge
100
109
  # The errors counts are for errors that occur on the Bricklet side. All
101
110
  # Bricks have a similar function that returns the errors on the Brick side.
102
111
  def get_spitfp_error_count
103
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
112
+ check_validity
113
+
114
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
104
115
  end
105
116
 
106
117
  # Sets the bootloader mode and returns the status after the requested
@@ -113,12 +124,16 @@ module Tinkerforge
113
124
  # This function is used by Brick Viewer during flashing. It should not be
114
125
  # necessary to call it in a normal user program.
115
126
  def set_bootloader_mode(mode)
116
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
127
+ check_validity
128
+
129
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
117
130
  end
118
131
 
119
132
  # Returns the current bootloader mode, see BrickletAnalogOutV3#set_bootloader_mode.
120
133
  def get_bootloader_mode
121
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
134
+ check_validity
135
+
136
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
122
137
  end
123
138
 
124
139
  # Sets the firmware pointer for BrickletAnalogOutV3#write_firmware. The pointer has
@@ -128,7 +143,9 @@ module Tinkerforge
128
143
  # This function is used by Brick Viewer during flashing. It should not be
129
144
  # necessary to call it in a normal user program.
130
145
  def set_write_firmware_pointer(pointer)
131
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
146
+ check_validity
147
+
148
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
132
149
  end
133
150
 
134
151
  # Writes 64 Bytes of firmware at the position as written by
@@ -140,7 +157,9 @@ module Tinkerforge
140
157
  # This function is used by Brick Viewer during flashing. It should not be
141
158
  # necessary to call it in a normal user program.
142
159
  def write_firmware(data)
143
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
160
+ check_validity
161
+
162
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
144
163
  end
145
164
 
146
165
  # Sets the status LED configuration. By default the LED shows
@@ -151,22 +170,28 @@ module Tinkerforge
151
170
  #
152
171
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
153
172
  def set_status_led_config(config)
154
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
173
+ check_validity
174
+
175
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
155
176
  end
156
177
 
157
178
  # Returns the configuration as set by BrickletAnalogOutV3#set_status_led_config
158
179
  def get_status_led_config
159
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
180
+ check_validity
181
+
182
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
160
183
  end
161
184
 
162
- # Returns the temperature in °C as measured inside the microcontroller. The
185
+ # Returns the temperature as measured inside the microcontroller. The
163
186
  # value returned is not the ambient temperature!
164
187
  #
165
188
  # The temperature is only proportional to the real temperature and it has bad
166
189
  # accuracy. Practically it is only useful as an indicator for
167
190
  # temperature changes.
168
191
  def get_chip_temperature
169
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
192
+ check_validity
193
+
194
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
170
195
  end
171
196
 
172
197
  # Calling this function will reset the Bricklet. All configurations
@@ -176,7 +201,9 @@ module Tinkerforge
176
201
  # calling functions on the existing ones will result in
177
202
  # undefined behavior!
178
203
  def reset
179
- send_request FUNCTION_RESET, [], '', 0, ''
204
+ check_validity
205
+
206
+ send_request FUNCTION_RESET, [], '', 8, ''
180
207
  end
181
208
 
182
209
  # Writes a new UID into flash. If you want to set a new UID
@@ -185,25 +212,31 @@ module Tinkerforge
185
212
  #
186
213
  # We recommend that you use Brick Viewer to change the UID.
187
214
  def write_uid(uid)
188
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
215
+ check_validity
216
+
217
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
189
218
  end
190
219
 
191
220
  # Returns the current UID as an integer. Encode as
192
221
  # Base58 to get the usual string version.
193
222
  def read_uid
194
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
223
+ check_validity
224
+
225
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
195
226
  end
196
227
 
197
228
  # Returns the UID, the UID where the Bricklet is connected to,
198
229
  # the position, the hardware and firmware version as well as the
199
230
  # device identifier.
200
231
  #
201
- # The position can be 'a', 'b', 'c' or 'd'.
232
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
233
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
234
+ # position 'z'.
202
235
  #
203
236
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
204
237
  # |device_identifier_constant|
205
238
  def get_identity
206
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
239
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
207
240
  end
208
241
 
209
242
  end