tinkerforge 2.1.24 → 2.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/tinkerforge/brick_dc.rb +155 -74
- data/lib/tinkerforge/brick_hat.rb +70 -30
- data/lib/tinkerforge/brick_hat_zero.rb +56 -22
- data/lib/tinkerforge/brick_imu.rb +184 -77
- data/lib/tinkerforge/brick_imu_v2.rb +208 -105
- data/lib/tinkerforge/brick_master.rb +484 -182
- data/lib/tinkerforge/brick_red.rb +197 -74
- data/lib/tinkerforge/brick_servo.rb +185 -101
- data/lib/tinkerforge/brick_silent_stepper.rb +246 -166
- data/lib/tinkerforge/brick_stepper.rb +210 -98
- data/lib/tinkerforge/bricklet_accelerometer.rb +58 -23
- data/lib/tinkerforge/bricklet_accelerometer_v2.rb +105 -54
- data/lib/tinkerforge/bricklet_air_quality.rb +117 -59
- data/lib/tinkerforge/bricklet_ambient_light.rb +51 -21
- data/lib/tinkerforge/bricklet_ambient_light_v2.rb +40 -22
- data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -25
- data/lib/tinkerforge/bricklet_analog_in.rb +63 -25
- data/lib/tinkerforge/bricklet_analog_in_v2.rb +57 -23
- data/lib/tinkerforge/bricklet_analog_in_v3.rb +67 -25
- data/lib/tinkerforge/bricklet_analog_out.rb +23 -9
- data/lib/tinkerforge/bricklet_analog_out_v2.rb +20 -8
- data/lib/tinkerforge/bricklet_analog_out_v3.rb +54 -20
- data/lib/tinkerforge/bricklet_barometer.rb +66 -26
- data/lib/tinkerforge/bricklet_barometer_v2.rb +99 -37
- data/lib/tinkerforge/bricklet_can.rb +83 -18
- data/lib/tinkerforge/bricklet_can_v2.rb +172 -38
- data/lib/tinkerforge/bricklet_co2.rb +34 -14
- data/lib/tinkerforge/bricklet_co2_v2.rb +97 -37
- data/lib/tinkerforge/bricklet_color.rb +69 -27
- data/lib/tinkerforge/bricklet_color_v2.rb +87 -33
- data/lib/tinkerforge/bricklet_compass.rb +78 -30
- data/lib/tinkerforge/bricklet_current12.rb +58 -24
- data/lib/tinkerforge/bricklet_current25.rb +58 -24
- data/lib/tinkerforge/bricklet_distance_ir.rb +57 -23
- data/lib/tinkerforge/bricklet_distance_ir_v2.rb +83 -31
- data/lib/tinkerforge/bricklet_distance_us.rb +40 -16
- data/lib/tinkerforge/bricklet_distance_us_v2.rb +67 -25
- data/lib/tinkerforge/bricklet_dmx.rb +88 -34
- data/lib/tinkerforge/bricklet_dual_button.rb +24 -10
- data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -24
- data/lib/tinkerforge/bricklet_dual_relay.rb +27 -11
- data/lib/tinkerforge/bricklet_dust_detector.rb +40 -16
- data/lib/tinkerforge/bricklet_e_paper_296x128.rb +88 -32
- data/lib/tinkerforge/bricklet_energy_monitor.rb +73 -27
- data/lib/tinkerforge/bricklet_gps.rb +64 -26
- data/lib/tinkerforge/bricklet_gps_v2.rb +117 -47
- data/lib/tinkerforge/bricklet_hall_effect.rb +43 -23
- data/lib/tinkerforge/bricklet_hall_effect_v2.rb +71 -27
- data/lib/tinkerforge/bricklet_humidity.rb +51 -21
- data/lib/tinkerforge/bricklet_humidity_v2.rb +83 -31
- data/lib/tinkerforge/bricklet_industrial_analog_out.rb +38 -14
- data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +81 -29
- data/lib/tinkerforge/bricklet_industrial_counter.rb +101 -39
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +45 -17
- data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +77 -29
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -14
- data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +73 -27
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +40 -16
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +79 -29
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +49 -19
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +82 -30
- data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +61 -23
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -14
- data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -25
- data/lib/tinkerforge/bricklet_io16.rb +55 -21
- data/lib/tinkerforge/bricklet_io16_v2.rb +90 -34
- data/lib/tinkerforge/bricklet_io4.rb +55 -23
- data/lib/tinkerforge/bricklet_io4_v2.rb +96 -36
- data/lib/tinkerforge/bricklet_isolator.rb +72 -28
- data/lib/tinkerforge/bricklet_joystick.rb +59 -25
- data/lib/tinkerforge/bricklet_joystick_v2.rb +68 -26
- data/lib/tinkerforge/bricklet_laser_range_finder.rb +82 -32
- data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +96 -36
- data/lib/tinkerforge/bricklet_lcd_128x64.rb +192 -70
- data/lib/tinkerforge/bricklet_lcd_16x2.rb +45 -18
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +58 -23
- data/lib/tinkerforge/bricklet_led_strip.rb +60 -22
- data/lib/tinkerforge/bricklet_led_strip_v2.rb +91 -46
- data/lib/tinkerforge/bricklet_line.rb +34 -14
- data/lib/tinkerforge/bricklet_linear_poti.rb +51 -21
- data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -21
- data/lib/tinkerforge/bricklet_load_cell.rb +61 -23
- data/lib/tinkerforge/bricklet_load_cell_v2.rb +80 -30
- data/lib/tinkerforge/bricklet_moisture.rb +40 -16
- data/lib/tinkerforge/bricklet_motion_detector.rb +22 -10
- data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -24
- data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -27
- data/lib/tinkerforge/bricklet_multi_touch.rb +31 -13
- data/lib/tinkerforge/bricklet_multi_touch_v2.rb +76 -28
- data/lib/tinkerforge/bricklet_nfc.rb +123 -58
- data/lib/tinkerforge/bricklet_nfc_rfid.rb +33 -13
- data/lib/tinkerforge/bricklet_oled_128x64.rb +29 -11
- data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +66 -24
- data/lib/tinkerforge/bricklet_oled_64x48.rb +29 -11
- data/lib/tinkerforge/bricklet_one_wire.rb +66 -24
- data/lib/tinkerforge/bricklet_outdoor_weather.rb +71 -27
- data/lib/tinkerforge/bricklet_particulate_matter.rb +75 -30
- data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -9
- data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -10
- data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +80 -42
- data/lib/tinkerforge/bricklet_ptc.rb +74 -42
- data/lib/tinkerforge/bricklet_ptc_v2.rb +95 -48
- data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -33
- data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -44
- data/lib/tinkerforge/bricklet_remote_switch.rb +39 -29
- data/lib/tinkerforge/bricklet_remote_switch_v2.rb +87 -49
- data/lib/tinkerforge/bricklet_rgb_led.rb +18 -8
- data/lib/tinkerforge/bricklet_rgb_led_button.rb +62 -30
- data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +79 -33
- data/lib/tinkerforge/bricklet_rgb_led_v2.rb +52 -20
- data/lib/tinkerforge/bricklet_rotary_encoder.rb +39 -19
- data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -24
- data/lib/tinkerforge/bricklet_rotary_poti.rb +53 -28
- data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +57 -23
- data/lib/tinkerforge/bricklet_rs232.rb +90 -28
- data/lib/tinkerforge/bricklet_rs232_v2.rb +118 -44
- data/lib/tinkerforge/bricklet_rs485.rb +223 -95
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +25 -14
- data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -35
- data/lib/tinkerforge/bricklet_solid_state_relay.rb +25 -13
- data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +59 -25
- data/lib/tinkerforge/bricklet_sound_intensity.rb +35 -18
- data/lib/tinkerforge/bricklet_sound_pressure_level.rb +72 -31
- data/lib/tinkerforge/bricklet_temperature.rb +40 -16
- data/lib/tinkerforge/bricklet_temperature_ir.rb +57 -23
- data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +71 -27
- data/lib/tinkerforge/bricklet_temperature_v2.rb +61 -25
- data/lib/tinkerforge/bricklet_thermal_imaging.rb +105 -44
- data/lib/tinkerforge/bricklet_thermocouple.rb +45 -24
- data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -27
- data/lib/tinkerforge/bricklet_tilt.rb +24 -10
- data/lib/tinkerforge/bricklet_uv_light.rb +36 -18
- data/lib/tinkerforge/bricklet_uv_light_v2.rb +85 -37
- data/lib/tinkerforge/bricklet_voltage.rb +52 -28
- data/lib/tinkerforge/bricklet_voltage_current.rb +91 -73
- data/lib/tinkerforge/bricklet_voltage_current_v2.rb +90 -68
- data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +80 -30
- data/lib/tinkerforge/device_display_names.rb +163 -0
- data/lib/tinkerforge/ip_connection.rb +151 -32
- data/lib/tinkerforge/version.rb +1 -1
- metadata +3 -2
|
@@ -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-04-07. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.25 #
|
|
6
6
|
# #
|
|
7
7
|
# If you have a bugfix for this file and want to commit it, #
|
|
8
8
|
# please fix the bug in the generator. You can find a link #
|
|
9
9
|
# to the generators git repository on tinkerforge.com #
|
|
10
10
|
#############################################################
|
|
11
11
|
|
|
12
|
+
require_relative './ip_connection'
|
|
13
|
+
|
|
12
14
|
module Tinkerforge
|
|
13
15
|
# Measures temperature with thermocouples
|
|
14
16
|
class BrickletThermocouple < Device
|
|
@@ -73,7 +75,7 @@ module Tinkerforge
|
|
|
73
75
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
74
76
|
# the IP Connection <tt>ipcon</tt>.
|
|
75
77
|
def initialize(uid, ipcon)
|
|
76
|
-
super uid, ipcon
|
|
78
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
77
79
|
|
|
78
80
|
@api_version = [2, 0, 0]
|
|
79
81
|
|
|
@@ -89,20 +91,22 @@ module Tinkerforge
|
|
|
89
91
|
@response_expected[FUNCTION_GET_ERROR_STATE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
90
92
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
91
93
|
|
|
92
|
-
@callback_formats[CALLBACK_TEMPERATURE] = 'l'
|
|
93
|
-
@callback_formats[CALLBACK_TEMPERATURE_REACHED] = 'l'
|
|
94
|
-
@callback_formats[CALLBACK_ERROR_STATE] = '? ?'
|
|
94
|
+
@callback_formats[CALLBACK_TEMPERATURE] = [12, 'l']
|
|
95
|
+
@callback_formats[CALLBACK_TEMPERATURE_REACHED] = [12, 'l']
|
|
96
|
+
@callback_formats[CALLBACK_ERROR_STATE] = [10, '? ?']
|
|
95
97
|
|
|
98
|
+
@ipcon.add_device self
|
|
96
99
|
end
|
|
97
100
|
|
|
98
|
-
# Returns the temperature of the thermocouple.
|
|
99
|
-
# e.g. a value of 4223 means that a temperature of 42.23 °C is measured.
|
|
101
|
+
# Returns the temperature of the thermocouple.
|
|
100
102
|
#
|
|
101
103
|
# If you want to get the temperature periodically, it is recommended
|
|
102
104
|
# to use the CALLBACK_TEMPERATURE callback and set the period with
|
|
103
105
|
# BrickletThermocouple#set_temperature_callback_period.
|
|
104
106
|
def get_temperature
|
|
105
|
-
|
|
107
|
+
check_validity
|
|
108
|
+
|
|
109
|
+
send_request FUNCTION_GET_TEMPERATURE, [], '', 12, 'l'
|
|
106
110
|
end
|
|
107
111
|
|
|
108
112
|
# Sets the period with which the CALLBACK_TEMPERATURE callback is triggered
|
|
@@ -111,12 +115,16 @@ module Tinkerforge
|
|
|
111
115
|
# The CALLBACK_TEMPERATURE callback is only triggered if the temperature has changed
|
|
112
116
|
# since the last triggering.
|
|
113
117
|
def set_temperature_callback_period(period)
|
|
114
|
-
|
|
118
|
+
check_validity
|
|
119
|
+
|
|
120
|
+
send_request FUNCTION_SET_TEMPERATURE_CALLBACK_PERIOD, [period], 'L', 8, ''
|
|
115
121
|
end
|
|
116
122
|
|
|
117
123
|
# Returns the period as set by BrickletThermocouple#set_temperature_callback_period.
|
|
118
124
|
def get_temperature_callback_period
|
|
119
|
-
|
|
125
|
+
check_validity
|
|
126
|
+
|
|
127
|
+
send_request FUNCTION_GET_TEMPERATURE_CALLBACK_PERIOD, [], '', 12, 'L'
|
|
120
128
|
end
|
|
121
129
|
|
|
122
130
|
# Sets the thresholds for the CALLBACK_TEMPERATURE_REACHED callback.
|
|
@@ -130,15 +138,17 @@ module Tinkerforge
|
|
|
130
138
|
# "'i'", "Callback is triggered when the temperature is *inside* the min and max values"
|
|
131
139
|
# "'<'", "Callback is triggered when the temperature is smaller than the min value (max is ignored)"
|
|
132
140
|
# "'>'", "Callback is triggered when the temperature is greater than the min value (max is ignored)"
|
|
133
|
-
#
|
|
134
|
-
# The default value is ('x', 0, 0).
|
|
135
141
|
def set_temperature_callback_threshold(option, min, max)
|
|
136
|
-
|
|
142
|
+
check_validity
|
|
143
|
+
|
|
144
|
+
send_request FUNCTION_SET_TEMPERATURE_CALLBACK_THRESHOLD, [option, min, max], 'k l l', 8, ''
|
|
137
145
|
end
|
|
138
146
|
|
|
139
147
|
# Returns the threshold as set by BrickletThermocouple#set_temperature_callback_threshold.
|
|
140
148
|
def get_temperature_callback_threshold
|
|
141
|
-
|
|
149
|
+
check_validity
|
|
150
|
+
|
|
151
|
+
send_request FUNCTION_GET_TEMPERATURE_CALLBACK_THRESHOLD, [], '', 17, 'k l l'
|
|
142
152
|
end
|
|
143
153
|
|
|
144
154
|
# Sets the period with which the threshold callback
|
|
@@ -151,12 +161,16 @@ module Tinkerforge
|
|
|
151
161
|
#
|
|
152
162
|
# keeps being reached.
|
|
153
163
|
def set_debounce_period(debounce)
|
|
154
|
-
|
|
164
|
+
check_validity
|
|
165
|
+
|
|
166
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
|
|
155
167
|
end
|
|
156
168
|
|
|
157
169
|
# Returns the debounce period as set by BrickletThermocouple#set_debounce_period.
|
|
158
170
|
def get_debounce_period
|
|
159
|
-
|
|
171
|
+
check_validity
|
|
172
|
+
|
|
173
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
|
|
160
174
|
end
|
|
161
175
|
|
|
162
176
|
# You can configure averaging size, thermocouple type and frequency
|
|
@@ -182,15 +196,17 @@ module Tinkerforge
|
|
|
182
196
|
#
|
|
183
197
|
# * 60Hz: ``time = 82 + (samples - 1) * 16.67``
|
|
184
198
|
# * 50Hz: ``time = 98 + (samples - 1) * 20``
|
|
185
|
-
#
|
|
186
|
-
# The default configuration is 16 samples, K type and 50Hz.
|
|
187
199
|
def set_configuration(averaging, thermocouple_type, filter)
|
|
188
|
-
|
|
200
|
+
check_validity
|
|
201
|
+
|
|
202
|
+
send_request FUNCTION_SET_CONFIGURATION, [averaging, thermocouple_type, filter], 'C C C', 8, ''
|
|
189
203
|
end
|
|
190
204
|
|
|
191
205
|
# Returns the configuration as set by BrickletThermocouple#set_configuration.
|
|
192
206
|
def get_configuration
|
|
193
|
-
|
|
207
|
+
check_validity
|
|
208
|
+
|
|
209
|
+
send_request FUNCTION_GET_CONFIGURATION, [], '', 11, 'C C C'
|
|
194
210
|
end
|
|
195
211
|
|
|
196
212
|
# Returns the current error state. There are two possible errors:
|
|
@@ -205,19 +221,24 @@ module Tinkerforge
|
|
|
205
221
|
# You can use the CALLBACK_ERROR_STATE callback to automatically get triggered
|
|
206
222
|
# when the error state changes.
|
|
207
223
|
def get_error_state
|
|
208
|
-
|
|
224
|
+
check_validity
|
|
225
|
+
|
|
226
|
+
send_request FUNCTION_GET_ERROR_STATE, [], '', 10, '? ?'
|
|
209
227
|
end
|
|
210
228
|
|
|
211
229
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
212
230
|
# the position, the hardware and firmware version as well as the
|
|
213
231
|
# device identifier.
|
|
214
232
|
#
|
|
215
|
-
# The position can be 'a', 'b', 'c' or '
|
|
233
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
234
|
+
# The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
|
|
235
|
+
# connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
|
|
236
|
+
# position 'z'.
|
|
216
237
|
#
|
|
217
238
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
218
239
|
# |device_identifier_constant|
|
|
219
240
|
def get_identity
|
|
220
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
241
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
221
242
|
end
|
|
222
243
|
|
|
223
244
|
# 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-04-07. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.25 #
|
|
6
6
|
# #
|
|
7
7
|
# If you have a bugfix for this file and want to commit it, #
|
|
8
8
|
# please fix the bug in the generator. You can find a link #
|
|
9
9
|
# to the generators git repository on tinkerforge.com #
|
|
10
10
|
#############################################################
|
|
11
11
|
|
|
12
|
+
require_relative './ip_connection'
|
|
13
|
+
|
|
12
14
|
module Tinkerforge
|
|
13
15
|
# Measures temperature with thermocouples
|
|
14
16
|
class BrickletThermocoupleV2 < Device
|
|
@@ -85,7 +87,7 @@ module Tinkerforge
|
|
|
85
87
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
86
88
|
# the IP Connection <tt>ipcon</tt>.
|
|
87
89
|
def initialize(uid, ipcon)
|
|
88
|
-
super uid, ipcon
|
|
90
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
89
91
|
|
|
90
92
|
@api_version = [2, 0, 0]
|
|
91
93
|
|
|
@@ -108,9 +110,10 @@ module Tinkerforge
|
|
|
108
110
|
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
109
111
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
110
112
|
|
|
111
|
-
@callback_formats[CALLBACK_TEMPERATURE] = 'l'
|
|
112
|
-
@callback_formats[CALLBACK_ERROR_STATE] = '? ?'
|
|
113
|
+
@callback_formats[CALLBACK_TEMPERATURE] = [12, 'l']
|
|
114
|
+
@callback_formats[CALLBACK_ERROR_STATE] = [10, '? ?']
|
|
113
115
|
|
|
116
|
+
@ipcon.add_device self
|
|
114
117
|
end
|
|
115
118
|
|
|
116
119
|
# Returns the temperature of the thermocouple. The value is given in °C/100,
|
|
@@ -125,7 +128,9 @@ module Tinkerforge
|
|
|
125
128
|
# CALLBACK_TEMPERATURE callback. You can set the callback configuration
|
|
126
129
|
# with BrickletThermocoupleV2#set_temperature_callback_configuration.
|
|
127
130
|
def get_temperature
|
|
128
|
-
|
|
131
|
+
check_validity
|
|
132
|
+
|
|
133
|
+
send_request FUNCTION_GET_TEMPERATURE, [], '', 12, 'l'
|
|
129
134
|
end
|
|
130
135
|
|
|
131
136
|
# The period is the period with which the CALLBACK_TEMPERATURE callback is triggered
|
|
@@ -154,12 +159,16 @@ module Tinkerforge
|
|
|
154
159
|
#
|
|
155
160
|
# If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
|
|
156
161
|
def set_temperature_callback_configuration(period, value_has_to_change, option, min, max)
|
|
157
|
-
|
|
162
|
+
check_validity
|
|
163
|
+
|
|
164
|
+
send_request FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 8, ''
|
|
158
165
|
end
|
|
159
166
|
|
|
160
167
|
# Returns the callback configuration as set by BrickletThermocoupleV2#set_temperature_callback_configuration.
|
|
161
168
|
def get_temperature_callback_configuration
|
|
162
|
-
|
|
169
|
+
check_validity
|
|
170
|
+
|
|
171
|
+
send_request FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k l l'
|
|
163
172
|
end
|
|
164
173
|
|
|
165
174
|
# You can configure averaging size, thermocouple type and frequency
|
|
@@ -185,15 +194,17 @@ module Tinkerforge
|
|
|
185
194
|
#
|
|
186
195
|
# * 60Hz: ``time = 82 + (samples - 1) * 16.67``
|
|
187
196
|
# * 50Hz: ``time = 98 + (samples - 1) * 20``
|
|
188
|
-
#
|
|
189
|
-
# The default configuration is 16 samples, K type and 50Hz.
|
|
190
197
|
def set_configuration(averaging, thermocouple_type, filter)
|
|
191
|
-
|
|
198
|
+
check_validity
|
|
199
|
+
|
|
200
|
+
send_request FUNCTION_SET_CONFIGURATION, [averaging, thermocouple_type, filter], 'C C C', 8, ''
|
|
192
201
|
end
|
|
193
202
|
|
|
194
203
|
# Returns the configuration as set by BrickletThermocoupleV2#set_configuration.
|
|
195
204
|
def get_configuration
|
|
196
|
-
|
|
205
|
+
check_validity
|
|
206
|
+
|
|
207
|
+
send_request FUNCTION_GET_CONFIGURATION, [], '', 11, 'C C C'
|
|
197
208
|
end
|
|
198
209
|
|
|
199
210
|
# Returns the current error state. There are two possible errors:
|
|
@@ -208,7 +219,9 @@ module Tinkerforge
|
|
|
208
219
|
# You can use the CALLBACK_ERROR_STATE callback to automatically get triggered
|
|
209
220
|
# when the error state changes.
|
|
210
221
|
def get_error_state
|
|
211
|
-
|
|
222
|
+
check_validity
|
|
223
|
+
|
|
224
|
+
send_request FUNCTION_GET_ERROR_STATE, [], '', 10, '? ?'
|
|
212
225
|
end
|
|
213
226
|
|
|
214
227
|
# Returns the error count for the communication between Brick and Bricklet.
|
|
@@ -223,7 +236,9 @@ module Tinkerforge
|
|
|
223
236
|
# The errors counts are for errors that occur on the Bricklet side. All
|
|
224
237
|
# Bricks have a similar function that returns the errors on the Brick side.
|
|
225
238
|
def get_spitfp_error_count
|
|
226
|
-
|
|
239
|
+
check_validity
|
|
240
|
+
|
|
241
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
|
227
242
|
end
|
|
228
243
|
|
|
229
244
|
# Sets the bootloader mode and returns the status after the requested
|
|
@@ -236,12 +251,16 @@ module Tinkerforge
|
|
|
236
251
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
237
252
|
# necessary to call it in a normal user program.
|
|
238
253
|
def set_bootloader_mode(mode)
|
|
239
|
-
|
|
254
|
+
check_validity
|
|
255
|
+
|
|
256
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
|
240
257
|
end
|
|
241
258
|
|
|
242
259
|
# Returns the current bootloader mode, see BrickletThermocoupleV2#set_bootloader_mode.
|
|
243
260
|
def get_bootloader_mode
|
|
244
|
-
|
|
261
|
+
check_validity
|
|
262
|
+
|
|
263
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
|
245
264
|
end
|
|
246
265
|
|
|
247
266
|
# Sets the firmware pointer for BrickletThermocoupleV2#write_firmware. The pointer has
|
|
@@ -251,7 +270,9 @@ module Tinkerforge
|
|
|
251
270
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
252
271
|
# necessary to call it in a normal user program.
|
|
253
272
|
def set_write_firmware_pointer(pointer)
|
|
254
|
-
|
|
273
|
+
check_validity
|
|
274
|
+
|
|
275
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
|
255
276
|
end
|
|
256
277
|
|
|
257
278
|
# Writes 64 Bytes of firmware at the position as written by
|
|
@@ -263,7 +284,9 @@ module Tinkerforge
|
|
|
263
284
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
264
285
|
# necessary to call it in a normal user program.
|
|
265
286
|
def write_firmware(data)
|
|
266
|
-
|
|
287
|
+
check_validity
|
|
288
|
+
|
|
289
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
|
267
290
|
end
|
|
268
291
|
|
|
269
292
|
# Sets the status LED configuration. By default the LED shows
|
|
@@ -274,22 +297,28 @@ module Tinkerforge
|
|
|
274
297
|
#
|
|
275
298
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
|
276
299
|
def set_status_led_config(config)
|
|
277
|
-
|
|
300
|
+
check_validity
|
|
301
|
+
|
|
302
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
|
278
303
|
end
|
|
279
304
|
|
|
280
305
|
# Returns the configuration as set by BrickletThermocoupleV2#set_status_led_config
|
|
281
306
|
def get_status_led_config
|
|
282
|
-
|
|
307
|
+
check_validity
|
|
308
|
+
|
|
309
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
|
283
310
|
end
|
|
284
311
|
|
|
285
|
-
# Returns the temperature
|
|
312
|
+
# Returns the temperature as measured inside the microcontroller. The
|
|
286
313
|
# value returned is not the ambient temperature!
|
|
287
314
|
#
|
|
288
315
|
# The temperature is only proportional to the real temperature and it has bad
|
|
289
316
|
# accuracy. Practically it is only useful as an indicator for
|
|
290
317
|
# temperature changes.
|
|
291
318
|
def get_chip_temperature
|
|
292
|
-
|
|
319
|
+
check_validity
|
|
320
|
+
|
|
321
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
|
293
322
|
end
|
|
294
323
|
|
|
295
324
|
# Calling this function will reset the Bricklet. All configurations
|
|
@@ -299,7 +328,9 @@ module Tinkerforge
|
|
|
299
328
|
# calling functions on the existing ones will result in
|
|
300
329
|
# undefined behavior!
|
|
301
330
|
def reset
|
|
302
|
-
|
|
331
|
+
check_validity
|
|
332
|
+
|
|
333
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
|
303
334
|
end
|
|
304
335
|
|
|
305
336
|
# Writes a new UID into flash. If you want to set a new UID
|
|
@@ -308,25 +339,32 @@ module Tinkerforge
|
|
|
308
339
|
#
|
|
309
340
|
# We recommend that you use Brick Viewer to change the UID.
|
|
310
341
|
def write_uid(uid)
|
|
311
|
-
|
|
342
|
+
check_validity
|
|
343
|
+
|
|
344
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
|
312
345
|
end
|
|
313
346
|
|
|
314
347
|
# Returns the current UID as an integer. Encode as
|
|
315
348
|
# Base58 to get the usual string version.
|
|
316
349
|
def read_uid
|
|
317
|
-
|
|
350
|
+
check_validity
|
|
351
|
+
|
|
352
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
|
318
353
|
end
|
|
319
354
|
|
|
320
355
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
321
356
|
# the position, the hardware and firmware version as well as the
|
|
322
357
|
# device identifier.
|
|
323
358
|
#
|
|
324
|
-
# The position can be 'a', 'b', 'c' or '
|
|
359
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
360
|
+
# The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
|
|
361
|
+
# connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
|
|
362
|
+
# position 'z'.
|
|
325
363
|
#
|
|
326
364
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
327
365
|
# |device_identifier_constant|
|
|
328
366
|
def get_identity
|
|
329
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
367
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
330
368
|
end
|
|
331
369
|
|
|
332
370
|
# 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-04-07. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.25 #
|
|
6
6
|
# #
|
|
7
7
|
# If you have a bugfix for this file and want to commit it, #
|
|
8
8
|
# please fix the bug in the generator. You can find a link #
|
|
9
9
|
# to the generators git repository on tinkerforge.com #
|
|
10
10
|
#############################################################
|
|
11
11
|
|
|
12
|
+
require_relative './ip_connection'
|
|
13
|
+
|
|
12
14
|
module Tinkerforge
|
|
13
15
|
# Detects inclination of Bricklet (tilt switch open/closed)
|
|
14
16
|
class BrickletTilt < Device
|
|
@@ -34,7 +36,7 @@ module Tinkerforge
|
|
|
34
36
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
35
37
|
# the IP Connection <tt>ipcon</tt>.
|
|
36
38
|
def initialize(uid, ipcon)
|
|
37
|
-
super uid, ipcon
|
|
39
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
38
40
|
|
|
39
41
|
@api_version = [2, 0, 0]
|
|
40
42
|
|
|
@@ -44,8 +46,9 @@ module Tinkerforge
|
|
|
44
46
|
@response_expected[FUNCTION_IS_TILT_STATE_CALLBACK_ENABLED] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
45
47
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
46
48
|
|
|
47
|
-
@callback_formats[CALLBACK_TILT_STATE] = 'C'
|
|
49
|
+
@callback_formats[CALLBACK_TILT_STATE] = [9, 'C']
|
|
48
50
|
|
|
51
|
+
@ipcon.add_device self
|
|
49
52
|
end
|
|
50
53
|
|
|
51
54
|
# Returns the current tilt state. The state can either be
|
|
@@ -60,34 +63,45 @@ module Tinkerforge
|
|
|
60
63
|
# :align: center
|
|
61
64
|
# :target: ../../_images/Bricklets/bricklet_tilt_mechanics.jpg
|
|
62
65
|
def get_tilt_state
|
|
63
|
-
|
|
66
|
+
check_validity
|
|
67
|
+
|
|
68
|
+
send_request FUNCTION_GET_TILT_STATE, [], '', 9, 'C'
|
|
64
69
|
end
|
|
65
70
|
|
|
66
71
|
# Enables the CALLBACK_TILT_STATE callback.
|
|
67
72
|
def enable_tilt_state_callback
|
|
68
|
-
|
|
73
|
+
check_validity
|
|
74
|
+
|
|
75
|
+
send_request FUNCTION_ENABLE_TILT_STATE_CALLBACK, [], '', 8, ''
|
|
69
76
|
end
|
|
70
77
|
|
|
71
78
|
# Disables the CALLBACK_TILT_STATE callback.
|
|
72
79
|
def disable_tilt_state_callback
|
|
73
|
-
|
|
80
|
+
check_validity
|
|
81
|
+
|
|
82
|
+
send_request FUNCTION_DISABLE_TILT_STATE_CALLBACK, [], '', 8, ''
|
|
74
83
|
end
|
|
75
84
|
|
|
76
85
|
# Returns *true* if the CALLBACK_TILT_STATE callback is enabled.
|
|
77
86
|
def is_tilt_state_callback_enabled
|
|
78
|
-
|
|
87
|
+
check_validity
|
|
88
|
+
|
|
89
|
+
send_request FUNCTION_IS_TILT_STATE_CALLBACK_ENABLED, [], '', 9, '?'
|
|
79
90
|
end
|
|
80
91
|
|
|
81
92
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
82
93
|
# the position, the hardware and firmware version as well as the
|
|
83
94
|
# device identifier.
|
|
84
95
|
#
|
|
85
|
-
# The position can be 'a', 'b', 'c' or '
|
|
96
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
97
|
+
# The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
|
|
98
|
+
# connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
|
|
99
|
+
# position 'z'.
|
|
86
100
|
#
|
|
87
101
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
88
102
|
# |device_identifier_constant|
|
|
89
103
|
def get_identity
|
|
90
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
104
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
91
105
|
end
|
|
92
106
|
|
|
93
107
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|