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 ambient temperature with 0.2°C accuracy
14
16
  class BrickletTemperatureV2 < Device
@@ -65,7 +67,7 @@ module Tinkerforge
65
67
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
66
68
  # the IP Connection <tt>ipcon</tt>.
67
69
  def initialize(uid, ipcon)
68
- super uid, ipcon
70
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
69
71
 
70
72
  @api_version = [2, 0, 0]
71
73
 
@@ -87,8 +89,9 @@ module Tinkerforge
87
89
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
88
90
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
89
91
 
90
- @callback_formats[CALLBACK_TEMPERATURE] = 's'
92
+ @callback_formats[CALLBACK_TEMPERATURE] = [10, 's']
91
93
 
94
+ @ipcon.add_device self
92
95
  end
93
96
 
94
97
  # Returns the temperature measured by the sensor.
@@ -98,7 +101,9 @@ module Tinkerforge
98
101
  # CALLBACK_TEMPERATURE callback. You can set the callback configuration
99
102
  # with BrickletTemperatureV2#set_temperature_callback_configuration.
100
103
  def get_temperature
101
- send_request FUNCTION_GET_TEMPERATURE, [], '', 2, 's'
104
+ check_validity
105
+
106
+ send_request FUNCTION_GET_TEMPERATURE, [], '', 10, 's'
102
107
  end
103
108
 
104
109
  # The period is the period with which the CALLBACK_TEMPERATURE callback is triggered
@@ -127,24 +132,30 @@ module Tinkerforge
127
132
  #
128
133
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
129
134
  def set_temperature_callback_configuration(period, value_has_to_change, option, min, max)
130
- send_request FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k s s', 0, ''
135
+ check_validity
136
+
137
+ send_request FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k s s', 8, ''
131
138
  end
132
139
 
133
140
  # Returns the callback configuration as set by BrickletTemperatureV2#set_temperature_callback_configuration.
134
141
  def get_temperature_callback_configuration
135
- send_request FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 10, 'L ? k s s'
142
+ check_validity
143
+
144
+ send_request FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 18, 'L ? k s s'
136
145
  end
137
146
 
138
147
  # Enables/disables the heater. The heater can be used to test the sensor.
139
- #
140
- # By default the heater is disabled.
141
148
  def set_heater_configuration(heater_config)
142
- send_request FUNCTION_SET_HEATER_CONFIGURATION, [heater_config], 'C', 0, ''
149
+ check_validity
150
+
151
+ send_request FUNCTION_SET_HEATER_CONFIGURATION, [heater_config], 'C', 8, ''
143
152
  end
144
153
 
145
154
  # Returns the heater configuration as set by BrickletTemperatureV2#set_heater_configuration.
146
155
  def get_heater_configuration
147
- send_request FUNCTION_GET_HEATER_CONFIGURATION, [], '', 1, 'C'
156
+ check_validity
157
+
158
+ send_request FUNCTION_GET_HEATER_CONFIGURATION, [], '', 9, 'C'
148
159
  end
149
160
 
150
161
  # Returns the error count for the communication between Brick and Bricklet.
@@ -159,7 +170,9 @@ module Tinkerforge
159
170
  # The errors counts are for errors that occur on the Bricklet side. All
160
171
  # Bricks have a similar function that returns the errors on the Brick side.
161
172
  def get_spitfp_error_count
162
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
173
+ check_validity
174
+
175
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
163
176
  end
164
177
 
165
178
  # Sets the bootloader mode and returns the status after the requested
@@ -172,12 +185,16 @@ module Tinkerforge
172
185
  # This function is used by Brick Viewer during flashing. It should not be
173
186
  # necessary to call it in a normal user program.
174
187
  def set_bootloader_mode(mode)
175
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
188
+ check_validity
189
+
190
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
176
191
  end
177
192
 
178
193
  # Returns the current bootloader mode, see BrickletTemperatureV2#set_bootloader_mode.
179
194
  def get_bootloader_mode
