tinkerforge 2.1.24 → 2.1.29

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +5 -5
  2. data/lib/tinkerforge/brick_dc.rb +156 -75
  3. data/lib/tinkerforge/brick_hat.rb +69 -31
  4. data/lib/tinkerforge/brick_hat_zero.rb +55 -23
  5. data/lib/tinkerforge/brick_imu.rb +185 -78
  6. data/lib/tinkerforge/brick_imu_v2.rb +209 -106
  7. data/lib/tinkerforge/brick_master.rb +491 -183
  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 +247 -167
  11. data/lib/tinkerforge/brick_stepper.rb +211 -99
  12. data/lib/tinkerforge/bricklet_accelerometer.rb +57 -23
  13. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +104 -54
  14. data/lib/tinkerforge/bricklet_air_quality.rb +116 -59
  15. data/lib/tinkerforge/bricklet_ambient_light.rb +50 -21
  16. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +44 -24
  17. data/lib/tinkerforge/bricklet_ambient_light_v3.rb +65 -27
  18. data/lib/tinkerforge/bricklet_analog_in.rb +62 -25
  19. data/lib/tinkerforge/bricklet_analog_in_v2.rb +56 -23
  20. data/lib/tinkerforge/bricklet_analog_in_v3.rb +66 -25
  21. data/lib/tinkerforge/bricklet_analog_out.rb +22 -9
  22. data/lib/tinkerforge/bricklet_analog_out_v2.rb +19 -8
  23. data/lib/tinkerforge/bricklet_analog_out_v3.rb +53 -20
  24. data/lib/tinkerforge/bricklet_barometer.rb +100 -27
  25. data/lib/tinkerforge/bricklet_barometer_v2.rb +98 -37
  26. data/lib/tinkerforge/bricklet_can.rb +83 -19
  27. data/lib/tinkerforge/bricklet_can_v2.rb +171 -38
  28. data/lib/tinkerforge/bricklet_co2.rb +33 -14
  29. data/lib/tinkerforge/bricklet_co2_v2.rb +97 -38
  30. data/lib/tinkerforge/bricklet_color.rb +68 -27
  31. data/lib/tinkerforge/bricklet_color_v2.rb +86 -33
  32. data/lib/tinkerforge/bricklet_compass.rb +77 -30
  33. data/lib/tinkerforge/bricklet_current12.rb +57 -24
  34. data/lib/tinkerforge/bricklet_current25.rb +57 -24
  35. data/lib/tinkerforge/bricklet_dc_v2.rb +521 -0
  36. data/lib/tinkerforge/bricklet_distance_ir.rb +56 -23
  37. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +82 -31
  38. data/lib/tinkerforge/bricklet_distance_us.rb +39 -16
  39. data/lib/tinkerforge/bricklet_distance_us_v2.rb +66 -25
  40. data/lib/tinkerforge/bricklet_dmx.rb +87 -34
  41. data/lib/tinkerforge/bricklet_dual_button.rb +23 -10
  42. data/lib/tinkerforge/bricklet_dual_button_v2.rb +63 -24
  43. data/lib/tinkerforge/bricklet_dual_relay.rb +26 -11
  44. data/lib/tinkerforge/bricklet_dust_detector.rb +39 -16
  45. data/lib/tinkerforge/bricklet_e_paper_296x128.rb +87 -32
  46. data/lib/tinkerforge/bricklet_energy_monitor.rb +72 -27
  47. data/lib/tinkerforge/bricklet_gps.rb +63 -26
  48. data/lib/tinkerforge/bricklet_gps_v2.rb +116 -47
  49. data/lib/tinkerforge/bricklet_hall_effect.rb +42 -23
  50. data/lib/tinkerforge/bricklet_hall_effect_v2.rb +70 -27
  51. data/lib/tinkerforge/bricklet_humidity.rb +50 -21
  52. data/lib/tinkerforge/bricklet_humidity_v2.rb +82 -31
  53. data/lib/tinkerforge/bricklet_imu_v3.rb +784 -0
  54. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +37 -14
  55. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +80 -29
  56. data/lib/tinkerforge/bricklet_industrial_counter.rb +100 -39
  57. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +44 -17
  58. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +76 -29
  59. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +35 -14
  60. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +72 -27
  61. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +39 -16
  62. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +79 -30
  63. data/lib/tinkerforge/bricklet_industrial_dual_ac_relay.rb +325 -0
  64. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +48 -19
  65. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +137 -31
  66. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +60 -23
  67. data/lib/tinkerforge/bricklet_industrial_ptc.rb +475 -0
  68. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +35 -14
  69. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +66 -25
  70. data/lib/tinkerforge/bricklet_io16.rb +54 -21
  71. data/lib/tinkerforge/bricklet_io16_v2.rb +89 -34
  72. data/lib/tinkerforge/bricklet_io4.rb +54 -23
  73. data/lib/tinkerforge/bricklet_io4_v2.rb +95 -36
  74. data/lib/tinkerforge/bricklet_isolator.rb +72 -29
  75. data/lib/tinkerforge/bricklet_joystick.rb +58 -25
  76. data/lib/tinkerforge/bricklet_joystick_v2.rb +67 -26
  77. data/lib/tinkerforge/bricklet_laser_range_finder.rb +81 -32
  78. data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +95 -36
  79. data/lib/tinkerforge/bricklet_lcd_128x64.rb +191 -70
  80. data/lib/tinkerforge/bricklet_lcd_16x2.rb +44 -18
  81. data/lib/tinkerforge/bricklet_lcd_20x4.rb +57 -23
  82. data/lib/tinkerforge/bricklet_led_strip.rb +59 -22
  83. data/lib/tinkerforge/bricklet_led_strip_v2.rb +90 -46
  84. data/lib/tinkerforge/bricklet_line.rb +33 -14
  85. data/lib/tinkerforge/bricklet_linear_poti.rb +50 -21
  86. data/lib/tinkerforge/bricklet_linear_poti_v2.rb +54 -21
  87. data/lib/tinkerforge/bricklet_load_cell.rb +60 -23
  88. data/lib/tinkerforge/bricklet_load_cell_v2.rb +79 -30
  89. data/lib/tinkerforge/bricklet_moisture.rb +39 -16
  90. data/lib/tinkerforge/bricklet_motion_detector.rb +21 -10
  91. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +61 -27
  92. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +70 -27
  93. data/lib/tinkerforge/bricklet_multi_touch.rb +30 -13
  94. data/lib/tinkerforge/bricklet_multi_touch_v2.rb +75 -28
  95. data/lib/tinkerforge/bricklet_nfc.rb +126 -62
  96. data/lib/tinkerforge/bricklet_nfc_rfid.rb +32 -13
  97. data/lib/tinkerforge/bricklet_oled_128x64.rb +28 -11
  98. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +65 -24
  99. data/lib/tinkerforge/bricklet_oled_64x48.rb +28 -11
  100. data/lib/tinkerforge/bricklet_one_wire.rb +65 -24
  101. data/lib/tinkerforge/bricklet_outdoor_weather.rb +71 -28
  102. data/lib/tinkerforge/bricklet_particulate_matter.rb +74 -30
  103. data/lib/tinkerforge/bricklet_performance_dc.rb +682 -0
  104. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +18 -9
  105. data/lib/tinkerforge/bricklet_piezo_speaker.rb +21 -10
  106. data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +79 -42
  107. data/lib/tinkerforge/bricklet_ptc.rb +73 -42
  108. data/lib/tinkerforge/bricklet_ptc_v2.rb +94 -48
  109. data/lib/tinkerforge/bricklet_real_time_clock.rb +44 -33
  110. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +77 -44
  111. data/lib/tinkerforge/bricklet_remote_switch.rb +38 -29
  112. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +86 -49
  113. data/lib/tinkerforge/bricklet_rgb_led.rb +17 -8
  114. data/lib/tinkerforge/bricklet_rgb_led_button.rb +61 -30
  115. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +78 -33
  116. data/lib/tinkerforge/bricklet_rgb_led_v2.rb +51 -20
  117. data/lib/tinkerforge/bricklet_rotary_encoder.rb +38 -19
  118. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +59 -24
  119. data/lib/tinkerforge/bricklet_rotary_poti.rb +52 -28
  120. data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +56 -23
  121. data/lib/tinkerforge/bricklet_rs232.rb +89 -28
  122. data/lib/tinkerforge/bricklet_rs232_v2.rb +117 -44
  123. data/lib/tinkerforge/bricklet_rs485.rb +222 -95
  124. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
  125. data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +74 -35
  126. data/lib/tinkerforge/bricklet_servo_v2.rb +565 -0
  127. data/lib/tinkerforge/bricklet_silent_stepper_v2.rb +1024 -0
  128. data/lib/tinkerforge/bricklet_solid_state_relay.rb +24 -13
  129. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +58 -25
  130. data/lib/tinkerforge/bricklet_sound_intensity.rb +34 -18
  131. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +71 -31
  132. data/lib/tinkerforge/bricklet_temperature.rb +39 -16
  133. data/lib/tinkerforge/bricklet_temperature_ir.rb +56 -23
  134. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +70 -27
  135. data/lib/tinkerforge/bricklet_temperature_v2.rb +60 -25
  136. data/lib/tinkerforge/bricklet_thermal_imaging.rb +104 -44
  137. data/lib/tinkerforge/bricklet_thermocouple.rb +44 -24
  138. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +64 -27
  139. data/lib/tinkerforge/bricklet_tilt.rb +23 -10
  140. data/lib/tinkerforge/bricklet_uv_light.rb +35 -18
  141. data/lib/tinkerforge/bricklet_uv_light_v2.rb +84 -37
  142. data/lib/tinkerforge/bricklet_voltage.rb +51 -28
  143. data/lib/tinkerforge/bricklet_voltage_current.rb +90 -73
  144. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +89 -68
  145. data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +79 -30
  146. data/lib/tinkerforge/device_display_names.rb +170 -0
  147. data/lib/tinkerforge/ip_connection.rb +153 -33
  148. data/lib/tinkerforge/version.rb +1 -1
  149. metadata +11 -3
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-11-25. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.29 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # Measures DC voltage between 0V and 42V
14
16
  class BrickletAnalogInV2 < Device
