tinkerforge 2.1.24 → 2.1.25

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 (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
  # Measures color (RGB value), illuminance and color temperature
14
16
  class BrickletColorV2 < Device
@@ -94,7 +96,7 @@ module Tinkerforge
94
96
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
95
97
  # the IP Connection <tt>ipcon</tt>.
96
98
  def initialize(uid, ipcon)
97
- super uid, ipcon
99
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
98
100
 
99
101
  @api_version = [2, 0, 0]
100
102
 
@@ -124,10 +126,11 @@ module Tinkerforge
124
126
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
125
127
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
126
128
 
127
- @callback_formats[CALLBACK_COLOR] = 'S S S S'
128
- @callback_formats[CALLBACK_ILLUMINANCE] = 'L'
129
- @callback_formats[CALLBACK_COLOR_TEMPERATURE] = 'S'
129
+ @callback_formats[CALLBACK_COLOR] = [16, 'S S S S']
130
+ @callback_formats[CALLBACK_ILLUMINANCE] = [12, 'L']
131
+ @callback_formats[CALLBACK_COLOR_TEMPERATURE] = [10, 'S']
130
132
 
133
+ @ipcon.add_device self
131
134
  end
132
135
 
133
136
  # Returns the measured color of the sensor.
@@ -146,7 +149,9 @@ module Tinkerforge
146
149
  # to use the CALLBACK_COLOR callback and set the period with
147
150
  # BrickletColorV2#set_color_callback_configuration.
148
151
  def get_color
149
- send_request FUNCTION_GET_COLOR, [], '', 8, 'S S S S'
152
+ check_validity
153
+
154
+ send_request FUNCTION_GET_COLOR, [], '', 16, 'S S S S'
150
155
  end
151
156
 
152
157
  # The period is the period with which the CALLBACK_COLOR
@@ -159,13 +164,17 @@ module Tinkerforge
159
164
  # If it is set to false, the callback is continuously triggered with the period,
160
165
  # independent of the value.
161
166
  def set_color_callback_configuration(period, value_has_to_change)
162
- send_request FUNCTION_SET_COLOR_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 0, ''
167
+ check_validity
168
+
169
+ send_request FUNCTION_SET_COLOR_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
163
170
  end
164
171
 
165
172
  # Returns the callback configuration as set by
166
173
  # BrickletColorV2#set_color_callback_configuration.
167
174
  def get_color_callback_configuration
168
- send_request FUNCTION_GET_COLOR_CALLBACK_CONFIGURATION, [], '', 5, 'L ?'
175
+ check_validity
176
+
177
+ send_request FUNCTION_GET_COLOR_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
169
178
  end
170
179
 
171
180
  # Returns the illuminance affected by the gain and integration time as
@@ -183,7 +192,9 @@ module Tinkerforge
183
192
  # CALLBACK_ILLUMINANCE callback. You can set the callback configuration
184
193
  # with BrickletColorV2#set_illuminance_callback_configuration.
185
194
  def get_illuminance
186
- send_request FUNCTION_GET_ILLUMINANCE, [], '', 4, 'L'
195
+ check_validity
196
+
197
+ send_request FUNCTION_GET_ILLUMINANCE, [], '', 12, 'L'
187
198
  end
188
199
 
189
200
  # The period is the period with which the CALLBACK_ILLUMINANCE callback is triggered
@@ -212,12 +223,16 @@ module Tinkerforge
212
223
  #
213
224
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
214
225
  def set_illuminance_callback_configuration(period, value_has_to_change, option, min, max)
215
- send_request FUNCTION_SET_ILLUMINANCE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k L L', 0, ''
226
+ check_validity
227
+
228
+ send_request FUNCTION_SET_ILLUMINANCE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k L L', 8, ''
216
229
  end
217
230
 
218
231
  # Returns the callback configuration as set by BrickletColorV2#set_illuminance_callback_configuration.
219
232
  def get_illuminance_callback_configuration
220
- send_request FUNCTION_GET_ILLUMINANCE_CALLBACK_CONFIGURATION, [], '', 14, 'L ? k L L'
233
+ check_validity
234
+
235
+ send_request FUNCTION_GET_ILLUMINANCE_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k L L'
221
236
  end
222
237
 
223
238
  # Returns the color temperature.
@@ -232,7 +247,9 @@ module Tinkerforge
232
247
  # CALLBACK_COLOR_TEMPERATURE callback. You can set the callback configuration
233
248
  # with BrickletColorV2#set_color_temperature_callback_configuration.
234
249
  def get_color_temperature
235
- send_request FUNCTION_GET_COLOR_TEMPERATURE, [], '', 2, 'S'
250
+ check_validity
251
+
252
+ send_request FUNCTION_GET_COLOR_TEMPERATURE, [], '', 10, 'S'
236
253
  end
237
254
 
238
255
  # The period is the period with which the CALLBACK_COLOR_TEMPERATURE callback is triggered
@@ -261,22 +278,30 @@ module Tinkerforge
261
278
  #
262
279
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
263
280
  def set_color_temperature_callback_configuration(period, value_has_to_change, option, min, max)
264
- send_request FUNCTION_SET_COLOR_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k S S', 0, ''
281
+ check_validity
282
+
283
+ send_request FUNCTION_SET_COLOR_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k S S', 8, ''
265
284
  end
266
285
 
267
286
  # Returns the callback configuration as set by BrickletColorV2#set_color_temperature_callback_configuration.
268
287
  def get_color_temperature_callback_configuration
269
- send_request FUNCTION_GET_COLOR_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 10, 'L ? k S S'
288
+ check_validity
289
+
290
+ send_request FUNCTION_GET_COLOR_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 18, 'L ? k S S'
270
291
  end
271
292
 
272
293
  # Turns the white LED on the Bricklet on/off.
273
294
  def set_light(enable)
274
- send_request FUNCTION_SET_LIGHT, [enable], '?', 0, ''
295
+ check_validity
296
+
297
+ send_request FUNCTION_SET_LIGHT, [enable], '?', 8, ''
275
298
  end
276
299
 
277
300
  # Returns the value as set by BrickletColorV2#set_light.
278
301
  def get_light
279
- send_request FUNCTION_GET_LIGHT, [], '', 1, '?'
302
+ check_validity
303
+
304
+ send_request FUNCTION_GET_LIGHT, [], '', 9, '?'
280
305
  end
281
306
 
282
307
  # Sets the configuration of the sensor. Gain and integration time
@@ -305,12 +330,16 @@ module Tinkerforge
305
330
  # be more accurate but it will take longer to get the conversion
306
331
  # results.
307
332
  def set_configuration(gain, integration_time)
308
- send_request FUNCTION_SET_CONFIGURATION, [gain, integration_time], 'C C', 0, ''
333
+ check_validity
334
+
335
+ send_request FUNCTION_SET_CONFIGURATION, [gain, integration_time], 'C C', 8, ''
309
336
  end
310
337
 
311
338
  # Returns the configuration as set by BrickletColorV2#set_configuration.
312
339
  def get_configuration
313
- send_request FUNCTION_GET_CONFIGURATION, [], '', 2, 'C C'
340
+ check_validity
341
+
342
+ send_request FUNCTION_GET_CONFIGURATION, [], '', 10, 'C C'
314
343
  end
315
344
 
316
345
  # Returns the error count for the communication between Brick and Bricklet.
@@ -325,7 +354,9 @@ module Tinkerforge
325
354
  # The errors counts are for errors that occur on the Bricklet side. All
326
355
  # Bricks have a similar function that returns the errors on the Brick side.
327
356
  def get_spitfp_error_count
328
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
357
+ check_validity
358
+
359
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
329
360
  end
330
361
 
331
362
  # Sets the bootloader mode and returns the status after the requested
@@ -338,12 +369,16 @@ module Tinkerforge
338
369
  # This function is used by Brick Viewer during flashing. It should not be
339
370
  # necessary to call it in a normal user program.
340
371
  def set_bootloader_mode(mode)
341
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
372
+ check_validity
373
+
374
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
342
375
  end
343
376
 
344
377
  # Returns the current bootloader mode, see BrickletColorV2#set_bootloader_mode.
345
378
  def get_bootloader_mode
346
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
379
+ check_validity
380
+
381
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
347
382
  end
348
383
 
349
384
  # Sets the firmware pointer for BrickletColorV2#write_firmware. The pointer has
@@ -353,7 +388,9 @@ module Tinkerforge
353
388
  # This function is used by Brick Viewer during flashing. It should not be
354
389
  # necessary to call it in a normal user program.
355
390
  def set_write_firmware_pointer(pointer)
356
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
391
+ check_validity
392
+
393
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
357
394
  end
358
395
 
359
396
  # Writes 64 Bytes of firmware at the position as written by
@@ -365,7 +402,9 @@ module Tinkerforge
365
402
  # This function is used by Brick Viewer during flashing. It should not be
366
403
  # necessary to call it in a normal user program.
367
404
  def write_firmware(data)
368
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
405
+ check_validity
406
+
407
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
369
408
  end
370
409
 
371
410
  # Sets the status LED configuration. By default the LED shows
@@ -376,22 +415,28 @@ module Tinkerforge
376
415
  #
377
416
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
378
417
  def set_status_led_config(config)
379
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
418
+ check_validity
419
+
420
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
380
421
  end
381
422
 
382
423
  # Returns the configuration as set by BrickletColorV2#set_status_led_config
383
424
  def get_status_led_config
384
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
425
+ check_validity
426
+
427
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
385
428
  end
386
429
 
387
- # Returns the temperature in °C as measured inside the microcontroller. The
430
+ # Returns the temperature as measured inside the microcontroller. The
388
431
  # value returned is not the ambient temperature!
389
432
  #
390
433
  # The temperature is only proportional to the real temperature and it has bad
391
434
  # accuracy. Practically it is only useful as an indicator for
392
435
  # temperature changes.
393
436
  def get_chip_temperature
394
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
437
+ check_validity
438
+
439
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
395
440
  end
396
441
 
397
442
  # Calling this function will reset the Bricklet. All configurations
@@ -401,7 +446,9 @@ module Tinkerforge
401
446
  # calling functions on the existing ones will result in
402
447
  # undefined behavior!
403
448
  def reset
404
- send_request FUNCTION_RESET, [], '', 0, ''
449
+ check_validity
450
+
451
+ send_request FUNCTION_RESET, [], '', 8, ''
405
452
  end
406
453
 
407
454
  # Writes a new UID into flash. If you want to set a new UID
@@ -410,25 +457,32 @@ module Tinkerforge
410
457
  #
411
458
  # We recommend that you use Brick Viewer to change the UID.
412
459
  def write_uid(uid)
413
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
460
+ check_validity
461
+
462
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
414
463
  end
415
464
 
416
465
  # Returns the current UID as an integer. Encode as
417
466
  # Base58 to get the usual string version.
418
467
  def read_uid
419
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
468
+ check_validity
469
+
470
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
420
471
  end
421
472
 
422
473
  # Returns the UID, the UID where the Bricklet is connected to,
423
474
  # the position, the hardware and firmware version as well as the
424
475
  # device identifier.
425
476
  #
426
- # The position can be 'a', 'b', 'c' or 'd'.
477
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
478
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
479
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
480
+ # position 'z'.
427
481
  #
428
482
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
429
483
  # |device_identifier_constant|
430
484
  def get_identity
431
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
485
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
432
486
  end
433
487
 
434
488
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
@@ -1,16 +1,18 @@
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
- # 3-axis compass with 0.1mG (milli Gauss) and 0.1° resolution
15
+ # 3-axis compass with 10 nanotesla and 0.1° resolution
14
16
  class BrickletCompass < Device
15
17
  DEVICE_IDENTIFIER = 2153 # :nodoc:
16
18
  DEVICE_DISPLAY_NAME = 'Compass Bricklet' # :nodoc:
@@ -78,7 +80,7 @@ module Tinkerforge
78
80
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
79
81
  # the IP Connection <tt>ipcon</tt>.
80
82
  def initialize(uid, ipcon)
81
- super uid, ipcon
83
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
82
84
 
83
85
  @api_version = [2, 0, 0]
84
86
 
@@ -105,9 +107,10 @@ module Tinkerforge
105
107
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
106
108
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
107
109
 
108
- @callback_formats[CALLBACK_HEADING] = 's'
109
- @callback_formats[CALLBACK_MAGNETIC_FLUX_DENSITY] = 'l l l'
110
+ @callback_formats[CALLBACK_HEADING] = [10, 's']
111
+ @callback_formats[CALLBACK_MAGNETIC_FLUX_DENSITY] = [20, 'l l l']
110
112
 
113
+ @ipcon.add_device self
111
114
  end
112
115
 
113
116
  # Returns the heading (north = 0 degree, east = 90 degree).
@@ -120,7 +123,9 @@ module Tinkerforge
120
123
  # CALLBACK_HEADING callback. You can set the callback configuration
121
124
  # with BrickletCompass#set_heading_callback_configuration.
122
125
  def get_heading
123
- send_request FUNCTION_GET_HEADING, [], '', 2, 's'
126
+ check_validity
127
+
128
+ send_request FUNCTION_GET_HEADING, [], '', 10, 's'
124
129
  end
125
130
 
126
131
  # The period is the period with which the CALLBACK_HEADING callback is triggered
@@ -149,12 +154,16 @@ module Tinkerforge
149
154
  #
150
155
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
151
156
  def set_heading_callback_configuration(period, value_has_to_change, option, min, max)
152
- send_request FUNCTION_SET_HEADING_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k s s', 0, ''
157
+ check_validity
158
+
159
+ send_request FUNCTION_SET_HEADING_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k s s', 8, ''
153
160
  end
154
161
 
155
162
  # Returns the callback configuration as set by BrickletCompass#set_heading_callback_configuration.
156
163
  def get_heading_callback_configuration
157
- send_request FUNCTION_GET_HEADING_CALLBACK_CONFIGURATION, [], '', 10, 'L ? k s s'
164
+ check_validity
165
+
166
+ send_request FUNCTION_GET_HEADING_CALLBACK_CONFIGURATION, [], '', 18, 'L ? k s s'
158
167
  end
159
168
 
160
169
  # Returns the `magnetic flux density (magnetic induction) <https://en.wikipedia.org/wiki/Magnetic_flux>`__
@@ -164,7 +173,9 @@ module Tinkerforge
164
173
  # CALLBACK_MAGNETIC_FLUX_DENSITY callback. You can set the callback configuration
165
174
  # with BrickletCompass#set_magnetic_flux_density_callback_configuration.
166
175
  def get_magnetic_flux_density
167
- send_request FUNCTION_GET_MAGNETIC_FLUX_DENSITY, [], '', 12, 'l l l'
176
+ check_validity
177
+
178
+ send_request FUNCTION_GET_MAGNETIC_FLUX_DENSITY, [], '', 20, 'l l l'
168
179
  end
169
180
 
170
181
  # The period is the period with which the CALLBACK_MAGNETIC_FLUX_DENSITY callback
@@ -177,13 +188,17 @@ module Tinkerforge
177
188
  # If it is set to false, the callback is continuously triggered with the period,
178
189
  # independent of the value.
179
190
  def set_magnetic_flux_density_callback_configuration(period, value_has_to_change)
180
- send_request FUNCTION_SET_MAGNETIC_FLUX_DENSITY_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 0, ''
191
+ check_validity
192
+
193
+ send_request FUNCTION_SET_MAGNETIC_FLUX_DENSITY_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
181
194
  end
182
195
 
183
196
  # Returns the callback configuration as set by
184
197
  # BrickletCompass#set_magnetic_flux_density_callback_configuration.
185
198
  def get_magnetic_flux_density_callback_configuration
186
- send_request FUNCTION_GET_MAGNETIC_FLUX_DENSITY_CALLBACK_CONFIGURATION, [], '', 5, 'L ?'
199
+ check_validity
200
+
201
+ send_request FUNCTION_GET_MAGNETIC_FLUX_DENSITY_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
187
202
  end
188
203
 
189
204
  # Configures the data rate and background calibration.
@@ -199,12 +214,16 @@ module Tinkerforge
199
214
  # you keep the background calibration enabled and only disable it if the 20ms
200
215
  # off-time is a problem in your application.
201
216
  def set_configuration(data_rate, background_calibration)
202
- send_request FUNCTION_SET_CONFIGURATION, [data_rate, background_calibration], 'C ?', 0, ''
217
+ check_validity
218
+
219
+ send_request FUNCTION_SET_CONFIGURATION, [data_rate, background_calibration], 'C ?', 8, ''
203
220
  end
204
221
 
205
222
  # Returns the configuration as set by BrickletCompass#set_configuration.
206
223
  def get_configuration
207
- send_request FUNCTION_GET_CONFIGURATION, [], '', 2, 'C ?'
224
+ check_validity
225
+
226
+ send_request FUNCTION_GET_CONFIGURATION, [], '', 10, 'C ?'
208
227
  end
209
228
 
210
229
  # Sets offset and gain for each of the three axes.
@@ -215,12 +234,16 @@ module Tinkerforge
215
234
  # The calibration is saved in non-volatile memory and only has to be
216
235
  # done once.
217
236
  def set_calibration(offset, gain)
218
- send_request FUNCTION_SET_CALIBRATION, [offset, gain], 's3 s3', 0, ''
237
+ check_validity
238
+
239
+ send_request FUNCTION_SET_CALIBRATION, [offset, gain], 's3 s3', 8, ''
219
240
  end
220
241
 
221
242
  # Returns the calibration parameters as set by BrickletCompass#set_calibration.
222
243
  def get_calibration
223
- send_request FUNCTION_GET_CALIBRATION, [], '', 12, 's3 s3'
244
+ check_validity
245
+
246
+ send_request FUNCTION_GET_CALIBRATION, [], '', 20, 's3 s3'
224
247
  end
225
248
 
226
249
  # Returns the error count for the communication between Brick and Bricklet.
@@ -235,7 +258,9 @@ module Tinkerforge
235
258
  # The errors counts are for errors that occur on the Bricklet side. All
236
259
  # Bricks have a similar function that returns the errors on the Brick side.
237
260
  def get_spitfp_error_count
238
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
261
+ check_validity
262
+
263
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
239
264
  end
240
265
 
241
266
  # Sets the bootloader mode and returns the status after the requested
@@ -248,12 +273,16 @@ module Tinkerforge
248
273
  # This function is used by Brick Viewer during flashing. It should not be
249
274
  # necessary to call it in a normal user program.
250
275
  def set_bootloader_mode(mode)
251
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
276
+ check_validity
277
+
278
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
252
279
  end
253
280
 
254
281
  # Returns the current bootloader mode, see BrickletCompass#set_bootloader_mode.
255
282
  def get_bootloader_mode
256
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
283
+ check_validity
284
+
285
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
257
286
  end
258
287
 
259
288
  # Sets the firmware pointer for BrickletCompass#write_firmware. The pointer has
@@ -263,7 +292,9 @@ module Tinkerforge
263
292
  # This function is used by Brick Viewer during flashing. It should not be
264
293
  # necessary to call it in a normal user program.
265
294
  def set_write_firmware_pointer(pointer)
266
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
295
+ check_validity
296
+
297
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
267
298
  end
268
299
 
269
300
  # Writes 64 Bytes of firmware at the position as written by
@@ -275,7 +306,9 @@ module Tinkerforge
275
306
  # This function is used by Brick Viewer during flashing. It should not be
276
307
  # necessary to call it in a normal user program.
277
308
  def write_firmware(data)
278
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
309
+ check_validity
310
+
311
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
279
312
  end
280
313
 
281
314
  # Sets the status LED configuration. By default the LED shows
@@ -286,22 +319,28 @@ module Tinkerforge
286
319
  #
287
320
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
288
321
  def set_status_led_config(config)
289
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
322
+ check_validity
323
+
324
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
290
325
  end
291
326
 
292
327
  # Returns the configuration as set by BrickletCompass#set_status_led_config
293
328
  def get_status_led_config
294
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
329
+ check_validity
330
+
331
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
295
332
  end
296
333
 
297
- # Returns the temperature in °C as measured inside the microcontroller. The
334
+ # Returns the temperature as measured inside the microcontroller. The
298
335
  # value returned is not the ambient temperature!
299
336
  #
300
337
  # The temperature is only proportional to the real temperature and it has bad
301
338
  # accuracy. Practically it is only useful as an indicator for
302
339
  # temperature changes.
303
340
  def get_chip_temperature
304
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
341
+ check_validity
342
+
343
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
305
344
  end
306
345
 
307
346
  # Calling this function will reset the Bricklet. All configurations
@@ -311,7 +350,9 @@ module Tinkerforge
311
350
  # calling functions on the existing ones will result in
312
351
  # undefined behavior!
313
352
  def reset
314
- send_request FUNCTION_RESET, [], '', 0, ''
353
+ check_validity
354
+
355
+ send_request FUNCTION_RESET, [], '', 8, ''
315
356
  end
316
357
 
317
358
  # Writes a new UID into flash. If you want to set a new UID
@@ -320,25 +361,32 @@ module Tinkerforge
320
361
  #
321
362
  # We recommend that you use Brick Viewer to change the UID.
322
363
  def write_uid(uid)
323
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
364
+ check_validity
365
+
366
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
324
367
  end
325
368
 
326
369
  # Returns the current UID as an integer. Encode as
327
370
  # Base58 to get the usual string version.
328
371
  def read_uid
329
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
372
+ check_validity
373
+
374
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
330
375
  end
331
376
 
332
377
  # Returns the UID, the UID where the Bricklet is connected to,
333
378
  # the position, the hardware and firmware version as well as the
334
379
  # device identifier.
335
380
  #
336
- # The position can be 'a', 'b', 'c' or 'd'.
381
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
382
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
383
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
384
+ # position 'z'.
337
385
  #
338
386
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
339
387
  # |device_identifier_constant|
340
388
  def get_identity
341
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
389
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
342
390
  end
343
391
 
344
392
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.