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 temperature with thermocouples
14
16
  class BrickletThermocouple < Device
@@ -73,7 +75,7 @@ module Tinkerforge
73
75
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
74
76
  # the IP Connection <tt>ipcon</tt>.
75
77
  def initialize(uid, ipcon)
76
- super uid, ipcon
78
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
77
79
 
78
80
  @api_version = [2, 0, 0]
79
81
 
@@ -89,20 +91,22 @@ module Tinkerforge
89
91
  @response_expected[FUNCTION_GET_ERROR_STATE] = RESPONSE_EXPECTED_ALWAYS_TRUE
90
92
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
91
93
 
92
- @callback_formats[CALLBACK_TEMPERATURE] = 'l'
93
- @callback_formats[CALLBACK_TEMPERATURE_REACHED] = 'l'
94
- @callback_formats[CALLBACK_ERROR_STATE] = '? ?'
94
+ @callback_formats[CALLBACK_TEMPERATURE] = [12, 'l']
95
+ @callback_formats[CALLBACK_TEMPERATURE_REACHED] = [12, 'l']
96
+ @callback_formats[CALLBACK_ERROR_STATE] = [10, '? ?']
95
97
 
98
+ @ipcon.add_device self
96
99
  end
97
100
 
98
- # Returns the temperature of the thermocouple. The value is given in °C/100,
99
- # e.g. a value of 4223 means that a temperature of 42.23 °C is measured.
101
+ # Returns the temperature of the thermocouple.
100
102
  #
101
103
  # If you want to get the temperature periodically, it is recommended
102
104
  # to use the CALLBACK_TEMPERATURE callback and set the period with
103
105
  # BrickletThermocouple#set_temperature_callback_period.
104
106
  def get_temperature
105
- send_request FUNCTION_GET_TEMPERATURE, [], '', 4, 'l'
107
+ check_validity
108
+
109
+ send_request FUNCTION_GET_TEMPERATURE, [], '', 12, 'l'
106
110
  end
107
111
 
108
112
  # Sets the period with which the CALLBACK_TEMPERATURE callback is triggered
@@ -111,12 +115,16 @@ module Tinkerforge
111
115
  # The CALLBACK_TEMPERATURE callback is only triggered if the temperature has changed
112
116
  # since the last triggering.
113
117
  def set_temperature_callback_period(period)
114
- send_request FUNCTION_SET_TEMPERATURE_CALLBACK_PERIOD, [period], 'L', 0, ''
118
+ check_validity
119
+
120
+ send_request FUNCTION_SET_TEMPERATURE_CALLBACK_PERIOD, [period], 'L', 8, ''
115
121
  end
116
122
 
117
123
  # Returns the period as set by BrickletThermocouple#set_temperature_callback_period.
118
124
  def get_temperature_callback_period
119
- send_request FUNCTION_GET_TEMPERATURE_CALLBACK_PERIOD, [], '', 4, 'L'
125
+ check_validity
126
+
127
+ send_request FUNCTION_GET_TEMPERATURE_CALLBACK_PERIOD, [], '', 12, 'L'
120
128
  end
121
129
 
122
130
  # Sets the thresholds for the CALLBACK_TEMPERATURE_REACHED callback.
@@ -130,15 +138,17 @@ module Tinkerforge
130
138
  # "'i'", "Callback is triggered when the temperature is *inside* the min and max values"
131
139
  # "'<'", "Callback is triggered when the temperature is smaller than the min value (max is ignored)"
132
140
  # "'>'", "Callback is triggered when the temperature is greater than the min value (max is ignored)"
133
- #
134
- # The default value is ('x', 0, 0).
135
141
  def set_temperature_callback_threshold(option, min, max)
136
- send_request FUNCTION_SET_TEMPERATURE_CALLBACK_THRESHOLD, [option, min, max], 'k l l', 0, ''
142
+ check_validity
143
+
144
+ send_request FUNCTION_SET_TEMPERATURE_CALLBACK_THRESHOLD, [option, min, max], 'k l l', 8, ''
137
145
  end
138
146
 
139
147
  # Returns the threshold as set by BrickletThermocouple#set_temperature_callback_threshold.
140
148
  def get_temperature_callback_threshold
141
- send_request FUNCTION_GET_TEMPERATURE_CALLBACK_THRESHOLD, [], '', 9, 'k l l'
149
+ check_validity
150
+
151
+ send_request FUNCTION_GET_TEMPERATURE_CALLBACK_THRESHOLD, [], '', 17, 'k l l'
142
152
  end
143
153
 
144
154
  # Sets the period with which the threshold callback
@@ -151,12 +161,16 @@ module Tinkerforge
151
161
  #
