tinkerforge 2.1.22 → 2.1.23
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 +4 -4
- data/lib/tinkerforge/brick_dc.rb +3 -3
- data/lib/tinkerforge/brick_hat.rb +11 -7
- data/lib/tinkerforge/brick_hat_zero.rb +2 -2
- data/lib/tinkerforge/brick_imu.rb +3 -3
- data/lib/tinkerforge/brick_imu_v2.rb +3 -3
- data/lib/tinkerforge/brick_master.rb +5 -5
- data/lib/tinkerforge/brick_red.rb +2 -2
- data/lib/tinkerforge/brick_servo.rb +3 -3
- data/lib/tinkerforge/brick_silent_stepper.rb +3 -3
- data/lib/tinkerforge/brick_stepper.rb +4 -4
- data/lib/tinkerforge/bricklet_accelerometer.rb +2 -2
- data/lib/tinkerforge/bricklet_accelerometer_v2.rb +81 -6
- data/lib/tinkerforge/bricklet_air_quality.rb +2 -2
- data/lib/tinkerforge/bricklet_ambient_light.rb +2 -2
- data/lib/tinkerforge/bricklet_ambient_light_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_ambient_light_v3.rb +2 -2
- data/lib/tinkerforge/bricklet_analog_in.rb +2 -2
- data/lib/tinkerforge/bricklet_analog_in_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_analog_in_v3.rb +2 -2
- data/lib/tinkerforge/bricklet_analog_out.rb +2 -2
- data/lib/tinkerforge/bricklet_analog_out_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_analog_out_v3.rb +2 -2
- data/lib/tinkerforge/bricklet_barometer.rb +2 -2
- data/lib/tinkerforge/bricklet_barometer_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_can.rb +2 -2
- data/lib/tinkerforge/bricklet_can_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_co2.rb +2 -2
- data/lib/tinkerforge/bricklet_co2_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_color.rb +4 -4
- data/lib/tinkerforge/bricklet_color_v2.rb +449 -0
- data/lib/tinkerforge/bricklet_compass.rb +356 -0
- data/lib/tinkerforge/bricklet_current12.rb +2 -2
- data/lib/tinkerforge/bricklet_current25.rb +2 -2
- data/lib/tinkerforge/bricklet_distance_ir.rb +2 -2
- data/lib/tinkerforge/bricklet_distance_ir_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_distance_us.rb +2 -2
- data/lib/tinkerforge/bricklet_distance_us_v2.rb +300 -0
- data/lib/tinkerforge/bricklet_dmx.rb +2 -2
- data/lib/tinkerforge/bricklet_dual_button.rb +2 -2
- data/lib/tinkerforge/bricklet_dual_button_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_dual_relay.rb +2 -2
- data/lib/tinkerforge/bricklet_dust_detector.rb +2 -2
- data/lib/tinkerforge/bricklet_e_paper_296x128.rb +2 -2
- data/lib/tinkerforge/bricklet_energy_monitor.rb +375 -0
- data/lib/tinkerforge/bricklet_gps.rb +2 -2
- data/lib/tinkerforge/bricklet_gps_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_hall_effect.rb +2 -2
- data/lib/tinkerforge/bricklet_hall_effect_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_humidity.rb +2 -2
- data/lib/tinkerforge/bricklet_humidity_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_analog_out.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_counter.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_io16.rb +2 -2
- data/lib/tinkerforge/bricklet_io16_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_io4.rb +2 -2
- data/lib/tinkerforge/bricklet_io4_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_isolator.rb +2 -2
- data/lib/tinkerforge/bricklet_joystick.rb +2 -2
- data/lib/tinkerforge/bricklet_joystick_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_laser_range_finder.rb +2 -2
- data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +5 -5
- data/lib/tinkerforge/bricklet_lcd_128x64.rb +24 -2
- data/lib/tinkerforge/bricklet_lcd_16x2.rb +2 -2
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +2 -2
- data/lib/tinkerforge/bricklet_led_strip.rb +2 -2
- data/lib/tinkerforge/bricklet_led_strip_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_line.rb +2 -2
- data/lib/tinkerforge/bricklet_linear_poti.rb +2 -2
- data/lib/tinkerforge/bricklet_linear_poti_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_load_cell.rb +2 -2
- data/lib/tinkerforge/bricklet_load_cell_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_moisture.rb +2 -2
- data/lib/tinkerforge/bricklet_motion_detector.rb +2 -2
- data/lib/tinkerforge/bricklet_motion_detector_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +2 -2
- data/lib/tinkerforge/bricklet_multi_touch.rb +2 -2
- data/lib/tinkerforge/bricklet_multi_touch_v2.rb +334 -0
- data/lib/tinkerforge/bricklet_nfc.rb +2 -2
- data/lib/tinkerforge/bricklet_nfc_rfid.rb +2 -2
- data/lib/tinkerforge/bricklet_oled_128x64.rb +2 -2
- data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +24 -2
- data/lib/tinkerforge/bricklet_oled_64x48.rb +2 -2
- data/lib/tinkerforge/bricklet_one_wire.rb +2 -2
- data/lib/tinkerforge/bricklet_outdoor_weather.rb +2 -2
- data/lib/tinkerforge/bricklet_particulate_matter.rb +2 -2
- data/lib/tinkerforge/bricklet_piezo_buzzer.rb +2 -2
- data/lib/tinkerforge/bricklet_piezo_speaker.rb +2 -2
- data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_ptc.rb +2 -2
- data/lib/tinkerforge/bricklet_ptc_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_real_time_clock.rb +2 -2
- data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_remote_switch.rb +2 -2
- data/lib/tinkerforge/bricklet_remote_switch_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_rgb_led.rb +2 -2
- data/lib/tinkerforge/bricklet_rgb_led_button.rb +2 -2
- data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +2 -2
- data/lib/tinkerforge/bricklet_rgb_led_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_rotary_encoder.rb +2 -2
- data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_rotary_poti.rb +2 -2
- data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +259 -0
- data/lib/tinkerforge/bricklet_rs232.rb +2 -2
- data/lib/tinkerforge/bricklet_rs232_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_rs485.rb +70 -60
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +2 -2
- data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_solid_state_relay.rb +2 -2
- data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_sound_intensity.rb +2 -2
- data/lib/tinkerforge/bricklet_sound_pressure_level.rb +2 -2
- data/lib/tinkerforge/bricklet_temperature.rb +2 -2
- data/lib/tinkerforge/bricklet_temperature_ir.rb +5 -3
- data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +3 -11
- data/lib/tinkerforge/bricklet_temperature_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_thermal_imaging.rb +2 -2
- data/lib/tinkerforge/bricklet_thermocouple.rb +2 -2
- data/lib/tinkerforge/bricklet_thermocouple_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_tilt.rb +2 -2
- data/lib/tinkerforge/bricklet_uv_light.rb +2 -2
- data/lib/tinkerforge/bricklet_uv_light_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_voltage.rb +2 -2
- data/lib/tinkerforge/bricklet_voltage_current.rb +2 -2
- data/lib/tinkerforge/bricklet_voltage_current_v2.rb +13 -2
- data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +365 -0
- data/lib/tinkerforge/ip_connection.rb +1 -1
- data/lib/tinkerforge/version.rb +1 -1
- metadata +10 -3
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2019-
|
|
3
|
+
# This file was automatically generated on 2019-08-23. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.23 #
|
|
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 #
|
|
@@ -134,7 +134,7 @@ module Tinkerforge
|
|
|
134
134
|
#
|
|
135
135
|
# The emissivity is usually given as a value between 0.0 and 1.0. A list of
|
|
136
136
|
# emissivities of different materials can be found
|
|
137
|
-
# `here <
|
|
137
|
+
# `here <https://www.infrared-thermography.com/material.htm>`__.
|
|
138
138
|
#
|
|
139
139
|
# The parameter of BrickletTemperatureIR#set_emissivity has to be given with a factor of
|
|
140
140
|
# 65535 (16-bit). For example: An emissivity of 0.1 can be set with the
|
|
@@ -146,6 +146,8 @@ module Tinkerforge
|
|
|
146
146
|
#
|
|
147
147
|
# The default emissivity is 1.0 (value of 65535) and the minimum emissivity the
|
|
148
148
|
# sensor can handle is 0.1 (value of 6553).
|
|
149
|
+
#
|
|
150
|
+
# The emissivity is stored in non-volatile memory and will still be used after a restart or power cycle of the Bricklet.
|
|
149
151
|
def set_emissivity(emissivity)
|
|
150
152
|
send_request FUNCTION_SET_EMISSIVITY, [emissivity], 'S', 0, ''
|
|
151
153
|
end
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2019-
|
|
3
|
+
# This file was automatically generated on 2019-08-23. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.23 #
|
|
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 #
|
|
@@ -107,10 +107,6 @@ module Tinkerforge
|
|
|
107
107
|
# e.g. a value of 423 means that an ambient temperature of 42.3 °C is
|
|
108
108
|
# measured.
|
|
109
109
|
#
|
|
110
|
-
# If you want to get the ambient temperature periodically, it is recommended
|
|
111
|
-
# to use the CALLBACK_AMBIENT_TEMPERATURE callback and set the period with
|
|
112
|
-
# BrickletTemperatureIRV2#set_ambient_temperature_callback_configuration.
|
|
113
|
-
#
|
|
114
110
|
#
|
|
115
111
|
# If you want to get the value periodically, it is recommended to use the
|
|
116
112
|
# CALLBACK_AMBIENT_TEMPERATURE callback. You can set the callback configuration
|
|
@@ -165,10 +161,6 @@ module Tinkerforge
|
|
|
165
161
|
# <https://en.wikipedia.org/wiki/Emissivity>`__. The emissivity of the material
|
|
166
162
|
# can be set with BrickletTemperatureIRV2#set_emissivity.
|
|
167
163
|
#
|
|
168
|
-
# If you want to get the object temperature periodically, it is recommended
|
|
169
|
-
# to use the CALLBACK_OBJECT_TEMPERATURE callback and set the period with
|
|
170
|
-
# BrickletTemperatureIRV2#set_object_temperature_callback_configuration.
|
|
171
|
-
#
|
|
172
164
|
#
|
|
173
165
|
# If you want to get the value periodically, it is recommended to use the
|
|
174
166
|
# CALLBACK_OBJECT_TEMPERATURE callback. You can set the callback configuration
|
|
@@ -219,7 +211,7 @@ module Tinkerforge
|
|
|
219
211
|
#
|
|
220
212
|
# The emissivity is usually given as a value between 0.0 and 1.0. A list of
|
|
221
213
|
# emissivities of different materials can be found
|
|
222
|
-
# `here <
|
|
214
|
+
# `here <https://www.infrared-thermography.com/material.htm>`__.
|
|
223
215
|
#
|
|
224
216
|
# The parameter of BrickletTemperatureIRV2#set_emissivity has to be given with a factor of
|
|
225
217
|
# 65535 (16-bit). For example: An emissivity of 0.1 can be set with the
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2019-
|
|
3
|
+
# This file was automatically generated on 2019-08-23. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.23 #
|
|
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 #
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2019-
|
|
3
|
+
# This file was automatically generated on 2019-08-23. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.23 #
|
|
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 #
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2019-
|
|
3
|
+
# This file was automatically generated on 2019-08-23. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.23 #
|
|
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 #
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2019-
|
|
3
|
+
# This file was automatically generated on 2019-08-23. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.23 #
|
|
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 #
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2019-
|
|
3
|
+
# This file was automatically generated on 2019-08-23. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.23 #
|
|
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 #
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2019-
|
|
3
|
+
# This file was automatically generated on 2019-08-23. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.23 #
|
|
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 #
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2019-
|
|
3
|
+
# This file was automatically generated on 2019-08-23. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.23 #
|
|
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 #
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2019-
|
|
3
|
+
# This file was automatically generated on 2019-08-23. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.23 #
|
|
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 #
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2019-
|
|
3
|
+
# This file was automatically generated on 2019-08-23. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.23 #
|
|
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 #
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2019-
|
|
3
|
+
# This file was automatically generated on 2019-08-23. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.23 #
|
|
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 #
|
|
@@ -72,6 +72,14 @@ module Tinkerforge
|
|
|
72
72
|
AVERAGING_256 = 5 # :nodoc:
|
|
73
73
|
AVERAGING_512 = 6 # :nodoc:
|
|
74
74
|
AVERAGING_1024 = 7 # :nodoc:
|
|
75
|
+
CONVERSION_TIME_140US = 0 # :nodoc:
|
|
76
|
+
CONVERSION_TIME_204US = 1 # :nodoc:
|
|
77
|
+
CONVERSION_TIME_332US = 2 # :nodoc:
|
|
78
|
+
CONVERSION_TIME_588US = 3 # :nodoc:
|
|
79
|
+
CONVERSION_TIME_1_1MS = 4 # :nodoc:
|
|
80
|
+
CONVERSION_TIME_2_116MS = 5 # :nodoc:
|
|
81
|
+
CONVERSION_TIME_4_156MS = 6 # :nodoc:
|
|
82
|
+
CONVERSION_TIME_8_244MS = 7 # :nodoc:
|
|
75
83
|
BOOTLOADER_MODE_BOOTLOADER = 0 # :nodoc:
|
|
76
84
|
BOOTLOADER_MODE_FIRMWARE = 1 # :nodoc:
|
|
77
85
|
BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT = 2 # :nodoc:
|
|
@@ -317,6 +325,9 @@ module Tinkerforge
|
|
|
317
325
|
# are measuring 1023mA, you can calibrate the Voltage/Current Bricklet
|
|
318
326
|
# by setting the current multiplier to 1000 and the divisor to 1023.
|
|
319
327
|
# The same applies for the voltage.
|
|
328
|
+
#
|
|
329
|
+
# The calibration will be saved on the EEPROM of the Voltage/Current
|
|
330
|
+
# Bricklet and only needs to be done once.
|
|
320
331
|
def set_calibration(voltage_multiplier, voltage_divisor, current_multiplier, current_divisor)
|
|
321
332
|
send_request FUNCTION_SET_CALIBRATION, [voltage_multiplier, voltage_divisor, current_multiplier, current_divisor], 'S S S S', 0, ''
|
|
322
333
|
end
|
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
# -*- ruby encoding: utf-8 -*-
|
|
2
|
+
#############################################################
|
|
3
|
+
# This file was automatically generated on 2019-08-23. #
|
|
4
|
+
# #
|
|
5
|
+
# Ruby Bindings Version 2.1.23 #
|
|
6
|
+
# #
|
|
7
|
+
# If you have a bugfix for this file and want to commit it, #
|
|
8
|
+
# please fix the bug in the generator. You can find a link #
|
|
9
|
+
# to the generators git repository on tinkerforge.com #
|
|
10
|
+
#############################################################
|
|
11
|
+
|
|
12
|
+
module Tinkerforge
|
|
13
|
+
# Breakout for Infineon XMC1400 microcontroller
|
|
14
|
+
class BrickletXMC1400Breakout < Device
|
|
15
|
+
DEVICE_IDENTIFIER = 279 # :nodoc:
|
|
16
|
+
DEVICE_DISPLAY_NAME = 'XMC1400 Breakout Bricklet' # :nodoc:
|
|
17
|
+
|
|
18
|
+
# This callback is triggered periodically according to the configuration set by
|
|
19
|
+
# BrickletXMC1400Breakout#set_adc_values_callback_configuration.
|
|
20
|
+
#
|
|
21
|
+
# The parameters are the same as BrickletXMC1400Breakout#get_adc_values.
|
|
22
|
+
CALLBACK_ADC_VALUES = 9
|
|
23
|
+
|
|
24
|
+
# This callback is triggered periodically according to the configuration set by
|
|
25
|
+
# BrickletXMC1400Breakout#set_count_callback_configuration.
|
|
26
|
+
#
|
|
27
|
+
# The parameter is the same as BrickletXMC1400Breakout#get_count.
|
|
28
|
+
CALLBACK_COUNT = 13
|
|
29
|
+
|
|
30
|
+
FUNCTION_SET_GPIO_CONFIG = 1 # :nodoc:
|
|
31
|
+
FUNCTION_GET_GPIO_INPUT = 2 # :nodoc:
|
|
32
|
+
FUNCTION_SET_ADC_CHANNEL_CONFIG = 3 # :nodoc:
|
|
33
|
+
FUNCTION_GET_ADC_CHANNEL_CONFIG = 4 # :nodoc:
|
|
34
|
+
FUNCTION_GET_ADC_CHANNEL_VALUE = 5 # :nodoc:
|
|
35
|
+
FUNCTION_GET_ADC_VALUES = 6 # :nodoc:
|
|
36
|
+
FUNCTION_SET_ADC_VALUES_CALLBACK_CONFIGURATION = 7 # :nodoc:
|
|
37
|
+
FUNCTION_GET_ADC_VALUES_CALLBACK_CONFIGURATION = 8 # :nodoc:
|
|
38
|
+
FUNCTION_GET_COUNT = 10 # :nodoc:
|
|
39
|
+
FUNCTION_SET_COUNT_CALLBACK_CONFIGURATION = 11 # :nodoc:
|
|
40
|
+
FUNCTION_GET_COUNT_CALLBACK_CONFIGURATION = 12 # :nodoc:
|
|
41
|
+
FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
|
|
42
|
+
FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
|
|
43
|
+
FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
|
|
44
|
+
FUNCTION_SET_WRITE_FIRMWARE_POINTER = 237 # :nodoc:
|
|
45
|
+
FUNCTION_WRITE_FIRMWARE = 238 # :nodoc:
|
|
46
|
+
FUNCTION_SET_STATUS_LED_CONFIG = 239 # :nodoc:
|
|
47
|
+
FUNCTION_GET_STATUS_LED_CONFIG = 240 # :nodoc:
|
|
48
|
+
FUNCTION_GET_CHIP_TEMPERATURE = 242 # :nodoc:
|
|
49
|
+
FUNCTION_RESET = 243 # :nodoc:
|
|
50
|
+
FUNCTION_WRITE_UID = 248 # :nodoc:
|
|
51
|
+
FUNCTION_READ_UID = 249 # :nodoc:
|
|
52
|
+
FUNCTION_GET_IDENTITY = 255 # :nodoc:
|
|
53
|
+
|
|
54
|
+
THRESHOLD_OPTION_OFF = 'x' # :nodoc:
|
|
55
|
+
THRESHOLD_OPTION_OUTSIDE = 'o' # :nodoc:
|
|
56
|
+
THRESHOLD_OPTION_INSIDE = 'i' # :nodoc:
|
|
57
|
+
THRESHOLD_OPTION_SMALLER = '<' # :nodoc:
|
|
58
|
+
THRESHOLD_OPTION_GREATER = '>' # :nodoc:
|
|
59
|
+
GPIO_MODE_INPUT_TRISTATE = 0 # :nodoc:
|
|
60
|
+
GPIO_MODE_INPUT_PULL_DOWN = 1 # :nodoc:
|
|
61
|
+
GPIO_MODE_INPUT_PULL_UP = 2 # :nodoc:
|
|
62
|
+
GPIO_MODE_INPUT_SAMPLING = 3 # :nodoc:
|
|
63
|
+
GPIO_MODE_INPUT_INVERTED_TRISTATE = 4 # :nodoc:
|
|
64
|
+
GPIO_MODE_INPUT_INVERTED_PULL_DOWN = 5 # :nodoc:
|
|
65
|
+
GPIO_MODE_INPUT_INVERTED_PULL_UP = 6 # :nodoc:
|
|
66
|
+
GPIO_MODE_INPUT_INVERTED_SAMPLING = 7 # :nodoc:
|
|
67
|
+
GPIO_MODE_OUTPUT_PUSH_PULL = 8 # :nodoc:
|
|
68
|
+
GPIO_MODE_OUTPUT_OPEN_DRAIN = 9 # :nodoc:
|
|
69
|
+
GPIO_INPUT_HYSTERESIS_STANDARD = 0 # :nodoc:
|
|
70
|
+
GPIO_INPUT_HYSTERESIS_LARGE = 4 # :nodoc:
|
|
71
|
+
BOOTLOADER_MODE_BOOTLOADER = 0 # :nodoc:
|
|
72
|
+
BOOTLOADER_MODE_FIRMWARE = 1 # :nodoc:
|
|
73
|
+
BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT = 2 # :nodoc:
|
|
74
|
+
BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT = 3 # :nodoc:
|
|
75
|
+
BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT = 4 # :nodoc:
|
|
76
|
+
BOOTLOADER_STATUS_OK = 0 # :nodoc:
|
|
77
|
+
BOOTLOADER_STATUS_INVALID_MODE = 1 # :nodoc:
|
|
78
|
+
BOOTLOADER_STATUS_NO_CHANGE = 2 # :nodoc:
|
|
79
|
+
BOOTLOADER_STATUS_ENTRY_FUNCTION_NOT_PRESENT = 3 # :nodoc:
|
|
80
|
+
BOOTLOADER_STATUS_DEVICE_IDENTIFIER_INCORRECT = 4 # :nodoc:
|
|
81
|
+
BOOTLOADER_STATUS_CRC_MISMATCH = 5 # :nodoc:
|
|
82
|
+
STATUS_LED_CONFIG_OFF = 0 # :nodoc:
|
|
83
|
+
STATUS_LED_CONFIG_ON = 1 # :nodoc:
|
|
84
|
+
STATUS_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
|
|
85
|
+
STATUS_LED_CONFIG_SHOW_STATUS = 3 # :nodoc:
|
|
86
|
+
|
|
87
|
+
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
88
|
+
# the IP Connection <tt>ipcon</tt>.
|
|
89
|
+
def initialize(uid, ipcon)
|
|
90
|
+
super uid, ipcon
|
|
91
|
+
|
|
92
|
+
@api_version = [2, 0, 0]
|
|
93
|
+
|
|
94
|
+
@response_expected[FUNCTION_SET_GPIO_CONFIG] = RESPONSE_EXPECTED_FALSE
|
|
95
|
+
@response_expected[FUNCTION_GET_GPIO_INPUT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
96
|
+
@response_expected[FUNCTION_SET_ADC_CHANNEL_CONFIG] = RESPONSE_EXPECTED_FALSE
|
|
97
|
+
@response_expected[FUNCTION_GET_ADC_CHANNEL_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
98
|
+
@response_expected[FUNCTION_GET_ADC_CHANNEL_VALUE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
99
|
+
@response_expected[FUNCTION_GET_ADC_VALUES] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
100
|
+
@response_expected[FUNCTION_SET_ADC_VALUES_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
|
|
101
|
+
@response_expected[FUNCTION_GET_ADC_VALUES_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
102
|
+
@response_expected[FUNCTION_GET_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
103
|
+
@response_expected[FUNCTION_SET_COUNT_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
|
|
104
|
+
@response_expected[FUNCTION_GET_COUNT_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
105
|
+
@response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
106
|
+
@response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
107
|
+
@response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
108
|
+
@response_expected[FUNCTION_SET_WRITE_FIRMWARE_POINTER] = RESPONSE_EXPECTED_FALSE
|
|
109
|
+
@response_expected[FUNCTION_WRITE_FIRMWARE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
110
|
+
@response_expected[FUNCTION_SET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
|
|
111
|
+
@response_expected[FUNCTION_GET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
112
|
+
@response_expected[FUNCTION_GET_CHIP_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
113
|
+
@response_expected[FUNCTION_RESET] = RESPONSE_EXPECTED_FALSE
|
|
114
|
+
@response_expected[FUNCTION_WRITE_UID] = RESPONSE_EXPECTED_FALSE
|
|
115
|
+
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
116
|
+
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
117
|
+
|
|
118
|
+
@callback_formats[CALLBACK_ADC_VALUES] = 'S8'
|
|
119
|
+
@callback_formats[CALLBACK_COUNT] = 'L'
|
|
120
|
+
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# Example for a setter function. The values are the values that can be given to
|
|
124
|
+
# the XMC_GPIO_Init function. See communication.c in the firmware.
|
|
125
|
+
def set_gpio_config(port, pin, mode, input_hysteresis, output_level)
|
|
126
|
+
send_request FUNCTION_SET_GPIO_CONFIG, [port, pin, mode, input_hysteresis, output_level], 'C C C C ?', 0, ''
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# Example for a getter function. Returns the result of a
|
|
130
|
+
# XMC_GPIO_GetInput call for the given port/pin.
|
|
131
|
+
def get_gpio_input(port, pin)
|
|
132
|
+
send_request FUNCTION_GET_GPIO_INPUT, [port, pin], 'C C', 1, '?'
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# Enables a ADC channel for the ADC driver example (adc.c/adc.h).
|
|
136
|
+
#
|
|
137
|
+
# There are 8 ADC channels and they correspond to the following pins:
|
|
138
|
+
#
|
|
139
|
+
# * Channel 0: P2_6
|
|
140
|
+
# * Channel 1: P2_8
|
|
141
|
+
# * Channel 2: P2_9
|
|
142
|
+
# * Channel 3: P2_10
|
|
143
|
+
# * Channel 4: P2_11
|
|
144
|
+
# * Channel 5: P2_0
|
|
145
|
+
# * Channel 6: P2_1
|
|
146
|
+
# * Channel 7: P2_2
|
|
147
|
+
def set_adc_channel_config(channel, enable)
|
|
148
|
+
send_request FUNCTION_SET_ADC_CHANNEL_CONFIG, [channel, enable], 'C ?', 0, ''
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
# Returns the config for the given channel as set by BrickletXMC1400Breakout#set_adc_channel_config.
|
|
152
|
+
def get_adc_channel_config(channel)
|
|
153
|
+
send_request FUNCTION_GET_ADC_CHANNEL_CONFIG, [channel], 'C', 1, '?'
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
# Returns the 12-bit value of the given ADC channel of the ADC driver example.
|
|
157
|
+
def get_adc_channel_value(channel)
|
|
158
|
+
send_request FUNCTION_GET_ADC_CHANNEL_VALUE, [channel], 'C', 2, 'S'
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
# Returns the values for all 8 ADC channels of the adc driver example.
|
|
162
|
+
#
|
|
163
|
+
# This example function also has a corresponding callback.
|
|
164
|
+
#
|
|
165
|
+
# See BrickletXMC1400Breakout#set_adc_values_callback_configuration and CALLBACK_ADC_VALUES callback.
|
|
166
|
+
def get_adc_values
|
|
167
|
+
send_request FUNCTION_GET_ADC_VALUES, [], '', 16, 'S8'
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
# The period in ms is the period with which the CALLBACK_ADC_VALUES
|
|
171
|
+
# callback is triggered periodically. A value of 0 turns the callback off.
|
|
172
|
+
#
|
|
173
|
+
# If the `value has to change`-parameter is set to true, the callback is only
|
|
174
|
+
# triggered after the value has changed. If the value didn't change within the
|
|
175
|
+
# period, the callback is triggered immediately on change.
|
|
176
|
+
#
|
|
177
|
+
# If it is set to false, the callback is continuously triggered with the period,
|
|
178
|
+
# independent of the value.
|
|
179
|
+
#
|
|
180
|
+
# The default value is (0, false).
|
|
181
|
+
def set_adc_values_callback_configuration(period, value_has_to_change)
|
|
182
|
+
send_request FUNCTION_SET_ADC_VALUES_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 0, ''
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
# Returns the callback configuration as set by
|
|
186
|
+
# BrickletXMC1400Breakout#set_adc_values_callback_configuration.
|
|
187
|
+
def get_adc_values_callback_configuration
|
|
188
|
+
send_request FUNCTION_GET_ADC_VALUES_CALLBACK_CONFIGURATION, [], '', 5, 'L ?'
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
# Returns the value of the example count (see example.c).
|
|
192
|
+
#
|
|
193
|
+
# This example function uses the "add_callback_value_function"-helper in the
|
|
194
|
+
# generator. The getter as well as the callback and callback configuration
|
|
195
|
+
# functions are auto-generated for the API as well as the firmware.
|
|
196
|
+
#
|
|
197
|
+
#
|
|
198
|
+
# If you want to get the value periodically, it is recommended to use the
|
|
199
|
+
# CALLBACK_COUNT callback. You can set the callback configuration
|
|
200
|
+
# with BrickletXMC1400Breakout#set_count_callback_configuration.
|
|
201
|
+
def get_count
|
|
202
|
+
send_request FUNCTION_GET_COUNT, [], '', 4, 'L'
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
# The period in ms is the period with which the CALLBACK_COUNT callback is triggered
|
|
206
|
+
# periodically. A value of 0 turns the callback off.
|
|
207
|
+
#
|
|
208
|
+
# If the `value has to change`-parameter is set to true, the callback is only
|
|
209
|
+
# triggered after the value has changed. If the value didn't change
|
|
210
|
+
# within the period, the callback is triggered immediately on change.
|
|
211
|
+
#
|
|
212
|
+
# If it is set to false, the callback is continuously triggered with the period,
|
|
213
|
+
# independent of the value.
|
|
214
|
+
#
|
|
215
|
+
# It is furthermore possible to constrain the callback with thresholds.
|
|
216
|
+
#
|
|
217
|
+
# The `option`-parameter together with min/max sets a threshold for the CALLBACK_COUNT callback.
|
|
218
|
+
#
|
|
219
|
+
# The following options are possible:
|
|
220
|
+
#
|
|
221
|
+
# "Option", "Description"
|
|
222
|
+
#
|
|
223
|
+
# "'x'", "Threshold is turned off"
|
|
224
|
+
# "'o'", "Threshold is triggered when the value is *outside* the min and max values"
|
|
225
|
+
# "'i'", "Threshold is triggered when the value is *inside* or equal to the min and max values"
|
|
226
|
+
# "'<'", "Threshold is triggered when the value is smaller than the min value (max is ignored)"
|
|
227
|
+
# "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
|
|
228
|
+
#
|
|
229
|
+
# 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
|
+
def set_count_callback_configuration(period, value_has_to_change, option, min, max)
|
|
233
|
+
send_request FUNCTION_SET_COUNT_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k L L', 0, ''
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
# Returns the callback configuration as set by BrickletXMC1400Breakout#set_count_callback_configuration.
|
|
237
|
+
def get_count_callback_configuration
|
|
238
|
+
send_request FUNCTION_GET_COUNT_CALLBACK_CONFIGURATION, [], '', 14, 'L ? k L L'
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
# Returns the error count for the communication between Brick and Bricklet.
|
|
242
|
+
#
|
|
243
|
+
# The errors are divided into
|
|
244
|
+
#
|
|
245
|
+
# * ACK checksum errors,
|
|
246
|
+
# * message checksum errors,
|
|
247
|
+
# * framing errors and
|
|
248
|
+
# * overflow errors.
|
|
249
|
+
#
|
|
250
|
+
# The errors counts are for errors that occur on the Bricklet side. All
|
|
251
|
+
# Bricks have a similar function that returns the errors on the Brick side.
|
|
252
|
+
def get_spitfp_error_count
|
|
253
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
# Sets the bootloader mode and returns the status after the requested
|
|
257
|
+
# mode change was instigated.
|
|
258
|
+
#
|
|
259
|
+
# You can change from bootloader mode to firmware mode and vice versa. A change
|
|
260
|
+
# from bootloader mode to firmware mode will only take place if the entry function,
|
|
261
|
+
# device identifier and CRC are present and correct.
|
|
262
|
+
#
|
|
263
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
|
264
|
+
# necessary to call it in a normal user program.
|
|
265
|
+
def set_bootloader_mode(mode)
|
|
266
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
# Returns the current bootloader mode, see BrickletXMC1400Breakout#set_bootloader_mode.
|
|
270
|
+
def get_bootloader_mode
|
|
271
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
# Sets the firmware pointer for BrickletXMC1400Breakout#write_firmware. The pointer has
|
|
275
|
+
# to be increased by chunks of size 64. The data is written to flash
|
|
276
|
+
# every 4 chunks (which equals to one page of size 256).
|
|
277
|
+
#
|
|
278
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
|
279
|
+
# necessary to call it in a normal user program.
|
|
280
|
+
def set_write_firmware_pointer(pointer)
|
|
281
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
# Writes 64 Bytes of firmware at the position as written by
|
|
285
|
+
# BrickletXMC1400Breakout#set_write_firmware_pointer before. The firmware is written
|
|
286
|
+
# to flash every 4 chunks.
|
|
287
|
+
#
|
|
288
|
+
# You can only write firmware in bootloader mode.
|
|
289
|
+
#
|
|
290
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
|
291
|
+
# necessary to call it in a normal user program.
|
|
292
|
+
def write_firmware(data)
|
|
293
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
# Sets the status LED configuration. By default the LED shows
|
|
297
|
+
# communication traffic between Brick and Bricklet, it flickers once
|
|
298
|
+
# for every 10 received data packets.
|
|
299
|
+
#
|
|
300
|
+
# You can also turn the LED permanently on/off or show a heartbeat.
|
|
301
|
+
#
|
|
302
|
+
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
|
303
|
+
def set_status_led_config(config)
|
|
304
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
|
|
305
|
+
end
|
|
306
|
+
|
|
307
|
+
# Returns the configuration as set by BrickletXMC1400Breakout#set_status_led_config
|
|
308
|
+
def get_status_led_config
|
|
309
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
|
|
310
|
+
end
|
|
311
|
+
|
|
312
|
+
# Returns the temperature in °C as measured inside the microcontroller. The
|
|
313
|
+
# value returned is not the ambient temperature!
|
|
314
|
+
#
|
|
315
|
+
# The temperature is only proportional to the real temperature and it has bad
|
|
316
|
+
# accuracy. Practically it is only useful as an indicator for
|
|
317
|
+
# temperature changes.
|
|
318
|
+
def get_chip_temperature
|
|
319
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
|
|
320
|
+
end
|
|
321
|
+
|
|
322
|
+
# Calling this function will reset the Bricklet. All configurations
|
|
323
|
+
# will be lost.
|
|
324
|
+
#
|
|
325
|
+
# After a reset you have to create new device objects,
|
|
326
|
+
# calling functions on the existing ones will result in
|
|
327
|
+
# undefined behavior!
|
|
328
|
+
def reset
|
|
329
|
+
send_request FUNCTION_RESET, [], '', 0, ''
|
|
330
|
+
end
|
|
331
|
+
|
|
332
|
+
# Writes a new UID into flash. If you want to set a new UID
|
|
333
|
+
# you have to decode the Base58 encoded UID string into an
|
|
334
|
+
# integer first.
|
|
335
|
+
#
|
|
336
|
+
# We recommend that you use Brick Viewer to change the UID.
|
|
337
|
+
def write_uid(uid)
|
|
338
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
|
|
339
|
+
end
|
|
340
|
+
|
|
341
|
+
# Returns the current UID as an integer. Encode as
|
|
342
|
+
# Base58 to get the usual string version.
|
|
343
|
+
def read_uid
|
|
344
|
+
send_request FUNCTION_READ_UID, [], '', 4, 'L'
|
|
345
|
+
end
|
|
346
|
+
|
|
347
|
+
# Returns the UID, the UID where the Bricklet is connected to,
|
|
348
|
+
# the position, the hardware and firmware version as well as the
|
|
349
|
+
# device identifier.
|
|
350
|
+
#
|
|
351
|
+
# The position can be 'a', 'b', 'c' or 'd'.
|
|
352
|
+
#
|
|
353
|
+
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
354
|
+
# |device_identifier_constant|
|
|
355
|
+
def get_identity
|
|
356
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
|
357
|
+
end
|
|
358
|
+
|
|
359
|
+
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|
|
360
|
+
def register_callback(id, &block)
|
|
361
|
+
callback = block
|
|
362
|
+
@registered_callbacks[id] = callback
|
|
363
|
+
end
|
|
364
|
+
end
|
|
365
|
+
end
|