tinkerforge 2.1.23 → 2.1.28

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. checksums.yaml +5 -5
  2. data/lib/tinkerforge/brick_dc.rb +156 -75
  3. data/lib/tinkerforge/brick_hat.rb +109 -30
  4. data/lib/tinkerforge/brick_hat_zero.rb +119 -21
  5. data/lib/tinkerforge/brick_imu.rb +191 -86
  6. data/lib/tinkerforge/brick_imu_v2.rb +219 -118
  7. data/lib/tinkerforge/brick_master.rb +495 -195
  8. data/lib/tinkerforge/brick_red.rb +197 -74
  9. data/lib/tinkerforge/brick_servo.rb +186 -102
  10. data/lib/tinkerforge/brick_silent_stepper.rb +248 -168
  11. data/lib/tinkerforge/brick_stepper.rb +212 -100
  12. data/lib/tinkerforge/bricklet_accelerometer.rb +61 -36
  13. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +107 -63
  14. data/lib/tinkerforge/bricklet_air_quality.rb +123 -76
  15. data/lib/tinkerforge/bricklet_ambient_light.rb +62 -46
  16. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +41 -28
  17. data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -28
  18. data/lib/tinkerforge/bricklet_analog_in.rb +66 -45
  19. data/lib/tinkerforge/bricklet_analog_in_v2.rb +60 -43
  20. data/lib/tinkerforge/bricklet_analog_in_v3.rb +68 -32
  21. data/lib/tinkerforge/bricklet_analog_out.rb +25 -16
  22. data/lib/tinkerforge/bricklet_analog_out_v2.rb +21 -10
  23. data/lib/tinkerforge/bricklet_analog_out_v3.rb +55 -22
  24. data/lib/tinkerforge/bricklet_barometer.rb +108 -58
  25. data/lib/tinkerforge/bricklet_barometer_v2.rb +109 -67
  26. data/lib/tinkerforge/bricklet_can.rb +84 -24
  27. data/lib/tinkerforge/bricklet_can_v2.rb +173 -72
  28. data/lib/tinkerforge/bricklet_co2.rb +36 -25
  29. data/lib/tinkerforge/bricklet_co2_v2.rb +119 -60
  30. data/lib/tinkerforge/bricklet_color.rb +75 -47
  31. data/lib/tinkerforge/bricklet_color_v2.rb +91 -47
  32. data/lib/tinkerforge/bricklet_compass.rb +81 -40
  33. data/lib/tinkerforge/bricklet_current12.rb +61 -40
  34. data/lib/tinkerforge/bricklet_current25.rb +61 -40
  35. data/lib/tinkerforge/bricklet_distance_ir.rb +60 -38
  36. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +85 -45
  37. data/lib/tinkerforge/bricklet_distance_us.rb +43 -30
  38. data/lib/tinkerforge/bricklet_distance_us_v2.rb +68 -33
  39. data/lib/tinkerforge/bricklet_dmx.rb +92 -48
  40. data/lib/tinkerforge/bricklet_dual_button.rb +23 -12
  41. data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -29
  42. data/lib/tinkerforge/bricklet_dual_relay.rb +27 -14
  43. data/lib/tinkerforge/bricklet_dust_detector.rb +43 -30
  44. data/lib/tinkerforge/bricklet_e_paper_296x128.rb +115 -63
  45. data/lib/tinkerforge/bricklet_energy_monitor.rb +81 -40
  46. data/lib/tinkerforge/bricklet_gps.rb +72 -48
  47. data/lib/tinkerforge/bricklet_gps_v2.rb +124 -73
  48. data/lib/tinkerforge/bricklet_hall_effect.rb +43 -28
  49. data/lib/tinkerforge/bricklet_hall_effect_v2.rb +76 -44
  50. data/lib/tinkerforge/bricklet_humidity.rb +54 -38
  51. data/lib/tinkerforge/bricklet_humidity_v2.rb +86 -49
  52. data/lib/tinkerforge/bricklet_imu_v3.rb +784 -0
  53. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +41 -18
  54. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +84 -40
  55. data/lib/tinkerforge/bricklet_industrial_counter.rb +102 -59
  56. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +51 -24
  57. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +79 -40
  58. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -15
  59. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +75 -33
  60. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +43 -29
  61. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +81 -44
  62. data/lib/tinkerforge/bricklet_industrial_dual_ac_relay.rb +325 -0
  63. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +51 -30
  64. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +139 -40
  65. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +63 -28
  66. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -15
  67. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -28
  68. data/lib/tinkerforge/bricklet_io16.rb +57 -32
  69. data/lib/tinkerforge/bricklet_io16_v2.rb +93 -48
  70. data/lib/tinkerforge/bricklet_io4.rb +56 -31
  71. data/lib/tinkerforge/bricklet_io4_v2.rb +109 -57
  72. data/lib/tinkerforge/bricklet_isolator.rb +111 -35
  73. data/lib/tinkerforge/bricklet_joystick.rb +63 -42
  74. data/lib/tinkerforge/bricklet_joystick_v2.rb +71 -35
  75. data/lib/tinkerforge/bricklet_laser_range_finder.rb +87 -59
  76. data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +99 -51
  77. data/lib/tinkerforge/bricklet_lcd_128x64.rb +219 -131
  78. data/lib/tinkerforge/bricklet_lcd_16x2.rb +49 -25
  79. data/lib/tinkerforge/bricklet_lcd_20x4.rb +59 -29
  80. data/lib/tinkerforge/bricklet_led_strip.rb +69 -47
  81. data/lib/tinkerforge/bricklet_led_strip_v2.rb +105 -48
  82. data/lib/tinkerforge/bricklet_line.rb +35 -22
  83. data/lib/tinkerforge/bricklet_linear_poti.rb +53 -35
  84. data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -24
  85. data/lib/tinkerforge/bricklet_load_cell.rb +64 -40
  86. data/lib/tinkerforge/bricklet_load_cell_v2.rb +81 -41
  87. data/lib/tinkerforge/bricklet_moisture.rb +43 -30
  88. data/lib/tinkerforge/bricklet_motion_detector.rb +21 -10
  89. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -29
  90. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -32
  91. data/lib/tinkerforge/bricklet_multi_touch.rb +30 -17
  92. data/lib/tinkerforge/bricklet_multi_touch_v2.rb +76 -39
  93. data/lib/tinkerforge/bricklet_nfc.rb +130 -80
  94. data/lib/tinkerforge/bricklet_nfc_rfid.rb +32 -13
  95. data/lib/tinkerforge/bricklet_oled_128x64.rb +30 -17
  96. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +75 -40
  97. data/lib/tinkerforge/bricklet_oled_64x48.rb +30 -17
  98. data/lib/tinkerforge/bricklet_one_wire.rb +65 -24
  99. data/lib/tinkerforge/bricklet_outdoor_weather.rb +84 -41
  100. data/lib/tinkerforge/bricklet_particulate_matter.rb +85 -37
  101. data/lib/tinkerforge/bricklet_performance_dc.rb +676 -0
  102. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -13
  103. data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -19
  104. data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +84 -57
  105. data/lib/tinkerforge/bricklet_ptc.rb +76 -51
  106. data/lib/tinkerforge/bricklet_ptc_v2.rb +96 -54
  107. data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -36
  108. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -47
  109. data/lib/tinkerforge/bricklet_remote_switch.rb +38 -29
  110. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +86 -49
  111. data/lib/tinkerforge/bricklet_rgb_led.rb +17 -8
  112. data/lib/tinkerforge/bricklet_rgb_led_button.rb +61 -30
  113. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +78 -33
  114. data/lib/tinkerforge/bricklet_rgb_led_v2.rb +51 -20
  115. data/lib/tinkerforge/bricklet_rotary_encoder.rb +40 -25
  116. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -27
  117. data/lib/tinkerforge/bricklet_rotary_poti.rb +55 -37
  118. data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +57 -26
  119. data/lib/tinkerforge/bricklet_rs232.rb +89 -28
  120. data/lib/tinkerforge/bricklet_rs232_v2.rb +121 -47
  121. data/lib/tinkerforge/bricklet_rs485.rb +250 -164
  122. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
  123. data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -36
  124. data/lib/tinkerforge/bricklet_servo_v2.rb +565 -0
  125. data/lib/tinkerforge/bricklet_solid_state_relay.rb +24 -13
  126. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +58 -25
  127. data/lib/tinkerforge/bricklet_sound_intensity.rb +36 -24
  128. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +77 -41
  129. data/lib/tinkerforge/bricklet_temperature.rb +43 -28
  130. data/lib/tinkerforge/bricklet_temperature_ir.rb +61 -47
  131. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +74 -44
  132. data/lib/tinkerforge/bricklet_temperature_v2.rb +62 -31
  133. data/lib/tinkerforge/bricklet_thermal_imaging.rb +118 -68
  134. data/lib/tinkerforge/bricklet_thermocouple.rb +46 -30
  135. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -30
  136. data/lib/tinkerforge/bricklet_tilt.rb +23 -10
  137. data/lib/tinkerforge/bricklet_uv_light.rb +37 -24
  138. data/lib/tinkerforge/bricklet_uv_light_v2.rb +87 -46
  139. data/lib/tinkerforge/bricklet_voltage.rb +54 -37
  140. data/lib/tinkerforge/bricklet_voltage_current.rb +94 -85
  141. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +92 -77
  142. data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +81 -36
  143. data/lib/tinkerforge/device_display_names.rb +167 -0
  144. data/lib/tinkerforge/ip_connection.rb +156 -33
  145. data/lib/tinkerforge/version.rb +1 -1
  146. metadata +8 -3
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-08-23. #
3
+ # This file was automatically generated on 2021-01-15. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.23 #
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 distance between 2cm and 400cm with ultrasound
14
16
  class BrickletDistanceUS < Device
