tinkerforge 2.1.17 → 2.1.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tinkerforge/brick_dc.rb +6 -6
  3. data/lib/tinkerforge/brick_imu.rb +6 -6
  4. data/lib/tinkerforge/brick_imu_v2.rb +13 -6
  5. data/lib/tinkerforge/brick_master.rb +6 -6
  6. data/lib/tinkerforge/brick_red.rb +2 -2
  7. data/lib/tinkerforge/brick_servo.rb +9 -7
  8. data/lib/tinkerforge/brick_silent_stepper.rb +13 -13
  9. data/lib/tinkerforge/brick_stepper.rb +6 -6
  10. data/lib/tinkerforge/bricklet_accelerometer.rb +2 -2
  11. data/lib/tinkerforge/bricklet_air_quality.rb +514 -0
  12. data/lib/tinkerforge/bricklet_ambient_light.rb +2 -2
  13. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +2 -2
  14. data/lib/tinkerforge/bricklet_analog_in.rb +2 -2
  15. data/lib/tinkerforge/bricklet_analog_in_v2.rb +2 -2
  16. data/lib/tinkerforge/bricklet_analog_in_v3.rb +5 -5
  17. data/lib/tinkerforge/bricklet_analog_out.rb +2 -2
  18. data/lib/tinkerforge/bricklet_analog_out_v2.rb +2 -2
  19. data/lib/tinkerforge/bricklet_analog_out_v3.rb +210 -0
  20. data/lib/tinkerforge/bricklet_barometer.rb +2 -2
  21. data/lib/tinkerforge/bricklet_barometer_v2.rb +497 -0
  22. data/lib/tinkerforge/bricklet_can.rb +2 -2
  23. data/lib/tinkerforge/bricklet_can_v2.rb +5 -5
  24. data/lib/tinkerforge/bricklet_co2.rb +2 -2
  25. data/lib/tinkerforge/bricklet_color.rb +2 -2
  26. data/lib/tinkerforge/bricklet_current12.rb +2 -2
  27. data/lib/tinkerforge/bricklet_current25.rb +2 -2
  28. data/lib/tinkerforge/bricklet_distance_ir.rb +2 -2
  29. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +398 -0
  30. data/lib/tinkerforge/bricklet_distance_us.rb +2 -2
  31. data/lib/tinkerforge/bricklet_dmx.rb +7 -5
  32. data/lib/tinkerforge/bricklet_dual_button.rb +2 -2
  33. data/lib/tinkerforge/bricklet_dual_button_v2.rb +283 -0
  34. data/lib/tinkerforge/bricklet_dual_relay.rb +2 -2
  35. data/lib/tinkerforge/bricklet_dust_detector.rb +2 -2
  36. data/lib/tinkerforge/bricklet_gps.rb +2 -2
  37. data/lib/tinkerforge/bricklet_gps_v2.rb +6 -6
  38. data/lib/tinkerforge/bricklet_hall_effect.rb +2 -2
  39. data/lib/tinkerforge/bricklet_humidity.rb +2 -2
  40. data/lib/tinkerforge/bricklet_humidity_v2.rb +5 -5
  41. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +2 -2
  42. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +336 -0
  43. data/lib/tinkerforge/bricklet_industrial_counter.rb +12 -12
  44. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +2 -2
  45. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +7 -7
  46. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +2 -2
  47. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +302 -0
  48. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +2 -2
  49. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +382 -0
  50. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +2 -2
  51. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +374 -0
  52. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +5 -5
  53. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +2 -2
  54. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +11 -11
  55. data/lib/tinkerforge/bricklet_io16.rb +2 -2
  56. data/lib/tinkerforge/bricklet_io16_v2.rb +418 -0
  57. data/lib/tinkerforge/bricklet_io4.rb +2 -2
  58. data/lib/tinkerforge/bricklet_io4_v2.rb +6 -6
  59. data/lib/tinkerforge/bricklet_isolator.rb +282 -0
  60. data/lib/tinkerforge/bricklet_joystick.rb +2 -2
  61. data/lib/tinkerforge/bricklet_laser_range_finder.rb +2 -2
  62. data/lib/tinkerforge/bricklet_lcd_128x64.rb +486 -0
  63. data/lib/tinkerforge/bricklet_lcd_16x2.rb +2 -2
  64. data/lib/tinkerforge/bricklet_lcd_20x4.rb +2 -2
  65. data/lib/tinkerforge/bricklet_led_strip.rb +2 -2
  66. data/lib/tinkerforge/bricklet_led_strip_v2.rb +8 -8
  67. data/lib/tinkerforge/bricklet_line.rb +2 -2
  68. data/lib/tinkerforge/bricklet_linear_poti.rb +2 -2
  69. data/lib/tinkerforge/bricklet_load_cell.rb +2 -2
  70. data/lib/tinkerforge/bricklet_load_cell_v2.rb +5 -5
  71. data/lib/tinkerforge/bricklet_moisture.rb +2 -2
  72. data/lib/tinkerforge/bricklet_motion_detector.rb +2 -2
  73. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +6 -6
  74. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +5 -5
  75. data/lib/tinkerforge/bricklet_multi_touch.rb +2 -2
  76. data/lib/tinkerforge/bricklet_nfc.rb +6 -6
  77. data/lib/tinkerforge/bricklet_nfc_rfid.rb +2 -2
  78. data/lib/tinkerforge/bricklet_oled_128x64.rb +2 -2
  79. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +387 -0
  80. data/lib/tinkerforge/bricklet_oled_64x48.rb +2 -2
  81. data/lib/tinkerforge/bricklet_one_wire.rb +305 -0
  82. data/lib/tinkerforge/bricklet_outdoor_weather.rb +5 -5
  83. data/lib/tinkerforge/bricklet_particulate_matter.rb +5 -5
  84. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +2 -2
  85. data/lib/tinkerforge/bricklet_piezo_speaker.rb +2 -2
  86. data/lib/tinkerforge/bricklet_ptc.rb +2 -2
  87. data/lib/tinkerforge/bricklet_ptc_v2.rb +5 -5
  88. data/lib/tinkerforge/bricklet_real_time_clock.rb +2 -2
  89. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +5 -5
  90. data/lib/tinkerforge/bricklet_remote_switch.rb +2 -2
  91. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +5 -5
  92. data/lib/tinkerforge/bricklet_rgb_led.rb +2 -2
  93. data/lib/tinkerforge/bricklet_rgb_led_button.rb +5 -5
  94. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +5 -5
  95. data/lib/tinkerforge/bricklet_rotary_encoder.rb +2 -2
  96. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +5 -5
  97. data/lib/tinkerforge/bricklet_rotary_poti.rb +2 -2
  98. data/lib/tinkerforge/bricklet_rs232.rb +2 -2
  99. data/lib/tinkerforge/bricklet_rs232_v2.rb +5 -5
  100. data/lib/tinkerforge/bricklet_rs485.rb +5 -5
  101. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +2 -2
  102. data/lib/tinkerforge/bricklet_solid_state_relay.rb +2 -2
  103. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +5 -5
  104. data/lib/tinkerforge/bricklet_sound_intensity.rb +2 -2
  105. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +9 -9
  106. data/lib/tinkerforge/bricklet_temperature.rb +2 -2
  107. data/lib/tinkerforge/bricklet_temperature_ir.rb +2 -2
  108. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +5 -5
  109. data/lib/tinkerforge/bricklet_temperature_v2.rb +278 -0
  110. data/lib/tinkerforge/bricklet_thermal_imaging.rb +5 -5
  111. data/lib/tinkerforge/bricklet_thermocouple.rb +2 -2
  112. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +5 -5
  113. data/lib/tinkerforge/bricklet_tilt.rb +2 -2
  114. data/lib/tinkerforge/bricklet_uv_light.rb +6 -5
  115. data/lib/tinkerforge/bricklet_uv_light_v2.rb +430 -0
  116. data/lib/tinkerforge/bricklet_voltage.rb +2 -2
  117. data/lib/tinkerforge/bricklet_voltage_current.rb +2 -2
  118. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +5 -5
  119. data/lib/tinkerforge/version.rb +1 -1
  120. metadata +18 -2
