tinkerforge 2.1.24 → 2.1.25
Sign up to get free protection for your applications and to get access to all the features.
- 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
|
# Communicates with RS485/Modbus devices with full- or half-duplex
|
14
16
|
class BrickletRS485 < Device
|
@@ -150,6 +152,14 @@ module Tinkerforge
|
|
150
152
|
# See CALLBACK_MODBUS_MASTER_READ_INPUT_REGISTERS_RESPONSE
|
151
153
|
CALLBACK_MODBUS_MASTER_READ_INPUT_REGISTERS_RESPONSE_LOW_LEVEL = 58
|
152
154
|
|
155
|
+
# This callback is called if at least one frame of data is readable. The frame size is configured with BrickletRS485#set_frame_readable_callback_configuration.
|
156
|
+
# The frame count parameter is the number of frames that can be read.
|
157
|
+
# This callback is triggered only once until BrickletRS485#read is called. This means, that if you have configured a frame size of X bytes,
|
158
|
+
# you can read exactly X bytes using the BrickletRS485#read function, every time the callback triggers without checking the frame count parameter.
|
159
|
+
#
|
160
|
+
# .. versionadded:: 2.0.5$nbsp;(Plugin)
|
161
|
+
CALLBACK_FRAME_READABLE = 61
|
162
|
+
|
153
163
|
# This callback is called if new data is available.
|
154
164
|
#
|
155
165
|
# To enable this callback, use BrickletRS485#enable_read_callback.
|
@@ -294,6 +304,8 @@ module Tinkerforge
|
|
294
304
|
FUNCTION_MODBUS_MASTER_READ_DISCRETE_INPUTS = 38 # :nodoc:
|
295
305
|
FUNCTION_MODBUS_SLAVE_ANSWER_READ_INPUT_REGISTERS_REQUEST_LOW_LEVEL = 39 # :nodoc:
|
296
306
|
FUNCTION_MODBUS_MASTER_READ_INPUT_REGISTERS = 40 # :nodoc:
|
307
|
+
FUNCTION_SET_FRAME_READABLE_CALLBACK_CONFIGURATION = 59 # :nodoc:
|
308
|
+
FUNCTION_GET_FRAME_READABLE_CALLBACK_CONFIGURATION = 60 # :nodoc:
|
297
309
|
FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
|
298
310
|
FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
|
299
311
|
FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
|
@@ -359,9 +371,9 @@ module Tinkerforge
|
|
359
371
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
360
372
|
# the IP Connection <tt>ipcon</tt>.
|
361
373
|
def initialize(uid, ipcon)
|
362
|
-
super uid, ipcon
|
374
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
363
375
|
|
364
|
-
@api_version = [2, 0,
|
376
|
+
@api_version = [2, 0, 1]
|
365
377
|
|
366
378
|
@response_expected[FUNCTION_WRITE_LOW_LEVEL] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
367
379
|
@response_expected[FUNCTION_READ_LOW_LEVEL] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
@@ -403,6 +415,8 @@ module Tinkerforge
|
|
403
415
|
@response_expected[FUNCTION_MODBUS_MASTER_READ_DISCRETE_INPUTS] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
404
416
|
@response_expected[FUNCTION_MODBUS_SLAVE_ANSWER_READ_INPUT_REGISTERS_REQUEST_LOW_LEVEL] = RESPONSE_EXPECTED_TRUE
|
405
417
|
@response_expected[FUNCTION_MODBUS_MASTER_READ_INPUT_REGISTERS] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
418
|
+
@response_expected[FUNCTION_SET_FRAME_READABLE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
|
419
|
+
@response_expected[FUNCTION_GET_FRAME_READABLE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
406
420
|
@response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
407
421
|
@response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
408
422
|
@response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
@@ -416,24 +430,25 @@ module Tinkerforge
|
|
416
430
|
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
417
431
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
418
432
|
|
419
|
-
@callback_formats[CALLBACK_READ_LOW_LEVEL] = 'S S k60'
|
420
|
-
@callback_formats[CALLBACK_ERROR_COUNT] = 'L L'
|
421
|
-
@callback_formats[CALLBACK_MODBUS_SLAVE_READ_COILS_REQUEST] = 'C L S'
|
422
|
-
@callback_formats[CALLBACK_MODBUS_MASTER_READ_COILS_RESPONSE_LOW_LEVEL] = 'C c S S ?464'
|
423
|
-
@callback_formats[CALLBACK_MODBUS_SLAVE_READ_HOLDING_REGISTERS_REQUEST] = 'C L S'
|
424
|
-
@callback_formats[CALLBACK_MODBUS_MASTER_READ_HOLDING_REGISTERS_RESPONSE_LOW_LEVEL] = 'C c S S S29'
|
425
|
-
@callback_formats[CALLBACK_MODBUS_SLAVE_WRITE_SINGLE_COIL_REQUEST] = 'C L ?'
|
426
|
-
@callback_formats[CALLBACK_MODBUS_MASTER_WRITE_SINGLE_COIL_RESPONSE] = 'C c'
|
427
|
-
@callback_formats[CALLBACK_MODBUS_SLAVE_WRITE_SINGLE_REGISTER_REQUEST] = 'C L S'
|
428
|
-
@callback_formats[CALLBACK_MODBUS_MASTER_WRITE_SINGLE_REGISTER_RESPONSE] = 'C c'
|
429
|
-
@callback_formats[CALLBACK_MODBUS_SLAVE_WRITE_MULTIPLE_COILS_REQUEST_LOW_LEVEL] = 'C L S S ?440'
|
430
|
-
@callback_formats[CALLBACK_MODBUS_MASTER_WRITE_MULTIPLE_COILS_RESPONSE] = 'C c'
|
431
|
-
@callback_formats[CALLBACK_MODBUS_SLAVE_WRITE_MULTIPLE_REGISTERS_REQUEST_LOW_LEVEL] = 'C L S S S27'
|
432
|
-
@callback_formats[CALLBACK_MODBUS_MASTER_WRITE_MULTIPLE_REGISTERS_RESPONSE] = 'C c'
|
433
|
-
@callback_formats[CALLBACK_MODBUS_SLAVE_READ_DISCRETE_INPUTS_REQUEST] = 'C L S'
|
434
|
-
@callback_formats[CALLBACK_MODBUS_MASTER_READ_DISCRETE_INPUTS_RESPONSE_LOW_LEVEL] = 'C c S S ?464'
|
435
|
-
@callback_formats[CALLBACK_MODBUS_SLAVE_READ_INPUT_REGISTERS_REQUEST] = 'C L S'
|
436
|
-
@callback_formats[CALLBACK_MODBUS_MASTER_READ_INPUT_REGISTERS_RESPONSE_LOW_LEVEL] = 'C c S S S29'
|
433
|
+
@callback_formats[CALLBACK_READ_LOW_LEVEL] = [72, 'S S k60']
|
434
|
+
@callback_formats[CALLBACK_ERROR_COUNT] = [16, 'L L']
|
435
|
+
@callback_formats[CALLBACK_MODBUS_SLAVE_READ_COILS_REQUEST] = [15, 'C L S']
|
436
|
+
@callback_formats[CALLBACK_MODBUS_MASTER_READ_COILS_RESPONSE_LOW_LEVEL] = [72, 'C c S S ?464']
|
437
|
+
@callback_formats[CALLBACK_MODBUS_SLAVE_READ_HOLDING_REGISTERS_REQUEST] = [15, 'C L S']
|
438
|
+
@callback_formats[CALLBACK_MODBUS_MASTER_READ_HOLDING_REGISTERS_RESPONSE_LOW_LEVEL] = [72, 'C c S S S29']
|
439
|
+
@callback_formats[CALLBACK_MODBUS_SLAVE_WRITE_SINGLE_COIL_REQUEST] = [14, 'C L ?']
|
440
|
+
@callback_formats[CALLBACK_MODBUS_MASTER_WRITE_SINGLE_COIL_RESPONSE] = [10, 'C c']
|
441
|
+
@callback_formats[CALLBACK_MODBUS_SLAVE_WRITE_SINGLE_REGISTER_REQUEST] = [15, 'C L S']
|
442
|
+
@callback_formats[CALLBACK_MODBUS_MASTER_WRITE_SINGLE_REGISTER_RESPONSE] = [10, 'C c']
|
443
|
+
@callback_formats[CALLBACK_MODBUS_SLAVE_WRITE_MULTIPLE_COILS_REQUEST_LOW_LEVEL] = [72, 'C L S S ?440']
|
444
|
+
@callback_formats[CALLBACK_MODBUS_MASTER_WRITE_MULTIPLE_COILS_RESPONSE] = [10, 'C c']
|
445
|
+
@callback_formats[CALLBACK_MODBUS_SLAVE_WRITE_MULTIPLE_REGISTERS_REQUEST_LOW_LEVEL] = [71, 'C L S S S27']
|
446
|
+
@callback_formats[CALLBACK_MODBUS_MASTER_WRITE_MULTIPLE_REGISTERS_RESPONSE] = [10, 'C c']
|
447
|
+
@callback_formats[CALLBACK_MODBUS_SLAVE_READ_DISCRETE_INPUTS_REQUEST] = [15, 'C L S']
|
448
|
+
@callback_formats[CALLBACK_MODBUS_MASTER_READ_DISCRETE_INPUTS_RESPONSE_LOW_LEVEL] = [72, 'C c S S ?464']
|
449
|
+
@callback_formats[CALLBACK_MODBUS_SLAVE_READ_INPUT_REGISTERS_REQUEST] = [15, 'C L S']
|
450
|
+
@callback_formats[CALLBACK_MODBUS_MASTER_READ_INPUT_REGISTERS_RESPONSE_LOW_LEVEL] = [72, 'C c S S S29']
|
451
|
+
@callback_formats[CALLBACK_FRAME_READABLE] = [10, 'S']
|
437
452
|
|
438
453
|
@high_level_callbacks[CALLBACK_READ] = [['stream_length', 'stream_chunk_offset', 'stream_chunk_data'], {'fixed_length' => nil, 'single_chunk' => false}, nil]
|
439
454
|
@high_level_callbacks[CALLBACK_MODBUS_MASTER_READ_COILS_RESPONSE] = [[nil, nil, 'stream_length', 'stream_chunk_offset', 'stream_chunk_data'], {'fixed_length' => nil, 'single_chunk' => false}, nil]
|
@@ -442,6 +457,7 @@ module Tinkerforge
|
|
442
457
|
@high_level_callbacks[CALLBACK_MODBUS_SLAVE_WRITE_MULTIPLE_REGISTERS_REQUEST] = [[nil, nil, 'stream_length', 'stream_chunk_offset', 'stream_chunk_data'], {'fixed_length' => nil, 'single_chunk' => false}, nil]
|
443
458
|
@high_level_callbacks[CALLBACK_MODBUS_MASTER_READ_DISCRETE_INPUTS_RESPONSE] = [[nil, nil, 'stream_length', 'stream_chunk_offset', 'stream_chunk_data'], {'fixed_length' => nil, 'single_chunk' => false}, nil]
|
444
459
|
@high_level_callbacks[CALLBACK_MODBUS_MASTER_READ_INPUT_REGISTERS_RESPONSE] = [[nil, nil, 'stream_length', 'stream_chunk_offset', 'stream_chunk_data'], {'fixed_length' => nil, 'single_chunk' => false}, nil]
|
460
|
+
@ipcon.add_device self
|
445
461
|
end
|
446
462
|
|
447
463
|
# Writes characters to the RS485 interface. The characters can be binary data,
|
@@ -452,7 +468,9 @@ module Tinkerforge
|
|
452
468
|
# See BrickletRS485#set_rs485_configuration for configuration possibilities
|
453
469
|
# regarding baudrate, parity and so on.
|
454
470
|
def write_low_level(message_length, message_chunk_offset, message_chunk_data)
|
455
|
-
|
471
|
+
check_validity
|
472
|
+
|
473
|
+
send_request FUNCTION_WRITE_LOW_LEVEL, [message_length, message_chunk_offset, message_chunk_data], 'S S k60', 9, 'C'
|
456
474
|
end
|
457
475
|
|
458
476
|
# Returns up to *length* characters from receive buffer.
|
@@ -462,60 +480,66 @@ module Tinkerforge
|
|
462
480
|
# data only when the read callback is disabled.
|
463
481
|
# See BrickletRS485#enable_read_callback and CALLBACK_READ callback.
|
464
482
|
def read_low_level(length)
|
465
|
-
|
483
|
+
check_validity
|
484
|
+
|
485
|
+
send_request FUNCTION_READ_LOW_LEVEL, [length], 'S', 72, 'S S k60'
|
466
486
|
end
|
467
487
|
|
468
|
-
# Enables the CALLBACK_READ callback.
|
488
|
+
# Enables the CALLBACK_READ callback. This will disable the CALLBACK_FRAME_READABLE callback.
|
469
489
|
#
|
470
490
|
# By default the callback is disabled.
|
471
491
|
def enable_read_callback
|
472
|
-
|
492
|
+
check_validity
|
493
|
+
|
494
|
+
send_request FUNCTION_ENABLE_READ_CALLBACK, [], '', 8, ''
|
473
495
|
end
|
474
496
|
|
475
497
|
# Disables the CALLBACK_READ callback.
|
476
498
|
#
|
477
499
|
# By default the callback is disabled.
|
478
500
|
def disable_read_callback
|
479
|
-
|
501
|
+
check_validity
|
502
|
+
|
503
|
+
send_request FUNCTION_DISABLE_READ_CALLBACK, [], '', 8, ''
|
480
504
|
end
|
481
505
|
|
482
506
|
# Returns *true* if the CALLBACK_READ callback is enabled,
|
483
507
|
# *false* otherwise.
|
484
508
|
def is_read_callback_enabled
|
485
|
-
|
509
|
+
check_validity
|
510
|
+
|
511
|
+
send_request FUNCTION_IS_READ_CALLBACK_ENABLED, [], '', 9, '?'
|
486
512
|
end
|
487
513
|
|
488
|
-
# Sets the configuration for the RS485 communication.
|
489
|
-
#
|
490
|
-
# * Baudrate between 100 and 2000000 baud.
|
491
|
-
# * Parity of none, odd or even.
|
492
|
-
# * Stopbits can be 1 or 2.
|
493
|
-
# * Word length of 5 to 8.
|
494
|
-
# * Half- or Full-Duplex.
|
495
|
-
#
|
496
|
-
# The default is: 115200 baud, parity none, 1 stop bit, word length 8, half duplex.
|
514
|
+
# Sets the configuration for the RS485 communication.
|
497
515
|
def set_rs485_configuration(baudrate, parity, stopbits, wordlength, duplex)
|
498
|
-
|
516
|
+
check_validity
|
517
|
+
|
518
|
+
send_request FUNCTION_SET_RS485_CONFIGURATION, [baudrate, parity, stopbits, wordlength, duplex], 'L C C C C', 8, ''
|
499
519
|
end
|
500
520
|
|
501
521
|
# Returns the configuration as set by BrickletRS485#set_rs485_configuration.
|
502
522
|
def get_rs485_configuration
|
503
|
-
|
523
|
+
check_validity
|
524
|
+
|
525
|
+
send_request FUNCTION_GET_RS485_CONFIGURATION, [], '', 16, 'L C C C C'
|
504
526
|
end
|
505
527
|
|
506
528
|
# Sets the configuration for the RS485 Modbus communication. Available options:
|
507
529
|
#
|
508
530
|
# * Slave Address: Address to be used as the Modbus slave address in Modbus slave mode. Valid Modbus slave address range is 1 to 247.
|
509
|
-
# * Master Request Timeout: Specifies how long the master should wait for a response from a slave
|
510
|
-
#
|
511
|
-
# The default is: Slave Address = 1 and Master Request Timeout = 1000 milliseconds (1 second).
|
531
|
+
# * Master Request Timeout: Specifies how long the master should wait for a response from a slave when in Modbus master mode.
|
512
532
|
def set_modbus_configuration(slave_address, master_request_timeout)
|
513
|
-
|
533
|
+
check_validity
|
534
|
+
|
535
|
+
send_request FUNCTION_SET_MODBUS_CONFIGURATION, [slave_address, master_request_timeout], 'C L', 8, ''
|
514
536
|
end
|
515
537
|
|
516
538
|
# Returns the configuration as set by BrickletRS485#set_modbus_configuration.
|
517
539
|
def get_modbus_configuration
|
518
|
-
|
540
|
+
check_validity
|
541
|
+
|
542
|
+
send_request FUNCTION_GET_MODBUS_CONFIGURATION, [], '', 13, 'C L'
|
519
543
|
end
|
520
544
|
|
521
545
|
# Sets the mode of the Bricklet in which it operates. Available options are
|
@@ -523,15 +547,17 @@ module Tinkerforge
|
|
523
547
|
# * RS485,
|
524
548
|
# * Modbus Master RTU and
|
525
549
|
# * Modbus Slave RTU.
|
526
|
-
#
|
527
|
-
# The default is: RS485 mode.
|
528
550
|
def set_mode(mode)
|
529
|
-
|
551
|
+
check_validity
|
552
|
+
|
553
|
+
send_request FUNCTION_SET_MODE, [mode], 'C', 8, ''
|
530
554
|
end
|
531
555
|
|
532
556
|
# Returns the configuration as set by BrickletRS485#set_mode.
|
533
557
|
def get_mode
|
534
|
-
|
558
|
+
check_validity
|
559
|
+
|
560
|
+
send_request FUNCTION_GET_MODE, [], '', 9, 'C'
|
535
561
|
end
|
536
562
|
|
537
563
|
# Sets the communication LED configuration. By default the LED shows RS485
|
@@ -541,12 +567,16 @@ module Tinkerforge
|
|
541
567
|
#
|
542
568
|
# If the Bricklet is in bootloader mode, the LED is off.
|
543
569
|
def set_communication_led_config(config)
|
544
|
-
|
570
|
+
check_validity
|
571
|
+
|
572
|
+
send_request FUNCTION_SET_COMMUNICATION_LED_CONFIG, [config], 'C', 8, ''
|
545
573
|
end
|
546
574
|
|
547
575
|
# Returns the configuration as set by BrickletRS485#set_communication_led_config
|
548
576
|
def get_communication_led_config
|
549
|
-
|
577
|
+
check_validity
|
578
|
+
|
579
|
+
send_request FUNCTION_GET_COMMUNICATION_LED_CONFIG, [], '', 9, 'C'
|
550
580
|
end
|
551
581
|
|
552
582
|
# Sets the error LED configuration.
|
@@ -559,17 +589,21 @@ module Tinkerforge
|
|
559
589
|
#
|
560
590
|
# If the Bricklet is in bootloader mode, the LED is off.
|
561
591
|
def set_error_led_config(config)
|
562
|
-
|
592
|
+
check_validity
|
593
|
+
|
594
|
+
send_request FUNCTION_SET_ERROR_LED_CONFIG, [config], 'C', 8, ''
|
563
595
|
end
|
564
596
|
|
565
597
|
# Returns the configuration as set by BrickletRS485#set_error_led_config.
|
566
598
|
def get_error_led_config
|
567
|
-
|
599
|
+
check_validity
|
600
|
+
|
601
|
+
send_request FUNCTION_GET_ERROR_LED_CONFIG, [], '', 9, 'C'
|
568
602
|
end
|
569
603
|
|
570
604
|
# Sets the send and receive buffer size in byte. In sum there is
|
571
|
-
# 10240 byte (
|
572
|
-
# is 1024 byte (
|
605
|
+
# 10240 byte (10KiB) buffer available and the minimum buffer size
|
606
|
+
# is 1024 byte (1KiB) for both.
|
573
607
|
#
|
574
608
|
# The current buffer content is lost if this function is called.
|
575
609
|
#
|
@@ -577,47 +611,59 @@ module Tinkerforge
|
|
577
611
|
# could not be written yet. The receive buffer holds data that is
|
578
612
|
# received through RS485 but could not yet be send to the
|
579
613
|
# user, either by BrickletRS485#read or through CALLBACK_READ callback.
|
580
|
-
#
|
581
|
-
# The default configuration is 5120 byte (5kb) per buffer.
|
582
614
|
def set_buffer_config(send_buffer_size, receive_buffer_size)
|
583
|
-
|
615
|
+
check_validity
|
616
|
+
|
617
|
+
send_request FUNCTION_SET_BUFFER_CONFIG, [send_buffer_size, receive_buffer_size], 'S S', 8, ''
|
584
618
|
end
|
585
619
|
|
586
620
|
# Returns the buffer configuration as set by BrickletRS485#set_buffer_config.
|
587
621
|
def get_buffer_config
|
588
|
-
|
622
|
+
check_validity
|
623
|
+
|
624
|
+
send_request FUNCTION_GET_BUFFER_CONFIG, [], '', 12, 'S S'
|
589
625
|
end
|
590
626
|
|
591
627
|
# Returns the currently used bytes for the send and received buffer.
|
592
628
|
#
|
593
629
|
# See BrickletRS485#set_buffer_config for buffer size configuration.
|
594
630
|
def get_buffer_status
|
595
|
-
|
631
|
+
check_validity
|
632
|
+
|
633
|
+
send_request FUNCTION_GET_BUFFER_STATUS, [], '', 12, 'S S'
|
596
634
|
end
|
597
635
|
|
598
636
|
# Enables the CALLBACK_ERROR_COUNT callback.
|
599
637
|
#
|
600
638
|
# By default the callback is disabled.
|
601
639
|
def enable_error_count_callback
|
602
|
-
|
640
|
+
check_validity
|
641
|
+
|
642
|
+
send_request FUNCTION_ENABLE_ERROR_COUNT_CALLBACK, [], '', 8, ''
|
603
643
|
end
|
604
644
|
|
605
645
|
# Disables the CALLBACK_ERROR_COUNT callback.
|
606
646
|
#
|
607
647
|
# By default the callback is disabled.
|
608
648
|
def disable_error_count_callback
|
609
|
-
|
649
|
+
check_validity
|
650
|
+
|
651
|
+
send_request FUNCTION_DISABLE_ERROR_COUNT_CALLBACK, [], '', 8, ''
|
610
652
|
end
|
611
653
|
|
612
654
|
# Returns *true* if the CALLBACK_ERROR_COUNT callback is enabled,
|
613
655
|
# *false* otherwise.
|
614
656
|
def is_error_count_callback_enabled
|
615
|
-
|
657
|
+
check_validity
|
658
|
+
|
659
|
+
send_request FUNCTION_IS_ERROR_COUNT_CALLBACK_ENABLED, [], '', 9, '?'
|
616
660
|
end
|
617
661
|
|
618
662
|
# Returns the current number of overrun and parity errors.
|
619
663
|
def get_error_count
|
620
|
-
|
664
|
+
check_validity
|
665
|
+
|
666
|
+
send_request FUNCTION_GET_ERROR_COUNT, [], '', 16, 'L L'
|
621
667
|
end
|
622
668
|
|
623
669
|
# Returns the current number of errors occurred in Modbus mode.
|
@@ -630,7 +676,9 @@ module Tinkerforge
|
|
630
676
|
# * Illegal Data Value Error Count: Number of errors due to invalid data value. This corresponds to Modbus exception code 3.
|
631
677
|
# * Slave Device Failure Error Count: Number of errors occurred on the slave device which were unrecoverable. This corresponds to Modbus exception code 4.
|
632
678
|
def get_modbus_common_error_count
|
633
|
-
|
679
|
+
check_validity
|
680
|
+
|
681
|
+
send_request FUNCTION_GET_MODBUS_COMMON_ERROR_COUNT, [], '', 36, 'L L L L L L L'
|
634
682
|
end
|
635
683
|
|
636
684
|
# In Modbus slave mode this function can be used to report a Modbus exception for
|
@@ -639,7 +687,9 @@ module Tinkerforge
|
|
639
687
|
# * Request ID: Request ID of the request received by the slave.
|
640
688
|
# * Exception Code: Modbus exception code to report to the Modbus master.
|
641
689
|
def modbus_slave_report_exception(request_id, exception_code)
|
642
|
-
|
690
|
+
check_validity
|
691
|
+
|
692
|
+
send_request FUNCTION_MODBUS_SLAVE_REPORT_EXCEPTION, [request_id, exception_code], 'C c', 8, ''
|
643
693
|
end
|
644
694
|
|
645
695
|
# In Modbus slave mode this function can be used to answer a master request to
|
@@ -651,7 +701,9 @@ module Tinkerforge
|
|
651
701
|
# This function must be called from the CALLBACK_MODBUS_SLAVE_READ_COILS_REQUEST callback
|
652
702
|
# with the Request ID as provided by the argument of the callback.
|
653
703
|
def modbus_slave_answer_read_coils_request_low_level(request_id, coils_length, coils_chunk_offset, coils_chunk_data)
|
654
|
-
|
704
|
+
check_validity
|
705
|
+
|
706
|
+
send_request FUNCTION_MODBUS_SLAVE_ANSWER_READ_COILS_REQUEST_LOW_LEVEL, [request_id, coils_length, coils_chunk_offset, coils_chunk_data], 'C S S ?472', 8, ''
|
655
707
|
end
|
656
708
|
|
657
709
|
# In Modbus master mode this function can be used to read coils from a slave. This
|
@@ -670,7 +722,9 @@ module Tinkerforge
|
|
670
722
|
# matched with the Request ID returned from this function to verify that the callback
|
671
723
|
# is indeed for a particular request.
|
672
724
|
def modbus_master_read_coils(slave_address, starting_address, count)
|
673
|
-
|
725
|
+
check_validity
|
726
|
+
|
727
|
+
send_request FUNCTION_MODBUS_MASTER_READ_COILS, [slave_address, starting_address, count], 'C L S', 9, 'C'
|
674
728
|
end
|
675
729
|
|
676
730
|
# In Modbus slave mode this function can be used to answer a master request to
|
@@ -682,7 +736,9 @@ module Tinkerforge
|
|
682
736
|
# This function must be called from the CALLBACK_MODBUS_SLAVE_READ_HOLDING_REGISTERS_REQUEST
|
683
737
|
# callback with the Request ID as provided by the argument of the callback.
|
684
738
|
def modbus_slave_answer_read_holding_registers_request_low_level(request_id, holding_registers_length, holding_registers_chunk_offset, holding_registers_chunk_data)
|
685
|
-
|
739
|
+
check_validity
|
740
|
+
|
741
|
+
send_request FUNCTION_MODBUS_SLAVE_ANSWER_READ_HOLDING_REGISTERS_REQUEST_LOW_LEVEL, [request_id, holding_registers_length, holding_registers_chunk_offset, holding_registers_chunk_data], 'C S S S29', 8, ''
|
686
742
|
end
|
687
743
|
|
688
744
|
# In Modbus master mode this function can be used to read holding registers from a slave.
|
@@ -701,7 +757,9 @@ module Tinkerforge
|
|
701
757
|
# with the Request ID returned from this function to verify that the callback is indeed for a
|
702
758
|
# particular request.
|
703
759
|
def modbus_master_read_holding_registers(slave_address, starting_address, count)
|
704
|
-
|
760
|
+
check_validity
|
761
|
+
|
762
|
+
send_request FUNCTION_MODBUS_MASTER_READ_HOLDING_REGISTERS, [slave_address, starting_address, count], 'C L S', 9, 'C'
|
705
763
|
end
|
706
764
|
|
707
765
|
# In Modbus slave mode this function can be used to answer a master request to
|
@@ -712,7 +770,9 @@ module Tinkerforge
|
|
712
770
|
# This function must be called from the CALLBACK_MODBUS_SLAVE_WRITE_SINGLE_COIL_REQUEST
|
713
771
|
# callback with the Request ID as provided by the arguments of the callback.
|
714
772
|
def modbus_slave_answer_write_single_coil_request(request_id)
|
715
|
-
|
773
|
+
check_validity
|
774
|
+
|
775
|
+
send_request FUNCTION_MODBUS_SLAVE_ANSWER_WRITE_SINGLE_COIL_REQUEST, [request_id], 'C', 8, ''
|
716
776
|
end
|
717
777
|
|
718
778
|
# In Modbus master mode this function can be used to write a single coil of a slave.
|
@@ -731,7 +791,9 @@ module Tinkerforge
|
|
731
791
|
# with the Request ID returned from this function to verify that the callback is indeed for a
|
732
792
|
# particular request.
|
733
793
|
def modbus_master_write_single_coil(slave_address, coil_address, coil_value)
|
734
|
-
|
794
|
+
check_validity
|
795
|
+
|
796
|
+
send_request FUNCTION_MODBUS_MASTER_WRITE_SINGLE_COIL, [slave_address, coil_address, coil_value], 'C L ?', 9, 'C'
|
735
797
|
end
|
736
798
|
|
737
799
|
# In Modbus slave mode this function can be used to answer a master request to
|
@@ -743,7 +805,9 @@ module Tinkerforge
|
|
743
805
|
# callback with the Request ID, Register Address and Register Value as provided by
|
744
806
|
# the arguments of the callback.
|
745
807
|
def modbus_slave_answer_write_single_register_request(request_id)
|
746
|
-
|
808
|
+
check_validity
|
809
|
+
|
810
|
+
send_request FUNCTION_MODBUS_SLAVE_ANSWER_WRITE_SINGLE_REGISTER_REQUEST, [request_id], 'C', 8, ''
|
747
811
|
end
|
748
812
|
|
749
813
|
# In Modbus master mode this function can be used to write a single holding register of a
|
@@ -762,7 +826,9 @@ module Tinkerforge
|
|
762
826
|
# with the Request ID returned from this function to verify that the callback is indeed for a
|
763
827
|
# particular request.
|
764
828
|
def modbus_master_write_single_register(slave_address, register_address, register_value)
|
765
|
-
|
829
|
+
check_validity
|
830
|
+
|
831
|
+
send_request FUNCTION_MODBUS_MASTER_WRITE_SINGLE_REGISTER, [slave_address, register_address, register_value], 'C L S', 9, 'C'
|
766
832
|
end
|
767
833
|
|
768
834
|
# In Modbus slave mode this function can be used to answer a master request to
|
@@ -773,7 +839,9 @@ module Tinkerforge
|
|
773
839
|
# This function must be called from the CALLBACK_MODBUS_SLAVE_WRITE_MULTIPLE_COILS_REQUEST
|
774
840
|
# callback with the Request ID of the callback.
|
775
841
|
def modbus_slave_answer_write_multiple_coils_request(request_id)
|
776
|
-
|
842
|
+
check_validity
|
843
|
+
|
844
|
+
send_request FUNCTION_MODBUS_SLAVE_ANSWER_WRITE_MULTIPLE_COILS_REQUEST, [request_id], 'C', 8, ''
|
777
845
|
end
|
778
846
|
|
779
847
|
# In Modbus master mode this function can be used to write multiple coils of a slave.
|
@@ -791,7 +859,9 @@ module Tinkerforge
|
|
791
859
|
# with the Request ID returned from this function to verify that the callback is indeed for a
|
792
860
|
# particular request.
|
793
861
|
def modbus_master_write_multiple_coils_low_level(slave_address, starting_address, coils_length, coils_chunk_offset, coils_chunk_data)
|
794
|
-
|
862
|
+
check_validity
|
863
|
+
|
864
|
+
send_request FUNCTION_MODBUS_MASTER_WRITE_MULTIPLE_COILS_LOW_LEVEL, [slave_address, starting_address, coils_length, coils_chunk_offset, coils_chunk_data], 'C L S S ?440', 9, 'C'
|
795
865
|
end
|
796
866
|
|
797
867
|
# In Modbus slave mode this function can be used to answer a master request to
|
@@ -802,7 +872,9 @@ module Tinkerforge
|
|
802
872
|
# This function must be called from the CALLBACK_MODBUS_SLAVE_WRITE_MULTIPLE_REGISTERS_REQUEST
|
803
873
|
# callback with the Request ID of the callback.
|
804
874
|
def modbus_slave_answer_write_multiple_registers_request(request_id)
|
805
|
-
|
875
|
+
check_validity
|
876
|
+
|
877
|
+
send_request FUNCTION_MODBUS_SLAVE_ANSWER_WRITE_MULTIPLE_REGISTERS_REQUEST, [request_id], 'C', 8, ''
|
806
878
|
end
|
807
879
|
|
808
880
|
# In Modbus master mode this function can be used to write multiple registers of a slave.
|
@@ -820,7 +892,9 @@ module Tinkerforge
|
|
820
892
|
# with the Request ID returned from this function to verify that the callback is indeed for a
|
821
893
|
# particular request.
|
822
894
|
def modbus_master_write_multiple_registers_low_level(slave_address, starting_address, registers_length, registers_chunk_offset, registers_chunk_data)
|
823
|
-
|
895
|
+
check_validity
|
896
|
+
|
897
|
+
send_request FUNCTION_MODBUS_MASTER_WRITE_MULTIPLE_REGISTERS_LOW_LEVEL, [slave_address, starting_address, registers_length, registers_chunk_offset, registers_chunk_data], 'C L S S S27', 9, 'C'
|
824
898
|
end
|
825
899
|
|
826
900
|
# In Modbus slave mode this function can be used to answer a master request to
|
@@ -832,7 +906,9 @@ module Tinkerforge
|
|
832
906
|
# This function must be called from the CALLBACK_MODBUS_SLAVE_READ_DISCRETE_INPUTS_REQUEST
|
833
907
|
# callback with the Request ID as provided by the argument of the callback.
|
834
908
|
def modbus_slave_answer_read_discrete_inputs_request_low_level(request_id, discrete_inputs_length, discrete_inputs_chunk_offset, discrete_inputs_chunk_data)
|
835
|
-
|
909
|
+
check_validity
|
910
|
+
|
911
|
+
send_request FUNCTION_MODBUS_SLAVE_ANSWER_READ_DISCRETE_INPUTS_REQUEST_LOW_LEVEL, [request_id, discrete_inputs_length, discrete_inputs_chunk_offset, discrete_inputs_chunk_data], 'C S S ?472', 8, ''
|
836
912
|
end
|
837
913
|
|
838
914
|
# In Modbus master mode this function can be used to read discrete inputs from a slave.
|
@@ -851,7 +927,9 @@ module Tinkerforge
|
|
851
927
|
# with the Request ID returned from this function to verify that the callback is indeed for a
|
852
928
|
# particular request.
|
853
929
|
def modbus_master_read_discrete_inputs(slave_address, starting_address, count)
|
854
|
-
|
930
|
+
check_validity
|
931
|
+
|
932
|
+
send_request FUNCTION_MODBUS_MASTER_READ_DISCRETE_INPUTS, [slave_address, starting_address, count], 'C L S', 9, 'C'
|
855
933
|
end
|
856
934
|
|
857
935
|
# In Modbus slave mode this function can be used to answer a master request to
|
@@ -863,7 +941,9 @@ module Tinkerforge
|
|
863
941
|
# This function must be called from the CALLBACK_MODBUS_SLAVE_READ_INPUT_REGISTERS_REQUEST callback
|
864
942
|
# with the Request ID as provided by the argument of the callback.
|
865
943
|
def modbus_slave_answer_read_input_registers_request_low_level(request_id, input_registers_length, input_registers_chunk_offset, input_registers_chunk_data)
|
866
|
-
|
944
|
+
check_validity
|
945
|
+
|
946
|
+
send_request FUNCTION_MODBUS_SLAVE_ANSWER_READ_INPUT_REGISTERS_REQUEST_LOW_LEVEL, [request_id, input_registers_length, input_registers_chunk_offset, input_registers_chunk_data], 'C S S S29', 8, ''
|
867
947
|
end
|
868
948
|
|
869
949
|
# In Modbus master mode this function can be used to read input registers from a slave.
|
@@ -882,7 +962,30 @@ module Tinkerforge
|
|
882
962
|
# with the Request ID returned from this function to verify that the callback is indeed for a
|
883
963
|
# particular request.
|
884
964
|
def modbus_master_read_input_registers(slave_address, starting_address, count)
|
885
|
-
|
965
|
+
check_validity
|
966
|
+
|
967
|
+
send_request FUNCTION_MODBUS_MASTER_READ_INPUT_REGISTERS, [slave_address, starting_address, count], 'C L S', 9, 'C'
|
968
|
+
end
|
969
|
+
|
970
|
+
# Configures the CALLBACK_FRAME_READABLE callback. The frame size is the number of bytes, that have to be readable to trigger the callback.
|
971
|
+
# A frame size of 0 disables the callback. A frame size greater than 0 enables the callback and disables the CALLBACK_READ callback.
|
972
|
+
#
|
973
|
+
# By default the callback is disabled.
|
974
|
+
#
|
975
|
+
# .. versionadded:: 2.0.5$nbsp;(Plugin)
|
976
|
+
def set_frame_readable_callback_configuration(frame_size)
|
977
|
+
check_validity
|
978
|
+
|
979
|
+
send_request FUNCTION_SET_FRAME_READABLE_CALLBACK_CONFIGURATION, [frame_size], 'S', 8, ''
|
980
|
+
end
|
981
|
+
|
982
|
+
# Returns the callback configuration as set by BrickletRS485#set_frame_readable_callback_configuration.
|
983
|
+
#
|
984
|
+
# .. versionadded:: 2.0.5$nbsp;(Plugin)
|
985
|
+
def get_frame_readable_callback_configuration
|
986
|
+
check_validity
|
987
|
+
|
988
|
+
send_request FUNCTION_GET_FRAME_READABLE_CALLBACK_CONFIGURATION, [], '', 10, 'S'
|
886
989
|
end
|
887
990
|
|
888
991
|
# Returns the error count for the communication between Brick and Bricklet.
|
@@ -897,7 +1000,9 @@ module Tinkerforge
|
|
897
1000
|
# The errors counts are for errors that occur on the Bricklet side. All
|
898
1001
|
# Bricks have a similar function that returns the errors on the Brick side.
|
899
1002
|
def get_spitfp_error_count
|
900
|
-
|
1003
|
+
check_validity
|
1004
|
+
|
1005
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
901
1006
|
end
|
902
1007
|
|
903
1008
|
# Sets the bootloader mode and returns the status after the requested
|
@@ -910,12 +1015,16 @@ module Tinkerforge
|
|
910
1015
|
# This function is used by Brick Viewer during flashing. It should not be
|
911
1016
|
# necessary to call it in a normal user program.
|
912
1017
|
def set_bootloader_mode(mode)
|
913
|
-
|
1018
|
+
check_validity
|
1019
|
+
|
1020
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
914
1021
|
end
|
915
1022
|
|
916
1023
|
# Returns the current bootloader mode, see BrickletRS485#set_bootloader_mode.
|
917
1024
|
def get_bootloader_mode
|
918
|
-
|
1025
|
+
check_validity
|
1026
|
+
|
1027
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
919
1028
|
end
|
920
1029
|
|
921
1030
|
# Sets the firmware pointer for BrickletRS485#write_firmware. The pointer has
|
@@ -925,7 +1034,9 @@ module Tinkerforge
|
|
925
1034
|
# This function is used by Brick Viewer during flashing. It should not be
|
926
1035
|
# necessary to call it in a normal user program.
|
927
1036
|
def set_write_firmware_pointer(pointer)
|
928
|
-
|
1037
|
+
check_validity
|
1038
|
+
|
1039
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
929
1040
|
end
|
930
1041
|
|
931
1042
|
# Writes 64 Bytes of firmware at the position as written by
|
@@ -937,7 +1048,9 @@ module Tinkerforge
|
|
937
1048
|
# This function is used by Brick Viewer during flashing. It should not be
|
938
1049
|
# necessary to call it in a normal user program.
|
939
1050
|
def write_firmware(data)
|
940
|
-
|
1051
|
+
check_validity
|
1052
|
+
|
1053
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
941
1054
|
end
|
942
1055
|
|
943
1056
|
# Sets the status LED configuration. By default the LED shows
|
@@ -948,22 +1061,28 @@ module Tinkerforge
|
|
948
1061
|
#
|
949
1062
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
950
1063
|
def set_status_led_config(config)
|
951
|
-
|
1064
|
+
check_validity
|
1065
|
+
|
1066
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
952
1067
|
end
|
953
1068
|
|
954
1069
|
# Returns the configuration as set by BrickletRS485#set_status_led_config
|
955
1070
|
def get_status_led_config
|
956
|
-
|
1071
|
+
check_validity
|
1072
|
+
|
1073
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
957
1074
|
end
|
958
1075
|
|
959
|
-
# Returns the temperature
|
1076
|
+
# Returns the temperature as measured inside the microcontroller. The
|
960
1077
|
# value returned is not the ambient temperature!
|
961
1078
|
#
|
962
1079
|
# The temperature is only proportional to the real temperature and it has bad
|
963
1080
|
# accuracy. Practically it is only useful as an indicator for
|
964
1081
|
# temperature changes.
|
965
1082
|
def get_chip_temperature
|
966
|
-
|
1083
|
+
check_validity
|
1084
|
+
|
1085
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
967
1086
|
end
|
968
1087
|
|
969
1088
|
# Calling this function will reset the Bricklet. All configurations
|
@@ -973,7 +1092,9 @@ module Tinkerforge
|
|
973
1092
|
# calling functions on the existing ones will result in
|
974
1093
|
# undefined behavior!
|
975
1094
|
def reset
|
976
|
-
|
1095
|
+
check_validity
|
1096
|
+
|
1097
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
977
1098
|
end
|
978
1099
|
|
979
1100
|
# Writes a new UID into flash. If you want to set a new UID
|
@@ -982,25 +1103,32 @@ module Tinkerforge
|
|
982
1103
|
#
|
983
1104
|
# We recommend that you use Brick Viewer to change the UID.
|
984
1105
|
def write_uid(uid)
|
985
|
-
|
1106
|
+
check_validity
|
1107
|
+
|
1108
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
986
1109
|
end
|
987
1110
|
|
988
1111
|
# Returns the current UID as an integer. Encode as
|
989
1112
|
# Base58 to get the usual string version.
|
990
1113
|
def read_uid
|
991
|
-
|
1114
|
+
check_validity
|
1115
|
+
|
1116
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
992
1117
|
end
|
993
1118
|
|
994
1119
|
# Returns the UID, the UID where the Bricklet is connected to,
|
995
1120
|
# the position, the hardware and firmware version as well as the
|
996
1121
|
# device identifier.
|
997
1122
|
#
|
998
|
-
# The position can be 'a', 'b', 'c' or '
|
1123
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
1124
|
+
# The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
|
1125
|
+
# connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
|
1126
|
+
# position 'z'.
|
999
1127
|
#
|
1000
1128
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
1001
1129
|
# |device_identifier_constant|
|
1002
1130
|
def get_identity
|
1003
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
1131
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
1004
1132
|
end
|
1005
1133
|
|
1006
1134
|
# Writes characters to the RS485 interface. The characters can be binary data,
|