@@ -51,7 +53,7 @@ module Tinkerforge
51
53
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
52
54
  # the IP Connection <tt>ipcon</tt>.
53
55
  def initialize(uid, ipcon)
54
- super uid, ipcon
56
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
55
57
 
56
58
  @api_version = [2, 0, 1]
57
59
 
@@ -66,13 +68,14 @@ module Tinkerforge
66
68
  @response_expected[FUNCTION_GET_MOVING_AVERAGE] = RESPONSE_EXPECTED_ALWAYS_TRUE
67
69
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
68
70
 
69
- @callback_formats[CALLBACK_DISTANCE] = 'S'
70
- @callback_formats[CALLBACK_DISTANCE_REACHED] = 'S'
71
+ @callback_formats[CALLBACK_DISTANCE] = [10, 'S']
72
+ @callback_formats[CALLBACK_DISTANCE_REACHED] = [10, 'S']
71
73
 
74
+ @ipcon.add_device self
72
75
  end
73
76
 
74
- # Returns the current distance value measured by the sensor. The value has a
75
- # range of 0 to 4095. A small value corresponds to a small distance, a big
77
+ # Returns the current distance value measured by the sensor.
78
+ # A small value corresponds to a small distance, a big
76
79
  # value corresponds to a big distance. The relation between the measured distance