@@ -72,7 +74,7 @@ module Tinkerforge
72
74
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
73
75
  # the IP Connection <tt>ipcon</tt>.
74
76
  def initialize(uid, ipcon)
75
- super uid, ipcon
77
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
76
78
 
77
79
  @api_version = [2, 0, 1]
78
80
 
@@ -92,11 +94,12 @@ module Tinkerforge
92
94
  @response_expected[FUNCTION_GET_MOVING_AVERAGE] = RESPONSE_EXPECTED_ALWAYS_TRUE
93
95
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
94
96
 
95
- @callback_formats[CALLBACK_VOLTAGE] = 'S'
96
- @callback_formats[CALLBACK_ANALOG_VALUE] = 'S'
97
- @callback_formats[CALLBACK_VOLTAGE_REACHED] = 'S'
98
- @callback_formats[CALLBACK_ANALOG_VALUE_REACHED] = 'S'
97
+ @callback_formats[CALLBACK_VOLTAGE] = [10, 'S']
98
+ @callback_formats[CALLBACK_ANALOG_VALUE] = [10, 'S']
99
+ @callback_formats[CALLBACK_VOLTAGE_REACHED] = [10, 'S']
100
+ @callback_formats[CALLBACK_ANALOG_VALUE_REACHED] = [10, 'S']
99
101
 
