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
  # Reads temperatures from Pt100 und Pt1000 sensors
14
16
  class BrickletPTCV2 < Device
@@ -90,7 +92,7 @@ module Tinkerforge
90
92
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
91
93
  # the IP Connection <tt>ipcon</tt>.
92
94
  def initialize(uid, ipcon)
93
- super uid, ipcon
95
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
94
96
 
95
97
  @api_version = [2, 0, 0]
96
98
 
@@ -122,25 +124,26 @@ module Tinkerforge
122
124
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
123
125
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
124
126
 
125
- @callback_formats[CALLBACK_TEMPERATURE] = 'l'
126
- @callback_formats[CALLBACK_RESISTANCE] = 'l'
127
- @callback_formats[CALLBACK_SENSOR_CONNECTED] = '?'
127
+ @callback_formats[CALLBACK_TEMPERATURE] = [12, 'l']
128
+ @callback_formats[CALLBACK_RESISTANCE] = [12, 'l']
129
+ @callback_formats[CALLBACK_SENSOR_CONNECTED] = [9, '?']
128
130
 
131
+ @ipcon.add_device self
129
132
  end
130
133
 
131
- # Returns the temperature of the connected sensor. The value
132
- # has a range of -246 to 849 °C and is given in °C/100,
133
- # e.g. a value of 4223 means that a temperature of 42.23 °C is measured.
134
+ # Returns the temperature of the connected sensor.
134
135
  #
135
136
  #
136
137
  # If you want to get the value periodically, it is recommended to use the
137
138
  # CALLBACK_TEMPERATURE callback. You can set the callback configuration
138
139
  # with BrickletPTCV2#set_temperature_callback_configuration.
139
140
  def get_temperature
140
- send_request FUNCTION_GET_TEMPERATURE, [], '', 4, 'l'
141
+ check_validity
142
+
143
+ send_request FUNCTION_GET_TEMPERATURE, [], '', 12, 'l'
141
144
  end
142
145
 
143
- # The period in ms is the period with which the CALLBACK_TEMPERATURE callback is triggered
146
+ # The period is the period with which the CALLBACK_TEMPERATURE callback is triggered
144
147
  # periodically. A value of 0 turns the callback off.
145
148
  #
146
149
  # If the `value has to change`-parameter is set to true, the callback is only
@@ -165,15 +168,17 @@ module Tinkerforge
165
168
  # "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
166
169
  #
167
170
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
168
- #
169
- # The default value is (0, false, 'x', 0, 0).
170
171
  def set_temperature_callback_configuration(period, value_has_to_change, option, min, max)
171
- send_request FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 0, ''
172
+ check_validity
173
+
174
+ send_request FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 8, ''
172
175
  end
173
176
 
174
177
  # Returns the callback configuration as set by BrickletPTCV2#set_temperature_callback_configuration.
175
178
  def get_temperature_callback_configuration
176
- send_request FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 14, 'L ? k l l'
179
+ check_validity
180
+
181
+ send_request FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k l l'
177
182
  end
178
183
 
179
184
  # Returns the value as measured by the MAX31865 precision delta-sigma ADC.
@@ -188,10 +193,12 @@ module Tinkerforge
188
193
  # CALLBACK_RESISTANCE callback. You can set the callback configuration
189
194
  # with BrickletPTCV2#set_resistance_callback_configuration.
190
195
  def get_resistance
191
- send_request FUNCTION_GET_RESISTANCE, [], '', 4, 'l'
196
+ check_validity
197
+
198
+ send_request FUNCTION_GET_RESISTANCE, [], '', 12, 'l'
192
199
  end
193
200
 
194
- # The period in ms is the period with which the CALLBACK_RESISTANCE callback is triggered
201
+ # The period is the period with which the CALLBACK_RESISTANCE callback is triggered
195
202
  # periodically. A value of 0 turns the callback off.
196
203
  #
197
204
  # If the `value has to change`-parameter is set to true, the callback is only
@@ -216,31 +223,35 @@ module Tinkerforge
216
223
  # "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
217
224
  #
218
225
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
219
- #
220
- # The default value is (0, false, 'x', 0, 0).
221
226
  def set_resistance_callback_configuration(period, value_has_to_change, option, min, max)
222
- send_request FUNCTION_SET_RESISTANCE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 0, ''
227
+ check_validity
228
+
229
+ send_request FUNCTION_SET_RESISTANCE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 8, ''
223
230
  end
224
231
 
225
232
  # Returns the callback configuration as set by BrickletPTCV2#set_resistance_callback_configuration.
