tinkerforge 2.1.23 → 2.1.28
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.
- checksums.yaml +5 -5
- data/lib/tinkerforge/brick_dc.rb +156 -75
- data/lib/tinkerforge/brick_hat.rb +109 -30
- data/lib/tinkerforge/brick_hat_zero.rb +119 -21
- data/lib/tinkerforge/brick_imu.rb +191 -86
- data/lib/tinkerforge/brick_imu_v2.rb +219 -118
- data/lib/tinkerforge/brick_master.rb +495 -195
- data/lib/tinkerforge/brick_red.rb +197 -74
- data/lib/tinkerforge/brick_servo.rb +186 -102
- data/lib/tinkerforge/brick_silent_stepper.rb +248 -168
- data/lib/tinkerforge/brick_stepper.rb +212 -100
- data/lib/tinkerforge/bricklet_accelerometer.rb +61 -36
- data/lib/tinkerforge/bricklet_accelerometer_v2.rb +107 -63
- data/lib/tinkerforge/bricklet_air_quality.rb +123 -76
- data/lib/tinkerforge/bricklet_ambient_light.rb +62 -46
- data/lib/tinkerforge/bricklet_ambient_light_v2.rb +41 -28
- data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -28
- data/lib/tinkerforge/bricklet_analog_in.rb +66 -45
- data/lib/tinkerforge/bricklet_analog_in_v2.rb +60 -43
- data/lib/tinkerforge/bricklet_analog_in_v3.rb +68 -32
- data/lib/tinkerforge/bricklet_analog_out.rb +25 -16
- data/lib/tinkerforge/bricklet_analog_out_v2.rb +21 -10
- data/lib/tinkerforge/bricklet_analog_out_v3.rb +55 -22
- data/lib/tinkerforge/bricklet_barometer.rb +108 -58
- data/lib/tinkerforge/bricklet_barometer_v2.rb +109 -67
- data/lib/tinkerforge/bricklet_can.rb +84 -24
- data/lib/tinkerforge/bricklet_can_v2.rb +173 -72
- data/lib/tinkerforge/bricklet_co2.rb +36 -25
- data/lib/tinkerforge/bricklet_co2_v2.rb +119 -60
- data/lib/tinkerforge/bricklet_color.rb +75 -47
- data/lib/tinkerforge/bricklet_color_v2.rb +91 -47
- data/lib/tinkerforge/bricklet_compass.rb +81 -40
- data/lib/tinkerforge/bricklet_current12.rb +61 -40
- data/lib/tinkerforge/bricklet_current25.rb +61 -40
- data/lib/tinkerforge/bricklet_distance_ir.rb +60 -38
- data/lib/tinkerforge/bricklet_distance_ir_v2.rb +85 -45
- data/lib/tinkerforge/bricklet_distance_us.rb +43 -30
- data/lib/tinkerforge/bricklet_distance_us_v2.rb +68 -33
- data/lib/tinkerforge/bricklet_dmx.rb +92 -48
- data/lib/tinkerforge/bricklet_dual_button.rb +23 -12
- data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -29
- data/lib/tinkerforge/bricklet_dual_relay.rb +27 -14
- data/lib/tinkerforge/bricklet_dust_detector.rb +43 -30
- data/lib/tinkerforge/bricklet_e_paper_296x128.rb +115 -63
- data/lib/tinkerforge/bricklet_energy_monitor.rb +81 -40
- data/lib/tinkerforge/bricklet_gps.rb +72 -48
- data/lib/tinkerforge/bricklet_gps_v2.rb +124 -73
- data/lib/tinkerforge/bricklet_hall_effect.rb +43 -28
- data/lib/tinkerforge/bricklet_hall_effect_v2.rb +76 -44
- data/lib/tinkerforge/bricklet_humidity.rb +54 -38
- data/lib/tinkerforge/bricklet_humidity_v2.rb +86 -49
- data/lib/tinkerforge/bricklet_imu_v3.rb +784 -0
- data/lib/tinkerforge/bricklet_industrial_analog_out.rb +41 -18
- data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +84 -40
- data/lib/tinkerforge/bricklet_industrial_counter.rb +102 -59
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +51 -24
- data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +79 -40
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -15
- data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +75 -33
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +43 -29
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +81 -44
- data/lib/tinkerforge/bricklet_industrial_dual_ac_relay.rb +325 -0
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +51 -30
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +139 -40
- data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +63 -28
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -15
- data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -28
- data/lib/tinkerforge/bricklet_io16.rb +57 -32
- data/lib/tinkerforge/bricklet_io16_v2.rb +93 -48
- data/lib/tinkerforge/bricklet_io4.rb +56 -31
- data/lib/tinkerforge/bricklet_io4_v2.rb +109 -57
- data/lib/tinkerforge/bricklet_isolator.rb +111 -35
- data/lib/tinkerforge/bricklet_joystick.rb +63 -42
- data/lib/tinkerforge/bricklet_joystick_v2.rb +71 -35
- data/lib/tinkerforge/bricklet_laser_range_finder.rb +87 -59
- data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +99 -51
- data/lib/tinkerforge/bricklet_lcd_128x64.rb +219 -131
- data/lib/tinkerforge/bricklet_lcd_16x2.rb +49 -25
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +59 -29
- data/lib/tinkerforge/bricklet_led_strip.rb +69 -47
- data/lib/tinkerforge/bricklet_led_strip_v2.rb +105 -48
- data/lib/tinkerforge/bricklet_line.rb +35 -22
- data/lib/tinkerforge/bricklet_linear_poti.rb +53 -35
- data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -24
- data/lib/tinkerforge/bricklet_load_cell.rb +64 -40
- data/lib/tinkerforge/bricklet_load_cell_v2.rb +81 -41
- data/lib/tinkerforge/bricklet_moisture.rb +43 -30
- data/lib/tinkerforge/bricklet_motion_detector.rb +21 -10
- data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -29
- data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -32
- data/lib/tinkerforge/bricklet_multi_touch.rb +30 -17
- data/lib/tinkerforge/bricklet_multi_touch_v2.rb +76 -39
- data/lib/tinkerforge/bricklet_nfc.rb +130 -80
- data/lib/tinkerforge/bricklet_nfc_rfid.rb +32 -13
- data/lib/tinkerforge/bricklet_oled_128x64.rb +30 -17
- data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +75 -40
- data/lib/tinkerforge/bricklet_oled_64x48.rb +30 -17
- data/lib/tinkerforge/bricklet_one_wire.rb +65 -24
- data/lib/tinkerforge/bricklet_outdoor_weather.rb +84 -41
- data/lib/tinkerforge/bricklet_particulate_matter.rb +85 -37
- data/lib/tinkerforge/bricklet_performance_dc.rb +676 -0
- data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -13
- data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -19
- data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +84 -57
- data/lib/tinkerforge/bricklet_ptc.rb +76 -51
- data/lib/tinkerforge/bricklet_ptc_v2.rb +96 -54
- data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -36
- data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -47
- data/lib/tinkerforge/bricklet_remote_switch.rb +38 -29
- data/lib/tinkerforge/bricklet_remote_switch_v2.rb +86 -49
- data/lib/tinkerforge/bricklet_rgb_led.rb +17 -8
- data/lib/tinkerforge/bricklet_rgb_led_button.rb +61 -30
- data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +78 -33
- data/lib/tinkerforge/bricklet_rgb_led_v2.rb +51 -20
- data/lib/tinkerforge/bricklet_rotary_encoder.rb +40 -25
- data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -27
- data/lib/tinkerforge/bricklet_rotary_poti.rb +55 -37
- data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +57 -26
- data/lib/tinkerforge/bricklet_rs232.rb +89 -28
- data/lib/tinkerforge/bricklet_rs232_v2.rb +121 -47
- data/lib/tinkerforge/bricklet_rs485.rb +250 -164
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
- data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -36
- data/lib/tinkerforge/bricklet_servo_v2.rb +565 -0
- data/lib/tinkerforge/bricklet_solid_state_relay.rb +24 -13
- data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +58 -25
- data/lib/tinkerforge/bricklet_sound_intensity.rb +36 -24
- data/lib/tinkerforge/bricklet_sound_pressure_level.rb +77 -41
- data/lib/tinkerforge/bricklet_temperature.rb +43 -28
- data/lib/tinkerforge/bricklet_temperature_ir.rb +61 -47
- data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +74 -44
- data/lib/tinkerforge/bricklet_temperature_v2.rb +62 -31
- data/lib/tinkerforge/bricklet_thermal_imaging.rb +118 -68
- data/lib/tinkerforge/bricklet_thermocouple.rb +46 -30
- data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -30
- data/lib/tinkerforge/bricklet_tilt.rb +23 -10
- data/lib/tinkerforge/bricklet_uv_light.rb +37 -24
- data/lib/tinkerforge/bricklet_uv_light_v2.rb +87 -46
- data/lib/tinkerforge/bricklet_voltage.rb +54 -37
- data/lib/tinkerforge/bricklet_voltage_current.rb +94 -85
- data/lib/tinkerforge/bricklet_voltage_current_v2.rb +92 -77
- data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +81 -36
- data/lib/tinkerforge/device_display_names.rb +167 -0
- data/lib/tinkerforge/ip_connection.rb +156 -33
- data/lib/tinkerforge/version.rb +1 -1
- metadata +8 -3
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on
|
|
3
|
+
# This file was automatically generated on 2021-01-15. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.28 #
|
|
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 contactless object temperature between -70°C and +380°C
|
|
14
16
|
class BrickletTemperatureIR < Device
|
|
@@ -72,7 +74,7 @@ module Tinkerforge
|
|
|
72
74
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
73
75
|
# the IP Connection <tt>ipcon</tt>.
|
|
74
76
|
def initialize(uid, ipcon)
|
|
75
|
-
super uid, ipcon
|
|
77
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
76
78
|
|
|
77
79
|
@api_version = [2, 0, 0]
|
|
78
80
|
|
|
@@ -92,30 +94,27 @@ module Tinkerforge
|
|
|
92
94
|
@response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
93
95
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
94
96
|
|
|
95
|
-
@callback_formats[CALLBACK_AMBIENT_TEMPERATURE] = 's'
|
|
96
|
-
@callback_formats[CALLBACK_OBJECT_TEMPERATURE] = 's'
|
|
97
|
-
@callback_formats[CALLBACK_AMBIENT_TEMPERATURE_REACHED] = 's'
|
|
98
|
-
@callback_formats[CALLBACK_OBJECT_TEMPERATURE_REACHED] = 's'
|
|
97
|
+
@callback_formats[CALLBACK_AMBIENT_TEMPERATURE] = [10, 's']
|
|
98
|
+
@callback_formats[CALLBACK_OBJECT_TEMPERATURE] = [10, 's']
|
|
99
|
+
@callback_formats[CALLBACK_AMBIENT_TEMPERATURE_REACHED] = [10, 's']
|
|
100
|
+
@callback_formats[CALLBACK_OBJECT_TEMPERATURE_REACHED] = [10, 's']
|
|
99
101
|
|
|
102
|
+
@ipcon.add_device self
|
|
100
103
|
end
|
|
101
104
|
|
|
102
|
-
# Returns the ambient temperature of the sensor.
|
|
103
|
-
# has a range of -400 to 1250 and is given in °C/10,
|
|
104
|
-
# e.g. a value of 423 means that an ambient temperature of 42.3 °C is
|
|
105
|
-
# measured.
|
|
105
|
+
# Returns the ambient temperature of the sensor.
|
|
106
106
|
#
|
|
107
107
|
# If you want to get the ambient temperature periodically, it is recommended
|
|
108
108
|
# to use the CALLBACK_AMBIENT_TEMPERATURE callback and set the period with
|
|
109
109
|
# BrickletTemperatureIR#set_ambient_temperature_callback_period.
|
|
110
110
|
def get_ambient_temperature
|
|
111
|
-
|
|
111
|
+
check_validity
|
|
112
|
+
|
|
113
|
+
send_request FUNCTION_GET_AMBIENT_TEMPERATURE, [], '', 10, 's'
|
|
112
114
|
end
|
|
113
115
|
|
|
114
116
|
# Returns the object temperature of the sensor, i.e. the temperature
|
|
115
|
-
# of the surface of the object the sensor is aimed at.
|
|
116
|
-
# has a range of -700 to 3800 and is given in °C/10,
|
|
117
|
-
# e.g. a value of 3001 means that a temperature of 300.1 °C is measured
|
|
118
|
-
# on the surface of the object.
|
|
117
|
+
# of the surface of the object the sensor is aimed at.
|
|
119
118
|
#
|
|
120
119
|
# The temperature of different materials is dependent on their `emissivity
|
|
121
120
|
# <https://en.wikipedia.org/wiki/Emissivity>`__. The emissivity of the material
|
|
@@ -125,7 +124,9 @@ module Tinkerforge
|
|
|
125
124
|
# to use the CALLBACK_OBJECT_TEMPERATURE callback and set the period with
|
|
126
125
|
# BrickletTemperatureIR#set_object_temperature_callback_period.
|
|
127
126
|
def get_object_temperature
|
|
128
|
-
|
|
127
|
+
check_validity
|
|
128
|
+
|
|
129
|
+
send_request FUNCTION_GET_OBJECT_TEMPERATURE, [], '', 10, 's'
|
|
129
130
|
end
|
|
130
131
|
|
|
131
132
|
# Sets the `emissivity <https://en.wikipedia.org/wiki/Emissivity>`__ that is
|
|
@@ -144,49 +145,54 @@ module Tinkerforge
|
|
|
144
145
|
# If you need a precise measurement for the object temperature, it is
|
|
145
146
|
# absolutely crucial that you also provide a precise emissivity.
|
|
146
147
|
#
|
|
147
|
-
# The default emissivity is 1.0 (value of 65535) and the minimum emissivity the
|
|
148
|
-
# sensor can handle is 0.1 (value of 6553).
|
|
149
|
-
#
|
|
150
148
|
# The emissivity is stored in non-volatile memory and will still be used after a restart or power cycle of the Bricklet.
|
|
151
149
|
def set_emissivity(emissivity)
|
|
152
|
-
|
|
150
|
+
check_validity
|
|
151
|
+
|
|
152
|
+
send_request FUNCTION_SET_EMISSIVITY, [emissivity], 'S', 8, ''
|
|
153
153
|
end
|
|
154
154
|
|
|
155
155
|
# Returns the emissivity as set by BrickletTemperatureIR#set_emissivity.
|
|
156
156
|
def get_emissivity
|
|
157
|
-
|
|
157
|
+
check_validity
|
|
158
|
+
|
|
159
|
+
send_request FUNCTION_GET_EMISSIVITY, [], '', 10, 'S'
|
|
158
160
|
end
|
|
159
161
|
|
|
160
|
-
# Sets the period
|
|
162
|
+
# Sets the period with which the CALLBACK_AMBIENT_TEMPERATURE callback is
|
|
161
163
|
# triggered periodically. A value of 0 turns the callback off.
|
|
162
164
|
#
|
|
163
165
|
# The CALLBACK_AMBIENT_TEMPERATURE callback is only triggered if the temperature has
|
|
164
166
|
# changed since the last triggering.
|
|
165
|
-
#
|
|
166
|
-
# The default value is 0.
|
|
167
167
|
def set_ambient_temperature_callback_period(period)
|
|
168
|
-
|
|
168
|
+
check_validity
|
|
169
|
+
|
|
170
|
+
send_request FUNCTION_SET_AMBIENT_TEMPERATURE_CALLBACK_PERIOD, [period], 'L', 8, ''
|
|
169
171
|
end
|
|
170
172
|
|
|
171
173
|
# Returns the period as set by BrickletTemperatureIR#set_ambient_temperature_callback_period.
|
|
172
174
|
def get_ambient_temperature_callback_period
|
|
173
|
-
|
|
175
|
+
check_validity
|
|
176
|
+
|
|
177
|
+
send_request FUNCTION_GET_AMBIENT_TEMPERATURE_CALLBACK_PERIOD, [], '', 12, 'L'
|
|
174
178
|
end
|
|
175
179
|
|
|
176
|
-
# Sets the period
|
|
180
|
+
# Sets the period with which the CALLBACK_OBJECT_TEMPERATURE callback is
|
|
177
181
|
# triggered periodically. A value of 0 turns the callback off.
|
|
178
182
|
#
|
|
179
183
|
# The CALLBACK_OBJECT_TEMPERATURE callback is only triggered if the temperature
|
|
180
184
|
# has changed since the last triggering.
|
|
181
|
-
#
|
|
182
|
-
# The default value is 0.
|
|
183
185
|
def set_object_temperature_callback_period(period)
|
|
184
|
-
|
|
186
|
+
check_validity
|
|
187
|
+
|
|
188
|
+
send_request FUNCTION_SET_OBJECT_TEMPERATURE_CALLBACK_PERIOD, [period], 'L', 8, ''
|
|
185
189
|
end
|
|
186
190
|
|
|
187
191
|
# Returns the period as set by BrickletTemperatureIR#set_object_temperature_callback_period.
|
|
188
192
|
def get_object_temperature_callback_period
|
|
189
|
-
|
|
193
|
+
check_validity
|
|
194
|
+
|
|
195
|
+
send_request FUNCTION_GET_OBJECT_TEMPERATURE_CALLBACK_PERIOD, [], '', 12, 'L'
|
|
190
196
|
end
|
|
191
197
|
|
|
192
198
|
# Sets the thresholds for the CALLBACK_AMBIENT_TEMPERATURE_REACHED callback.
|
|
@@ -200,15 +206,17 @@ module Tinkerforge
|
|
|
200
206
|
# "'i'", "Callback is triggered when the ambient temperature is *inside* the min and max values"
|
|
201
207
|
# "'<'", "Callback is triggered when the ambient temperature is smaller than the min value (max is ignored)"
|
|
202
208
|
# "'>'", "Callback is triggered when the ambient temperature is greater than the min value (max is ignored)"
|
|
203
|
-
#
|
|
204
|
-
# The default value is ('x', 0, 0).
|
|
205
209
|
def set_ambient_temperature_callback_threshold(option, min, max)
|
|
206
|
-
|
|
210
|
+
check_validity
|
|
211
|
+
|
|
212
|
+
send_request FUNCTION_SET_AMBIENT_TEMPERATURE_CALLBACK_THRESHOLD, [option, min, max], 'k s s', 8, ''
|
|
207
213
|
end
|
|
208
214
|
|
|
209
215
|
# Returns the threshold as set by BrickletTemperatureIR#set_ambient_temperature_callback_threshold.
|
|
210
216
|
def get_ambient_temperature_callback_threshold
|
|
211
|
-
|
|
217
|
+
check_validity
|
|
218
|
+
|
|
219
|
+
send_request FUNCTION_GET_AMBIENT_TEMPERATURE_CALLBACK_THRESHOLD, [], '', 13, 'k s s'
|
|
212
220
|
end
|
|
213
221
|
|
|
214
222
|
# Sets the thresholds for the CALLBACK_OBJECT_TEMPERATURE_REACHED callback.
|
|
@@ -222,18 +230,20 @@ module Tinkerforge
|
|
|
222
230
|
# "'i'", "Callback is triggered when the object temperature is *inside* the min and max values"
|
|
223
231
|
# "'<'", "Callback is triggered when the object temperature is smaller than the min value (max is ignored)"
|
|
224
232
|
# "'>'", "Callback is triggered when the object temperature is greater than the min value (max is ignored)"
|
|
225
|
-
#
|
|
226
|
-
# The default value is ('x', 0, 0).
|
|
227
233
|
def set_object_temperature_callback_threshold(option, min, max)
|
|
228
|
-
|
|
234
|
+
check_validity
|
|
235
|
+
|
|
236
|
+
send_request FUNCTION_SET_OBJECT_TEMPERATURE_CALLBACK_THRESHOLD, [option, min, max], 'k s s', 8, ''
|
|
229
237
|
end
|
|
230
238
|
|
|
231
239
|
# Returns the threshold as set by BrickletTemperatureIR#set_object_temperature_callback_threshold.
|
|
232
240
|
def get_object_temperature_callback_threshold
|
|
233
|
-
|
|
241
|
+
check_validity
|
|
242
|
+
|
|
243
|
+
send_request FUNCTION_GET_OBJECT_TEMPERATURE_CALLBACK_THRESHOLD, [], '', 13, 'k s s'
|
|
234
244
|
end
|
|
235
245
|
|
|
236
|
-
# Sets the period
|
|
246
|
+
# Sets the period with which the threshold callbacks
|
|
237
247
|
#
|
|
238
248
|
# * CALLBACK_AMBIENT_TEMPERATURE_REACHED,
|
|
239
249
|
# * CALLBACK_OBJECT_TEMPERATURE_REACHED
|
|
@@ -244,27 +254,31 @@ module Tinkerforge
|
|
|
244
254
|
# * BrickletTemperatureIR#set_object_temperature_callback_threshold
|
|
245
255
|
#
|
|
246
256
|
# keep being reached.
|
|
247
|
-
#
|
|
248
|
-
# The default value is 100.
|
|
249
257
|
def set_debounce_period(debounce)
|
|
250
|
-
|
|
258
|
+
check_validity
|
|
259
|
+
|
|
260
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
|
|
251
261
|
end
|
|
252
262
|
|
|
253
263
|
# Returns the debounce period as set by BrickletTemperatureIR#set_debounce_period.
|
|
254
264
|
def get_debounce_period
|
|
255
|
-
|
|
265
|
+
check_validity
|
|
266
|
+
|
|
267
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
|
|
256
268
|
end
|
|
257
269
|
|
|
258
270
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
259
271
|
# the position, the hardware and firmware version as well as the
|
|
260
272
|
# device identifier.
|
|
261
273
|
#
|
|
262
|
-
# The position can be 'a', 'b', 'c' or '
|
|
274
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
275
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
276
|
+
# position 'z'.
|
|
263
277
|
#
|
|
264
278
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
265
279
|
# |device_identifier_constant|
|
|
266
280
|
def get_identity
|
|
267
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
281
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
268
282
|
end
|
|
269
283
|
|
|
270
284
|
# 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
|
|
3
|
+
# This file was automatically generated on 2021-01-15. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.28 #
|
|
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 contactless object temperature between -70°C and +380°C
|
|
14
16
|
class BrickletTemperatureIRV2 < Device
|
|
@@ -72,7 +74,7 @@ module Tinkerforge
|
|
|
72
74
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
73
75
|
# the IP Connection <tt>ipcon</tt>.
|
|
74
76
|
def initialize(uid, ipcon)
|
|
75
|
-
super uid, ipcon
|
|
77
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
76
78
|
|
|
77
79
|
@api_version = [2, 0, 1]
|
|
78
80
|
|
|
@@ -97,25 +99,25 @@ module Tinkerforge
|
|
|
97
99
|
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
98
100
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
99
101
|
|
|
100
|
-
@callback_formats[CALLBACK_AMBIENT_TEMPERATURE] = 's'
|
|
101
|
-
@callback_formats[CALLBACK_OBJECT_TEMPERATURE] = 's'
|
|
102
|
+
@callback_formats[CALLBACK_AMBIENT_TEMPERATURE] = [10, 's']
|
|
103
|
+
@callback_formats[CALLBACK_OBJECT_TEMPERATURE] = [10, 's']
|
|
102
104
|
|
|
105
|
+
@ipcon.add_device self
|
|
103
106
|
end
|
|
104
107
|
|
|
105
|
-
# Returns the ambient temperature of the sensor.
|
|
106
|
-
# has a range of -400 to 1250 and is given in °C/10,
|
|
107
|
-
# e.g. a value of 423 means that an ambient temperature of 42.3 °C is
|
|
108
|
-
# measured.
|
|
108
|
+
# Returns the ambient temperature of the sensor.
|
|
109
109
|
#
|
|
110
110
|
#
|
|
111
111
|
# If you want to get the value periodically, it is recommended to use the
|
|
112
112
|
# CALLBACK_AMBIENT_TEMPERATURE callback. You can set the callback configuration
|
|
113
113
|
# with BrickletTemperatureIRV2#set_ambient_temperature_callback_configuration.
|
|
114
114
|
def get_ambient_temperature
|
|
115
|
-
|
|
115
|
+
check_validity
|
|
116
|
+
|
|
117
|
+
send_request FUNCTION_GET_AMBIENT_TEMPERATURE, [], '', 10, 's'
|
|
116
118
|
end
|
|
117
119
|
|
|
118
|
-
# The period
|
|
120
|
+
# The period is the period with which the CALLBACK_AMBIENT_TEMPERATURE callback is triggered
|
|
119
121
|
# periodically. A value of 0 turns the callback off.
|
|
120
122
|
#
|
|
121
123
|
# If the `value has to change`-parameter is set to true, the callback is only
|
|
@@ -140,22 +142,21 @@ module Tinkerforge
|
|
|
140
142
|
# "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
|
|
141
143
|
#
|
|
142
144
|
# If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
|
|
143
|
-
#
|
|
144
|
-
# The default value is (0, false, 'x', 0, 0).
|
|
145
145
|
def set_ambient_temperature_callback_configuration(period, value_has_to_change, option, min, max)
|
|
146
|
-
|
|
146
|
+
check_validity
|
|
147
|
+
|
|
148
|
+
send_request FUNCTION_SET_AMBIENT_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k s s', 8, ''
|
|
147
149
|
end
|
|
148
150
|
|
|
149
151
|
# Returns the callback configuration as set by BrickletTemperatureIRV2#set_ambient_temperature_callback_configuration.
|
|
150
152
|
def get_ambient_temperature_callback_configuration
|
|
151
|
-
|
|
153
|
+
check_validity
|
|
154
|
+
|
|
155
|
+
send_request FUNCTION_GET_AMBIENT_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 18, 'L ? k s s'
|
|
152
156
|
end
|
|
153
157
|
|
|
154
158
|
# Returns the object temperature of the sensor, i.e. the temperature
|
|
155
|
-
# of the surface of the object the sensor is aimed at.
|
|
156
|
-
# has a range of -700 to 3800 and is given in °C/10,
|
|
157
|
-
# e.g. a value of 3001 means that a temperature of 300.1 °C is measured
|
|
158
|
-
# on the surface of the object.
|
|
159
|
+
# of the surface of the object the sensor is aimed at.
|
|
159
160
|
#
|
|
160
161
|
# The temperature of different materials is dependent on their `emissivity
|
|
161
162
|
# <https://en.wikipedia.org/wiki/Emissivity>`__. The emissivity of the material
|
|
@@ -166,10 +167,12 @@ module Tinkerforge
|
|
|
166
167
|
# CALLBACK_OBJECT_TEMPERATURE callback. You can set the callback configuration
|
|
167
168
|
# with BrickletTemperatureIRV2#set_object_temperature_callback_configuration.
|
|
168
169
|
def get_object_temperature
|
|
169
|
-
|
|
170
|
+
check_validity
|
|
171
|
+
|
|
172
|
+
send_request FUNCTION_GET_OBJECT_TEMPERATURE, [], '', 10, 's'
|
|
170
173
|
end
|
|
171
174
|
|
|
172
|
-
# The period
|
|
175
|
+
# The period is the period with which the CALLBACK_OBJECT_TEMPERATURE callback is triggered
|
|
173
176
|
# periodically. A value of 0 turns the callback off.
|
|
174
177
|
#
|
|
175
178
|
# If the `value has to change`-parameter is set to true, the callback is only
|
|
@@ -194,15 +197,17 @@ module Tinkerforge
|
|
|
194
197
|
# "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
|
|
195
198
|
#
|
|
196
199
|
# If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
|
|
197
|
-
#
|
|
198
|
-
# The default value is (0, false, 'x', 0, 0).
|
|
199
200
|
def set_object_temperature_callback_configuration(period, value_has_to_change, option, min, max)
|
|
200
|
-
|
|
201
|
+
check_validity
|
|
202
|
+
|
|
203
|
+
send_request FUNCTION_SET_OBJECT_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k s s', 8, ''
|
|
201
204
|
end
|
|
202
205
|
|
|
203
206
|
# Returns the callback configuration as set by BrickletTemperatureIRV2#set_object_temperature_callback_configuration.
|
|
204
207
|
def get_object_temperature_callback_configuration
|
|
205
|
-
|
|
208
|
+
check_validity
|
|
209
|
+
|
|
210
|
+
send_request FUNCTION_GET_OBJECT_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 18, 'L ? k s s'
|
|
206
211
|
end
|
|
207
212
|
|
|
208
213
|
# Sets the `emissivity <https://en.wikipedia.org/wiki/Emissivity>`__ that is
|
|
@@ -221,18 +226,19 @@ module Tinkerforge
|
|
|
221
226
|
# If you need a precise measurement for the object temperature, it is
|
|
222
227
|
# absolutely crucial that you also provide a precise emissivity.
|
|
223
228
|
#
|
|
224
|
-
# The default emissivity is 1.0 (value of 65535) and the minimum emissivity the
|
|
225
|
-
# sensor can handle is 0.1 (value of 6553).
|
|
226
|
-
#
|
|
227
229
|
# The emissivity is stored in non-volatile memory and will still be
|
|
228
230
|
# used after a restart or power cycle of the Bricklet.
|
|
229
231
|
def set_emissivity(emissivity)
|
|
230
|
-
|
|
232
|
+
check_validity
|
|
233
|
+
|
|
234
|
+
send_request FUNCTION_SET_EMISSIVITY, [emissivity], 'S', 8, ''
|
|
231
235
|
end
|
|
232
236
|
|
|
233
237
|
# Returns the emissivity as set by BrickletTemperatureIRV2#set_emissivity.
|
|
234
238
|
def get_emissivity
|
|
235
|
-
|
|
239
|
+
check_validity
|
|
240
|
+
|
|
241
|
+
send_request FUNCTION_GET_EMISSIVITY, [], '', 10, 'S'
|
|
236
242
|
end
|
|
237
243
|
|
|
238
244
|
# Returns the error count for the communication between Brick and Bricklet.
|
|
@@ -247,7 +253,9 @@ module Tinkerforge
|
|
|
247
253
|
# The errors counts are for errors that occur on the Bricklet side. All
|
|
248
254
|
# Bricks have a similar function that returns the errors on the Brick side.
|
|
249
255
|
def get_spitfp_error_count
|
|
250
|
-
|
|
256
|
+
check_validity
|
|
257
|
+
|
|
258
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
|
251
259
|
end
|
|
252
260
|
|
|
253
261
|
# Sets the bootloader mode and returns the status after the requested
|
|
@@ -260,12 +268,16 @@ module Tinkerforge
|
|
|
260
268
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
261
269
|
# necessary to call it in a normal user program.
|
|
262
270
|
def set_bootloader_mode(mode)
|
|
263
|
-
|
|
271
|
+
check_validity
|
|
272
|
+
|
|
273
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
|
264
274
|
end
|
|
265
275
|
|
|
266
276
|
# Returns the current bootloader mode, see BrickletTemperatureIRV2#set_bootloader_mode.
|
|
267
277
|
def get_bootloader_mode
|
|
268
|
-
|
|
278
|
+
check_validity
|
|
279
|
+
|
|
280
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
|
269
281
|
end
|
|
270
282
|
|
|
271
283
|
# Sets the firmware pointer for BrickletTemperatureIRV2#write_firmware. The pointer has
|
|
@@ -275,7 +287,9 @@ module Tinkerforge
|
|
|
275
287
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
276
288
|
# necessary to call it in a normal user program.
|
|
277
289
|
def set_write_firmware_pointer(pointer)
|
|
278
|
-
|
|
290
|
+
check_validity
|
|
291
|
+
|
|
292
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
|
279
293
|
end
|
|
280
294
|
|
|
281
295
|
# Writes 64 Bytes of firmware at the position as written by
|
|
@@ -287,7 +301,9 @@ module Tinkerforge
|
|
|
287
301
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
288
302
|
# necessary to call it in a normal user program.
|
|
289
303
|
def write_firmware(data)
|
|
290
|
-
|
|
304
|
+
check_validity
|
|
305
|
+
|
|
306
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
|
291
307
|
end
|
|
292
308
|
|
|
293
309
|
# Sets the status LED configuration. By default the LED shows
|
|
@@ -298,22 +314,28 @@ module Tinkerforge
|
|
|
298
314
|
#
|
|
299
315
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
|
300
316
|
def set_status_led_config(config)
|
|
301
|
-
|
|
317
|
+
check_validity
|
|
318
|
+
|
|
319
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
|
302
320
|
end
|
|
303
321
|
|
|
304
322
|
# Returns the configuration as set by BrickletTemperatureIRV2#set_status_led_config
|
|
305
323
|
def get_status_led_config
|
|
306
|
-
|
|
324
|
+
check_validity
|
|
325
|
+
|
|
326
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
|
307
327
|
end
|
|
308
328
|
|
|
309
|
-
# Returns the temperature
|
|
329
|
+
# Returns the temperature as measured inside the microcontroller. The
|
|
310
330
|
# value returned is not the ambient temperature!
|
|
311
331
|
#
|
|
312
332
|
# The temperature is only proportional to the real temperature and it has bad
|
|
313
333
|
# accuracy. Practically it is only useful as an indicator for
|
|
314
334
|
# temperature changes.
|
|
315
335
|
def get_chip_temperature
|
|
316
|
-
|
|
336
|
+
check_validity
|
|
337
|
+
|
|
338
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
|
317
339
|
end
|
|
318
340
|
|
|
319
341
|
# Calling this function will reset the Bricklet. All configurations
|
|
@@ -323,7 +345,9 @@ module Tinkerforge
|
|
|
323
345
|
# calling functions on the existing ones will result in
|
|
324
346
|
# undefined behavior!
|
|
325
347
|
def reset
|
|
326
|
-
|
|
348
|
+
check_validity
|
|
349
|
+
|
|
350
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
|
327
351
|
end
|
|
328
352
|
|
|
329
353
|
# Writes a new UID into flash. If you want to set a new UID
|
|
@@ -332,25 +356,31 @@ module Tinkerforge
|
|
|
332
356
|
#
|
|
333
357
|
# We recommend that you use Brick Viewer to change the UID.
|
|
334
358
|
def write_uid(uid)
|
|
335
|
-
|
|
359
|
+
check_validity
|
|
360
|
+
|
|
361
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
|
336
362
|
end
|
|
337
363
|
|
|
338
364
|
# Returns the current UID as an integer. Encode as
|
|
339
365
|
# Base58 to get the usual string version.
|
|
340
366
|
def read_uid
|
|
341
|
-
|
|
367
|
+
check_validity
|
|
368
|
+
|
|
369
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
|
342
370
|
end
|
|
343
371
|
|
|
344
372
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
345
373
|
# the position, the hardware and firmware version as well as the
|
|
346
374
|
# device identifier.
|
|
347
375
|
#
|
|
348
|
-
# The position can be 'a', 'b', 'c' or '
|
|
376
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
377
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
378
|
+
# position 'z'.
|
|
349
379
|
#
|
|
350
380
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
351
381
|
# |device_identifier_constant|
|
|
352
382
|
def get_identity
|
|
353
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
383
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
354
384
|
end
|
|
355
385
|
|
|
356
386
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|