tinkerforge 2.1.22 → 2.1.27

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 (144) hide show
  1. checksums.yaml +5 -5
  2. data/lib/tinkerforge/brick_dc.rb +157 -76
  3. data/lib/tinkerforge/brick_hat.rb +115 -32
  4. data/lib/tinkerforge/brick_hat_zero.rb +119 -21
  5. data/lib/tinkerforge/brick_imu.rb +192 -87
  6. data/lib/tinkerforge/brick_imu_v2.rb +220 -119
  7. data/lib/tinkerforge/brick_master.rb +498 -198
  8. data/lib/tinkerforge/brick_red.rb +197 -74
  9. data/lib/tinkerforge/brick_servo.rb +187 -103
  10. data/lib/tinkerforge/brick_silent_stepper.rb +249 -169
  11. data/lib/tinkerforge/brick_stepper.rb +214 -102
  12. data/lib/tinkerforge/bricklet_accelerometer.rb +61 -36
  13. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +167 -48
  14. data/lib/tinkerforge/bricklet_air_quality.rb +123 -76
  15. data/lib/tinkerforge/bricklet_ambient_light.rb +62 -46
  16. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +41 -28
  17. data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -28
  18. data/lib/tinkerforge/bricklet_analog_in.rb +66 -45
  19. data/lib/tinkerforge/bricklet_analog_in_v2.rb +60 -43
  20. data/lib/tinkerforge/bricklet_analog_in_v3.rb +68 -32
  21. data/lib/tinkerforge/bricklet_analog_out.rb +25 -16
  22. data/lib/tinkerforge/bricklet_analog_out_v2.rb +21 -10
  23. data/lib/tinkerforge/bricklet_analog_out_v3.rb +55 -22
  24. data/lib/tinkerforge/bricklet_barometer.rb +108 -58
  25. data/lib/tinkerforge/bricklet_barometer_v2.rb +109 -67
  26. data/lib/tinkerforge/bricklet_can.rb +84 -24
  27. data/lib/tinkerforge/bricklet_can_v2.rb +173 -72
  28. data/lib/tinkerforge/bricklet_co2.rb +36 -25
  29. data/lib/tinkerforge/bricklet_co2_v2.rb +119 -60
  30. data/lib/tinkerforge/bricklet_color.rb +77 -49
  31. data/lib/tinkerforge/bricklet_color_v2.rb +493 -0
  32. data/lib/tinkerforge/bricklet_compass.rb +397 -0
  33. data/lib/tinkerforge/bricklet_current12.rb +61 -40
  34. data/lib/tinkerforge/bricklet_current25.rb +61 -40
  35. data/lib/tinkerforge/bricklet_distance_ir.rb +60 -38
  36. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +85 -45
  37. data/lib/tinkerforge/bricklet_distance_us.rb +43 -30
  38. data/lib/tinkerforge/bricklet_distance_us_v2.rb +335 -0
  39. data/lib/tinkerforge/bricklet_dmx.rb +92 -48
  40. data/lib/tinkerforge/bricklet_dual_button.rb +23 -12
  41. data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -29
  42. data/lib/tinkerforge/bricklet_dual_relay.rb +27 -14
  43. data/lib/tinkerforge/bricklet_dust_detector.rb +43 -30
  44. data/lib/tinkerforge/bricklet_e_paper_296x128.rb +115 -63
  45. data/lib/tinkerforge/bricklet_energy_monitor.rb +416 -0
  46. data/lib/tinkerforge/bricklet_gps.rb +72 -48
  47. data/lib/tinkerforge/bricklet_gps_v2.rb +124 -73
  48. data/lib/tinkerforge/bricklet_hall_effect.rb +43 -28
  49. data/lib/tinkerforge/bricklet_hall_effect_v2.rb +76 -44
  50. data/lib/tinkerforge/bricklet_humidity.rb +54 -38
  51. data/lib/tinkerforge/bricklet_humidity_v2.rb +86 -49
  52. data/lib/tinkerforge/bricklet_imu_v3.rb +784 -0
  53. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +41 -18
  54. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +84 -40
  55. data/lib/tinkerforge/bricklet_industrial_counter.rb +102 -59
  56. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +51 -24
  57. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +79 -40
  58. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -15
  59. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +75 -33
  60. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +43 -29
  61. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +81 -44
  62. data/lib/tinkerforge/bricklet_industrial_dual_ac_relay.rb +325 -0
  63. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +51 -30
  64. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +139 -40
  65. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +63 -28
  66. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -15
  67. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -28
  68. data/lib/tinkerforge/bricklet_io16.rb +57 -32
  69. data/lib/tinkerforge/bricklet_io16_v2.rb +93 -48
  70. data/lib/tinkerforge/bricklet_io4.rb +56 -31
  71. data/lib/tinkerforge/bricklet_io4_v2.rb +109 -57
  72. data/lib/tinkerforge/bricklet_isolator.rb +111 -35
  73. data/lib/tinkerforge/bricklet_joystick.rb +63 -42
  74. data/lib/tinkerforge/bricklet_joystick_v2.rb +71 -35
  75. data/lib/tinkerforge/bricklet_laser_range_finder.rb +87 -59
  76. data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +101 -53
  77. data/lib/tinkerforge/bricklet_lcd_128x64.rb +241 -131
  78. data/lib/tinkerforge/bricklet_lcd_16x2.rb +49 -25
  79. data/lib/tinkerforge/bricklet_lcd_20x4.rb +59 -29
  80. data/lib/tinkerforge/bricklet_led_strip.rb +69 -47
  81. data/lib/tinkerforge/bricklet_led_strip_v2.rb +105 -48
  82. data/lib/tinkerforge/bricklet_line.rb +35 -22
  83. data/lib/tinkerforge/bricklet_linear_poti.rb +53 -35
  84. data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -24
  85. data/lib/tinkerforge/bricklet_load_cell.rb +64 -40
  86. data/lib/tinkerforge/bricklet_load_cell_v2.rb +81 -41
  87. data/lib/tinkerforge/bricklet_moisture.rb +43 -30
  88. data/lib/tinkerforge/bricklet_motion_detector.rb +21 -10
  89. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -29
  90. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -32
  91. data/lib/tinkerforge/bricklet_multi_touch.rb +30 -17
  92. data/lib/tinkerforge/bricklet_multi_touch_v2.rb +371 -0
  93. data/lib/tinkerforge/bricklet_nfc.rb +130 -80
  94. data/lib/tinkerforge/bricklet_nfc_rfid.rb +32 -13
  95. data/lib/tinkerforge/bricklet_oled_128x64.rb +30 -17
  96. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +97 -40
  97. data/lib/tinkerforge/bricklet_oled_64x48.rb +30 -17
  98. data/lib/tinkerforge/bricklet_one_wire.rb +65 -24
  99. data/lib/tinkerforge/bricklet_outdoor_weather.rb +84 -41
  100. data/lib/tinkerforge/bricklet_particulate_matter.rb +85 -37
  101. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -13
  102. data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -19
  103. data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +84 -57
  104. data/lib/tinkerforge/bricklet_ptc.rb +76 -51
  105. data/lib/tinkerforge/bricklet_ptc_v2.rb +96 -54
  106. data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -36
  107. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -47
  108. data/lib/tinkerforge/bricklet_remote_switch.rb +38 -29
  109. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +86 -49
  110. data/lib/tinkerforge/bricklet_rgb_led.rb +17 -8
  111. data/lib/tinkerforge/bricklet_rgb_led_button.rb +61 -30
  112. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +78 -33
  113. data/lib/tinkerforge/bricklet_rgb_led_v2.rb +51 -20
  114. data/lib/tinkerforge/bricklet_rotary_encoder.rb +40 -25
  115. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -27
  116. data/lib/tinkerforge/bricklet_rotary_poti.rb +55 -37
  117. data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +290 -0
  118. data/lib/tinkerforge/bricklet_rs232.rb +89 -28
  119. data/lib/tinkerforge/bricklet_rs232_v2.rb +121 -47
  120. data/lib/tinkerforge/bricklet_rs485.rb +303 -207
  121. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
  122. data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -36
  123. data/lib/tinkerforge/bricklet_solid_state_relay.rb +24 -13
  124. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +58 -25
  125. data/lib/tinkerforge/bricklet_sound_intensity.rb +36 -24
  126. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +77 -41
  127. data/lib/tinkerforge/bricklet_temperature.rb +43 -28
  128. data/lib/tinkerforge/bricklet_temperature_ir.rb +63 -47
  129. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +75 -53
  130. data/lib/tinkerforge/bricklet_temperature_v2.rb +62 -31
  131. data/lib/tinkerforge/bricklet_thermal_imaging.rb +118 -68
  132. data/lib/tinkerforge/bricklet_thermocouple.rb +46 -30
  133. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -30
  134. data/lib/tinkerforge/bricklet_tilt.rb +23 -10
  135. data/lib/tinkerforge/bricklet_uv_light.rb +37 -24
  136. data/lib/tinkerforge/bricklet_uv_light_v2.rb +87 -46
  137. data/lib/tinkerforge/bricklet_voltage.rb +54 -37
  138. data/lib/tinkerforge/bricklet_voltage_current.rb +94 -85
  139. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +103 -77
  140. data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +410 -0
  141. data/lib/tinkerforge/device_display_names.rb +165 -0
  142. data/lib/tinkerforge/ip_connection.rb +155 -33
  143. data/lib/tinkerforge/version.rb +1 -1
  144. metadata +14 -4
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-05-21. #
3
+ # This file was automatically generated on 2020-11-02. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.22 #
5
+ # Ruby Bindings Version 2.1.27 #
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,36 +91,40 @@ 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
- # Sets the period in ms with which the CALLBACK_TEMPERATURE callback is triggered
112
+ # Sets the period with which the CALLBACK_TEMPERATURE callback is triggered
109
113
  # periodically. A value of 0 turns the callback off.