102
+ @ipcon.add_device self
100
103
  end
101
104
 
102
105
  # Returns the measured voltage. The resolution is approximately 10mV.
@@ -105,7 +108,9 @@ module Tinkerforge
105
108
  # CALLBACK_VOLTAGE callback and set the period with
106
109
  # BrickletAnalogInV2#set_voltage_callback_period.
107
110
  def get_voltage
108
- send_request FUNCTION_GET_VOLTAGE, [], '', 2, 'S'
111
+ check_validity
112
+
113
+ send_request FUNCTION_GET_VOLTAGE, [], '', 10, 'S'
109
114
  end
110
115
 
111
116
  # Returns the value as read by a 12-bit analog-to-digital converter.
@@ -114,7 +119,9 @@ module Tinkerforge
114
119
  # CALLBACK_ANALOG_VALUE callback and set the period with
115
120
  # BrickletAnalogInV2#set_analog_value_callback_period.
116
121
  def get_analog_value
117
- send_request FUNCTION_GET_ANALOG_VALUE, [], '', 2, 'S'
122
+ check_validity
123
+
124
+ send_request FUNCTION_GET_ANALOG_VALUE, [], '', 10, 'S'
118
125
  end
119
126
 
120
127
  # Sets the period with which the CALLBACK_VOLTAGE callback is triggered