77
80
  # value and the actual distance is affected by the 5V supply voltage (deviations
78
81
  # in the supply voltage result in deviations in the distance values) and is
@@ -82,23 +85,27 @@ module Tinkerforge
82
85
  # use the CALLBACK_DISTANCE callback and set the period with
83
86
  # BrickletDistanceUS#set_distance_callback_period.
84
87
  def get_distance_value
85
- send_request FUNCTION_GET_DISTANCE_VALUE, [], '', 2, 'S'
88
+ check_validity
89
+
90
+ send_request FUNCTION_GET_DISTANCE_VALUE, [], '', 10, 'S'
86
91
  end
87
92
 
88
- # Sets the period in ms with which the CALLBACK_DISTANCE callback is triggered
93
+ # Sets the period with which the CALLBACK_DISTANCE callback is triggered
89
94
  # periodically. A value of 0 turns the callback off.
90
95
  #
91
96
  # Der CALLBACK_DISTANCE callback is only triggered if the distance value has changed
92
97
  # since the last triggering.
93
- #
94
- # The default value is 0.
95
98
  def set_distance_callback_period(period)
96
- send_request FUNCTION_SET_DISTANCE_CALLBACK_PERIOD, [period], 'L', 0, ''
99
+ check_validity
100
+
101
+ send_request FUNCTION_SET_DISTANCE_CALLBACK_PERIOD, [period], 'L', 8, ''
97
102
  end
98
103
 
99
104
  # Returns the period as set by BrickletDistanceUS#set_distance_callback_period.
100
105
  def get_distance_callback_period
101
- send_request FUNCTION_GET_DISTANCE_CALLBACK_PERIOD, [], '', 4, 'L'
106
+ check_validity
107
+
108
+ send_request FUNCTION_GET_DISTANCE_CALLBACK_PERIOD, [], '', 12, 'L'
102
109
  end
103
110
 
104
111
  # Sets the thresholds for the CALLBACK_DISTANCE_REACHED callback.
@@ -112,18 +119,20 @@ module Tinkerforge
112
119
  # "'i'", "Callback is triggered when the distance value is *inside* the min and max values"
113
120
  # "'<'", "Callback is triggered when the distance value is smaller than the min value (max is ignored)"
114
121
  # "'>'", "Callback is triggered when the distance value is greater than the min value (max is ignored)"
115
- #
116
- # The default value is ('x', 0, 0).
117
122
  def set_distance_callback_threshold(option, min, max)
118
- send_request FUNCTION_SET_DISTANCE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
123
+ check_validity
124
+
125
+ send_request FUNCTION_SET_DISTANCE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
119
126
  end
120
127
 
121
128
  # Returns the threshold as set by BrickletDistanceUS#set_distance_callback_threshold.
122
129
  def get_distance_callback_threshold
123
- send_request FUNCTION_GET_DISTANCE_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
130
+ check_validity
131
+
132
+ send_request FUNCTION_GET_DISTANCE_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
124
133
  end
125
134
 
126
- # Sets the period in ms with which the threshold callbacks
135
+ # Sets the period with which the threshold callbacks
127
136
  #
128
137
  # * CALLBACK_DISTANCE_REACHED,
129
138
  #
@@ -132,15 +141,17 @@ module Tinkerforge
132
141
  # * BrickletDistanceUS#set_distance_callback_threshold,
133
142
  #
134
143
  # keep being reached.
135
- #
136
- # The default value is 100.
137
144
  def set_debounce_period(debounce)
138
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
145
+ check_validity
146
+
147
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
139
148
  end
140
149
 
141
150
  # Returns the debounce period as set by BrickletDistanceUS#set_debounce_period.
142
151
  def get_debounce_period
143
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
152
+ check_validity
153
+
154
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
144
155
  end
145
156
 