110
114
  #
111
115
  # The CALLBACK_TEMPERATURE callback is only triggered if the temperature has changed
112
116
  # since the last triggering.
113
- #
114
- # The default value is 0.
115
117
  def set_temperature_callback_period(period)
116
- 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, ''
117
121
  end
118
122
 
119
123
  # Returns the period as set by BrickletThermocouple#set_temperature_callback_period.
120
124
  def get_temperature_callback_period
121
- send_request FUNCTION_GET_TEMPERATURE_CALLBACK_PERIOD, [], '', 4, 'L'
125
+ check_validity
126
+
127
+ send_request FUNCTION_GET_TEMPERATURE_CALLBACK_PERIOD, [], '', 12, 'L'
122
128
  end
123
129
 
124
130
  # Sets the thresholds for the CALLBACK_TEMPERATURE_REACHED callback.
@@ -132,18 +138,20 @@ module Tinkerforge
132
138
  # "'i'", "Callback is triggered when the temperature is *inside* the min and max values"
133
139
  # "'<'", "Callback is triggered when the temperature is smaller than the min value (max is ignored)"
134
140
  # "'>'", "Callback is triggered when the temperature is greater than the min value (max is ignored)"
135
- #
136
- # The default value is ('x', 0, 0).
137
141
  def set_temperature_callback_threshold(option, min, max)