@@ -123,12 +130,16 @@ module Tinkerforge
123
130
  # The CALLBACK_VOLTAGE callback is only triggered if the voltage has changed since
124
131
  # the last triggering.
125
132
  def set_voltage_callback_period(period)
126
- send_request FUNCTION_SET_VOLTAGE_CALLBACK_PERIOD, [period], 'L', 0, ''
133
+ check_validity
134
+
135
+ send_request FUNCTION_SET_VOLTAGE_CALLBACK_PERIOD, [period], 'L', 8, ''
127
136
  end
128
137
 
129
138
  # Returns the period as set by BrickletAnalogInV2#set_voltage_callback_period.
130
139
  def get_voltage_callback_period
131
- send_request FUNCTION_GET_VOLTAGE_CALLBACK_PERIOD, [], '', 4, 'L'
140
+ check_validity
141
+
142
+ send_request FUNCTION_GET_VOLTAGE_CALLBACK_PERIOD, [], '', 12, 'L'
132
143
  end
133
144
 
134
145
  # Sets the period with which the CALLBACK_ANALOG_VALUE callback is triggered
@@ -137,12 +148,16 @@ module Tinkerforge
137
148
  # The CALLBACK_ANALOG_VALUE callback is only triggered if the analog value has
138
149
  # changed since the last triggering.
139
150
  def set_analog_value_callback_period(period)
140
- send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD, [period], 'L', 0, ''
151
+ check_validity
152
+
153
+ send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD, [period], 'L', 8, ''
141
154
  end
142
155
 
143
156
  # Returns the period as set by BrickletAnalogInV2#set_analog_value_callback_period.
144
157
  def get_analog_value_callback_period
145
- send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD, [], '', 4, 'L'
158
+ check_validity
159
+
160
+ send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD, [], '', 12, 'L'
146
161
  end
147
162
 
148
163
  # Sets the thresholds for the CALLBACK_VOLTAGE_REACHED callback.
@@ -157,12 +172,16 @@ module Tinkerforge
157
172
  # "'<'", "Callback is triggered when the voltage is smaller than the min value (max is ignored)"
158
173
  # "'>'", "Callback is triggered when the voltage is greater than the min value (max is ignored)"
159
174
  def set_voltage_callback_threshold(option, min, max)
160
- send_request FUNCTION_SET_VOLTAGE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
175
+ check_validity
176
+
177
+ send_request FUNCTION_SET_VOLTAGE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
161
178
  end
162
179
 
163
180
  # Returns the threshold as set by BrickletAnalogInV2#set_voltage_callback_threshold.
164
181
  def get_voltage_callback_threshold
165
- send_request FUNCTION_GET_VOLTAGE_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
182
+ check_validity
183
+
184
+ send_request FUNCTION_GET_VOLTAGE_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
166
185
  end
167
186
 
168
187
  # Sets the thresholds for the CALLBACK_ANALOG_VALUE_REACHED callback.
@@ -177,12 +196,16 @@ module Tinkerforge
177
196
  # "'<'", "Callback is triggered when the analog value is smaller than the min value (max is ignored)"
178
197
  # "'>'", "Callback is triggered when the analog value is greater than the min value (max is ignored)"
179
198
  def set_analog_value_callback_threshold(option, min, max)
180
- send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
199
+ check_validity
200
+
201
+ send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
181
202
  end
182
203
 
183
204
  # Returns the threshold as set by BrickletAnalogInV2#set_analog_value_callback_threshold.
184
205
  def get_analog_value_callback_threshold
185
- send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
206
+ check_validity
207
+
208
+ send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
186
209
  end
187
210
 
188
211
  # Sets the period with which the threshold callbacks
@@ -197,12 +220,16 @@ module Tinkerforge
197
220
  #
198
221
  # keep being reached.
199
222
  def set_debounce_period(debounce)
200
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
223
+ check_validity
224
+
225
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
201
226
  end
202
227
 
203
228
  # Returns the debounce period as set by BrickletAnalogInV2#set_debounce_period.
204
229
  def get_debounce_period
205
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
230
+ check_validity
231
+
232
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
206
233
  end
207
234
 