@@ -0,0 +1,398 @@
1
+ # -*- ruby encoding: utf-8 -*-
2
+ #############################################################
3
+ # This file was automatically generated on 2018-09-28. #
4
+ # #
5
+ # Ruby Bindings Version 2.1.18 #
6
+ # #
7
+ # If you have a bugfix for this file and want to commit it, #
8
+ # please fix the bug in the generator. You can find a link #
9
+ # to the generators git repository on tinkerforge.com #
10
+ #############################################################
11
+
12
+ module Tinkerforge
13
+ # Measures distance up to 150cm with infrared light
14
+ class BrickletDistanceIRV2 < Device
15
+ DEVICE_IDENTIFIER = 2125 # :nodoc:
16
+ DEVICE_DISPLAY_NAME = 'Distance IR Bricklet 2.0' # :nodoc:
17
+
18
+ # This callback is triggered periodically according to the configuration set by
19
+ # BrickletDistanceIRV2#set_distance_callback_configuration.
20
+ #
21
+ # The parameter is the same as BrickletDistanceIRV2#get_distance.
22
+ CALLBACK_DISTANCE = 4
23
+
24
+ # This callback is triggered periodically according to the configuration set by
25
+ # BrickletDistanceIRV2#set_analog_value_callback_configuration.
26
+ #
27
+ # The parameter is the same as BrickletDistanceIRV2#get_analog_value.
28
+ CALLBACK_ANALOG_VALUE = 8
29
+
30
+ FUNCTION_GET_DISTANCE = 1 # :nodoc:
31
+ FUNCTION_SET_DISTANCE_CALLBACK_CONFIGURATION = 2 # :nodoc:
32
+ FUNCTION_GET_DISTANCE_CALLBACK_CONFIGURATION = 3 # :nodoc:
33
+ FUNCTION_GET_ANALOG_VALUE = 5 # :nodoc:
34
+ FUNCTION_SET_ANALOG_VALUE_CALLBACK_CONFIGURATION = 6 # :nodoc:
35
+ FUNCTION_GET_ANALOG_VALUE_CALLBACK_CONFIGURATION = 7 # :nodoc:
36
+ FUNCTION_SET_MOVING_AVERAGE_CONFIGURATION = 9 # :nodoc:
37
+ FUNCTION_GET_MOVING_AVERAGE_CONFIGURATION = 10 # :nodoc:
38
+ FUNCTION_SET_DISTANCE_LED_CONFIG = 11 # :nodoc:
39
+ FUNCTION_GET_DISTANCE_LED_CONFIG = 12 # :nodoc:
40
+ FUNCTION_SET_SENSOR_TYPE = 13 # :nodoc:
41
+ FUNCTION_GET_SENSOR_TYPE = 14 # :nodoc:
42
+ FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
43
+ FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
44
+ FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
45
+ FUNCTION_SET_WRITE_FIRMWARE_POINTER = 237 # :nodoc:
46
+ FUNCTION_WRITE_FIRMWARE = 238 # :nodoc:
47
+ FUNCTION_SET_STATUS_LED_CONFIG = 239 # :nodoc:
48
+ FUNCTION_GET_STATUS_LED_CONFIG = 240 # :nodoc:
49
+ FUNCTION_GET_CHIP_TEMPERATURE = 242 # :nodoc:
50
+ FUNCTION_RESET = 243 # :nodoc:
51
+ FUNCTION_WRITE_UID = 248 # :nodoc:
52
+ FUNCTION_READ_UID = 249 # :nodoc:
53
+ FUNCTION_GET_IDENTITY = 255 # :nodoc:
54
+
55
+ THRESHOLD_OPTION_OFF = 'x' # :nodoc:
56
+ THRESHOLD_OPTION_OUTSIDE = 'o' # :nodoc:
57
+ THRESHOLD_OPTION_INSIDE = 'i' # :nodoc:
58
+ THRESHOLD_OPTION_SMALLER = '<' # :nodoc:
59
+ THRESHOLD_OPTION_GREATER = '>' # :nodoc:
60
+ DISTANCE_LED_CONFIG_OFF = 0 # :nodoc:
61
+ DISTANCE_LED_CONFIG_ON = 1 # :nodoc:
62
+ DISTANCE_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
63
+ DISTANCE_LED_CONFIG_SHOW_DISTANCE = 3 # :nodoc:
64
+ SENSOR_TYPE_2Y0A41 = 0 # :nodoc:
65
+ SENSOR_TYPE_2Y0A21 = 1 # :nodoc:
66
+ SENSOR_TYPE_2Y0A02 = 2 # :nodoc:
67
+ BOOTLOADER_MODE_BOOTLOADER = 0 # :nodoc:
68
+ BOOTLOADER_MODE_FIRMWARE = 1 # :nodoc:
69
+ BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT = 2 # :nodoc:
70
+ BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT = 3 # :nodoc:
71
+ BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT = 4 # :nodoc:
72
+ BOOTLOADER_STATUS_OK = 0 # :nodoc:
73
+ BOOTLOADER_STATUS_INVALID_MODE = 1 # :nodoc:
74
+ BOOTLOADER_STATUS_NO_CHANGE = 2 # :nodoc:
75
+ BOOTLOADER_STATUS_ENTRY_FUNCTION_NOT_PRESENT = 3 # :nodoc:
76
+ BOOTLOADER_STATUS_DEVICE_IDENTIFIER_INCORRECT = 4 # :nodoc:
77
+ BOOTLOADER_STATUS_CRC_MISMATCH = 5 # :nodoc:
78
+ STATUS_LED_CONFIG_OFF = 0 # :nodoc:
79
+ STATUS_LED_CONFIG_ON = 1 # :nodoc:
80
+ STATUS_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
81
+ STATUS_LED_CONFIG_SHOW_STATUS = 3 # :nodoc:
82
+
83
+ # Creates an object with the unique device ID <tt>uid</tt> and adds it to
84
+ # the IP Connection <tt>ipcon</tt>.
85
+ def initialize(uid, ipcon)
86
+ super uid, ipcon
87
+
88
+ @api_version = [2, 0, 0]
89
+
90
+ @response_expected[FUNCTION_GET_DISTANCE] = RESPONSE_EXPECTED_ALWAYS_TRUE
91
+ @response_expected[FUNCTION_SET_DISTANCE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
92
+ @response_expected[FUNCTION_GET_DISTANCE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
93
+ @response_expected[FUNCTION_GET_ANALOG_VALUE] = RESPONSE_EXPECTED_ALWAYS_TRUE
94
+ @response_expected[FUNCTION_SET_ANALOG_VALUE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
95
+ @response_expected[FUNCTION_GET_ANALOG_VALUE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
96
+ @response_expected[FUNCTION_SET_MOVING_AVERAGE_CONFIGURATION] = RESPONSE_EXPECTED_FALSE
97
+ @response_expected[FUNCTION_GET_MOVING_AVERAGE_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
98
+ @response_expected[FUNCTION_SET_DISTANCE_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
99
+ @response_expected[FUNCTION_GET_DISTANCE_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
100
+ @response_expected[FUNCTION_SET_SENSOR_TYPE] = RESPONSE_EXPECTED_FALSE
101
+ @response_expected[FUNCTION_GET_SENSOR_TYPE] = RESPONSE_EXPECTED_ALWAYS_TRUE
102
+ @response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
103
+ @response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
104
+ @response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
105
+ @response_expected[FUNCTION_SET_WRITE_FIRMWARE_POINTER] = RESPONSE_EXPECTED_FALSE
106
+ @response_expected[FUNCTION_WRITE_FIRMWARE] = RESPONSE_EXPECTED_ALWAYS_TRUE
107
+ @response_expected[FUNCTION_SET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
108
+ @response_expected[FUNCTION_GET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
109
+ @response_expected[FUNCTION_GET_CHIP_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
110
+ @response_expected[FUNCTION_RESET] = RESPONSE_EXPECTED_FALSE
111
+ @response_expected[FUNCTION_WRITE_UID] = RESPONSE_EXPECTED_FALSE
112
+ @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
113
+ @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
114
+
115
+ @callback_formats[CALLBACK_DISTANCE] = 'S'
116
+ @callback_formats[CALLBACK_ANALOG_VALUE] = 'L'
117
+
118
+ end
119
+
120
+ # Returns the distance measured by the sensor. The value is in mm and possible
121
+ # distance ranges are 40 to 300, 100 to 800 and 200 to 1500, depending on the
122
+ # selected IR sensor.
123
+ #
124
+ #
125
+ # If you want to get the value periodically, it is recommended to use the
126
+ # CALLBACK_DISTANCE callback. You can set the callback configuration
127
+ # with BrickletDistanceIRV2#set_distance_callback_configuration.
128
+ def get_distance
129
+ send_request FUNCTION_GET_DISTANCE, [], '', 2, 'S'
130
+ end
131
+
132
+ # The period in ms is the period with which the CALLBACK_DISTANCE callback is triggered
133
+ # periodically. A value of 0 turns the callback off.
134
+ #
135
+ # If the `value has to change`-parameter is set to true, the callback is only
136
+ # triggered after the value has changed. If the value didn't change
137
+ # within the period, the callback is triggered immediately on change.
138
+ #
139
+ # If it is set to false, the callback is continuously triggered with the period,
140
+ # independent of the value.
141
+ #
142
+ # It is furthermore possible to constrain the callback with thresholds.
143
+ #
144
+ # The `option`-parameter together with min/max sets a threshold for the CALLBACK_DISTANCE callback.
145
+ #
146
+ # The following options are possible:
147
+ #
148
+ # "Option", "Description"
149
+ #
150
+ # "'x'", "Threshold is turned off"
151
+ # "'o'", "Threshold is triggered when the value is *outside* the min and max values"
152
+ # "'i'", "Threshold is triggered when the value is *inside* or equal to the min and max values"
153
+ # "'<'", "Threshold is triggered when the value is smaller than the min value (max is ignored)"
154
+ # "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
155
+ #
156
+ # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
157
+ #
158
+ # The default value is (0, false, 'x', 0, 0).
159
+ def set_distance_callback_configuration(period, value_has_to_change, option, min, max)
160
+ send_request FUNCTION_SET_DISTANCE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k S S', 0, ''
161
+ end
162
+
163
+ # Returns the callback configuration as set by BrickletDistanceIRV2#set_distance_callback_configuration.
164
+ def get_distance_callback_configuration
165
+ send_request FUNCTION_GET_DISTANCE_CALLBACK_CONFIGURATION, [], '', 10, 'L ? k S S'
166
+ end
167
+
168
+ # Returns the analog value as read by a analog-to-digital converter.
169
+ # The value has 21 bit with a range of 0 to 2097151.
170
+ #
171
+ # This is unfiltered raw data. We made sure that the integration time
172
+ # of the ADC is shorter then the measurement interval of the sensor
173
+ # (10ms vs 16.5ms). So there is no information lost.
174
+ #
175
+ # If you want to do your own calibration or create your own lookup table
176
+ # you can use this value.
177
+ #
178
+ #
179
+ # If you want to get the value periodically, it is recommended to use the
180
+ # CALLBACK_ANALOG_VALUE callback. You can set the callback configuration
181
+ # with BrickletDistanceIRV2#set_analog_value_callback_configuration.
182
+ def get_analog_value
183
+ send_request FUNCTION_GET_ANALOG_VALUE, [], '', 4, 'L'
184
+ end
185
+
186
+ # The period in ms is the period with which the CALLBACK_ANALOG_VALUE callback is triggered
187
+ # periodically. A value of 0 turns the callback off.
188
+ #
189
+ # If the `value has to change`-parameter is set to true, the callback is only
190
+ # triggered after the value has changed. If the value didn't change
191
+ # within the period, the callback is triggered immediately on change.
192
+ #
193
+ # If it is set to false, the callback is continuously triggered with the period,
194
+ # independent of the value.
195
+ #
196
+ # It is furthermore possible to constrain the callback with thresholds.
197
+ #
198
+ # The `option`-parameter together with min/max sets a threshold for the CALLBACK_ANALOG_VALUE callback.
199
+ #
200
+ # The following options are possible:
201
+ #
202
+ # "Option", "Description"
203
+ #
204
+ # "'x'", "Threshold is turned off"
205
+ # "'o'", "Threshold is triggered when the value is *outside* the min and max values"
206
+ # "'i'", "Threshold is triggered when the value is *inside* or equal to the min and max values"
207
+ # "'<'", "Threshold is triggered when the value is smaller than the min value (max is ignored)"
208
+ # "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
209
+ #
210
+ # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
211
+ #
212
+ # The default value is (0, false, 'x', 0, 0).
213
+ def set_analog_value_callback_configuration(period, value_has_to_change, option, min, max)
214
+ send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k L L', 0, ''
215
+ end
216
+
217
+ # Returns the callback configuration as set by BrickletDistanceIRV2#set_analog_value_callback_configuration.
218
+ def get_analog_value_callback_configuration
219
+ send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_CONFIGURATION, [], '', 14, 'L ? k L L'
220
+ end
221
+
222
+ # Sets the length of a `moving averaging <https://en.wikipedia.org/wiki/Moving_average>`__
223
+ # for the resistance and temperature.
224
+ #
225
+ # Setting the length to 1 will turn the averaging off. With less averaging, there
226
+ # is more noise on the data.
227
+ #
228
+ # The range for the averaging is 1-1000.
229
+ #
230
+ # New data is gathered every ~10ms. With a moving average of length 1000 the
231
+ # resulting averaging window has a length of approximately 10s. If you want to do
232
+ # long term measurements the longest moving average will give the cleanest results.
233
+ #
234
+ # The default value is 25.
235
+ def set_moving_average_configuration(moving_average_length)
236
+ send_request FUNCTION_SET_MOVING_AVERAGE_CONFIGURATION, [moving_average_length], 'C', 0, ''
237
+ end
238
+
239
+ # Returns the moving average configuration as set by BrickletDistanceIRV2#set_moving_average_configuration.
240
+ def get_moving_average_configuration
241
+ send_request FUNCTION_GET_MOVING_AVERAGE_CONFIGURATION, [], '', 1, 'C'
242
+ end
243
+
244
+ # Configures the distance LED to be either turned off, turned on, blink in
245
+ # heartbeat mode or show the distance (brighter = object is nearer).
246
+ #
247
+ # The default value is 3 (show distance).
248
+ def set_distance_led_config(config)
249
+ send_request FUNCTION_SET_DISTANCE_LED_CONFIG, [config], 'C', 0, ''
250
+ end
251
+
252
+ # Returns the LED configuration as set by BrickletDistanceIRV2#set_distance_led_config
253
+ def get_distance_led_config
254
+ send_request FUNCTION_GET_DISTANCE_LED_CONFIG, [], '', 1, 'C'
255
+ end
256
+
257
+ # Sets the sensor type.
258
+ #
259
+ # The Bricklet comes configured with the correct sensor type
260
+ # and the type is saved in flash (i.e. the Bricklet retains the information if
261
+ # power is lost).
262
+ #
263
+ # If you want to change the sensor you can set the type in Brick Viewer,
264
+ # you will likely never need to call this function from your program.
265
+ def set_sensor_type(sensor)
266
+ send_request FUNCTION_SET_SENSOR_TYPE, [sensor], 'C', 0, ''
267
+ end
268
+
269
+ # Returns the sensor type as set by BrickletDistanceIRV2#set_sensor_type.
270
+ def get_sensor_type
271
+ send_request FUNCTION_GET_SENSOR_TYPE, [], '', 1, 'C'
272
+ end
273
+
274
+ # Returns the error count for the communication between Brick and Bricklet.
275
+ #
276
+ # The errors are divided into
277
+ #
278
+ # * ACK checksum errors,
279
+ # * message checksum errors,
280
+ # * framing errors and
281
+ # * overflow errors.
282
+ #
283
+ # The errors counts are for errors that occur on the Bricklet side. All
284
+ # Bricks have a similar function that returns the errors on the Brick side.
285
+ def get_spitfp_error_count
286
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
287
+ end
288
+
289
+ # Sets the bootloader mode and returns the status after the requested
290
+ # mode change was instigated.
291
+ #
292
+ # You can change from bootloader mode to firmware mode and vice versa. A change
293
+ # from bootloader mode to firmware mode will only take place if the entry function,
294
+ # device identifier and CRC are present and correct.
295
+ #
296
+ # This function is used by Brick Viewer during flashing. It should not be
297
+ # necessary to call it in a normal user program.
298
+ def set_bootloader_mode(mode)
299
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
300
+ end
301
+
302
+ # Returns the current bootloader mode, see BrickletDistanceIRV2#set_bootloader_mode.
303
+ def get_bootloader_mode
304
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
305
+ end
306
+
307
+ # Sets the firmware pointer for BrickletDistanceIRV2#write_firmware. The pointer has
308
+ # to be increased by chunks of size 64. The data is written to flash
309
+ # every 4 chunks (which equals to one page of size 256).
310
+ #
311
+ # This function is used by Brick Viewer during flashing. It should not be
312
+ # necessary to call it in a normal user program.
313
+ def set_write_firmware_pointer(pointer)
314
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
315
+ end
316
+
317
+ # Writes 64 Bytes of firmware at the position as written by
318
+ # BrickletDistanceIRV2#set_write_firmware_pointer before. The firmware is written
319
+ # to flash every 4 chunks.
320
+ #
321
+ # You can only write firmware in bootloader mode.
322
+ #
323
+ # This function is used by Brick Viewer during flashing. It should not be
324
+ # necessary to call it in a normal user program.
325
+ def write_firmware(data)
326
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
327
+ end
328
+
329
+ # Sets the status LED configuration. By default the LED shows
330
+ # communication traffic between Brick and Bricklet, it flickers once
331
+ # for every 10 received data packets.
332
+ #
333
+ # You can also turn the LED permanently on/off or show a heartbeat.
334
+ #
335
+ # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
336
+ def set_status_led_config(config)
337
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
338
+ end
339
+
340
+ # Returns the configuration as set by BrickletDistanceIRV2#set_status_led_config
341
+ def get_status_led_config
342
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
343
+ end
344
+
345
+ # Returns the temperature in °C as measured inside the microcontroller. The
346
+ # value returned is not the ambient temperature!
347
+ #
348
+ # The temperature is only proportional to the real temperature and it has bad
349
+ # accuracy. Practically it is only useful as an indicator for
350
+ # temperature changes.
351
+ def get_chip_temperature
352
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
353
+ end
354
+
355
+ # Calling this function will reset the Bricklet. All configurations
356
+ # will be lost.
357
+ #
358
+ # After a reset you have to create new device objects,
359
+ # calling functions on the existing ones will result in
360
+ # undefined behavior!
361
+ def reset
362
+ send_request FUNCTION_RESET, [], '', 0, ''
363
+ end
364
+
365
+ # Writes a new UID into flash. If you want to set a new UID
366
+ # you have to decode the Base58 encoded UID string into an
367
+ # integer first.
368
+ #
369
+ # We recommend that you use Brick Viewer to change the UID.
370
+ def write_uid(uid)
371
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
372
+ end
373
+
374
+ # Returns the current UID as an integer. Encode as
375
+ # Base58 to get the usual string version.
376
+ def read_uid
377
+ send_request FUNCTION_READ_UID, [], '', 4, 'L'
378
+ end
379
+
380
+ # Returns the UID, the UID where the Bricklet is connected to,
381
+ # the position, the hardware and firmware version as well as the
382
+ # device identifier.
383
+ #
384
+ # The position can be 'a', 'b', 'c' or 'd'.
385
+ #
386
+ # The device identifier numbers can be found :ref:`here <device_identifier>`.
387
+ # |device_identifier_constant|
388
+ def get_identity
389
+ send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
390
+ end
391
+
392
+ # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
393
+ def register_callback(id, &block)
394
+ callback = block
395
+ @registered_callbacks[id] = callback
396
+ end
397
+ end
398
+ end
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2018-06-08. #
3
+ # This file was automatically generated on 2018-09-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.17 #
5
+ # Ruby Bindings Version 2.1.18 #
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 #
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2018-06-08. #
3
+ # This file was automatically generated on 2018-09-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.17 #
5
+ # Ruby Bindings Version 2.1.18 #
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 #
@@ -159,6 +159,8 @@ module Tinkerforge
159
159
  # Sets the DMX mode to either master or slave.
160
160
  #
161
161
  # Calling this function sets frame number to 0.
162
+ #
163
+ # The default value is 0 (master).
162
164
  def set_dmx_mode(dmx_mode)
163
165
  send_request FUNCTION_SET_DMX_MODE, [dmx_mode], 'C', 0, ''
164
166
  end
@@ -293,9 +295,9 @@ module Tinkerforge
293
295
  #
294
296
  # The errors are divided into
295
297
  #
296
- # * ack checksum errors,
298
+ # * ACK checksum errors,
297
299
  # * message checksum errors,
298
- # * frameing errors and
300
+ # * framing errors and
299
301
  # * overflow errors.
300
302
  #
301
303
  # The errors counts are for errors that occur on the Bricklet side. All
@@ -309,7 +311,7 @@ module Tinkerforge
309
311
  #
310
312
  # You can change from bootloader mode to firmware mode and vice versa. A change
311
313
  # from bootloader mode to firmware mode will only take place if the entry function,
312
- # device identifier und crc are present and correct.
314
+ # device identifier and CRC are present and correct.
313
315
  #
314
316
  # This function is used by Brick Viewer during flashing. It should not be
315
317
  # necessary to call it in a normal user program.
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2018-06-08. #
3
+ # This file was automatically generated on 2018-09-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.17 #
5
+ # Ruby Bindings Version 2.1.18 #
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 #