152
162
  # keeps being reached.
153
163
  def set_debounce_period(debounce)
154
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
164
+ check_validity
165
+
166
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
155
167
  end
156
168
 
157
169
  # Returns the debounce period as set by BrickletThermocouple#set_debounce_period.
158
170
  def get_debounce_period
159
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
171
+ check_validity
172
+
173
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
160
174
  end
161
175
 
162
176
  # You can configure averaging size, thermocouple type and frequency
@@ -182,15 +196,17 @@ module Tinkerforge
182
196
  #
183
197
  # * 60Hz: ``time = 82 + (samples - 1) * 16.67``
184
198
  # * 50Hz: ``time = 98 + (samples - 1) * 20``
185
- #
186
- # The default configuration is 16 samples, K type and 50Hz.
187
199
  def set_configuration(averaging, thermocouple_type, filter)
188
- send_request FUNCTION_SET_CONFIGURATION, [averaging, thermocouple_type, filter], 'C C C', 0, ''
200
+ check_validity
201
+
202
+ send_request FUNCTION_SET_CONFIGURATION, [averaging, thermocouple_type, filter], 'C C C', 8, ''
189
203
  end
190
204
 
191
205
  # Returns the configuration as set by BrickletThermocouple#set_configuration.
192
206
  def get_configuration
193
- send_request FUNCTION_GET_CONFIGURATION, [], '', 3, 'C C C'
207
+ check_validity
208
+
209
+ send_request FUNCTION_GET_CONFIGURATION, [], '', 11, 'C C C'
194
210
  end
195
211
 
196
212
  # Returns the current error state. There are two possible errors:
@@ -205,19 +221,23 @@ module Tinkerforge
205
221
  # You can use the CALLBACK_ERROR_STATE callback to automatically get triggered
206
222
  # when the error state changes.
207
223
  def get_error_state
208
- send_request FUNCTION_GET_ERROR_STATE, [], '', 2, '? ?'
224
+ check_validity
225
+
226
+ send_request FUNCTION_GET_ERROR_STATE, [], '', 10, '? ?'
209
227
  end
210
228
 
211
229
  # Returns the UID, the UID where the Bricklet is connected to,
212
230
  # the position, the hardware and firmware version as well as the
213
231
  # device identifier.
214
232
  #
215
- # The position can be 'a', 'b', 'c' or 'd'.
233
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
234
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
235
+ # position 'z'.
216
236
  #
217
237
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
218
238
  # |device_identifier_constant|
219
239
  def get_identity
220
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
240
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
221
241
  end
222
242
 
223
243
  # 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 temperature with thermocouples
14
16
  class BrickletThermocoupleV2 < Device
@@ -85,7 +87,7 @@ module Tinkerforge
85
87
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
86
88
  # the IP Connection <tt>ipcon</tt>.
87
89
  def initialize(uid, ipcon)
88
- super uid, ipcon
90
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
89
91
 
90
92
  @api_version = [2, 0, 0]
91
93
 
@@ -108,9 +110,10 @@ module Tinkerforge
108
110
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
109
111
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
110
112
 
111
- @callback_formats[CALLBACK_TEMPERATURE] = 'l'
112
- @callback_formats[CALLBACK_ERROR_STATE] = '? ?'
113
+ @callback_formats[CALLBACK_TEMPERATURE] = [12, 'l']
114
+ @callback_formats[CALLBACK_ERROR_STATE] = [10, '? ?']
113
115
 
116
+ @ipcon.add_device self
114
117
  end
115
118
 
116
119
  # Returns the temperature of the thermocouple. The value is given in °C/100,
@@ -125,7 +128,9 @@ module Tinkerforge
125
128
  # CALLBACK_TEMPERATURE callback. You can set the callback configuration
126
129
  # with BrickletThermocoupleV2#set_temperature_callback_configuration.
127
130
  def get_temperature
128
- send_request FUNCTION_GET_TEMPERATURE, [], '', 4, 'l'
131
+ check_validity
132
+
133
+ send_request FUNCTION_GET_TEMPERATURE, [], '', 12, 'l'
129
134
  end
130
135
 
131
136
  # The period is the period with which the CALLBACK_TEMPERATURE callback is triggered
@@ -154,12 +159,16 @@ module Tinkerforge
154
159
  #
155
160
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
156
161
  def set_temperature_callback_configuration(period, value_has_to_change, option, min, max)
157
- send_request FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 0, ''
162
+ check_validity
163
+
164
+ send_request FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 8, ''
158
165
  end
159
166
 
160
167
  # Returns the callback configuration as set by BrickletThermocoupleV2#set_temperature_callback_configuration.
161
168
  def get_temperature_callback_configuration
