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
|
# Basis to build stacks and has 4 Bricklet ports
|
|
14
16
|
class BrickMaster < Device
|
|
@@ -37,7 +39,7 @@ module Tinkerforge
|
|
|
37
39
|
|
|
38
40
|
# This callback is triggered periodically with the period that is set by
|
|
39
41
|
# BrickMaster#set_usb_voltage_callback_period. The parameter is the USB
|
|
40
|
-
# voltage
|
|
42
|
+
# voltage.
|
|
41
43
|
#
|
|
42
44
|
# The CALLBACK_USB_VOLTAGE callback is only triggered if the USB voltage has changed
|
|
43
45
|
# since the last triggering.
|
|
@@ -49,7 +51,7 @@ module Tinkerforge
|
|
|
49
51
|
|
|
50
52
|
# This callback is triggered when the threshold as set by
|
|
51
53
|
# BrickMaster#set_stack_current_callback_threshold is reached.
|
|
52
|
-
# The parameter is the stack current
|
|
54
|
+
# The parameter is the stack current.
|
|
53
55
|
#
|
|
54
56
|
# If the threshold keeps being reached, the callback is triggered periodically
|
|
55
57
|
# with the period as set by BrickMaster#set_debounce_period.
|
|
@@ -59,7 +61,7 @@ module Tinkerforge
|
|
|
59
61
|
|
|
60
62
|
# This callback is triggered when the threshold as set by
|
|
61
63
|
# BrickMaster#set_stack_voltage_callback_threshold is reached.
|
|
62
|
-
# The parameter is the stack voltage
|
|
64
|
+
# The parameter is the stack voltage.
|
|
63
65
|
#
|
|
64
66
|
# If the threshold keeps being reached, the callback is triggered periodically
|
|
65
67
|
# with the period as set by BrickMaster#set_debounce_period.
|
|
@@ -181,6 +183,10 @@ module Tinkerforge
|
|
|
181
183
|
FUNCTION_GET_WIFI2_MESH_COMMON_STATUS = 108 # :nodoc:
|
|
182
184
|
FUNCTION_GET_WIFI2_MESH_CLIENT_STATUS = 109 # :nodoc:
|
|
183
185
|
FUNCTION_GET_WIFI2_MESH_AP_STATUS = 110 # :nodoc:
|
|
186
|
+
FUNCTION_SET_BRICKLET_XMC_FLASH_CONFIG = 111 # :nodoc:
|
|
187
|
+
FUNCTION_SET_BRICKLET_XMC_FLASH_DATA = 112 # :nodoc:
|
|
188
|
+
FUNCTION_SET_BRICKLETS_ENABLED = 113 # :nodoc:
|
|
189
|
+
FUNCTION_GET_BRICKLETS_ENABLED = 114 # :nodoc:
|
|
184
190
|
FUNCTION_SET_SPITFP_BAUDRATE_CONFIG = 231 # :nodoc:
|
|
185
191
|
FUNCTION_GET_SPITFP_BAUDRATE_CONFIG = 232 # :nodoc:
|
|
186
192
|
FUNCTION_GET_SEND_TIMEOUT_COUNT = 233 # :nodoc:
|
|
@@ -193,6 +199,8 @@ module Tinkerforge
|
|
|
193
199
|
FUNCTION_GET_PROTOCOL1_BRICKLET_NAME = 241 # :nodoc:
|
|
194
200
|
FUNCTION_GET_CHIP_TEMPERATURE = 242 # :nodoc:
|
|
195
201
|
FUNCTION_RESET = 243 # :nodoc:
|
|
202
|
+
FUNCTION_WRITE_BRICKLET_PLUGIN = 246 # :nodoc:
|
|
203
|
+
FUNCTION_READ_BRICKLET_PLUGIN = 247 # :nodoc:
|
|
196
204
|
FUNCTION_GET_IDENTITY = 255 # :nodoc:
|
|
197
205
|
|
|
198
206
|
EXTENSION_TYPE_CHIBI = 1 # :nodoc:
|
|
@@ -286,9 +294,9 @@ module Tinkerforge
|
|
|
286
294
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
287
295
|
# the IP Connection <tt>ipcon</tt>.
|
|
288
296
|
def initialize(uid, ipcon)
|
|
289
|
-
super uid, ipcon
|
|
297
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
290
298
|
|
|
291
|
-
@api_version = [2, 0,
|
|
299
|
+
@api_version = [2, 0, 10]
|
|
292
300
|
|
|
293
301
|
@response_expected[FUNCTION_GET_STACK_VOLTAGE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
294
302
|
@response_expected[FUNCTION_GET_STACK_CURRENT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
@@ -394,6 +402,10 @@ module Tinkerforge
|
|
|
394
402
|
@response_expected[FUNCTION_GET_WIFI2_MESH_COMMON_STATUS] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
395
403
|
@response_expected[FUNCTION_GET_WIFI2_MESH_CLIENT_STATUS] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
396
404
|
@response_expected[FUNCTION_GET_WIFI2_MESH_AP_STATUS] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
405
|
+
@response_expected[FUNCTION_SET_BRICKLET_XMC_FLASH_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
406
|
+
@response_expected[FUNCTION_SET_BRICKLET_XMC_FLASH_DATA] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
407
|
+
@response_expected[FUNCTION_SET_BRICKLETS_ENABLED] = RESPONSE_EXPECTED_FALSE
|
|
408
|
+
@response_expected[FUNCTION_GET_BRICKLETS_ENABLED] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
397
409
|
@response_expected[FUNCTION_SET_SPITFP_BAUDRATE_CONFIG] = RESPONSE_EXPECTED_FALSE
|
|
398
410
|
@response_expected[FUNCTION_GET_SPITFP_BAUDRATE_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
399
411
|
@response_expected[FUNCTION_GET_SEND_TIMEOUT_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
@@ -406,33 +418,46 @@ module Tinkerforge
|
|
|
406
418
|
@response_expected[FUNCTION_GET_PROTOCOL1_BRICKLET_NAME] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
407
419
|
@response_expected[FUNCTION_GET_CHIP_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
408
420
|
@response_expected[FUNCTION_RESET] = RESPONSE_EXPECTED_FALSE
|
|
421
|
+
@response_expected[FUNCTION_WRITE_BRICKLET_PLUGIN] = RESPONSE_EXPECTED_FALSE
|
|
422
|
+
@response_expected[FUNCTION_READ_BRICKLET_PLUGIN] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
409
423
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
410
424
|
|
|
411
|
-
@callback_formats[CALLBACK_STACK_CURRENT] = 'S'
|
|
412
|
-
@callback_formats[CALLBACK_STACK_VOLTAGE] = 'S'
|
|
413
|
-
@callback_formats[CALLBACK_USB_VOLTAGE] = 'S'
|
|
414
|
-
@callback_formats[CALLBACK_STACK_CURRENT_REACHED] = 'S'
|
|
415
|
-
@callback_formats[CALLBACK_STACK_VOLTAGE_REACHED] = 'S'
|
|
416
|
-
@callback_formats[CALLBACK_USB_VOLTAGE_REACHED] = 'S'
|
|
425
|
+
@callback_formats[CALLBACK_STACK_CURRENT] = [10, 'S']
|
|
426
|
+
@callback_formats[CALLBACK_STACK_VOLTAGE] = [10, 'S']
|
|
427
|
+
@callback_formats[CALLBACK_USB_VOLTAGE] = [10, 'S']
|
|
428
|
+
@callback_formats[CALLBACK_STACK_CURRENT_REACHED] = [10, 'S']
|
|
429
|
+
@callback_formats[CALLBACK_STACK_VOLTAGE_REACHED] = [10, 'S']
|
|
430
|
+
@callback_formats[CALLBACK_USB_VOLTAGE_REACHED] = [10, 'S']
|
|
417
431
|
|
|
432
|
+
@ipcon.add_device self
|
|
418
433
|
end
|
|
419
434
|
|
|
420
|
-
# Returns the stack voltage
|
|
435
|
+
# Returns the stack voltage. The stack voltage is the
|
|
421
436
|
# voltage that is supplied via the stack, i.e. it is given by a
|
|
422
437
|
# Step-Down or Step-Up Power Supply.
|
|
438
|
+
#
|
|
439
|
+
# .. note::
|
|
440
|
+
# It is not possible to measure voltages supplied per PoE or USB with this function.
|
|
423
441
|
def get_stack_voltage
|
|
424
|
-
|
|
442
|
+
check_validity
|
|
443
|
+
|
|
444
|
+
send_request FUNCTION_GET_STACK_VOLTAGE, [], '', 10, 'S'
|
|
425
445
|
end
|
|
426
446
|
|
|
427
|
-
# Returns the stack current
|
|
447
|
+
# Returns the stack current. The stack current is the
|
|
428
448
|
# current that is drawn via the stack, i.e. it is given by a
|
|
429
449
|
# Step-Down or Step-Up Power Supply.
|
|
450
|
+
#
|
|
451
|
+
# .. note::
|
|
452
|
+
# It is not possible to measure the current drawn via PoE or USB with this function.
|
|
430
453
|
def get_stack_current
|
|
431
|
-
|
|
454
|
+
check_validity
|
|
455
|
+
|
|
456
|
+
send_request FUNCTION_GET_STACK_CURRENT, [], '', 10, 'S'
|
|
432
457
|
end
|
|
433
458
|
|
|
434
459
|
# Writes the extension type to the EEPROM of a specified extension.
|
|
435
|
-
# The extension is either 0 or 1 (0 is the
|
|
460
|
+
# The extension is either 0 or 1 (0 is the lower one, 1 is the upper one,
|
|
436
461
|
# if only one extension is present use 0).
|
|
437
462
|
#
|
|
438
463
|
# Possible extension types:
|
|
@@ -448,50 +473,64 @@ module Tinkerforge
|
|
|
448
473
|
# The extension type is already set when bought and it can be set with the
|
|
449
474
|
# Brick Viewer, it is unlikely that you need this function.
|
|
450
475
|
def set_extension_type(extension, exttype)
|
|
451
|
-
|
|
476
|
+
check_validity
|
|
477
|
+
|
|
478
|
+
send_request FUNCTION_SET_EXTENSION_TYPE, [extension, exttype], 'C L', 8, ''
|
|
452
479
|
end
|
|
453
480
|
|
|
454
481
|
# Returns the type for a given extension as set by BrickMaster#set_extension_type.
|
|
455
482
|
def get_extension_type(extension)
|
|
456
|
-
|
|
483
|
+
check_validity
|
|
484
|
+
|
|
485
|
+
send_request FUNCTION_GET_EXTENSION_TYPE, [extension], 'C', 12, 'L'
|
|
457
486
|
end
|
|
458
487
|
|
|
459
488
|
# Returns *true* if the Master Brick is at position 0 in the stack and a Chibi
|
|
460
489
|
# Extension is available.
|
|
461
490
|
def is_chibi_present
|
|
462
|
-
|
|
491
|
+
check_validity
|
|
492
|
+
|
|
493
|
+
send_request FUNCTION_IS_CHIBI_PRESENT, [], '', 9, '?'
|
|
463
494
|
end
|
|
464
495
|
|
|
465
|
-
# Sets the address
|
|
496
|
+
# Sets the address belonging to the Chibi Extension.
|
|
466
497
|
#
|
|
467
498
|
# It is possible to set the address with the Brick Viewer and it will be
|
|
468
499
|
# saved in the EEPROM of the Chibi Extension, it does not
|
|
469
500
|
# have to be set on every startup.
|
|
470
501
|
def set_chibi_address(address)
|
|
471
|
-
|
|
502
|
+
check_validity
|
|
503
|
+
|
|
504
|
+
send_request FUNCTION_SET_CHIBI_ADDRESS, [address], 'C', 8, ''
|
|
472
505
|
end
|
|
473
506
|
|
|
474
507
|
# Returns the address as set by BrickMaster#set_chibi_address.
|
|
475
508
|
def get_chibi_address
|
|
476
|
-
|
|
509
|
+
check_validity
|
|
510
|
+
|
|
511
|
+
send_request FUNCTION_GET_CHIBI_ADDRESS, [], '', 9, 'C'
|
|
477
512
|
end
|
|
478
513
|
|
|
479
|
-
# Sets the address
|
|
514
|
+
# Sets the address of the Chibi Master. This address is used if the
|
|
480
515
|
# Chibi Extension is used as slave (i.e. it does not have a USB connection).
|
|
481
516
|
#
|
|
482
517
|
# It is possible to set the address with the Brick Viewer and it will be
|
|
483
518
|
# saved in the EEPROM of the Chibi Extension, it does not
|
|
484
519
|
# have to be set on every startup.
|
|
485
520
|
def set_chibi_master_address(address)
|
|
486
|
-
|
|
521
|
+
check_validity
|
|
522
|
+
|
|
523
|
+
send_request FUNCTION_SET_CHIBI_MASTER_ADDRESS, [address], 'C', 8, ''
|
|
487
524
|
end
|
|
488
525
|
|
|
489
526
|
# Returns the address as set by BrickMaster#set_chibi_master_address.
|
|
490
527
|
def get_chibi_master_address
|
|
491
|
-
|
|
528
|
+
check_validity
|
|
529
|
+
|
|
530
|
+
send_request FUNCTION_GET_CHIBI_MASTER_ADDRESS, [], '', 9, 'C'
|
|
492
531
|
end
|
|
493
532
|
|
|
494
|
-
# Sets up to 254 slave addresses.
|
|
533
|
+
# Sets up to 254 slave addresses. 0 has a
|
|
495
534
|
# special meaning, it is used as list terminator and not allowed as normal slave
|
|
496
535
|
# address. The address numeration (via num parameter) has to be used
|
|
497
536
|
# ascending from 0. For example: If you use the Chibi Extension in Master mode
|
|
@@ -507,19 +546,25 @@ module Tinkerforge
|
|
|
507
546
|
# The slave addresses will be saved in the EEPROM of the Chibi Extension, they
|
|
508
547
|
# don't have to be set on every startup.
|
|
509
548
|
def set_chibi_slave_address(num, address)
|
|
510
|
-
|
|
549
|
+
check_validity
|
|
550
|
+
|
|
551
|
+
send_request FUNCTION_SET_CHIBI_SLAVE_ADDRESS, [num, address], 'C C', 8, ''
|
|
511
552
|
end
|
|
512
553
|
|
|
513
554
|
# Returns the slave address for a given num as set by
|
|
514
555
|
# BrickMaster#set_chibi_slave_address.
|
|
515
556
|
def get_chibi_slave_address(num)
|
|
516
|
-
|
|
557
|
+
check_validity
|
|
558
|
+
|
|
559
|
+
send_request FUNCTION_GET_CHIBI_SLAVE_ADDRESS, [num], 'C', 9, 'C'
|
|
517
560
|
end
|
|
518
561
|
|
|
519
562
|
# Returns the signal strength in dBm. The signal strength updates every time a
|
|
520
563
|
# packet is received.
|
|
521
564
|
def get_chibi_signal_strength
|
|
522
|
-
|
|
565
|
+
check_validity
|
|
566
|
+
|
|
567
|
+
send_request FUNCTION_GET_CHIBI_SIGNAL_STRENGTH, [], '', 9, 'C'
|
|
523
568
|
end
|
|
524
569
|
|
|
525
570
|
# Returns underrun, CRC error, no ACK and overflow error counts of the Chibi
|
|
@@ -527,7 +572,9 @@ module Tinkerforge
|
|
|
527
572
|
# distance between two Chibi stacks is becoming too big or there are
|
|
528
573
|
# interferences.
|
|
529
574
|
def get_chibi_error_log
|
|
530
|
-
|
|
575
|
+
check_validity
|
|
576
|
+
|
|
577
|
+
send_request FUNCTION_GET_CHIBI_ERROR_LOG, [], '', 16, 'S S S S'
|
|
531
578
|
end
|
|
532
579
|
|
|
533
580
|
# Sets the Chibi frequency range for the Chibi Extension. Possible values are:
|
|
@@ -543,12 +590,16 @@ module Tinkerforge
|
|
|
543
590
|
# saved in the EEPROM of the Chibi Extension, it does not
|
|
544
591
|
# have to be set on every startup.
|
|
545
592
|
def set_chibi_frequency(frequency)
|
|
546
|
-
|
|
593
|
+
check_validity
|
|
594
|
+
|
|
595
|
+
send_request FUNCTION_SET_CHIBI_FREQUENCY, [frequency], 'C', 8, ''
|
|
547
596
|
end
|
|
548
597
|
|
|
549
598
|
# Returns the frequency value as set by BrickMaster#set_chibi_frequency.
|
|
550
599
|
def get_chibi_frequency
|
|
551
|
-
|
|
600
|
+
check_validity
|
|
601
|
+
|
|
602
|
+
send_request FUNCTION_GET_CHIBI_FREQUENCY, [], '', 9, 'C'
|
|
552
603
|
end
|
|
553
604
|
|
|
554
605
|
# Sets the channel used by the Chibi Extension. Possible channels are
|
|
@@ -565,18 +616,24 @@ module Tinkerforge
|
|
|
565
616
|
# saved in the EEPROM of the Chibi Extension, it does not
|
|
566
617
|
# have to be set on every startup.
|
|
567
618
|
def set_chibi_channel(channel)
|
|
568
|
-
|
|
619
|
+
check_validity
|
|
620
|
+
|
|
621
|
+
send_request FUNCTION_SET_CHIBI_CHANNEL, [channel], 'C', 8, ''
|
|
569
622
|
end
|
|
570
623
|
|
|
571
624
|
# Returns the channel as set by BrickMaster#set_chibi_channel.
|
|
572
625
|
def get_chibi_channel
|
|
573
|
-
|
|
626
|
+
check_validity
|
|
627
|
+
|
|
628
|
+
send_request FUNCTION_GET_CHIBI_CHANNEL, [], '', 9, 'C'
|
|
574
629
|
end
|
|
575
630
|
|
|
576
631
|
# Returns *true* if the Master Brick is at position 0 in the stack and a RS485
|
|
577
632
|
# Extension is available.
|
|
578
633
|
def is_rs485_present
|
|
579
|
-
|
|
634
|
+
check_validity
|
|
635
|
+
|
|
636
|
+
send_request FUNCTION_IS_RS485_PRESENT, [], '', 9, '?'
|
|
580
637
|
end
|
|
581
638
|
|
|
582
639
|
# Sets the address (0-255) belonging to the RS485 Extension.
|
|
@@ -588,12 +645,16 @@ module Tinkerforge
|
|
|
588
645
|
# saved in the EEPROM of the RS485 Extension, it does not
|
|
589
646
|
# have to be set on every startup.
|
|
590
647
|
def set_rs485_address(address)
|
|
591
|
-
|
|
648
|
+
check_validity
|
|
649
|
+
|
|
650
|
+
send_request FUNCTION_SET_RS485_ADDRESS, [address], 'C', 8, ''
|
|
592
651
|
end
|
|
593
652
|
|
|
594
653
|
# Returns the address as set by BrickMaster#set_rs485_address.
|
|
595
654
|
def get_rs485_address
|
|
596
|
-
|
|
655
|
+
check_validity
|
|
656
|
+
|
|
657
|
+
send_request FUNCTION_GET_RS485_ADDRESS, [], '', 9, 'C'
|
|
597
658
|
end
|
|
598
659
|
|
|
599
660
|
# Sets up to 255 slave addresses. Valid addresses are in range 1-255. 0 has a
|
|
@@ -612,13 +673,17 @@ module Tinkerforge
|
|
|
612
673
|
# The slave addresses will be saved in the EEPROM of the Chibi Extension, they
|
|
613
674
|
# don't have to be set on every startup.
|
|
614
675
|
def set_rs485_slave_address(num, address)
|
|
615
|
-
|
|
676
|
+
check_validity
|
|
677
|
+
|
|
678
|
+
send_request FUNCTION_SET_RS485_SLAVE_ADDRESS, [num, address], 'C C', 8, ''
|
|
616
679
|
end
|
|
617
680
|
|
|
618
681
|
# Returns the slave address for a given ``num`` as set by
|
|
619
682
|
# BrickMaster#set_rs485_slave_address.
|
|
620
683
|
def get_rs485_slave_address(num)
|
|
621
|
-
|
|
684
|
+
check_validity
|
|
685
|
+
|
|
686
|
+
send_request FUNCTION_GET_RS485_SLAVE_ADDRESS, [num], 'C', 9, 'C'
|
|
622
687
|
end
|
|
623
688
|
|
|
624
689
|
# Returns CRC error counts of the RS485 communication.
|
|
@@ -626,34 +691,41 @@ module Tinkerforge
|
|
|
626
691
|
# between the RS485 nodes is too big or there is some kind of
|
|
627
692
|
# interference.
|
|
628
693
|
def get_rs485_error_log
|
|
629
|
-
|
|
694
|
+
check_validity
|
|
695
|
+
|
|
696
|
+
send_request FUNCTION_GET_RS485_ERROR_LOG, [], '', 10, 'S'
|
|
630
697
|
end
|
|
631
698
|
|
|
632
|
-
# Sets the configuration of the RS485 Extension.
|
|
699
|
+
# Sets the configuration of the RS485 Extension. The
|
|
633
700
|
# Master Brick will try to match the given baud rate as exactly as possible.
|
|
634
|
-
# The maximum recommended baud rate is 2000000 (
|
|
701
|
+
# The maximum recommended baud rate is 2000000 (2MBd).
|
|
635
702
|
# Possible values for parity are 'n' (none), 'e' (even) and 'o' (odd).
|
|
636
|
-
# Possible values for stop bits are 1 and 2.
|
|
637
703
|
#
|
|
638
704
|
# If your RS485 is unstable (lost messages etc.), the first thing you should
|
|
639
705
|
# try is to decrease the speed. On very large bus (e.g. 1km), you probably
|
|
640
|
-
# should use a value in the range of 100000 (
|
|
706
|
+
# should use a value in the range of 100000 (100kBd).
|
|
641
707
|
#
|
|
642
708
|
# The values are stored in the EEPROM and only applied on startup. That means
|
|
643
709
|
# you have to restart the Master Brick after configuration.
|
|
644
710
|
def set_rs485_configuration(speed, parity, stopbits)
|
|
645
|
-
|
|
711
|
+
check_validity
|
|
712
|
+
|
|
713
|
+
send_request FUNCTION_SET_RS485_CONFIGURATION, [speed, parity, stopbits], 'L k C', 8, ''
|
|
646
714
|
end
|
|
647
715
|
|
|
648
716
|
# Returns the configuration as set by BrickMaster#set_rs485_configuration.
|
|
649
717
|
def get_rs485_configuration
|
|
650
|
-
|
|
718
|
+
check_validity
|
|
719
|
+
|
|
720
|
+
send_request FUNCTION_GET_RS485_CONFIGURATION, [], '', 14, 'L k C'
|
|
651
721
|
end
|
|
652
722
|
|
|
653
723
|
# Returns *true* if the Master Brick is at position 0 in the stack and a WIFI
|
|
654
724
|
# Extension is available.
|
|
655
725
|
def is_wifi_present
|
|
656
|
-
|
|
726
|
+
check_validity
|
|
727
|
+
|
|
728
|
+
send_request FUNCTION_IS_WIFI_PRESENT, [], '', 9, '?'
|
|
657
729
|
end
|
|
658
730
|
|
|
659
731
|
# Sets the configuration of the WIFI Extension. The ``ssid`` can have a max length
|
|
@@ -674,20 +746,23 @@ module Tinkerforge
|
|
|
674
746
|
# ``connection`` is set to one of the DHCP options then ``ip``, ``subnet_mask``
|
|
675
747
|
# and ``gateway`` are ignored, you can set them to 0.
|
|
676
748
|
#
|
|
677
|
-
# The last parameter is the port that your program will connect to.
|
|
678
|
-
# default port, that is used by brickd, is 4223.
|
|
749
|
+
# The last parameter is the port that your program will connect to.
|
|
679
750
|
#
|
|
680
751
|
# The values are stored in the EEPROM and only applied on startup. That means
|
|
681
752
|
# you have to restart the Master Brick after configuration.
|
|
682
753
|
#
|
|
683
754
|
# It is recommended to use the Brick Viewer to set the WIFI configuration.
|
|
684
755
|
def set_wifi_configuration(ssid, connection, ip, subnet_mask, gateway, port)
|
|
685
|
-
|
|
756
|
+
check_validity
|
|
757
|
+
|
|
758
|
+
send_request FUNCTION_SET_WIFI_CONFIGURATION, [ssid, connection, ip, subnet_mask, gateway, port], 'Z32 C C4 C4 C4 S', 8, ''
|
|
686
759
|
end
|
|
687
760
|
|
|
688
761
|
# Returns the configuration as set by BrickMaster#set_wifi_configuration.
|
|
689
762
|
def get_wifi_configuration
|
|
690
|
-
|
|
763
|
+
check_validity
|
|
764
|
+
|
|
765
|
+
send_request FUNCTION_GET_WIFI_CONFIGURATION, [], '', 55, 'Z32 C C4 C4 C4 S'
|
|
691
766
|
end
|
|
692
767
|
|
|
693
768
|
# Sets the encryption of the WIFI Extension. The first parameter is the
|
|
@@ -712,7 +787,7 @@ module Tinkerforge
|
|
|
712
787
|
#
|
|
713
788
|
# If you choose WPA Enterprise as encryption, you have to set ``eap_options`` and
|
|
714
789
|
# the length of the certificates (for other encryption types these parameters
|
|
715
|
-
# are ignored). The
|
|
790
|
+
# are ignored). The certificates
|
|
716
791
|
# themselves can be set with BrickMaster#set_wifi_certificate. ``eap_options`` consist
|
|
717
792
|
# of the outer authentication (bits 1-2), inner authentication (bit 3) and
|
|
718
793
|
# certificate type (bits 4-5):
|
|
@@ -730,7 +805,9 @@ module Tinkerforge
|
|
|
730
805
|
#
|
|
731
806
|
# It is recommended to use the Brick Viewer to set the Wi-Fi encryption.
|
|
732
807
|
def set_wifi_encryption(encryption, key, key_index, eap_options, ca_certificate_length, client_certificate_length, private_key_length)
|
|
733
|
-
|
|
808
|
+
check_validity
|
|
809
|
+
|
|
810
|
+
send_request FUNCTION_SET_WIFI_ENCRYPTION, [encryption, key, key_index, eap_options, ca_certificate_length, client_certificate_length, private_key_length], 'C Z50 C C S S S', 8, ''
|
|
734
811
|
end
|
|
735
812
|
|
|
736
813
|
# Returns the encryption as set by BrickMaster#set_wifi_encryption.
|
|
@@ -738,7 +815,9 @@ module Tinkerforge
|
|
|
738
815
|
# .. note::
|
|
739
816
|
# Since Master Brick Firmware version 2.4.4 the key is not returned anymore.
|
|
740
817
|
def get_wifi_encryption
|
|
741
|
-
|
|
818
|
+
check_validity
|
|
819
|
+
|
|
820
|
+
send_request FUNCTION_GET_WIFI_ENCRYPTION, [], '', 67, 'C Z50 C C S S S'
|
|
742
821
|
end
|
|
743
822
|
|
|
744
823
|
# Returns the status of the WIFI Extension. The ``state`` is updated automatically,
|
|
@@ -755,7 +834,9 @@ module Tinkerforge
|
|
|
755
834
|
# "3", "Error"
|
|
756
835
|
# "255", "Not initialized yet"
|
|
757
836
|
def get_wifi_status
|
|
758
|
-
|
|
837
|
+
check_validity
|
|
838
|
+
|
|
839
|
+
send_request FUNCTION_GET_WIFI_STATUS, [], '', 44, 'C6 C6 C s C4 C4 C4 L L C'
|
|
759
840
|
end
|
|
760
841
|
|
|
761
842
|
# Refreshes the Wi-Fi status (see BrickMaster#get_wifi_status). To read the status
|
|
@@ -765,7 +846,9 @@ module Tinkerforge
|
|
|
765
846
|
# until the stack with attached WIFI Extension reacts again after this
|
|
766
847
|
# function is called.
|
|
767
848
|
def refresh_wifi_status
|
|
768
|
-
|
|
849
|
+
check_validity
|
|
850
|
+
|
|
851
|
+
send_request FUNCTION_REFRESH_WIFI_STATUS, [], '', 8, ''
|
|
769
852
|
end
|
|
770
853
|
|
|
771
854
|
# This function is used to set the certificate as well as password and username
|
|
@@ -787,12 +870,16 @@ module Tinkerforge
|
|
|
787
870
|
# It is recommended to use the Brick Viewer to set the certificate, username
|
|
788
871
|
# and password.
|
|
789
872
|
def set_wifi_certificate(index, data, data_length)
|
|
790
|
-
|
|
873
|
+
check_validity
|
|
874
|
+
|
|
875
|
+
send_request FUNCTION_SET_WIFI_CERTIFICATE, [index, data, data_length], 'S C32 C', 8, ''
|
|
791
876
|
end
|
|
792
877
|
|
|
793
878
|
# Returns the certificate for a given index as set by BrickMaster#set_wifi_certificate.
|
|
794
879
|
def get_wifi_certificate(index)
|
|
795
|
-
|
|
880
|
+
check_validity
|
|
881
|
+
|
|
882
|
+
send_request FUNCTION_GET_WIFI_CERTIFICATE, [index], 'S', 41, 'C32 C'
|
|
796
883
|
end
|
|
797
884
|
|
|
798
885
|
# Sets the power mode of the WIFI Extension. Possible modes are:
|
|
@@ -801,15 +888,17 @@ module Tinkerforge
|
|
|
801
888
|
#
|
|
802
889
|
# "0", "Full Speed (high power consumption, high throughput)"
|
|
803
890
|
# "1", "Low Power (low power consumption, low throughput)"
|
|
804
|
-
#
|
|
805
|
-
# The default value is 0 (Full Speed).
|
|
806
891
|
def set_wifi_power_mode(mode)
|
|
807
|
-
|
|
892
|
+
check_validity
|
|
893
|
+
|
|
894
|
+
send_request FUNCTION_SET_WIFI_POWER_MODE, [mode], 'C', 8, ''
|
|
808
895
|
end
|
|
809
896
|
|
|
810
897
|
# Returns the power mode as set by BrickMaster#set_wifi_power_mode.
|
|
811
898
|
def get_wifi_power_mode
|
|
812
|
-
|
|
899
|
+
check_validity
|
|
900
|
+
|
|
901
|
+
send_request FUNCTION_GET_WIFI_POWER_MODE, [], '', 9, 'C'
|
|
813
902
|
end
|
|
814
903
|
|
|
815
904
|
# Returns informations about the Wi-Fi receive buffer. The Wi-Fi
|
|
@@ -827,7 +916,9 @@ module Tinkerforge
|
|
|
827
916
|
# Try to not send more then 50 messages at a time without any kind of
|
|
828
917
|
# break between them.
|
|
829
918
|
def get_wifi_buffer_info
|
|
830
|
-
|
|
919
|
+
check_validity
|
|
920
|
+
|
|
921
|
+
send_request FUNCTION_GET_WIFI_BUFFER_INFO, [], '', 16, 'L S S'
|
|
831
922
|
end
|
|
832
923
|
|
|
833
924
|
# Sets the regulatory domain of the WIFI Extension. Possible domains are:
|
|
@@ -837,20 +928,24 @@ module Tinkerforge
|
|
|
837
928
|
# "0", "FCC: Channel 1-11 (N/S America, Australia, New Zealand)"
|
|
838
929
|
# "1", "ETSI: Channel 1-13 (Europe, Middle East, Africa)"
|
|
839
930
|
# "2", "TELEC: Channel 1-14 (Japan)"
|
|
840
|
-
#
|
|
841
|
-
# The default value is 1 (ETSI).
|
|
842
931
|
def set_wifi_regulatory_domain(domain)
|
|
843
|
-
|
|
932
|
+
check_validity
|
|
933
|
+
|
|
934
|
+
send_request FUNCTION_SET_WIFI_REGULATORY_DOMAIN, [domain], 'C', 8, ''
|
|
844
935
|
end
|
|
845
936
|
|
|
846
937
|
# Returns the regulatory domain as set by BrickMaster#set_wifi_regulatory_domain.
|
|
847
938
|
def get_wifi_regulatory_domain
|
|
848
|
-
|
|
939
|
+
check_validity
|
|
940
|
+
|
|
941
|
+
send_request FUNCTION_GET_WIFI_REGULATORY_DOMAIN, [], '', 9, 'C'
|
|
849
942
|
end
|
|
850
943
|
|
|
851
|
-
# Returns the USB voltage
|
|
944
|
+
# Returns the USB voltage. Does not work with hardware version 2.1.
|
|
852
945
|
def get_usb_voltage
|
|
853
|
-
|
|
946
|
+
check_validity
|
|
947
|
+
|
|
948
|
+
send_request FUNCTION_GET_USB_VOLTAGE, [], '', 10, 'S'
|
|
854
949
|
end
|
|
855
950
|
|
|
856
951
|
# Sets a long Wi-Fi key (up to 63 chars, at least 8 chars) for WPA encryption.
|
|
@@ -863,7 +958,9 @@ module Tinkerforge
|
|
|
863
958
|
#
|
|
864
959
|
# .. versionadded:: 2.0.2$nbsp;(Firmware)
|
|
865
960
|
def set_long_wifi_key(key)
|
|
866
|
-
|
|
961
|
+
check_validity
|
|
962
|
+
|
|
963
|
+
send_request FUNCTION_SET_LONG_WIFI_KEY, [key], 'Z64', 8, ''
|
|
867
964
|
end
|
|
868
965
|
|
|
869
966
|
# Returns the encryption key as set by BrickMaster#set_long_wifi_key.
|
|
@@ -873,7 +970,9 @@ module Tinkerforge
|
|
|
873
970
|
#
|
|
874
971
|
# .. versionadded:: 2.0.2$nbsp;(Firmware)
|
|
875
972
|
def get_long_wifi_key
|
|
876
|
-
|
|
973
|
+
check_validity
|
|
974
|
+
|
|
975
|
+
send_request FUNCTION_GET_LONG_WIFI_KEY, [], '', 72, 'Z64'
|
|
877
976
|
end
|
|
878
977
|
|
|
879
978
|
# Sets the hostname of the WIFI Extension. The hostname will be displayed
|
|
@@ -883,7 +982,9 @@ module Tinkerforge
|
|
|
883
982
|
#
|
|
884
983
|
# .. versionadded:: 2.0.5$nbsp;(Firmware)
|
|
885
984
|
def set_wifi_hostname(hostname)
|
|
886
|
-
|
|
985
|
+
check_validity
|
|
986
|
+
|
|
987
|
+
send_request FUNCTION_SET_WIFI_HOSTNAME, [hostname], 'Z16', 8, ''
|
|
887
988
|
end
|
|
888
989
|
|
|
889
990
|
# Returns the hostname as set by BrickMaster#set_wifi_hostname.
|
|
@@ -892,7 +993,9 @@ module Tinkerforge
|
|
|
892
993
|
#
|
|
893
994
|
# .. versionadded:: 2.0.5$nbsp;(Firmware)
|
|
894
995
|
def get_wifi_hostname
|
|
895
|
-
|
|
996
|
+
check_validity
|
|
997
|
+
|
|
998
|
+
send_request FUNCTION_GET_WIFI_HOSTNAME, [], '', 24, 'Z16'
|
|
896
999
|
end
|
|
897
1000
|
|
|
898
1001
|
# Sets the period with which the CALLBACK_STACK_CURRENT callback is triggered
|
|
@@ -903,14 +1006,18 @@ module Tinkerforge
|
|
|
903
1006
|
#
|
|
904
1007
|
# .. versionadded:: 2.0.5$nbsp;(Firmware)
|
|
905
1008
|
def set_stack_current_callback_period(period)
|
|
906
|
-
|
|
1009
|
+
check_validity
|
|
1010
|
+
|
|
1011
|
+
send_request FUNCTION_SET_STACK_CURRENT_CALLBACK_PERIOD, [period], 'L', 8, ''
|
|
907
1012
|
end
|
|
908
1013
|
|
|
909
1014
|
# Returns the period as set by BrickMaster#set_stack_current_callback_period.
|
|
910
1015
|
#
|
|
911
1016
|
# .. versionadded:: 2.0.5$nbsp;(Firmware)
|
|
912
1017
|
def get_stack_current_callback_period
|
|
913
|
-
|
|
1018
|
+
check_validity
|
|
1019
|
+
|
|
1020
|
+
send_request FUNCTION_GET_STACK_CURRENT_CALLBACK_PERIOD, [], '', 12, 'L'
|
|
914
1021
|
end
|
|
915
1022
|
|
|
916
1023
|
# Sets the period with which the CALLBACK_STACK_VOLTAGE callback is triggered
|
|
@@ -921,14 +1028,18 @@ module Tinkerforge
|
|
|
921
1028
|
#
|
|
922
1029
|
# .. versionadded:: 2.0.5$nbsp;(Firmware)
|
|
923
1030
|
def set_stack_voltage_callback_period(period)
|
|
924
|
-
|
|
1031
|
+
check_validity
|
|
1032
|
+
|
|
1033
|
+
send_request FUNCTION_SET_STACK_VOLTAGE_CALLBACK_PERIOD, [period], 'L', 8, ''
|
|
925
1034
|
end
|
|
926
1035
|
|
|
927
1036
|
# Returns the period as set by BrickMaster#set_stack_voltage_callback_period.
|
|
928
1037
|
#
|
|
929
1038
|
# .. versionadded:: 2.0.5$nbsp;(Firmware)
|
|
930
1039
|
def get_stack_voltage_callback_period
|
|
931
|
-
|
|
1040
|
+
check_validity
|
|
1041
|
+
|
|
1042
|
+
send_request FUNCTION_GET_STACK_VOLTAGE_CALLBACK_PERIOD, [], '', 12, 'L'
|
|
932
1043
|
end
|
|
933
1044
|
|
|
934
1045
|
# Sets the period with which the CALLBACK_USB_VOLTAGE callback is triggered
|
|
@@ -939,14 +1050,18 @@ module Tinkerforge
|
|
|
939
1050
|
#
|
|
940
1051
|
# .. versionadded:: 2.0.5$nbsp;(Firmware)
|
|
941
1052
|
def set_usb_voltage_callback_period(period)
|
|
942
|
-
|
|
1053
|
+
check_validity
|
|
1054
|
+
|
|
1055
|
+
send_request FUNCTION_SET_USB_VOLTAGE_CALLBACK_PERIOD, [period], 'L', 8, ''
|
|
943
1056
|
end
|
|
944
1057
|
|
|
945
1058
|
# Returns the period as set by BrickMaster#set_usb_voltage_callback_period.
|
|
946
1059
|
#
|
|
947
1060
|
# .. versionadded:: 2.0.5$nbsp;(Firmware)
|
|
948
1061
|
def get_usb_voltage_callback_period
|
|
949
|
-
|
|
1062
|
+
check_validity
|
|
1063
|
+
|
|
1064
|
+
send_request FUNCTION_GET_USB_VOLTAGE_CALLBACK_PERIOD, [], '', 12, 'L'
|
|
950
1065
|
end
|
|
951
1066
|
|
|
952
1067
|
# Sets the thresholds for the CALLBACK_STACK_CURRENT_REACHED callback.
|
|
@@ -961,18 +1076,20 @@ module Tinkerforge
|
|
|
961
1076
|
# "'<'", "Callback is triggered when the current is smaller than the min value (max is ignored)"
|
|
962
1077
|
# "'>'", "Callback is triggered when the current is greater than the min value (max is ignored)"
|
|
963
1078
|
#
|
|
964
|
-
# The default value is ('x', 0, 0).
|
|
965
|
-
#
|
|
966
1079
|
# .. versionadded:: 2.0.5$nbsp;(Firmware)
|
|
967
1080
|
def set_stack_current_callback_threshold(option, min, max)
|
|
968
|
-
|
|
1081
|
+
check_validity
|
|
1082
|
+
|
|
1083
|
+
send_request FUNCTION_SET_STACK_CURRENT_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
|
|
969
1084
|
end
|
|
970
1085
|
|
|
971
1086
|
# Returns the threshold as set by BrickMaster#set_stack_current_callback_threshold.
|
|
972
1087
|
#
|
|
973
1088
|
# .. versionadded:: 2.0.5$nbsp;(Firmware)
|
|
974
1089
|
def get_stack_current_callback_threshold
|
|
975
|
-
|
|
1090
|
+
check_validity
|
|
1091
|
+
|
|
1092
|
+
send_request FUNCTION_GET_STACK_CURRENT_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
|
|
976
1093
|
end
|
|
977
1094
|
|
|
978
1095
|
# Sets the thresholds for the CALLBACK_STACK_VOLTAGE_REACHED callback.
|
|
@@ -987,18 +1104,20 @@ module Tinkerforge
|
|
|
987
1104
|
# "'<'", "Callback is triggered when the voltage is smaller than the min value (max is ignored)"
|
|
988
1105
|
# "'>'", "Callback is triggered when the voltage is greater than the min value (max is ignored)"
|
|
989
1106
|
#
|
|
990
|
-
# The default value is ('x', 0, 0).
|
|
991
|
-
#
|
|
992
1107
|
# .. versionadded:: 2.0.5$nbsp;(Firmware)
|
|
993
1108
|
def set_stack_voltage_callback_threshold(option, min, max)
|
|
994
|
-
|
|
1109
|
+
check_validity
|
|
1110
|
+
|
|
1111
|
+
send_request FUNCTION_SET_STACK_VOLTAGE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
|
|
995
1112
|
end
|
|
996
1113
|
|
|
997
1114
|
# Returns the threshold as set by BrickMaster#set_stack_voltage_callback_threshold.
|
|
998
1115
|
#
|
|
999
1116
|
# .. versionadded:: 2.0.5$nbsp;(Firmware)
|
|
1000
1117
|
def get_stack_voltage_callback_threshold
|
|
1001
|
-
|
|
1118
|
+
check_validity
|
|
1119
|
+
|
|
1120
|
+
send_request FUNCTION_GET_STACK_VOLTAGE_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
|
|
1002
1121
|
end
|
|
1003
1122
|
|
|
1004
1123
|
# Sets the thresholds for the CALLBACK_USB_VOLTAGE_REACHED callback.
|
|
@@ -1013,18 +1132,20 @@ module Tinkerforge
|
|
|
1013
1132
|
# "'<'", "Callback is triggered when the voltage is smaller than the min value (max is ignored)"
|
|
1014
1133
|
# "'>'", "Callback is triggered when the voltage is greater than the min value (max is ignored)"
|
|
1015
1134
|
#
|
|
1016
|
-
# The default value is ('x', 0, 0).
|
|
1017
|
-
#
|
|
1018
1135
|
# .. versionadded:: 2.0.5$nbsp;(Firmware)
|
|
1019
1136
|
def set_usb_voltage_callback_threshold(option, min, max)
|
|
1020
|
-
|
|
1137
|
+
check_validity
|
|
1138
|
+
|
|
1139
|
+
send_request FUNCTION_SET_USB_VOLTAGE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
|
|
1021
1140
|
end
|
|
1022
1141
|
|
|
1023
1142
|
# Returns the threshold as set by BrickMaster#set_usb_voltage_callback_threshold.
|
|
1024
1143
|
#
|
|
1025
1144
|
# .. versionadded:: 2.0.5$nbsp;(Firmware)
|
|
1026
1145
|
def get_usb_voltage_callback_threshold
|
|
1027
|
-
|
|
1146
|
+
check_validity
|
|
1147
|
+
|
|
1148
|
+
send_request FUNCTION_GET_USB_VOLTAGE_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
|
|
1028
1149
|
end
|
|
1029
1150
|
|
|
1030
1151
|
# Sets the period with which the threshold callbacks
|
|
@@ -1043,14 +1164,18 @@ module Tinkerforge
|
|
|
1043
1164
|
#
|
|
1044
1165
|
# .. versionadded:: 2.0.5$nbsp;(Firmware)
|
|
1045
1166
|
def set_debounce_period(debounce)
|
|
1046
|
-
|
|
1167
|
+
check_validity
|
|
1168
|
+
|
|
1169
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
|
|
1047
1170
|
end
|
|
1048
1171
|
|
|
1049
1172
|
# Returns the debounce period as set by BrickMaster#set_debounce_period.
|
|
1050
1173
|
#
|
|
1051
1174
|
# .. versionadded:: 2.0.5$nbsp;(Firmware)
|
|
1052
1175
|
def get_debounce_period
|
|
1053
|
-
|
|
1176
|
+
check_validity
|
|
1177
|
+
|
|
1178
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
|
|
1054
1179
|
end
|
|
1055
1180
|
|
|
1056
1181
|
# Returns *true* if the Master Brick is at position 0 in the stack and an Ethernet
|
|
@@ -1058,7 +1183,9 @@ module Tinkerforge
|
|
|
1058
1183
|
#
|
|
1059
1184
|
# .. versionadded:: 2.1.0$nbsp;(Firmware)
|
|
1060
1185
|
def is_ethernet_present
|
|
1061
|
-
|
|
1186
|
+
check_validity
|
|
1187
|
+
|
|
1188
|
+
send_request FUNCTION_IS_ETHERNET_PRESENT, [], '', 9, '?'
|
|
1062
1189
|
end
|
|
1063
1190
|
|
|
1064
1191
|
# Sets the configuration of the Ethernet Extension. Possible values for
|
|
@@ -1075,8 +1202,7 @@ module Tinkerforge
|
|
|
1075
1202
|
# to the DHCP options then ``ip``, ``subnet_mask`` and ``gateway`` are ignored,
|
|
1076
1203
|
# you can set them to 0.
|
|
1077
1204
|
#
|
|
1078
|
-
# The last parameter is the port that your program will connect to.
|
|
1079
|
-
# default port, that is used by brickd, is 4223.
|
|
1205
|
+
# The last parameter is the port that your program will connect to.
|
|
1080
1206
|
#
|
|
1081
1207
|
# The values are stored in the EEPROM and only applied on startup. That means
|
|
1082
1208
|
# you have to restart the Master Brick after configuration.
|
|
@@ -1085,14 +1211,18 @@ module Tinkerforge
|
|
|
1085
1211
|
#
|
|
1086
1212
|
# .. versionadded:: 2.1.0$nbsp;(Firmware)
|
|
1087
1213
|
def set_ethernet_configuration(connection, ip, subnet_mask, gateway, port)
|
|
1088
|
-
|
|
1214
|
+
check_validity
|
|
1215
|
+
|
|
1216
|
+
send_request FUNCTION_SET_ETHERNET_CONFIGURATION, [connection, ip, subnet_mask, gateway, port], 'C C4 C4 C4 S', 8, ''
|
|
1089
1217
|
end
|
|
1090
1218
|
|
|
1091
1219
|
# Returns the configuration as set by BrickMaster#set_ethernet_configuration.
|
|
1092
1220
|
#
|
|
1093
1221
|
# .. versionadded:: 2.1.0$nbsp;(Firmware)
|
|
1094
1222
|
def get_ethernet_configuration
|
|
1095
|
-
|
|
1223
|
+
check_validity
|
|
1224
|
+
|
|
1225
|
+
send_request FUNCTION_GET_ETHERNET_CONFIGURATION, [], '', 23, 'C C4 C4 C4 S'
|
|
1096
1226
|
end
|
|
1097
1227
|
|
|
1098
1228
|
# Returns the status of the Ethernet Extension.
|
|
@@ -1107,7 +1237,9 @@ module Tinkerforge
|
|
|
1107
1237
|
#
|
|
1108
1238
|
# .. versionadded:: 2.1.0$nbsp;(Firmware)
|
|
1109
1239
|
def get_ethernet_status
|
|
1110
|
-
|
|
1240
|
+
check_validity
|
|
1241
|
+
|
|
1242
|
+
send_request FUNCTION_GET_ETHERNET_STATUS, [], '', 66, 'C6 C4 C4 C4 L L Z32'
|
|
1111
1243
|
end
|
|
1112
1244
|
|
|
1113
1245
|
# Sets the hostname of the Ethernet Extension. The hostname will be displayed
|
|
@@ -1119,7 +1251,9 @@ module Tinkerforge
|
|
|
1119
1251
|
#
|
|
1120
1252
|
# .. versionadded:: 2.1.0$nbsp;(Firmware)
|
|
1121
1253
|
def set_ethernet_hostname(hostname)
|
|
1122
|
-
|
|
1254
|
+
check_validity
|
|
1255
|
+
|
|
1256
|
+
send_request FUNCTION_SET_ETHERNET_HOSTNAME, [hostname], 'Z32', 8, ''
|
|
1123
1257
|
end
|
|
1124
1258
|
|
|
1125
1259
|
# Sets the MAC address of the Ethernet Extension. The Ethernet Extension should
|
|
@@ -1130,7 +1264,9 @@ module Tinkerforge
|
|
|
1130
1264
|
#
|
|
1131
1265
|
# .. versionadded:: 2.1.0$nbsp;(Firmware)
|
|
1132
1266
|
def set_ethernet_mac_address(mac_address)
|
|
1133
|
-
|
|
1267
|
+
check_validity
|
|
1268
|
+
|
|
1269
|
+
send_request FUNCTION_SET_ETHERNET_MAC_ADDRESS, [mac_address], 'C6', 8, ''
|
|
1134
1270
|
end
|
|
1135
1271
|
|
|
1136
1272
|
# Sets the Ethernet WebSocket configuration. The first parameter sets the number of socket
|
|
@@ -1146,18 +1282,20 @@ module Tinkerforge
|
|
|
1146
1282
|
#
|
|
1147
1283
|
# It is recommended to use the Brick Viewer to set the Ethernet configuration.
|
|
1148
1284
|
#
|
|
1149
|
-
# The default values are 3 for the socket connections and 4280 for the port.
|
|
1150
|
-
#
|
|
1151
1285
|
# .. versionadded:: 2.2.0$nbsp;(Firmware)
|
|
1152
1286
|
def set_ethernet_websocket_configuration(sockets, port)
|
|
1153
|
-
|
|
1287
|
+
check_validity
|
|
1288
|
+
|
|
1289
|
+
send_request FUNCTION_SET_ETHERNET_WEBSOCKET_CONFIGURATION, [sockets, port], 'C S', 8, ''
|
|
1154
1290
|
end
|
|
1155
1291
|
|
|
1156
1292
|
# Returns the configuration as set by BrickMaster#set_ethernet_configuration.
|
|
1157
1293
|
#
|
|
1158
1294
|
# .. versionadded:: 2.2.0$nbsp;(Firmware)
|
|
1159
1295
|
def get_ethernet_websocket_configuration
|
|
1160
|
-
|
|
1296
|
+
check_validity
|
|
1297
|
+
|
|
1298
|
+
send_request FUNCTION_GET_ETHERNET_WEBSOCKET_CONFIGURATION, [], '', 11, 'C S'
|
|
1161
1299
|
end
|
|
1162
1300
|
|
|
1163
1301
|
# Sets the Ethernet authentication secret. The secret can be a string of up to 64
|
|
@@ -1175,7 +1313,9 @@ module Tinkerforge
|
|
|
1175
1313
|
#
|
|
1176
1314
|
# .. versionadded:: 2.2.0$nbsp;(Firmware)
|
|
1177
1315
|
def set_ethernet_authentication_secret(secret)
|
|
1178
|
-
|
|
1316
|
+
check_validity
|
|
1317
|
+
|
|
1318
|
+
send_request FUNCTION_SET_ETHERNET_AUTHENTICATION_SECRET, [secret], 'Z64', 8, ''
|
|
1179
1319
|
end
|
|
1180
1320
|
|
|
1181
1321
|
# Returns the authentication secret as set by
|
|
@@ -1183,7 +1323,9 @@ module Tinkerforge
|
|
|
1183
1323
|
#
|
|
1184
1324
|
# .. versionadded:: 2.2.0$nbsp;(Firmware)
|
|
1185
1325
|
def get_ethernet_authentication_secret
|
|
1186
|
-
|
|
1326
|
+
check_validity
|
|
1327
|
+
|
|
1328
|
+
send_request FUNCTION_GET_ETHERNET_AUTHENTICATION_SECRET, [], '', 72, 'Z64'
|
|
1187
1329
|
end
|
|
1188
1330
|
|
|
1189
1331
|
# Sets the WIFI authentication secret. The secret can be a string of up to 64
|
|
@@ -1201,7 +1343,9 @@ module Tinkerforge
|
|
|
1201
1343
|
#
|
|
1202
1344
|
# .. versionadded:: 2.2.0$nbsp;(Firmware)
|
|
1203
1345
|
def set_wifi_authentication_secret(secret)
|
|
1204
|
-
|
|
1346
|
+
check_validity
|
|
1347
|
+
|
|
1348
|
+
send_request FUNCTION_SET_WIFI_AUTHENTICATION_SECRET, [secret], 'Z64', 8, ''
|
|
1205
1349
|
end
|
|
1206
1350
|
|
|
1207
1351
|
# Returns the authentication secret as set by
|
|
@@ -1209,14 +1353,18 @@ module Tinkerforge
|
|
|
1209
1353
|
#
|
|
1210
1354
|
# .. versionadded:: 2.2.0$nbsp;(Firmware)
|
|
1211
1355
|
def get_wifi_authentication_secret
|
|
1212
|
-
|
|
1356
|
+
check_validity
|
|
1357
|
+
|
|
1358
|
+
send_request FUNCTION_GET_WIFI_AUTHENTICATION_SECRET, [], '', 72, 'Z64'
|
|
1213
1359
|
end
|
|
1214
1360
|
|
|
1215
1361
|
# Returns the type of the connection over which this function was called.
|
|
1216
1362
|
#
|
|
1217
1363
|
# .. versionadded:: 2.4.0$nbsp;(Firmware)
|
|
1218
1364
|
def get_connection_type
|
|
1219
|
-
|
|
1365
|
+
check_validity
|
|
1366
|
+
|
|
1367
|
+
send_request FUNCTION_GET_CONNECTION_TYPE, [], '', 9, 'C'
|
|
1220
1368
|
end
|
|
1221
1369
|
|
|
1222
1370
|
# Returns *true* if the Master Brick is at position 0 in the stack and a WIFI
|
|
@@ -1224,7 +1372,9 @@ module Tinkerforge
|
|
|
1224
1372
|
#
|
|
1225
1373
|
# .. versionadded:: 2.4.0$nbsp;(Firmware)
|
|
1226
1374
|
def is_wifi2_present
|
|
1227
|
-
|
|
1375
|
+
check_validity
|
|
1376
|
+
|
|
1377
|
+
send_request FUNCTION_IS_WIFI2_PRESENT, [], '', 9, '?'
|
|
1228
1378
|
end
|
|
1229
1379
|
|
|
1230
1380
|
# Starts the bootloader of the WIFI Extension 2.0. Returns 0 on success.
|
|
@@ -1240,7 +1390,9 @@ module Tinkerforge
|
|
|
1240
1390
|
#
|
|
1241
1391
|
# .. versionadded:: 2.4.0$nbsp;(Firmware)
|
|
1242
1392
|
def start_wifi2_bootloader
|
|
1243
|
-
|
|
1393
|
+
check_validity
|
|
1394
|
+
|
|
1395
|
+
send_request FUNCTION_START_WIFI2_BOOTLOADER, [], '', 9, 'c'
|
|
1244
1396
|
end
|
|
1245
1397
|
|
|
1246
1398
|
# Writes up to 60 bytes (number of bytes to be written specified by ``length``)
|
|
@@ -1255,7 +1407,9 @@ module Tinkerforge
|
|
|
1255
1407
|
#
|
|
1256
1408
|
# .. versionadded:: 2.4.0$nbsp;(Firmware)
|
|
1257
1409
|
def write_wifi2_serial_port(data, length)
|
|
1258
|
-
|
|
1410
|
+
check_validity
|
|
1411
|
+
|
|
1412
|
+
send_request FUNCTION_WRITE_WIFI2_SERIAL_PORT, [data, length], 'C60 C', 9, 'c'
|
|
1259
1413
|
end
|
|
1260
1414
|
|
|
1261
1415
|
# Reads up to 60 bytes (number of bytes to be read specified by ``length``)
|
|
@@ -1270,7 +1424,9 @@ module Tinkerforge
|
|
|
1270
1424
|
#
|
|
1271
1425
|
# .. versionadded:: 2.4.0$nbsp;(Firmware)
|
|
1272
1426
|
def read_wifi2_serial_port(length)
|
|
1273
|
-
|
|
1427
|
+
check_validity
|
|
1428
|
+
|
|
1429
|
+
send_request FUNCTION_READ_WIFI2_SERIAL_PORT, [length], 'C', 69, 'C60 C'
|
|
1274
1430
|
end
|
|
1275
1431
|
|
|
1276
1432
|
# Sets the WIFI authentication secret. The secret can be a string of up to 64
|
|
@@ -1288,7 +1444,9 @@ module Tinkerforge
|
|
|
1288
1444
|
#
|
|
1289
1445
|
# .. versionadded:: 2.4.0$nbsp;(Firmware)
|
|
1290
1446
|
def set_wifi2_authentication_secret(secret)
|
|
1291
|
-
|
|
1447
|
+
check_validity
|
|
1448
|
+
|
|
1449
|
+
send_request FUNCTION_SET_WIFI2_AUTHENTICATION_SECRET, [secret], 'Z64', 8, ''
|
|
1292
1450
|
end
|
|
1293
1451
|
|
|
1294
1452
|
# Returns the WIFI authentication secret as set by
|
|
@@ -1296,22 +1454,24 @@ module Tinkerforge
|
|
|
1296
1454
|
#
|
|
1297
1455
|
# .. versionadded:: 2.4.0$nbsp;(Firmware)
|
|
1298
1456
|
def get_wifi2_authentication_secret
|
|
1299
|
-
|
|
1457
|
+
check_validity
|
|
1458
|
+
|
|
1459
|
+
send_request FUNCTION_GET_WIFI2_AUTHENTICATION_SECRET, [], '', 72, 'Z64'
|
|
1300
1460
|
end
|
|
1301
1461
|
|
|
1302
1462
|
# Sets the general configuration of the WIFI Extension 2.0.
|
|
1303
1463
|
#
|
|
1304
1464
|
# The ``port`` parameter sets the port number that your programm will connect
|
|
1305
|
-
# to.
|
|
1465
|
+
# to.
|
|
1306
1466
|
#
|
|
1307
1467
|
# The ``websocket_port`` parameter sets the WebSocket port number that your
|
|
1308
|
-
# JavaScript programm will connect to.
|
|
1468
|
+
# JavaScript programm will connect to.
|
|
1309
1469
|
#
|
|
1310
1470
|
# The ``website_port`` parameter sets the port number for the website of the
|
|
1311
|
-
# WIFI Extension 2.0.
|
|
1471
|
+
# WIFI Extension 2.0.
|
|
1312
1472
|
#
|
|
1313
1473
|
# The ``phy_mode`` parameter sets the specific wireless network mode to be used.
|
|
1314
|
-
# Possible values are B, G and N.
|
|
1474
|
+
# Possible values are B, G and N.
|
|
1315
1475
|
#
|
|
1316
1476
|
# The ``sleep_mode`` parameter is currently unused.
|
|
1317
1477
|
#
|
|
@@ -1331,27 +1491,33 @@ module Tinkerforge
|
|
|
1331
1491
|
#
|
|
1332
1492
|
# .. versionadded:: 2.4.0$nbsp;(Firmware)
|
|
1333
1493
|
def set_wifi2_configuration(port, websocket_port, website_port, phy_mode, sleep_mode, website)
|
|
1334
|
-
|
|
1494
|
+
check_validity
|
|
1495
|
+
|
|
1496
|
+
send_request FUNCTION_SET_WIFI2_CONFIGURATION, [port, websocket_port, website_port, phy_mode, sleep_mode, website], 'S S S C C C', 8, ''
|
|
1335
1497
|
end
|
|
1336
1498
|
|
|
1337
1499
|
# Returns the general configuration as set by BrickMaster#set_wifi2_configuration.
|
|
1338
1500
|
#
|
|
1339
1501
|
# .. versionadded:: 2.4.0$nbsp;(Firmware)
|
|
1340
1502
|
def get_wifi2_configuration
|
|
1341
|
-
|
|
1503
|
+
check_validity
|
|
1504
|
+
|
|
1505
|
+
send_request FUNCTION_GET_WIFI2_CONFIGURATION, [], '', 17, 'S S S C C C'
|
|
1342
1506
|
end
|
|
1343
1507
|
|
|
1344
1508
|
# Returns the client and access point status of the WIFI Extension 2.0.
|
|
1345
1509
|
#
|
|
1346
1510
|
# .. versionadded:: 2.4.0$nbsp;(Firmware)
|
|
1347
1511
|
def get_wifi2_status
|
|
1348
|
-
|
|
1512
|
+
check_validity
|
|
1513
|
+
|
|
1514
|
+
send_request FUNCTION_GET_WIFI2_STATUS, [], '', 65, '? C C4 C4 C4 C6 L L c ? C4 C4 C4 C6 L L C'
|
|
1349
1515
|
end
|
|
1350
1516
|
|
|
1351
1517
|
# Sets the client specific configuration of the WIFI Extension 2.0.
|
|
1352
1518
|
#
|
|
1353
1519
|
# The ``enable`` parameter enables or disables the client part of the
|
|
1354
|
-
# WIFI Extension 2.0.
|
|
1520
|
+
# WIFI Extension 2.0.
|
|
1355
1521
|
#
|
|
1356
1522
|
# The ``ssid`` parameter sets the SSID (up to 32 characters) of the access point
|
|
1357
1523
|
# to connect to.
|
|
@@ -1378,14 +1544,18 @@ module Tinkerforge
|
|
|
1378
1544
|
#
|
|
1379
1545
|
# .. versionadded:: 2.4.0$nbsp;(Firmware)
|
|
1380
1546
|
def set_wifi2_client_configuration(enable, ssid, ip, subnet_mask, gateway, mac_address, bssid)
|
|
1381
|
-
|
|
1547
|
+
check_validity
|
|
1548
|
+
|
|
1549
|
+
send_request FUNCTION_SET_WIFI2_CLIENT_CONFIGURATION, [enable, ssid, ip, subnet_mask, gateway, mac_address, bssid], '? Z32 C4 C4 C4 C6 C6', 8, ''
|
|
1382
1550
|
end
|
|
1383
1551
|
|
|
1384
1552
|
# Returns the client configuration as set by BrickMaster#set_wifi2_client_configuration.
|
|
1385
1553
|
#
|
|
1386
1554
|
# .. versionadded:: 2.4.0$nbsp;(Firmware)
|
|
1387
1555
|
def get_wifi2_client_configuration
|
|
1388
|
-
|
|
1556
|
+
check_validity
|
|
1557
|
+
|
|
1558
|
+
send_request FUNCTION_GET_WIFI2_CLIENT_CONFIGURATION, [], '', 65, '? Z32 C4 C4 C4 C6 C6'
|
|
1389
1559
|
end
|
|
1390
1560
|
|
|
1391
1561
|
# Sets the client hostname (up to 32 characters) of the WIFI Extension 2.0. The
|
|
@@ -1400,14 +1570,18 @@ module Tinkerforge
|
|
|
1400
1570
|
#
|
|
1401
1571
|
# .. versionadded:: 2.4.0$nbsp;(Firmware)
|
|
1402
1572
|
def set_wifi2_client_hostname(hostname)
|
|
1403
|
-
|
|
1573
|
+
check_validity
|
|
1574
|
+
|
|
1575
|
+
send_request FUNCTION_SET_WIFI2_CLIENT_HOSTNAME, [hostname], 'Z32', 8, ''
|
|
1404
1576
|
end
|
|
1405
1577
|
|
|
1406
1578
|
# Returns the client hostname as set by BrickMaster#set_wifi2_client_hostname.
|
|
1407
1579
|
#
|
|
1408
1580
|
# .. versionadded:: 2.4.0$nbsp;(Firmware)
|
|
1409
1581
|
def get_wifi2_client_hostname
|
|
1410
|
-
|
|
1582
|
+
check_validity
|
|
1583
|
+
|
|
1584
|
+
send_request FUNCTION_GET_WIFI2_CLIENT_HOSTNAME, [], '', 40, 'Z32'
|
|
1411
1585
|
end
|
|
1412
1586
|
|
|
1413
1587
|
# Sets the client password (up to 63 chars) for WPA/WPA2 encryption.
|
|
@@ -1420,7 +1594,9 @@ module Tinkerforge
|
|
|
1420
1594
|
#
|
|
1421
1595
|
# .. versionadded:: 2.4.0$nbsp;(Firmware)
|
|
1422
1596
|
def set_wifi2_client_password(password)
|
|
1423
|
-
|
|
1597
|
+
check_validity
|
|
1598
|
+
|
|
1599
|
+
send_request FUNCTION_SET_WIFI2_CLIENT_PASSWORD, [password], 'Z64', 8, ''
|
|
1424
1600
|
end
|
|
1425
1601
|
|
|
1426
1602
|
# Returns the client password as set by BrickMaster#set_wifi2_client_password.
|
|
@@ -1431,13 +1607,15 @@ module Tinkerforge
|
|
|
1431
1607
|
#
|
|
1432
1608
|
# .. versionadded:: 2.4.0$nbsp;(Firmware)
|
|
1433
1609
|
def get_wifi2_client_password
|
|
1434
|
-
|
|
1610
|
+
check_validity
|
|
1611
|
+
|
|
1612
|
+
send_request FUNCTION_GET_WIFI2_CLIENT_PASSWORD, [], '', 72, 'Z64'
|
|
1435
1613
|
end
|
|
1436
1614
|
|
|
1437
1615
|
# Sets the access point specific configuration of the WIFI Extension 2.0.
|
|
1438
1616
|
#
|
|
1439
1617
|
# The ``enable`` parameter enables or disables the access point part of the
|
|
1440
|
-
# WIFI Extension 2.0.
|
|
1618
|
+
# WIFI Extension 2.0.
|
|
1441
1619
|
#
|
|
1442
1620
|
# The ``ssid`` parameter sets the SSID (up to 32 characters) of the access point.
|
|
1443
1621
|
#
|
|
@@ -1447,15 +1625,13 @@ module Tinkerforge
|
|
|
1447
1625
|
# The default configuration is DHCP.
|
|
1448
1626
|
#
|
|
1449
1627
|
# The ``encryption`` parameter sets the encryption mode to be used. Possible
|
|
1450
|
-
# values are Open (no encryption), WEP or WPA/WPA2 PSK.
|
|
1451
|
-
#
|
|
1628
|
+
# values are Open (no encryption), WEP or WPA/WPA2 PSK.
|
|
1629
|
+
# Use the BrickMaster#set_wifi2_ap_password function to set the encryption
|
|
1452
1630
|
# password.
|
|
1453
1631
|
#
|
|
1454
1632
|
# The ``hidden`` parameter makes the access point hide or show its SSID.
|
|
1455
|
-
# The default value is *false*.
|
|
1456
1633
|
#
|
|
1457
1634
|
# The ``channel`` parameter sets the channel (1 to 13) of the access point.
|
|
1458
|
-
# The default value is 1.
|
|
1459
1635
|
#
|
|
1460
1636
|
# If the ``mac_address`` parameter is set to all zero then the factory MAC
|
|
1461
1637
|
# address is used. Otherwise this parameter can be used to set a custom MAC
|
|
@@ -1469,14 +1645,18 @@ module Tinkerforge
|
|
|
1469
1645
|
#
|
|
1470
1646
|
# .. versionadded:: 2.4.0$nbsp;(Firmware)
|
|
1471
1647
|
def set_wifi2_ap_configuration(enable, ssid, ip, subnet_mask, gateway, encryption, hidden, channel, mac_address)
|
|
1472
|
-
|
|
1648
|
+
check_validity
|
|
1649
|
+
|
|
1650
|
+
send_request FUNCTION_SET_WIFI2_AP_CONFIGURATION, [enable, ssid, ip, subnet_mask, gateway, encryption, hidden, channel, mac_address], '? Z32 C4 C4 C4 C ? C C6', 8, ''
|
|
1473
1651
|
end
|
|
1474
1652
|
|
|
1475
1653
|
# Returns the access point configuration as set by BrickMaster#set_wifi2_ap_configuration.
|
|
1476
1654
|
#
|
|
1477
1655
|
# .. versionadded:: 2.4.0$nbsp;(Firmware)
|
|
1478
1656
|
def get_wifi2_ap_configuration
|
|
1479
|
-
|
|
1657
|
+
check_validity
|
|
1658
|
+
|
|
1659
|
+
send_request FUNCTION_GET_WIFI2_AP_CONFIGURATION, [], '', 62, '? Z32 C4 C4 C4 C ? C C6'
|
|
1480
1660
|
end
|
|
1481
1661
|
|
|
1482
1662
|
# Sets the access point password (at least 8 and up to 63 chars) for the configured encryption
|
|
@@ -1490,7 +1670,9 @@ module Tinkerforge
|
|
|
1490
1670
|
#
|
|
1491
1671
|
# .. versionadded:: 2.4.0$nbsp;(Firmware)
|
|
1492
1672
|
def set_wifi2_ap_password(password)
|
|
1493
|
-
|
|
1673
|
+
check_validity
|
|
1674
|
+
|
|
1675
|
+
send_request FUNCTION_SET_WIFI2_AP_PASSWORD, [password], 'Z64', 8, ''
|
|
1494
1676
|
end
|
|
1495
1677
|
|
|
1496
1678
|
# Returns the access point password as set by BrickMaster#set_wifi2_ap_password.
|
|
@@ -1501,7 +1683,9 @@ module Tinkerforge
|
|
|
1501
1683
|
#
|
|
1502
1684
|
# .. versionadded:: 2.4.0$nbsp;(Firmware)
|
|
1503
1685
|
def get_wifi2_ap_password
|
|
1504
|
-
|
|
1686
|
+
check_validity
|
|
1687
|
+
|
|
1688
|
+
send_request FUNCTION_GET_WIFI2_AP_PASSWORD, [], '', 72, 'Z64'
|
|
1505
1689
|
end
|
|
1506
1690
|
|
|
1507
1691
|
# All configuration functions for the WIFI Extension 2.0 do not change the
|
|
@@ -1513,35 +1697,45 @@ module Tinkerforge
|
|
|
1513
1697
|
#
|
|
1514
1698
|
# .. versionadded:: 2.4.0$nbsp;(Firmware)
|
|
1515
1699
|
def save_wifi2_configuration
|
|
1516
|
-
|
|
1700
|
+
check_validity
|
|
1701
|
+
|
|
1702
|
+
send_request FUNCTION_SAVE_WIFI2_CONFIGURATION, [], '', 9, 'C'
|
|
1517
1703
|
end
|
|
1518
1704
|
|
|
1519
|
-
# Returns the current version of the WIFI Extension 2.0 firmware
|
|
1705
|
+
# Returns the current version of the WIFI Extension 2.0 firmware.
|
|
1520
1706
|
#
|
|
1521
1707
|
# .. versionadded:: 2.4.0$nbsp;(Firmware)
|
|
1522
1708
|
def get_wifi2_firmware_version
|
|
1523
|
-
|
|
1709
|
+
check_validity
|
|
1710
|
+
|
|
1711
|
+
send_request FUNCTION_GET_WIFI2_FIRMWARE_VERSION, [], '', 11, 'C3'
|
|
1524
1712
|
end
|
|
1525
1713
|
|
|
1526
1714
|
# Turns the green status LED of the WIFI Extension 2.0 on.
|
|
1527
1715
|
#
|
|
1528
1716
|
# .. versionadded:: 2.4.0$nbsp;(Firmware)
|
|
1529
1717
|
def enable_wifi2_status_led
|
|
1530
|
-
|
|
1718
|
+
check_validity
|
|
1719
|
+
|
|
1720
|
+
send_request FUNCTION_ENABLE_WIFI2_STATUS_LED, [], '', 8, ''
|
|
1531
1721
|
end
|
|
1532
1722
|
|
|
1533
1723
|
# Turns the green status LED of the WIFI Extension 2.0 off.
|
|
1534
1724
|
#
|
|
1535
1725
|
# .. versionadded:: 2.4.0$nbsp;(Firmware)
|
|
1536
1726
|
def disable_wifi2_status_led
|
|
1537
|
-
|
|
1727
|
+
check_validity
|
|
1728
|
+
|
|
1729
|
+
send_request FUNCTION_DISABLE_WIFI2_STATUS_LED, [], '', 8, ''
|
|
1538
1730
|
end
|
|
1539
1731
|
|
|
1540
1732
|
# Returns *true* if the green status LED of the WIFI Extension 2.0 is turned on.
|
|
1541
1733
|
#
|
|
1542
1734
|
# .. versionadded:: 2.4.0$nbsp;(Firmware)
|
|
1543
1735
|
def is_wifi2_status_led_enabled
|
|
1544
|
-
|
|
1736
|
+
check_validity
|
|
1737
|
+
|
|
1738
|
+
send_request FUNCTION_IS_WIFI2_STATUS_LED_ENABLED, [], '', 9, '?'
|
|
1545
1739
|
end
|
|
1546
1740
|
|
|
1547
1741
|
# Requires WIFI Extension 2.0 firmware 2.1.0.
|
|
@@ -1549,7 +1743,7 @@ module Tinkerforge
|
|
|
1549
1743
|
# Sets the mesh specific configuration of the WIFI Extension 2.0.
|
|
1550
1744
|
#
|
|
1551
1745
|
# The ``enable`` parameter enables or disables the mesh part of the
|
|
1552
|
-
# WIFI Extension 2.0. The
|
|
1746
|
+
# WIFI Extension 2.0. The mesh part cannot be
|
|
1553
1747
|
# enabled together with the client and access-point part.
|
|
1554
1748
|
#
|
|
1555
1749
|
# If the ``root_ip`` parameter is set to all zero then ``root_subnet_mask``
|
|
@@ -1578,7 +1772,9 @@ module Tinkerforge
|
|
|
1578
1772
|
#
|
|
1579
1773
|
# .. versionadded:: 2.4.2$nbsp;(Firmware)
|
|
1580
1774
|
def set_wifi2_mesh_configuration(enable, root_ip, root_subnet_mask, root_gateway, router_bssid, group_id, group_ssid_prefix, gateway_ip, gateway_port)
|
|
1581
|
-
|
|
1775
|
+
check_validity
|
|
1776
|
+
|
|
1777
|
+
send_request FUNCTION_SET_WIFI2_MESH_CONFIGURATION, [enable, root_ip, root_subnet_mask, root_gateway, router_bssid, group_id, group_ssid_prefix, gateway_ip, gateway_port], '? C4 C4 C4 C6 C6 Z16 C4 S', 8, ''
|
|
1582
1778
|
end
|
|
1583
1779
|
|
|
1584
1780
|
# Requires WIFI Extension 2.0 firmware 2.1.0.
|
|
@@ -1587,7 +1783,9 @@ module Tinkerforge
|
|
|
1587
1783
|
#
|
|
1588
1784
|
# .. versionadded:: 2.4.2$nbsp;(Firmware)
|
|
1589
1785
|
def get_wifi2_mesh_configuration
|
|
1590
|
-
|
|
1786
|
+
check_validity
|
|
1787
|
+
|
|
1788
|
+
send_request FUNCTION_GET_WIFI2_MESH_CONFIGURATION, [], '', 55, '? C4 C4 C4 C6 C6 Z16 C4 S'
|
|
1591
1789
|
end
|
|
1592
1790
|
|
|
1593
1791
|
# Requires WIFI Extension 2.0 firmware 2.1.0.
|
|
@@ -1607,7 +1805,9 @@ module Tinkerforge
|
|
|
1607
1805
|
#
|
|
1608
1806
|
# .. versionadded:: 2.4.2$nbsp;(Firmware)
|
|
1609
1807
|
def set_wifi2_mesh_router_ssid(ssid)
|
|
1610
|
-
|
|
1808
|
+
check_validity
|
|
1809
|
+
|
|
1810
|
+
send_request FUNCTION_SET_WIFI2_MESH_ROUTER_SSID, [ssid], 'Z32', 8, ''
|
|
1611
1811
|
end
|
|
1612
1812
|
|
|
1613
1813
|
# Requires WIFI Extension 2.0 firmware 2.1.0.
|
|
@@ -1616,7 +1816,9 @@ module Tinkerforge
|
|
|
1616
1816
|
#
|
|
1617
1817
|
# .. versionadded:: 2.4.2$nbsp;(Firmware)
|
|
1618
1818
|
def get_wifi2_mesh_router_ssid
|
|
1619
|
-
|
|
1819
|
+
check_validity
|
|
1820
|
+
|
|
1821
|
+
send_request FUNCTION_GET_WIFI2_MESH_ROUTER_SSID, [], '', 40, 'Z32'
|
|
1620
1822
|
end
|
|
1621
1823
|
|
|
1622
1824
|
# Requires WIFI Extension 2.0 firmware 2.1.0.
|
|
@@ -1632,7 +1834,9 @@ module Tinkerforge
|
|
|
1632
1834
|
#
|
|
1633
1835
|
# .. versionadded:: 2.4.2$nbsp;(Firmware)
|
|
1634
1836
|
def set_wifi2_mesh_router_password(password)
|
|
1635
|
-
|
|
1837
|
+
check_validity
|
|
1838
|
+
|
|
1839
|
+
send_request FUNCTION_SET_WIFI2_MESH_ROUTER_PASSWORD, [password], 'Z64', 8, ''
|
|
1636
1840
|
end
|
|
1637
1841
|
|
|
1638
1842
|
# Requires WIFI Extension 2.0 firmware 2.1.0.
|
|
@@ -1641,7 +1845,9 @@ module Tinkerforge
|
|
|
1641
1845
|
#
|
|
1642
1846
|
# .. versionadded:: 2.4.2$nbsp;(Firmware)
|
|
1643
1847
|
def get_wifi2_mesh_router_password
|
|
1644
|
-
|
|
1848
|
+
check_validity
|
|
1849
|
+
|
|
1850
|
+
send_request FUNCTION_GET_WIFI2_MESH_ROUTER_PASSWORD, [], '', 72, 'Z64'
|
|
1645
1851
|
end
|
|
1646
1852
|
|
|
1647
1853
|
# Requires WIFI Extension 2.0 firmware 2.1.0.
|
|
@@ -1650,7 +1856,9 @@ module Tinkerforge
|
|
|
1650
1856
|
#
|
|
1651
1857
|
# .. versionadded:: 2.4.2$nbsp;(Firmware)
|
|
1652
1858
|
def get_wifi2_mesh_common_status
|
|
1653
|
-
|
|
1859
|
+
check_validity
|
|
1860
|
+
|
|
1861
|
+
send_request FUNCTION_GET_WIFI2_MESH_COMMON_STATUS, [], '', 21, 'C ? ? S L L'
|
|
1654
1862
|
end
|
|
1655
1863
|
|
|
1656
1864
|
# Requires WIFI Extension 2.0 firmware 2.1.0.
|
|
@@ -1659,7 +1867,9 @@ module Tinkerforge
|
|
|
1659
1867
|
#
|
|
1660
1868
|
# .. versionadded:: 2.4.2$nbsp;(Firmware)
|
|
1661
1869
|
def get_wifi2_mesh_client_status
|
|
1662
|
-
|
|
1870
|
+
check_validity
|
|
1871
|
+
|
|
1872
|
+
send_request FUNCTION_GET_WIFI2_MESH_CLIENT_STATUS, [], '', 58, 'Z32 C4 C4 C4 C6'
|
|
1663
1873
|
end
|
|
1664
1874
|
|
|
1665
1875
|
# Requires WIFI Extension 2.0 firmware 2.1.0.
|
|
@@ -1668,15 +1878,74 @@ module Tinkerforge
|
|
|
1668
1878
|
#
|
|
1669
1879
|
# .. versionadded:: 2.4.2$nbsp;(Firmware)
|
|
1670
1880
|
def get_wifi2_mesh_ap_status
|
|
1671
|
-
|
|
1881
|
+
check_validity
|
|
1882
|
+
|
|
1883
|
+
send_request FUNCTION_GET_WIFI2_MESH_AP_STATUS, [], '', 58, 'Z32 C4 C4 C4 C6'
|
|
1884
|
+
end
|
|
1885
|
+
|
|
1886
|
+
# This function is for internal use to flash the initial
|
|
1887
|
+
# bootstrapper and bootloader to the Bricklets.
|
|
1888
|
+
#
|
|
1889
|
+
# If you need to flash a boostrapper/bootloader (for exmaple
|
|
1890
|
+
# because you made your own Bricklet from scratch) please
|
|
1891
|
+
# take a look at our open source flash and test tool at
|
|
1892
|
+
# `https://github.com/Tinkerforge/flash-test <https://github.com/Tinkerforge/flash-test>`__
|
|
1893
|
+
#
|
|
1894
|
+
# Don't use this function directly.
|
|
1895
|
+
#
|
|
1896
|
+
# .. versionadded:: 2.5.0$nbsp;(Firmware)
|
|
1897
|
+
def set_bricklet_xmc_flash_config(config, parameter1, parameter2, data)
|
|
1898
|
+
check_validity
|
|
1899
|
+
|
|
1900
|
+
send_request FUNCTION_SET_BRICKLET_XMC_FLASH_CONFIG, [config, parameter1, parameter2, data], 'L L L C52', 72, 'L C60'
|
|
1901
|
+
end
|
|
1902
|
+
|
|
1903
|
+
# This function is for internal use to flash the initial
|
|
1904
|
+
# bootstrapper and bootloader to the Bricklets.
|
|
1905
|
+
#
|
|
1906
|
+
# If you need to flash a boostrapper/bootloader (for exmaple
|
|
1907
|
+
# because you made your own Bricklet from scratch) please
|
|
1908
|
+
# take a look at our open source flash and test tool at
|
|
1909
|
+
# `https://github.com/Tinkerforge/flash-test <https://github.com/Tinkerforge/flash-test>`__
|
|
1910
|
+
#
|
|
1911
|
+
# Don't use this function directly.
|
|
1912
|
+
#
|
|
1913
|
+
# .. versionadded:: 2.5.0$nbsp;(Firmware)
|
|
1914
|
+
def set_bricklet_xmc_flash_data(data)
|
|
1915
|
+
check_validity
|
|
1916
|
+
|
|
1917
|
+
send_request FUNCTION_SET_BRICKLET_XMC_FLASH_DATA, [data], 'C64', 12, 'L'
|
|
1918
|
+
end
|
|
1919
|
+
|
|
1920
|
+
# This function is only available in Master Brick hardware version >= 3.0.
|
|
1921
|
+
#
|
|
1922
|
+
# Enables/disables all four Bricklets if set to true/false.
|
|
1923
|
+
#
|
|
1924
|
+
# If you disable the Bricklets the power supply to the Bricklets will be disconnected.
|
|
1925
|
+
# The Bricklets will lose all configurations if disabled.
|
|
1926
|
+
#
|
|
1927
|
+
# .. versionadded:: 2.5.0$nbsp;(Firmware)
|
|
1928
|
+
def set_bricklets_enabled(bricklets_enabled)
|
|
1929
|
+
check_validity
|
|
1930
|
+
|
|
1931
|
+
send_request FUNCTION_SET_BRICKLETS_ENABLED, [bricklets_enabled], '?', 8, ''
|
|
1932
|
+
end
|
|
1933
|
+
|
|
1934
|
+
# Returns *true* if the Bricklets are enabled, *false* otherwise.
|
|
1935
|
+
#
|
|
1936
|
+
# .. versionadded:: 2.5.0$nbsp;(Firmware)
|
|
1937
|
+
def get_bricklets_enabled
|
|
1938
|
+
check_validity
|
|
1939
|
+
|
|
1940
|
+
send_request FUNCTION_GET_BRICKLETS_ENABLED, [], '', 9, '?'
|
|
1672
1941
|
end
|
|
1673
1942
|
|
|
1674
1943
|
# The SPITF protocol can be used with a dynamic baudrate. If the dynamic baudrate is
|
|
1675
1944
|
# enabled, the Brick will try to adapt the baudrate for the communication
|
|
1676
1945
|
# between Bricks and Bricklets according to the amount of data that is transferred.
|
|
1677
1946
|
#
|
|
1678
|
-
# The baudrate will be increased exponentially if lots of data is
|
|
1679
|
-
# decreased linearly if little data is
|
|
1947
|
+
# The baudrate will be increased exponentially if lots of data is sent/received and
|
|
1948
|
+
# decreased linearly if little data is sent/received.
|
|
1680
1949
|
#
|
|
1681
1950
|
# This lowers the baudrate in applications where little data is transferred (e.g.
|
|
1682
1951
|
# a weather station) and increases the robustness. If there is lots of data to transfer
|
|
@@ -1690,20 +1959,20 @@ module Tinkerforge
|
|
|
1690
1959
|
# BrickMaster#set_spitfp_baudrate. If the dynamic baudrate is disabled, the baudrate
|
|
1691
1960
|
# as set by BrickMaster#set_spitfp_baudrate will be used statically.
|
|
1692
1961
|
#
|
|
1693
|
-
# The minimum dynamic baudrate has a value range of 400000 to 2000000 baud.
|
|
1694
|
-
#
|
|
1695
|
-
# By default dynamic baudrate is enabled and the minimum dynamic baudrate is 400000.
|
|
1696
|
-
#
|
|
1697
1962
|
# .. versionadded:: 2.4.6$nbsp;(Firmware)
|
|
1698
1963
|
def set_spitfp_baudrate_config(enable_dynamic_baudrate, minimum_dynamic_baudrate)
|
|
1699
|
-
|
|
1964
|
+
check_validity
|
|
1965
|
+
|
|
1966
|
+
send_request FUNCTION_SET_SPITFP_BAUDRATE_CONFIG, [enable_dynamic_baudrate, minimum_dynamic_baudrate], '? L', 8, ''
|
|
1700
1967
|
end
|
|
1701
1968
|
|
|
1702
1969
|
# Returns the baudrate config, see BrickMaster#set_spitfp_baudrate_config.
|
|
1703
1970
|
#
|
|
1704
1971
|
# .. versionadded:: 2.4.6$nbsp;(Firmware)
|
|
1705
1972
|
def get_spitfp_baudrate_config
|
|
1706
|
-
|
|
1973
|
+
check_validity
|
|
1974
|
+
|
|
1975
|
+
send_request FUNCTION_GET_SPITFP_BAUDRATE_CONFIG, [], '', 13, '? L'
|
|
1707
1976
|
end
|
|
1708
1977
|
|
|
1709
1978
|
# Returns the timeout count for the different communication methods.
|
|
@@ -1715,11 +1984,12 @@ module Tinkerforge
|
|
|
1715
1984
|
#
|
|
1716
1985
|
# .. versionadded:: 2.4.3$nbsp;(Firmware)
|
|
1717
1986
|
def get_send_timeout_count(communication_method)
|
|
1718
|
-
|
|
1987
|
+
check_validity
|
|
1988
|
+
|
|
1989
|
+
send_request FUNCTION_GET_SEND_TIMEOUT_COUNT, [communication_method], 'C', 12, 'L'
|
|
1719
1990
|
end
|
|
1720
1991
|
|
|
1721
|
-
# Sets the baudrate for a specific Bricklet port
|
|
1722
|
-
# baudrate can be in the range 400000 to 2000000.
|
|
1992
|
+
# Sets the baudrate for a specific Bricklet port.
|
|
1723
1993
|
#
|
|
1724
1994
|
# If you want to increase the throughput of Bricklets you can increase
|
|
1725
1995
|
# the baudrate. If you get a high error count because of high
|
|
@@ -1730,21 +2000,23 @@ module Tinkerforge
|
|
|
1730
2000
|
# function corresponds to the maximum baudrate (see BrickMaster#set_spitfp_baudrate_config).
|
|
1731
2001
|
#
|
|
1732
2002
|
# Regulatory testing is done with the default baudrate. If CE compatibility
|
|
1733
|
-
# or similar is necessary in
|
|
2003
|
+
# or similar is necessary in your applications we recommend to not change
|
|
1734
2004
|
# the baudrate.
|
|
1735
2005
|
#
|
|
1736
|
-
# The default baudrate for all ports is 1400000.
|
|
1737
|
-
#
|
|
1738
2006
|
# .. versionadded:: 2.4.3$nbsp;(Firmware)
|
|
1739
2007
|
def set_spitfp_baudrate(bricklet_port, baudrate)
|
|
1740
|
-
|
|
2008
|
+
check_validity
|
|
2009
|
+
|
|
2010
|
+
send_request FUNCTION_SET_SPITFP_BAUDRATE, [bricklet_port, baudrate], 'k L', 8, ''
|
|
1741
2011
|
end
|
|
1742
2012
|
|
|
1743
2013
|
# Returns the baudrate for a given Bricklet port, see BrickMaster#set_spitfp_baudrate.
|
|
1744
2014
|
#
|
|
1745
2015
|
# .. versionadded:: 2.4.3$nbsp;(Firmware)
|
|
1746
2016
|
def get_spitfp_baudrate(bricklet_port)
|
|
1747
|
-
|
|
2017
|
+
check_validity
|
|
2018
|
+
|
|
2019
|
+
send_request FUNCTION_GET_SPITFP_BAUDRATE, [bricklet_port], 'k', 12, 'L'
|
|
1748
2020
|
end
|
|
1749
2021
|
|
|
1750
2022
|
# Returns the error count for the communication between Brick and Bricklet.
|
|
@@ -1761,7 +2033,9 @@ module Tinkerforge
|
|
|
1761
2033
|
#
|
|
1762
2034
|
# .. versionadded:: 2.4.3$nbsp;(Firmware)
|
|
1763
2035
|
def get_spitfp_error_count(bricklet_port)
|
|
1764
|
-
|
|
2036
|
+
check_validity
|
|
2037
|
+
|
|
2038
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [bricklet_port], 'k', 24, 'L L L L'
|
|
1765
2039
|
end
|
|
1766
2040
|
|
|
1767
2041
|
# Enables the status LED.
|
|
@@ -1773,7 +2047,9 @@ module Tinkerforge
|
|
|
1773
2047
|
#
|
|
1774
2048
|
# .. versionadded:: 2.3.2$nbsp;(Firmware)
|
|
1775
2049
|
def enable_status_led
|
|
1776
|
-
|
|
2050
|
+
check_validity
|
|
2051
|
+
|
|
2052
|
+
send_request FUNCTION_ENABLE_STATUS_LED, [], '', 8, ''
|
|
1777
2053
|
end
|
|
1778
2054
|
|
|
1779
2055
|
# Disables the status LED.
|
|
@@ -1785,14 +2061,18 @@ module Tinkerforge
|
|
|
1785
2061
|
#
|
|
1786
2062
|
# .. versionadded:: 2.3.2$nbsp;(Firmware)
|
|
1787
2063
|
def disable_status_led
|
|
1788
|
-
|
|
2064
|
+
check_validity
|
|
2065
|
+
|
|
2066
|
+
send_request FUNCTION_DISABLE_STATUS_LED, [], '', 8, ''
|
|
1789
2067
|
end
|
|
1790
2068
|
|
|
1791
2069
|
# Returns *true* if the status LED is enabled, *false* otherwise.
|
|
1792
2070
|
#
|
|
1793
2071
|
# .. versionadded:: 2.3.2$nbsp;(Firmware)
|
|
1794
2072
|
def is_status_led_enabled
|
|
1795
|
-
|
|
2073
|
+
check_validity
|
|
2074
|
+
|
|
2075
|
+
send_request FUNCTION_IS_STATUS_LED_ENABLED, [], '', 9, '?'
|
|
1796
2076
|
end
|
|
1797
2077
|
|
|
1798
2078
|
# Returns the firmware and protocol version and the name of the Bricklet for a
|
|
@@ -1801,17 +2081,21 @@ module Tinkerforge
|
|
|
1801
2081
|
# This functions sole purpose is to allow automatic flashing of v1.x.y Bricklet
|
|
1802
2082
|
# plugins.
|
|
1803
2083
|
def get_protocol1_bricklet_name(port)
|
|
1804
|
-
|
|
2084
|
+
check_validity
|
|
2085
|
+
|
|
2086
|
+
send_request FUNCTION_GET_PROTOCOL1_BRICKLET_NAME, [port], 'k', 52, 'C C3 Z40'
|
|
1805
2087
|
end
|
|
1806
2088
|
|
|
1807
|
-
# Returns the temperature
|
|
2089
|
+
# Returns the temperature as measured inside the microcontroller. The
|
|
1808
2090
|
# value returned is not the ambient temperature!
|
|
1809
2091
|
#
|
|
1810
2092
|
# The temperature is only proportional to the real temperature and it has an
|
|
1811
2093
|
# accuracy of ±15%. Practically it is only useful as an indicator for
|
|
1812
2094
|
# temperature changes.
|
|
1813
2095
|
def get_chip_temperature
|
|
1814
|
-
|
|
2096
|
+
check_validity
|
|
2097
|
+
|
|
2098
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
|
1815
2099
|
end
|
|
1816
2100
|
|
|
1817
2101
|
# Calling this function will reset the Brick. Calling this function
|
|
@@ -1821,19 +2105,43 @@ module Tinkerforge
|
|
|
1821
2105
|
# calling functions on the existing ones will result in
|
|
1822
2106
|
# undefined behavior!
|
|
1823
2107
|
def reset
|
|
1824
|
-
|
|
2108
|
+
check_validity
|
|
2109
|
+
|
|
2110
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
|
2111
|
+
end
|
|
2112
|
+
|
|
2113
|
+
# Writes 32 bytes of firmware to the bricklet attached at the given port.
|
|
2114
|
+
# The bytes are written to the position offset * 32.
|
|
2115
|
+
#
|
|
2116
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
|
2117
|
+
# necessary to call it in a normal user program.
|
|
2118
|
+
def write_bricklet_plugin(port, offset, chunk)
|
|
2119
|
+
check_validity
|
|
2120
|
+
|
|
2121
|
+
send_request FUNCTION_WRITE_BRICKLET_PLUGIN, [port, offset, chunk], 'k C C32', 8, ''
|
|
2122
|
+
end
|
|
2123
|
+
|
|
2124
|
+
# Reads 32 bytes of firmware from the bricklet attached at the given port.
|
|
2125
|
+
# The bytes are read starting at the position offset * 32.
|
|
2126
|
+
#
|
|
2127
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
|
2128
|
+
# necessary to call it in a normal user program.
|
|
2129
|
+
def read_bricklet_plugin(port, offset)
|
|
2130
|
+
check_validity
|
|
2131
|
+
|
|
2132
|
+
send_request FUNCTION_READ_BRICKLET_PLUGIN, [port, offset], 'k C', 40, 'C32'
|
|
1825
2133
|
end
|
|
1826
2134
|
|
|
1827
2135
|
# Returns the UID, the UID where the Brick is connected to,
|
|
1828
2136
|
# the position, the hardware and firmware version as well as the
|
|
1829
2137
|
# device identifier.
|
|
1830
2138
|
#
|
|
1831
|
-
# The position
|
|
2139
|
+
# The position is the position in the stack from '0' (bottom) to '8' (top).
|
|
1832
2140
|
#
|
|
1833
2141
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
1834
2142
|
# |device_identifier_constant|
|
|
1835
2143
|
def get_identity
|
|
1836
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
2144
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
1837
2145
|
end
|
|
1838
2146
|
|
|
1839
2147
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|