tinkerforge 2.1.22 → 2.1.27
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 +157 -76
- data/lib/tinkerforge/brick_hat.rb +115 -32
- data/lib/tinkerforge/brick_hat_zero.rb +119 -21
- data/lib/tinkerforge/brick_imu.rb +192 -87
- data/lib/tinkerforge/brick_imu_v2.rb +220 -119
- data/lib/tinkerforge/brick_master.rb +498 -198
- data/lib/tinkerforge/brick_red.rb +197 -74
- data/lib/tinkerforge/brick_servo.rb +187 -103
- data/lib/tinkerforge/brick_silent_stepper.rb +249 -169
- data/lib/tinkerforge/brick_stepper.rb +214 -102
- data/lib/tinkerforge/bricklet_accelerometer.rb +61 -36
- data/lib/tinkerforge/bricklet_accelerometer_v2.rb +167 -48
- 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 +77 -49
- data/lib/tinkerforge/bricklet_color_v2.rb +493 -0
- data/lib/tinkerforge/bricklet_compass.rb +397 -0
- 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 +335 -0
- 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 +416 -0
- 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 +101 -53
- data/lib/tinkerforge/bricklet_lcd_128x64.rb +241 -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 +371 -0
- 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 +97 -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_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 +290 -0
- data/lib/tinkerforge/bricklet_rs232.rb +89 -28
- data/lib/tinkerforge/bricklet_rs232_v2.rb +121 -47
- data/lib/tinkerforge/bricklet_rs485.rb +303 -207
- 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_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 +63 -47
- data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +75 -53
- 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 +103 -77
- data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +410 -0
- data/lib/tinkerforge/device_display_names.rb +165 -0
- data/lib/tinkerforge/ip_connection.rb +155 -33
- data/lib/tinkerforge/version.rb +1 -1
- metadata +14 -4
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on
|
|
3
|
+
# This file was automatically generated on 2020-11-02. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.27 #
|
|
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
|
# 4 galvanically isolated digital outputs
|
|
14
16
|
class BrickletIndustrialDigitalOut4 < Device
|
|
@@ -34,7 +36,7 @@ module Tinkerforge
|
|
|
34
36
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
35
37
|
# the IP Connection <tt>ipcon</tt>.
|
|
36
38
|
def initialize(uid, ipcon)
|
|
37
|
-
super uid, ipcon
|
|
39
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
38
40
|
|
|
39
41
|
@api_version = [2, 0, 0]
|
|
40
42
|
|
|
@@ -48,8 +50,9 @@ module Tinkerforge
|
|
|
48
50
|
@response_expected[FUNCTION_SET_SELECTED_VALUES] = RESPONSE_EXPECTED_FALSE
|
|
49
51
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
50
52
|
|
|
51
|
-
@callback_formats[CALLBACK_MONOFLOP_DONE] = 'S S'
|
|
53
|
+
@callback_formats[CALLBACK_MONOFLOP_DONE] = [12, 'S S']
|
|
52
54
|
|
|
55
|
+
@ipcon.add_device self
|
|
53
56
|
end
|
|
54
57
|
|
|
55
58
|
# Sets the output value with a bitmask (16bit). A 1 in the bitmask means high
|
|
@@ -67,12 +70,16 @@ module Tinkerforge
|
|
|
67
70
|
#
|
|
68
71
|
# All running monoflop timers will be aborted if this function is called.
|
|
69
72
|
def set_value(value_mask)
|
|
70
|
-
|
|
73
|
+
check_validity
|
|
74
|
+
|
|
75
|
+
send_request FUNCTION_SET_VALUE, [value_mask], 'S', 8, ''
|
|
71
76
|
end
|
|
72
77
|
|
|
73
78
|
# Returns the bitmask as set by BrickletIndustrialDigitalOut4#set_value.
|
|
74
79
|
def get_value
|
|
75
|
-
|
|
80
|
+
check_validity
|
|
81
|
+
|
|
82
|
+
send_request FUNCTION_GET_VALUE, [], '', 10, 'S'
|
|
76
83
|
end
|
|
77
84
|
|
|
78
85
|
# Configures a monoflop of the pins specified by the first parameter
|
|
@@ -81,7 +88,7 @@ module Tinkerforge
|
|
|
81
88
|
# The second parameter is a bitmask with the desired value of the specified
|
|
82
89
|
# pins. A 1 in the bitmask means high and a 0 in the bitmask means low.
|
|
83
90
|
#
|
|
84
|
-
# The third parameter indicates the time
|
|
91
|
+
# The third parameter indicates the time that the pins should hold
|
|
85
92
|
# the value.
|
|
86
93
|
#
|
|
87
94
|
# If this function is called with the parameters (9, 1, 1500) or
|
|
@@ -94,7 +101,9 @@ module Tinkerforge
|
|
|
94
101
|
# of two seconds and pin 0 high. Pin 0 will be high all the time. If now
|
|
95
102
|
# the RS485 connection is lost, then pin 0 will turn low in at most two seconds.
|
|
96
103
|
def set_monoflop(selection_mask, value_mask, time)
|
|
97
|
-
|
|
104
|
+
check_validity
|
|
105
|
+
|
|
106
|
+
send_request FUNCTION_SET_MONOFLOP, [selection_mask, value_mask, time], 'S S L', 8, ''
|
|
98
107
|
end
|
|
99
108
|
|
|
100
109
|
# Returns (for the given pin) the current value and the time as set by
|
|
@@ -103,7 +112,9 @@ module Tinkerforge
|
|
|
103
112
|
# If the timer is not running currently, the remaining time will be returned
|
|
104
113
|
# as 0.
|
|
105
114
|
def get_monoflop(pin)
|
|
106
|
-
|
|
115
|
+
check_validity
|
|
116
|
+
|
|
117
|
+
send_request FUNCTION_GET_MONOFLOP, [pin], 'C', 18, 'S L L'
|
|
107
118
|
end
|
|
108
119
|
|
|
109
120
|
# Sets a group of Digital Out 4 Bricklets that should work together. You can
|
|
@@ -122,19 +133,25 @@ module Tinkerforge
|
|
|
122
133
|
# pins on the Digital Out 4 on port B are assigned to 4-7. It is now possible
|
|
123
134
|
# to call BrickletIndustrialDigitalOut4#set_value and control two Bricklets at the same time.
|
|
124
135
|
def set_group(group)
|
|
125
|
-
|
|
136
|
+
check_validity
|
|
137
|
+
|
|
138
|
+
send_request FUNCTION_SET_GROUP, [group], 'k4', 8, ''
|
|
126
139
|
end
|
|
127
140
|
|
|
128
141
|
# Returns the group as set by BrickletIndustrialDigitalOut4#set_group
|
|
129
142
|
def get_group
|
|
130
|
-
|
|
143
|
+
check_validity
|
|
144
|
+
|
|
145
|
+
send_request FUNCTION_GET_GROUP, [], '', 12, 'k4'
|
|
131
146
|
end
|
|
132
147
|
|
|
133
148
|
# Returns a bitmask of ports that are available for grouping. For example the
|
|
134
149
|
# value 5 or 0b0101 means: Port A and port C are connected to Bricklets that
|
|
135
150
|
# can be grouped together.
|
|
136
151
|
def get_available_for_group
|
|
137
|
-
|
|
152
|
+
check_validity
|
|
153
|
+
|
|
154
|
+
send_request FUNCTION_GET_AVAILABLE_FOR_GROUP, [], '', 9, 'C'
|
|
138
155
|
end
|
|
139
156
|
|
|
140
157
|
# Sets the output value with a bitmask, according to the selection mask.
|
|
@@ -154,19 +171,23 @@ module Tinkerforge
|
|
|
154
171
|
# Running monoflop timers for the selected pins will be aborted if this function
|
|
155
172
|
# is called.
|
|
156
173
|
def set_selected_values(selection_mask, value_mask)
|
|
157
|
-
|
|
174
|
+
check_validity
|
|
175
|
+
|
|
176
|
+
send_request FUNCTION_SET_SELECTED_VALUES, [selection_mask, value_mask], 'S S', 8, ''
|
|
158
177
|
end
|
|
159
178
|
|
|
160
179
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
161
180
|
# the position, the hardware and firmware version as well as the
|
|
162
181
|
# device identifier.
|
|
163
182
|
#
|
|
164
|
-
# The position can be 'a', 'b', 'c' or '
|
|
183
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
184
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
185
|
+
# position 'z'.
|
|
165
186
|
#
|
|
166
187
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
167
188
|
# |device_identifier_constant|
|
|
168
189
|
def get_identity
|
|
169
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
190
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
170
191
|
end
|
|
171
192
|
|
|
172
193
|
# 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 2020-11-02. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.27 #
|
|
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
|
# 4 galvanically isolated digital outputs
|
|
14
16
|
class BrickletIndustrialDigitalOut4V2 < Device
|
|
@@ -65,7 +67,7 @@ module Tinkerforge
|
|
|
65
67
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
66
68
|
# the IP Connection <tt>ipcon</tt>.
|
|
67
69
|
def initialize(uid, ipcon)
|
|
68
|
-
super uid, ipcon
|
|
70
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
69
71
|
|
|
70
72
|
@api_version = [2, 0, 0]
|
|
71
73
|
|
|
@@ -91,8 +93,9 @@ module Tinkerforge
|
|
|
91
93
|
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
92
94
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
93
95
|
|
|
94
|
-
@callback_formats[CALLBACK_MONOFLOP_DONE] = 'C ?'
|
|
96
|
+
@callback_formats[CALLBACK_MONOFLOP_DONE] = [10, 'C ?']
|
|
95
97
|
|
|
98
|
+
@ipcon.add_device self
|
|
96
99
|
end
|
|
97
100
|
|
|
98
101
|
# Sets the output value of all four channels. A value of *true* or *false* outputs
|
|
@@ -105,12 +108,16 @@ module Tinkerforge
|
|
|
105
108
|
# For example: (True, True, False, False) will turn the channels 0-1 high and the
|
|
106
109
|
# channels 2-3 low.
|
|
107
110
|
def set_value(value)
|
|
108
|
-
|
|
111
|
+
check_validity
|
|
112
|
+
|
|
113
|
+
send_request FUNCTION_SET_VALUE, [value], '?4', 8, ''
|
|
109
114
|
end
|
|
110
115
|
|
|
111
116
|
# Returns the logic levels that are currently output on the channels.
|
|
112
117
|
def get_value
|
|
113
|
-
|
|
118
|
+
check_validity
|
|
119
|
+
|
|
120
|
+
send_request FUNCTION_GET_VALUE, [], '', 9, '?4'
|
|
114
121
|
end
|
|
115
122
|
|
|
116
123
|
# Sets the output value of a specific channel without affecting the other channels.
|
|
@@ -118,11 +125,13 @@ module Tinkerforge
|
|
|
118
125
|
# A running monoflop timer or PWM for the specified channel will be aborted if this
|
|
119
126
|
# function is called.
|
|
120
127
|
def set_selected_value(channel, value)
|
|
121
|
-
|
|
128
|
+
check_validity
|
|
129
|
+
|
|
130
|
+
send_request FUNCTION_SET_SELECTED_VALUE, [channel, value], 'C ?', 8, ''
|
|
122
131
|
end
|
|
123
132
|
|
|
124
133
|
# The first parameter is the desired state of the channel (*true* means output *high*
|
|
125
|
-
# and *false* means output *low*). The second parameter indicates the time
|
|
134
|
+
# and *false* means output *low*). The second parameter indicates the time that
|
|
126
135
|
# the channel should hold the state.
|
|
127
136
|
#
|
|
128
137
|
# If this function is called with the parameters (true, 1500):
|
|
@@ -136,7 +145,9 @@ module Tinkerforge
|
|
|
136
145
|
# of two seconds. The channel will be *high* all the time. If now the RS485
|
|
137
146
|
# connection is lost, the channel will turn *low* in at most two seconds.
|
|
138
147
|
def set_monoflop(channel, value, time)
|
|
139
|
-
|
|
148
|
+
check_validity
|
|
149
|
+
|
|
150
|
+
send_request FUNCTION_SET_MONOFLOP, [channel, value, time], 'C ? L', 8, ''
|
|
140
151
|
end
|
|
141
152
|
|
|
142
153
|
# Returns (for the given channel) the current value and the time as set by
|
|
@@ -145,7 +156,9 @@ module Tinkerforge
|
|
|
145
156
|
# If the timer is not running currently, the remaining time will be returned
|
|
146
157
|
# as 0.
|
|
147
158
|
def get_monoflop(channel)
|
|
148
|
-
|
|
159
|
+
check_validity
|
|
160
|
+
|
|
161
|
+
send_request FUNCTION_GET_MONOFLOP, [channel], 'C', 17, '? L L'
|
|
149
162
|
end
|
|
150
163
|
|
|
151
164
|
# Each channel has a corresponding LED. You can turn the LED off, on or show a
|
|
@@ -154,35 +167,40 @@ module Tinkerforge
|
|
|
154
167
|
#
|
|
155
168
|
# By default all channel LEDs are configured as "Channel Status".
|
|
156
169
|
def set_channel_led_config(channel, config)
|
|
157
|
-
|
|
170
|
+
check_validity
|
|
171
|
+
|
|
172
|
+
send_request FUNCTION_SET_CHANNEL_LED_CONFIG, [channel, config], 'C C', 8, ''
|
|
158
173
|
end
|
|
159
174
|
|
|
160
175
|
# Returns the channel LED configuration as set by BrickletIndustrialDigitalOut4V2#set_channel_led_config
|
|
161
176
|
def get_channel_led_config(channel)
|
|
162
|
-
|
|
177
|
+
check_validity
|
|
178
|
+
|
|
179
|
+
send_request FUNCTION_GET_CHANNEL_LED_CONFIG, [channel], 'C', 9, 'C'
|
|
163
180
|
end
|
|
164
181
|
|
|
165
|
-
# Activates a PWM for the given channel
|
|
166
|
-
# cycle given in 1/100%.
|
|
182
|
+
# Activates a PWM for the given channel.
|
|
167
183
|
#
|
|
168
184
|
# To turn the PWM off again, you can set the frequency to 0 or any other
|
|
169
185
|
# function that changes a value of the channel (e.g. BrickletIndustrialDigitalOut4V2#set_selected_value).
|
|
170
186
|
#
|
|
171
|
-
# The
|
|
187
|
+
# The optocoupler of the Industrial Digital
|
|
172
188
|
# Out 4 Bricklet 2.0 has a rise time and fall time of 11.5us (each) at 24V. So the maximum
|
|
173
189
|
# useful frequency value is about 400000 (40kHz).
|
|
174
190
|
#
|
|
175
191
|
# A running monoflop timer for the given channel will be aborted if this function
|
|
176
192
|
# is called.
|
|
177
|
-
#
|
|
178
|
-
# The default values are 0, 0.
|
|
179
193
|
def set_pwm_configuration(channel, frequency, duty_cycle)
|
|
180
|
-
|
|
194
|
+
check_validity
|
|
195
|
+
|
|
196
|
+
send_request FUNCTION_SET_PWM_CONFIGURATION, [channel, frequency, duty_cycle], 'C L S', 8, ''
|
|
181
197
|
end
|
|
182
198
|
|
|
183
199
|
# Returns the PWM configuration as set by BrickletIndustrialDigitalOut4V2#set_pwm_configuration.
|
|
184
200
|
def get_pwm_configuration(channel)
|
|
185
|
-
|
|
201
|
+
check_validity
|
|
202
|
+
|
|
203
|
+
send_request FUNCTION_GET_PWM_CONFIGURATION, [channel], 'C', 14, 'L S'
|
|
186
204
|
end
|
|
187
205
|
|
|
188
206
|
# Returns the error count for the communication between Brick and Bricklet.
|
|
@@ -197,7 +215,9 @@ module Tinkerforge
|
|
|
197
215
|
# The errors counts are for errors that occur on the Bricklet side. All
|
|
198
216
|
# Bricks have a similar function that returns the errors on the Brick side.
|
|
199
217
|
def get_spitfp_error_count
|
|
200
|
-
|
|
218
|
+
check_validity
|
|
219
|
+
|
|
220
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
|
201
221
|
end
|
|
202
222
|
|
|
203
223
|
# Sets the bootloader mode and returns the status after the requested
|
|
@@ -210,12 +230,16 @@ module Tinkerforge
|
|
|
210
230
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
211
231
|
# necessary to call it in a normal user program.
|
|
212
232
|
def set_bootloader_mode(mode)
|
|
213
|
-
|
|
233
|
+
check_validity
|
|
234
|
+
|
|
235
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
|
214
236
|
end
|
|
215
237
|
|
|
216
238
|
# Returns the current bootloader mode, see BrickletIndustrialDigitalOut4V2#set_bootloader_mode.
|
|
217
239
|
def get_bootloader_mode
|
|
218
|
-
|
|
240
|
+
check_validity
|
|
241
|
+
|
|
242
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
|
219
243
|
end
|
|
220
244
|
|
|
221
245
|
# Sets the firmware pointer for BrickletIndustrialDigitalOut4V2#write_firmware. The pointer has
|
|
@@ -225,7 +249,9 @@ module Tinkerforge
|
|
|
225
249
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
226
250
|
# necessary to call it in a normal user program.
|
|
227
251
|
def set_write_firmware_pointer(pointer)
|
|
228
|
-
|
|
252
|
+
check_validity
|
|
253
|
+
|
|
254
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
|
229
255
|
end
|
|
230
256
|
|
|
231
257
|
# Writes 64 Bytes of firmware at the position as written by
|
|
@@ -237,7 +263,9 @@ module Tinkerforge
|
|
|
237
263
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
238
264
|
# necessary to call it in a normal user program.
|
|
239
265
|
def write_firmware(data)
|
|
240
|
-
|
|
266
|
+
check_validity
|
|
267
|
+
|
|
268
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
|
241
269
|
end
|
|
242
270
|
|
|
243
271
|
# Sets the status LED configuration. By default the LED shows
|
|
@@ -248,22 +276,28 @@ module Tinkerforge
|
|
|
248
276
|
#
|
|
249
277
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
|
250
278
|
def set_status_led_config(config)
|
|
251
|
-
|
|
279
|
+
check_validity
|
|
280
|
+
|
|
281
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
|
252
282
|
end
|
|
253
283
|
|
|
254
284
|
# Returns the configuration as set by BrickletIndustrialDigitalOut4V2#set_status_led_config
|
|
255
285
|
def get_status_led_config
|
|
256
|
-
|
|
286
|
+
check_validity
|
|
287
|
+
|
|
288
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
|
257
289
|
end
|
|
258
290
|
|
|
259
|
-
# Returns the temperature
|
|
291
|
+
# Returns the temperature as measured inside the microcontroller. The
|
|
260
292
|
# value returned is not the ambient temperature!
|
|
261
293
|
#
|
|
262
294
|
# The temperature is only proportional to the real temperature and it has bad
|
|
263
295
|
# accuracy. Practically it is only useful as an indicator for
|
|
264
296
|
# temperature changes.
|
|
265
297
|
def get_chip_temperature
|
|
266
|
-
|
|
298
|
+
check_validity
|
|
299
|
+
|
|
300
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
|
267
301
|
end
|
|
268
302
|
|
|
269
303
|
# Calling this function will reset the Bricklet. All configurations
|
|
@@ -273,7 +307,9 @@ module Tinkerforge
|
|
|
273
307
|
# calling functions on the existing ones will result in
|
|
274
308
|
# undefined behavior!
|
|
275
309
|
def reset
|
|
276
|
-
|
|
310
|
+
check_validity
|
|
311
|
+
|
|
312
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
|
277
313
|
end
|
|
278
314
|
|
|
279
315
|
# Writes a new UID into flash. If you want to set a new UID
|
|
@@ -282,25 +318,31 @@ module Tinkerforge
|
|
|
282
318
|
#
|
|
283
319
|
# We recommend that you use Brick Viewer to change the UID.
|
|
284
320
|
def write_uid(uid)
|
|
285
|
-
|
|
321
|
+
check_validity
|
|
322
|
+
|
|
323
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
|
286
324
|
end
|
|
287
325
|
|
|
288
326
|
# Returns the current UID as an integer. Encode as
|
|
289
327
|
# Base58 to get the usual string version.
|
|
290
328
|
def read_uid
|
|
291
|
-
|
|
329
|
+
check_validity
|
|
330
|
+
|
|
331
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
|
292
332
|
end
|
|
293
333
|
|
|
294
334
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
295
335
|
# the position, the hardware and firmware version as well as the
|
|
296
336
|
# device identifier.
|
|
297
337
|
#
|
|
298
|
-
# The position can be 'a', 'b', 'c' or '
|
|
338
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
339
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
340
|
+
# position 'z'.
|
|
299
341
|
#
|
|
300
342
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
301
343
|
# |device_identifier_constant|
|
|
302
344
|
def get_identity
|
|
303
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
345
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
304
346
|
end
|
|
305
347
|
|
|
306
348
|
# 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 2020-11-02. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.27 #
|
|
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 two DC currents between 0mA and 20mA (IEC 60381-1)
|
|
14
16
|
class BrickletIndustrialDual020mA < Device
|
|
@@ -55,7 +57,7 @@ module Tinkerforge
|
|
|
55
57
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
56
58
|
# the IP Connection <tt>ipcon</tt>.
|
|
57
59
|
def initialize(uid, ipcon)
|
|
58
|
-
super uid, ipcon
|
|
60
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
59
61
|
|
|
60
62
|
@api_version = [2, 0, 0]
|
|
61
63
|
|
|
@@ -70,16 +72,16 @@ module Tinkerforge
|
|
|
70
72
|
@response_expected[FUNCTION_GET_SAMPLE_RATE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
71
73
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
72
74
|
|
|
73
|
-
@callback_formats[CALLBACK_CURRENT] = 'C l'
|
|
74
|
-
@callback_formats[CALLBACK_CURRENT_REACHED] = 'C l'
|
|
75
|
+
@callback_formats[CALLBACK_CURRENT] = [13, 'C l']
|
|
76
|
+
@callback_formats[CALLBACK_CURRENT_REACHED] = [13, 'C l']
|
|
75
77
|
|
|
78
|
+
@ipcon.add_device self
|
|
76
79
|
end
|
|
77
80
|
|
|
78
|
-
# Returns the current of the specified sensor
|
|
79
|
-
# and between 0nA and 22505322nA (22.5mA).
|
|
81
|
+
# Returns the current of the specified sensor.
|
|
80
82
|
#
|
|
81
83
|
# It is possible to detect if an IEC 60381-1 compatible sensor is connected
|
|
82
|
-
# and if it works
|
|
84
|
+
# and if it works properly.
|
|
83
85
|
#
|
|
84
86
|
# If the returned current is below 4mA, there is likely no sensor connected
|
|
85
87
|
# or the sensor may be defect. If the returned current is over 20mA, there might
|
|
@@ -89,23 +91,27 @@ module Tinkerforge
|
|
|
89
91
|
# CALLBACK_CURRENT callback and set the period with
|
|
90
92
|
# BrickletIndustrialDual020mA#set_current_callback_period.
|
|
91
93
|
def get_current(sensor)
|
|
92
|
-
|
|
94
|
+
check_validity
|
|
95
|
+
|
|
96
|
+
send_request FUNCTION_GET_CURRENT, [sensor], 'C', 12, 'l'
|
|
93
97
|
end
|
|
94
98
|
|
|
95
|
-
# Sets the period
|
|
99
|
+
# Sets the period with which the CALLBACK_CURRENT callback is triggered
|
|
96
100
|
# periodically for the given sensor. A value of 0 turns the callback off.
|
|
97
101
|
#
|
|
98
102
|
# The CALLBACK_CURRENT callback is only triggered if the current has changed since the
|
|
99
103
|
# last triggering.
|
|
100
|
-
#
|
|
101
|
-
# The default value is 0.
|
|
102
104
|
def set_current_callback_period(sensor, period)
|
|
103
|
-
|
|
105
|
+
check_validity
|
|
106
|
+
|
|
107
|
+
send_request FUNCTION_SET_CURRENT_CALLBACK_PERIOD, [sensor, period], 'C L', 8, ''
|
|
104
108
|
end
|
|
105
109
|
|
|
106
110
|
# Returns the period as set by BrickletIndustrialDual020mA#set_current_callback_period.
|
|
107
111
|
def get_current_callback_period(sensor)
|
|
108
|
-
|
|
112
|
+
check_validity
|
|
113
|
+
|
|
114
|
+
send_request FUNCTION_GET_CURRENT_CALLBACK_PERIOD, [sensor], 'C', 12, 'L'
|
|
109
115
|
end
|
|
110
116
|
|
|
111
117
|
# Sets the thresholds for the CALLBACK_CURRENT_REACHED callback for the given
|
|
@@ -120,18 +126,20 @@ module Tinkerforge
|
|
|
120
126
|
# "'i'", "Callback is triggered when the current is *inside* the min and max values"
|
|
121
127
|
# "'<'", "Callback is triggered when the current is smaller than the min value (max is ignored)"
|
|
122
128
|
# "'>'", "Callback is triggered when the current is greater than the min value (max is ignored)"
|
|
123
|
-
#
|
|
124
|
-
# The default value is ('x', 0, 0).
|
|
125
129
|
def set_current_callback_threshold(sensor, option, min, max)
|
|
126
|
-
|
|
130
|
+
check_validity
|
|
131
|
+
|
|
132
|
+
send_request FUNCTION_SET_CURRENT_CALLBACK_THRESHOLD, [sensor, option, min, max], 'C k l l', 8, ''
|
|
127
133
|
end
|
|
128
134
|
|
|
129
135
|
# Returns the threshold as set by BrickletIndustrialDual020mA#set_current_callback_threshold.
|
|
130
136
|
def get_current_callback_threshold(sensor)
|
|
131
|
-
|
|
137
|
+
check_validity
|
|
138
|
+
|
|
139
|
+
send_request FUNCTION_GET_CURRENT_CALLBACK_THRESHOLD, [sensor], 'C', 17, 'k l l'
|
|
132
140
|
end
|
|
133
141
|
|
|
134
|
-
# Sets the period
|
|
142
|
+
# Sets the period with which the threshold callback
|
|
135
143
|
#
|
|
136
144
|
# * CALLBACK_CURRENT_REACHED
|
|
137
145
|
#
|
|
@@ -140,15 +148,17 @@ module Tinkerforge
|
|
|
140
148
|
# * BrickletIndustrialDual020mA#set_current_callback_threshold
|
|
141
149
|
#
|
|
142
150
|
# keeps being reached.
|
|
143
|
-
#
|
|
144
|
-
# The default value is 100.
|
|
145
151
|
def set_debounce_period(debounce)
|
|
146
|
-
|
|
152
|
+
check_validity
|
|
153
|
+
|
|
154
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
|
|
147
155
|
end
|
|
148
156
|
|
|
149
157
|
# Returns the debounce period as set by BrickletIndustrialDual020mA#set_debounce_period.
|
|
150
158
|
def get_debounce_period
|
|
151
|
-
|
|
159
|
+
check_validity
|
|
160
|
+
|
|
161
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
|
|
152
162
|
end
|
|
153
163
|
|
|
154
164
|
# Sets the sample rate to either 240, 60, 15 or 4 samples per second.
|
|
@@ -160,27 +170,31 @@ module Tinkerforge
|
|
|
160
170
|
# "1", "60 samples per second, 14 bit resolution"
|
|
161
171
|
# "2", "15 samples per second, 16 bit resolution"
|
|
162
172
|
# "3", "4 samples per second, 18 bit resolution"
|
|
163
|
-
#
|
|
164
|
-
# The default value is 3 (4 samples per second with 18 bit resolution).
|
|
165
173
|
def set_sample_rate(rate)
|
|
166
|
-
|
|
174
|
+
check_validity
|
|
175
|
+
|
|
176
|
+
send_request FUNCTION_SET_SAMPLE_RATE, [rate], 'C', 8, ''
|
|
167
177
|
end
|
|
168
178
|
|
|
169
179
|
# Returns the sample rate as set by BrickletIndustrialDual020mA#set_sample_rate.
|
|
170
180
|
def get_sample_rate
|
|
171
|
-
|
|
181
|
+
check_validity
|
|
182
|
+
|
|
183
|
+
send_request FUNCTION_GET_SAMPLE_RATE, [], '', 9, 'C'
|
|
172
184
|
end
|
|
173
185
|
|
|
174
186
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
175
187
|
# the position, the hardware and firmware version as well as the
|
|
176
188
|
# device identifier.
|
|
177
189
|
#
|
|
178
|
-
# The position can be 'a', 'b', 'c' or '
|
|
190
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
191
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
192
|
+
# position 'z'.
|
|
179
193
|
#
|
|
180
194
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
181
195
|
# |device_identifier_constant|
|
|
182
196
|
def get_identity
|
|
183
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
197
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
184
198
|
end
|
|
185
199
|
|
|
186
200
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|