208
235
  # Sets the length of a `moving averaging <https://en.wikipedia.org/wiki/Moving_average>`__
@@ -211,24 +238,30 @@ module Tinkerforge
211
238
  # Setting the length to 1 will turn the averaging off. With less
212
239
  # averaging, there is more noise on the data.
213
240
  def set_moving_average(average)
214
- send_request FUNCTION_SET_MOVING_AVERAGE, [average], 'C', 0, ''
241
+ check_validity
242
+
243
+ send_request FUNCTION_SET_MOVING_AVERAGE, [average], 'C', 8, ''
215
244
  end
216
245
 
217
246
  # Returns the length of the moving average as set by BrickletAnalogInV2#set_moving_average.
218
247
  def get_moving_average
219
- send_request FUNCTION_GET_MOVING_AVERAGE, [], '', 1, 'C'
248
+ check_validity
249
+
250
+ send_request FUNCTION_GET_MOVING_AVERAGE, [], '', 9, 'C'
220
251
  end
221
252
 
222
253
  # Returns the UID, the UID where the Bricklet is connected to,
223
254
  # the position, the hardware and firmware version as well as the
224
255
  # device identifier.
225
256
  #
226
- # The position can be 'a', 'b', 'c' or 'd'.
257
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
258
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
259
+ # position 'z'.
227
260
  #
228
261
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
229
262
  # |device_identifier_constant|
230
263
  def get_identity
231
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
264
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
232
265
  end
233
266
 
234
267
  # 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-11-25. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.29 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # Measures DC voltage between 0V and 42V
14
16
  class BrickletAnalogInV3 < Device
@@ -75,7 +77,7 @@ module Tinkerforge
75
77
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
76
78
  # the IP Connection <tt>ipcon</tt>.
77
79
  def initialize(uid, ipcon)
78
- super uid, ipcon
80
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
79
81
 
80
82
  @api_version = [2, 0, 0]
81
83
 
@@ -99,8 +101,9 @@ module Tinkerforge
99
101
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
100
102
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
101
103
 
102
- @callback_formats[CALLBACK_VOLTAGE] = 'S'
104
+ @callback_formats[CALLBACK_VOLTAGE] = [10, 'S']
103
105
 
106
+ @ipcon.add_device self
104
107
  end
105
108
 
106
109
  # Returns the measured voltage. The resolution is approximately 10mV to 1mV
@@ -111,7 +114,9 @@ module Tinkerforge
111
114
  # CALLBACK_VOLTAGE callback. You can set the callback configuration
112
115
  # with BrickletAnalogInV3#set_voltage_callback_configuration.
113
116
  def get_voltage
114
- send_request FUNCTION_GET_VOLTAGE, [], '', 2, 'S'
117
+ check_validity
118
+
119
+ send_request FUNCTION_GET_VOLTAGE, [], '', 10, 'S'
115
120
  end
116
121
 
117
122
  # The period is the period with which the CALLBACK_VOLTAGE callback is triggered
@@ -140,12 +145,16 @@ module Tinkerforge
140
145
  #
141
146
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
142
147
  def set_voltage_callback_configuration(period, value_has_to_change, option, min, max)
143
- send_request FUNCTION_SET_VOLTAGE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k S S', 0, ''
148
+ check_validity
149
+
150
+ send_request FUNCTION_SET_VOLTAGE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k S S', 8, ''
144
151
  end
145
152
 
146
153
  # Returns the callback configuration as set by BrickletAnalogInV3#set_voltage_callback_configuration.
147
154
  def get_voltage_callback_configuration
148
- send_request FUNCTION_GET_VOLTAGE_CALLBACK_CONFIGURATION, [], '', 10, 'L ? k S S'
155
+ check_validity
156
+
157
+ send_request FUNCTION_GET_VOLTAGE_CALLBACK_CONFIGURATION, [], '', 18, 'L ? k S S'
149
158
  end
150
159
 
151
160
  # Sets the oversampling between 32x and 16384x. The Bricklet
@@ -161,12 +170,16 @@ module Tinkerforge
161
170
  # oversampling the reaction time increases (changes in voltage will be
162
171
  # measured faster).
163
172
  def set_oversampling(oversampling)
164
- send_request FUNCTION_SET_OVERSAMPLING, [oversampling], 'C', 0, ''
173
+ check_validity
174
+
175
+ send_request FUNCTION_SET_OVERSAMPLING, [oversampling], 'C', 8, ''
165
176
  end