138
- 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, ''
139
145
  end
140
146
 
141
147
  # Returns the threshold as set by BrickletThermocouple#set_temperature_callback_threshold.
142
148
  def get_temperature_callback_threshold
143
- 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'
144
152
  end
145
153
 
146
- # Sets the period in ms with which the threshold callback
154
+ # Sets the period with which the threshold callback
147
155
  #
148
156
  # * CALLBACK_TEMPERATURE_REACHED
149
157
  #
@@ -152,15 +160,17 @@ module Tinkerforge
152
160
  # * BrickletThermocouple#set_temperature_callback_threshold
153
161
  #
154
162
  # keeps being reached.
155
- #
156
- # The default value is 100.
157
163
  def set_debounce_period(debounce)
158
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
164
+ check_validity
165
+
166
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
159
167
  end
160
168
 
161
169
  # Returns the debounce period as set by BrickletThermocouple#set_debounce_period.
162
170
  def get_debounce_period
163
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
171
+ check_validity
172
+
173
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
164
174
  end
165
175
 
166
176
  # You can configure averaging size, thermocouple type and frequency
@@ -186,15 +196,17 @@ module Tinkerforge
186
196
  #
187
197
  # * 60Hz: ``time = 82 + (samples - 1) * 16.67``
188
198
  # * 50Hz: ``time = 98 + (samples - 1) * 20``
