tinkerforge 2.1.24 → 2.1.25

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.
Files changed (142) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tinkerforge/brick_dc.rb +155 -74
  3. data/lib/tinkerforge/brick_hat.rb +70 -30
  4. data/lib/tinkerforge/brick_hat_zero.rb +56 -22
  5. data/lib/tinkerforge/brick_imu.rb +184 -77
  6. data/lib/tinkerforge/brick_imu_v2.rb +208 -105
  7. data/lib/tinkerforge/brick_master.rb +484 -182
  8. data/lib/tinkerforge/brick_red.rb +197 -74
  9. data/lib/tinkerforge/brick_servo.rb +185 -101
  10. data/lib/tinkerforge/brick_silent_stepper.rb +246 -166
  11. data/lib/tinkerforge/brick_stepper.rb +210 -98
  12. data/lib/tinkerforge/bricklet_accelerometer.rb +58 -23
  13. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +105 -54
  14. data/lib/tinkerforge/bricklet_air_quality.rb +117 -59
  15. data/lib/tinkerforge/bricklet_ambient_light.rb +51 -21
  16. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +40 -22
  17. data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -25
  18. data/lib/tinkerforge/bricklet_analog_in.rb +63 -25
  19. data/lib/tinkerforge/bricklet_analog_in_v2.rb +57 -23
  20. data/lib/tinkerforge/bricklet_analog_in_v3.rb +67 -25
  21. data/lib/tinkerforge/bricklet_analog_out.rb +23 -9
  22. data/lib/tinkerforge/bricklet_analog_out_v2.rb +20 -8
  23. data/lib/tinkerforge/bricklet_analog_out_v3.rb +54 -20
  24. data/lib/tinkerforge/bricklet_barometer.rb +66 -26
  25. data/lib/tinkerforge/bricklet_barometer_v2.rb +99 -37
  26. data/lib/tinkerforge/bricklet_can.rb +83 -18
  27. data/lib/tinkerforge/bricklet_can_v2.rb +172 -38
  28. data/lib/tinkerforge/bricklet_co2.rb +34 -14
  29. data/lib/tinkerforge/bricklet_co2_v2.rb +97 -37
  30. data/lib/tinkerforge/bricklet_color.rb +69 -27
  31. data/lib/tinkerforge/bricklet_color_v2.rb +87 -33
  32. data/lib/tinkerforge/bricklet_compass.rb +78 -30
  33. data/lib/tinkerforge/bricklet_current12.rb +58 -24
  34. data/lib/tinkerforge/bricklet_current25.rb +58 -24
  35. data/lib/tinkerforge/bricklet_distance_ir.rb +57 -23
  36. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +83 -31
  37. data/lib/tinkerforge/bricklet_distance_us.rb +40 -16
  38. data/lib/tinkerforge/bricklet_distance_us_v2.rb +67 -25
  39. data/lib/tinkerforge/bricklet_dmx.rb +88 -34
  40. data/lib/tinkerforge/bricklet_dual_button.rb +24 -10
  41. data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -24
  42. data/lib/tinkerforge/bricklet_dual_relay.rb +27 -11
  43. data/lib/tinkerforge/bricklet_dust_detector.rb +40 -16
  44. data/lib/tinkerforge/bricklet_e_paper_296x128.rb +88 -32
  45. data/lib/tinkerforge/bricklet_energy_monitor.rb +73 -27
  46. data/lib/tinkerforge/bricklet_gps.rb +64 -26
  47. data/lib/tinkerforge/bricklet_gps_v2.rb +117 -47
  48. data/lib/tinkerforge/bricklet_hall_effect.rb +43 -23
  49. data/lib/tinkerforge/bricklet_hall_effect_v2.rb +71 -27
  50. data/lib/tinkerforge/bricklet_humidity.rb +51 -21
  51. data/lib/tinkerforge/bricklet_humidity_v2.rb +83 -31
  52. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +38 -14
  53. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +81 -29
  54. data/lib/tinkerforge/bricklet_industrial_counter.rb +101 -39
  55. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +45 -17
  56. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +77 -29
  57. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -14
  58. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +73 -27
  59. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +40 -16
  60. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +79 -29
  61. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +49 -19
  62. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +82 -30
  63. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +61 -23
  64. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -14
  65. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -25
  66. data/lib/tinkerforge/bricklet_io16.rb +55 -21
  67. data/lib/tinkerforge/bricklet_io16_v2.rb +90 -34
  68. data/lib/tinkerforge/bricklet_io4.rb +55 -23
  69. data/lib/tinkerforge/bricklet_io4_v2.rb +96 -36
  70. data/lib/tinkerforge/bricklet_isolator.rb +72 -28
  71. data/lib/tinkerforge/bricklet_joystick.rb +59 -25
  72. data/lib/tinkerforge/bricklet_joystick_v2.rb +68 -26
  73. data/lib/tinkerforge/bricklet_laser_range_finder.rb +82 -32
  74. data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +96 -36
  75. data/lib/tinkerforge/bricklet_lcd_128x64.rb +192 -70
  76. data/lib/tinkerforge/bricklet_lcd_16x2.rb +45 -18
  77. data/lib/tinkerforge/bricklet_lcd_20x4.rb +58 -23
  78. data/lib/tinkerforge/bricklet_led_strip.rb +60 -22
  79. data/lib/tinkerforge/bricklet_led_strip_v2.rb +91 -46
  80. data/lib/tinkerforge/bricklet_line.rb +34 -14
  81. data/lib/tinkerforge/bricklet_linear_poti.rb +51 -21
  82. data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -21
  83. data/lib/tinkerforge/bricklet_load_cell.rb +61 -23
  84. data/lib/tinkerforge/bricklet_load_cell_v2.rb +80 -30
  85. data/lib/tinkerforge/bricklet_moisture.rb +40 -16
  86. data/lib/tinkerforge/bricklet_motion_detector.rb +22 -10
  87. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -24
  88. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -27
  89. data/lib/tinkerforge/bricklet_multi_touch.rb +31 -13
  90. data/lib/tinkerforge/bricklet_multi_touch_v2.rb +76 -28
  91. data/lib/tinkerforge/bricklet_nfc.rb +123 -58
  92. data/lib/tinkerforge/bricklet_nfc_rfid.rb +33 -13
  93. data/lib/tinkerforge/bricklet_oled_128x64.rb +29 -11
  94. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +66 -24
  95. data/lib/tinkerforge/bricklet_oled_64x48.rb +29 -11
  96. data/lib/tinkerforge/bricklet_one_wire.rb +66 -24
  97. data/lib/tinkerforge/bricklet_outdoor_weather.rb +71 -27
  98. data/lib/tinkerforge/bricklet_particulate_matter.rb +75 -30
  99. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -9
  100. data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -10
  101. data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +80 -42
  102. data/lib/tinkerforge/bricklet_ptc.rb +74 -42
  103. data/lib/tinkerforge/bricklet_ptc_v2.rb +95 -48
  104. data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -33
  105. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -44
  106. data/lib/tinkerforge/bricklet_remote_switch.rb +39 -29
  107. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +87 -49
  108. data/lib/tinkerforge/bricklet_rgb_led.rb +18 -8
  109. data/lib/tinkerforge/bricklet_rgb_led_button.rb +62 -30
  110. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +79 -33
  111. data/lib/tinkerforge/bricklet_rgb_led_v2.rb +52 -20
  112. data/lib/tinkerforge/bricklet_rotary_encoder.rb +39 -19
  113. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -24
  114. data/lib/tinkerforge/bricklet_rotary_poti.rb +53 -28
  115. data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +57 -23
  116. data/lib/tinkerforge/bricklet_rs232.rb +90 -28
  117. data/lib/tinkerforge/bricklet_rs232_v2.rb +118 -44
  118. data/lib/tinkerforge/bricklet_rs485.rb +223 -95
  119. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +25 -14
  120. data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -35
  121. data/lib/tinkerforge/bricklet_solid_state_relay.rb +25 -13
  122. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +59 -25
  123. data/lib/tinkerforge/bricklet_sound_intensity.rb +35 -18
  124. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +72 -31
  125. data/lib/tinkerforge/bricklet_temperature.rb +40 -16
  126. data/lib/tinkerforge/bricklet_temperature_ir.rb +57 -23
  127. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +71 -27
  128. data/lib/tinkerforge/bricklet_temperature_v2.rb +61 -25
  129. data/lib/tinkerforge/bricklet_thermal_imaging.rb +105 -44
  130. data/lib/tinkerforge/bricklet_thermocouple.rb +45 -24
  131. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -27
  132. data/lib/tinkerforge/bricklet_tilt.rb +24 -10
  133. data/lib/tinkerforge/bricklet_uv_light.rb +36 -18
  134. data/lib/tinkerforge/bricklet_uv_light_v2.rb +85 -37
  135. data/lib/tinkerforge/bricklet_voltage.rb +52 -28
  136. data/lib/tinkerforge/bricklet_voltage_current.rb +91 -73
  137. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +90 -68
  138. data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +80 -30
  139. data/lib/tinkerforge/device_display_names.rb +163 -0
  140. data/lib/tinkerforge/ip_connection.rb +151 -32
  141. data/lib/tinkerforge/version.rb +1 -1
  142. metadata +3 -2
@@ -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 2020-04-07. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.25 #
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,31 @@ 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
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
259
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
260
+ # position 'z'.
227
261
  #
228
262
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
229
263
  # |device_identifier_constant|
230
264
  def get_identity
231
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
265
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
232
266
  end
233
267
 
234
268
  # 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 2020-04-07. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.25 #
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,32 @@ 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
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
340
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
341
+ # position 'z'.
300
342
  #
301
343
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
302
344
  # |device_identifier_constant|
303
345
  def get_identity
304
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
346
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
305
347
  end
306
348
 
307
349
  # 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 2020-04-07. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.25 #
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,31 @@ 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
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
91
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
92
+ # position 'z'.
79
93
  #
80
94
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
81
95
  # |device_identifier_constant|
82
96
  def get_identity
83
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
97
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
84
98
  end
85
99
 
86
100
  end