166
177
 
167
178
  # Returns the oversampling value as set by BrickletAnalogInV3#set_oversampling.
168
179
  def get_oversampling
169
- send_request FUNCTION_GET_OVERSAMPLING, [], '', 1, 'C'
180
+ check_validity
181
+
182
+ send_request FUNCTION_GET_OVERSAMPLING, [], '', 9, 'C'
170
183
  end
171
184
 
172
185
  # Sets a calibration for the measured voltage value.
@@ -178,12 +191,16 @@ module Tinkerforge
178
191
  # the Bricklet. The calibration will be saved internally and only
179
192
  # has to be done once.
180
193
  def set_calibration(offset, multiplier, divisor)
181
- send_request FUNCTION_SET_CALIBRATION, [offset, multiplier, divisor], 's S S', 0, ''
194
+ check_validity
195
+
196
+ send_request FUNCTION_SET_CALIBRATION, [offset, multiplier, divisor], 's S S', 8, ''
182
197
  end
183
198
 
184
199
  # Returns the calibration as set by BrickletAnalogInV3#set_calibration.
185
200
  def get_calibration
186
- send_request FUNCTION_GET_CALIBRATION, [], '', 6, 's S S'
201
+ check_validity
202
+
203
+ send_request FUNCTION_GET_CALIBRATION, [], '', 14, 's S S'
187
204
  end
188
205
 
189
206
  # Returns the error count for the communication between Brick and Bricklet.
@@ -198,7 +215,9 @@ module Tinkerforge
198
215
  # The errors counts are for errors that occur on the Bricklet side. All
199
216
  # Bricks have a similar function that returns the errors on the Brick side.
200
217
  def get_spitfp_error_count
201
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
218
+ check_validity
219
+
220
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
202
221
  end
203
222
 
204
223
  # Sets the bootloader mode and returns the status after the requested
@@ -211,12 +230,16 @@ module Tinkerforge
211
230
  # This function is used by Brick Viewer during flashing. It should not be
212
231
  # necessary to call it in a normal user program.
213
232
  def set_bootloader_mode(mode)
214
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
233
+ check_validity
234
+
235
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
215
236
  end
216
237
 
217
238
  # Returns the current bootloader mode, see BrickletAnalogInV3#set_bootloader_mode.
218
239
  def get_bootloader_mode
219
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
240
+ check_validity
241
+
242
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
220
243
  end
221
244
 
222
245
  # Sets the firmware pointer for BrickletAnalogInV3#write_firmware. The pointer has
@@ -226,7 +249,9 @@ module Tinkerforge
226
249
  # This function is used by Brick Viewer during flashing. It should not be
227
250
  # necessary to call it in a normal user program.
228
251
  def set_write_firmware_pointer(pointer)
229
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
252
+ check_validity
253
+
254
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
230
255
  end
231
256
 
232
257
  # Writes 64 Bytes of firmware at the position as written by
@@ -238,7 +263,9 @@ module Tinkerforge
238
263
  # This function is used by Brick Viewer during flashing. It should not be
239
264
  # necessary to call it in a normal user program.
240
265
  def write_firmware(data)
241
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
266
+ check_validity
267
+
268
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
242
269
  end
243
270
 
244
271
  # Sets the status LED configuration. By default the LED shows
@@ -249,22 +276,28 @@ module Tinkerforge
249
276
  #
250
277
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
251
278
  def set_status_led_config(config)
252
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
279
+ check_validity
280
+
281
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
253
282
  end
254
283
 
255
284
  # Returns the configuration as set by BrickletAnalogInV3#set_status_led_config
256
285
  def get_status_led_config
257
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
286
+ check_validity
287
+
288
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
258
289
  end
259
290
 
260
- # Returns the temperature in °C as measured inside the microcontroller. The
291
+ # Returns the temperature as measured inside the microcontroller. The
261
292
  # value returned is not the ambient temperature!
262
293
  #
263
294
  # The temperature is only proportional to the real temperature and it has bad
264
295
  # accuracy. Practically it is only useful as an indicator for
265
296
  # temperature changes.
266
297
  def get_chip_temperature
267
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
298
+ check_validity
299
+
300
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
268
301
  end