146
157
  # Sets the length of a `moving averaging <https://en.wikipedia.org/wiki/Moving_average>`__
@@ -148,29 +159,31 @@ module Tinkerforge
148
159
  #
149
160
  # Setting the length to 0 will turn the averaging completely off. With less
150
161
  # averaging, there is more noise on the data.
151
- #
152
- # The range for the averaging is 0-100.
153
- #
154
- # The default value is 20.
155
162
  def set_moving_average(average)
156
- send_request FUNCTION_SET_MOVING_AVERAGE, [average], 'C', 0, ''
163
+ check_validity
164
+
165
+ send_request FUNCTION_SET_MOVING_AVERAGE, [average], 'C', 8, ''
157
166
  end
158
167
 
159
168
  # Returns the length moving average as set by BrickletDistanceUS#set_moving_average.
160
169
  def get_moving_average
161
- send_request FUNCTION_GET_MOVING_AVERAGE, [], '', 1, 'C'
170
+ check_validity
171
+
172
+ send_request FUNCTION_GET_MOVING_AVERAGE, [], '', 9, 'C'
162
173
  end
163
174
 
164
175
  # Returns the UID, the UID where the Bricklet is connected to,
165
176
  # the position, the hardware and firmware version as well as the
166
177
  # device identifier.
167
178
  #
168
- # The position can be 'a', 'b', 'c' or 'd'.
179
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
180
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
181
+ # position 'z'.
169
182
  #
170
183
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
171
184
  # |device_identifier_constant|
172
185
  def get_identity
173
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
186
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
174
187
  end
175
188
 
176
189
  # 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 2019-08-23. #
3
+ # This file was automatically generated on 2021-01-15. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.23 #
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 distance between 30cm and 500cm with ultrasound
14
16
  class BrickletDistanceUSV2 < Device
@@ -71,7 +73,7 @@ module Tinkerforge
71
73
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
72
74
  # the IP Connection <tt>ipcon</tt>.
73
75
  def initialize(uid, ipcon)
74
- super uid, ipcon
76
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
75
77
 
76
78
  @api_version = [2, 0, 0]
77
79
 
@@ -95,21 +97,24 @@ module Tinkerforge
95
97
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
96
98
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
97
99
 
98
- @callback_formats[CALLBACK_DISTANCE] = 'S'
100
+ @callback_formats[CALLBACK_DISTANCE] = [10, 'S']
99
101
 
102
+ @ipcon.add_device self
100
103
  end
101
104
 
102
- # Returns the distance in mm.
105
+ # Returns the distance.
103
106
  #
104
107
  #
105
108
  # If you want to get the value periodically, it is recommended to use the
106
109
  # CALLBACK_DISTANCE callback. You can set the callback configuration
107
110
  # with BrickletDistanceUSV2#set_distance_callback_configuration.
108
111
  def get_distance
109
- send_request FUNCTION_GET_DISTANCE, [], '', 2, 'S'
112
+ check_validity
113
+
114
+ send_request FUNCTION_GET_DISTANCE, [], '', 10, 'S'
110
115
  end
111
116
 
112
- # The period in ms is the period with which the CALLBACK_DISTANCE callback is triggered
117
+ # The period is the period with which the CALLBACK_DISTANCE callback is triggered
113
118
  # periodically. A value of 0 turns the callback off.
114
119
  #
115
120
  # If the `value has to change`-parameter is set to true, the callback is only
@@ -134,43 +139,49 @@ module Tinkerforge
134
139
  # "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
135
140
  #
136
141
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
137
- #
138
- # The default value is (0, false, 'x', 0, 0).
139
142
  def set_distance_callback_configuration(period, value_has_to_change, option, min, max)
140
- send_request FUNCTION_SET_DISTANCE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k S S', 0, ''
143
+ check_validity
144
+
145
+ send_request FUNCTION_SET_DISTANCE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k S S', 8, ''
141
146
  end
142
147
 
143
148
  # Returns the callback configuration as set by BrickletDistanceUSV2#set_distance_callback_configuration.
144
149
  def get_distance_callback_configuration
145
- send_request FUNCTION_GET_DISTANCE_CALLBACK_CONFIGURATION, [], '', 10, 'L ? k S S'
150
+ check_validity
151
+
152
+ send_request FUNCTION_GET_DISTANCE_CALLBACK_CONFIGURATION, [], '', 18, 'L ? k S S'
146
153
  end
147
154
 
148
155
  # Sets the update rate to 2 Hz or 10 Hz.
149
156
  #
150
157
  # With 2 Hz update rate the noise is about ±1mm, while with 10 Hz update rate the noise
151
158
  # increases to about ±5mm.
152
- #
153
- # The default update rate is 2 Hz.
154
159
  def set_update_rate(update_rate)
155
- send_request FUNCTION_SET_UPDATE_RATE, [update_rate], 'C', 0, ''
160
+ check_validity
161
+
162
+ send_request FUNCTION_SET_UPDATE_RATE, [update_rate], 'C', 8, ''
156
163
  end