226
233
  def get_resistance_callback_configuration
227
- send_request FUNCTION_GET_RESISTANCE_CALLBACK_CONFIGURATION, [], '', 14, 'L ? k l l'
234
+ check_validity
235
+
236
+ send_request FUNCTION_GET_RESISTANCE_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k l l'
228
237
  end
229
238
 
230
239
  # Sets the noise rejection filter to either 50Hz (0) or 60Hz (1).
231
240
  # Noise from 50Hz or 60Hz power sources (including
232
241
  # harmonics of the AC power's fundamental frequency) is
233
242
  # attenuated by 82dB.
234
- #
235
- # Default value is 0 = 50Hz.
236
243
  def set_noise_rejection_filter(filter)
237
- send_request FUNCTION_SET_NOISE_REJECTION_FILTER, [filter], 'C', 0, ''
244
+ check_validity
245
+
246
+ send_request FUNCTION_SET_NOISE_REJECTION_FILTER, [filter], 'C', 8, ''
238
247
  end
239
248
 
240
249
  # Returns the noise rejection filter option as set by
241
250
  # BrickletPTCV2#set_noise_rejection_filter
242
251
  def get_noise_rejection_filter
243
- send_request FUNCTION_GET_NOISE_REJECTION_FILTER, [], '', 1, 'C'
252
+ check_validity
253
+
254
+ send_request FUNCTION_GET_NOISE_REJECTION_FILTER, [], '', 9, 'C'
244
255
  end
245
256
 
246
257
  # Returns *true* if the sensor is connected correctly.
@@ -253,21 +264,25 @@ module Tinkerforge
253
264
  # CALLBACK_SENSOR_CONNECTED callback. You can set the callback configuration
254
265
  # with BrickletPTCV2#set_sensor_connected_callback_configuration.
255
266
  def is_sensor_connected
256
- send_request FUNCTION_IS_SENSOR_CONNECTED, [], '', 1, '?'
267
+ check_validity
268
+
269
+ send_request FUNCTION_IS_SENSOR_CONNECTED, [], '', 9, '?'
257
270
  end
258
271
 
259
272
  # Sets the wire mode of the sensor. Possible values are 2, 3 and 4 which
260
273
  # correspond to 2-, 3- and 4-wire sensors. The value has to match the jumper
261
274
  # configuration on the Bricklet.
262
- #
263
- # The default value is 2 = 2-wire.
264
275
  def set_wire_mode(mode)
265
- send_request FUNCTION_SET_WIRE_MODE, [mode], 'C', 0, ''
276
+ check_validity
277
+
278
+ send_request FUNCTION_SET_WIRE_MODE, [mode], 'C', 8, ''
266
279
  end
267
280
 
268
281
  # Returns the wire mode as set by BrickletPTCV2#set_wire_mode
269
282
  def get_wire_mode
270
- send_request FUNCTION_GET_WIRE_MODE, [], '', 1, 'C'
283
+ check_validity
284
+
285
+ send_request FUNCTION_GET_WIRE_MODE, [], '', 9, 'C'
271
286
  end
272
287
 
273
288
  # Sets the length of a `moving averaging <https://en.wikipedia.org/wiki/Moving_average>`__
@@ -276,34 +291,37 @@ module Tinkerforge
276
291
  # Setting the length to 1 will turn the averaging off. With less
277
292
  # averaging, there is more noise on the data.
278
293
  #
279
- # The range for the averaging is 1-1000.
280
- #
281
294
  # New data is gathered every 20ms. With a moving average of length 1000 the resulting
282
295
  # averaging window has a length of 20s. If you want to do long term measurements the longest
283
296
  # moving average will give the cleanest results.
284
297
  #
285
- # The default value is 1 for resistance and 40 for temperature. The default values match
286
- # the non-changeable averaging settings of the old PTC Bricklet 1.0
298
+ # The default values match the non-changeable averaging settings of the old PTC Bricklet 1.0
287
299
  def set_moving_average_configuration(moving_average_length_resistance, moving_average_length_temperature)
288
- send_request FUNCTION_SET_MOVING_AVERAGE_CONFIGURATION, [moving_average_length_resistance, moving_average_length_temperature], 'S S', 0, ''
300
+ check_validity
301
+
302
+ send_request FUNCTION_SET_MOVING_AVERAGE_CONFIGURATION, [moving_average_length_resistance, moving_average_length_temperature], 'S S', 8, ''
289
303
  end
290
304
 