189
- #
190
- # The default configuration is 16 samples, K type and 50Hz.
191
199
  def set_configuration(averaging, thermocouple_type, filter)
192
- 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, ''
193
203
  end
194
204
 
195
205
  # Returns the configuration as set by BrickletThermocouple#set_configuration.
196
206
  def get_configuration
197
- send_request FUNCTION_GET_CONFIGURATION, [], '', 3, 'C C C'
207
+ check_validity
208
+
209
+ send_request FUNCTION_GET_CONFIGURATION, [], '', 11, 'C C C'
198
210
  end
199
211
 
200
212
  # Returns the current error state. There are two possible errors:
@@ -209,19 +221,23 @@ module Tinkerforge
209
221
  # You can use the CALLBACK_ERROR_STATE callback to automatically get triggered
210
222
  # when the error state changes.
211
223
  def get_error_state
212
- send_request FUNCTION_GET_ERROR_STATE, [], '', 2, '? ?'
224
+ check_validity
225
+
226
+ send_request FUNCTION_GET_ERROR_STATE, [], '', 10, '? ?'
213
227
  end
214
228
 
215
229
  # Returns the UID, the UID where the Bricklet is connected to,
216
230
  # the position, the hardware and firmware version as well as the
217
231
  # device identifier.
218
232
  #
219
- # 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'.
220
236
  #
221
237
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
222
238
  # |device_identifier_constant|
223
239
  def get_identity
224
- 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'
225
241
  end
226
242
 
227
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-05-21. #
3
+ # This file was automatically generated on 2020-11-02. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.22 #
5
+ # Ruby Bindings Version 2.1.27 #
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,10 +128,12 @@ 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
- # The period in ms is the period with which the CALLBACK_TEMPERATURE callback is triggered
136
+ # The period is the period with which the CALLBACK_TEMPERATURE callback is triggered
132
137
  # periodically. A value of 0 turns the callback off.
133
138
  #
134
139
  # If the `value has to change`-parameter is set to true, the callback is only
@@ -153,15 +158,17 @@ module Tinkerforge
153
158
  # "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
154
159
  #
155
160
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
156
- #
157
- # The default value is (0, false, 'x', 0, 0).
158
161
  def set_temperature_callback_configuration(period, value_has_to_change, option, min, max)
159
- 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, ''
160
165
  end
161
166
 
162
167
  # Returns the callback configuration as set by BrickletThermocoupleV2#set_temperature_callback_configuration.
163
168
  def get_temperature_callback_configuration
164
- 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'
165
172
  end
166
173
 
167
174
  # You can configure averaging size, thermocouple type and frequency
@@ -187,15 +194,17 @@ module Tinkerforge
187
194
  #
188
195
  # * 60Hz: ``time = 82 + (samples - 1) * 16.67``
189
196
  # * 50Hz: ``time = 98 + (samples - 1) * 20``
190
- #
191
- # The default configuration is 16 samples, K type and 50Hz.
192
197
  def set_configuration(averaging, thermocouple_type, filter)
193
- 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, ''
194
201
  end
195
202
 
196
203
  # Returns the configuration as set by BrickletThermocoupleV2#set_configuration.
197
204
  def get_configuration
198
- send_request FUNCTION_GET_CONFIGURATION, [], '', 3, 'C C C'
205
+ check_validity
206
+
207
+ send_request FUNCTION_GET_CONFIGURATION, [], '', 11, 'C C C'
199
208
  end
200
209
 
201
210
  # Returns the current error state. There are two possible errors:
@@ -210,7 +219,9 @@ module Tinkerforge
210
219
  # You can use the CALLBACK_ERROR_STATE callback to automatically get triggered
211
220
  # when the error state changes.
212
221
  def get_error_state
213
- send_request FUNCTION_GET_ERROR_STATE, [], '', 2, '? ?'
222
+ check_validity
223
+
224
+ send_request FUNCTION_GET_ERROR_STATE, [], '', 10, '? ?'
214
225
  end
215
226
 
