tinkerforge 2.1.23 → 2.1.28
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 +109 -30
- data/lib/tinkerforge/brick_hat_zero.rb +119 -21
- data/lib/tinkerforge/brick_imu.rb +191 -86
- data/lib/tinkerforge/brick_imu_v2.rb +219 -118
- data/lib/tinkerforge/brick_master.rb +495 -195
- data/lib/tinkerforge/brick_red.rb +197 -74
- data/lib/tinkerforge/brick_servo.rb +186 -102
- data/lib/tinkerforge/brick_silent_stepper.rb +248 -168
- data/lib/tinkerforge/brick_stepper.rb +212 -100
- data/lib/tinkerforge/bricklet_accelerometer.rb +61 -36
- data/lib/tinkerforge/bricklet_accelerometer_v2.rb +107 -63
- data/lib/tinkerforge/bricklet_air_quality.rb +123 -76
- data/lib/tinkerforge/bricklet_ambient_light.rb +62 -46
- data/lib/tinkerforge/bricklet_ambient_light_v2.rb +41 -28
- data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -28
- data/lib/tinkerforge/bricklet_analog_in.rb +66 -45
- data/lib/tinkerforge/bricklet_analog_in_v2.rb +60 -43
- data/lib/tinkerforge/bricklet_analog_in_v3.rb +68 -32
- data/lib/tinkerforge/bricklet_analog_out.rb +25 -16
- data/lib/tinkerforge/bricklet_analog_out_v2.rb +21 -10
- data/lib/tinkerforge/bricklet_analog_out_v3.rb +55 -22
- data/lib/tinkerforge/bricklet_barometer.rb +108 -58
- data/lib/tinkerforge/bricklet_barometer_v2.rb +109 -67
- data/lib/tinkerforge/bricklet_can.rb +84 -24
- data/lib/tinkerforge/bricklet_can_v2.rb +173 -72
- data/lib/tinkerforge/bricklet_co2.rb +36 -25
- data/lib/tinkerforge/bricklet_co2_v2.rb +119 -60
- data/lib/tinkerforge/bricklet_color.rb +75 -47
- data/lib/tinkerforge/bricklet_color_v2.rb +91 -47
- data/lib/tinkerforge/bricklet_compass.rb +81 -40
- data/lib/tinkerforge/bricklet_current12.rb +61 -40
- data/lib/tinkerforge/bricklet_current25.rb +61 -40
- data/lib/tinkerforge/bricklet_distance_ir.rb +60 -38
- data/lib/tinkerforge/bricklet_distance_ir_v2.rb +85 -45
- data/lib/tinkerforge/bricklet_distance_us.rb +43 -30
- data/lib/tinkerforge/bricklet_distance_us_v2.rb +68 -33
- data/lib/tinkerforge/bricklet_dmx.rb +92 -48
- data/lib/tinkerforge/bricklet_dual_button.rb +23 -12
- data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -29
- data/lib/tinkerforge/bricklet_dual_relay.rb +27 -14
- data/lib/tinkerforge/bricklet_dust_detector.rb +43 -30
- data/lib/tinkerforge/bricklet_e_paper_296x128.rb +115 -63
- data/lib/tinkerforge/bricklet_energy_monitor.rb +81 -40
- data/lib/tinkerforge/bricklet_gps.rb +72 -48
- data/lib/tinkerforge/bricklet_gps_v2.rb +124 -73
- data/lib/tinkerforge/bricklet_hall_effect.rb +43 -28
- data/lib/tinkerforge/bricklet_hall_effect_v2.rb +76 -44
- data/lib/tinkerforge/bricklet_humidity.rb +54 -38
- data/lib/tinkerforge/bricklet_humidity_v2.rb +86 -49
- data/lib/tinkerforge/bricklet_imu_v3.rb +784 -0
- data/lib/tinkerforge/bricklet_industrial_analog_out.rb +41 -18
- data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +84 -40
- data/lib/tinkerforge/bricklet_industrial_counter.rb +102 -59
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +51 -24
- data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +79 -40
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -15
- data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +75 -33
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +43 -29
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +81 -44
- data/lib/tinkerforge/bricklet_industrial_dual_ac_relay.rb +325 -0
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +51 -30
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +139 -40
- data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +63 -28
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -15
- data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -28
- data/lib/tinkerforge/bricklet_io16.rb +57 -32
- data/lib/tinkerforge/bricklet_io16_v2.rb +93 -48
- data/lib/tinkerforge/bricklet_io4.rb +56 -31
- data/lib/tinkerforge/bricklet_io4_v2.rb +109 -57
- data/lib/tinkerforge/bricklet_isolator.rb +111 -35
- data/lib/tinkerforge/bricklet_joystick.rb +63 -42
- data/lib/tinkerforge/bricklet_joystick_v2.rb +71 -35
- data/lib/tinkerforge/bricklet_laser_range_finder.rb +87 -59
- data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +99 -51
- data/lib/tinkerforge/bricklet_lcd_128x64.rb +219 -131
- data/lib/tinkerforge/bricklet_lcd_16x2.rb +49 -25
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +59 -29
- data/lib/tinkerforge/bricklet_led_strip.rb +69 -47
- data/lib/tinkerforge/bricklet_led_strip_v2.rb +105 -48
- data/lib/tinkerforge/bricklet_line.rb +35 -22
- data/lib/tinkerforge/bricklet_linear_poti.rb +53 -35
- data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -24
- data/lib/tinkerforge/bricklet_load_cell.rb +64 -40
- data/lib/tinkerforge/bricklet_load_cell_v2.rb +81 -41
- data/lib/tinkerforge/bricklet_moisture.rb +43 -30
- data/lib/tinkerforge/bricklet_motion_detector.rb +21 -10
- data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -29
- data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -32
- data/lib/tinkerforge/bricklet_multi_touch.rb +30 -17
- data/lib/tinkerforge/bricklet_multi_touch_v2.rb +76 -39
- data/lib/tinkerforge/bricklet_nfc.rb +130 -80
- data/lib/tinkerforge/bricklet_nfc_rfid.rb +32 -13
- data/lib/tinkerforge/bricklet_oled_128x64.rb +30 -17
- data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +75 -40
- data/lib/tinkerforge/bricklet_oled_64x48.rb +30 -17
- data/lib/tinkerforge/bricklet_one_wire.rb +65 -24
- data/lib/tinkerforge/bricklet_outdoor_weather.rb +84 -41
- data/lib/tinkerforge/bricklet_particulate_matter.rb +85 -37
- data/lib/tinkerforge/bricklet_performance_dc.rb +676 -0
- data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -13
- data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -19
- data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +84 -57
- data/lib/tinkerforge/bricklet_ptc.rb +76 -51
- data/lib/tinkerforge/bricklet_ptc_v2.rb +96 -54
- data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -36
- data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -47
- 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 +40 -25
- data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -27
- data/lib/tinkerforge/bricklet_rotary_poti.rb +55 -37
- data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +57 -26
- data/lib/tinkerforge/bricklet_rs232.rb +89 -28
- data/lib/tinkerforge/bricklet_rs232_v2.rb +121 -47
- data/lib/tinkerforge/bricklet_rs485.rb +250 -164
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
- data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -36
- data/lib/tinkerforge/bricklet_servo_v2.rb +565 -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 +36 -24
- data/lib/tinkerforge/bricklet_sound_pressure_level.rb +77 -41
- data/lib/tinkerforge/bricklet_temperature.rb +43 -28
- data/lib/tinkerforge/bricklet_temperature_ir.rb +61 -47
- data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +74 -44
- data/lib/tinkerforge/bricklet_temperature_v2.rb +62 -31
- data/lib/tinkerforge/bricklet_thermal_imaging.rb +118 -68
- data/lib/tinkerforge/bricklet_thermocouple.rb +46 -30
- data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -30
- data/lib/tinkerforge/bricklet_tilt.rb +23 -10
- data/lib/tinkerforge/bricklet_uv_light.rb +37 -24
- data/lib/tinkerforge/bricklet_uv_light_v2.rb +87 -46
- data/lib/tinkerforge/bricklet_voltage.rb +54 -37
- data/lib/tinkerforge/bricklet_voltage_current.rb +94 -85
- data/lib/tinkerforge/bricklet_voltage_current_v2.rb +92 -77
- data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +81 -36
- data/lib/tinkerforge/device_display_names.rb +167 -0
- data/lib/tinkerforge/ip_connection.rb +156 -33
- data/lib/tinkerforge/version.rb +1 -1
- metadata +8 -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-01-15. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.28 #
|
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
|
# Two tactile buttons with built-in blue LEDs
|
14
16
|
class BrickletDualButton < Device
|
@@ -48,7 +50,7 @@ module Tinkerforge
|
|
48
50
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
49
51
|
# the IP Connection <tt>ipcon</tt>.
|
50
52
|
def initialize(uid, ipcon)
|
51
|
-
super uid, ipcon
|
53
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
52
54
|
|
53
55
|
@api_version = [2, 0, 0]
|
54
56
|
|
@@ -58,8 +60,9 @@ module Tinkerforge
|
|
58
60
|
@response_expected[FUNCTION_SET_SELECTED_LED_STATE] = RESPONSE_EXPECTED_FALSE
|
59
61
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
60
62
|
|
61
|
-
@callback_formats[CALLBACK_STATE_CHANGED] = 'C C C C'
|
63
|
+
@callback_formats[CALLBACK_STATE_CHANGED] = [12, 'C C C C']
|
62
64
|
|
65
|
+
@ipcon.add_device self
|
63
66
|
end
|
64
67
|
|
65
68
|
# Sets the state of the LEDs. Possible states are:
|
@@ -74,15 +77,17 @@ module Tinkerforge
|
|
74
77
|
# If you just want to set one of the LEDs and don't know the current state
|
75
78
|
# of the other LED, you can get the state with BrickletDualButton#get_led_state or you
|
76
79
|
# can use BrickletDualButton#set_selected_led_state.
|
77
|
-
#
|
78
|
-
# The default value is (1, 1).
|
79
80
|
def set_led_state(led_l, led_r)
|
80
|
-
|
81
|
+
check_validity
|
82
|
+
|
83
|
+
send_request FUNCTION_SET_LED_STATE, [led_l, led_r], 'C C', 8, ''
|
81
84
|
end
|
82
85
|
|
83
86
|
# Returns the current state of the LEDs, as set by BrickletDualButton#set_led_state.
|
84
87
|
def get_led_state
|
85
|
-
|
88
|
+
check_validity
|
89
|
+
|
90
|
+
send_request FUNCTION_GET_LED_STATE, [], '', 10, 'C C'
|
86
91
|
end
|
87
92
|
|
88
93
|
# Returns the current state for both buttons. Possible states are:
|
@@ -90,26 +95,32 @@ module Tinkerforge
|
|
90
95
|
# * 0 = pressed
|
91
96
|
# * 1 = released
|
92
97
|
def get_button_state
|
93
|
-
|
98
|
+
check_validity
|
99
|
+
|
100
|
+
send_request FUNCTION_GET_BUTTON_STATE, [], '', 10, 'C C'
|
94
101
|
end
|
95
102
|
|
96
103
|
# Sets the state of the selected LED (0 or 1).
|
97
104
|
#
|
98
105
|
# The other LED remains untouched.
|
99
106
|
def set_selected_led_state(led, state)
|
100
|
-
|
107
|
+
check_validity
|
108
|
+
|
109
|
+
send_request FUNCTION_SET_SELECTED_LED_STATE, [led, state], 'C C', 8, ''
|
101
110
|
end
|
102
111
|
|
103
112
|
# Returns the UID, the UID where the Bricklet is connected to,
|
104
113
|
# the position, the hardware and firmware version as well as the
|
105
114
|
# device identifier.
|
106
115
|
#
|
107
|
-
# The position can be 'a', 'b', 'c' or '
|
116
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
117
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
118
|
+
# position 'z'.
|
108
119
|
#
|
109
120
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
110
121
|
# |device_identifier_constant|
|
111
122
|
def get_identity
|
112
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
123
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
113
124
|
end
|
114
125
|
|
115
126
|
# 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-01-15. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.28 #
|
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
|
# Two tactile buttons with built-in blue LEDs
|
14
16
|
class BrickletDualButtonV2 < Device
|
@@ -78,7 +80,7 @@ module Tinkerforge
|
|
78
80
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
79
81
|
# the IP Connection <tt>ipcon</tt>.
|
80
82
|
def initialize(uid, ipcon)
|
81
|
-
super uid, ipcon
|
83
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
82
84
|
|
83
85
|
@api_version = [2, 0, 0]
|
84
86
|
|
@@ -101,8 +103,9 @@ module Tinkerforge
|
|
101
103
|
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
102
104
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
103
105
|
|
104
|
-
@callback_formats[CALLBACK_STATE_CHANGED] = 'C C C C'
|
106
|
+
@callback_formats[CALLBACK_STATE_CHANGED] = [12, 'C C C C']
|
105
107
|
|
108
|
+
@ipcon.add_device self
|
106
109
|
end
|
107
110
|
|
108
111
|
# Sets the state of the LEDs. Possible states are:
|
@@ -117,15 +120,17 @@ module Tinkerforge
|
|
117
120
|
# If you just want to set one of the LEDs and don't know the current state
|
118
121
|
# of the other LED, you can get the state with BrickletDualButtonV2#get_led_state or you
|
119
122
|
# can use BrickletDualButtonV2#set_selected_led_state.
|
120
|
-
#
|
121
|
-
# The default value is (1, 1).
|
122
123
|
def set_led_state(led_l, led_r)
|
123
|
-
|
124
|
+
check_validity
|
125
|
+
|
126
|
+
send_request FUNCTION_SET_LED_STATE, [led_l, led_r], 'C C', 8, ''
|
124
127
|
end
|
125
128
|
|
126
129
|
# Returns the current state of the LEDs, as set by BrickletDualButtonV2#set_led_state.
|
127
130
|
def get_led_state
|
128
|
-
|
131
|
+
check_validity
|
132
|
+
|
133
|
+
send_request FUNCTION_GET_LED_STATE, [], '', 10, 'C C'
|
129
134
|
end
|
130
135
|
|
131
136
|
# Returns the current state for both buttons. Possible states are:
|
@@ -133,27 +138,33 @@ module Tinkerforge
|
|
133
138
|
# * 0 = pressed
|
134
139
|
# * 1 = released
|
135
140
|
def get_button_state
|
136
|
-
|
141
|
+
check_validity
|
142
|
+
|
143
|
+
send_request FUNCTION_GET_BUTTON_STATE, [], '', 10, 'C C'
|
137
144
|
end
|
138
145
|
|
139
|
-
# Sets the state of the selected LED
|
146
|
+
# Sets the state of the selected LED.
|
140
147
|
#
|
141
148
|
# The other LED remains untouched.
|
142
149
|
def set_selected_led_state(led, state)
|
143
|
-
|
150
|
+
check_validity
|
151
|
+
|
152
|
+
send_request FUNCTION_SET_SELECTED_LED_STATE, [led, state], 'C C', 8, ''
|
144
153
|
end
|
145
154
|
|
146
155
|
# If you enable this callback, the CALLBACK_STATE_CHANGED callback is triggered
|
147
156
|
# every time a button is pressed/released
|
148
|
-
#
|
149
|
-
# By default this callback is disabled.
|
150
157
|
def set_state_changed_callback_configuration(enabled)
|
151
|
-
|
158
|
+
check_validity
|
159
|
+
|
160
|
+
send_request FUNCTION_SET_STATE_CHANGED_CALLBACK_CONFIGURATION, [enabled], '?', 8, ''
|
152
161
|
end
|
153
162
|
|
154
163
|
# Returns the configuration as set by BrickletDualButtonV2#set_state_changed_callback_configuration.
|
155
164
|
def get_state_changed_callback_configuration
|
156
|
-
|
165
|
+
check_validity
|
166
|
+
|
167
|
+
send_request FUNCTION_GET_STATE_CHANGED_CALLBACK_CONFIGURATION, [], '', 9, '?'
|
157
168
|
end
|
158
169
|
|
159
170
|
# Returns the error count for the communication between Brick and Bricklet.
|
@@ -168,7 +179,9 @@ module Tinkerforge
|
|
168
179
|
# The errors counts are for errors that occur on the Bricklet side. All
|
169
180
|
# Bricks have a similar function that returns the errors on the Brick side.
|
170
181
|
def get_spitfp_error_count
|
171
|
-
|
182
|
+
check_validity
|
183
|
+
|
184
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
172
185
|
end
|
173
186
|
|
174
187
|
# Sets the bootloader mode and returns the status after the requested
|
@@ -181,12 +194,16 @@ module Tinkerforge
|
|
181
194
|
# This function is used by Brick Viewer during flashing. It should not be
|
182
195
|
# necessary to call it in a normal user program.
|
183
196
|
def set_bootloader_mode(mode)
|
184
|
-
|
197
|
+
check_validity
|
198
|
+
|
199
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
185
200
|
end
|
186
201
|
|
187
202
|
# Returns the current bootloader mode, see BrickletDualButtonV2#set_bootloader_mode.
|
188
203
|
def get_bootloader_mode
|
189
|
-
|
204
|
+
check_validity
|
205
|
+
|
206
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
190
207
|
end
|
191
208
|
|
192
209
|
# Sets the firmware pointer for BrickletDualButtonV2#write_firmware. The pointer has
|
@@ -196,7 +213,9 @@ module Tinkerforge
|
|
196
213
|
# This function is used by Brick Viewer during flashing. It should not be
|
197
214
|
# necessary to call it in a normal user program.
|
198
215
|
def set_write_firmware_pointer(pointer)
|
199
|
-
|
216
|
+
check_validity
|
217
|
+
|
218
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
200
219
|
end
|
201
220
|
|
202
221
|
# Writes 64 Bytes of firmware at the position as written by
|
@@ -208,7 +227,9 @@ module Tinkerforge
|
|
208
227
|
# This function is used by Brick Viewer during flashing. It should not be
|
209
228
|
# necessary to call it in a normal user program.
|
210
229
|
def write_firmware(data)
|
211
|
-
|
230
|
+
check_validity
|
231
|
+
|
232
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
212
233
|
end
|
213
234
|
|
214
235
|
# Sets the status LED configuration. By default the LED shows
|
@@ -219,22 +240,28 @@ module Tinkerforge
|
|
219
240
|
#
|
220
241
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
221
242
|
def set_status_led_config(config)
|
222
|
-
|
243
|
+
check_validity
|
244
|
+
|
245
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
223
246
|
end
|
224
247
|
|
225
248
|
# Returns the configuration as set by BrickletDualButtonV2#set_status_led_config
|
226
249
|
def get_status_led_config
|
227
|
-
|
250
|
+
check_validity
|
251
|
+
|
252
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
228
253
|
end
|
229
254
|
|
230
|
-
# Returns the temperature
|
255
|
+
# Returns the temperature as measured inside the microcontroller. The
|
231
256
|
# value returned is not the ambient temperature!
|
232
257
|
#
|
233
258
|
# The temperature is only proportional to the real temperature and it has bad
|
234
259
|
# accuracy. Practically it is only useful as an indicator for
|
235
260
|
# temperature changes.
|
236
261
|
def get_chip_temperature
|
237
|
-
|
262
|
+
check_validity
|
263
|
+
|
264
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
238
265
|
end
|
239
266
|
|
240
267
|
# Calling this function will reset the Bricklet. All configurations
|
@@ -244,7 +271,9 @@ module Tinkerforge
|
|
244
271
|
# calling functions on the existing ones will result in
|
245
272
|
# undefined behavior!
|
246
273
|
def reset
|
247
|
-
|
274
|
+
check_validity
|
275
|
+
|
276
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
248
277
|
end
|
249
278
|
|
250
279
|
# Writes a new UID into flash. If you want to set a new UID
|
@@ -253,25 +282,31 @@ module Tinkerforge
|
|
253
282
|
#
|
254
283
|
# We recommend that you use Brick Viewer to change the UID.
|
255
284
|
def write_uid(uid)
|
256
|
-
|
285
|
+
check_validity
|
286
|
+
|
287
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
257
288
|
end
|
258
289
|
|
259
290
|
# Returns the current UID as an integer. Encode as
|
260
291
|
# Base58 to get the usual string version.
|
261
292
|
def read_uid
|
262
|
-
|
293
|
+
check_validity
|
294
|
+
|
295
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
263
296
|
end
|
264
297
|
|
265
298
|
# Returns the UID, the UID where the Bricklet is connected to,
|
266
299
|
# the position, the hardware and firmware version as well as the
|
267
300
|
# device identifier.
|
268
301
|
#
|
269
|
-
# The position can be 'a', 'b', 'c' or '
|
302
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
303
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
304
|
+
# position 'z'.
|
270
305
|
#
|
271
306
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
272
307
|
# |device_identifier_constant|
|
273
308
|
def get_identity
|
274
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
309
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
275
310
|
end
|
276
311
|
|
277
312
|
# 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-01-15. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.28 #
|
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
|
# Two relays to switch AC/DC devices
|
14
16
|
class BrickletDualRelay < Device
|
@@ -31,7 +33,7 @@ module Tinkerforge
|
|
31
33
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
32
34
|
# the IP Connection <tt>ipcon</tt>.
|
33
35
|
def initialize(uid, ipcon)
|
34
|
-
super uid, ipcon
|
36
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
35
37
|
|
36
38
|
@api_version = [2, 0, 0]
|
37
39
|
|
@@ -42,8 +44,9 @@ module Tinkerforge
|
|
42
44
|
@response_expected[FUNCTION_SET_SELECTED_STATE] = RESPONSE_EXPECTED_FALSE
|
43
45
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
44
46
|
|
45
|
-
@callback_formats[CALLBACK_MONOFLOP_DONE] = 'C ?'
|
47
|
+
@callback_formats[CALLBACK_MONOFLOP_DONE] = [10, 'C ?']
|
46
48
|
|
49
|
+
@ipcon.add_device self
|
47
50
|
end
|
48
51
|
|
49
52
|
# Sets the state of the relays, *true* means on and *false* means off.
|
@@ -54,20 +57,22 @@ module Tinkerforge
|
|
54
57
|
# can use BrickletDualRelay#set_selected_state.
|
55
58
|
#
|
56
59
|
# All running monoflop timers will be aborted if this function is called.
|
57
|
-
#
|
58
|
-
# The default value is (*false*, *false*).
|
59
60
|
def set_state(relay1, relay2)
|
60
|
-
|
61
|
+
check_validity
|
62
|
+
|
63
|
+
send_request FUNCTION_SET_STATE, [relay1, relay2], '? ?', 8, ''
|
61
64
|
end
|
62
65
|
|
63
66
|
# Returns the state of the relays, *true* means on and *false* means off.
|
64
67
|
def get_state
|
65
|
-
|
68
|
+
check_validity
|
69
|
+
|
70
|
+
send_request FUNCTION_GET_STATE, [], '', 10, '? ?'
|
66
71
|
end
|
67
72
|
|
68
73
|
# The first parameter can be 1 or 2 (relay 1 or relay 2). The second parameter
|
69
74
|
# is the desired state of the relay (*true* means on and *false* means off).
|
70
|
-
# The third parameter indicates the time
|
75
|
+
# The third parameter indicates the time that the relay should hold
|
71
76
|
# the state.
|
72
77
|
#
|
73
78
|
# If this function is called with the parameters (1, true, 1500):
|
@@ -79,7 +84,9 @@ module Tinkerforge
|
|
79
84
|
# of two seconds. The relay will be on all the time. If now the RS485
|
80
85
|
# connection is lost, the relay will turn off in at most two seconds.
|
81
86
|
def set_monoflop(relay, state, time)
|
82
|
-
|
87
|
+
check_validity
|
88
|
+
|
89
|
+
send_request FUNCTION_SET_MONOFLOP, [relay, state, time], 'C ? L', 8, ''
|
83
90
|
end
|
84
91
|
|
85
92
|
# Returns (for the given relay) the current state and the time as set by
|
@@ -88,7 +95,9 @@ module Tinkerforge
|
|
88
95
|
# If the timer is not running currently, the remaining time will be returned
|
89
96
|
# as 0.
|
90
97
|
def get_monoflop(relay)
|
91
|
-
|
98
|
+
check_validity
|
99
|
+
|
100
|
+
send_request FUNCTION_GET_MONOFLOP, [relay], 'C', 17, '? L L'
|
92
101
|
end
|
93
102
|
|
94
103
|
# Sets the state of the selected relay (1 or 2), *true* means on and *false* means off.
|
@@ -97,19 +106,23 @@ module Tinkerforge
|
|
97
106
|
#
|
98
107
|
# The other relay remains untouched.
|
99
108
|
def set_selected_state(relay, state)
|
100
|
-
|
109
|
+
check_validity
|
110
|
+
|
111
|
+
send_request FUNCTION_SET_SELECTED_STATE, [relay, state], 'C ?', 8, ''
|
101
112
|
end
|
102
113
|
|
103
114
|
# Returns the UID, the UID where the Bricklet is connected to,
|
104
115
|
# the position, the hardware and firmware version as well as the
|
105
116
|
# device identifier.
|
106
117
|
#
|
107
|
-
# The position can be 'a', 'b', 'c' or '
|
118
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
119
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
120
|
+
# position 'z'.
|
108
121
|
#
|
109
122
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
110
123
|
# |device_identifier_constant|
|
111
124
|
def get_identity
|
112
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
125
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
113
126
|
end
|
114
127
|
|
115
128
|
# 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-01-15. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.28 #
|
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 dust density
|
14
16
|
class BrickletDustDetector < 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, 0]
|
57
59
|
|
@@ -66,34 +68,39 @@ 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_DUST_DENSITY] = 'S'
|
70
|
-
@callback_formats[CALLBACK_DUST_DENSITY_REACHED] = 'S'
|
71
|
+
@callback_formats[CALLBACK_DUST_DENSITY] = [10, 'S']
|
72
|
+
@callback_formats[CALLBACK_DUST_DENSITY_REACHED] = [10, 'S']
|
71
73
|
|
74
|
+
@ipcon.add_device self
|
72
75
|
end
|
73
76
|
|
74
|
-
# Returns the dust density
|
77
|
+
# Returns the dust density.
|
75
78
|
#
|
76
79
|
# If you want to get the dust density periodically, it is recommended
|
77
80
|
# to use the CALLBACK_DUST_DENSITY callback and set the period with
|
78
81
|
# BrickletDustDetector#set_dust_density_callback_period.
|
79
82
|
def get_dust_density
|
80
|
-
|
83
|
+
check_validity
|
84
|
+
|
85
|
+
send_request FUNCTION_GET_DUST_DENSITY, [], '', 10, 'S'
|
81
86
|
end
|
82
87
|
|
83
|
-
# Sets the period
|
88
|
+
# Sets the period with which the CALLBACK_DUST_DENSITY callback is triggered
|
84
89
|
# periodically. A value of 0 turns the callback off.
|
85
90
|
#
|
86
91
|
# The CALLBACK_DUST_DENSITY callback is only triggered if the dust density has
|
87
92
|
# changed since the last triggering.
|
88
|
-
#
|
89
|
-
# The default value is 0.
|
90
93
|
def set_dust_density_callback_period(period)
|
91
|
-
|
94
|
+
check_validity
|
95
|
+
|
96
|
+
send_request FUNCTION_SET_DUST_DENSITY_CALLBACK_PERIOD, [period], 'L', 8, ''
|
92
97
|
end
|
93
98
|
|
94
99
|
# Returns the period as set by BrickletDustDetector#set_dust_density_callback_period.
|
95
100
|
def get_dust_density_callback_period
|
96
|
-
|
101
|
+
check_validity
|
102
|
+
|
103
|
+
send_request FUNCTION_GET_DUST_DENSITY_CALLBACK_PERIOD, [], '', 12, 'L'
|
97
104
|
end
|
98
105
|
|
99
106
|
# Sets the thresholds for the CALLBACK_DUST_DENSITY_REACHED callback.
|
@@ -107,18 +114,20 @@ module Tinkerforge
|
|
107
114
|
# "'i'", "Callback is triggered when the dust density value is *inside* the min and max values"
|
108
115
|
# "'<'", "Callback is triggered when the dust density value is smaller than the min value (max is ignored)"
|
109
116
|
# "'>'", "Callback is triggered when the dust density value is greater than the min value (max is ignored)"
|
110
|
-
#
|
111
|
-
# The default value is ('x', 0, 0).
|
112
117
|
def set_dust_density_callback_threshold(option, min, max)
|
113
|
-
|
118
|
+
check_validity
|
119
|
+
|
120
|
+
send_request FUNCTION_SET_DUST_DENSITY_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
|
114
121
|
end
|
115
122
|
|
116
123
|
# Returns the threshold as set by BrickletDustDetector#set_dust_density_callback_threshold.
|
117
124
|
def get_dust_density_callback_threshold
|
118
|
-
|
125
|
+
check_validity
|
126
|
+
|
127
|
+
send_request FUNCTION_GET_DUST_DENSITY_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
|
119
128
|
end
|
120
129
|
|
121
|
-
# Sets the period
|
130
|
+
# Sets the period with which the threshold callback
|
122
131
|
#
|
123
132
|
# * CALLBACK_DUST_DENSITY_REACHED
|
124
133
|
#
|
@@ -127,45 +136,49 @@ module Tinkerforge
|
|
127
136
|
# * BrickletDustDetector#set_dust_density_callback_threshold
|
128
137
|
#
|
129
138
|
# keeps being reached.
|
130
|
-
#
|
131
|
-
# The default value is 100.
|
132
139
|
def set_debounce_period(debounce)
|
133
|
-
|
140
|
+
check_validity
|
141
|
+
|
142
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
|
134
143
|
end
|
135
144
|
|
136
145
|
# Returns the debounce period as set by BrickletDustDetector#set_debounce_period.
|
137
146
|
def get_debounce_period
|
138
|
-
|
147
|
+
check_validity
|
148
|
+
|
149
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
|
139
150
|
end
|
140
151
|
|
141
152
|
# Sets the length of a `moving averaging <https://en.wikipedia.org/wiki/Moving_average>`__
|
142
|
-
# for the
|
153
|
+
# for the dust density.
|
143
154
|
#
|
144
155
|
# Setting the length to 0 will turn the averaging completely off. With less
|
145
156
|
# averaging, there is more noise on the data.
|
146
|
-
#
|
147
|
-
# The range for the averaging is 0-100.
|
148
|
-
#
|
149
|
-
# The default value is 100.
|
150
157
|
def set_moving_average(average)
|
151
|
-
|
158
|
+
check_validity
|
159
|
+
|
160
|
+
send_request FUNCTION_SET_MOVING_AVERAGE, [average], 'C', 8, ''
|
152
161
|
end
|
153
162
|
|
154
163
|
# Returns the length moving average as set by BrickletDustDetector#set_moving_average.
|
155
164
|
def get_moving_average
|
156
|
-
|
165
|
+
check_validity
|
166
|
+
|
167
|
+
send_request FUNCTION_GET_MOVING_AVERAGE, [], '', 9, 'C'
|
157
168
|
end
|
158
169
|
|
159
170
|
# Returns the UID, the UID where the Bricklet is connected to,
|
160
171
|
# the position, the hardware and firmware version as well as the
|
161
172
|
# device identifier.
|
162
173
|
#
|
163
|
-
# The position can be 'a', 'b', 'c' or '
|
174
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
175
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
176
|
+
# position 'z'.
|
164
177
|
#
|
165
178
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
166
179
|
# |device_identifier_constant|
|
167
180
|
def get_identity
|
168
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
181
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
169
182
|
end
|
170
183
|
|
171
184
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|