291
305
  # Returns the moving average configuration as set by BrickletPTCV2#set_moving_average_configuration.
292
306
  def get_moving_average_configuration
293
- send_request FUNCTION_GET_MOVING_AVERAGE_CONFIGURATION, [], '', 4, 'S S'
307
+ check_validity
308
+
309
+ send_request FUNCTION_GET_MOVING_AVERAGE_CONFIGURATION, [], '', 12, 'S S'
294
310
  end
295
311
 
296
312
  # If you enable this callback, the CALLBACK_SENSOR_CONNECTED callback is triggered
297
313
  # every time a Pt sensor is connected/disconnected.
298
- #
299
- # By default this callback is disabled.
300
314
  def set_sensor_connected_callback_configuration(enabled)
301
- send_request FUNCTION_SET_SENSOR_CONNECTED_CALLBACK_CONFIGURATION, [enabled], '?', 0, ''
315
+ check_validity
316
+
317
+ send_request FUNCTION_SET_SENSOR_CONNECTED_CALLBACK_CONFIGURATION, [enabled], '?', 8, ''
302
318
  end
303
319
 
304
320
  # Returns the configuration as set by BrickletPTCV2#set_sensor_connected_callback_configuration.
305
321
  def get_sensor_connected_callback_configuration
306
- send_request FUNCTION_GET_SENSOR_CONNECTED_CALLBACK_CONFIGURATION, [], '', 1, '?'
322
+ check_validity
323
+
324
+ send_request FUNCTION_GET_SENSOR_CONNECTED_CALLBACK_CONFIGURATION, [], '', 9, '?'
307
325
  end
308
326
 
309
327
  # Returns the error count for the communication between Brick and Bricklet.
@@ -318,7 +336,9 @@ module Tinkerforge
318
336
  # The errors counts are for errors that occur on the Bricklet side. All
319
337
  # Bricks have a similar function that returns the errors on the Brick side.
320
338
  def get_spitfp_error_count
321
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
339
+ check_validity
340
+
341
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
322
342
  end
323
343
 
324
344
  # Sets the bootloader mode and returns the status after the requested
@@ -331,12 +351,16 @@ module Tinkerforge
331
351
  # This function is used by Brick Viewer during flashing. It should not be
332
352
  # necessary to call it in a normal user program.
333
353
  def set_bootloader_mode(mode)
334
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
354
+ check_validity
355
+
356
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
335
357
  end
336
358
 
337
359
  # Returns the current bootloader mode, see BrickletPTCV2#set_bootloader_mode.
338
360
  def get_bootloader_mode
339
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
361
+ check_validity
362
+
363
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
340
364
  end
341
365
 
342
366
  # Sets the firmware pointer for BrickletPTCV2#write_firmware. The pointer has
@@ -346,7 +370,9 @@ module Tinkerforge
346
370
  # This function is used by Brick Viewer during flashing. It should not be
347
371
  # necessary to call it in a normal user program.
348
372
  def set_write_firmware_pointer(pointer)
349
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
373
+ check_validity
374
+
375
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
350
376
  end
351
377
 
352
378
  # Writes 64 Bytes of firmware at the position as written by
@@ -358,7 +384,9 @@ module Tinkerforge
358
384
  # This function is used by Brick Viewer during flashing. It should not be
359
385
  # necessary to call it in a normal user program.
360
386
  def write_firmware(data)
361
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
387
+ check_validity
388
+
389
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
362
390
  end
363
391
 
364
392
  # Sets the status LED configuration. By default the LED shows
@@ -369,22 +397,28 @@ module Tinkerforge
369
397
  #
370
398
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
371
399
  def set_status_led_config(config)
372
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
400
+ check_validity
401
+
402
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
373
403
  end
374
404
 
375
405
  # Returns the configuration as set by BrickletPTCV2#set_status_led_config
376
406
  def get_status_led_config
377
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
407
+ check_validity
408
+
409
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
378
410
  end
379
411
 
380
- # Returns the temperature in °C as measured inside the microcontroller. The
412
+ # Returns the temperature as measured inside the microcontroller. The
381
413
  # value returned is not the ambient temperature!
382
414
  #
383
415
  # The temperature is only proportional to the real temperature and it has bad
384
416
  # accuracy. Practically it is only useful as an indicator for
385
417
  # temperature changes.
386
418
  def get_chip_temperature
387
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
419
+ check_validity
420
+
421
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
388
422
  end
389
423
 
390
424
  # Calling this function will reset the Bricklet. All configurations