157
164
 
158
165
  # Returns the update rate as set by BrickletDistanceUSV2#set_update_rate.
159
166
  def get_update_rate
160
- send_request FUNCTION_GET_UPDATE_RATE, [], '', 1, 'C'
167
+ check_validity
168
+
169
+ send_request FUNCTION_GET_UPDATE_RATE, [], '', 9, 'C'
161
170
  end
162
171
 
163
172
  # Configures the distance LED to be either turned off, turned on, blink in
164
173
  # heartbeat mode or show the distance (brighter = object is nearer).
165
- #
166
- # The default value is 3 (show distance).
167
174
  def set_distance_led_config(config)
168
- send_request FUNCTION_SET_DISTANCE_LED_CONFIG, [config], 'C', 0, ''
175
+ check_validity
176
+
177
+ send_request FUNCTION_SET_DISTANCE_LED_CONFIG, [config], 'C', 8, ''
169
178
  end
170
179
 
171
180
  # Returns the LED configuration as set by BrickletDistanceUSV2#set_distance_led_config
172
181
  def get_distance_led_config
173
- send_request FUNCTION_GET_DISTANCE_LED_CONFIG, [], '', 1, 'C'
182
+ check_validity
183
+
184
+ send_request FUNCTION_GET_DISTANCE_LED_CONFIG, [], '', 9, 'C'
174
185
  end
175
186
 
176
187
  # Returns the error count for the communication between Brick and Bricklet.
@@ -185,7 +196,9 @@ module Tinkerforge
185
196
  # The errors counts are for errors that occur on the Bricklet side. All
186
197
  # Bricks have a similar function that returns the errors on the Brick side.
187
198
  def get_spitfp_error_count
188
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
199
+ check_validity
200
+
201
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
189
202
  end
190
203
 
191
204
  # Sets the bootloader mode and returns the status after the requested
@@ -198,12 +211,16 @@ module Tinkerforge
198
211
  # This function is used by Brick Viewer during flashing. It should not be
199
212
  # necessary to call it in a normal user program.
200
213
  def set_bootloader_mode(mode)
201
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
214
+ check_validity
215
+
216
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
202
217
  end
203
218
 
204
219
  # Returns the current bootloader mode, see BrickletDistanceUSV2#set_bootloader_mode.
205
220
  def get_bootloader_mode
206
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
221
+ check_validity
222
+
223
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
207
224
  end
208
225
 
209
226
  # Sets the firmware pointer for BrickletDistanceUSV2#write_firmware. The pointer has
@@ -213,7 +230,9 @@ module Tinkerforge
213
230
  # This function is used by Brick Viewer during flashing. It should not be
214
231
  # necessary to call it in a normal user program.
215
232
  def set_write_firmware_pointer(pointer)
216
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
233
+ check_validity
234
+
235
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
217
236
  end
218
237
 
219
238
  # Writes 64 Bytes of firmware at the position as written by
@@ -225,7 +244,9 @@ module Tinkerforge
225
244
  # This function is used by Brick Viewer during flashing. It should not be
226
245
  # necessary to call it in a normal user program.
227
246
  def write_firmware(data)
228
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
247
+ check_validity
248
+
249
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
229
250
  end
230
251
 
231
252
  # Sets the status LED configuration. By default the LED shows
@@ -236,22 +257,28 @@ module Tinkerforge
236
257
  #
237
258
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
238
259
  def set_status_led_config(config)
239
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
260
+ check_validity
261
+
262
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
240
263
  end
241
264
 
242
265
  # Returns the configuration as set by BrickletDistanceUSV2#set_status_led_config
243
266
  def get_status_led_config
244
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
267
+ check_validity
268
+
269
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
245
270
  end
246
271
 
247
- # Returns the temperature in °C as measured inside the microcontroller. The
272
+ # Returns the temperature as measured inside the microcontroller. The
248
273
  # value returned is not the ambient temperature!
249
274
  #
250
275
  # The temperature is only proportional to the real temperature and it has bad
251
276
  # accuracy. Practically it is only useful as an indicator for
252
277
  # temperature changes.
253
278
  def get_chip_temperature
254
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
279
+ check_validity
280
+
281
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
255
282
  end
256
283
 
257
284
  # Calling this function will reset the Bricklet. All configurations
@@ -261,7 +288,9 @@ module Tinkerforge
261
288
  # calling functions on the existing ones will result in
262
289
  # undefined behavior!
263
290
  def reset
264
- send_request FUNCTION_RESET, [], '', 0, ''
291
+ check_validity
292
+
293
+ send_request FUNCTION_RESET, [], '', 8, ''
265
294
  end
266
295
 
267
296
  # Writes a new UID into flash. If you want to set a new UID
@@ -270,25 +299,31 @@ module Tinkerforge
270
299
  #
271
300
  # We recommend that you use Brick Viewer to change the UID.
272
301
  def write_uid(uid)
273
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
302
+ check_validity
303
+
304
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
274
305
  end
275
306
 
