tinkerforge 2.1.24 → 2.1.25

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tinkerforge/brick_dc.rb +155 -74
  3. data/lib/tinkerforge/brick_hat.rb +70 -30
  4. data/lib/tinkerforge/brick_hat_zero.rb +56 -22
  5. data/lib/tinkerforge/brick_imu.rb +184 -77
  6. data/lib/tinkerforge/brick_imu_v2.rb +208 -105
  7. data/lib/tinkerforge/brick_master.rb +484 -182
  8. data/lib/tinkerforge/brick_red.rb +197 -74
  9. data/lib/tinkerforge/brick_servo.rb +185 -101
  10. data/lib/tinkerforge/brick_silent_stepper.rb +246 -166
  11. data/lib/tinkerforge/brick_stepper.rb +210 -98
  12. data/lib/tinkerforge/bricklet_accelerometer.rb +58 -23
  13. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +105 -54
  14. data/lib/tinkerforge/bricklet_air_quality.rb +117 -59
  15. data/lib/tinkerforge/bricklet_ambient_light.rb +51 -21
  16. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +40 -22
  17. data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -25
  18. data/lib/tinkerforge/bricklet_analog_in.rb +63 -25
  19. data/lib/tinkerforge/bricklet_analog_in_v2.rb +57 -23
  20. data/lib/tinkerforge/bricklet_analog_in_v3.rb +67 -25
  21. data/lib/tinkerforge/bricklet_analog_out.rb +23 -9
  22. data/lib/tinkerforge/bricklet_analog_out_v2.rb +20 -8
  23. data/lib/tinkerforge/bricklet_analog_out_v3.rb +54 -20
  24. data/lib/tinkerforge/bricklet_barometer.rb +66 -26
  25. data/lib/tinkerforge/bricklet_barometer_v2.rb +99 -37
  26. data/lib/tinkerforge/bricklet_can.rb +83 -18
  27. data/lib/tinkerforge/bricklet_can_v2.rb +172 -38
  28. data/lib/tinkerforge/bricklet_co2.rb +34 -14
  29. data/lib/tinkerforge/bricklet_co2_v2.rb +97 -37
  30. data/lib/tinkerforge/bricklet_color.rb +69 -27
  31. data/lib/tinkerforge/bricklet_color_v2.rb +87 -33
  32. data/lib/tinkerforge/bricklet_compass.rb +78 -30
  33. data/lib/tinkerforge/bricklet_current12.rb +58 -24
  34. data/lib/tinkerforge/bricklet_current25.rb +58 -24
  35. data/lib/tinkerforge/bricklet_distance_ir.rb +57 -23
  36. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +83 -31
  37. data/lib/tinkerforge/bricklet_distance_us.rb +40 -16
  38. data/lib/tinkerforge/bricklet_distance_us_v2.rb +67 -25
  39. data/lib/tinkerforge/bricklet_dmx.rb +88 -34
  40. data/lib/tinkerforge/bricklet_dual_button.rb +24 -10
  41. data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -24
  42. data/lib/tinkerforge/bricklet_dual_relay.rb +27 -11
  43. data/lib/tinkerforge/bricklet_dust_detector.rb +40 -16
  44. data/lib/tinkerforge/bricklet_e_paper_296x128.rb +88 -32
  45. data/lib/tinkerforge/bricklet_energy_monitor.rb +73 -27
  46. data/lib/tinkerforge/bricklet_gps.rb +64 -26
  47. data/lib/tinkerforge/bricklet_gps_v2.rb +117 -47
  48. data/lib/tinkerforge/bricklet_hall_effect.rb +43 -23
  49. data/lib/tinkerforge/bricklet_hall_effect_v2.rb +71 -27
  50. data/lib/tinkerforge/bricklet_humidity.rb +51 -21
  51. data/lib/tinkerforge/bricklet_humidity_v2.rb +83 -31
  52. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +38 -14
  53. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +81 -29
  54. data/lib/tinkerforge/bricklet_industrial_counter.rb +101 -39
  55. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +45 -17
  56. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +77 -29
  57. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -14
  58. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +73 -27
  59. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +40 -16
  60. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +79 -29
  61. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +49 -19
  62. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +82 -30
  63. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +61 -23
  64. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -14
  65. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -25
  66. data/lib/tinkerforge/bricklet_io16.rb +55 -21
  67. data/lib/tinkerforge/bricklet_io16_v2.rb +90 -34
  68. data/lib/tinkerforge/bricklet_io4.rb +55 -23
  69. data/lib/tinkerforge/bricklet_io4_v2.rb +96 -36
  70. data/lib/tinkerforge/bricklet_isolator.rb +72 -28
  71. data/lib/tinkerforge/bricklet_joystick.rb +59 -25
  72. data/lib/tinkerforge/bricklet_joystick_v2.rb +68 -26
  73. data/lib/tinkerforge/bricklet_laser_range_finder.rb +82 -32
  74. data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +96 -36
  75. data/lib/tinkerforge/bricklet_lcd_128x64.rb +192 -70
  76. data/lib/tinkerforge/bricklet_lcd_16x2.rb +45 -18
  77. data/lib/tinkerforge/bricklet_lcd_20x4.rb +58 -23
  78. data/lib/tinkerforge/bricklet_led_strip.rb +60 -22
  79. data/lib/tinkerforge/bricklet_led_strip_v2.rb +91 -46
  80. data/lib/tinkerforge/bricklet_line.rb +34 -14
  81. data/lib/tinkerforge/bricklet_linear_poti.rb +51 -21
  82. data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -21
  83. data/lib/tinkerforge/bricklet_load_cell.rb +61 -23
  84. data/lib/tinkerforge/bricklet_load_cell_v2.rb +80 -30
  85. data/lib/tinkerforge/bricklet_moisture.rb +40 -16
  86. data/lib/tinkerforge/bricklet_motion_detector.rb +22 -10
  87. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -24
  88. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -27
  89. data/lib/tinkerforge/bricklet_multi_touch.rb +31 -13
  90. data/lib/tinkerforge/bricklet_multi_touch_v2.rb +76 -28
  91. data/lib/tinkerforge/bricklet_nfc.rb +123 -58
  92. data/lib/tinkerforge/bricklet_nfc_rfid.rb +33 -13
  93. data/lib/tinkerforge/bricklet_oled_128x64.rb +29 -11
  94. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +66 -24
  95. data/lib/tinkerforge/bricklet_oled_64x48.rb +29 -11
  96. data/lib/tinkerforge/bricklet_one_wire.rb +66 -24
  97. data/lib/tinkerforge/bricklet_outdoor_weather.rb +71 -27
  98. data/lib/tinkerforge/bricklet_particulate_matter.rb +75 -30
  99. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -9
  100. data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -10
  101. data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +80 -42
  102. data/lib/tinkerforge/bricklet_ptc.rb +74 -42
  103. data/lib/tinkerforge/bricklet_ptc_v2.rb +95 -48
  104. data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -33
  105. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -44
  106. data/lib/tinkerforge/bricklet_remote_switch.rb +39 -29
  107. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +87 -49
  108. data/lib/tinkerforge/bricklet_rgb_led.rb +18 -8
  109. data/lib/tinkerforge/bricklet_rgb_led_button.rb +62 -30
  110. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +79 -33
  111. data/lib/tinkerforge/bricklet_rgb_led_v2.rb +52 -20
  112. data/lib/tinkerforge/bricklet_rotary_encoder.rb +39 -19
  113. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -24
  114. data/lib/tinkerforge/bricklet_rotary_poti.rb +53 -28
  115. data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +57 -23
  116. data/lib/tinkerforge/bricklet_rs232.rb +90 -28
  117. data/lib/tinkerforge/bricklet_rs232_v2.rb +118 -44
  118. data/lib/tinkerforge/bricklet_rs485.rb +223 -95
  119. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +25 -14
  120. data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -35
  121. data/lib/tinkerforge/bricklet_solid_state_relay.rb +25 -13
  122. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +59 -25
  123. data/lib/tinkerforge/bricklet_sound_intensity.rb +35 -18
  124. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +72 -31
  125. data/lib/tinkerforge/bricklet_temperature.rb +40 -16
  126. data/lib/tinkerforge/bricklet_temperature_ir.rb +57 -23
  127. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +71 -27
  128. data/lib/tinkerforge/bricklet_temperature_v2.rb +61 -25
  129. data/lib/tinkerforge/bricklet_thermal_imaging.rb +105 -44
  130. data/lib/tinkerforge/bricklet_thermocouple.rb +45 -24
  131. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -27
  132. data/lib/tinkerforge/bricklet_tilt.rb +24 -10
  133. data/lib/tinkerforge/bricklet_uv_light.rb +36 -18
  134. data/lib/tinkerforge/bricklet_uv_light_v2.rb +85 -37
  135. data/lib/tinkerforge/bricklet_voltage.rb +52 -28
  136. data/lib/tinkerforge/bricklet_voltage_current.rb +91 -73
  137. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +90 -68
  138. data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +80 -30
  139. data/lib/tinkerforge/device_display_names.rb +163 -0
  140. data/lib/tinkerforge/ip_connection.rb +151 -32
  141. data/lib/tinkerforge/version.rb +1 -1
  142. metadata +3 -2
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-11-25. #
3
+ # This file was automatically generated on 2020-04-07. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.25 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # 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,43 @@ 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
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
69
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
70
+ # position 'z'.
59
71
  #
