tinkerforge 2.1.24 → 2.1.29
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 +69 -31
- data/lib/tinkerforge/brick_hat_zero.rb +55 -23
- data/lib/tinkerforge/brick_imu.rb +185 -78
- data/lib/tinkerforge/brick_imu_v2.rb +209 -106
- data/lib/tinkerforge/brick_master.rb +491 -183
- data/lib/tinkerforge/brick_red.rb +197 -74
- data/lib/tinkerforge/brick_servo.rb +186 -102
- data/lib/tinkerforge/brick_silent_stepper.rb +247 -167
- data/lib/tinkerforge/brick_stepper.rb +211 -99
- data/lib/tinkerforge/bricklet_accelerometer.rb +57 -23
- data/lib/tinkerforge/bricklet_accelerometer_v2.rb +104 -54
- data/lib/tinkerforge/bricklet_air_quality.rb +116 -59
- data/lib/tinkerforge/bricklet_ambient_light.rb +50 -21
- data/lib/tinkerforge/bricklet_ambient_light_v2.rb +44 -24
- data/lib/tinkerforge/bricklet_ambient_light_v3.rb +65 -27
- data/lib/tinkerforge/bricklet_analog_in.rb +62 -25
- data/lib/tinkerforge/bricklet_analog_in_v2.rb +56 -23
- data/lib/tinkerforge/bricklet_analog_in_v3.rb +66 -25
- data/lib/tinkerforge/bricklet_analog_out.rb +22 -9
- data/lib/tinkerforge/bricklet_analog_out_v2.rb +19 -8
- data/lib/tinkerforge/bricklet_analog_out_v3.rb +53 -20
- data/lib/tinkerforge/bricklet_barometer.rb +100 -27
- data/lib/tinkerforge/bricklet_barometer_v2.rb +98 -37
- data/lib/tinkerforge/bricklet_can.rb +83 -19
- data/lib/tinkerforge/bricklet_can_v2.rb +171 -38
- data/lib/tinkerforge/bricklet_co2.rb +33 -14
- data/lib/tinkerforge/bricklet_co2_v2.rb +97 -38
- data/lib/tinkerforge/bricklet_color.rb +68 -27
- data/lib/tinkerforge/bricklet_color_v2.rb +86 -33
- data/lib/tinkerforge/bricklet_compass.rb +77 -30
- data/lib/tinkerforge/bricklet_current12.rb +57 -24
- data/lib/tinkerforge/bricklet_current25.rb +57 -24
- data/lib/tinkerforge/bricklet_dc_v2.rb +521 -0
- data/lib/tinkerforge/bricklet_distance_ir.rb +56 -23
- data/lib/tinkerforge/bricklet_distance_ir_v2.rb +82 -31
- data/lib/tinkerforge/bricklet_distance_us.rb +39 -16
- data/lib/tinkerforge/bricklet_distance_us_v2.rb +66 -25
- data/lib/tinkerforge/bricklet_dmx.rb +87 -34
- data/lib/tinkerforge/bricklet_dual_button.rb +23 -10
- data/lib/tinkerforge/bricklet_dual_button_v2.rb +63 -24
- data/lib/tinkerforge/bricklet_dual_relay.rb +26 -11
- data/lib/tinkerforge/bricklet_dust_detector.rb +39 -16
- data/lib/tinkerforge/bricklet_e_paper_296x128.rb +87 -32
- data/lib/tinkerforge/bricklet_energy_monitor.rb +72 -27
- data/lib/tinkerforge/bricklet_gps.rb +63 -26
- data/lib/tinkerforge/bricklet_gps_v2.rb +116 -47
- data/lib/tinkerforge/bricklet_hall_effect.rb +42 -23
- data/lib/tinkerforge/bricklet_hall_effect_v2.rb +70 -27
- data/lib/tinkerforge/bricklet_humidity.rb +50 -21
- data/lib/tinkerforge/bricklet_humidity_v2.rb +82 -31
- data/lib/tinkerforge/bricklet_imu_v3.rb +784 -0
- data/lib/tinkerforge/bricklet_industrial_analog_out.rb +37 -14
- data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +80 -29
- data/lib/tinkerforge/bricklet_industrial_counter.rb +100 -39
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +44 -17
- data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +76 -29
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +35 -14
- data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +72 -27
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +39 -16
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +79 -30
- data/lib/tinkerforge/bricklet_industrial_dual_ac_relay.rb +325 -0
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +48 -19
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +137 -31
- data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +60 -23
- data/lib/tinkerforge/bricklet_industrial_ptc.rb +475 -0
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +35 -14
- data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +66 -25
- data/lib/tinkerforge/bricklet_io16.rb +54 -21
- data/lib/tinkerforge/bricklet_io16_v2.rb +89 -34
- data/lib/tinkerforge/bricklet_io4.rb +54 -23
- data/lib/tinkerforge/bricklet_io4_v2.rb +95 -36
- data/lib/tinkerforge/bricklet_isolator.rb +72 -29
- data/lib/tinkerforge/bricklet_joystick.rb +58 -25
- data/lib/tinkerforge/bricklet_joystick_v2.rb +67 -26
- data/lib/tinkerforge/bricklet_laser_range_finder.rb +81 -32
- data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +95 -36
- data/lib/tinkerforge/bricklet_lcd_128x64.rb +191 -70
- data/lib/tinkerforge/bricklet_lcd_16x2.rb +44 -18
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +57 -23
- data/lib/tinkerforge/bricklet_led_strip.rb +59 -22
- data/lib/tinkerforge/bricklet_led_strip_v2.rb +90 -46
- data/lib/tinkerforge/bricklet_line.rb +33 -14
- data/lib/tinkerforge/bricklet_linear_poti.rb +50 -21
- data/lib/tinkerforge/bricklet_linear_poti_v2.rb +54 -21
- data/lib/tinkerforge/bricklet_load_cell.rb +60 -23
- data/lib/tinkerforge/bricklet_load_cell_v2.rb +79 -30
- data/lib/tinkerforge/bricklet_moisture.rb +39 -16
- data/lib/tinkerforge/bricklet_motion_detector.rb +21 -10
- data/lib/tinkerforge/bricklet_motion_detector_v2.rb +61 -27
- data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +70 -27
- data/lib/tinkerforge/bricklet_multi_touch.rb +30 -13
- data/lib/tinkerforge/bricklet_multi_touch_v2.rb +75 -28
- data/lib/tinkerforge/bricklet_nfc.rb +126 -62
- data/lib/tinkerforge/bricklet_nfc_rfid.rb +32 -13
- data/lib/tinkerforge/bricklet_oled_128x64.rb +28 -11
- data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +65 -24
- data/lib/tinkerforge/bricklet_oled_64x48.rb +28 -11
- data/lib/tinkerforge/bricklet_one_wire.rb +65 -24
- data/lib/tinkerforge/bricklet_outdoor_weather.rb +71 -28
- data/lib/tinkerforge/bricklet_particulate_matter.rb +74 -30
- data/lib/tinkerforge/bricklet_performance_dc.rb +682 -0
- data/lib/tinkerforge/bricklet_piezo_buzzer.rb +18 -9
- data/lib/tinkerforge/bricklet_piezo_speaker.rb +21 -10
- data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +79 -42
- data/lib/tinkerforge/bricklet_ptc.rb +73 -42
- data/lib/tinkerforge/bricklet_ptc_v2.rb +94 -48
- data/lib/tinkerforge/bricklet_real_time_clock.rb +44 -33
- data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +77 -44
- 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 +38 -19
- data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +59 -24
- data/lib/tinkerforge/bricklet_rotary_poti.rb +52 -28
- data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +56 -23
- data/lib/tinkerforge/bricklet_rs232.rb +89 -28
- data/lib/tinkerforge/bricklet_rs232_v2.rb +117 -44
- data/lib/tinkerforge/bricklet_rs485.rb +222 -95
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
- data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +74 -35
- data/lib/tinkerforge/bricklet_servo_v2.rb +565 -0
- data/lib/tinkerforge/bricklet_silent_stepper_v2.rb +1024 -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 +34 -18
- data/lib/tinkerforge/bricklet_sound_pressure_level.rb +71 -31
- data/lib/tinkerforge/bricklet_temperature.rb +39 -16
- data/lib/tinkerforge/bricklet_temperature_ir.rb +56 -23
- data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +70 -27
- data/lib/tinkerforge/bricklet_temperature_v2.rb +60 -25
- data/lib/tinkerforge/bricklet_thermal_imaging.rb +104 -44
- data/lib/tinkerforge/bricklet_thermocouple.rb +44 -24
- data/lib/tinkerforge/bricklet_thermocouple_v2.rb +64 -27
- data/lib/tinkerforge/bricklet_tilt.rb +23 -10
- data/lib/tinkerforge/bricklet_uv_light.rb +35 -18
- data/lib/tinkerforge/bricklet_uv_light_v2.rb +84 -37
- data/lib/tinkerforge/bricklet_voltage.rb +51 -28
- data/lib/tinkerforge/bricklet_voltage_current.rb +90 -73
- data/lib/tinkerforge/bricklet_voltage_current_v2.rb +89 -68
- data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +79 -30
- data/lib/tinkerforge/device_display_names.rb +170 -0
- data/lib/tinkerforge/ip_connection.rb +153 -33
- data/lib/tinkerforge/version.rb +1 -1
- metadata +11 -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-05-06. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.29 #
|
|
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 air pressure and altitude changes
|
|
14
16
|
class BrickletBarometerV2 < Device
|
|
@@ -96,7 +98,7 @@ module Tinkerforge
|
|
|
96
98
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
97
99
|
# the IP Connection <tt>ipcon</tt>.
|
|
98
100
|
def initialize(uid, ipcon)
|
|
99
|
-
super uid, ipcon
|
|
101
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
100
102
|
|
|
101
103
|
@api_version = [2, 0, 0]
|
|
102
104
|
|
|
@@ -130,10 +132,11 @@ module Tinkerforge
|
|
|
130
132
|
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
131
133
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
132
134
|
|
|
133
|
-
@callback_formats[CALLBACK_AIR_PRESSURE] = 'l'
|
|
134
|
-
@callback_formats[CALLBACK_ALTITUDE] = 'l'
|
|
135
|
-
@callback_formats[CALLBACK_TEMPERATURE] = 'l'
|
|
135
|
+
@callback_formats[CALLBACK_AIR_PRESSURE] = [12, 'l']
|
|
136
|
+
@callback_formats[CALLBACK_ALTITUDE] = [12, 'l']
|
|
137
|
+
@callback_formats[CALLBACK_TEMPERATURE] = [12, 'l']
|
|
136
138
|
|
|
139
|
+
@ipcon.add_device self
|
|
137
140
|
end
|
|
138
141
|
|
|
139
142
|
# Returns the measured air pressure.
|
|
@@ -143,7 +146,9 @@ module Tinkerforge
|
|
|
143
146
|
# CALLBACK_AIR_PRESSURE callback. You can set the callback configuration
|
|
144
147
|
# with BrickletBarometerV2#set_air_pressure_callback_configuration.
|
|
145
148
|
def get_air_pressure
|
|
146
|
-
|
|
149
|
+
check_validity
|
|
150
|
+
|
|
151
|
+
send_request FUNCTION_GET_AIR_PRESSURE, [], '', 12, 'l'
|
|
147
152
|
end
|
|
148
153
|
|
|
149
154
|
# The period is the period with which the CALLBACK_AIR_PRESSURE callback is triggered
|
|
@@ -172,12 +177,16 @@ module Tinkerforge
|
|
|
172
177
|
#
|
|
173
178
|
# If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
|
|
174
179
|
def set_air_pressure_callback_configuration(period, value_has_to_change, option, min, max)
|
|
175
|
-
|
|
180
|
+
check_validity
|
|
181
|
+
|
|
182
|
+
send_request FUNCTION_SET_AIR_PRESSURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 8, ''
|
|
176
183
|
end
|
|
177
184
|
|
|
178
185
|
# Returns the callback configuration as set by BrickletBarometerV2#set_air_pressure_callback_configuration.
|
|
179
186
|
def get_air_pressure_callback_configuration
|
|
180
|
-
|
|
187
|
+
check_validity
|
|
188
|
+
|
|
189
|
+
send_request FUNCTION_GET_AIR_PRESSURE_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k l l'
|
|
181
190
|
end
|
|
182
191
|
|
|
183
192
|
# Returns the relative altitude of the air pressure sensor. The value
|
|
@@ -190,7 +199,9 @@ module Tinkerforge
|
|
|
190
199
|
# CALLBACK_ALTITUDE callback. You can set the callback configuration
|
|
191
200
|
# with BrickletBarometerV2#set_altitude_callback_configuration.
|
|
192
201
|
def get_altitude
|
|
193
|
-
|
|
202
|
+
check_validity
|
|
203
|
+
|
|
204
|
+
send_request FUNCTION_GET_ALTITUDE, [], '', 12, 'l'
|
|
194
205
|
end
|
|
195
206
|
|
|
196
207
|
# The period is the period with which the CALLBACK_ALTITUDE callback is triggered
|
|
@@ -219,12 +230,16 @@ module Tinkerforge
|
|
|
219
230
|
#
|
|
220
231
|
# If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
|
|
221
232
|
def set_altitude_callback_configuration(period, value_has_to_change, option, min, max)
|
|
222
|
-
|
|
233
|
+
check_validity
|
|
234
|
+
|
|
235
|
+
send_request FUNCTION_SET_ALTITUDE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 8, ''
|
|
223
236
|
end
|
|
224
237
|
|
|
225
238
|
# Returns the callback configuration as set by BrickletBarometerV2#set_altitude_callback_configuration.
|
|
226
239
|
def get_altitude_callback_configuration
|
|
227
|
-
|
|
240
|
+
check_validity
|
|
241
|
+
|
|
242
|
+
send_request FUNCTION_GET_ALTITUDE_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k l l'
|
|
228
243
|
end
|
|
229
244
|
|
|
230
245
|
# Returns the temperature of the air pressure sensor.
|
|
@@ -239,7 +254,9 @@ module Tinkerforge
|
|
|
239
254
|
# CALLBACK_TEMPERATURE callback. You can set the callback configuration
|
|
240
255
|
# with BrickletBarometerV2#set_temperature_callback_configuration.
|
|
241
256
|
def get_temperature
|
|
242
|
-
|
|
257
|
+
check_validity
|
|
258
|
+
|
|
259
|
+
send_request FUNCTION_GET_TEMPERATURE, [], '', 12, 'l'
|
|
243
260
|
end
|
|
244
261
|
|
|
245
262
|
# The period is the period with which the CALLBACK_TEMPERATURE callback is triggered
|
|
@@ -268,12 +285,16 @@ module Tinkerforge
|
|
|
268
285
|
#
|
|
269
286
|
# If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
|
|
270
287
|
def set_temperature_callback_configuration(period, value_has_to_change, option, min, max)
|
|
271
|
-
|
|
288
|
+
check_validity
|
|
289
|
+
|
|
290
|
+
send_request FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 8, ''
|
|
272
291
|
end
|
|
273
292
|
|
|
274
293
|
# Returns the callback configuration as set by BrickletBarometerV2#set_temperature_callback_configuration.
|
|
275
294
|
def get_temperature_callback_configuration
|
|
276
|
-
|
|
295
|
+
check_validity
|
|
296
|
+
|
|
297
|
+
send_request FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k l l'
|
|
277
298
|
end
|
|
278
299
|
|
|
279
300
|
# Sets the length of a `moving averaging <https://en.wikipedia.org/wiki/Moving_average>`__
|
|
@@ -285,13 +306,17 @@ module Tinkerforge
|
|
|
285
306
|
# If you want to do long term measurements the longest moving average will give
|
|
286
307
|
# the cleanest results.
|
|
287
308
|
def set_moving_average_configuration(moving_average_length_air_pressure, moving_average_length_temperature)
|
|
288
|
-
|
|
309
|
+
check_validity
|
|
310
|
+
|
|
311
|
+
send_request FUNCTION_SET_MOVING_AVERAGE_CONFIGURATION, [moving_average_length_air_pressure, moving_average_length_temperature], 'S S', 8, ''
|
|
289
312
|
end
|
|
290
313
|
|
|
291
314
|
# Returns the moving average configuration as set by
|
|
292
315
|
# BrickletBarometerV2#set_moving_average_configuration.
|
|
293
316
|
def get_moving_average_configuration
|
|
294
|
-
|
|
317
|
+
check_validity
|
|
318
|
+
|
|
319
|
+
send_request FUNCTION_GET_MOVING_AVERAGE_CONFIGURATION, [], '', 12, 'S S'
|
|
295
320
|
end
|
|
296
321
|
|
|
297
322
|
# Sets the reference air pressure for the altitude calculation.
|
|
@@ -304,12 +329,16 @@ module Tinkerforge
|
|
|
304
329
|
# `QFE <https://en.wikipedia.org/wiki/Mean_sea_level_pressure#Mean_sea_level_pressure>`__
|
|
305
330
|
# used in aviation.
|
|
306
331
|
def set_reference_air_pressure(air_pressure)
|
|
307
|
-
|
|
332
|
+
check_validity
|
|
333
|
+
|
|
334
|
+
send_request FUNCTION_SET_REFERENCE_AIR_PRESSURE, [air_pressure], 'l', 8, ''
|
|
308
335
|
end
|
|
309
336
|
|
|
310
337
|
# Returns the reference air pressure as set by BrickletBarometerV2#set_reference_air_pressure.
|
|
311
338
|
def get_reference_air_pressure
|
|
312
|
-
|
|
339
|
+
check_validity
|
|
340
|
+
|
|
341
|
+
send_request FUNCTION_GET_REFERENCE_AIR_PRESSURE, [], '', 12, 'l'
|
|
313
342
|
end
|
|
314
343
|
|
|
315
344
|
# Sets the one point calibration (OPC) values for the air pressure measurement.
|
|
@@ -327,13 +356,17 @@ module Tinkerforge
|
|
|
327
356
|
# The calibration is saved in the EEPROM of the Bricklet and only needs to be
|
|
328
357
|
# configured once.
|
|
329
358
|
def set_calibration(measured_air_pressure, actual_air_pressure)
|
|
330
|
-
|
|
359
|
+
check_validity
|
|
360
|
+
|
|
361
|
+
send_request FUNCTION_SET_CALIBRATION, [measured_air_pressure, actual_air_pressure], 'l l', 8, ''
|
|
331
362
|
end
|
|
332
363
|
|
|
333
364
|
# Returns the air pressure one point calibration values as set by
|
|
334
365
|
# BrickletBarometerV2#set_calibration.
|
|
335
366
|
def get_calibration
|
|
336
|
-
|
|
367
|
+
check_validity
|
|
368
|
+
|
|
369
|
+
send_request FUNCTION_GET_CALIBRATION, [], '', 16, 'l l'
|
|
337
370
|
end
|
|
338
371
|
|
|
339
372
|
# Configures the data rate and air pressure low pass filter. The low pass filter
|
|
@@ -347,12 +380,16 @@ module Tinkerforge
|
|
|
347
380
|
# self-heating of the sensor. If the accuracy of the temperature reading is
|
|
348
381
|
# important to you, we would recommend the 1Hz data rate.
|
|
349
382
|
def set_sensor_configuration(data_rate, air_pressure_low_pass_filter)
|
|
350
|
-
|
|
383
|
+
check_validity
|
|
384
|
+
|
|
385
|
+
send_request FUNCTION_SET_SENSOR_CONFIGURATION, [data_rate, air_pressure_low_pass_filter], 'C C', 8, ''
|
|
351
386
|
end
|
|
352
387
|
|
|
353
388
|
# Returns the sensor configuration as set by BrickletBarometerV2#set_sensor_configuration.
|
|
354
389
|
def get_sensor_configuration
|
|
355
|
-
|
|
390
|
+
check_validity
|
|
391
|
+
|
|
392
|
+
send_request FUNCTION_GET_SENSOR_CONFIGURATION, [], '', 10, 'C C'
|
|
356
393
|
end
|
|
357
394
|
|
|
358
395
|
# Returns the error count for the communication between Brick and Bricklet.
|
|
@@ -367,7 +404,9 @@ module Tinkerforge
|
|
|
367
404
|
# The errors counts are for errors that occur on the Bricklet side. All
|
|
368
405
|
# Bricks have a similar function that returns the errors on the Brick side.
|
|
369
406
|
def get_spitfp_error_count
|
|
370
|
-
|
|
407
|
+
check_validity
|
|
408
|
+
|
|
409
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
|
371
410
|
end
|
|
372
411
|
|
|
373
412
|
# Sets the bootloader mode and returns the status after the requested
|
|
@@ -380,12 +419,16 @@ module Tinkerforge
|
|
|
380
419
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
381
420
|
# necessary to call it in a normal user program.
|
|
382
421
|
def set_bootloader_mode(mode)
|
|
383
|
-
|
|
422
|
+
check_validity
|
|
423
|
+
|
|
424
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
|
384
425
|
end
|
|
385
426
|
|
|
386
427
|
# Returns the current bootloader mode, see BrickletBarometerV2#set_bootloader_mode.
|
|
387
428
|
def get_bootloader_mode
|
|
388
|
-
|
|
429
|
+
check_validity
|
|
430
|
+
|
|
431
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
|
389
432
|
end
|
|
390
433
|
|
|
391
434
|
# Sets the firmware pointer for BrickletBarometerV2#write_firmware. The pointer has
|
|
@@ -395,7 +438,9 @@ module Tinkerforge
|
|
|
395
438
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
396
439
|
# necessary to call it in a normal user program.
|
|
397
440
|
def set_write_firmware_pointer(pointer)
|
|
398
|
-
|
|
441
|
+
check_validity
|
|
442
|
+
|
|
443
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
|
399
444
|
end
|
|
400
445
|
|
|
401
446
|
# Writes 64 Bytes of firmware at the position as written by
|
|
@@ -407,7 +452,9 @@ module Tinkerforge
|
|
|
407
452
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
408
453
|
# necessary to call it in a normal user program.
|
|
409
454
|
def write_firmware(data)
|
|
410
|
-
|
|
455
|
+
check_validity
|
|
456
|
+
|
|
457
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
|
411
458
|
end
|
|
412
459
|
|
|
413
460
|
# Sets the status LED configuration. By default the LED shows
|
|
@@ -418,22 +465,28 @@ module Tinkerforge
|
|
|
418
465
|
#
|
|
419
466
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
|
420
467
|
def set_status_led_config(config)
|
|
421
|
-
|
|
468
|
+
check_validity
|
|
469
|
+
|
|
470
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
|
422
471
|
end
|
|
423
472
|
|
|
424
473
|
# Returns the configuration as set by BrickletBarometerV2#set_status_led_config
|
|
425
474
|
def get_status_led_config
|
|
426
|
-
|
|
475
|
+
check_validity
|
|
476
|
+
|
|
477
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
|
427
478
|
end
|
|
428
479
|
|
|
429
|
-
# Returns the temperature
|
|
480
|
+
# Returns the temperature as measured inside the microcontroller. The
|
|
430
481
|
# value returned is not the ambient temperature!
|
|
431
482
|
#
|
|
432
483
|
# The temperature is only proportional to the real temperature and it has bad
|
|
433
484
|
# accuracy. Practically it is only useful as an indicator for
|
|
434
485
|
# temperature changes.
|
|
435
486
|
def get_chip_temperature
|
|
436
|
-
|
|
487
|
+
check_validity
|
|
488
|
+
|
|
489
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
|
437
490
|
end
|
|
438
491
|
|
|
439
492
|
# Calling this function will reset the Bricklet. All configurations
|
|
@@ -443,7 +496,9 @@ module Tinkerforge
|
|
|
443
496
|
# calling functions on the existing ones will result in
|
|
444
497
|
# undefined behavior!
|
|
445
498
|
def reset
|
|
446
|
-
|
|
499
|
+
check_validity
|
|
500
|
+
|
|
501
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
|
447
502
|
end
|
|
448
503
|
|
|
449
504
|
# Writes a new UID into flash. If you want to set a new UID
|
|
@@ -452,25 +507,31 @@ module Tinkerforge
|
|
|
452
507
|
#
|
|
453
508
|
# We recommend that you use Brick Viewer to change the UID.
|
|
454
509
|
def write_uid(uid)
|
|
455
|
-
|
|
510
|
+
check_validity
|
|
511
|
+
|
|
512
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
|
456
513
|
end
|
|
457
514
|
|
|
458
515
|
# Returns the current UID as an integer. Encode as
|
|
459
516
|
# Base58 to get the usual string version.
|
|
460
517
|
def read_uid
|
|
461
|
-
|
|
518
|
+
check_validity
|
|
519
|
+
|
|
520
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
|
462
521
|
end
|
|
463
522
|
|
|
464
523
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
465
524
|
# the position, the hardware and firmware version as well as the
|
|
466
525
|
# device identifier.
|
|
467
526
|
#
|
|
468
|
-
# The position can be 'a', 'b', 'c' or '
|
|
527
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
528
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
529
|
+
# position 'z'.
|
|
469
530
|
#
|
|
470
531
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
471
532
|
# |device_identifier_constant|
|
|
472
533
|
def get_identity
|
|
473
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
534
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
474
535
|
end
|
|
475
536
|
|
|
476
537
|
# 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-05-06. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.29 #
|
|
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
|
# Communicates with CAN bus devices
|
|
14
16
|
class BrickletCAN < Device
|
|
@@ -29,6 +31,20 @@ module Tinkerforge
|
|
|
29
31
|
# To enable this callback, use BrickletCAN#enable_frame_read_callback.
|
|
30
32
|
CALLBACK_FRAME_READ = 11
|
|
31
33
|
|
|
34
|
+
# This callback is triggered if a data or remote frame was received by the CAN
|
|
35
|
+
# transceiver. The received frame can be read with BrickletCAN#read_frame.
|
|
36
|
+
# If additional frames are received, but BrickletCAN#read_frame was not called yet, the callback
|
|
37
|
+
# will not trigger again.
|
|
38
|
+
#
|
|
39
|
+
# A configurable read filter can be used to define which frames should be
|
|
40
|
+
# received by the CAN transceiver and put into the read queue (see
|
|
41
|
+
# BrickletCAN#set_read_filter).
|
|
42
|
+
#
|
|
43
|
+
# To enable this callback, use BrickletCAN#set_frame_readable_callback_configuration.
|
|
44
|
+
#
|
|
45
|
+
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
|
46
|
+
CALLBACK_FRAME_READABLE = 14
|
|
47
|
+
|
|
32
48
|
FUNCTION_WRITE_FRAME = 1 # :nodoc:
|
|
33
49
|
FUNCTION_READ_FRAME = 2 # :nodoc:
|
|
34
50
|
FUNCTION_ENABLE_FRAME_READ_CALLBACK = 3 # :nodoc:
|
|
@@ -39,6 +55,8 @@ module Tinkerforge
|
|
|
39
55
|
FUNCTION_SET_READ_FILTER = 8 # :nodoc:
|
|
40
56
|
FUNCTION_GET_READ_FILTER = 9 # :nodoc:
|
|
41
57
|
FUNCTION_GET_ERROR_LOG = 10 # :nodoc:
|
|
58
|
+
FUNCTION_SET_FRAME_READABLE_CALLBACK_CONFIGURATION = 12 # :nodoc:
|
|
59
|
+
FUNCTION_GET_FRAME_READABLE_CALLBACK_CONFIGURATION = 13 # :nodoc:
|
|
42
60
|
FUNCTION_GET_IDENTITY = 255 # :nodoc:
|
|
43
61
|
|
|
44
62
|
FRAME_TYPE_STANDARD_DATA = 0 # :nodoc:
|
|
@@ -65,9 +83,9 @@ module Tinkerforge
|
|
|
65
83
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
66
84
|
# the IP Connection <tt>ipcon</tt>.
|
|
67
85
|
def initialize(uid, ipcon)
|
|
68
|
-
super uid, ipcon
|
|
86
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
69
87
|
|
|
70
|
-
@api_version = [2, 0,
|
|
88
|
+
@api_version = [2, 0, 1]
|
|
71
89
|
|
|
72
90
|
@response_expected[FUNCTION_WRITE_FRAME] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
73
91
|
@response_expected[FUNCTION_READ_FRAME] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
@@ -79,10 +97,14 @@ module Tinkerforge
|
|
|
79
97
|
@response_expected[FUNCTION_SET_READ_FILTER] = RESPONSE_EXPECTED_FALSE
|
|
80
98
|
@response_expected[FUNCTION_GET_READ_FILTER] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
81
99
|
@response_expected[FUNCTION_GET_ERROR_LOG] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
100
|
+
@response_expected[FUNCTION_SET_FRAME_READABLE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
|
|
101
|
+
@response_expected[FUNCTION_GET_FRAME_READABLE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
82
102
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
83
103
|
|
|
84
|
-
@callback_formats[CALLBACK_FRAME_READ] = 'C L C8 C'
|
|
104
|
+
@callback_formats[CALLBACK_FRAME_READ] = [22, 'C L C8 C']
|
|
105
|
+
@callback_formats[CALLBACK_FRAME_READABLE] = [8, '']
|
|
85
106
|
|
|
107
|
+
@ipcon.add_device self
|
|
86
108
|
end
|
|
87
109
|
|
|
88
110
|
# Writes a data or remote frame to the write buffer to be transmitted over the
|
|
@@ -107,7 +129,9 @@ module Tinkerforge
|
|
|
107
129
|
# arbitration or because the CAN transceiver is currently disabled due to a high
|
|
108
130
|
# write error level (see BrickletCAN#get_error_log).
|
|
109
131
|
def write_frame(frame_type, identifier, data, length)
|
|
110
|
-
|
|
132
|
+
check_validity
|
|
133
|
+
|
|
134
|
+
send_request FUNCTION_WRITE_FRAME, [frame_type, identifier, data, length], 'C L C8 C', 9, '?'
|
|
111
135
|
end
|
|
112
136
|
|
|
113
137
|
# Tries to read the next data or remote frame from the read buffer and return it.
|
|
@@ -128,26 +152,34 @@ module Tinkerforge
|
|
|
128
152
|
# Instead of polling with this function, you can also use callbacks. See the
|
|
129
153
|
# BrickletCAN#enable_frame_read_callback function and the CALLBACK_FRAME_READ callback.
|
|
130
154
|
def read_frame
|
|
131
|
-
|
|
155
|
+
check_validity
|
|
156
|
+
|
|
157
|
+
send_request FUNCTION_READ_FRAME, [], '', 23, '? C L C8 C'
|
|
132
158
|
end
|
|
133
159
|
|
|
134
160
|
# Enables the CALLBACK_FRAME_READ callback.
|
|
135
161
|
#
|
|
136
|
-
# By default the callback is disabled.
|
|
162
|
+
# By default the callback is disabled. Enabling this callback will disable the CALLBACK_FRAME_READABLE callback.
|
|
137
163
|
def enable_frame_read_callback
|
|
138
|
-
|
|
164
|
+
check_validity
|
|
165
|
+
|
|
166
|
+
send_request FUNCTION_ENABLE_FRAME_READ_CALLBACK, [], '', 8, ''
|
|
139
167
|
end
|
|
140
168
|
|
|
141
169
|
# Disables the CALLBACK_FRAME_READ callback.
|
|
142
170
|
#
|
|
143
171
|
# By default the callback is disabled.
|
|
144
172
|
def disable_frame_read_callback
|
|
145
|
-
|
|
173
|
+
check_validity
|
|
174
|
+
|
|
175
|
+
send_request FUNCTION_DISABLE_FRAME_READ_CALLBACK, [], '', 8, ''
|
|
146
176
|
end
|
|
147
177
|
|
|
148
178
|
# Returns *true* if the CALLBACK_FRAME_READ callback is enabled, *false* otherwise.
|
|
149
179
|
def is_frame_read_callback_enabled
|
|
150
|
-
|
|
180
|
+
check_validity
|
|
181
|
+
|
|
182
|
+
send_request FUNCTION_IS_FRAME_READ_CALLBACK_ENABLED, [], '', 9, '?'
|
|
151
183
|
end
|
|
152
184
|
|
|
153
185
|
# Sets the configuration for the CAN bus communication.
|
|
@@ -175,12 +207,16 @@ module Tinkerforge
|
|
|
175
207
|
# If the frame could not be transmitted successfully after the configured
|
|
176
208
|
# number of milliseconds then the frame is discarded.
|
|
177
209
|
def set_configuration(baud_rate, transceiver_mode, write_timeout)
|
|
178
|
-
|
|
210
|
+
check_validity
|
|
211
|
+
|
|
212
|
+
send_request FUNCTION_SET_CONFIGURATION, [baud_rate, transceiver_mode, write_timeout], 'C C l', 8, ''
|
|
179
213
|
end
|
|
180
214
|
|
|
181
215
|
# Returns the configuration as set by BrickletCAN#set_configuration.
|
|
182
216
|
def get_configuration
|
|
183
|
-
|
|
217
|
+
check_validity
|
|
218
|
+
|
|
219
|
+
send_request FUNCTION_GET_CONFIGURATION, [], '', 14, 'C C l'
|
|
184
220
|
end
|
|
185
221
|
|
|
186
222
|
# Set the read filter configuration. This can be used to define which frames
|
|
@@ -234,12 +270,16 @@ module Tinkerforge
|
|
|
234
270
|
# To accept identifier 0x123 and identifier 0x456 at the same time, just set
|
|
235
271
|
# filter 2 to 0x456 and keep mask and filter 1 unchanged.
|
|
236
272
|
def set_read_filter(mode, mask, filter1, filter2)
|
|
237
|
-
|
|
273
|
+
check_validity
|
|
274
|
+
|
|
275
|
+
send_request FUNCTION_SET_READ_FILTER, [mode, mask, filter1, filter2], 'C L L L', 8, ''
|
|
238
276
|
end
|
|
239
277
|
|
|
240
278
|
# Returns the read filter as set by BrickletCAN#set_read_filter.
|
|
241
279
|
def get_read_filter
|
|
242
|
-
|
|
280
|
+
check_validity
|
|
281
|
+
|
|
282
|
+
send_request FUNCTION_GET_READ_FILTER, [], '', 21, 'C L L L'
|
|
243
283
|
end
|
|
244
284
|
|
|
245
285
|
# Returns information about different kinds of errors.
|
|
@@ -248,7 +288,7 @@ module Tinkerforge
|
|
|
248
288
|
# acknowledgement, form, bit and stuffing errors during CAN bus write and read
|
|
249
289
|
# operations.
|
|
250
290
|
#
|
|
251
|
-
# When the write error level
|
|
291
|
+
# When the write error level exceeds 255 then the CAN transceiver gets disabled
|
|
252
292
|
# and no frames can be transmitted or received anymore. The CAN transceiver will
|
|
253
293
|
# automatically be activated again after the CAN bus is idle for a while.
|
|
254
294
|
#
|
|
@@ -276,19 +316,43 @@ module Tinkerforge
|
|
|
276
316
|
# function. Using the CALLBACK_FRAME_READ callback ensures that the read buffer
|
|
277
317
|
# can not overflow.
|
|
278
318
|
def get_error_log
|
|
279
|
-
|
|
319
|
+
check_validity
|
|
320
|
+
|
|
321
|
+
send_request FUNCTION_GET_ERROR_LOG, [], '', 23, 'C C ? L L L'
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
# Enables/disables the CALLBACK_FRAME_READABLE callback.
|
|
325
|
+
#
|
|
326
|
+
# By default the callback is disabled. Enabling this callback will disable the CALLBACK_FRAME_READ callback.
|
|
327
|
+
#
|
|
328
|
+
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
|
329
|
+
def set_frame_readable_callback_configuration(enabled)
|
|
330
|
+
check_validity
|
|
331
|
+
|
|
332
|
+
send_request FUNCTION_SET_FRAME_READABLE_CALLBACK_CONFIGURATION, [enabled], '?', 8, ''
|
|
333
|
+
end
|
|
334
|
+
|
|
335
|
+
# Returns *true* if the CALLBACK_FRAME_READABLE callback is enabled, *false* otherwise.
|
|
336
|
+
#
|
|
337
|
+
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
|
338
|
+
def get_frame_readable_callback_configuration
|
|
339
|
+
check_validity
|
|
340
|
+
|
|
341
|
+
send_request FUNCTION_GET_FRAME_READABLE_CALLBACK_CONFIGURATION, [], '', 9, '?'
|
|
280
342
|
end
|
|
281
343
|
|
|
282
344
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
283
345
|
# the position, the hardware and firmware version as well as the
|
|
284
346
|
# device identifier.
|
|
285
347
|
#
|
|
286
|
-
# The position can be 'a', 'b', 'c' or '
|
|
348
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
349
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
350
|
+
# position 'z'.
|
|
287
351
|
#
|
|
288
352
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
289
353
|
# |device_identifier_constant|
|
|
290
354
|
def get_identity
|
|
291
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
355
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
292
356
|
end
|
|
293
357
|
|
|
294
358
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|