276
307
  # Returns the current UID as an integer. Encode as
277
308
  # Base58 to get the usual string version.
278
309
  def read_uid
279
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
310
+ check_validity
311
+
312
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
280
313
  end
281
314
 
282
315
  # Returns the UID, the UID where the Bricklet is connected to,
283
316
  # the position, the hardware and firmware version as well as the
284
317
  # device identifier.
285
318
  #
286
- # The position can be 'a', 'b', 'c' or 'd'.
319
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
320
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
321
+ # position 'z'.
287
322
  #
288
323
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
289
324
  # |device_identifier_constant|
290
325
  def get_identity
291
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
326
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
292
327
  end
293
328
 
294
329
  # 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 2019-08-23. #
3
+ # This file was automatically generated on 2021-01-15. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.23 #
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
  # DMX master and slave
14
16
  class BrickletDMX < Device
@@ -37,15 +39,7 @@ module Tinkerforge
37
39
  # This callback can only be triggered in slave mode.
38
40
  CALLBACK_FRAME_AVAILABLE = 15
39
41
 
40
- # This callback is called as soon as a new frame is available
41
- # (written by the DMX master).
42
- #
43
- # The size of the array is equivalent to the number of channels in
44
- # the frame. Each byte represents one channel.
45
- #
46
- # This callback can be enabled via BrickletDMX#set_frame_callback_config.
47
- #
48
- # This callback can only be triggered in slave mode.
42
+ # See CALLBACK_FRAME
49
43
  CALLBACK_FRAME_LOW_LEVEL = 16
50
44
 
51
45
  # This callback is called if a new error occurs. It returns
@@ -61,6 +55,9 @@ module Tinkerforge
61
55
  # This callback can be enabled via BrickletDMX#set_frame_callback_config.
62
56
  #
63
57
  # This callback can only be triggered in slave mode.
58
+ #
59
+ # .. note::
60
+ # If reconstructing the value fails, the callback is triggered with nil for frame.
64
61
  CALLBACK_FRAME = -16
65
62
 
66
63
  FUNCTION_SET_DMX_MODE = 1 # :nodoc:
@@ -118,7 +115,7 @@ module Tinkerforge
118
115
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
119
116
  # the IP Connection <tt>ipcon</tt>.
120
117
  def initialize(uid, ipcon)
121
- super uid, ipcon
118
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
122
119
 
123
120
  @api_version = [2, 0, 0]
124
121
 
@@ -148,26 +145,29 @@ module Tinkerforge
148
145
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
149
146
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
150
147
 
151
- @callback_formats[CALLBACK_FRAME_STARTED] = ''
152
- @callback_formats[CALLBACK_FRAME_AVAILABLE] = 'L'
153
- @callback_formats[CALLBACK_FRAME_LOW_LEVEL] = 'S S C56 L'
154
- @callback_formats[CALLBACK_FRAME_ERROR_COUNT] = 'L L'
148
+ @callback_formats[CALLBACK_FRAME_STARTED] = [8, '']
149
+ @callback_formats[CALLBACK_FRAME_AVAILABLE] = [12, 'L']
150
+ @callback_formats[CALLBACK_FRAME_LOW_LEVEL] = [72, 'S S C56 L']
151
+ @callback_formats[CALLBACK_FRAME_ERROR_COUNT] = [16, 'L L']
155
152
 
156
153
  @high_level_callbacks[CALLBACK_FRAME] = [['stream_length', 'stream_chunk_offset', 'stream_chunk_data', nil], {'fixed_length' => nil, 'single_chunk' => false}, nil]
154
+ @ipcon.add_device self
157
155
  end
158
156
 
159
157
  # Sets the DMX mode to either master or slave.
160
158
  #
161
159
  # Calling this function sets frame number to 0.
162
- #
163
- # The default value is 0 (master).
164
160
  def set_dmx_mode(dmx_mode)
165
- send_request FUNCTION_SET_DMX_MODE, [dmx_mode], 'C', 0, ''
161
+ check_validity
162
+
163
+ send_request FUNCTION_SET_DMX_MODE, [dmx_mode], 'C', 8, ''
166
164
  end
167
165
 
168
166
  # Returns the DMX mode, as set by BrickletDMX#set_dmx_mode.
169
167
  def get_dmx_mode
170
- send_request FUNCTION_GET_DMX_MODE, [], '', 1, 'C'
168
+ check_validity
169
+
170
+ send_request FUNCTION_GET_DMX_MODE, [], '', 9, 'C'
171
171
  end
172
172
 
173
173
  # Writes a DMX frame. The maximum frame size is 512 byte. Each byte represents one channel.
@@ -191,7 +191,9 @@ module Tinkerforge
191
191
  #
192
192
  # This function can only be called in master mode.
193
193
  def write_frame_low_level(frame_length, frame_chunk_offset, frame_chunk_data)