60
72
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
61
73
  # |device_identifier_constant|
62
74
  def get_identity
63
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
75
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
64
76
  end
65
77
 
66
78
  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 2020-04-07. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.25 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # Generates configurable DC voltage between 0V and 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,32 @@ 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
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
234
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
235
+ # position 'z'.
202
236
  #
203
237
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
204
238
  # |device_identifier_constant|
205
239
  def get_identity
206
- 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'
207
241
  end
208
242
 
209
243
  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 2020-04-07. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.25 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # Measures air pressure and altitude changes
14
16
  class BrickletBarometer < Device
@@ -75,7 +77,7 @@ module Tinkerforge
75
77
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
76
78
  # the IP Connection <tt>ipcon</tt>.
77
79
  def initialize(uid, ipcon)
78
- super uid, ipcon
80
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
79
81
 
80
82
  @api_version = [2, 0, 1]
81
83
 
@@ -98,11 +100,12 @@ module Tinkerforge
98
100
  @response_expected[FUNCTION_GET_AVERAGING] = RESPONSE_EXPECTED_ALWAYS_TRUE
99
101
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
100
102
 
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'
103
+ @callback_formats[CALLBACK_AIR_PRESSURE] = [12, 'l']
104
+ @callback_formats[CALLBACK_ALTITUDE] = [12, 'l']
105
+ @callback_formats[CALLBACK_AIR_PRESSURE_REACHED] = [12, 'l']
106
+ @callback_formats[CALLBACK_ALTITUDE_REACHED] = [12, 'l']
105
107
 