269
302
 
270
303
  # Calling this function will reset the Bricklet. All configurations
@@ -274,7 +307,9 @@ module Tinkerforge
274
307
  # calling functions on the existing ones will result in
275
308
  # undefined behavior!
276
309
  def reset
277
- send_request FUNCTION_RESET, [], '', 0, ''
310
+ check_validity
311
+
312
+ send_request FUNCTION_RESET, [], '', 8, ''
278
313
  end
279
314
 
280
315
  # Writes a new UID into flash. If you want to set a new UID
@@ -283,25 +318,31 @@ module Tinkerforge
283
318
  #
284
319
  # We recommend that you use Brick Viewer to change the UID.
285
320
  def write_uid(uid)
286
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
321
+ check_validity
322
+
323
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
287
324
  end
288
325
 
289
326
  # Returns the current UID as an integer. Encode as
290
327
  # Base58 to get the usual string version.
291
328
  def read_uid
292
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
329
+ check_validity
330
+
331
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
293
332
  end
294
333
 
295
334
  # Returns the UID, the UID where the Bricklet is connected to,
296
335
  # the position, the hardware and firmware version as well as the
297
336
  # device identifier.
298
337
  #
299
- # The position can be 'a', 'b', 'c' or 'd'.
338
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
339
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
340
+ # position 'z'.
300
341
  #
301
342
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
302
343
  # |device_identifier_constant|
303
344
  def get_identity
304
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
345
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
305
346
  end
306
347
 
307
348
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-11-25. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.29 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # Generates configurable DC voltage between 0V and 5V
14
16
  class BrickletAnalogOut < Device
@@ -29,7 +31,7 @@ module Tinkerforge
29
31
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
30
32
  # the IP Connection <tt>ipcon</tt>.
31
33
  def initialize(uid, ipcon)
32
- super uid, ipcon
34
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
33
35
 
34
36
  @api_version = [2, 0, 0]
35
37
 
@@ -40,17 +42,22 @@ module Tinkerforge
40
42
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
41
43
 
42
44
 
45
+ @ipcon.add_device self
43
46
  end
44
47
 
45
48
  # Sets the voltage. Calling this function will set
46
49
  # the mode to 0 (see BrickletAnalogOut#set_mode).
47
50
  def set_voltage(voltage)
48
- send_request FUNCTION_SET_VOLTAGE, [voltage], 'S', 0, ''
51
+ check_validity
52
+
53
+ send_request FUNCTION_SET_VOLTAGE, [voltage], 'S', 8, ''
49
54
  end
50
55
 
51
56
  # Returns the voltage as set by BrickletAnalogOut#set_voltage.
52
57
  def get_voltage
53
- send_request FUNCTION_GET_VOLTAGE, [], '', 2, 'S'
58
+ check_validity
59
+
60
+ send_request FUNCTION_GET_VOLTAGE, [], '', 10, 'S'
54
61
  end
55
62
 
56
63
  # Sets the mode of the analog value. Possible modes:
@@ -63,24 +70,30 @@ module Tinkerforge
63
70
  # Setting the mode to 0 will result in an output voltage of 0 V. You can jump
64
71
  # to a higher output voltage directly by calling BrickletAnalogOut#set_voltage.
65
72
  def set_mode(mode)
66
- send_request FUNCTION_SET_MODE, [mode], 'C', 0, ''
73
+ check_validity
74
+
75
+ send_request FUNCTION_SET_MODE, [mode], 'C', 8, ''
67
76
  end
68
77
 
69
78
  # Returns the mode as set by BrickletAnalogOut#set_mode.
70
79
  def get_mode
71
- send_request FUNCTION_GET_MODE, [], '', 1, 'C'
80
+ check_validity
81
+
82
+ send_request FUNCTION_GET_MODE, [], '', 9, 'C'
72
83
  end
73
84
 
74
85
  # Returns the UID, the UID where the Bricklet is connected to,
75
86
  # the position, the hardware and firmware version as well as the
76
87
  # device identifier.
77
88
  #
78
- # The position can be 'a', 'b', 'c' or 'd'.
89
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
90
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
91
+ # position 'z'.
79
92
  #
80
93
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
81
94
  # |device_identifier_constant|
82
95
  def get_identity
83
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
96
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
84
97
  end
85
98
 
86
99
  end