194
- send_request FUNCTION_WRITE_FRAME_LOW_LEVEL, [frame_length, frame_chunk_offset, frame_chunk_data], 'S S C60', 0, ''
194
+ check_validity
195
+
196
+ send_request FUNCTION_WRITE_FRAME_LOW_LEVEL, [frame_length, frame_chunk_offset, frame_chunk_data], 'S S C60', 8, ''
195
197
  end
196
198
 
197
199
  # Returns the last frame that was written by the DMX master. The size of the array
@@ -214,10 +216,12 @@ module Tinkerforge
214
216
  #
215
217
  # This function can only be called in slave mode.
216
218
  def read_frame_low_level
217
- send_request FUNCTION_READ_FRAME_LOW_LEVEL, [], '', 64, 'S S C56 L'
219
+ check_validity
220
+
221
+ send_request FUNCTION_READ_FRAME_LOW_LEVEL, [], '', 72, 'S S C56 L'
218
222
  end
219
223
 
220
- # Sets the duration of a frame in ms.
224
+ # Sets the duration of a frame.
221
225
  #
222
226
  # Example: If you want to achieve 20 frames per second, you should
223
227
  # set the frame duration to 50ms (50ms * 20 = 1 second).
@@ -226,20 +230,24 @@ module Tinkerforge
226
230
  # this value to 0.
227
231
  #
228
232
  # This setting is only used in master mode.
229
- #
230
- # Default value: 100ms (10 frames per second).
231
233
  def set_frame_duration(frame_duration)
232
- send_request FUNCTION_SET_FRAME_DURATION, [frame_duration], 'S', 0, ''
234
+ check_validity
235
+
236
+ send_request FUNCTION_SET_FRAME_DURATION, [frame_duration], 'S', 8, ''
233
237
  end
234
238
 
235
239
  # Returns the frame duration as set by BrickletDMX#set_frame_duration.
236
240
  def get_frame_duration
237
- send_request FUNCTION_GET_FRAME_DURATION, [], '', 2, 'S'
241
+ check_validity
242
+
243
+ send_request FUNCTION_GET_FRAME_DURATION, [], '', 10, 'S'
238
244
  end
239
245
 
240
246
  # Returns the current number of overrun and framing errors.
241
247
  def get_frame_error_count
242
- send_request FUNCTION_GET_FRAME_ERROR_COUNT, [], '', 8, 'L L'
248
+ check_validity
249
+
250
+ send_request FUNCTION_GET_FRAME_ERROR_COUNT, [], '', 16, 'L L'
243
251
  end
244
252
 
245
253
  # Sets the communication LED configuration. By default the LED shows
@@ -249,12 +257,16 @@ module Tinkerforge
249
257
  #
250
258
  # If the Bricklet is in bootloader mode, the LED is off.
251
259
  def set_communication_led_config(config)
252
- send_request FUNCTION_SET_COMMUNICATION_LED_CONFIG, [config], 'C', 0, ''
260
+ check_validity
261
+
262
+ send_request FUNCTION_SET_COMMUNICATION_LED_CONFIG, [config], 'C', 8, ''
253
263
  end
254
264
 
255
265
  # Returns the configuration as set by BrickletDMX#set_communication_led_config
256
266
  def get_communication_led_config
257
- send_request FUNCTION_GET_COMMUNICATION_LED_CONFIG, [], '', 1, 'C'
267
+ check_validity
268
+
269
+ send_request FUNCTION_GET_COMMUNICATION_LED_CONFIG, [], '', 9, 'C'
258
270
  end
259
271
 
260
272
  # Sets the error LED configuration.
@@ -267,12 +279,16 @@ module Tinkerforge
267
279
  #
268
280
  # If the Bricklet is in bootloader mode, the LED is off.
269
281
  def set_error_led_config(config)
270
- send_request FUNCTION_SET_ERROR_LED_CONFIG, [config], 'C', 0, ''
282
+ check_validity
283
+
284
+ send_request FUNCTION_SET_ERROR_LED_CONFIG, [config], 'C', 8, ''
271
285
  end
272
286
 
273
287
  # Returns the configuration as set by BrickletDMX#set_error_led_config.
274
288
  def get_error_led_config
275
- send_request FUNCTION_GET_ERROR_LED_CONFIG, [], '', 1, 'C'
289
+ check_validity
290
+
291
+ send_request FUNCTION_GET_ERROR_LED_CONFIG, [], '', 9, 'C'
276
292
  end
277
293
 
278
294
  # Enables/Disables the different callbacks. By default the
@@ -283,12 +299,16 @@ module Tinkerforge
283
299
  # the cb:`Frame Available` callback at the same time. It becomes redundant in
284
300
  # this case.
285
301
  def set_frame_callback_config(frame_started_callback_enabled, frame_available_callback_enabled, frame_callback_enabled, frame_error_count_callback_enabled)
286
- send_request FUNCTION_SET_FRAME_CALLBACK_CONFIG, [frame_started_callback_enabled, frame_available_callback_enabled, frame_callback_enabled, frame_error_count_callback_enabled], '? ? ? ?', 0, ''
302
+ check_validity
303
+
304
+ send_request FUNCTION_SET_FRAME_CALLBACK_CONFIG, [frame_started_callback_enabled, frame_available_callback_enabled, frame_callback_enabled, frame_error_count_callback_enabled], '? ? ? ?', 8, ''
287
305
  end