108
+ @ipcon.add_device self
106
109
  end
107
110
 
108
111
  # Returns the air pressure of the air pressure sensor.
@@ -111,7 +114,9 @@ module Tinkerforge
111
114
  # CALLBACK_AIR_PRESSURE callback and set the period with
112
115
  # BrickletBarometer#set_air_pressure_callback_period.
113
116
  def get_air_pressure
114
- send_request FUNCTION_GET_AIR_PRESSURE, [], '', 4, 'l'
117
+ check_validity
118
+
119
+ send_request FUNCTION_GET_AIR_PRESSURE, [], '', 12, 'l'
115
120
  end
116
121
 
117
122
  # Returns the relative altitude of the air pressure sensor. The value is
@@ -122,7 +127,9 @@ module Tinkerforge
122
127
  # CALLBACK_ALTITUDE callback and set the period with
123
128
  # BrickletBarometer#set_altitude_callback_period.
124
129
  def get_altitude
125
- send_request FUNCTION_GET_ALTITUDE, [], '', 4, 'l'
130
+ check_validity
131
+
132
+ send_request FUNCTION_GET_ALTITUDE, [], '', 12, 'l'
126
133
  end
127
134
 
128
135
  # Sets the period with which the CALLBACK_AIR_PRESSURE callback is triggered