180
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
195
+ check_validity
196
+
197
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
181
198
  end
182
199
 
183
200
  # Sets the firmware pointer for BrickletTemperatureV2#write_firmware. The pointer has
@@ -187,7 +204,9 @@ module Tinkerforge
187
204
  # This function is used by Brick Viewer during flashing. It should not be
188
205
  # necessary to call it in a normal user program.
189
206
  def set_write_firmware_pointer(pointer)
190
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
207
+ check_validity
208
+
209
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
191
210
  end
192
211
 
193
212
  # Writes 64 Bytes of firmware at the position as written by
@@ -199,7 +218,9 @@ module Tinkerforge
199
218
  # This function is used by Brick Viewer during flashing. It should not be
200
219
  # necessary to call it in a normal user program.
201
220
  def write_firmware(data)
202
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
221
+ check_validity
222
+
223
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
203
224
  end
204
225
 
205
226
  # Sets the status LED configuration. By default the LED shows
@@ -210,22 +231,28 @@ module Tinkerforge
210
231
  #
211
232
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
212
233
  def set_status_led_config(config)
213
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
234
+ check_validity
235
+
236
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
214
237
  end
215
238
 
216
239
  # Returns the configuration as set by BrickletTemperatureV2#set_status_led_config
217
240
  def get_status_led_config
218
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
241
+ check_validity
242
+
243
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
219
244
  end
220
245
 
221
- # Returns the temperature in °C as measured inside the microcontroller. The
246
+ # Returns the temperature as measured inside the microcontroller. The
222
247
  # value returned is not the ambient temperature!
223
248
  #
224
249
  # The temperature is only proportional to the real temperature and it has bad
225
250
  # accuracy. Practically it is only useful as an indicator for
226
251
  # temperature changes.
227
252
  def get_chip_temperature
228
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
253
+ check_validity
254
+
255
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
229
256
  end
230
257
 
231
258
  # Calling this function will reset the Bricklet. All configurations
@@ -235,7 +262,9 @@ module Tinkerforge
235
262
  # calling functions on the existing ones will result in
236
263
  # undefined behavior!
237
264
  def reset
238
- send_request FUNCTION_RESET, [], '', 0, ''
265
+ check_validity
266
+
267
+ send_request FUNCTION_RESET, [], '', 8, ''
239
268
  end
240
269
 
241
270
  # Writes a new UID into flash. If you want to set a new UID
@@ -244,25 +273,32 @@ module Tinkerforge
244
273
  #
245
274
  # We recommend that you use Brick Viewer to change the UID.
246
275
  def write_uid(uid)
247
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
276
+ check_validity
277
+
278
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
248
279
  end
249
280
 
250
281
  # Returns the current UID as an integer. Encode as
251
282
  # Base58 to get the usual string version.
252
283
  def read_uid
253
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
284
+ check_validity
285
+
286
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
254
287
  end
255
288
 
256
289
  # Returns the UID, the UID where the Bricklet is connected to,
257
290
  # the position, the hardware and firmware version as well as the
258
291
  # device identifier.
259
292
  #
260
- # The position can be 'a', 'b', 'c' or 'd'.
293
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
294
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
295
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
296
+ # position 'z'.
261
297
  #
262
298
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
263
299
  # |device_identifier_constant|
264
300
  def get_identity
265
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
301
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
266
302
  end
267
303
 
268
304
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-11-25. #
3
+ # This file was automatically generated on 2020-04-07. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.25 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # 80x60 pixel thermal imaging camera
14
16
  class BrickletThermalImaging < Device
@@ -60,6 +62,8 @@ module Tinkerforge
60
62
  FUNCTION_GET_HIGH_CONTRAST_CONFIG = 9 # :nodoc:
61
63
  FUNCTION_SET_IMAGE_TRANSFER_CONFIG = 10 # :nodoc:
62
64
  FUNCTION_GET_IMAGE_TRANSFER_CONFIG = 11 # :nodoc:
