tinkerforge 2.1.24 → 2.1.29

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 (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
  # Generates configurable DC voltage between 0V and 12V
14
16
  class BrickletAnalogOutV2 < Device
@@ -24,7 +26,7 @@ module Tinkerforge
24
26
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
25
27
  # the IP Connection <tt>ipcon</tt>.
26
28
  def initialize(uid, ipcon)
27
- super uid, ipcon
29
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
28
30
 
29
31
  @api_version = [2, 0, 0]
30
32
 
@@ -34,33 +36,42 @@ module Tinkerforge
34
36
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
35
37
 
36
38
 
39
+ @ipcon.add_device self
37
40
  end
38
41
 
39
42
  # Sets the voltage.
40
43
  def set_output_voltage(voltage)
41
- send_request FUNCTION_SET_OUTPUT_VOLTAGE, [voltage], 'S', 0, ''
44
+ check_validity
45
+
46
+ send_request FUNCTION_SET_OUTPUT_VOLTAGE, [voltage], 'S', 8, ''
42
47
  end
43
48
 
44
49
  # Returns the voltage as set by BrickletAnalogOutV2#set_output_voltage.
45
50
  def get_output_voltage
46
- send_request FUNCTION_GET_OUTPUT_VOLTAGE, [], '', 2, 'S'
51
+ check_validity
52
+
53
+ send_request FUNCTION_GET_OUTPUT_VOLTAGE, [], '', 10, 'S'
47
54
  end
48
55
 
49
56
  # Returns the input voltage.
50
57
  def get_input_voltage
51
- send_request FUNCTION_GET_INPUT_VOLTAGE, [], '', 2, 'S'
58
+ check_validity
59
+
60
+ send_request FUNCTION_GET_INPUT_VOLTAGE, [], '', 10, 'S'
52
61
  end
53
62
 
54
63
  # Returns the UID, the UID where the Bricklet is connected to,
55
64
  # the position, the hardware and firmware version as well as the
56
65
  # device identifier.
57
66
  #
58
- # The position can be 'a', 'b', 'c' or 'd'.
67
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
68
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
69
+ # position 'z'.
59
70
  #
60
71
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
61
72
  # |device_identifier_constant|
62
73
  def get_identity
63
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
74
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
64
75
  end
65
76
 
66
77
  end
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-11-25. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.29 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # Generates configurable DC voltage between 0V and 12V
14
16
  class BrickletAnalogOutV3 < Device
@@ -50,7 +52,7 @@ module Tinkerforge
50
52
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
51
53
  # the IP Connection <tt>ipcon</tt>.
52
54
  def initialize(uid, ipcon)
53
- super uid, ipcon
55
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
54
56
 
55
57
  @api_version = [2, 0, 0]
56
58
 
@@ -71,21 +73,28 @@ module Tinkerforge
71
73
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
72
74
 
73
75
 
76
+ @ipcon.add_device self
74
77
  end
75
78
 
76
79
  # Sets the voltage.
77
80
  def set_output_voltage(voltage)
78
- send_request FUNCTION_SET_OUTPUT_VOLTAGE, [voltage], 'S', 0, ''
81
+ check_validity
82
+
83
+ send_request FUNCTION_SET_OUTPUT_VOLTAGE, [voltage], 'S', 8, ''
79
84
  end
80
85
 
81
86
  # Returns the voltage as set by BrickletAnalogOutV3#set_output_voltage.
82
87
  def get_output_voltage
83
- send_request FUNCTION_GET_OUTPUT_VOLTAGE, [], '', 2, 'S'
88
+ check_validity
89
+
90
+ send_request FUNCTION_GET_OUTPUT_VOLTAGE, [], '', 10, 'S'
84
91
  end
85
92
 
86
93
  # Returns the input voltage.
87
94
  def get_input_voltage
88
- send_request FUNCTION_GET_INPUT_VOLTAGE, [], '', 2, 'S'
95
+ check_validity
96
+
97
+ send_request FUNCTION_GET_INPUT_VOLTAGE, [], '', 10, 'S'
89
98
  end
90
99
 
91
100
  # Returns the error count for the communication between Brick and Bricklet.
@@ -100,7 +109,9 @@ module Tinkerforge
100
109
  # The errors counts are for errors that occur on the Bricklet side. All
101
110
  # Bricks have a similar function that returns the errors on the Brick side.
102
111
  def get_spitfp_error_count
103
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
112
+ check_validity
113
+
114
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
104
115
  end
105
116
 
106
117
  # Sets the bootloader mode and returns the status after the requested
@@ -113,12 +124,16 @@ module Tinkerforge
113
124
  # This function is used by Brick Viewer during flashing. It should not be
114
125
  # necessary to call it in a normal user program.
115
126
  def set_bootloader_mode(mode)
116
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
127
+ check_validity
128
+
129
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
117
130
  end
118
131
 
119
132
  # Returns the current bootloader mode, see BrickletAnalogOutV3#set_bootloader_mode.
120
133
  def get_bootloader_mode
121
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
134
+ check_validity
135
+
136
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
122
137
  end
123
138
 
124
139
  # Sets the firmware pointer for BrickletAnalogOutV3#write_firmware. The pointer has
@@ -128,7 +143,9 @@ module Tinkerforge
128
143
  # This function is used by Brick Viewer during flashing. It should not be
129
144
  # necessary to call it in a normal user program.
130
145
  def set_write_firmware_pointer(pointer)
131
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
146
+ check_validity
147
+
148
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
132
149
  end
133
150
 
134
151
  # Writes 64 Bytes of firmware at the position as written by
@@ -140,7 +157,9 @@ module Tinkerforge
140
157
  # This function is used by Brick Viewer during flashing. It should not be
141
158
  # necessary to call it in a normal user program.
142
159
  def write_firmware(data)
143
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
160
+ check_validity
161
+
162
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
144
163
  end
145
164
 
146
165
  # Sets the status LED configuration. By default the LED shows
@@ -151,22 +170,28 @@ module Tinkerforge
151
170
  #
152
171
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
153
172
  def set_status_led_config(config)
154
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
173
+ check_validity
174
+
175
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
155
176
  end
156
177
 
157
178
  # Returns the configuration as set by BrickletAnalogOutV3#set_status_led_config
158
179
  def get_status_led_config
159
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
180
+ check_validity
181
+
182
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
160
183
  end
161
184
 
162
- # Returns the temperature in °C as measured inside the microcontroller. The
185
+ # Returns the temperature as measured inside the microcontroller. The
163
186
  # value returned is not the ambient temperature!
164
187
  #
165
188
  # The temperature is only proportional to the real temperature and it has bad
166
189
  # accuracy. Practically it is only useful as an indicator for
167
190
  # temperature changes.
168
191
  def get_chip_temperature
169
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
192
+ check_validity
193
+
194
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
170
195
  end
171
196
 
172
197
  # Calling this function will reset the Bricklet. All configurations
@@ -176,7 +201,9 @@ module Tinkerforge
176
201
  # calling functions on the existing ones will result in
177
202
  # undefined behavior!
178
203
  def reset
179
- send_request FUNCTION_RESET, [], '', 0, ''
204
+ check_validity
205
+
206
+ send_request FUNCTION_RESET, [], '', 8, ''
180
207
  end
181
208
 
182
209
  # Writes a new UID into flash. If you want to set a new UID
@@ -185,25 +212,31 @@ module Tinkerforge
185
212
  #
186
213
  # We recommend that you use Brick Viewer to change the UID.
187
214
  def write_uid(uid)
188
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
215
+ check_validity
216
+
217
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
189
218
  end
190
219
 
191
220
  # Returns the current UID as an integer. Encode as
192
221
  # Base58 to get the usual string version.
193
222
  def read_uid
194
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
223
+ check_validity
224
+
225
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
195
226
  end
196
227
 
197
228
  # Returns the UID, the UID where the Bricklet is connected to,
198
229
  # the position, the hardware and firmware version as well as the
199
230
  # device identifier.
200
231
  #
201
- # The position can be 'a', 'b', 'c' or 'd'.
232
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
233
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
234
+ # position 'z'.
202
235
  #
203
236
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
204
237
  # |device_identifier_constant|
205
238
  def get_identity
206
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
239
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
207
240
  end
208
241
 
209
242
  end
@@ -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 air pressure and altitude changes
14
16
  class BrickletBarometer < Device
@@ -64,6 +66,8 @@ module Tinkerforge
64
66
  FUNCTION_GET_REFERENCE_AIR_PRESSURE = 19 # :nodoc:
65
67
  FUNCTION_SET_AVERAGING = 20 # :nodoc:
66
68
  FUNCTION_GET_AVERAGING = 21 # :nodoc:
69
+ FUNCTION_SET_I2C_MODE = 22 # :nodoc:
70
+ FUNCTION_GET_I2C_MODE = 23 # :nodoc:
67
71
  FUNCTION_GET_IDENTITY = 255 # :nodoc:
68
72
 
69
73
  THRESHOLD_OPTION_OFF = 'x' # :nodoc:
@@ -71,13 +75,15 @@ module Tinkerforge
71
75
  THRESHOLD_OPTION_INSIDE = 'i' # :nodoc:
72
76
  THRESHOLD_OPTION_SMALLER = '<' # :nodoc:
73
77
  THRESHOLD_OPTION_GREATER = '>' # :nodoc:
78
+ I2C_MODE_FAST = 0 # :nodoc:
79
+ I2C_MODE_SLOW = 1 # :nodoc:
74
80
 
75
81
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
76
82
  # the IP Connection <tt>ipcon</tt>.
77
83
  def initialize(uid, ipcon)
78
- super uid, ipcon
84
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
79
85
 
80
- @api_version = [2, 0, 1]
86
+ @api_version = [2, 0, 2]
81
87
 
82
88
  @response_expected[FUNCTION_GET_AIR_PRESSURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
83
89
  @response_expected[FUNCTION_GET_ALTITUDE] = RESPONSE_EXPECTED_ALWAYS_TRUE
@@ -96,13 +102,16 @@ module Tinkerforge
96
102
  @response_expected[FUNCTION_GET_REFERENCE_AIR_PRESSURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
97
103
  @response_expected[FUNCTION_SET_AVERAGING] = RESPONSE_EXPECTED_FALSE
98
104
  @response_expected[FUNCTION_GET_AVERAGING] = RESPONSE_EXPECTED_ALWAYS_TRUE
105
+ @response_expected[FUNCTION_SET_I2C_MODE] = RESPONSE_EXPECTED_FALSE
106
+ @response_expected[FUNCTION_GET_I2C_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
99
107
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
100
108
 
101
- @callback_formats[CALLBACK_AIR_PRESSURE] = 'l'
102
- @callback_formats[CALLBACK_ALTITUDE] = 'l'
103
- @callback_formats[CALLBACK_AIR_PRESSURE_REACHED] = 'l'
104
- @callback_formats[CALLBACK_ALTITUDE_REACHED] = 'l'
109
+ @callback_formats[CALLBACK_AIR_PRESSURE] = [12, 'l']
110
+ @callback_formats[CALLBACK_ALTITUDE] = [12, 'l']
111
+ @callback_formats[CALLBACK_AIR_PRESSURE_REACHED] = [12, 'l']
112
+ @callback_formats[CALLBACK_ALTITUDE_REACHED] = [12, 'l']
105
113
 
114
+ @ipcon.add_device self
106
115
  end
107
116
 
108
117
  # Returns the air pressure of the air pressure sensor.
@@ -111,7 +120,9 @@ module Tinkerforge
111
120
  # CALLBACK_AIR_PRESSURE callback and set the period with
112
121
  # BrickletBarometer#set_air_pressure_callback_period.
113
122
  def get_air_pressure
114
- send_request FUNCTION_GET_AIR_PRESSURE, [], '', 4, 'l'
123
+ check_validity
124
+
125
+ send_request FUNCTION_GET_AIR_PRESSURE, [], '', 12, 'l'
115
126
  end
116
127
 
117
128
  # Returns the relative altitude of the air pressure sensor. The value is
@@ -122,7 +133,9 @@ module Tinkerforge
122
133
  # CALLBACK_ALTITUDE callback and set the period with
123
134
  # BrickletBarometer#set_altitude_callback_period.
124
135
  def get_altitude
125
- send_request FUNCTION_GET_ALTITUDE, [], '', 4, 'l'
136
+ check_validity
137
+
138
+ send_request FUNCTION_GET_ALTITUDE, [], '', 12, 'l'
126
139
  end
127
140
 
128
141
  # Sets the period with which the CALLBACK_AIR_PRESSURE callback is triggered
@@ -131,12 +144,16 @@ module Tinkerforge
131
144
  # The CALLBACK_AIR_PRESSURE callback is only triggered if the air pressure has
132
145
  # changed since the last triggering.
133
146
  def set_air_pressure_callback_period(period)
134
- send_request FUNCTION_SET_AIR_PRESSURE_CALLBACK_PERIOD, [period], 'L', 0, ''
147
+ check_validity
148
+
149
+ send_request FUNCTION_SET_AIR_PRESSURE_CALLBACK_PERIOD, [period], 'L', 8, ''
135
150
  end
136
151
 
137
152
  # Returns the period as set by BrickletBarometer#set_air_pressure_callback_period.
138
153
  def get_air_pressure_callback_period
139
- send_request FUNCTION_GET_AIR_PRESSURE_CALLBACK_PERIOD, [], '', 4, 'L'
154
+ check_validity
155
+
156
+ send_request FUNCTION_GET_AIR_PRESSURE_CALLBACK_PERIOD, [], '', 12, 'L'
140
157
  end
141
158
 
142
159
  # Sets the period with which the CALLBACK_ALTITUDE callback is triggered
@@ -145,12 +162,16 @@ module Tinkerforge
145
162
  # The CALLBACK_ALTITUDE callback is only triggered if the altitude has changed since
146
163
  # the last triggering.
147
164
  def set_altitude_callback_period(period)
148
- send_request FUNCTION_SET_ALTITUDE_CALLBACK_PERIOD, [period], 'L', 0, ''
165
+ check_validity
166
+
167
+ send_request FUNCTION_SET_ALTITUDE_CALLBACK_PERIOD, [period], 'L', 8, ''
149
168
  end
150
169
 
151
170
  # Returns the period as set by BrickletBarometer#set_altitude_callback_period.
152
171
  def get_altitude_callback_period
153
- send_request FUNCTION_GET_ALTITUDE_CALLBACK_PERIOD, [], '', 4, 'L'
172
+ check_validity
173
+
174
+ send_request FUNCTION_GET_ALTITUDE_CALLBACK_PERIOD, [], '', 12, 'L'
154
175
  end
155
176
 
156
177
  # Sets the thresholds for the CALLBACK_AIR_PRESSURE_REACHED callback.
@@ -165,12 +186,16 @@ module Tinkerforge
165
186
  # "'<'", "Callback is triggered when the air pressure is smaller than the min value (max is ignored)"
166
187
  # "'>'", "Callback is triggered when the air pressure is greater than the min value (max is ignored)"
167
188
  def set_air_pressure_callback_threshold(option, min, max)
168
- send_request FUNCTION_SET_AIR_PRESSURE_CALLBACK_THRESHOLD, [option, min, max], 'k l l', 0, ''
189
+ check_validity
190
+
191
+ send_request FUNCTION_SET_AIR_PRESSURE_CALLBACK_THRESHOLD, [option, min, max], 'k l l', 8, ''
169
192
  end
170
193
 
171
194
  # Returns the threshold as set by BrickletBarometer#set_air_pressure_callback_threshold.
172
195
  def get_air_pressure_callback_threshold
173
- send_request FUNCTION_GET_AIR_PRESSURE_CALLBACK_THRESHOLD, [], '', 9, 'k l l'
196
+ check_validity
197
+
198
+ send_request FUNCTION_GET_AIR_PRESSURE_CALLBACK_THRESHOLD, [], '', 17, 'k l l'
174
199
  end
175
200
 
176
201
  # Sets the thresholds for the CALLBACK_ALTITUDE_REACHED callback.
@@ -185,12 +210,16 @@ module Tinkerforge
185
210
  # "'<'", "Callback is triggered when the altitude is smaller than the min value (max is ignored)"
186
211
  # "'>'", "Callback is triggered when the altitude is greater than the min value (max is ignored)"
187
212
  def set_altitude_callback_threshold(option, min, max)
188
- send_request FUNCTION_SET_ALTITUDE_CALLBACK_THRESHOLD, [option, min, max], 'k l l', 0, ''
213
+ check_validity
214
+
215
+ send_request FUNCTION_SET_ALTITUDE_CALLBACK_THRESHOLD, [option, min, max], 'k l l', 8, ''
189
216
  end
190
217
 
191
218
  # Returns the threshold as set by BrickletBarometer#set_altitude_callback_threshold.
192
219
  def get_altitude_callback_threshold
193
- send_request FUNCTION_GET_ALTITUDE_CALLBACK_THRESHOLD, [], '', 9, 'k l l'
220
+ check_validity
221
+
222
+ send_request FUNCTION_GET_ALTITUDE_CALLBACK_THRESHOLD, [], '', 17, 'k l l'
194
223
  end
195
224
 
196
225
  # Sets the period with which the threshold callbacks
@@ -205,12 +234,16 @@ module Tinkerforge
205
234
  #
206
235
  # keep being reached.
207
236
  def set_debounce_period(debounce)
208
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
237
+ check_validity
238
+
239
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
209
240
  end
210
241
 
211
242
  # Returns the debounce period as set by BrickletBarometer#set_debounce_period.
212
243
  def get_debounce_period
213
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
244
+ check_validity
245
+
246
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
214
247
  end
215
248
 
216
249
  # Sets the reference air pressure for the altitude calculation.
@@ -223,7 +256,9 @@ module Tinkerforge
223
256
  # `QFE <https://en.wikipedia.org/wiki/Mean_sea_level_pressure#Mean_sea_level_pressure>`__
224
257
  # used in aviation.
225
258
  def set_reference_air_pressure(air_pressure)
226
- send_request FUNCTION_SET_REFERENCE_AIR_PRESSURE, [air_pressure], 'l', 0, ''
259
+ check_validity
260
+
261
+ send_request FUNCTION_SET_REFERENCE_AIR_PRESSURE, [air_pressure], 'l', 8, ''
227
262
  end
228
263
 
229
264
  # Returns the temperature of the air pressure sensor.
@@ -232,12 +267,16 @@ module Tinkerforge
232
267
  # pressure measurement. It is not as accurate as the temperature measured by the
233
268
  # :ref:`temperature_bricklet` or the :ref:`temperature_ir_bricklet`.
234
269
  def get_chip_temperature
235
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
270
+ check_validity
271
+
272
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
236
273
  end
237
274
 
238
275
  # Returns the reference air pressure as set by BrickletBarometer#set_reference_air_pressure.
239
276
  def get_reference_air_pressure
240
- send_request FUNCTION_GET_REFERENCE_AIR_PRESSURE, [], '', 4, 'l'
277
+ check_validity
278
+
279
+ send_request FUNCTION_GET_REFERENCE_AIR_PRESSURE, [], '', 12, 'l'
241
280
  end
242
281
 
243
282
  # Sets the different averaging parameters. It is possible to set
@@ -255,26 +294,60 @@ module Tinkerforge
255
294
  #
256
295
  # .. versionadded:: 2.0.1$nbsp;(Plugin)
257
296
  def set_averaging(moving_average_pressure, average_pressure, average_temperature)
258
- send_request FUNCTION_SET_AVERAGING, [moving_average_pressure, average_pressure, average_temperature], 'C C C', 0, ''
297
+ check_validity
298
+
299
+ send_request FUNCTION_SET_AVERAGING, [moving_average_pressure, average_pressure, average_temperature], 'C C C', 8, ''
259
300
  end
260
301
 
261
302
  # Returns the averaging configuration as set by BrickletBarometer#set_averaging.
262
303
  #
263
304
  # .. versionadded:: 2.0.1$nbsp;(Plugin)
264
305
  def get_averaging
265
- send_request FUNCTION_GET_AVERAGING, [], '', 3, 'C C C'
306
+ check_validity
307
+
308
+ send_request FUNCTION_GET_AVERAGING, [], '', 11, 'C C C'
309
+ end
310
+
311
+ # Sets the I2C mode. Possible modes are:
312
+ #
313
+ # * 0: Fast (400kHz)
314
+ # * 1: Slow (100kHz)
315
+ #
316
+ # If you have problems with obvious outliers in the
317
+ # Barometer Bricklet measurements, they may be caused by EMI issues.
318
+ # In this case it may be helpful to lower the I2C speed.
319
+ #
320
+ # It is however not recommended to lower the I2C speed in applications where
321
+ # a high throughput needs to be achieved.
322
+ #
323
+ # .. versionadded:: 2.0.3$nbsp;(Plugin)
324
+ def set_i2c_mode(mode)
325
+ check_validity
326
+
327
+ send_request FUNCTION_SET_I2C_MODE, [mode], 'C', 8, ''
328
+ end
329
+
330
+ # Returns the I2C mode as set by BrickletBarometer#set_i2c_mode.
331
+ #
332
+ # .. versionadded:: 2.0.3$nbsp;(Plugin)
333
+ def get_i2c_mode
334
+ check_validity
335
+
336
+ send_request FUNCTION_GET_I2C_MODE, [], '', 9, 'C'
266
337
  end
267
338
 
268
339
  # Returns the UID, the UID where the Bricklet is connected to,
269
340
  # the position, the hardware and firmware version as well as the
270
341
  # device identifier.
271
342
  #
272
- # The position can be 'a', 'b', 'c' or 'd'.
343
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
344
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
345
+ # position 'z'.
273
346
  #
274
347
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
275
348
  # |device_identifier_constant|
276
349
  def get_identity
277
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
350
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
278
351
  end
279
352
 
280
353
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.