@@ -131,12 +138,16 @@ module Tinkerforge
131
138
  # The CALLBACK_AIR_PRESSURE callback is only triggered if the air pressure has
132
139
  # changed since the last triggering.
133
140
  def set_air_pressure_callback_period(period)
134
- send_request FUNCTION_SET_AIR_PRESSURE_CALLBACK_PERIOD, [period], 'L', 0, ''
141
+ check_validity
142
+
143
+ send_request FUNCTION_SET_AIR_PRESSURE_CALLBACK_PERIOD, [period], 'L', 8, ''
135
144
  end
136
145
 
137
146
  # Returns the period as set by BrickletBarometer#set_air_pressure_callback_period.
138
147
  def get_air_pressure_callback_period
139
- send_request FUNCTION_GET_AIR_PRESSURE_CALLBACK_PERIOD, [], '', 4, 'L'
148
+ check_validity
149
+
150
+ send_request FUNCTION_GET_AIR_PRESSURE_CALLBACK_PERIOD, [], '', 12, 'L'
140
151
  end
141
152
 
142
153
  # Sets the period with which the CALLBACK_ALTITUDE callback is triggered
@@ -145,12 +156,16 @@ module Tinkerforge
145
156
  # The CALLBACK_ALTITUDE callback is only triggered if the altitude has changed since
146
157
  # the last triggering.
147
158
  def set_altitude_callback_period(period)
148
- send_request FUNCTION_SET_ALTITUDE_CALLBACK_PERIOD, [period], 'L', 0, ''
159
+ check_validity
160
+
161
+ send_request FUNCTION_SET_ALTITUDE_CALLBACK_PERIOD, [period], 'L', 8, ''
149
162
  end
150
163
 
151
164
  # Returns the period as set by BrickletBarometer#set_altitude_callback_period.
152
165
  def get_altitude_callback_period
153
- send_request FUNCTION_GET_ALTITUDE_CALLBACK_PERIOD, [], '', 4, 'L'
166
+ check_validity
167
+
168
+ send_request FUNCTION_GET_ALTITUDE_CALLBACK_PERIOD, [], '', 12, 'L'
154
169
  end
155
170
 
156
171
  # Sets the thresholds for the CALLBACK_AIR_PRESSURE_REACHED callback.
@@ -165,12 +180,16 @@ module Tinkerforge
165
180
  # "'<'", "Callback is triggered when the air pressure is smaller than the min value (max is ignored)"
166
181
  # "'>'", "Callback is triggered when the air pressure is greater than the min value (max is ignored)"
167
182
  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, ''
183
+ check_validity
184
+
185
+ send_request FUNCTION_SET_AIR_PRESSURE_CALLBACK_THRESHOLD, [option, min, max], 'k l l', 8, ''
169
186
  end
170
187
 
171
188
  # Returns the threshold as set by BrickletBarometer#set_air_pressure_callback_threshold.
172
189
  def get_air_pressure_callback_threshold
173
- send_request FUNCTION_GET_AIR_PRESSURE_CALLBACK_THRESHOLD, [], '', 9, 'k l l'
190
+ check_validity
191
+
192
+ send_request FUNCTION_GET_AIR_PRESSURE_CALLBACK_THRESHOLD, [], '', 17, 'k l l'
174
193
  end
175
194
 
176
195
  # Sets the thresholds for the CALLBACK_ALTITUDE_REACHED callback.
@@ -185,12 +204,16 @@ module Tinkerforge
185
204
  # "'<'", "Callback is triggered when the altitude is smaller than the min value (max is ignored)"
186
205
  # "'>'", "Callback is triggered when the altitude is greater than the min value (max is ignored)"
187
206
  def set_altitude_callback_threshold(option, min, max)
188
- send_request FUNCTION_SET_ALTITUDE_CALLBACK_THRESHOLD, [option, min, max], 'k l l', 0, ''
207
+ check_validity
208
+
209
+ send_request FUNCTION_SET_ALTITUDE_CALLBACK_THRESHOLD, [option, min, max], 'k l l', 8, ''
189
210
  end
