tinkerforge 2.1.24 → 2.1.29
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/tinkerforge/brick_dc.rb +156 -75
- data/lib/tinkerforge/brick_hat.rb +69 -31
- data/lib/tinkerforge/brick_hat_zero.rb +55 -23
- data/lib/tinkerforge/brick_imu.rb +185 -78
- data/lib/tinkerforge/brick_imu_v2.rb +209 -106
- data/lib/tinkerforge/brick_master.rb +491 -183
- data/lib/tinkerforge/brick_red.rb +197 -74
- data/lib/tinkerforge/brick_servo.rb +186 -102
- data/lib/tinkerforge/brick_silent_stepper.rb +247 -167
- data/lib/tinkerforge/brick_stepper.rb +211 -99
- data/lib/tinkerforge/bricklet_accelerometer.rb +57 -23
- data/lib/tinkerforge/bricklet_accelerometer_v2.rb +104 -54
- data/lib/tinkerforge/bricklet_air_quality.rb +116 -59
- data/lib/tinkerforge/bricklet_ambient_light.rb +50 -21
- data/lib/tinkerforge/bricklet_ambient_light_v2.rb +44 -24
- data/lib/tinkerforge/bricklet_ambient_light_v3.rb +65 -27
- data/lib/tinkerforge/bricklet_analog_in.rb +62 -25
- data/lib/tinkerforge/bricklet_analog_in_v2.rb +56 -23
- data/lib/tinkerforge/bricklet_analog_in_v3.rb +66 -25
- data/lib/tinkerforge/bricklet_analog_out.rb +22 -9
- data/lib/tinkerforge/bricklet_analog_out_v2.rb +19 -8
- data/lib/tinkerforge/bricklet_analog_out_v3.rb +53 -20
- data/lib/tinkerforge/bricklet_barometer.rb +100 -27
- data/lib/tinkerforge/bricklet_barometer_v2.rb +98 -37
- data/lib/tinkerforge/bricklet_can.rb +83 -19
- data/lib/tinkerforge/bricklet_can_v2.rb +171 -38
- data/lib/tinkerforge/bricklet_co2.rb +33 -14
- data/lib/tinkerforge/bricklet_co2_v2.rb +97 -38
- data/lib/tinkerforge/bricklet_color.rb +68 -27
- data/lib/tinkerforge/bricklet_color_v2.rb +86 -33
- data/lib/tinkerforge/bricklet_compass.rb +77 -30
- data/lib/tinkerforge/bricklet_current12.rb +57 -24
- data/lib/tinkerforge/bricklet_current25.rb +57 -24
- data/lib/tinkerforge/bricklet_dc_v2.rb +521 -0
- data/lib/tinkerforge/bricklet_distance_ir.rb +56 -23
- data/lib/tinkerforge/bricklet_distance_ir_v2.rb +82 -31
- data/lib/tinkerforge/bricklet_distance_us.rb +39 -16
- data/lib/tinkerforge/bricklet_distance_us_v2.rb +66 -25
- data/lib/tinkerforge/bricklet_dmx.rb +87 -34
- data/lib/tinkerforge/bricklet_dual_button.rb +23 -10
- data/lib/tinkerforge/bricklet_dual_button_v2.rb +63 -24
- data/lib/tinkerforge/bricklet_dual_relay.rb +26 -11
- data/lib/tinkerforge/bricklet_dust_detector.rb +39 -16
- data/lib/tinkerforge/bricklet_e_paper_296x128.rb +87 -32
- data/lib/tinkerforge/bricklet_energy_monitor.rb +72 -27
- data/lib/tinkerforge/bricklet_gps.rb +63 -26
- data/lib/tinkerforge/bricklet_gps_v2.rb +116 -47
- data/lib/tinkerforge/bricklet_hall_effect.rb +42 -23
- data/lib/tinkerforge/bricklet_hall_effect_v2.rb +70 -27
- data/lib/tinkerforge/bricklet_humidity.rb +50 -21
- data/lib/tinkerforge/bricklet_humidity_v2.rb +82 -31
- data/lib/tinkerforge/bricklet_imu_v3.rb +784 -0
- data/lib/tinkerforge/bricklet_industrial_analog_out.rb +37 -14
- data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +80 -29
- data/lib/tinkerforge/bricklet_industrial_counter.rb +100 -39
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +44 -17
- data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +76 -29
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +35 -14
- data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +72 -27
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +39 -16
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +79 -30
- data/lib/tinkerforge/bricklet_industrial_dual_ac_relay.rb +325 -0
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +48 -19
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +137 -31
- data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +60 -23
- data/lib/tinkerforge/bricklet_industrial_ptc.rb +475 -0
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +35 -14
- data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +66 -25
- data/lib/tinkerforge/bricklet_io16.rb +54 -21
- data/lib/tinkerforge/bricklet_io16_v2.rb +89 -34
- data/lib/tinkerforge/bricklet_io4.rb +54 -23
- data/lib/tinkerforge/bricklet_io4_v2.rb +95 -36
- data/lib/tinkerforge/bricklet_isolator.rb +72 -29
- data/lib/tinkerforge/bricklet_joystick.rb +58 -25
- data/lib/tinkerforge/bricklet_joystick_v2.rb +67 -26
- data/lib/tinkerforge/bricklet_laser_range_finder.rb +81 -32
- data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +95 -36
- data/lib/tinkerforge/bricklet_lcd_128x64.rb +191 -70
- data/lib/tinkerforge/bricklet_lcd_16x2.rb +44 -18
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +57 -23
- data/lib/tinkerforge/bricklet_led_strip.rb +59 -22
- data/lib/tinkerforge/bricklet_led_strip_v2.rb +90 -46
- data/lib/tinkerforge/bricklet_line.rb +33 -14
- data/lib/tinkerforge/bricklet_linear_poti.rb +50 -21
- data/lib/tinkerforge/bricklet_linear_poti_v2.rb +54 -21
- data/lib/tinkerforge/bricklet_load_cell.rb +60 -23
- data/lib/tinkerforge/bricklet_load_cell_v2.rb +79 -30
- data/lib/tinkerforge/bricklet_moisture.rb +39 -16
- data/lib/tinkerforge/bricklet_motion_detector.rb +21 -10
- data/lib/tinkerforge/bricklet_motion_detector_v2.rb +61 -27
- data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +70 -27
- data/lib/tinkerforge/bricklet_multi_touch.rb +30 -13
- data/lib/tinkerforge/bricklet_multi_touch_v2.rb +75 -28
- data/lib/tinkerforge/bricklet_nfc.rb +126 -62
- data/lib/tinkerforge/bricklet_nfc_rfid.rb +32 -13
- data/lib/tinkerforge/bricklet_oled_128x64.rb +28 -11
- data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +65 -24
- data/lib/tinkerforge/bricklet_oled_64x48.rb +28 -11
- data/lib/tinkerforge/bricklet_one_wire.rb +65 -24
- data/lib/tinkerforge/bricklet_outdoor_weather.rb +71 -28
- data/lib/tinkerforge/bricklet_particulate_matter.rb +74 -30
- data/lib/tinkerforge/bricklet_performance_dc.rb +682 -0
- data/lib/tinkerforge/bricklet_piezo_buzzer.rb +18 -9
- data/lib/tinkerforge/bricklet_piezo_speaker.rb +21 -10
- data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +79 -42
- data/lib/tinkerforge/bricklet_ptc.rb +73 -42
- data/lib/tinkerforge/bricklet_ptc_v2.rb +94 -48
- data/lib/tinkerforge/bricklet_real_time_clock.rb +44 -33
- data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +77 -44
- data/lib/tinkerforge/bricklet_remote_switch.rb +38 -29
- data/lib/tinkerforge/bricklet_remote_switch_v2.rb +86 -49
- data/lib/tinkerforge/bricklet_rgb_led.rb +17 -8
- data/lib/tinkerforge/bricklet_rgb_led_button.rb +61 -30
- data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +78 -33
- data/lib/tinkerforge/bricklet_rgb_led_v2.rb +51 -20
- data/lib/tinkerforge/bricklet_rotary_encoder.rb +38 -19
- data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +59 -24
- data/lib/tinkerforge/bricklet_rotary_poti.rb +52 -28
- data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +56 -23
- data/lib/tinkerforge/bricklet_rs232.rb +89 -28
- data/lib/tinkerforge/bricklet_rs232_v2.rb +117 -44
- data/lib/tinkerforge/bricklet_rs485.rb +222 -95
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
- data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +74 -35
- data/lib/tinkerforge/bricklet_servo_v2.rb +565 -0
- data/lib/tinkerforge/bricklet_silent_stepper_v2.rb +1024 -0
- data/lib/tinkerforge/bricklet_solid_state_relay.rb +24 -13
- data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +58 -25
- data/lib/tinkerforge/bricklet_sound_intensity.rb +34 -18
- data/lib/tinkerforge/bricklet_sound_pressure_level.rb +71 -31
- data/lib/tinkerforge/bricklet_temperature.rb +39 -16
- data/lib/tinkerforge/bricklet_temperature_ir.rb +56 -23
- data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +70 -27
- data/lib/tinkerforge/bricklet_temperature_v2.rb +60 -25
- data/lib/tinkerforge/bricklet_thermal_imaging.rb +104 -44
- data/lib/tinkerforge/bricklet_thermocouple.rb +44 -24
- data/lib/tinkerforge/bricklet_thermocouple_v2.rb +64 -27
- data/lib/tinkerforge/bricklet_tilt.rb +23 -10
- data/lib/tinkerforge/bricklet_uv_light.rb +35 -18
- data/lib/tinkerforge/bricklet_uv_light_v2.rb +84 -37
- data/lib/tinkerforge/bricklet_voltage.rb +51 -28
- data/lib/tinkerforge/bricklet_voltage_current.rb +90 -73
- data/lib/tinkerforge/bricklet_voltage_current_v2.rb +89 -68
- data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +79 -30
- data/lib/tinkerforge/device_display_names.rb +170 -0
- data/lib/tinkerforge/ip_connection.rb +153 -33
- data/lib/tinkerforge/version.rb +1 -1
- metadata +11 -3
@@ -1,14 +1,16 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on
|
3
|
+
# This file was automatically generated on 2021-05-06. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.29 #
|
6
6
|
# #
|
7
7
|
# If you have a bugfix for this file and want to commit it, #
|
8
8
|
# please fix the bug in the generator. You can find a link #
|
9
9
|
# to the generators git repository on tinkerforge.com #
|
10
10
|
#############################################################
|
11
11
|
|
12
|
+
require_relative './ip_connection'
|
13
|
+
|
12
14
|
module Tinkerforge
|
13
15
|
# Measures distance between 2cm and 400cm with ultrasound
|
14
16
|
class BrickletDistanceUS < Device
|
@@ -51,7 +53,7 @@ module Tinkerforge
|
|
51
53
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
52
54
|
# the IP Connection <tt>ipcon</tt>.
|
53
55
|
def initialize(uid, ipcon)
|
54
|
-
super uid, ipcon
|
56
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
55
57
|
|
56
58
|
@api_version = [2, 0, 1]
|
57
59
|
|
@@ -66,9 +68,10 @@ module Tinkerforge
|
|
66
68
|
@response_expected[FUNCTION_GET_MOVING_AVERAGE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
67
69
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
68
70
|
|
69
|
-
@callback_formats[CALLBACK_DISTANCE] = 'S'
|
70
|
-
@callback_formats[CALLBACK_DISTANCE_REACHED] = 'S'
|
71
|
+
@callback_formats[CALLBACK_DISTANCE] = [10, 'S']
|
72
|
+
@callback_formats[CALLBACK_DISTANCE_REACHED] = [10, 'S']
|
71
73
|
|
74
|
+
@ipcon.add_device self
|
72
75
|
end
|
73
76
|
|
74
77
|
# Returns the current distance value measured by the sensor.
|
@@ -82,7 +85,9 @@ module Tinkerforge
|
|
82
85
|
# use the CALLBACK_DISTANCE callback and set the period with
|
83
86
|
# BrickletDistanceUS#set_distance_callback_period.
|
84
87
|
def get_distance_value
|
85
|
-
|
88
|
+
check_validity
|
89
|
+
|
90
|
+
send_request FUNCTION_GET_DISTANCE_VALUE, [], '', 10, 'S'
|
86
91
|
end
|
87
92
|
|
88
93
|
# Sets the period with which the CALLBACK_DISTANCE callback is triggered
|
@@ -91,12 +96,16 @@ module Tinkerforge
|
|
91
96
|
# Der CALLBACK_DISTANCE callback is only triggered if the distance value has changed
|
92
97
|
# since the last triggering.
|
93
98
|
def set_distance_callback_period(period)
|
94
|
-
|
99
|
+
check_validity
|
100
|
+
|
101
|
+
send_request FUNCTION_SET_DISTANCE_CALLBACK_PERIOD, [period], 'L', 8, ''
|
95
102
|
end
|
96
103
|
|
97
104
|
# Returns the period as set by BrickletDistanceUS#set_distance_callback_period.
|
98
105
|
def get_distance_callback_period
|
99
|
-
|
106
|
+
check_validity
|
107
|
+
|
108
|
+
send_request FUNCTION_GET_DISTANCE_CALLBACK_PERIOD, [], '', 12, 'L'
|
100
109
|
end
|
101
110
|
|
102
111
|
# Sets the thresholds for the CALLBACK_DISTANCE_REACHED callback.
|
@@ -111,12 +120,16 @@ module Tinkerforge
|
|
111
120
|
# "'<'", "Callback is triggered when the distance value is smaller than the min value (max is ignored)"
|
112
121
|
# "'>'", "Callback is triggered when the distance value is greater than the min value (max is ignored)"
|
113
122
|
def set_distance_callback_threshold(option, min, max)
|
114
|
-
|
123
|
+
check_validity
|
124
|
+
|
125
|
+
send_request FUNCTION_SET_DISTANCE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
|
115
126
|
end
|
116
127
|
|
117
128
|
# Returns the threshold as set by BrickletDistanceUS#set_distance_callback_threshold.
|
118
129
|
def get_distance_callback_threshold
|
119
|
-
|
130
|
+
check_validity
|
131
|
+
|
132
|
+
send_request FUNCTION_GET_DISTANCE_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
|
120
133
|
end
|
121
134
|
|
122
135
|
# Sets the period with which the threshold callbacks
|
@@ -129,12 +142,16 @@ module Tinkerforge
|
|
129
142
|
#
|
130
143
|
# keep being reached.
|
131
144
|
def set_debounce_period(debounce)
|
132
|
-
|
145
|
+
check_validity
|
146
|
+
|
147
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
|
133
148
|
end
|
134
149
|
|
135
150
|
# Returns the debounce period as set by BrickletDistanceUS#set_debounce_period.
|
136
151
|
def get_debounce_period
|
137
|
-
|
152
|
+
check_validity
|
153
|
+
|
154
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
|
138
155
|
end
|
139
156
|
|
140
157
|
# Sets the length of a `moving averaging <https://en.wikipedia.org/wiki/Moving_average>`__
|
@@ -143,24 +160,30 @@ module Tinkerforge
|
|
143
160
|
# Setting the length to 0 will turn the averaging completely off. With less
|
144
161
|
# averaging, there is more noise on the data.
|
145
162
|
def set_moving_average(average)
|
146
|
-
|
163
|
+
check_validity
|
164
|
+
|
165
|
+
send_request FUNCTION_SET_MOVING_AVERAGE, [average], 'C', 8, ''
|
147
166
|
end
|
148
167
|
|
149
168
|
# Returns the length moving average as set by BrickletDistanceUS#set_moving_average.
|
150
169
|
def get_moving_average
|
151
|
-
|
170
|
+
check_validity
|
171
|
+
|
172
|
+
send_request FUNCTION_GET_MOVING_AVERAGE, [], '', 9, 'C'
|
152
173
|
end
|
153
174
|
|
154
175
|
# Returns the UID, the UID where the Bricklet is connected to,
|
155
176
|
# the position, the hardware and firmware version as well as the
|
156
177
|
# device identifier.
|
157
178
|
#
|
158
|
-
# The position can be 'a', 'b', 'c' or '
|
179
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
180
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
181
|
+
# position 'z'.
|
159
182
|
#
|
160
183
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
161
184
|
# |device_identifier_constant|
|
162
185
|
def get_identity
|
163
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
186
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
164
187
|
end
|
165
188
|
|
166
189
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|
@@ -1,14 +1,16 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on
|
3
|
+
# This file was automatically generated on 2021-05-06. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.29 #
|
6
6
|
# #
|
7
7
|
# If you have a bugfix for this file and want to commit it, #
|
8
8
|
# please fix the bug in the generator. You can find a link #
|
9
9
|
# to the generators git repository on tinkerforge.com #
|
10
10
|
#############################################################
|
11
11
|
|
12
|
+
require_relative './ip_connection'
|
13
|
+
|
12
14
|
module Tinkerforge
|
13
15
|
# Measures distance between 30cm and 500cm with ultrasound
|
14
16
|
class BrickletDistanceUSV2 < Device
|
@@ -71,7 +73,7 @@ module Tinkerforge
|
|
71
73
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
72
74
|
# the IP Connection <tt>ipcon</tt>.
|
73
75
|
def initialize(uid, ipcon)
|
74
|
-
super uid, ipcon
|
76
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
75
77
|
|
76
78
|
@api_version = [2, 0, 0]
|
77
79
|
|
@@ -95,8 +97,9 @@ module Tinkerforge
|
|
95
97
|
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
96
98
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
97
99
|
|
98
|
-
@callback_formats[CALLBACK_DISTANCE] = 'S'
|
100
|
+
@callback_formats[CALLBACK_DISTANCE] = [10, 'S']
|
99
101
|
|
102
|
+
@ipcon.add_device self
|
100
103
|
end
|
101
104
|
|
102
105
|
# Returns the distance.
|
@@ -106,7 +109,9 @@ module Tinkerforge
|
|
106
109
|
# CALLBACK_DISTANCE callback. You can set the callback configuration
|
107
110
|
# with BrickletDistanceUSV2#set_distance_callback_configuration.
|
108
111
|
def get_distance
|
109
|
-
|
112
|
+
check_validity
|
113
|
+
|
114
|
+
send_request FUNCTION_GET_DISTANCE, [], '', 10, 'S'
|
110
115
|
end
|
111
116
|
|
112
117
|
# The period is the period with which the CALLBACK_DISTANCE callback is triggered
|
@@ -135,12 +140,16 @@ module Tinkerforge
|
|
135
140
|
#
|
136
141
|
# If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
|
137
142
|
def set_distance_callback_configuration(period, value_has_to_change, option, min, max)
|
138
|
-
|
143
|
+
check_validity
|
144
|
+
|
145
|
+
send_request FUNCTION_SET_DISTANCE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k S S', 8, ''
|
139
146
|
end
|
140
147
|
|
141
148
|
# Returns the callback configuration as set by BrickletDistanceUSV2#set_distance_callback_configuration.
|
142
149
|
def get_distance_callback_configuration
|
143
|
-
|
150
|
+
check_validity
|
151
|
+
|
152
|
+
send_request FUNCTION_GET_DISTANCE_CALLBACK_CONFIGURATION, [], '', 18, 'L ? k S S'
|
144
153
|
end
|
145
154
|
|
146
155
|
# Sets the update rate to 2 Hz or 10 Hz.
|
@@ -148,23 +157,31 @@ module Tinkerforge
|
|
148
157
|
# With 2 Hz update rate the noise is about ±1mm, while with 10 Hz update rate the noise
|
149
158
|
# increases to about ±5mm.
|
150
159
|
def set_update_rate(update_rate)
|
151
|
-
|
160
|
+
check_validity
|
161
|
+
|
162
|
+
send_request FUNCTION_SET_UPDATE_RATE, [update_rate], 'C', 8, ''
|
152
163
|
end
|
153
164
|
|
154
165
|
# Returns the update rate as set by BrickletDistanceUSV2#set_update_rate.
|
155
166
|
def get_update_rate
|
156
|
-
|
167
|
+
check_validity
|
168
|
+
|
169
|
+
send_request FUNCTION_GET_UPDATE_RATE, [], '', 9, 'C'
|
157
170
|
end
|
158
171
|
|
159
172
|
# Configures the distance LED to be either turned off, turned on, blink in
|
160
173
|
# heartbeat mode or show the distance (brighter = object is nearer).
|
161
174
|
def set_distance_led_config(config)
|
162
|
-
|
175
|
+
check_validity
|
176
|
+
|
177
|
+
send_request FUNCTION_SET_DISTANCE_LED_CONFIG, [config], 'C', 8, ''
|
163
178
|
end
|
164
179
|
|
165
180
|
# Returns the LED configuration as set by BrickletDistanceUSV2#set_distance_led_config
|
166
181
|
def get_distance_led_config
|
167
|
-
|
182
|
+
check_validity
|
183
|
+
|
184
|
+
send_request FUNCTION_GET_DISTANCE_LED_CONFIG, [], '', 9, 'C'
|
168
185
|
end
|
169
186
|
|
170
187
|
# Returns the error count for the communication between Brick and Bricklet.
|
@@ -179,7 +196,9 @@ module Tinkerforge
|
|
179
196
|
# The errors counts are for errors that occur on the Bricklet side. All
|
180
197
|
# Bricks have a similar function that returns the errors on the Brick side.
|
181
198
|
def get_spitfp_error_count
|
182
|
-
|
199
|
+
check_validity
|
200
|
+
|
201
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
183
202
|
end
|
184
203
|
|
185
204
|
# Sets the bootloader mode and returns the status after the requested
|
@@ -192,12 +211,16 @@ module Tinkerforge
|
|
192
211
|
# This function is used by Brick Viewer during flashing. It should not be
|
193
212
|
# necessary to call it in a normal user program.
|
194
213
|
def set_bootloader_mode(mode)
|
195
|
-
|
214
|
+
check_validity
|
215
|
+
|
216
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
196
217
|
end
|
197
218
|
|
198
219
|
# Returns the current bootloader mode, see BrickletDistanceUSV2#set_bootloader_mode.
|
199
220
|
def get_bootloader_mode
|
200
|
-
|
221
|
+
check_validity
|
222
|
+
|
223
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
201
224
|
end
|
202
225
|
|
203
226
|
# Sets the firmware pointer for BrickletDistanceUSV2#write_firmware. The pointer has
|
@@ -207,7 +230,9 @@ module Tinkerforge
|
|
207
230
|
# This function is used by Brick Viewer during flashing. It should not be
|
208
231
|
# necessary to call it in a normal user program.
|
209
232
|
def set_write_firmware_pointer(pointer)
|
210
|
-
|
233
|
+
check_validity
|
234
|
+
|
235
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
211
236
|
end
|
212
237
|
|
213
238
|
# Writes 64 Bytes of firmware at the position as written by
|
@@ -219,7 +244,9 @@ module Tinkerforge
|
|
219
244
|
# This function is used by Brick Viewer during flashing. It should not be
|
220
245
|
# necessary to call it in a normal user program.
|
221
246
|
def write_firmware(data)
|
222
|
-
|
247
|
+
check_validity
|
248
|
+
|
249
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
223
250
|
end
|
224
251
|
|
225
252
|
# Sets the status LED configuration. By default the LED shows
|
@@ -230,22 +257,28 @@ module Tinkerforge
|
|
230
257
|
#
|
231
258
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
232
259
|
def set_status_led_config(config)
|
233
|
-
|
260
|
+
check_validity
|
261
|
+
|
262
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
234
263
|
end
|
235
264
|
|
236
265
|
# Returns the configuration as set by BrickletDistanceUSV2#set_status_led_config
|
237
266
|
def get_status_led_config
|
238
|
-
|
267
|
+
check_validity
|
268
|
+
|
269
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
239
270
|
end
|
240
271
|
|
241
|
-
# Returns the temperature
|
272
|
+
# Returns the temperature as measured inside the microcontroller. The
|
242
273
|
# value returned is not the ambient temperature!
|
243
274
|
#
|
244
275
|
# The temperature is only proportional to the real temperature and it has bad
|
245
276
|
# accuracy. Practically it is only useful as an indicator for
|
246
277
|
# temperature changes.
|
247
278
|
def get_chip_temperature
|
248
|
-
|
279
|
+
check_validity
|
280
|
+
|
281
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
249
282
|
end
|
250
283
|
|
251
284
|
# Calling this function will reset the Bricklet. All configurations
|
@@ -255,7 +288,9 @@ module Tinkerforge
|
|
255
288
|
# calling functions on the existing ones will result in
|
256
289
|
# undefined behavior!
|
257
290
|
def reset
|
258
|
-
|
291
|
+
check_validity
|
292
|
+
|
293
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
259
294
|
end
|
260
295
|
|
261
296
|
# Writes a new UID into flash. If you want to set a new UID
|
@@ -264,25 +299,31 @@ module Tinkerforge
|
|
264
299
|
#
|
265
300
|
# We recommend that you use Brick Viewer to change the UID.
|
266
301
|
def write_uid(uid)
|
267
|
-
|
302
|
+
check_validity
|
303
|
+
|
304
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
268
305
|
end
|
269
306
|
|
270
307
|
# Returns the current UID as an integer. Encode as
|
271
308
|
# Base58 to get the usual string version.
|
272
309
|
def read_uid
|
273
|
-
|
310
|
+
check_validity
|
311
|
+
|
312
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
274
313
|
end
|
275
314
|
|
276
315
|
# Returns the UID, the UID where the Bricklet is connected to,
|
277
316
|
# the position, the hardware and firmware version as well as the
|
278
317
|
# device identifier.
|
279
318
|
#
|
280
|
-
# The position can be 'a', 'b', 'c' or '
|
319
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
320
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
321
|
+
# position 'z'.
|
281
322
|
#
|
282
323
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
283
324
|
# |device_identifier_constant|
|
284
325
|
def get_identity
|
285
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
326
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
286
327
|
end
|
287
328
|
|
288
329
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|
@@ -1,14 +1,16 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on
|
3
|
+
# This file was automatically generated on 2021-05-06. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.29 #
|
6
6
|
# #
|
7
7
|
# If you have a bugfix for this file and want to commit it, #
|
8
8
|
# please fix the bug in the generator. You can find a link #
|
9
9
|
# to the generators git repository on tinkerforge.com #
|
10
10
|
#############################################################
|
11
11
|
|
12
|
+
require_relative './ip_connection'
|
13
|
+
|
12
14
|
module Tinkerforge
|
13
15
|
# DMX master and slave
|
14
16
|
class BrickletDMX < Device
|
@@ -113,7 +115,7 @@ module Tinkerforge
|
|
113
115
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
114
116
|
# the IP Connection <tt>ipcon</tt>.
|
115
117
|
def initialize(uid, ipcon)
|
116
|
-
super uid, ipcon
|
118
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
117
119
|
|
118
120
|
@api_version = [2, 0, 0]
|
119
121
|
|
@@ -143,24 +145,29 @@ module Tinkerforge
|
|
143
145
|
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
144
146
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
145
147
|
|
146
|
-
@callback_formats[CALLBACK_FRAME_STARTED] = ''
|
147
|
-
@callback_formats[CALLBACK_FRAME_AVAILABLE] = 'L'
|
148
|
-
@callback_formats[CALLBACK_FRAME_LOW_LEVEL] = 'S S C56 L'
|
149
|
-
@callback_formats[CALLBACK_FRAME_ERROR_COUNT] = 'L L'
|
148
|
+
@callback_formats[CALLBACK_FRAME_STARTED] = [8, '']
|
149
|
+
@callback_formats[CALLBACK_FRAME_AVAILABLE] = [12, 'L']
|
150
|
+
@callback_formats[CALLBACK_FRAME_LOW_LEVEL] = [72, 'S S C56 L']
|
151
|
+
@callback_formats[CALLBACK_FRAME_ERROR_COUNT] = [16, 'L L']
|
150
152
|
|
151
153
|
@high_level_callbacks[CALLBACK_FRAME] = [['stream_length', 'stream_chunk_offset', 'stream_chunk_data', nil], {'fixed_length' => nil, 'single_chunk' => false}, nil]
|
154
|
+
@ipcon.add_device self
|
152
155
|
end
|
153
156
|
|
154
157
|
# Sets the DMX mode to either master or slave.
|
155
158
|
#
|
156
159
|
# Calling this function sets frame number to 0.
|
157
160
|
def set_dmx_mode(dmx_mode)
|
158
|
-
|
161
|
+
check_validity
|
162
|
+
|
163
|
+
send_request FUNCTION_SET_DMX_MODE, [dmx_mode], 'C', 8, ''
|
159
164
|
end
|
160
165
|
|
161
166
|
# Returns the DMX mode, as set by BrickletDMX#set_dmx_mode.
|
162
167
|
def get_dmx_mode
|
163
|
-
|
168
|
+
check_validity
|
169
|
+
|
170
|
+
send_request FUNCTION_GET_DMX_MODE, [], '', 9, 'C'
|
164
171
|
end
|
165
172
|
|
166
173
|
# Writes a DMX frame. The maximum frame size is 512 byte. Each byte represents one channel.
|
@@ -184,7 +191,9 @@ module Tinkerforge
|
|
184
191
|
#
|
185
192
|
# This function can only be called in master mode.
|
186
193
|
def write_frame_low_level(frame_length, frame_chunk_offset, frame_chunk_data)
|
187
|
-
|
194
|
+
check_validity
|
195
|
+
|
196
|
+
send_request FUNCTION_WRITE_FRAME_LOW_LEVEL, [frame_length, frame_chunk_offset, frame_chunk_data], 'S S C60', 8, ''
|
188
197
|
end
|
189
198
|
|
190
199
|
# Returns the last frame that was written by the DMX master. The size of the array
|
@@ -207,7 +216,9 @@ module Tinkerforge
|
|
207
216
|
#
|
208
217
|
# This function can only be called in slave mode.
|
209
218
|
def read_frame_low_level
|
210
|
-
|
219
|
+
check_validity
|
220
|
+
|
221
|
+
send_request FUNCTION_READ_FRAME_LOW_LEVEL, [], '', 72, 'S S C56 L'
|
211
222
|
end
|
212
223
|
|
213
224
|
# Sets the duration of a frame.
|
@@ -220,17 +231,23 @@ module Tinkerforge
|
|
220
231
|
#
|
221
232
|
# This setting is only used in master mode.
|
222
233
|
def set_frame_duration(frame_duration)
|
223
|
-
|
234
|
+
check_validity
|
235
|
+
|
236
|
+
send_request FUNCTION_SET_FRAME_DURATION, [frame_duration], 'S', 8, ''
|
224
237
|
end
|
225
238
|
|
226
239
|
# Returns the frame duration as set by BrickletDMX#set_frame_duration.
|
227
240
|
def get_frame_duration
|
228
|
-
|
241
|
+
check_validity
|
242
|
+
|
243
|
+
send_request FUNCTION_GET_FRAME_DURATION, [], '', 10, 'S'
|
229
244
|
end
|
230
245
|
|
231
246
|
# Returns the current number of overrun and framing errors.
|
232
247
|
def get_frame_error_count
|
233
|
-
|
248
|
+
check_validity
|
249
|
+
|
250
|
+
send_request FUNCTION_GET_FRAME_ERROR_COUNT, [], '', 16, 'L L'
|
234
251
|
end
|
235
252
|
|
236
253
|
# Sets the communication LED configuration. By default the LED shows
|
@@ -240,12 +257,16 @@ module Tinkerforge
|
|
240
257
|
#
|
241
258
|
# If the Bricklet is in bootloader mode, the LED is off.
|
242
259
|
def set_communication_led_config(config)
|
243
|
-
|
260
|
+
check_validity
|
261
|
+
|
262
|
+
send_request FUNCTION_SET_COMMUNICATION_LED_CONFIG, [config], 'C', 8, ''
|
244
263
|
end
|
245
264
|
|
246
265
|
# Returns the configuration as set by BrickletDMX#set_communication_led_config
|
247
266
|
def get_communication_led_config
|
248
|
-
|
267
|
+
check_validity
|
268
|
+
|
269
|
+
send_request FUNCTION_GET_COMMUNICATION_LED_CONFIG, [], '', 9, 'C'
|
249
270
|
end
|
250
271
|
|
251
272
|
# Sets the error LED configuration.
|
@@ -258,12 +279,16 @@ module Tinkerforge
|
|
258
279
|
#
|
259
280
|
# If the Bricklet is in bootloader mode, the LED is off.
|
260
281
|
def set_error_led_config(config)
|
261
|
-
|
282
|
+
check_validity
|
283
|
+
|
284
|
+
send_request FUNCTION_SET_ERROR_LED_CONFIG, [config], 'C', 8, ''
|
262
285
|
end
|
263
286
|
|
264
287
|
# Returns the configuration as set by BrickletDMX#set_error_led_config.
|
265
288
|
def get_error_led_config
|
266
|
-
|
289
|
+
check_validity
|
290
|
+
|
291
|
+
send_request FUNCTION_GET_ERROR_LED_CONFIG, [], '', 9, 'C'
|
267
292
|
end
|
268
293
|
|
269
294
|
# Enables/Disables the different callbacks. By default the
|
@@ -274,12 +299,16 @@ module Tinkerforge
|
|
274
299
|
# the cb:`Frame Available` callback at the same time. It becomes redundant in
|
275
300
|
# this case.
|
276
301
|
def set_frame_callback_config(frame_started_callback_enabled, frame_available_callback_enabled, frame_callback_enabled, frame_error_count_callback_enabled)
|
277
|
-
|
302
|
+
check_validity
|
303
|
+
|
304
|
+
send_request FUNCTION_SET_FRAME_CALLBACK_CONFIG, [frame_started_callback_enabled, frame_available_callback_enabled, frame_callback_enabled, frame_error_count_callback_enabled], '? ? ? ?', 8, ''
|
278
305
|
end
|
279
306
|
|
280
307
|
# Returns the frame callback config as set by BrickletDMX#set_frame_callback_config.
|
281
308
|
def get_frame_callback_config
|
282
|
-
|
309
|
+
check_validity
|
310
|
+
|
311
|
+
send_request FUNCTION_GET_FRAME_CALLBACK_CONFIG, [], '', 12, '? ? ? ?'
|
283
312
|
end
|
284
313
|
|
285
314
|
# Returns the error count for the communication between Brick and Bricklet.
|
@@ -294,7 +323,9 @@ module Tinkerforge
|
|
294
323
|
# The errors counts are for errors that occur on the Bricklet side. All
|
295
324
|
# Bricks have a similar function that returns the errors on the Brick side.
|
296
325
|
def get_spitfp_error_count
|
297
|
-
|
326
|
+
check_validity
|
327
|
+
|
328
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
298
329
|
end
|
299
330
|
|
300
331
|
# Sets the bootloader mode and returns the status after the requested
|
@@ -307,12 +338,16 @@ module Tinkerforge
|
|
307
338
|
# This function is used by Brick Viewer during flashing. It should not be
|
308
339
|
# necessary to call it in a normal user program.
|
309
340
|
def set_bootloader_mode(mode)
|
310
|
-
|
341
|
+
check_validity
|
342
|
+
|
343
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
311
344
|
end
|
312
345
|
|
313
346
|
# Returns the current bootloader mode, see BrickletDMX#set_bootloader_mode.
|
314
347
|
def get_bootloader_mode
|
315
|
-
|
348
|
+
check_validity
|
349
|
+
|
350
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
316
351
|
end
|
317
352
|
|
318
353
|
# Sets the firmware pointer for BrickletDMX#write_firmware. The pointer has
|
@@ -322,7 +357,9 @@ module Tinkerforge
|
|
322
357
|
# This function is used by Brick Viewer during flashing. It should not be
|
323
358
|
# necessary to call it in a normal user program.
|
324
359
|
def set_write_firmware_pointer(pointer)
|
325
|
-
|
360
|
+
check_validity
|
361
|
+
|
362
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
326
363
|
end
|
327
364
|
|
328
365
|
# Writes 64 Bytes of firmware at the position as written by
|
@@ -334,7 +371,9 @@ module Tinkerforge
|
|
334
371
|
# This function is used by Brick Viewer during flashing. It should not be
|
335
372
|
# necessary to call it in a normal user program.
|
336
373
|
def write_firmware(data)
|
337
|
-
|
374
|
+
check_validity
|
375
|
+
|
376
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
338
377
|
end
|
339
378
|
|
340
379
|
# Sets the status LED configuration. By default the LED shows
|
@@ -345,22 +384,28 @@ module Tinkerforge
|
|
345
384
|
#
|
346
385
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
347
386
|
def set_status_led_config(config)
|
348
|
-
|
387
|
+
check_validity
|
388
|
+
|
389
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
349
390
|
end
|
350
391
|
|
351
392
|
# Returns the configuration as set by BrickletDMX#set_status_led_config
|
352
393
|
def get_status_led_config
|
353
|
-
|
394
|
+
check_validity
|
395
|
+
|
396
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
354
397
|
end
|
355
398
|
|
356
|
-
# Returns the temperature
|
399
|
+
# Returns the temperature as measured inside the microcontroller. The
|
357
400
|
# value returned is not the ambient temperature!
|
358
401
|
#
|
359
402
|
# The temperature is only proportional to the real temperature and it has bad
|
360
403
|
# accuracy. Practically it is only useful as an indicator for
|
361
404
|
# temperature changes.
|
362
405
|
def get_chip_temperature
|
363
|
-
|
406
|
+
check_validity
|
407
|
+
|
408
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
364
409
|
end
|
365
410
|
|
366
411
|
# Calling this function will reset the Bricklet. All configurations
|
@@ -370,7 +415,9 @@ module Tinkerforge
|
|
370
415
|
# calling functions on the existing ones will result in
|
371
416
|
# undefined behavior!
|
372
417
|
def reset
|
373
|
-
|
418
|
+
check_validity
|
419
|
+
|
420
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
374
421
|
end
|
375
422
|
|
376
423
|
# Writes a new UID into flash. If you want to set a new UID
|
@@ -379,25 +426,31 @@ module Tinkerforge
|
|
379
426
|
#
|
380
427
|
# We recommend that you use Brick Viewer to change the UID.
|
381
428
|
def write_uid(uid)
|
382
|
-
|
429
|
+
check_validity
|
430
|
+
|
431
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
383
432
|
end
|
384
433
|
|
385
434
|
# Returns the current UID as an integer. Encode as
|
386
435
|
# Base58 to get the usual string version.
|
387
436
|
def read_uid
|
388
|
-
|
437
|
+
check_validity
|
438
|
+
|
439
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
389
440
|
end
|
390
441
|
|
391
442
|
# Returns the UID, the UID where the Bricklet is connected to,
|
392
443
|
# the position, the hardware and firmware version as well as the
|
393
444
|
# device identifier.
|
394
445
|
#
|
395
|
-
# The position can be 'a', 'b', 'c' or '
|
446
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
447
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
448
|
+
# position 'z'.
|
396
449
|
#
|
397
450
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
398
451
|
# |device_identifier_constant|
|
399
452
|
def get_identity
|
400
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
453
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
401
454
|
end
|
402
455
|
|
403
456
|
# Writes a DMX frame. The maximum frame size is 512 byte. Each byte represents one channel.
|