162
- send_request FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 14, 'L ? k l l'
169
+ check_validity
170
+
171
+ send_request FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k l l'
163
172
  end
164
173
 
165
174
  # You can configure averaging size, thermocouple type and frequency
@@ -185,15 +194,17 @@ module Tinkerforge
185
194
  #
186
195
  # * 60Hz: ``time = 82 + (samples - 1) * 16.67``
187
196
  # * 50Hz: ``time = 98 + (samples - 1) * 20``
188
- #
189
- # The default configuration is 16 samples, K type and 50Hz.
190
197
  def set_configuration(averaging, thermocouple_type, filter)
191
- send_request FUNCTION_SET_CONFIGURATION, [averaging, thermocouple_type, filter], 'C C C', 0, ''
198
+ check_validity
199
+
200
+ send_request FUNCTION_SET_CONFIGURATION, [averaging, thermocouple_type, filter], 'C C C', 8, ''
192
201
  end
193
202
 
194
203
  # Returns the configuration as set by BrickletThermocoupleV2#set_configuration.
195
204
  def get_configuration
196
- send_request FUNCTION_GET_CONFIGURATION, [], '', 3, 'C C C'
205
+ check_validity
206
+
207
+ send_request FUNCTION_GET_CONFIGURATION, [], '', 11, 'C C C'
197
208
  end
198
209
 
199
210
  # Returns the current error state. There are two possible errors:
@@ -208,7 +219,9 @@ module Tinkerforge
208
219
  # You can use the CALLBACK_ERROR_STATE callback to automatically get triggered
209
220
  # when the error state changes.
210
221
  def get_error_state
211
- send_request FUNCTION_GET_ERROR_STATE, [], '', 2, '? ?'
222
+ check_validity
223
+
224
+ send_request FUNCTION_GET_ERROR_STATE, [], '', 10, '? ?'
212
225
  end
213
226
 
214
227
  # Returns the error count for the communication between Brick and Bricklet.
@@ -223,7 +236,9 @@ module Tinkerforge
223
236
  # The errors counts are for errors that occur on the Bricklet side. All
224
237
  # Bricks have a similar function that returns the errors on the Brick side.
225
238
  def get_spitfp_error_count
226
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
239
+ check_validity
240
+
241
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
227
242
  end
228
243
 
229
244
  # Sets the bootloader mode and returns the status after the requested
@@ -236,12 +251,16 @@ module Tinkerforge
236
251
  # This function is used by Brick Viewer during flashing. It should not be
237
252
  # necessary to call it in a normal user program.
238
253
  def set_bootloader_mode(mode)
239
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
254
+ check_validity
255
+
256
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
240
257
  end
241
258
 
242
259
  # Returns the current bootloader mode, see BrickletThermocoupleV2#set_bootloader_mode.
243
260
  def get_bootloader_mode
244
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
261
+ check_validity
262
+
263
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
245
264
  end
246
265
 
247
266
  # Sets the firmware pointer for BrickletThermocoupleV2#write_firmware. The pointer has
@@ -251,7 +270,9 @@ module Tinkerforge
251
270
  # This function is used by Brick Viewer during flashing. It should not be
252
271
  # necessary to call it in a normal user program.
253
272
  def set_write_firmware_pointer(pointer)
254
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
273
+ check_validity
274
+
275
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
255
276
  end
256
277
 
257
278
  # Writes 64 Bytes of firmware at the position as written by
@@ -263,7 +284,9 @@ module Tinkerforge
263
284
  # This function is used by Brick Viewer during flashing. It should not be
264
285
  # necessary to call it in a normal user program.
265
286
  def write_firmware(data)
266
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
287
+ check_validity
288
+
289
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
267
290
  end
268
291
 
269
292
  # Sets the status LED configuration. By default the LED shows
@@ -274,22 +297,28 @@ module Tinkerforge
274
297
  #
275
298
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
276
299
  def set_status_led_config(config)
277
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
300
+ check_validity
301
+
302
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
278
303
  end
279
304
 
280
305
  # Returns the configuration as set by BrickletThermocoupleV2#set_status_led_config
281
306
  def get_status_led_config
282
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
307
+ check_validity
308
+
309
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
283
310
  end
284
311
 
285
- # Returns the temperature in °C as measured inside the microcontroller. The
312
+ # Returns the temperature as measured inside the microcontroller. The
286
313
  # value returned is not the ambient temperature!
287
314
  #
288
315
  # The temperature is only proportional to the real temperature and it has bad
289
316
  # accuracy. Practically it is only useful as an indicator for
290
317
  # temperature changes.
291
318
  def get_chip_temperature
292
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
319
+ check_validity
320
+
321
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
293
322
  end