190
211
 
191
212
  # Returns the threshold as set by BrickletBarometer#set_altitude_callback_threshold.
192
213
  def get_altitude_callback_threshold
193
- send_request FUNCTION_GET_ALTITUDE_CALLBACK_THRESHOLD, [], '', 9, 'k l l'
214
+ check_validity
215
+
216
+ send_request FUNCTION_GET_ALTITUDE_CALLBACK_THRESHOLD, [], '', 17, 'k l l'
194
217
  end
195
218
 
196
219
  # Sets the period with which the threshold callbacks
@@ -205,12 +228,16 @@ module Tinkerforge
205
228
  #
206
229
  # keep being reached.
207
230
  def set_debounce_period(debounce)
208
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
231
+ check_validity
232
+
233
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
209
234
  end
210
235
 
211
236
  # Returns the debounce period as set by BrickletBarometer#set_debounce_period.
212
237
  def get_debounce_period
213
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
238
+ check_validity
239
+
240
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
214
241
  end
215
242
 
216
243
  # Sets the reference air pressure for the altitude calculation.
@@ -223,7 +250,9 @@ module Tinkerforge
223
250
  # `QFE <https://en.wikipedia.org/wiki/Mean_sea_level_pressure#Mean_sea_level_pressure>`__
224
251
  # used in aviation.
225
252
  def set_reference_air_pressure(air_pressure)
226
- send_request FUNCTION_SET_REFERENCE_AIR_PRESSURE, [air_pressure], 'l', 0, ''
253
+ check_validity
254
+
255
+ send_request FUNCTION_SET_REFERENCE_AIR_PRESSURE, [air_pressure], 'l', 8, ''
227
256
  end
228
257
 
229
258
  # Returns the temperature of the air pressure sensor.
@@ -232,12 +261,16 @@ module Tinkerforge
232
261
  # pressure measurement. It is not as accurate as the temperature measured by the
233
262
  # :ref:`temperature_bricklet` or the :ref:`temperature_ir_bricklet`.
234
263
  def get_chip_temperature
235
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
264
+ check_validity
265
+
266
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
236
267
  end
237
268
 
238
269
  # Returns the reference air pressure as set by BrickletBarometer#set_reference_air_pressure.
239
270
  def get_reference_air_pressure
240
- send_request FUNCTION_GET_REFERENCE_AIR_PRESSURE, [], '', 4, 'l'
271
+ check_validity
272
+
273
+ send_request FUNCTION_GET_REFERENCE_AIR_PRESSURE, [], '', 12, 'l'
241
274
  end
242
275
 
243
276
  # Sets the different averaging parameters. It is possible to set
@@ -255,26 +288,33 @@ module Tinkerforge
255
288
  #
256
289
  # .. versionadded:: 2.0.1$nbsp;(Plugin)
257
290
  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, ''
291
+ check_validity
292
+
293
+ send_request FUNCTION_SET_AVERAGING, [moving_average_pressure, average_pressure, average_temperature], 'C C C', 8, ''
259
294
  end
260
295
 
261
296
  # Returns the averaging configuration as set by BrickletBarometer#set_averaging.
262
297
  #
263
298
  # .. versionadded:: 2.0.1$nbsp;(Plugin)
264
299
  def get_averaging
265
- send_request FUNCTION_GET_AVERAGING, [], '', 3, 'C C C'
300
+ check_validity
301
+
302
+ send_request FUNCTION_GET_AVERAGING, [], '', 11, 'C C C'
266
303
  end
267
304
 
268
305
  # Returns the UID, the UID where the Bricklet is connected to,
269
306
  # the position, the hardware and firmware version as well as the
270
307
  # device identifier.
271
308
  #
272
- # The position can be 'a', 'b', 'c' or 'd'.
309
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
310
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
311
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
312
+ # position 'z'.
273
313
  #
274
314
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
275
315
  # |device_identifier_constant|
276
316
  def get_identity
277
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
317
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
278
318
  end
279
319
 
280
320
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.