65
+ FUNCTION_SET_FLUX_LINEAR_PARAMETERS = 14 # :nodoc:
66
+ FUNCTION_GET_FLUX_LINEAR_PARAMETERS = 15 # :nodoc:
63
67
  FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
64
68
  FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
65
69
  FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
@@ -102,9 +106,9 @@ module Tinkerforge
102
106
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
103
107
  # the IP Connection <tt>ipcon</tt>.
104
108
  def initialize(uid, ipcon)
105
- super uid, ipcon
109
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
106
110
 
107
- @api_version = [2, 0, 0]
111
+ @api_version = [2, 0, 1]
108
112
 
109
113
  @response_expected[FUNCTION_GET_HIGH_CONTRAST_IMAGE_LOW_LEVEL] = RESPONSE_EXPECTED_ALWAYS_TRUE
110
114
  @response_expected[FUNCTION_GET_TEMPERATURE_IMAGE_LOW_LEVEL] = RESPONSE_EXPECTED_ALWAYS_TRUE
@@ -117,6 +121,8 @@ module Tinkerforge
117
121
  @response_expected[FUNCTION_GET_HIGH_CONTRAST_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
118
122
  @response_expected[FUNCTION_SET_IMAGE_TRANSFER_CONFIG] = RESPONSE_EXPECTED_TRUE
119
123
  @response_expected[FUNCTION_GET_IMAGE_TRANSFER_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
124
+ @response_expected[FUNCTION_SET_FLUX_LINEAR_PARAMETERS] = RESPONSE_EXPECTED_FALSE
125
+ @response_expected[FUNCTION_GET_FLUX_LINEAR_PARAMETERS] = RESPONSE_EXPECTED_ALWAYS_TRUE
120
126
  @response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
121
127
  @response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
122
128
  @response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
@@ -130,11 +136,12 @@ module Tinkerforge
130
136
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
131
137
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
132
138
 
133
- @callback_formats[CALLBACK_HIGH_CONTRAST_IMAGE_LOW_LEVEL] = 'S C62'
134
- @callback_formats[CALLBACK_TEMPERATURE_IMAGE_LOW_LEVEL] = 'S S31'
139
+ @callback_formats[CALLBACK_HIGH_CONTRAST_IMAGE_LOW_LEVEL] = [72, 'S C62']
140
+ @callback_formats[CALLBACK_TEMPERATURE_IMAGE_LOW_LEVEL] = [72, 'S S31']
135
141
 
136
142
  @high_level_callbacks[CALLBACK_HIGH_CONTRAST_IMAGE] = [['stream_chunk_offset', 'stream_chunk_data'], {'fixed_length' => 4800, 'single_chunk' => false}, nil]
137
143
  @high_level_callbacks[CALLBACK_TEMPERATURE_IMAGE] = [['stream_chunk_offset', 'stream_chunk_data'], {'fixed_length' => 4800, 'single_chunk' => false}, nil]
144
+ @ipcon.add_device self
138
145
  end
139
146
 
140
147
  # Returns the current high contrast image. See `here <https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Thermal_Imaging.html#high-contrast-image-vs-temperature-image>`__
@@ -152,7 +159,9 @@ module Tinkerforge
152
159
  # Before you can use this function you have to enable it with
153
160
  # BrickletThermalImaging#set_image_transfer_config.
154
161
  def get_high_contrast_image_low_level
155
- send_request FUNCTION_GET_HIGH_CONTRAST_IMAGE_LOW_LEVEL, [], '', 64, 'S C62'
162
+ check_validity
163
+
164
+ send_request FUNCTION_GET_HIGH_CONTRAST_IMAGE_LOW_LEVEL, [], '', 72, 'S C62'
156
165
  end
157
166
 
158
167
  # Returns the current temperature image. See `here <https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Thermal_Imaging.html#high-contrast-image-vs-temperature-image>`__
@@ -169,7 +178,9 @@ module Tinkerforge
169
178
  # Before you can use this function you have to enable it with
170
179
  # BrickletThermalImaging#set_image_transfer_config.
171
180
  def get_temperature_image_low_level
172
- send_request FUNCTION_GET_TEMPERATURE_IMAGE_LOW_LEVEL, [], '', 64, 'S S31'
181
+ check_validity
182
+
183
+ send_request FUNCTION_GET_TEMPERATURE_IMAGE_LOW_LEVEL, [], '', 72, 'S S31'
173
184
  end
174
185
 
175
186
  # Returns the spotmeter statistics, various temperatures, current resolution and status bits.
@@ -203,7 +214,9 @@ module Tinkerforge
203
214
  # * Index 0: Shutter lockout (if true shutter is locked out because temperature is outside -10°C to +65°C)
204
215
  # * Index 1: Overtemperature shut down imminent (goes true 10 seconds before shutdown)
205
216
  def get_statistics
206
- send_request FUNCTION_GET_STATISTICS, [], '', 20, 'S4 S4 C C ?2'
217
+ check_validity
218
+
219
+ send_request FUNCTION_GET_STATISTICS, [], '', 27, 'S4 S4 C C ?2'
207
220
  end
208
221
 
209
222
  # Sets the resolution. The Thermal Imaging Bricklet can either measure
@@ -213,15 +226,17 @@ module Tinkerforge
213
226
  #
214
227
  # The accuracy is specified for -10°C to 450°C in the
215
228
  # first range and -10°C and 140°C in the second range.
216
- #
217
- # The default value is 0 to 655 Kelvin.
218
229
  def set_resolution(resolution)
219
- send_request FUNCTION_SET_RESOLUTION, [resolution], 'C', 0, ''
230
+ check_validity
231
+
232
+ send_request FUNCTION_SET_RESOLUTION, [resolution], 'C', 8, ''
220
233
  end
221
234
 
222
235
  # Returns the resolution as set by BrickletThermalImaging#set_resolution.
223
236
  def get_resolution
224
- send_request FUNCTION_GET_RESOLUTION, [], '', 1, 'C'
237
+ check_validity
238
+
239
+ send_request FUNCTION_GET_RESOLUTION, [], '', 9, 'C'
225
240
  end
226
241
 
227
242
  # Sets the spotmeter region of interest. The 4 values are
@@ -232,15 +247,17 @@ module Tinkerforge
232
247
  # * Index 3: Row end (has to be smaller then 60).
233
248
  #
234
249
  # The spotmeter statistics can be read out with BrickletThermalImaging#get_statistics.
235
- #
236
- # The default region of interest is (39, 29, 40, 30).
237
250
  def set_spotmeter_config(region_of_interest)
238
- send_request FUNCTION_SET_SPOTMETER_CONFIG, [region_of_interest], 'C4', 0, ''
251
+ check_validity
252
+
253
+ send_request FUNCTION_SET_SPOTMETER_CONFIG, [region_of_interest], 'C4', 8, ''
239
254
  end
240
255
 
241
256
  # Returns the spotmeter config as set by BrickletThermalImaging#set_spotmeter_config.
242
257
  def get_spotmeter_config
243
- send_request FUNCTION_GET_SPOTMETER_CONFIG, [], '', 4, 'C4'
258
+ check_validity
259
+
260
+ send_request FUNCTION_GET_SPOTMETER_CONFIG, [], '', 12, 'C4'
244
261
  end
245
262
 
246
263
  # Sets the high contrast region of interest, dampening factor, clip limit and empty counts.
@@ -281,20 +298,17 @@ module Tinkerforge
281
298
  # Empty Counts: This parameter specifies the maximum number of pixels in a bin that will be
282
299
  # interpreted as an empty bin. Histogram bins with this number of pixels or less will be
283
300
  # processed as an empty bin.
284
- #
285
- # The default values are
286
- #
287
- # * Region Of Interest = (0, 0, 79, 59),
288
- # * Dampening Factor = 64,
289
- # * Clip Limit = (4800, 512) and
290
- # * Empty Counts = 2.
291
301
  def set_high_contrast_config(region_of_interest, dampening_factor, clip_limit, empty_counts)
292
- send_request FUNCTION_SET_HIGH_CONTRAST_CONFIG, [region_of_interest, dampening_factor, clip_limit, empty_counts], 'C4 S S2 S', 0, ''
302
+ check_validity
303
+
304
+ send_request FUNCTION_SET_HIGH_CONTRAST_CONFIG, [region_of_interest, dampening_factor, clip_limit, empty_counts], 'C4 S S2 S', 8, ''
293
305
  end
294
306
 
295
307
  # Returns the high contrast config as set by BrickletThermalImaging#set_high_contrast_config.
296
308
  def get_high_contrast_config
297
- send_request FUNCTION_GET_HIGH_CONTRAST_CONFIG, [], '', 12, 'C4 S S2 S'
309
+ check_validity
310
+
311
+ send_request FUNCTION_GET_HIGH_CONTRAST_CONFIG, [], '', 20, 'C4 S S2 S'
298
312
  end
299
313
 
300
314
  # The necessary bandwidth of this Bricklet is too high to use getter/callback or
@@ -307,15 +321,37 @@ module Tinkerforge
307
321
  # * Manual Temperature Image: BrickletThermalImaging#get_temperature_image.
308
322
  # * Callback High Contrast Image: CALLBACK_HIGH_CONTRAST_IMAGE callback.
309
323
  # * Callback Temperature Image: CALLBACK_TEMPERATURE_IMAGE callback.
310
- #
311
- # The default is Manual High Contrast Image (0).
312
324
  def set_image_transfer_config(config)
313
- send_request FUNCTION_SET_IMAGE_TRANSFER_CONFIG, [config], 'C', 0, ''
325
+ check_validity
326
+
327
+ send_request FUNCTION_SET_IMAGE_TRANSFER_CONFIG, [config], 'C', 8, ''
314
328
  end
315
329
 
316
330
  # Returns the image transfer config, as set by BrickletThermalImaging#set_image_transfer_config.
317
331
  def get_image_transfer_config
318
- send_request FUNCTION_GET_IMAGE_TRANSFER_CONFIG, [], '', 1, 'C'
332
+ check_validity
333
+
334
+ send_request FUNCTION_GET_IMAGE_TRANSFER_CONFIG, [], '', 9, 'C'
335
+ end
336
+
337
+ # Sets the flux linear parameters that can be used for radiometry calibration.
338
+ #
339
+ # See FLIR document 102-PS245-100-01 for more details.
340
+ #
341
+ # .. versionadded:: 2.0.5$nbsp;(Plugin)
342
+ def set_flux_linear_parameters(scene_emissivity, temperature_background, tau_window, temperatur_window, tau_atmosphere, temperature_atmosphere, reflection_window, temperature_reflection)
343
+ check_validity
344
+
345
+ send_request FUNCTION_SET_FLUX_LINEAR_PARAMETERS, [scene_emissivity, temperature_background, tau_window, temperatur_window, tau_atmosphere, temperature_atmosphere, reflection_window, temperature_reflection], 'S S S S S S S S', 8, ''
346
+ end
347
+
348
+ # Returns the flux linear parameters, as set by BrickletThermalImaging#set_flux_linear_parameters.
349
+ #
350
+ # .. versionadded:: 2.0.5$nbsp;(Plugin)
351
+ def get_flux_linear_parameters
352
+ check_validity
353
+
354
+ send_request FUNCTION_GET_FLUX_LINEAR_PARAMETERS, [], '', 24, 'S S S S S S S S'
319
355
  end
320
356
 
321
357
  # Returns the error count for the communication between Brick and Bricklet.
@@ -330,7 +366,9 @@ module Tinkerforge
330
366
  # The errors counts are for errors that occur on the Bricklet side. All
331
367
  # Bricks have a similar function that returns the errors on the Brick side.
332
368
  def get_spitfp_error_count
333
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
369
+ check_validity
370
+
371
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
334
372
  end
335
373
 
336
374
  # Sets the bootloader mode and returns the status after the requested
@@ -343,12 +381,16 @@ module Tinkerforge
343
381
  # This function is used by Brick Viewer during flashing. It should not be
344
382
  # necessary to call it in a normal user program.
345
383
  def set_bootloader_mode(mode)
346
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
384
+ check_validity
385
+
386
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
347
387
  end
348
388
 
349
389
  # Returns the current bootloader mode, see BrickletThermalImaging#set_bootloader_mode.
350
390
  def get_bootloader_mode
351
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
391
+ check_validity
392
+
393
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
352
394
  end
353
395
 
354
396
  # Sets the firmware pointer for BrickletThermalImaging#write_firmware. The pointer has
@@ -358,7 +400,9 @@ module Tinkerforge
358
400
  # This function is used by Brick Viewer during flashing. It should not be
359
401
  # necessary to call it in a normal user program.
360
402
  def set_write_firmware_pointer(pointer)
361
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
403
+ check_validity
404
+
405
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
362
406
  end
363
407
 
364
408
  # Writes 64 Bytes of firmware at the position as written by
@@ -370,7 +414,9 @@ module Tinkerforge
370
414
  # This function is used by Brick Viewer during flashing. It should not be
371
415
  # necessary to call it in a normal user program.
372
416
  def write_firmware(data)
373
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
417
+ check_validity
418
+
419
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
374
420
  end
375
421
 
376
422
  # Sets the status LED configuration. By default the LED shows
@@ -381,22 +427,28 @@ module Tinkerforge
381
427
  #
382
428
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
383
429
  def set_status_led_config(config)
384
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
430
+ check_validity
431
+
432
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
385
433
  end
386
434
 
387
435
  # Returns the configuration as set by BrickletThermalImaging#set_status_led_config
388
436
  def get_status_led_config
389
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
437
+ check_validity
438
+
439
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
390
440
  end
391
441
 
392
- # Returns the temperature in °C as measured inside the microcontroller. The
442
+ # Returns the temperature as measured inside the microcontroller. The
393
443
  # value returned is not the ambient temperature!
394
444
  #
395
445
  # The temperature is only proportional to the real temperature and it has bad
396
446
  # accuracy. Practically it is only useful as an indicator for
397
447
  # temperature changes.
398
448
  def get_chip_temperature
399
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
449
+ check_validity
450
+
451
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
400
452
  end
401
453
 
402
454
  # Calling this function will reset the Bricklet. All configurations
@@ -406,7 +458,9 @@ module Tinkerforge
406
458
  # calling functions on the existing ones will result in
407
459
  # undefined behavior!
408
460
  def reset
409
- send_request FUNCTION_RESET, [], '', 0, ''
461
+ check_validity
462
+
463
+ send_request FUNCTION_RESET, [], '', 8, ''
410
464
  end
411
465
 
412
466
  # Writes a new UID into flash. If you want to set a new UID
@@ -415,25 +469,32 @@ module Tinkerforge
415
469
  #
416
470
  # We recommend that you use Brick Viewer to change the UID.
417
471
  def write_uid(uid)
418
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
472
+ check_validity
473
+
474
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
419
475
  end
420
476
 
421
477
  # Returns the current UID as an integer. Encode as
422
478
  # Base58 to get the usual string version.
423
479
  def read_uid
424
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
480
+ check_validity
481
+
482
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
425
483
  end
426
484
 
427
485
  # Returns the UID, the UID where the Bricklet is connected to,
428
486
  # the position, the hardware and firmware version as well as the
429
487
  # device identifier.
430
488
  #
431
- # The position can be 'a', 'b', 'c' or 'd'.
489
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
490
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
491
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
492
+ # position 'z'.
432
493
  #
433
494
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
434
495
  # |device_identifier_constant|
435
496
  def get_identity
436
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
497
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
437
498
  end
438
499
 
439
500
  # Returns the current high contrast image. See `here <https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Thermal_Imaging.html#high-contrast-image-vs-temperature-image>`__