@@ -394,7 +428,9 @@ module Tinkerforge
394
428
  # calling functions on the existing ones will result in
395
429
  # undefined behavior!
396
430
  def reset
397
- send_request FUNCTION_RESET, [], '', 0, ''
431
+ check_validity
432
+
433
+ send_request FUNCTION_RESET, [], '', 8, ''
398
434
  end
399
435
 
400
436
  # Writes a new UID into flash. If you want to set a new UID
@@ -403,25 +439,31 @@ module Tinkerforge
403
439
  #
404
440
  # We recommend that you use Brick Viewer to change the UID.
405
441
  def write_uid(uid)
406
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
442
+ check_validity
443
+
444
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
407
445
  end
408
446
 
409
447
  # Returns the current UID as an integer. Encode as
410
448
  # Base58 to get the usual string version.
411
449
  def read_uid
412
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
450
+ check_validity
451
+
452
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
413
453
  end
414
454
 
415
455
  # Returns the UID, the UID where the Bricklet is connected to,
416
456
  # the position, the hardware and firmware version as well as the
417
457
  # device identifier.
418
458
  #
419
- # The position can be 'a', 'b', 'c' or 'd'.
459
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
460
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
461
+ # position 'z'.
420
462
  #
421
463
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
422
464
  # |device_identifier_constant|
423
465
  def get_identity
424
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
466
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
425
467
  end
426
468
 
427
469
  # 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
  # Battery-backed real-time clock
14
16
  class BrickletRealTimeClock < Device
@@ -56,7 +58,7 @@ module Tinkerforge
56
58
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
57
59
  # the IP Connection <tt>ipcon</tt>.
58
60
  def initialize(uid, ipcon)
59
- super uid, ipcon
61
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
60
62
 
61
63
  @api_version = [2, 0, 1]
62
64
 
@@ -71,24 +73,13 @@ module Tinkerforge
71
73
  @response_expected[FUNCTION_GET_ALARM] = RESPONSE_EXPECTED_ALWAYS_TRUE
72
74
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
73
75
 
74
- @callback_formats[CALLBACK_DATE_TIME] = 'S C C C C C C C q'
75
- @callback_formats[CALLBACK_ALARM] = 'S C C C C C C C q'
76
+ @callback_formats[CALLBACK_DATE_TIME] = [25, 'S C C C C C C C q']
77
+ @callback_formats[CALLBACK_ALARM] = [25, 'S C C C C C C C q']
76
78
 
79
+ @ipcon.add_device self
77
80
  end
78
81
 
79
- # Sets the current date (including weekday) and the current time with hundredths
80
- # of a second resolution.
81
- #
82
- # Possible value ranges:
83
- #
84
- # * Year: 2000 to 2099
85
- # * Month: 1 to 12 (January to December)
86
- # * Day: 1 to 31
87
- # * Hour: 0 to 23
88
- # * Minute: 0 to 59
89
- # * Second: 0 to 59
90
- # * Centisecond: 0 to 99
91
- # * Weekday: 1 to 7 (Monday to Sunday)
82
+ # Sets the current date (including weekday) and the current time.
92
83
  #
93
84
  # If the backup battery is installed then the real-time clock keeps date and
94
85
  # time even if the Bricklet is not powered by a Brick.
@@ -97,20 +88,26 @@ module Tinkerforge
97
88
  # accordingly. But leap seconds, time zones and daylight saving time are not
98
89
  # handled.
99
90
  def set_date_time(year, month, day, hour, minute, second, centisecond, weekday)
100
- send_request FUNCTION_SET_DATE_TIME, [year, month, day, hour, minute, second, centisecond, weekday], 'S C C C C C C C', 0, ''
91
+ check_validity
92
+
93
+ send_request FUNCTION_SET_DATE_TIME, [year, month, day, hour, minute, second, centisecond, weekday], 'S C C C C C C C', 8, ''
101
94
  end
102
95
 
103
96
  # Returns the current date (including weekday) and the current time of the
104
- # real-time clock with hundredths of a second resolution.
97
+ # real-time clock.
105
98
  def get_date_time
106
- send_request FUNCTION_GET_DATE_TIME, [], '', 9, 'S C C C C C C C'
99
+ check_validity
100
+
101
+ send_request FUNCTION_GET_DATE_TIME, [], '', 17, 'S C C C C C C C'
107
102
  end
108
103
 