288
306
 
289
307
  # Returns the frame callback config as set by BrickletDMX#set_frame_callback_config.
290
308
  def get_frame_callback_config
291
- send_request FUNCTION_GET_FRAME_CALLBACK_CONFIG, [], '', 4, '? ? ? ?'
309
+ check_validity
310
+
311
+ send_request FUNCTION_GET_FRAME_CALLBACK_CONFIG, [], '', 12, '? ? ? ?'
292
312
  end
293
313
 
294
314
  # Returns the error count for the communication between Brick and Bricklet.
@@ -303,7 +323,9 @@ module Tinkerforge
303
323
  # The errors counts are for errors that occur on the Bricklet side. All
304
324
  # Bricks have a similar function that returns the errors on the Brick side.
305
325
  def get_spitfp_error_count
306
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
326
+ check_validity
327
+
328
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
307
329
  end
308
330
 
309
331
  # Sets the bootloader mode and returns the status after the requested
@@ -316,12 +338,16 @@ module Tinkerforge
316
338
  # This function is used by Brick Viewer during flashing. It should not be
317
339
  # necessary to call it in a normal user program.
318
340
  def set_bootloader_mode(mode)
319
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
341
+ check_validity
342
+
343
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
320
344
  end
321
345
 
322
346
  # Returns the current bootloader mode, see BrickletDMX#set_bootloader_mode.
323
347
  def get_bootloader_mode
324
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
348
+ check_validity
349
+
350
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
325
351
  end
326
352
 
327
353
  # Sets the firmware pointer for BrickletDMX#write_firmware. The pointer has
@@ -331,7 +357,9 @@ module Tinkerforge
331
357
  # This function is used by Brick Viewer during flashing. It should not be
332
358
  # necessary to call it in a normal user program.
333
359
  def set_write_firmware_pointer(pointer)
334
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
360
+ check_validity
361
+
362
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
335
363
  end
336
364
 
337
365
  # Writes 64 Bytes of firmware at the position as written by
@@ -343,7 +371,9 @@ module Tinkerforge
343
371
  # This function is used by Brick Viewer during flashing. It should not be
344
372
  # necessary to call it in a normal user program.
345
373
  def write_firmware(data)
346
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
374
+ check_validity
375
+
376
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
347
377
  end
348
378
 
349
379
  # Sets the status LED configuration. By default the LED shows
@@ -354,22 +384,28 @@ module Tinkerforge
354
384
  #
355
385
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
356
386
  def set_status_led_config(config)
357
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
387
+ check_validity
388
+
389
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
358
390
  end
359
391
 
360
392
  # Returns the configuration as set by BrickletDMX#set_status_led_config
361
393
  def get_status_led_config
362
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
394
+ check_validity
395
+
396
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
363
397
  end
364
398
 
365
- # Returns the temperature in °C as measured inside the microcontroller. The
399
+ # Returns the temperature as measured inside the microcontroller. The
366
400
  # value returned is not the ambient temperature!
367
401
  #
368
402
  # The temperature is only proportional to the real temperature and it has bad
369
403
  # accuracy. Practically it is only useful as an indicator for
370
404
  # temperature changes.
371
405
  def get_chip_temperature
372
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
406
+ check_validity
407
+
408
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
373
409
  end
374
410
 
375
411
  # Calling this function will reset the Bricklet. All configurations
@@ -379,7 +415,9 @@ module Tinkerforge
379
415
  # calling functions on the existing ones will result in
380
416
  # undefined behavior!
381
417
  def reset
382
- send_request FUNCTION_RESET, [], '', 0, ''
418
+ check_validity
419
+
420
+ send_request FUNCTION_RESET, [], '', 8, ''
383
421
  end
384
422
 
385
423
  # Writes a new UID into flash. If you want to set a new UID
@@ -388,25 +426,31 @@ module Tinkerforge
388
426
  #
389
427
  # We recommend that you use Brick Viewer to change the UID.
390
428
  def write_uid(uid)
391
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
429
+ check_validity
430
+
431
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
392
432
  end
393
433
 
394
434
  # Returns the current UID as an integer. Encode as
395
435
  # Base58 to get the usual string version.
396
436
  def read_uid
397
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
437
+ check_validity
438
+
439
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
398
440
  end
399
441
 
400
442
  # Returns the UID, the UID where the Bricklet is connected to,
401
443
  # the position, the hardware and firmware version as well as the
402
444
  # device identifier.
403
445
  #
404
- # The position can be 'a', 'b', 'c' or 'd'.
446
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
447
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
448
+ # position 'z'.
405
449
  #
406
450
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
407
451
  # |device_identifier_constant|
408
452
  def get_identity
409
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
453
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
410
454
  end
411
455
 
412
456
  # Writes a DMX frame. The maximum frame size is 512 byte. Each byte represents one channel.