294
323
 
295
324
  # Calling this function will reset the Bricklet. All configurations
@@ -299,7 +328,9 @@ module Tinkerforge
299
328
  # calling functions on the existing ones will result in
300
329
  # undefined behavior!
301
330
  def reset
302
- send_request FUNCTION_RESET, [], '', 0, ''
331
+ check_validity
332
+
333
+ send_request FUNCTION_RESET, [], '', 8, ''
303
334
  end
304
335
 
305
336
  # Writes a new UID into flash. If you want to set a new UID
@@ -308,25 +339,31 @@ module Tinkerforge
308
339
  #
309
340
  # We recommend that you use Brick Viewer to change the UID.
310
341
  def write_uid(uid)
311
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
342
+ check_validity
343
+
344
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
312
345
  end
313
346
 
314
347
  # Returns the current UID as an integer. Encode as
315
348
  # Base58 to get the usual string version.
316
349
  def read_uid
317
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
350
+ check_validity
351
+
352
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
318
353
  end
319
354
 
320
355
  # Returns the UID, the UID where the Bricklet is connected to,
321
356
  # the position, the hardware and firmware version as well as the
322
357
  # device identifier.
323
358
  #
324
- # The position can be 'a', 'b', 'c' or 'd'.
359
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
360
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
361
+ # position 'z'.
325
362
  #
326
363
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
327
364
  # |device_identifier_constant|
328
365
  def get_identity
329
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
366
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
330
367
  end
331
368
 
332
369
  # 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
  # Detects inclination of Bricklet (tilt switch open/closed)
14
16
  class BrickletTilt < Device
@@ -34,7 +36,7 @@ module Tinkerforge
34
36
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
35
37
  # the IP Connection <tt>ipcon</tt>.
36
38
  def initialize(uid, ipcon)
37
- super uid, ipcon
39
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
38
40
 
39
41
  @api_version = [2, 0, 0]
40
42
 
@@ -44,8 +46,9 @@ module Tinkerforge
44
46
  @response_expected[FUNCTION_IS_TILT_STATE_CALLBACK_ENABLED] = RESPONSE_EXPECTED_ALWAYS_TRUE
45
47
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
46
48
 
47
- @callback_formats[CALLBACK_TILT_STATE] = 'C'
49
+ @callback_formats[CALLBACK_TILT_STATE] = [9, 'C']
48
50
 
51
+ @ipcon.add_device self
49
52
  end
50
53
 
51
54
  # Returns the current tilt state. The state can either be
@@ -60,34 +63,44 @@ module Tinkerforge
60
63
  # :align: center
61
64
  # :target: ../../_images/Bricklets/bricklet_tilt_mechanics.jpg
62
65
  def get_tilt_state
63
- send_request FUNCTION_GET_TILT_STATE, [], '', 1, 'C'
66
+ check_validity
67
+
68
+ send_request FUNCTION_GET_TILT_STATE, [], '', 9, 'C'
64
69
  end
65
70
 
66
71
  # Enables the CALLBACK_TILT_STATE callback.
67
72
  def enable_tilt_state_callback
68
- send_request FUNCTION_ENABLE_TILT_STATE_CALLBACK, [], '', 0, ''
73
+ check_validity
74
+
75
+ send_request FUNCTION_ENABLE_TILT_STATE_CALLBACK, [], '', 8, ''
69
76
  end
70
77
 
71
78
  # Disables the CALLBACK_TILT_STATE callback.
72
79
  def disable_tilt_state_callback
73
- send_request FUNCTION_DISABLE_TILT_STATE_CALLBACK, [], '', 0, ''
80
+ check_validity
81
+
82
+ send_request FUNCTION_DISABLE_TILT_STATE_CALLBACK, [], '', 8, ''
74
83
  end
75
84
 
76
85
  # Returns *true* if the CALLBACK_TILT_STATE callback is enabled.
77
86
  def is_tilt_state_callback_enabled
78
- send_request FUNCTION_IS_TILT_STATE_CALLBACK_ENABLED, [], '', 1, '?'
87
+ check_validity
88
+
89
+ send_request FUNCTION_IS_TILT_STATE_CALLBACK_ENABLED, [], '', 9, '?'
79
90
  end
80
91
 
81
92
  # Returns the UID, the UID where the Bricklet is connected to,
82
93
  # the position, the hardware and firmware version as well as the
83
94
  # device identifier.
84
95
  #
85
- # The position can be 'a', 'b', 'c' or 'd'.
96
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
97
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
98
+ # position 'z'.
86
99
  #
87
100
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
88
101
  # |device_identifier_constant|
89
102
  def get_identity
90
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
103
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
91
104
  end
92
105
 
93
106
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.