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 UV light
|
14
16
|
class BrickletUVLight < Device
|
@@ -49,7 +51,7 @@ module Tinkerforge
|
|
49
51
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
50
52
|
# the IP Connection <tt>ipcon</tt>.
|
51
53
|
def initialize(uid, ipcon)
|
52
|
-
super uid, ipcon
|
54
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
53
55
|
|
54
56
|
@api_version = [2, 0, 0]
|
55
57
|
|
@@ -62,13 +64,14 @@ module Tinkerforge
|
|
62
64
|
@response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
63
65
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
64
66
|
|
65
|
-
@callback_formats[CALLBACK_UV_LIGHT] = 'L'
|
66
|
-
@callback_formats[CALLBACK_UV_LIGHT_REACHED] = 'L'
|
67
|
+
@callback_formats[CALLBACK_UV_LIGHT] = [12, 'L']
|
68
|
+
@callback_formats[CALLBACK_UV_LIGHT_REACHED] = [12, 'L']
|
67
69
|
|
70
|
+
@ipcon.add_device self
|
68
71
|
end
|
69
72
|
|
70
|
-
# Returns the UV light intensity of the sensor
|
71
|
-
#
|
73
|
+
# Returns the UV light intensity of the sensor.
|
74
|
+
# The sensor has already weighted the intensity with the erythemal
|
72
75
|
# action spectrum to get the skin-affecting irradiation.
|
73
76
|
#
|
74
77
|
# To get UV index you just have to divide the value by 250. For example, a UV
|
@@ -78,7 +81,9 @@ module Tinkerforge
|
|
78
81
|
# CALLBACK_UV_LIGHT callback and set the period with
|
79
82
|
# BrickletUVLight#set_uv_light_callback_period.
|
80
83
|
def get_uv_light
|
81
|
-
|
84
|
+
check_validity
|
85
|
+
|
86
|
+
send_request FUNCTION_GET_UV_LIGHT, [], '', 12, 'L'
|
82
87
|
end
|
83
88
|
|
84
89
|
# Sets the period with which the CALLBACK_UV_LIGHT callback is triggered
|
@@ -87,12 +92,16 @@ module Tinkerforge
|
|
87
92
|
# The CALLBACK_UV_LIGHT callback is only triggered if the intensity has changed since
|
88
93
|
# the last triggering.
|
89
94
|
def set_uv_light_callback_period(period)
|
90
|
-
|
95
|
+
check_validity
|
96
|
+
|
97
|
+
send_request FUNCTION_SET_UV_LIGHT_CALLBACK_PERIOD, [period], 'L', 8, ''
|
91
98
|
end
|
92
99
|
|
93
100
|
# Returns the period as set by BrickletUVLight#set_uv_light_callback_period.
|
94
101
|
def get_uv_light_callback_period
|
95
|
-
|
102
|
+
check_validity
|
103
|
+
|
104
|
+
send_request FUNCTION_GET_UV_LIGHT_CALLBACK_PERIOD, [], '', 12, 'L'
|
96
105
|
end
|
97
106
|
|
98
107
|
# Sets the thresholds for the CALLBACK_UV_LIGHT_REACHED callback.
|
@@ -106,15 +115,17 @@ module Tinkerforge
|
|
106
115
|
# "'i'", "Callback is triggered when the intensity is *inside* the min and max values"
|
107
116
|
# "'<'", "Callback is triggered when the intensity is smaller than the min value (max is ignored)"
|
108
117
|
# "'>'", "Callback is triggered when the intensity is greater than the min value (max is ignored)"
|
109
|
-
#
|
110
|
-
# The default value is ('x', 0, 0).
|
111
118
|
def set_uv_light_callback_threshold(option, min, max)
|
112
|
-
|
119
|
+
check_validity
|
120
|
+
|
121
|
+
send_request FUNCTION_SET_UV_LIGHT_CALLBACK_THRESHOLD, [option, min, max], 'k L L', 8, ''
|
113
122
|
end
|
114
123
|
|
115
124
|
# Returns the threshold as set by BrickletUVLight#set_uv_light_callback_threshold.
|
116
125
|
def get_uv_light_callback_threshold
|
117
|
-
|
126
|
+
check_validity
|
127
|
+
|
128
|
+
send_request FUNCTION_GET_UV_LIGHT_CALLBACK_THRESHOLD, [], '', 17, 'k L L'
|
118
129
|
end
|
119
130
|
|
120
131
|
# Sets the period with which the threshold callbacks
|
@@ -127,24 +138,30 @@ module Tinkerforge
|
|
127
138
|
#
|
128
139
|
# keep being reached.
|
129
140
|
def set_debounce_period(debounce)
|
130
|
-
|
141
|
+
check_validity
|
142
|
+
|
143
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
|
131
144
|
end
|
132
145
|
|
133
146
|
# Returns the debounce period as set by BrickletUVLight#set_debounce_period.
|
134
147
|
def get_debounce_period
|
135
|
-
|
148
|
+
check_validity
|
149
|
+
|
150
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
|
136
151
|
end
|
137
152
|
|
138
153
|
# Returns the UID, the UID where the Bricklet is connected to,
|
139
154
|
# the position, the hardware and firmware version as well as the
|
140
155
|
# device identifier.
|
141
156
|
#
|
142
|
-
# The position can be 'a', 'b', 'c' or '
|
157
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
158
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
159
|
+
# position 'z'.
|
143
160
|
#
|
144
161
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
145
162
|
# |device_identifier_constant|
|
146
163
|
def get_identity
|
147
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
164
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
148
165
|
end
|
149
166
|
|
150
167
|
# 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 UV-A, UV-B and UV index
|
14
16
|
class BrickletUVLightV2 < Device
|
@@ -86,7 +88,7 @@ module Tinkerforge
|
|
86
88
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
87
89
|
# the IP Connection <tt>ipcon</tt>.
|
88
90
|
def initialize(uid, ipcon)
|
89
|
-
super uid, ipcon
|
91
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
90
92
|
|
91
93
|
@api_version = [2, 0, 0]
|
92
94
|
|
@@ -114,14 +116,15 @@ module Tinkerforge
|
|
114
116
|
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
115
117
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
116
118
|
|
117
|
-
@callback_formats[CALLBACK_UVA] = 'l'
|
118
|
-
@callback_formats[CALLBACK_UVB] = 'l'
|
119
|
-
@callback_formats[CALLBACK_UVI] = 'l'
|
119
|
+
@callback_formats[CALLBACK_UVA] = [12, 'l']
|
120
|
+
@callback_formats[CALLBACK_UVB] = [12, 'l']
|
121
|
+
@callback_formats[CALLBACK_UVI] = [12, 'l']
|
120
122
|
|
123
|
+
@ipcon.add_device self
|
121
124
|
end
|
122
125
|
|
123
|
-
# Returns the UVA intensity of the sensor
|
124
|
-
#
|
126
|
+
# Returns the UVA intensity of the sensor.
|
127
|
+
# The sensor has not weighted the intensity with the erythemal
|
125
128
|
# action spectrum to get the skin-affecting irradiation. Therefore, you cannot
|
126
129
|
# just divide the value by 250 to get the UVA index. To get the UV index use
|
127
130
|
# BrickletUVLightV2#get_uvi.
|
@@ -137,7 +140,9 @@ module Tinkerforge
|
|
137
140
|
# CALLBACK_UVA callback. You can set the callback configuration
|
138
141
|
# with BrickletUVLightV2#set_uva_callback_configuration.
|
139
142
|
def get_uva
|
140
|
-
|
143
|
+
check_validity
|
144
|
+
|
145
|
+
send_request FUNCTION_GET_UVA, [], '', 12, 'l'
|
141
146
|
end
|
142
147
|
|
143
148
|
# The period is the period with which the CALLBACK_UVA callback is triggered
|
@@ -166,16 +171,20 @@ module Tinkerforge
|
|
166
171
|
#
|
167
172
|
# If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
|
168
173
|
def set_uva_callback_configuration(period, value_has_to_change, option, min, max)
|
169
|
-
|
174
|
+
check_validity
|
175
|
+
|
176
|
+
send_request FUNCTION_SET_UVA_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 8, ''
|
170
177
|
end
|
171
178
|
|
172
179
|
# Returns the callback configuration as set by BrickletUVLightV2#set_uva_callback_configuration.
|
173
180
|
def get_uva_callback_configuration
|
174
|
-
|
181
|
+
check_validity
|
182
|
+
|
183
|
+
send_request FUNCTION_GET_UVA_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k l l'
|
175
184
|
end
|
176
185
|
|
177
|
-
# Returns the UVB intensity of the sensor
|
178
|
-
#
|
186
|
+
# Returns the UVB intensity of the sensor.
|
187
|
+
# The sensor has not weighted the intensity with the erythemal
|
179
188
|
# action spectrum to get the skin-affecting irradiation. Therefore, you cannot
|
180
189
|
# just divide the value by 250 to get the UVB index. To get the UV index use
|
181
190
|
# BrickletUVLightV2#get_uvi.
|
@@ -191,7 +200,9 @@ module Tinkerforge
|
|
191
200
|
# CALLBACK_UVB callback. You can set the callback configuration
|
192
201
|
# with BrickletUVLightV2#set_uvb_callback_configuration.
|
193
202
|
def get_uvb
|
194
|
-
|
203
|
+
check_validity
|
204
|
+
|
205
|
+
send_request FUNCTION_GET_UVB, [], '', 12, 'l'
|
195
206
|
end
|
196
207
|
|
197
208
|
# The period is the period with which the CALLBACK_UVB callback is triggered
|
@@ -220,12 +231,16 @@ module Tinkerforge
|
|
220
231
|
#
|
221
232
|
# If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
|
222
233
|
def set_uvb_callback_configuration(period, value_has_to_change, option, min, max)
|
223
|
-
|
234
|
+
check_validity
|
235
|
+
|
236
|
+
send_request FUNCTION_SET_UVB_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 8, ''
|
224
237
|
end
|
225
238
|
|
226
239
|
# Returns the callback configuration as set by BrickletUVLightV2#set_uvb_callback_configuration.
|
227
240
|
def get_uvb_callback_configuration
|
228
|
-
|
241
|
+
check_validity
|
242
|
+
|
243
|
+
send_request FUNCTION_GET_UVB_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k l l'
|
229
244
|
end
|
230
245
|
|
231
246
|
# Returns the UV index of the sensor, the index is given in 1/10.
|
@@ -241,7 +256,9 @@ module Tinkerforge
|
|
241
256
|
# CALLBACK_UVI callback. You can set the callback configuration
|
242
257
|
# with BrickletUVLightV2#set_uvi_callback_configuration.
|
243
258
|
def get_uvi
|
244
|
-
|
259
|
+
check_validity
|
260
|
+
|
261
|
+
send_request FUNCTION_GET_UVI, [], '', 12, 'l'
|
245
262
|
end
|
246
263
|
|
247
264
|
# The period is the period with which the CALLBACK_UVI callback is triggered
|
@@ -270,12 +287,16 @@ module Tinkerforge
|
|
270
287
|
#
|
271
288
|
# If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
|
272
289
|
def set_uvi_callback_configuration(period, value_has_to_change, option, min, max)
|
273
|
-
|
290
|
+
check_validity
|
291
|
+
|
292
|
+
send_request FUNCTION_SET_UVI_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 8, ''
|
274
293
|
end
|
275
294
|
|
276
295
|
# Returns the callback configuration as set by BrickletUVLightV2#set_uvi_callback_configuration.
|
277
296
|
def get_uvi_callback_configuration
|
278
|
-
|
297
|
+
check_validity
|
298
|
+
|
299
|
+
send_request FUNCTION_GET_UVI_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k l l'
|
279
300
|
end
|
280
301
|
|
281
302
|
# Sets the configuration of the sensor. The integration time can be configured
|
@@ -286,15 +307,17 @@ module Tinkerforge
|
|
286
307
|
# With a longer integration time (especially 800 ms) and a higher UV intensity the
|
287
308
|
# sensor can be saturated. If this happens the UVA/UVB/UVI readings are all -1.
|
288
309
|
# In this case you need to choose a shorter integration time.
|
289
|
-
#
|
290
|
-
# Default value: 400 ms.
|
291
310
|
def set_configuration(integration_time)
|
292
|
-
|
311
|
+
check_validity
|
312
|
+
|
313
|
+
send_request FUNCTION_SET_CONFIGURATION, [integration_time], 'C', 8, ''
|
293
314
|
end
|
294
315
|
|
295
316
|
# Returns the configuration as set by BrickletUVLightV2#set_configuration.
|
296
317
|
def get_configuration
|
297
|
-
|
318
|
+
check_validity
|
319
|
+
|
320
|
+
send_request FUNCTION_GET_CONFIGURATION, [], '', 9, 'C'
|
298
321
|
end
|
299
322
|
|
300
323
|
# Returns the error count for the communication between Brick and Bricklet.
|
@@ -309,7 +332,9 @@ module Tinkerforge
|
|
309
332
|
# The errors counts are for errors that occur on the Bricklet side. All
|
310
333
|
# Bricks have a similar function that returns the errors on the Brick side.
|
311
334
|
def get_spitfp_error_count
|
312
|
-
|
335
|
+
check_validity
|
336
|
+
|
337
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
313
338
|
end
|
314
339
|
|
315
340
|
# Sets the bootloader mode and returns the status after the requested
|
@@ -322,12 +347,16 @@ module Tinkerforge
|
|
322
347
|
# This function is used by Brick Viewer during flashing. It should not be
|
323
348
|
# necessary to call it in a normal user program.
|
324
349
|
def set_bootloader_mode(mode)
|
325
|
-
|
350
|
+
check_validity
|
351
|
+
|
352
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
326
353
|
end
|
327
354
|
|
328
355
|
# Returns the current bootloader mode, see BrickletUVLightV2#set_bootloader_mode.
|
329
356
|
def get_bootloader_mode
|
330
|
-
|
357
|
+
check_validity
|
358
|
+
|
359
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
331
360
|
end
|
332
361
|
|
333
362
|
# Sets the firmware pointer for BrickletUVLightV2#write_firmware. The pointer has
|
@@ -337,7 +366,9 @@ module Tinkerforge
|
|
337
366
|
# This function is used by Brick Viewer during flashing. It should not be
|
338
367
|
# necessary to call it in a normal user program.
|
339
368
|
def set_write_firmware_pointer(pointer)
|
340
|
-
|
369
|
+
check_validity
|
370
|
+
|
371
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
341
372
|
end
|
342
373
|
|
343
374
|
# Writes 64 Bytes of firmware at the position as written by
|
@@ -349,7 +380,9 @@ module Tinkerforge
|
|
349
380
|
# This function is used by Brick Viewer during flashing. It should not be
|
350
381
|
# necessary to call it in a normal user program.
|
351
382
|
def write_firmware(data)
|
352
|
-
|
383
|
+
check_validity
|
384
|
+
|
385
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
353
386
|
end
|
354
387
|
|
355
388
|
# Sets the status LED configuration. By default the LED shows
|
@@ -360,22 +393,28 @@ module Tinkerforge
|
|
360
393
|
#
|
361
394
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
362
395
|
def set_status_led_config(config)
|
363
|
-
|
396
|
+
check_validity
|
397
|
+
|
398
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
364
399
|
end
|
365
400
|
|
366
401
|
# Returns the configuration as set by BrickletUVLightV2#set_status_led_config
|
367
402
|
def get_status_led_config
|
368
|
-
|
403
|
+
check_validity
|
404
|
+
|
405
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
369
406
|
end
|
370
407
|
|
371
|
-
# Returns the temperature
|
408
|
+
# Returns the temperature as measured inside the microcontroller. The
|
372
409
|
# value returned is not the ambient temperature!
|
373
410
|
#
|
374
411
|
# The temperature is only proportional to the real temperature and it has bad
|
375
412
|
# accuracy. Practically it is only useful as an indicator for
|
376
413
|
# temperature changes.
|
377
414
|
def get_chip_temperature
|
378
|
-
|
415
|
+
check_validity
|
416
|
+
|
417
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
379
418
|
end
|
380
419
|
|
381
420
|
# Calling this function will reset the Bricklet. All configurations
|
@@ -385,7 +424,9 @@ module Tinkerforge
|
|
385
424
|
# calling functions on the existing ones will result in
|
386
425
|
# undefined behavior!
|
387
426
|
def reset
|
388
|
-
|
427
|
+
check_validity
|
428
|
+
|
429
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
389
430
|
end
|
390
431
|
|
391
432
|
# Writes a new UID into flash. If you want to set a new UID
|
@@ -394,25 +435,31 @@ module Tinkerforge
|
|
394
435
|
#
|
395
436
|
# We recommend that you use Brick Viewer to change the UID.
|
396
437
|
def write_uid(uid)
|
397
|
-
|
438
|
+
check_validity
|
439
|
+
|
440
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
398
441
|
end
|
399
442
|
|
400
443
|
# Returns the current UID as an integer. Encode as
|
401
444
|
# Base58 to get the usual string version.
|
402
445
|
def read_uid
|
403
|
-
|
446
|
+
check_validity
|
447
|
+
|
448
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
404
449
|
end
|
405
450
|
|
406
451
|
# Returns the UID, the UID where the Bricklet is connected to,
|
407
452
|
# the position, the hardware and firmware version as well as the
|
408
453
|
# device identifier.
|
409
454
|
#
|
410
|
-
# The position can be 'a', 'b', 'c' or '
|
455
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
456
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
457
|
+
# position 'z'.
|
411
458
|
#
|
412
459
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
413
460
|
# |device_identifier_constant|
|
414
461
|
def get_identity
|
415
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
462
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
416
463
|
end
|
417
464
|
|
418
465
|
# 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 DC voltage between 0V and 50V
|
14
16
|
class BrickletVoltage < Device
|
@@ -70,7 +72,7 @@ module Tinkerforge
|
|
70
72
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
71
73
|
# the IP Connection <tt>ipcon</tt>.
|
72
74
|
def initialize(uid, ipcon)
|
73
|
-
super uid, ipcon
|
75
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
74
76
|
|
75
77
|
@api_version = [2, 0, 1]
|
76
78
|
|
@@ -88,25 +90,26 @@ module Tinkerforge
|
|
88
90
|
@response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
89
91
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
90
92
|
|
91
|
-
@callback_formats[CALLBACK_VOLTAGE] = 'S'
|
92
|
-
@callback_formats[CALLBACK_ANALOG_VALUE] = 'S'
|
93
|
-
@callback_formats[CALLBACK_VOLTAGE_REACHED] = 'S'
|
94
|
-
@callback_formats[CALLBACK_ANALOG_VALUE_REACHED] = 'S'
|
93
|
+
@callback_formats[CALLBACK_VOLTAGE] = [10, 'S']
|
94
|
+
@callback_formats[CALLBACK_ANALOG_VALUE] = [10, 'S']
|
95
|
+
@callback_formats[CALLBACK_VOLTAGE_REACHED] = [10, 'S']
|
96
|
+
@callback_formats[CALLBACK_ANALOG_VALUE_REACHED] = [10, 'S']
|
95
97
|
|
98
|
+
@ipcon.add_device self
|
96
99
|
end
|
97
100
|
|
98
|
-
# Returns the voltage of the sensor.
|
99
|
-
# between 0mV and 50000mV.
|
101
|
+
# Returns the voltage of the sensor.
|
100
102
|
#
|
101
103
|
# If you want to get the voltage periodically, it is recommended to use the
|
102
104
|
# CALLBACK_VOLTAGE callback and set the period with
|
103
105
|
# BrickletVoltage#set_voltage_callback_period.
|
104
106
|
def get_voltage
|
105
|
-
|
107
|
+
check_validity
|
108
|
+
|
109
|
+
send_request FUNCTION_GET_VOLTAGE, [], '', 10, 'S'
|
106
110
|
end
|
107
111
|
|
108
112
|
# Returns the value as read by a 12-bit analog-to-digital converter.
|
109
|
-
# The value is between 0 and 4095.
|
110
113
|
#
|
111
114
|
# .. note::
|
112
115
|
# The value returned by BrickletVoltage#get_voltage is averaged over several samples
|
@@ -118,7 +121,9 @@ module Tinkerforge
|
|
118
121
|
# CALLBACK_ANALOG_VALUE callback and set the period with
|
119
122
|
# BrickletVoltage#set_analog_value_callback_period.
|
120
123
|
def get_analog_value
|
121
|
-
|
124
|
+
check_validity
|
125
|
+
|
126
|
+
send_request FUNCTION_GET_ANALOG_VALUE, [], '', 10, 'S'
|
122
127
|
end
|
123
128
|
|
124
129
|
# Sets the period with which the CALLBACK_VOLTAGE callback is triggered
|
@@ -127,12 +132,16 @@ module Tinkerforge
|
|
127
132
|
# The CALLBACK_VOLTAGE callback is only triggered if the voltage has changed since
|
128
133
|
# the last triggering.
|
129
134
|
def set_voltage_callback_period(period)
|
130
|
-
|
135
|
+
check_validity
|
136
|
+
|
137
|
+
send_request FUNCTION_SET_VOLTAGE_CALLBACK_PERIOD, [period], 'L', 8, ''
|
131
138
|
end
|
132
139
|
|
133
140
|
# Returns the period as set by BrickletVoltage#set_voltage_callback_period.
|
134
141
|
def get_voltage_callback_period
|
135
|
-
|
142
|
+
check_validity
|
143
|
+
|
144
|
+
send_request FUNCTION_GET_VOLTAGE_CALLBACK_PERIOD, [], '', 12, 'L'
|
136
145
|
end
|
137
146
|
|
138
147
|
# Sets the period with which the CALLBACK_ANALOG_VALUE callback is triggered
|
@@ -141,12 +150,16 @@ module Tinkerforge
|
|
141
150
|
# The CALLBACK_ANALOG_VALUE callback is only triggered if the analog value has
|
142
151
|
# changed since the last triggering.
|
143
152
|
def set_analog_value_callback_period(period)
|
144
|
-
|
153
|
+
check_validity
|
154
|
+
|
155
|
+
send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD, [period], 'L', 8, ''
|
145
156
|
end
|
146
157
|
|
147
158
|
# Returns the period as set by BrickletVoltage#set_analog_value_callback_period.
|
148
159
|
def get_analog_value_callback_period
|
149
|
-
|
160
|
+
check_validity
|
161
|
+
|
162
|
+
send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD, [], '', 12, 'L'
|
150
163
|
end
|
151
164
|
|
152
165
|
# Sets the thresholds for the CALLBACK_VOLTAGE_REACHED callback.
|
@@ -160,15 +173,17 @@ module Tinkerforge
|
|
160
173
|
# "'i'", "Callback is triggered when the voltage is *inside* the min and max values"
|
161
174
|
# "'<'", "Callback is triggered when the voltage is smaller than the min value (max is ignored)"
|
162
175
|
# "'>'", "Callback is triggered when the voltage is greater than the min value (max is ignored)"
|
163
|
-
#
|
164
|
-
# The default value is ('x', 0, 0).
|
165
176
|
def set_voltage_callback_threshold(option, min, max)
|
166
|
-
|
177
|
+
check_validity
|
178
|
+
|
179
|
+
send_request FUNCTION_SET_VOLTAGE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
|
167
180
|
end
|
168
181
|
|
169
182
|
# Returns the threshold as set by BrickletVoltage#set_voltage_callback_threshold.
|
170
183
|
def get_voltage_callback_threshold
|
171
|
-
|
184
|
+
check_validity
|
185
|
+
|
186
|
+
send_request FUNCTION_GET_VOLTAGE_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
|
172
187
|
end
|
173
188
|
|
174
189
|
# Sets the thresholds for the CALLBACK_ANALOG_VALUE_REACHED callback.
|
@@ -182,15 +197,17 @@ module Tinkerforge
|
|
182
197
|
# "'i'", "Callback is triggered when the analog value is *inside* the min and max values"
|
183
198
|
# "'<'", "Callback is triggered when the analog value is smaller than the min value (max is ignored)"
|
184
199
|
# "'>'", "Callback is triggered when the analog value is greater than the min value (max is ignored)"
|
185
|
-
#
|
186
|
-
# The default value is ('x', 0, 0).
|
187
200
|
def set_analog_value_callback_threshold(option, min, max)
|
188
|
-
|
201
|
+
check_validity
|
202
|
+
|
203
|
+
send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
|
189
204
|
end
|
190
205
|
|
191
206
|
# Returns the threshold as set by BrickletVoltage#set_analog_value_callback_threshold.
|
192
207
|
def get_analog_value_callback_threshold
|
193
|
-
|
208
|
+
check_validity
|
209
|
+
|
210
|
+
send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
|
194
211
|
end
|
195
212
|
|
196
213
|
# Sets the period with which the threshold callbacks
|
@@ -205,24 +222,30 @@ module Tinkerforge
|
|
205
222
|
#
|
206
223
|
# keep being reached.
|
207
224
|
def set_debounce_period(debounce)
|
208
|
-
|
225
|
+
check_validity
|
226
|
+
|
227
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
|
209
228
|
end
|
210
229
|
|
211
230
|
# Returns the debounce period as set by BrickletVoltage#set_debounce_period.
|
212
231
|
def get_debounce_period
|
213
|
-
|
232
|
+
check_validity
|
233
|
+
|
234
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
|
214
235
|
end
|
215
236
|
|
216
237
|
# Returns the UID, the UID where the Bricklet is connected to,
|
217
238
|
# the position, the hardware and firmware version as well as the
|
218
239
|
# device identifier.
|
219
240
|
#
|
220
|
-
# The position can be 'a', 'b', 'c' or '
|
241
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
242
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
243
|
+
# position 'z'.
|
221
244
|
#
|
222
245
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
223
246
|
# |device_identifier_constant|
|
224
247
|
def get_identity
|
225
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
248
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
226
249
|
end
|
227
250
|
|
228
251
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|