tinkerforge 2.1.23 → 2.1.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/lib/tinkerforge/brick_dc.rb +156 -75
- data/lib/tinkerforge/brick_hat.rb +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
|
# Measures power, DC voltage and DC current up to 720W/36V/20A
|
|
14
16
|
class BrickletVoltageCurrentV2 < Device
|
|
@@ -99,7 +101,7 @@ module Tinkerforge
|
|
|
99
101
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
100
102
|
# the IP Connection <tt>ipcon</tt>.
|
|
101
103
|
def initialize(uid, ipcon)
|
|
102
|
-
super uid, ipcon
|
|
104
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
103
105
|
|
|
104
106
|
@api_version = [2, 0, 0]
|
|
105
107
|
|
|
@@ -129,24 +131,26 @@ module Tinkerforge
|
|
|
129
131
|
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
130
132
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
131
133
|
|
|
132
|
-
@callback_formats[CALLBACK_CURRENT] = 'l'
|
|
133
|
-
@callback_formats[CALLBACK_VOLTAGE] = 'l'
|
|
134
|
-
@callback_formats[CALLBACK_POWER] = 'l'
|
|
134
|
+
@callback_formats[CALLBACK_CURRENT] = [12, 'l']
|
|
135
|
+
@callback_formats[CALLBACK_VOLTAGE] = [12, 'l']
|
|
136
|
+
@callback_formats[CALLBACK_POWER] = [12, 'l']
|
|
135
137
|
|
|
138
|
+
@ipcon.add_device self
|
|
136
139
|
end
|
|
137
140
|
|
|
138
|
-
# Returns the current.
|
|
139
|
-
# and between -20000mA and 20000mA.
|
|
141
|
+
# Returns the current.
|
|
140
142
|
#
|
|
141
143
|
#
|
|
142
144
|
# If you want to get the value periodically, it is recommended to use the
|
|
143
145
|
# CALLBACK_CURRENT callback. You can set the callback configuration
|
|
144
146
|
# with BrickletVoltageCurrentV2#set_current_callback_configuration.
|
|
145
147
|
def get_current
|
|
146
|
-
|
|
148
|
+
check_validity
|
|
149
|
+
|
|
150
|
+
send_request FUNCTION_GET_CURRENT, [], '', 12, 'l'
|
|
147
151
|
end
|
|
148
152
|
|
|
149
|
-
# The period
|
|
153
|
+
# The period is the period with which the CALLBACK_CURRENT callback is triggered
|
|
150
154
|
# periodically. A value of 0 turns the callback off.
|
|
151
155
|
#
|
|
152
156
|
# If the `value has to change`-parameter is set to true, the callback is only
|
|
@@ -171,29 +175,32 @@ module Tinkerforge
|
|
|
171
175
|
# "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
|
|
172
176
|
#
|
|
173
177
|
# If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
|
|
174
|
-
#
|
|
175
|
-
# The default value is (0, false, 'x', 0, 0).
|
|
176
178
|
def set_current_callback_configuration(period, value_has_to_change, option, min, max)
|
|
177
|
-
|
|
179
|
+
check_validity
|
|
180
|
+
|
|
181
|
+
send_request FUNCTION_SET_CURRENT_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 8, ''
|
|
178
182
|
end
|
|
179
183
|
|
|
180
184
|
# Returns the callback configuration as set by BrickletVoltageCurrentV2#set_current_callback_configuration.
|
|
181
185
|
def get_current_callback_configuration
|
|
182
|
-
|
|
186
|
+
check_validity
|
|
187
|
+
|
|
188
|
+
send_request FUNCTION_GET_CURRENT_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k l l'
|
|
183
189
|
end
|
|
184
190
|
|
|
185
|
-
# Returns the voltage.
|
|
186
|
-
# and between 0mV and 36000mV.
|
|
191
|
+
# Returns the voltage.
|
|
187
192
|
#
|
|
188
193
|
#
|
|
189
194
|
# If you want to get the value periodically, it is recommended to use the
|
|
190
195
|
# CALLBACK_VOLTAGE callback. You can set the callback configuration
|
|
191
196
|
# with BrickletVoltageCurrentV2#set_voltage_callback_configuration.
|
|
192
197
|
def get_voltage
|
|
193
|
-
|
|
198
|
+
check_validity
|
|
199
|
+
|
|
200
|
+
send_request FUNCTION_GET_VOLTAGE, [], '', 12, 'l'
|
|
194
201
|
end
|
|
195
202
|
|
|
196
|
-
# The period
|
|
203
|
+
# The period is the period with which the CALLBACK_VOLTAGE callback is triggered
|
|
197
204
|
# periodically. A value of 0 turns the callback off.
|
|
198
205
|
#
|
|
199
206
|
# If the `value has to change`-parameter is set to true, the callback is only
|
|
@@ -218,29 +225,32 @@ module Tinkerforge
|
|
|
218
225
|
# "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
|
|
219
226
|
#
|
|
220
227
|
# If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
|
|
221
|
-
#
|
|
222
|
-
# The default value is (0, false, 'x', 0, 0).
|
|
223
228
|
def set_voltage_callback_configuration(period, value_has_to_change, option, min, max)
|
|
224
|
-
|
|
229
|
+
check_validity
|
|
230
|
+
|
|
231
|
+
send_request FUNCTION_SET_VOLTAGE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 8, ''
|
|
225
232
|
end
|
|
226
233
|
|
|
227
234
|
# Returns the callback configuration as set by BrickletVoltageCurrentV2#set_voltage_callback_configuration.
|
|
228
235
|
def get_voltage_callback_configuration
|
|
229
|
-
|
|
236
|
+
check_validity
|
|
237
|
+
|
|
238
|
+
send_request FUNCTION_GET_VOLTAGE_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k l l'
|
|
230
239
|
end
|
|
231
240
|
|
|
232
|
-
# Returns the power.
|
|
233
|
-
# and between 0mV and 720000mW.
|
|
241
|
+
# Returns the power.
|
|
234
242
|
#
|
|
235
243
|
#
|
|
236
244
|
# If you want to get the value periodically, it is recommended to use the
|
|
237
245
|
# CALLBACK_POWER callback. You can set the callback configuration
|
|
238
246
|
# with BrickletVoltageCurrentV2#set_power_callback_configuration.
|
|
239
247
|
def get_power
|
|
240
|
-
|
|
248
|
+
check_validity
|
|
249
|
+
|
|
250
|
+
send_request FUNCTION_GET_POWER, [], '', 12, 'l'
|
|
241
251
|
end
|
|
242
252
|
|
|
243
|
-
# The period
|
|
253
|
+
# The period is the period with which the CALLBACK_POWER callback is triggered
|
|
244
254
|
# periodically. A value of 0 turns the callback off.
|
|
245
255
|
#
|
|
246
256
|
# If the `value has to change`-parameter is set to true, the callback is only
|
|
@@ -265,56 +275,33 @@ module Tinkerforge
|
|
|
265
275
|
# "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
|
|
266
276
|
#
|
|
267
277
|
# If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
|
|
268
|
-
#
|
|
269
|
-
# The default value is (0, false, 'x', 0, 0).
|
|
270
278
|
def set_power_callback_configuration(period, value_has_to_change, option, min, max)
|
|
271
|
-
|
|
279
|
+
check_validity
|
|
280
|
+
|
|
281
|
+
send_request FUNCTION_SET_POWER_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 8, ''
|
|
272
282
|
end
|
|
273
283
|
|
|
274
284
|
# Returns the callback configuration as set by BrickletVoltageCurrentV2#set_power_callback_configuration.
|
|
275
285
|
def get_power_callback_configuration
|
|
276
|
-
|
|
286
|
+
check_validity
|
|
287
|
+
|
|
288
|
+
send_request FUNCTION_GET_POWER_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k l l'
|
|
277
289
|
end
|
|
278
290
|
|
|
279
291
|
# Sets the configuration of the Voltage/Current Bricklet 2.0. It is
|
|
280
292
|
# possible to configure number of averages as well as
|
|
281
293
|
# voltage and current conversion time.
|
|
282
|
-
#
|
|
283
|
-
# Averaging:
|
|
284
|
-
#
|
|
285
|
-
# "Value", "Number of Averages"
|
|
286
|
-
#
|
|
287
|
-
# "0", "1"
|
|
288
|
-
# "1", "4"
|
|
289
|
-
# "2", "16"
|
|
290
|
-
# "3", "64"
|
|
291
|
-
# "4", "128"
|
|
292
|
-
# "5", "256"
|
|
293
|
-
# "6", "512"
|
|
294
|
-
# ">=7", "1024"
|
|
295
|
-
#
|
|
296
|
-
# Voltage/Current conversion:
|
|
297
|
-
#
|
|
298
|
-
# "Value", "Conversion time"
|
|
299
|
-
#
|
|
300
|
-
# "0", "140µs"
|
|
301
|
-
# "1", "204µs"
|
|
302
|
-
# "2", "332µs"
|
|
303
|
-
# "3", "588µs"
|
|
304
|
-
# "4", "1.1ms"
|
|
305
|
-
# "5", "2.116ms"
|
|
306
|
-
# "6", "4.156ms"
|
|
307
|
-
# ">=7", "8.244ms"
|
|
308
|
-
#
|
|
309
|
-
# The default values are 3, 4 and 4 (64, 1.1ms, 1.1ms) for averaging, voltage
|
|
310
|
-
# conversion and current conversion.
|
|
311
294
|
def set_configuration(averaging, voltage_conversion_time, current_conversion_time)
|
|
312
|
-
|
|
295
|
+
check_validity
|
|
296
|
+
|
|
297
|
+
send_request FUNCTION_SET_CONFIGURATION, [averaging, voltage_conversion_time, current_conversion_time], 'C C C', 8, ''
|
|
313
298
|
end
|
|
314
299
|
|
|
315
300
|
# Returns the configuration as set by BrickletVoltageCurrentV2#set_configuration.
|
|
316
301
|
def get_configuration
|
|
317
|
-
|
|
302
|
+
check_validity
|
|
303
|
+
|
|
304
|
+
send_request FUNCTION_GET_CONFIGURATION, [], '', 11, 'C C C'
|
|
318
305
|
end
|
|
319
306
|
|
|
320
307
|
# Since the ADC and the shunt resistor used for the measurements
|
|
@@ -329,12 +316,16 @@ module Tinkerforge
|
|
|
329
316
|
# The calibration will be saved on the EEPROM of the Voltage/Current
|
|
330
317
|
# Bricklet and only needs to be done once.
|
|
331
318
|
def set_calibration(voltage_multiplier, voltage_divisor, current_multiplier, current_divisor)
|
|
332
|
-
|
|
319
|
+
check_validity
|
|
320
|
+
|
|
321
|
+
send_request FUNCTION_SET_CALIBRATION, [voltage_multiplier, voltage_divisor, current_multiplier, current_divisor], 'S S S S', 8, ''
|
|
333
322
|
end
|
|
334
323
|
|
|
335
324
|
# Returns the calibration as set by BrickletVoltageCurrentV2#set_calibration.
|
|
336
325
|
def get_calibration
|
|
337
|
-
|
|
326
|
+
check_validity
|
|
327
|
+
|
|
328
|
+
send_request FUNCTION_GET_CALIBRATION, [], '', 16, 'S S S S'
|
|
338
329
|
end
|
|
339
330
|
|
|
340
331
|
# Returns the error count for the communication between Brick and Bricklet.
|
|
@@ -349,7 +340,9 @@ module Tinkerforge
|
|
|
349
340
|
# The errors counts are for errors that occur on the Bricklet side. All
|
|
350
341
|
# Bricks have a similar function that returns the errors on the Brick side.
|
|
351
342
|
def get_spitfp_error_count
|
|
352
|
-
|
|
343
|
+
check_validity
|
|
344
|
+
|
|
345
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
|
353
346
|
end
|
|
354
347
|
|
|
355
348
|
# Sets the bootloader mode and returns the status after the requested
|
|
@@ -362,12 +355,16 @@ module Tinkerforge
|
|
|
362
355
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
363
356
|
# necessary to call it in a normal user program.
|
|
364
357
|
def set_bootloader_mode(mode)
|
|
365
|
-
|
|
358
|
+
check_validity
|
|
359
|
+
|
|
360
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
|
366
361
|
end
|
|
367
362
|
|
|
368
363
|
# Returns the current bootloader mode, see BrickletVoltageCurrentV2#set_bootloader_mode.
|
|
369
364
|
def get_bootloader_mode
|
|
370
|
-
|
|
365
|
+
check_validity
|
|
366
|
+
|
|
367
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
|
371
368
|
end
|
|
372
369
|
|
|
373
370
|
# Sets the firmware pointer for BrickletVoltageCurrentV2#write_firmware. The pointer has
|
|
@@ -377,7 +374,9 @@ module Tinkerforge
|
|
|
377
374
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
378
375
|
# necessary to call it in a normal user program.
|
|
379
376
|
def set_write_firmware_pointer(pointer)
|
|
380
|
-
|
|
377
|
+
check_validity
|
|
378
|
+
|
|
379
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
|
381
380
|
end
|
|
382
381
|
|
|
383
382
|
# Writes 64 Bytes of firmware at the position as written by
|
|
@@ -389,7 +388,9 @@ module Tinkerforge
|
|
|
389
388
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
390
389
|
# necessary to call it in a normal user program.
|
|
391
390
|
def write_firmware(data)
|
|
392
|
-
|
|
391
|
+
check_validity
|
|
392
|
+
|
|
393
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
|
393
394
|
end
|
|
394
395
|
|
|
395
396
|
# Sets the status LED configuration. By default the LED shows
|
|
@@ -400,22 +401,28 @@ module Tinkerforge
|
|
|
400
401
|
#
|
|
401
402
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
|
402
403
|
def set_status_led_config(config)
|
|
403
|
-
|
|
404
|
+
check_validity
|
|
405
|
+
|
|
406
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
|
404
407
|
end
|
|
405
408
|
|
|
406
409
|
# Returns the configuration as set by BrickletVoltageCurrentV2#set_status_led_config
|
|
407
410
|
def get_status_led_config
|
|
408
|
-
|
|
411
|
+
check_validity
|
|
412
|
+
|
|
413
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
|
409
414
|
end
|
|
410
415
|
|
|
411
|
-
# Returns the temperature
|
|
416
|
+
# Returns the temperature as measured inside the microcontroller. The
|
|
412
417
|
# value returned is not the ambient temperature!
|
|
413
418
|
#
|
|
414
419
|
# The temperature is only proportional to the real temperature and it has bad
|
|
415
420
|
# accuracy. Practically it is only useful as an indicator for
|
|
416
421
|
# temperature changes.
|
|
417
422
|
def get_chip_temperature
|
|
418
|
-
|
|
423
|
+
check_validity
|
|
424
|
+
|
|
425
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
|
419
426
|
end
|
|
420
427
|
|
|
421
428
|
# Calling this function will reset the Bricklet. All configurations
|
|
@@ -425,7 +432,9 @@ module Tinkerforge
|
|
|
425
432
|
# calling functions on the existing ones will result in
|
|
426
433
|
# undefined behavior!
|
|
427
434
|
def reset
|
|
428
|
-
|
|
435
|
+
check_validity
|
|
436
|
+
|
|
437
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
|
429
438
|
end
|
|
430
439
|
|
|
431
440
|
# Writes a new UID into flash. If you want to set a new UID
|
|
@@ -434,25 +443,31 @@ module Tinkerforge
|
|
|
434
443
|
#
|
|
435
444
|
# We recommend that you use Brick Viewer to change the UID.
|
|
436
445
|
def write_uid(uid)
|
|
437
|
-
|
|
446
|
+
check_validity
|
|
447
|
+
|
|
448
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
|
438
449
|
end
|
|
439
450
|
|
|
440
451
|
# Returns the current UID as an integer. Encode as
|
|
441
452
|
# Base58 to get the usual string version.
|
|
442
453
|
def read_uid
|
|
443
|
-
|
|
454
|
+
check_validity
|
|
455
|
+
|
|
456
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
|
444
457
|
end
|
|
445
458
|
|
|
446
459
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
447
460
|
# the position, the hardware and firmware version as well as the
|
|
448
461
|
# device identifier.
|
|
449
462
|
#
|
|
450
|
-
# The position can be 'a', 'b', 'c' or '
|
|
463
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
464
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
465
|
+
# position 'z'.
|
|
451
466
|
#
|
|
452
467
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
453
468
|
# |device_identifier_constant|
|
|
454
469
|
def get_identity
|
|
455
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
470
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
456
471
|
end
|
|
457
472
|
|
|
458
473
|
# 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
|
# Breakout for Infineon XMC1400 microcontroller
|
|
14
16
|
class BrickletXMC1400Breakout < Device
|
|
@@ -87,7 +89,7 @@ module Tinkerforge
|
|
|
87
89
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
88
90
|
# the IP Connection <tt>ipcon</tt>.
|
|
89
91
|
def initialize(uid, ipcon)
|
|
90
|
-
super uid, ipcon
|
|
92
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
91
93
|
|
|
92
94
|
@api_version = [2, 0, 0]
|
|
93
95
|
|
|
@@ -115,21 +117,26 @@ module Tinkerforge
|
|
|
115
117
|
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
116
118
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
117
119
|
|
|
118
|
-
@callback_formats[CALLBACK_ADC_VALUES] = 'S8'
|
|
119
|
-
@callback_formats[CALLBACK_COUNT] = 'L'
|
|
120
|
+
@callback_formats[CALLBACK_ADC_VALUES] = [24, 'S8']
|
|
121
|
+
@callback_formats[CALLBACK_COUNT] = [12, 'L']
|
|
120
122
|
|
|
123
|
+
@ipcon.add_device self
|
|
121
124
|
end
|
|
122
125
|
|
|
123
126
|
# Example for a setter function. The values are the values that can be given to
|
|
124
127
|
# the XMC_GPIO_Init function. See communication.c in the firmware.
|
|
125
128
|
def set_gpio_config(port, pin, mode, input_hysteresis, output_level)
|
|
126
|
-
|
|
129
|
+
check_validity
|
|
130
|
+
|
|
131
|
+
send_request FUNCTION_SET_GPIO_CONFIG, [port, pin, mode, input_hysteresis, output_level], 'C C C C ?', 8, ''
|
|
127
132
|
end
|
|
128
133
|
|
|
129
134
|
# Example for a getter function. Returns the result of a
|
|
130
135
|
# XMC_GPIO_GetInput call for the given port/pin.
|
|
131
136
|
def get_gpio_input(port, pin)
|
|
132
|
-
|
|
137
|
+
check_validity
|
|
138
|
+
|
|
139
|
+
send_request FUNCTION_GET_GPIO_INPUT, [port, pin], 'C C', 9, '?'
|
|
133
140
|
end
|
|
134
141
|
|
|
135
142
|
# Enables a ADC channel for the ADC driver example (adc.c/adc.h).
|
|
@@ -145,17 +152,23 @@ module Tinkerforge
|
|
|
145
152
|
# * Channel 6: P2_1
|
|
146
153
|
# * Channel 7: P2_2
|
|
147
154
|
def set_adc_channel_config(channel, enable)
|
|
148
|
-
|
|
155
|
+
check_validity
|
|
156
|
+
|
|
157
|
+
send_request FUNCTION_SET_ADC_CHANNEL_CONFIG, [channel, enable], 'C ?', 8, ''
|
|
149
158
|
end
|
|
150
159
|
|
|
151
160
|
# Returns the config for the given channel as set by BrickletXMC1400Breakout#set_adc_channel_config.
|
|
152
161
|
def get_adc_channel_config(channel)
|
|
153
|
-
|
|
162
|
+
check_validity
|
|
163
|
+
|
|
164
|
+
send_request FUNCTION_GET_ADC_CHANNEL_CONFIG, [channel], 'C', 9, '?'
|
|
154
165
|
end
|
|
155
166
|
|
|
156
167
|
# Returns the 12-bit value of the given ADC channel of the ADC driver example.
|
|
157
168
|
def get_adc_channel_value(channel)
|
|
158
|
-
|
|
169
|
+
check_validity
|
|
170
|
+
|
|
171
|
+
send_request FUNCTION_GET_ADC_CHANNEL_VALUE, [channel], 'C', 10, 'S'
|
|
159
172
|
end
|
|
160
173
|
|
|
161
174
|
# Returns the values for all 8 ADC channels of the adc driver example.
|
|
@@ -164,10 +177,12 @@ module Tinkerforge
|
|
|
164
177
|
#
|
|
165
178
|
# See BrickletXMC1400Breakout#set_adc_values_callback_configuration and CALLBACK_ADC_VALUES callback.
|
|
166
179
|
def get_adc_values
|
|
167
|
-
|
|
180
|
+
check_validity
|
|
181
|
+
|
|
182
|
+
send_request FUNCTION_GET_ADC_VALUES, [], '', 24, 'S8'
|
|
168
183
|
end
|
|
169
184
|
|
|
170
|
-
# The period
|
|
185
|
+
# The period is the period with which the CALLBACK_ADC_VALUES
|
|
171
186
|
# callback is triggered periodically. A value of 0 turns the callback off.
|
|
172
187
|
#
|
|
173
188
|
# If the `value has to change`-parameter is set to true, the callback is only
|
|
@@ -176,16 +191,18 @@ module Tinkerforge
|
|
|
176
191
|
#
|
|
177
192
|
# If it is set to false, the callback is continuously triggered with the period,
|
|
178
193
|
# independent of the value.
|
|
179
|
-
#
|
|
180
|
-
# The default value is (0, false).
|
|
181
194
|
def set_adc_values_callback_configuration(period, value_has_to_change)
|
|
182
|
-
|
|
195
|
+
check_validity
|
|
196
|
+
|
|
197
|
+
send_request FUNCTION_SET_ADC_VALUES_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
|
|
183
198
|
end
|
|
184
199
|
|
|
185
200
|
# Returns the callback configuration as set by
|
|
186
201
|
# BrickletXMC1400Breakout#set_adc_values_callback_configuration.
|
|
187
202
|
def get_adc_values_callback_configuration
|
|
188
|
-
|
|
203
|
+
check_validity
|
|
204
|
+
|
|
205
|
+
send_request FUNCTION_GET_ADC_VALUES_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
|
|
189
206
|
end
|
|
190
207
|
|
|
191
208
|
# Returns the value of the example count (see example.c).
|
|
@@ -199,10 +216,12 @@ module Tinkerforge
|
|
|
199
216
|
# CALLBACK_COUNT callback. You can set the callback configuration
|
|
200
217
|
# with BrickletXMC1400Breakout#set_count_callback_configuration.
|
|
201
218
|
def get_count
|
|
202
|
-
|
|
219
|
+
check_validity
|
|
220
|
+
|
|
221
|
+
send_request FUNCTION_GET_COUNT, [], '', 12, 'L'
|
|
203
222
|
end
|
|
204
223
|
|
|
205
|
-
# The period
|
|
224
|
+
# The period is the period with which the CALLBACK_COUNT callback is triggered
|
|
206
225
|
# periodically. A value of 0 turns the callback off.
|
|
207
226
|
#
|
|
208
227
|
# If the `value has to change`-parameter is set to true, the callback is only
|
|
@@ -227,15 +246,17 @@ module Tinkerforge
|
|
|
227
246
|
# "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
|
|
228
247
|
#
|
|
229
248
|
# If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
|
|
230
|
-
#
|
|
231
|
-
# The default value is (0, false, 'x', 0, 0).
|
|
232
249
|
def set_count_callback_configuration(period, value_has_to_change, option, min, max)
|
|
233
|
-
|
|
250
|
+
check_validity
|
|
251
|
+
|
|
252
|
+
send_request FUNCTION_SET_COUNT_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k L L', 8, ''
|
|
234
253
|
end
|
|
235
254
|
|
|
236
255
|
# Returns the callback configuration as set by BrickletXMC1400Breakout#set_count_callback_configuration.
|
|
237
256
|
def get_count_callback_configuration
|
|
238
|
-
|
|
257
|
+
check_validity
|
|
258
|
+
|
|
259
|
+
send_request FUNCTION_GET_COUNT_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k L L'
|
|
239
260
|
end
|
|
240
261
|
|
|
241
262
|
# Returns the error count for the communication between Brick and Bricklet.
|
|
@@ -250,7 +271,9 @@ module Tinkerforge
|
|
|
250
271
|
# The errors counts are for errors that occur on the Bricklet side. All
|
|
251
272
|
# Bricks have a similar function that returns the errors on the Brick side.
|
|
252
273
|
def get_spitfp_error_count
|
|
253
|
-
|
|
274
|
+
check_validity
|
|
275
|
+
|
|
276
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
|
254
277
|
end
|
|
255
278
|
|
|
256
279
|
# Sets the bootloader mode and returns the status after the requested
|
|
@@ -263,12 +286,16 @@ module Tinkerforge
|
|
|
263
286
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
264
287
|
# necessary to call it in a normal user program.
|
|
265
288
|
def set_bootloader_mode(mode)
|
|
266
|
-
|
|
289
|
+
check_validity
|
|
290
|
+
|
|
291
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
|
267
292
|
end
|
|
268
293
|
|
|
269
294
|
# Returns the current bootloader mode, see BrickletXMC1400Breakout#set_bootloader_mode.
|
|
270
295
|
def get_bootloader_mode
|
|
271
|
-
|
|
296
|
+
check_validity
|
|
297
|
+
|
|
298
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
|
272
299
|
end
|
|
273
300
|
|
|
274
301
|
# Sets the firmware pointer for BrickletXMC1400Breakout#write_firmware. The pointer has
|
|
@@ -278,7 +305,9 @@ module Tinkerforge
|
|
|
278
305
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
279
306
|
# necessary to call it in a normal user program.
|
|
280
307
|
def set_write_firmware_pointer(pointer)
|
|
281
|
-
|
|
308
|
+
check_validity
|
|
309
|
+
|
|
310
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
|
282
311
|
end
|
|
283
312
|
|
|
284
313
|
# Writes 64 Bytes of firmware at the position as written by
|
|
@@ -290,7 +319,9 @@ module Tinkerforge
|
|
|
290
319
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
291
320
|
# necessary to call it in a normal user program.
|
|
292
321
|
def write_firmware(data)
|
|
293
|
-
|
|
322
|
+
check_validity
|
|
323
|
+
|
|
324
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
|
294
325
|
end
|
|
295
326
|
|
|
296
327
|
# Sets the status LED configuration. By default the LED shows
|
|
@@ -301,22 +332,28 @@ module Tinkerforge
|
|
|
301
332
|
#
|
|
302
333
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
|
303
334
|
def set_status_led_config(config)
|
|
304
|
-
|
|
335
|
+
check_validity
|
|
336
|
+
|
|
337
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
|
305
338
|
end
|
|
306
339
|
|
|
307
340
|
# Returns the configuration as set by BrickletXMC1400Breakout#set_status_led_config
|
|
308
341
|
def get_status_led_config
|
|
309
|
-
|
|
342
|
+
check_validity
|
|
343
|
+
|
|
344
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
|
310
345
|
end
|
|
311
346
|
|
|
312
|
-
# Returns the temperature
|
|
347
|
+
# Returns the temperature as measured inside the microcontroller. The
|
|
313
348
|
# value returned is not the ambient temperature!
|
|
314
349
|
#
|
|
315
350
|
# The temperature is only proportional to the real temperature and it has bad
|
|
316
351
|
# accuracy. Practically it is only useful as an indicator for
|
|
317
352
|
# temperature changes.
|
|
318
353
|
def get_chip_temperature
|
|
319
|
-
|
|
354
|
+
check_validity
|
|
355
|
+
|
|
356
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
|
320
357
|
end
|
|
321
358
|
|
|
322
359
|
# Calling this function will reset the Bricklet. All configurations
|
|
@@ -326,7 +363,9 @@ module Tinkerforge
|
|
|
326
363
|
# calling functions on the existing ones will result in
|
|
327
364
|
# undefined behavior!
|
|
328
365
|
def reset
|
|
329
|
-
|
|
366
|
+
check_validity
|
|
367
|
+
|
|
368
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
|
330
369
|
end
|
|
331
370
|
|
|
332
371
|
# Writes a new UID into flash. If you want to set a new UID
|
|
@@ -335,25 +374,31 @@ module Tinkerforge
|
|
|
335
374
|
#
|
|
336
375
|
# We recommend that you use Brick Viewer to change the UID.
|
|
337
376
|
def write_uid(uid)
|
|
338
|
-
|
|
377
|
+
check_validity
|
|
378
|
+
|
|
379
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
|
339
380
|
end
|
|
340
381
|
|
|
341
382
|
# Returns the current UID as an integer. Encode as
|
|
342
383
|
# Base58 to get the usual string version.
|
|
343
384
|
def read_uid
|
|
344
|
-
|
|
385
|
+
check_validity
|
|
386
|
+
|
|
387
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
|
345
388
|
end
|
|
346
389
|
|
|
347
390
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
348
391
|
# the position, the hardware and firmware version as well as the
|
|
349
392
|
# device identifier.
|
|
350
393
|
#
|
|
351
|
-
# The position can be 'a', 'b', 'c' or '
|
|
394
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
395
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
396
|
+
# position 'z'.
|
|
352
397
|
#
|
|
353
398
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
354
399
|
# |device_identifier_constant|
|
|
355
400
|
def get_identity
|
|
356
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
401
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
357
402
|
end
|
|
358
403
|
|
|
359
404
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|