216
227
  # Returns the error count for the communication between Brick and Bricklet.
@@ -225,7 +236,9 @@ module Tinkerforge
225
236
  # The errors counts are for errors that occur on the Bricklet side. All
226
237
  # Bricks have a similar function that returns the errors on the Brick side.
227
238
  def get_spitfp_error_count
228
- 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'
229
242
  end
230
243
 
231
244
  # Sets the bootloader mode and returns the status after the requested
@@ -238,12 +251,16 @@ module Tinkerforge
238
251
  # This function is used by Brick Viewer during flashing. It should not be
239
252
  # necessary to call it in a normal user program.
240
253
  def set_bootloader_mode(mode)
241
- 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'
242
257
  end
243
258
 
244
259
  # Returns the current bootloader mode, see BrickletThermocoupleV2#set_bootloader_mode.
245
260
  def get_bootloader_mode
246
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
261
+ check_validity
262
+
263
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
247
264
  end
248
265
 
249
266
  # Sets the firmware pointer for BrickletThermocoupleV2#write_firmware. The pointer has
@@ -253,7 +270,9 @@ module Tinkerforge
253
270
  # This function is used by Brick Viewer during flashing. It should not be
254
271
  # necessary to call it in a normal user program.
255
272
  def set_write_firmware_pointer(pointer)
256
- 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, ''
257
276
  end
258
277
 
259
278
  # Writes 64 Bytes of firmware at the position as written by
@@ -265,7 +284,9 @@ module Tinkerforge
265
284
  # This function is used by Brick Viewer during flashing. It should not be
266
285
  # necessary to call it in a normal user program.
267
286
  def write_firmware(data)
268
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
287
+ check_validity
288
+
289
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
269
290
  end
270
291
 
271
292
  # Sets the status LED configuration. By default the LED shows
@@ -276,22 +297,28 @@ module Tinkerforge
276
297
  #
277
298
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
278
299
  def set_status_led_config(config)
279
- 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, ''
280
303
  end
281
304
 
282
305
  # Returns the configuration as set by BrickletThermocoupleV2#set_status_led_config
283
306
  def get_status_led_config
284
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
307
+ check_validity
308
+
309
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
285
310
  end
286
311
 
287
- # Returns the temperature in °C as measured inside the microcontroller. The
312
+ # Returns the temperature as measured inside the microcontroller. The
288
313
  # value returned is not the ambient temperature!
289
314
  #
290
315
  # The temperature is only proportional to the real temperature and it has bad
291
316
  # accuracy. Practically it is only useful as an indicator for
292
317
  # temperature changes.
293
318
  def get_chip_temperature
294
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
319
+ check_validity
320
+
321
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
295
322
  end
296
323
 
297
324
  # Calling this function will reset the Bricklet. All configurations
@@ -301,7 +328,9 @@ module Tinkerforge
301
328
  # calling functions on the existing ones will result in
302
329
  # undefined behavior!
303
330
  def reset
304
- send_request FUNCTION_RESET, [], '', 0, ''
331
+ check_validity
332
+
333
+ send_request FUNCTION_RESET, [], '', 8, ''
305
334
  end
306
335
 
307
336
  # Writes a new UID into flash. If you want to set a new UID
@@ -310,25 +339,31 @@ module Tinkerforge
310
339
  #
311
340
  # We recommend that you use Brick Viewer to change the UID.
312
341
  def write_uid(uid)
313
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
342
+ check_validity
343
+
344
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
314
345
  end
315
346
 
316
347
  # Returns the current UID as an integer. Encode as
317
348
  # Base58 to get the usual string version.
318
349
  def read_uid
319
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
350
+ check_validity
351
+
352
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
320
353
  end
321
354
 
322
355
  # Returns the UID, the UID where the Bricklet is connected to,
323
356
  # the position, the hardware and firmware version as well as the
324
357
  # device identifier.
325
358
  #
326
- # 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'.
327
362
  #
328
363
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
329
364
  # |device_identifier_constant|
330
365
  def get_identity
331
- 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'
332
367
  end
333
368
 
334
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-05-21. #
3
+ # This file was automatically generated on 2020-11-02. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.22 #
5
+ # Ruby Bindings Version 2.1.27 #
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>.