109
- # Returns the current date and the time of the real-time clock converted to
110
- # milliseconds. The timestamp has an effective resolution of hundredths of a
111
- # second.
104
+ # Returns the current date and the time of the real-time clock.
105
+ # The timestamp has an effective resolution of hundredths of a
106
+ # second and is an offset to 2000-01-01 00:00:00.000.
112
107
  def get_timestamp
113
- send_request FUNCTION_GET_TIMESTAMP, [], '', 8, 'q'
108
+ check_validity
109
+
110
+ send_request FUNCTION_GET_TIMESTAMP, [], '', 16, 'q'
114
111
  end
115
112
 
116
113
  # Sets the offset the real-time clock should compensate for in 2.17 ppm steps
@@ -139,32 +136,38 @@ module Tinkerforge
139
136
  # The offset is saved in the EEPROM of the Bricklet and only needs to be
140
137
  # configured once.
141
138
  def set_offset(offset)
142
- send_request FUNCTION_SET_OFFSET, [offset], 'c', 0, ''
139
+ check_validity
140
+
141
+ send_request FUNCTION_SET_OFFSET, [offset], 'c', 8, ''
143
142
  end
144
143
 
145
144
  # Returns the offset as set by BrickletRealTimeClock#set_offset.
146
145
  def get_offset
147
- send_request FUNCTION_GET_OFFSET, [], '', 1, 'c'
146
+ check_validity
147
+
148
+ send_request FUNCTION_GET_OFFSET, [], '', 9, 'c'
148
149
  end
149
150
 
150
- # Sets the period in ms with which the CALLBACK_DATE_TIME callback is triggered
151
+ # Sets the period with which the CALLBACK_DATE_TIME callback is triggered
151
152
  # periodically. A value of 0 turns the callback off.
152
153
  #
153
154
  # The CALLBACK_DATE_TIME Callback is only triggered if the date or time changed
154
155
  # since the last triggering.
155
156
  #
156
- # The default value is 0.
157
- #
158
157
  # .. versionadded:: 2.0.1$nbsp;(Plugin)
159
158
  def set_date_time_callback_period(period)
160
- send_request FUNCTION_SET_DATE_TIME_CALLBACK_PERIOD, [period], 'L', 0, ''
159
+ check_validity
160
+
161
+ send_request FUNCTION_SET_DATE_TIME_CALLBACK_PERIOD, [period], 'L', 8, ''
161
162
  end
162
163
 
163
164
  # Returns the period as set by BrickletRealTimeClock#set_date_time_callback_period.
164
165
  #
165
166
  # .. versionadded:: 2.0.1$nbsp;(Plugin)
166
167
  def get_date_time_callback_period
167
- send_request FUNCTION_GET_DATE_TIME_CALLBACK_PERIOD, [], '', 4, 'L'
168
+ check_validity
169
+
170
+ send_request FUNCTION_GET_DATE_TIME_CALLBACK_PERIOD, [], '', 12, 'L'
168
171
  end
169
172
 
170
173
  # Configures a repeatable alarm. The CALLBACK_ALARM callback is triggered if the
@@ -194,26 +197,32 @@ module Tinkerforge
194
197
  #
195
198
  # .. versionadded:: 2.0.1$nbsp;(Plugin)
196
199
  def set_alarm(month, day, hour, minute, second, weekday, interval)
197
- send_request FUNCTION_SET_ALARM, [month, day, hour, minute, second, weekday, interval], 'c c c c c c l', 0, ''
200
+ check_validity
201
+
202
+ send_request FUNCTION_SET_ALARM, [month, day, hour, minute, second, weekday, interval], 'c c c c c c l', 8, ''
198
203
  end
199
204
 
200
205
  # Returns the alarm configuration as set by BrickletRealTimeClock#set_alarm.
201
206
  #
202
207
  # .. versionadded:: 2.0.1$nbsp;(Plugin)
203
208
  def get_alarm
204
- send_request FUNCTION_GET_ALARM, [], '', 10, 'c c c c c c l'
209
+ check_validity
210
+
211
+ send_request FUNCTION_GET_ALARM, [], '', 18, 'c c c c c c l'
205
212
  end
206
213
 
207
214
  # Returns the UID, the UID where the Bricklet is connected to,
208
215
  # the position, the hardware and firmware version as well as the
209
216
  # device identifier.
210
217
  #
211
- # The position can be 'a', 'b', 'c' or 'd'.
218
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
219
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
220
+ # position 'z'.
212
221
  #
213
222
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
214
223
  # |device_identifier_constant|
215
224
  def get_identity
216
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
225
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
217
226
  end
218
227
 
219
228
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.