tinkerforge 2.1.22 → 2.1.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/lib/tinkerforge/brick_dc.rb +157 -76
- data/lib/tinkerforge/brick_hat.rb +115 -32
- data/lib/tinkerforge/brick_hat_zero.rb +119 -21
- data/lib/tinkerforge/brick_imu.rb +192 -87
- data/lib/tinkerforge/brick_imu_v2.rb +220 -119
- data/lib/tinkerforge/brick_master.rb +498 -198
- data/lib/tinkerforge/brick_red.rb +197 -74
- data/lib/tinkerforge/brick_servo.rb +187 -103
- data/lib/tinkerforge/brick_silent_stepper.rb +249 -169
- data/lib/tinkerforge/brick_stepper.rb +214 -102
- data/lib/tinkerforge/bricklet_accelerometer.rb +61 -36
- data/lib/tinkerforge/bricklet_accelerometer_v2.rb +167 -48
- 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 +77 -49
- data/lib/tinkerforge/bricklet_color_v2.rb +493 -0
- data/lib/tinkerforge/bricklet_compass.rb +397 -0
- 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 +335 -0
- 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 +416 -0
- 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 +101 -53
- data/lib/tinkerforge/bricklet_lcd_128x64.rb +241 -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 +371 -0
- 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 +97 -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_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 +290 -0
- data/lib/tinkerforge/bricklet_rs232.rb +89 -28
- data/lib/tinkerforge/bricklet_rs232_v2.rb +121 -47
- data/lib/tinkerforge/bricklet_rs485.rb +303 -207
- 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_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 +63 -47
- data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +75 -53
- 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 +103 -77
- data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +410 -0
- data/lib/tinkerforge/device_display_names.rb +165 -0
- data/lib/tinkerforge/ip_connection.rb +155 -33
- data/lib/tinkerforge/version.rb +1 -1
- metadata +14 -4
|
@@ -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 2020-11-02. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.27 #
|
|
6
6
|
# #
|
|
7
7
|
# If you have a bugfix for this file and want to commit it, #
|
|
8
8
|
# please fix the bug in the generator. You can find a link #
|
|
9
9
|
# to the generators git repository on tinkerforge.com #
|
|
10
10
|
#############################################################
|
|
11
11
|
|
|
12
|
+
require_relative './ip_connection'
|
|
13
|
+
|
|
12
14
|
module Tinkerforge
|
|
13
15
|
# Measures ambient temperature with 0.5°C accuracy
|
|
14
16
|
class BrickletTemperature < Device
|
|
@@ -53,7 +55,7 @@ module Tinkerforge
|
|
|
53
55
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
54
56
|
# the IP Connection <tt>ipcon</tt>.
|
|
55
57
|
def initialize(uid, ipcon)
|
|
56
|
-
super uid, ipcon
|
|
58
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
57
59
|
|
|
58
60
|
@api_version = [2, 0, 1]
|
|
59
61
|
|
|
@@ -68,36 +70,39 @@ module Tinkerforge
|
|
|
68
70
|
@response_expected[FUNCTION_GET_I2C_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
69
71
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
70
72
|
|
|
71
|
-
@callback_formats[CALLBACK_TEMPERATURE] = 's'
|
|
72
|
-
@callback_formats[CALLBACK_TEMPERATURE_REACHED] = 's'
|
|
73
|
+
@callback_formats[CALLBACK_TEMPERATURE] = [10, 's']
|
|
74
|
+
@callback_formats[CALLBACK_TEMPERATURE_REACHED] = [10, 's']
|
|
73
75
|
|
|
76
|
+
@ipcon.add_device self
|
|
74
77
|
end
|
|
75
78
|
|
|
76
|
-
# Returns the temperature of the sensor.
|
|
77
|
-
# has a range of -2500 to 8500 and is given in °C/100,
|
|
78
|
-
# e.g. a value of 4223 means that a temperature of 42.23 °C is measured.
|
|
79
|
+
# Returns the temperature of the sensor.
|
|
79
80
|
#
|
|
80
81
|
# If you want to get the temperature periodically, it is recommended
|
|
81
82
|
# to use the CALLBACK_TEMPERATURE callback and set the period with
|
|
82
83
|
# BrickletTemperature#set_temperature_callback_period.
|
|
83
84
|
def get_temperature
|
|
84
|
-
|
|
85
|
+
check_validity
|
|
86
|
+
|
|
87
|
+
send_request FUNCTION_GET_TEMPERATURE, [], '', 10, 's'
|
|
85
88
|
end
|
|
86
89
|
|
|
87
|
-
# Sets the period
|
|
90
|
+
# Sets the period with which the CALLBACK_TEMPERATURE callback is triggered
|
|
88
91
|
# periodically. A value of 0 turns the callback off.
|
|
89
92
|
#
|
|
90
93
|
# The CALLBACK_TEMPERATURE callback is only triggered if the temperature has changed
|
|
91
94
|
# since the last triggering.
|
|
92
|
-
#
|
|
93
|
-
# The default value is 0.
|
|
94
95
|
def set_temperature_callback_period(period)
|
|
95
|
-
|
|
96
|
+
check_validity
|
|
97
|
+
|
|
98
|
+
send_request FUNCTION_SET_TEMPERATURE_CALLBACK_PERIOD, [period], 'L', 8, ''
|
|
96
99
|
end
|
|
97
100
|
|
|
98
101
|
# Returns the period as set by BrickletTemperature#set_temperature_callback_period.
|
|
99
102
|
def get_temperature_callback_period
|
|
100
|
-
|
|
103
|
+
check_validity
|
|
104
|
+
|
|
105
|
+
send_request FUNCTION_GET_TEMPERATURE_CALLBACK_PERIOD, [], '', 12, 'L'
|
|
101
106
|
end
|
|
102
107
|
|
|
103
108
|
# Sets the thresholds for the CALLBACK_TEMPERATURE_REACHED callback.
|
|
@@ -111,18 +116,20 @@ module Tinkerforge
|
|
|
111
116
|
# "'i'", "Callback is triggered when the temperature is *inside* the min and max values"
|
|
112
117
|
# "'<'", "Callback is triggered when the temperature is smaller than the min value (max is ignored)"
|
|
113
118
|
# "'>'", "Callback is triggered when the temperature is greater than the min value (max is ignored)"
|
|
114
|
-
#
|
|
115
|
-
# The default value is ('x', 0, 0).
|
|
116
119
|
def set_temperature_callback_threshold(option, min, max)
|
|
117
|
-
|
|
120
|
+
check_validity
|
|
121
|
+
|
|
122
|
+
send_request FUNCTION_SET_TEMPERATURE_CALLBACK_THRESHOLD, [option, min, max], 'k s s', 8, ''
|
|
118
123
|
end
|
|
119
124
|
|
|
120
125
|
# Returns the threshold as set by BrickletTemperature#set_temperature_callback_threshold.
|
|
121
126
|
def get_temperature_callback_threshold
|
|
122
|
-
|
|
127
|
+
check_validity
|
|
128
|
+
|
|
129
|
+
send_request FUNCTION_GET_TEMPERATURE_CALLBACK_THRESHOLD, [], '', 13, 'k s s'
|
|
123
130
|
end
|
|
124
131
|
|
|
125
|
-
# Sets the period
|
|
132
|
+
# Sets the period with which the threshold callback
|
|
126
133
|
#
|
|
127
134
|
# * CALLBACK_TEMPERATURE_REACHED
|
|
128
135
|
#
|
|
@@ -131,20 +138,22 @@ module Tinkerforge
|
|
|
131
138
|
# * BrickletTemperature#set_temperature_callback_threshold
|
|
132
139
|
#
|
|
133
140
|
# keeps being reached.
|
|
134
|
-
#
|
|
135
|
-
# The default value is 100.
|
|
136
141
|
def set_debounce_period(debounce)
|
|
137
|
-
|
|
142
|
+
check_validity
|
|
143
|
+
|
|
144
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
|
|
138
145
|
end
|
|
139
146
|
|
|
140
147
|
# Returns the debounce period as set by BrickletTemperature#set_debounce_period.
|
|
141
148
|
def get_debounce_period
|
|
142
|
-
|
|
149
|
+
check_validity
|
|
150
|
+
|
|
151
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
|
|
143
152
|
end
|
|
144
153
|
|
|
145
154
|
# Sets the I2C mode. Possible modes are:
|
|
146
155
|
#
|
|
147
|
-
# * 0: Fast (400kHz
|
|
156
|
+
# * 0: Fast (400kHz)
|
|
148
157
|
# * 1: Slow (100kHz)
|
|
149
158
|
#
|
|
150
159
|
# If you have problems with obvious outliers in the
|
|
@@ -156,26 +165,32 @@ module Tinkerforge
|
|
|
156
165
|
#
|
|
157
166
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
|
158
167
|
def set_i2c_mode(mode)
|
|
159
|
-
|
|
168
|
+
check_validity
|
|
169
|
+
|
|
170
|
+
send_request FUNCTION_SET_I2C_MODE, [mode], 'C', 8, ''
|
|
160
171
|
end
|
|
161
172
|
|
|
162
173
|
# Returns the I2C mode as set by BrickletTemperature#set_i2c_mode.
|
|
163
174
|
#
|
|
164
175
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
|
165
176
|
def get_i2c_mode
|
|
166
|
-
|
|
177
|
+
check_validity
|
|
178
|
+
|
|
179
|
+
send_request FUNCTION_GET_I2C_MODE, [], '', 9, 'C'
|
|
167
180
|
end
|
|
168
181
|
|
|
169
182
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
170
183
|
# the position, the hardware and firmware version as well as the
|
|
171
184
|
# device identifier.
|
|
172
185
|
#
|
|
173
|
-
# The position can be 'a', 'b', 'c' or '
|
|
186
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
187
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
188
|
+
# position 'z'.
|
|
174
189
|
#
|
|
175
190
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
176
191
|
# |device_identifier_constant|
|
|
177
192
|
def get_identity
|
|
178
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
193
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
179
194
|
end
|
|
180
195
|
|
|
181
196
|
# 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 2020-11-02. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.27 #
|
|
6
6
|
# #
|
|
7
7
|
# If you have a bugfix for this file and want to commit it, #
|
|
8
8
|
# please fix the bug in the generator. You can find a link #
|
|
9
9
|
# to the generators git repository on tinkerforge.com #
|
|
10
10
|
#############################################################
|
|
11
11
|
|
|
12
|
+
require_relative './ip_connection'
|
|
13
|
+
|
|
12
14
|
module Tinkerforge
|
|
13
15
|
# 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
|
|
@@ -134,7 +135,7 @@ module Tinkerforge
|
|
|
134
135
|
#
|
|
135
136
|
# The emissivity is usually given as a value between 0.0 and 1.0. A list of
|
|
136
137
|
# emissivities of different materials can be found
|
|
137
|
-
# `here <
|
|
138
|
+
# `here <https://www.infrared-thermography.com/material.htm>`__.
|
|
138
139
|
#
|
|
139
140
|
# The parameter of BrickletTemperatureIR#set_emissivity has to be given with a factor of
|
|
140
141
|
# 65535 (16-bit). For example: An emissivity of 0.1 can be set with the
|
|
@@ -144,47 +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
|
|
148
|
-
# sensor can handle is 0.1 (value of 6553).
|
|
148
|
+
# The emissivity is stored in non-volatile memory and will still be used after a restart or power cycle of the Bricklet.
|
|
149
149
|
def set_emissivity(emissivity)
|
|
150
|
-
|
|
150
|
+
check_validity
|
|
151
|
+
|
|
152
|
+
send_request FUNCTION_SET_EMISSIVITY, [emissivity], 'S', 8, ''
|
|
151
153
|
end
|
|
152
154
|
|
|
153
155
|
# Returns the emissivity as set by BrickletTemperatureIR#set_emissivity.
|
|
154
156
|
def get_emissivity
|
|
155
|
-
|
|
157
|
+
check_validity
|
|
158
|
+
|
|
159
|
+
send_request FUNCTION_GET_EMISSIVITY, [], '', 10, 'S'
|
|
156
160
|
end
|
|
157
161
|
|
|
158
|
-
# Sets the period
|
|
162
|
+
# Sets the period with which the CALLBACK_AMBIENT_TEMPERATURE callback is
|
|
159
163
|
# triggered periodically. A value of 0 turns the callback off.
|
|
160
164
|
#
|
|
161
165
|
# The CALLBACK_AMBIENT_TEMPERATURE callback is only triggered if the temperature has
|
|
162
166
|
# changed since the last triggering.
|
|
163
|
-
#
|
|
164
|
-
# The default value is 0.
|
|
165
167
|
def set_ambient_temperature_callback_period(period)
|
|
166
|
-
|
|
168
|
+
check_validity
|
|
169
|
+
|
|
170
|
+
send_request FUNCTION_SET_AMBIENT_TEMPERATURE_CALLBACK_PERIOD, [period], 'L', 8, ''
|
|
167
171
|
end
|
|
168
172
|
|
|
169
173
|
# Returns the period as set by BrickletTemperatureIR#set_ambient_temperature_callback_period.
|
|
170
174
|
def get_ambient_temperature_callback_period
|
|
171
|
-
|
|
175
|
+
check_validity
|
|
176
|
+
|
|
177
|
+
send_request FUNCTION_GET_AMBIENT_TEMPERATURE_CALLBACK_PERIOD, [], '', 12, 'L'
|
|
172
178
|
end
|
|
173
179
|
|
|
174
|
-
# Sets the period
|
|
180
|
+
# Sets the period with which the CALLBACK_OBJECT_TEMPERATURE callback is
|
|
175
181
|
# triggered periodically. A value of 0 turns the callback off.
|
|
176
182
|
#
|
|
177
183
|
# The CALLBACK_OBJECT_TEMPERATURE callback is only triggered if the temperature
|
|
178
184
|
# has changed since the last triggering.
|
|
179
|
-
#
|
|
180
|
-
# The default value is 0.
|
|
181
185
|
def set_object_temperature_callback_period(period)
|
|
182
|
-
|
|
186
|
+
check_validity
|
|
187
|
+
|
|
188
|
+
send_request FUNCTION_SET_OBJECT_TEMPERATURE_CALLBACK_PERIOD, [period], 'L', 8, ''
|
|
183
189
|
end
|
|
184
190
|
|
|
185
191
|
# Returns the period as set by BrickletTemperatureIR#set_object_temperature_callback_period.
|
|
186
192
|
def get_object_temperature_callback_period
|
|
187
|
-
|
|
193
|
+
check_validity
|
|
194
|
+
|
|
195
|
+
send_request FUNCTION_GET_OBJECT_TEMPERATURE_CALLBACK_PERIOD, [], '', 12, 'L'
|
|
188
196
|
end
|
|
189
197
|
|
|
190
198
|
# Sets the thresholds for the CALLBACK_AMBIENT_TEMPERATURE_REACHED callback.
|
|
@@ -198,15 +206,17 @@ module Tinkerforge
|
|
|
198
206
|
# "'i'", "Callback is triggered when the ambient temperature is *inside* the min and max values"
|
|
199
207
|
# "'<'", "Callback is triggered when the ambient temperature is smaller than the min value (max is ignored)"
|
|
200
208
|
# "'>'", "Callback is triggered when the ambient temperature is greater than the min value (max is ignored)"
|
|
201
|
-
#
|
|
202
|
-
# The default value is ('x', 0, 0).
|
|
203
209
|
def set_ambient_temperature_callback_threshold(option, min, max)
|
|
204
|
-
|
|
210
|
+
check_validity
|
|
211
|
+
|
|
212
|
+
send_request FUNCTION_SET_AMBIENT_TEMPERATURE_CALLBACK_THRESHOLD, [option, min, max], 'k s s', 8, ''
|
|
205
213
|
end
|
|
206
214
|
|
|
207
215
|
# Returns the threshold as set by BrickletTemperatureIR#set_ambient_temperature_callback_threshold.
|
|
208
216
|
def get_ambient_temperature_callback_threshold
|
|
209
|
-
|
|
217
|
+
check_validity
|
|
218
|
+
|
|
219
|
+
send_request FUNCTION_GET_AMBIENT_TEMPERATURE_CALLBACK_THRESHOLD, [], '', 13, 'k s s'
|
|
210
220
|
end
|
|
211
221
|
|
|
212
222
|
# Sets the thresholds for the CALLBACK_OBJECT_TEMPERATURE_REACHED callback.
|
|
@@ -220,18 +230,20 @@ module Tinkerforge
|
|
|
220
230
|
# "'i'", "Callback is triggered when the object temperature is *inside* the min and max values"
|
|
221
231
|
# "'<'", "Callback is triggered when the object temperature is smaller than the min value (max is ignored)"
|
|
222
232
|
# "'>'", "Callback is triggered when the object temperature is greater than the min value (max is ignored)"
|
|
223
|
-
#
|
|
224
|
-
# The default value is ('x', 0, 0).
|
|
225
233
|
def set_object_temperature_callback_threshold(option, min, max)
|
|
226
|
-
|
|
234
|
+
check_validity
|
|
235
|
+
|
|
236
|
+
send_request FUNCTION_SET_OBJECT_TEMPERATURE_CALLBACK_THRESHOLD, [option, min, max], 'k s s', 8, ''
|
|
227
237
|
end
|
|
228
238
|
|
|
229
239
|
# Returns the threshold as set by BrickletTemperatureIR#set_object_temperature_callback_threshold.
|
|
230
240
|
def get_object_temperature_callback_threshold
|
|
231
|
-
|
|
241
|
+
check_validity
|
|
242
|
+
|
|
243
|
+
send_request FUNCTION_GET_OBJECT_TEMPERATURE_CALLBACK_THRESHOLD, [], '', 13, 'k s s'
|
|
232
244
|
end
|
|
233
245
|
|
|
234
|
-
# Sets the period
|
|
246
|
+
# Sets the period with which the threshold callbacks
|
|
235
247
|
#
|
|
236
248
|
# * CALLBACK_AMBIENT_TEMPERATURE_REACHED,
|
|
237
249
|
# * CALLBACK_OBJECT_TEMPERATURE_REACHED
|
|
@@ -242,27 +254,31 @@ module Tinkerforge
|
|
|
242
254
|
# * BrickletTemperatureIR#set_object_temperature_callback_threshold
|
|
243
255
|
#
|
|
244
256
|
# keep being reached.
|
|
245
|
-
#
|
|
246
|
-
# The default value is 100.
|
|
247
257
|
def set_debounce_period(debounce)
|
|
248
|
-
|
|
258
|
+
check_validity
|
|
259
|
+
|
|
260
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
|
|
249
261
|
end
|
|
250
262
|
|
|
251
263
|
# Returns the debounce period as set by BrickletTemperatureIR#set_debounce_period.
|
|
252
264
|
def get_debounce_period
|
|
253
|
-
|
|
265
|
+
check_validity
|
|
266
|
+
|
|
267
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
|
|
254
268
|
end
|
|
255
269
|
|
|
256
270
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
257
271
|
# the position, the hardware and firmware version as well as the
|
|
258
272
|
# device identifier.
|
|
259
273
|
#
|
|
260
|
-
# 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'.
|
|
261
277
|
#
|
|
262
278
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
263
279
|
# |device_identifier_constant|
|
|
264
280
|
def get_identity
|
|
265
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
281
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
266
282
|
end
|
|
267
283
|
|
|
268
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 2020-11-02. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.27 #
|
|
6
6
|
# #
|
|
7
7
|
# If you have a bugfix for this file and want to commit it, #
|
|
8
8
|
# please fix the bug in the generator. You can find a link #
|
|
9
9
|
# to the generators git repository on tinkerforge.com #
|
|
10
10
|
#############################################################
|
|
11
11
|
|
|
12
|
+
require_relative './ip_connection'
|
|
13
|
+
|
|
12
14
|
module Tinkerforge
|
|
13
15
|
# 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,29 +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.
|
|
109
|
-
#
|
|
110
|
-
# If you want to get the ambient temperature periodically, it is recommended
|
|
111
|
-
# to use the CALLBACK_AMBIENT_TEMPERATURE callback and set the period with
|
|
112
|
-
# BrickletTemperatureIRV2#set_ambient_temperature_callback_configuration.
|
|
108
|
+
# Returns the ambient temperature of the sensor.
|
|
113
109
|
#
|
|
114
110
|
#
|
|
115
111
|
# If you want to get the value periodically, it is recommended to use the
|
|
116
112
|
# CALLBACK_AMBIENT_TEMPERATURE callback. You can set the callback configuration
|
|
117
113
|
# with BrickletTemperatureIRV2#set_ambient_temperature_callback_configuration.
|
|
118
114
|
def get_ambient_temperature
|
|
119
|
-
|
|
115
|
+
check_validity
|
|
116
|
+
|
|
117
|
+
send_request FUNCTION_GET_AMBIENT_TEMPERATURE, [], '', 10, 's'
|
|
120
118
|
end
|
|
121
119
|
|
|
122
|
-
# The period
|
|
120
|
+
# The period is the period with which the CALLBACK_AMBIENT_TEMPERATURE callback is triggered
|
|
123
121
|
# periodically. A value of 0 turns the callback off.
|
|
124
122
|
#
|
|
125
123
|
# If the `value has to change`-parameter is set to true, the callback is only
|
|
@@ -144,40 +142,37 @@ module Tinkerforge
|
|
|
144
142
|
# "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
|
|
145
143
|
#
|
|
146
144
|
# If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
|
|
147
|
-
#
|
|
148
|
-
# The default value is (0, false, 'x', 0, 0).
|
|
149
145
|
def set_ambient_temperature_callback_configuration(period, value_has_to_change, option, min, max)
|
|
150
|
-
|
|
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, ''
|
|
151
149
|
end
|
|
152
150
|
|
|
153
151
|
# Returns the callback configuration as set by BrickletTemperatureIRV2#set_ambient_temperature_callback_configuration.
|
|
154
152
|
def get_ambient_temperature_callback_configuration
|
|
155
|
-
|
|
153
|
+
check_validity
|
|
154
|
+
|
|
155
|
+
send_request FUNCTION_GET_AMBIENT_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 18, 'L ? k s s'
|
|
156
156
|
end
|
|
157
157
|
|
|
158
158
|
# Returns the object temperature of the sensor, i.e. the temperature
|
|
159
|
-
# of the surface of the object the sensor is aimed at.
|
|
160
|
-
# has a range of -700 to 3800 and is given in °C/10,
|
|
161
|
-
# e.g. a value of 3001 means that a temperature of 300.1 °C is measured
|
|
162
|
-
# on the surface of the object.
|
|
159
|
+
# of the surface of the object the sensor is aimed at.
|
|
163
160
|
#
|
|
164
161
|
# The temperature of different materials is dependent on their `emissivity
|
|
165
162
|
# <https://en.wikipedia.org/wiki/Emissivity>`__. The emissivity of the material
|
|
166
163
|
# can be set with BrickletTemperatureIRV2#set_emissivity.
|
|
167
164
|
#
|
|
168
|
-
# If you want to get the object temperature periodically, it is recommended
|
|
169
|
-
# to use the CALLBACK_OBJECT_TEMPERATURE callback and set the period with
|
|
170
|
-
# BrickletTemperatureIRV2#set_object_temperature_callback_configuration.
|
|
171
|
-
#
|
|
172
165
|
#
|
|
173
166
|
# If you want to get the value periodically, it is recommended to use the
|
|
174
167
|
# CALLBACK_OBJECT_TEMPERATURE callback. You can set the callback configuration
|
|
175
168
|
# with BrickletTemperatureIRV2#set_object_temperature_callback_configuration.
|
|
176
169
|
def get_object_temperature
|
|
177
|
-
|
|
170
|
+
check_validity
|
|
171
|
+
|
|
172
|
+
send_request FUNCTION_GET_OBJECT_TEMPERATURE, [], '', 10, 's'
|
|
178
173
|
end
|
|
179
174
|
|
|
180
|
-
# The period
|
|
175
|
+
# The period is the period with which the CALLBACK_OBJECT_TEMPERATURE callback is triggered
|
|
181
176
|
# periodically. A value of 0 turns the callback off.
|
|
182
177
|
#
|
|
183
178
|
# If the `value has to change`-parameter is set to true, the callback is only
|
|
@@ -202,15 +197,17 @@ module Tinkerforge
|
|
|
202
197
|
# "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
|
|
203
198
|
#
|
|
204
199
|
# If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
|
|
205
|
-
#
|
|
206
|
-
# The default value is (0, false, 'x', 0, 0).
|
|
207
200
|
def set_object_temperature_callback_configuration(period, value_has_to_change, option, min, max)
|
|
208
|
-
|
|
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, ''
|
|
209
204
|
end
|
|
210
205
|
|
|
211
206
|
# Returns the callback configuration as set by BrickletTemperatureIRV2#set_object_temperature_callback_configuration.
|
|
212
207
|
def get_object_temperature_callback_configuration
|
|
213
|
-
|
|
208
|
+
check_validity
|
|
209
|
+
|
|
210
|
+
send_request FUNCTION_GET_OBJECT_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 18, 'L ? k s s'
|
|
214
211
|
end
|
|
215
212
|
|
|
216
213
|
# Sets the `emissivity <https://en.wikipedia.org/wiki/Emissivity>`__ that is
|
|
@@ -219,7 +216,7 @@ module Tinkerforge
|
|
|
219
216
|
#
|
|
220
217
|
# The emissivity is usually given as a value between 0.0 and 1.0. A list of
|
|
221
218
|
# emissivities of different materials can be found
|
|
222
|
-
# `here <
|
|
219
|
+
# `here <https://www.infrared-thermography.com/material.htm>`__.
|
|
223
220
|
#
|
|
224
221
|
# The parameter of BrickletTemperatureIRV2#set_emissivity has to be given with a factor of
|
|
225
222
|
# 65535 (16-bit). For example: An emissivity of 0.1 can be set with the
|
|
@@ -229,18 +226,19 @@ module Tinkerforge
|
|
|
229
226
|
# If you need a precise measurement for the object temperature, it is
|
|
230
227
|
# absolutely crucial that you also provide a precise emissivity.
|
|
231
228
|
#
|
|
232
|
-
# The default emissivity is 1.0 (value of 65535) and the minimum emissivity the
|
|
233
|
-
# sensor can handle is 0.1 (value of 6553).
|
|
234
|
-
#
|
|
235
229
|
# The emissivity is stored in non-volatile memory and will still be
|
|
236
230
|
# used after a restart or power cycle of the Bricklet.
|
|
237
231
|
def set_emissivity(emissivity)
|
|
238
|
-
|
|
232
|
+
check_validity
|
|
233
|
+
|
|
234
|
+
send_request FUNCTION_SET_EMISSIVITY, [emissivity], 'S', 8, ''
|
|
239
235
|
end
|
|
240
236
|
|
|
241
237
|
# Returns the emissivity as set by BrickletTemperatureIRV2#set_emissivity.
|
|
242
238
|
def get_emissivity
|
|
243
|
-
|
|
239
|
+
check_validity
|
|
240
|
+
|
|
241
|
+
send_request FUNCTION_GET_EMISSIVITY, [], '', 10, 'S'
|
|
244
242
|
end
|
|
245
243
|
|
|
246
244
|
# Returns the error count for the communication between Brick and Bricklet.
|
|
@@ -255,7 +253,9 @@ module Tinkerforge
|
|
|
255
253
|
# The errors counts are for errors that occur on the Bricklet side. All
|
|
256
254
|
# Bricks have a similar function that returns the errors on the Brick side.
|
|
257
255
|
def get_spitfp_error_count
|
|
258
|
-
|
|
256
|
+
check_validity
|
|
257
|
+
|
|
258
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
|
259
259
|
end
|
|
260
260
|
|
|
261
261
|
# Sets the bootloader mode and returns the status after the requested
|
|
@@ -268,12 +268,16 @@ module Tinkerforge
|
|
|
268
268
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
269
269
|
# necessary to call it in a normal user program.
|
|
270
270
|
def set_bootloader_mode(mode)
|
|
271
|
-
|
|
271
|
+
check_validity
|
|
272
|
+
|
|
273
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
|
272
274
|
end
|
|
273
275
|
|
|
274
276
|
# Returns the current bootloader mode, see BrickletTemperatureIRV2#set_bootloader_mode.
|
|
275
277
|
def get_bootloader_mode
|
|
276
|
-
|
|
278
|
+
check_validity
|
|
279
|
+
|
|
280
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
|
277
281
|
end
|
|
278
282
|
|
|
279
283
|
# Sets the firmware pointer for BrickletTemperatureIRV2#write_firmware. The pointer has
|
|
@@ -283,7 +287,9 @@ module Tinkerforge
|
|
|
283
287
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
284
288
|
# necessary to call it in a normal user program.
|
|
285
289
|
def set_write_firmware_pointer(pointer)
|
|
286
|
-
|
|
290
|
+
check_validity
|
|
291
|
+
|
|
292
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
|
287
293
|
end
|
|
288
294
|
|
|
289
295
|
# Writes 64 Bytes of firmware at the position as written by
|
|
@@ -295,7 +301,9 @@ module Tinkerforge
|
|
|
295
301
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
296
302
|
# necessary to call it in a normal user program.
|
|
297
303
|
def write_firmware(data)
|
|
298
|
-
|
|
304
|
+
check_validity
|
|
305
|
+
|
|
306
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
|
299
307
|
end
|
|
300
308
|
|
|
301
309
|
# Sets the status LED configuration. By default the LED shows
|
|
@@ -306,22 +314,28 @@ module Tinkerforge
|
|
|
306
314
|
#
|
|
307
315
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
|
308
316
|
def set_status_led_config(config)
|
|
309
|
-
|
|
317
|
+
check_validity
|
|
318
|
+
|
|
319
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
|
310
320
|
end
|
|
311
321
|
|
|
312
322
|
# Returns the configuration as set by BrickletTemperatureIRV2#set_status_led_config
|
|
313
323
|
def get_status_led_config
|
|
314
|
-
|
|
324
|
+
check_validity
|
|
325
|
+
|
|
326
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
|
315
327
|
end
|
|
316
328
|
|
|
317
|
-
# Returns the temperature
|
|
329
|
+
# Returns the temperature as measured inside the microcontroller. The
|
|
318
330
|
# value returned is not the ambient temperature!
|
|
319
331
|
#
|
|
320
332
|
# The temperature is only proportional to the real temperature and it has bad
|
|
321
333
|
# accuracy. Practically it is only useful as an indicator for
|
|
322
334
|
# temperature changes.
|
|
323
335
|
def get_chip_temperature
|
|
324
|
-
|
|
336
|
+
check_validity
|
|
337
|
+
|
|
338
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
|
325
339
|
end
|
|
326
340
|
|
|
327
341
|
# Calling this function will reset the Bricklet. All configurations
|
|
@@ -331,7 +345,9 @@ module Tinkerforge
|
|
|
331
345
|
# calling functions on the existing ones will result in
|
|
332
346
|
# undefined behavior!
|
|
333
347
|
def reset
|
|
334
|
-
|
|
348
|
+
check_validity
|
|
349
|
+
|
|
350
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
|
335
351
|
end
|
|
336
352
|
|
|
337
353
|
# Writes a new UID into flash. If you want to set a new UID
|
|
@@ -340,25 +356,31 @@ module Tinkerforge
|
|
|
340
356
|
#
|
|
341
357
|
# We recommend that you use Brick Viewer to change the UID.
|
|
342
358
|
def write_uid(uid)
|
|
343
|
-
|
|
359
|
+
check_validity
|
|
360
|
+
|
|
361
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
|
344
362
|
end
|
|
345
363
|
|
|
346
364
|
# Returns the current UID as an integer. Encode as
|
|
347
365
|
# Base58 to get the usual string version.
|
|
348
366
|
def read_uid
|
|
349
|
-
|
|
367
|
+
check_validity
|
|
368
|
+
|
|
369
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
|
350
370
|
end
|
|
351
371
|
|
|
352
372
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
353
373
|
# the position, the hardware and firmware version as well as the
|
|
354
374
|
# device identifier.
|
|
355
375
|
#
|
|
356
|
-
# 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'.
|
|
357
379
|
#
|
|
358
380
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
359
381
|
# |device_identifier_constant|
|
|
360
382
|
def get_identity
|
|
361
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
383
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
362
384
|
end
|
|
363
385
|
|
|
364
386
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|