tinkerforge 2.1.23 → 2.1.28

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 (146) hide show
  1. checksums.yaml +5 -5
  2. data/lib/tinkerforge/brick_dc.rb +156 -75
  3. data/lib/tinkerforge/brick_hat.rb +109 -30
  4. data/lib/tinkerforge/brick_hat_zero.rb +119 -21
  5. data/lib/tinkerforge/brick_imu.rb +191 -86
  6. data/lib/tinkerforge/brick_imu_v2.rb +219 -118
  7. data/lib/tinkerforge/brick_master.rb +495 -195
  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 +248 -168
  11. data/lib/tinkerforge/brick_stepper.rb +212 -100
  12. data/lib/tinkerforge/bricklet_accelerometer.rb +61 -36
  13. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +107 -63
  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 +75 -47
  31. data/lib/tinkerforge/bricklet_color_v2.rb +91 -47
  32. data/lib/tinkerforge/bricklet_compass.rb +81 -40
  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 +68 -33
  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 +81 -40
  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 +99 -51
  77. data/lib/tinkerforge/bricklet_lcd_128x64.rb +219 -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 +76 -39
  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 +75 -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_performance_dc.rb +676 -0
  102. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -13
  103. data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -19
  104. data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +84 -57
  105. data/lib/tinkerforge/bricklet_ptc.rb +76 -51
  106. data/lib/tinkerforge/bricklet_ptc_v2.rb +96 -54
  107. data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -36
  108. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -47
  109. data/lib/tinkerforge/bricklet_remote_switch.rb +38 -29
  110. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +86 -49
  111. data/lib/tinkerforge/bricklet_rgb_led.rb +17 -8
  112. data/lib/tinkerforge/bricklet_rgb_led_button.rb +61 -30
  113. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +78 -33
  114. data/lib/tinkerforge/bricklet_rgb_led_v2.rb +51 -20
  115. data/lib/tinkerforge/bricklet_rotary_encoder.rb +40 -25
  116. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -27
  117. data/lib/tinkerforge/bricklet_rotary_poti.rb +55 -37
  118. data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +57 -26
  119. data/lib/tinkerforge/bricklet_rs232.rb +89 -28
  120. data/lib/tinkerforge/bricklet_rs232_v2.rb +121 -47
  121. data/lib/tinkerforge/bricklet_rs485.rb +250 -164
  122. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
  123. data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -36
  124. data/lib/tinkerforge/bricklet_servo_v2.rb +565 -0
  125. data/lib/tinkerforge/bricklet_solid_state_relay.rb +24 -13
  126. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +58 -25
  127. data/lib/tinkerforge/bricklet_sound_intensity.rb +36 -24
  128. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +77 -41
  129. data/lib/tinkerforge/bricklet_temperature.rb +43 -28
  130. data/lib/tinkerforge/bricklet_temperature_ir.rb +61 -47
  131. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +74 -44
  132. data/lib/tinkerforge/bricklet_temperature_v2.rb +62 -31
  133. data/lib/tinkerforge/bricklet_thermal_imaging.rb +118 -68
  134. data/lib/tinkerforge/bricklet_thermocouple.rb +46 -30
  135. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -30
  136. data/lib/tinkerforge/bricklet_tilt.rb +23 -10
  137. data/lib/tinkerforge/bricklet_uv_light.rb +37 -24
  138. data/lib/tinkerforge/bricklet_uv_light_v2.rb +87 -46
  139. data/lib/tinkerforge/bricklet_voltage.rb +54 -37
  140. data/lib/tinkerforge/bricklet_voltage_current.rb +94 -85
  141. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +92 -77
  142. data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +81 -36
  143. data/lib/tinkerforge/device_display_names.rb +167 -0
  144. data/lib/tinkerforge/ip_connection.rb +156 -33
  145. data/lib/tinkerforge/version.rb +1 -1
  146. metadata +8 -3
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-08-23. #
3
+ # This file was automatically generated on 2021-01-15. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.23 #
5
+ # Ruby Bindings Version 2.1.28 #
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
  # Three color 296x128 e-paper display
14
16
  class BrickletEPaper296x128 < Device
@@ -89,7 +91,7 @@ module Tinkerforge
89
91
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
90
92
  # the IP Connection <tt>ipcon</tt>.
91
93
  def initialize(uid, ipcon)
92
- super uid, ipcon
94
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
93
95
 
94
96
  @api_version = [2, 0, 0]
95
97
 
@@ -120,8 +122,9 @@ module Tinkerforge
120
122
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
121
123
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
122
124
 
123
- @callback_formats[CALLBACK_DRAW_STATUS] = 'C'
125
+ @callback_formats[CALLBACK_DRAW_STATUS] = [9, 'C']
124
126
 
127
+ @ipcon.add_device self
125
128
  end
126
129
 
127
130
  # Draws the current black/white and red or gray buffer to the e-paper display.
@@ -129,7 +132,9 @@ module Tinkerforge
129
132
  # The Bricklet does not have any double-buffering. You should not call
130
133
  # this function while writing to the buffer. See BrickletEPaper296x128#get_draw_status.
131
134
  def draw
132
- send_request FUNCTION_DRAW, [], '', 0, ''
135
+ check_validity
136
+
137
+ send_request FUNCTION_DRAW, [], '', 8, ''
133
138
  end
134
139
 
135
140
  # Returns one of three draw statuses:
@@ -142,14 +147,15 @@ module Tinkerforge
142
147
  # either *idle* or *drawing*. You should not write to the buffer while it is being *copied* to the
143
148
  # display. There is no double-buffering.
144
149
  def get_draw_status
145
- send_request FUNCTION_GET_DRAW_STATUS, [], '', 1, 'C'
150
+ check_validity
151
+
152
+ send_request FUNCTION_GET_DRAW_STATUS, [], '', 9, 'C'
146
153
  end
147
154
 
148
155
  # Writes black/white pixels to the specified window into the buffer.
149
156
  #
150
- # The x-axis goes from 0 to 295 and the y-axis from 0 to 127. The pixels are written
151
- # into the window line by line top to bottom and each line is written from left to
152
- # right.
157
+ # The pixels are written into the window line by line top to bottom
158
+ # and each line is written from left to right.
153
159
  #
154
160
  # The value 0 (false) corresponds to a black pixel and the value 1 (true) to a
155
161
  # white pixel.
@@ -159,29 +165,31 @@ module Tinkerforge
159
165
  #
160
166
  # Use BrickletEPaper296x128#write_color to write red or gray pixels.
161
167
  def write_black_white_low_level(x_start, y_start, x_end, y_end, pixels_length, pixels_chunk_offset, pixels_chunk_data)
162
- send_request FUNCTION_WRITE_BLACK_WHITE_LOW_LEVEL, [x_start, y_start, x_end, y_end, pixels_length, pixels_chunk_offset, pixels_chunk_data], 'S C S C S S ?432', 0, ''
168
+ check_validity
169
+
170
+ send_request FUNCTION_WRITE_BLACK_WHITE_LOW_LEVEL, [x_start, y_start, x_end, y_end, pixels_length, pixels_chunk_offset, pixels_chunk_data], 'S C S C S S ?432', 8, ''
163
171
  end
164
172
 
165
173
  # Returns the current content of the black/white pixel buffer for the specified window.
166
174
  #
167
- # The x-axis goes from 0 to 295 and the y-axis from 0 to 127. The pixels are written
168
- # into the window line by line top to bottom and each line is written from left to
169
- # right.
175
+ # The pixels are read into the window line by line top to bottom and
176
+ # each line is read from left to right.
170
177
  #
171
178
  # The current content of the buffer does not have to be the current content of the display.
172
179
  # It is possible that the data was not drawn to the display yet and after a restart of
173
180
  # the Bricklet the buffer will be reset to black, while the display retains its content.
174
181
  def read_black_white_low_level(x_start, y_start, x_end, y_end)
175
- send_request FUNCTION_READ_BLACK_WHITE_LOW_LEVEL, [x_start, y_start, x_end, y_end], 'S C S C', 468, 'S S ?464'
182
+ check_validity
183
+
184
+ send_request FUNCTION_READ_BLACK_WHITE_LOW_LEVEL, [x_start, y_start, x_end, y_end], 'S C S C', 70, 'S S ?464'
176
185
  end
177
186
 
178
187
  # The E-Paper 296x128 Bricklet is available with the colors black/white/red and
179
188
  # black/white/gray. Depending on the model this function writes either red or
180
189
  # gray pixels to the specified window into the buffer.
181
190
  #
182
- # The x-axis goes from 0 to 295 and the y-axis from 0 to 127. The pixels are written
183
- # into the window line by line top to bottom and each line is written from left to
184
- # right.
191
+ # The pixels are written into the window line by line top to bottom
192
+ # and each line is written from left to right.
185
193
  #
186
194
  # The value 0 (false) means that this pixel does not have color. It will be either black
187
195
  # or white (see BrickletEPaper296x128#write_black_white). The value 1 (true) corresponds to a red or gray
@@ -192,53 +200,69 @@ module Tinkerforge
192
200
  #
193
201
  # Use BrickletEPaper296x128#write_black_white to write black/white pixels.
194
202
  def write_color_low_level(x_start, y_start, x_end, y_end, pixels_length, pixels_chunk_offset, pixels_chunk_data)
195
- send_request FUNCTION_WRITE_COLOR_LOW_LEVEL, [x_start, y_start, x_end, y_end, pixels_length, pixels_chunk_offset, pixels_chunk_data], 'S C S C S S ?432', 0, ''
203
+ check_validity
204
+
205
+ send_request FUNCTION_WRITE_COLOR_LOW_LEVEL, [x_start, y_start, x_end, y_end, pixels_length, pixels_chunk_offset, pixels_chunk_data], 'S C S C S S ?432', 8, ''
196
206
  end
197
207
 
198
208
  # Returns the current content of the red or gray pixel buffer for the specified window.
199
209
  #
200
- # The x-axis goes from 0 to 295 and the y-axis from 0 to 127. The pixels are written
201
- # into the window line by line top to bottom and each line is written from left to
202
- # right.
210
+ # The pixels are written into the window line by line top to bottom
211
+ # and each line is written from left to right.
203
212
  #
204
213
  # The current content of the buffer does not have to be the current content of the display.
205
214
  # It is possible that the data was not drawn to the display yet and after a restart of
206
215
  # the Bricklet the buffer will be reset to black, while the display retains its content.
207
216
  def read_color_low_level(x_start, y_start, x_end, y_end)
208
- send_request FUNCTION_READ_COLOR_LOW_LEVEL, [x_start, y_start, x_end, y_end], 'S C S C', 468, 'S S ?464'
217
+ check_validity
218
+
219
+ send_request FUNCTION_READ_COLOR_LOW_LEVEL, [x_start, y_start, x_end, y_end], 'S C S C', 70, 'S S ?464'
209
220
  end
210
221
 
211
222
  # Fills the complete content of the display with the given color.
223
+ #
224
+ # This function writes the pixels into the black/white/red|gray pixel buffer, to draw the buffer
225
+ # to the display use BrickletEPaper296x128#draw.
212
226
  def fill_display(color)
213
- send_request FUNCTION_FILL_DISPLAY, [color], 'C', 0, ''
227
+ check_validity
228
+
229
+ send_request FUNCTION_FILL_DISPLAY, [color], 'C', 8, ''
214
230
  end
215
231
 
216
232
  # Draws a text with up to 50 characters at the pixel position (x, y).
217
233
  #
218
- # The x values have to be within the range of 0 to 295 and the y
219
- # values have to be within the range of 0 to 127.
220
- #
221
234
  # You can use one of 9 different font sizes and draw the text in
222
235
  # black/white/red|gray. The text can be drawn horizontal or vertical.
236
+ #
237
+ # This function writes the pixels into the black/white/red|gray pixel buffer, to draw the buffer
238
+ # to the display use BrickletEPaper296x128#draw.
223
239
  def draw_text(position_x, position_y, font, color, orientation, text)
224
- send_request FUNCTION_DRAW_TEXT, [position_x, position_y, font, color, orientation, text], 'S C C C C Z50', 0, ''
240
+ check_validity
241
+
242
+ send_request FUNCTION_DRAW_TEXT, [position_x, position_y, font, color, orientation, text], 'S C C C C Z50', 8, ''
225
243
  end
226
244
 
227
245
  # Draws a line from (x, y)-start to (x, y)-end in the given color.
228
- # The x values have to be within the range of 0 to 295 and the y
229
- # values have t be within the range of 0 to 127.
246
+ #
247
+ # This function writes the pixels into the black/white/red|gray pixel buffer, to draw the buffer
248
+ # to the display use BrickletEPaper296x128#draw.
230
249
  def draw_line(position_x_start, position_y_start, position_x_end, position_y_end, color)
231
- send_request FUNCTION_DRAW_LINE, [position_x_start, position_y_start, position_x_end, position_y_end, color], 'S C S C C', 0, ''
250
+ check_validity
251
+
252
+ send_request FUNCTION_DRAW_LINE, [position_x_start, position_y_start, position_x_end, position_y_end, color], 'S C S C C', 8, ''
232
253
  end
233
254
 
234
255
  # Draws a box from (x, y)-start to (x, y)-end in the given color.
235
- # The x values have to be within the range of 0 to 295 and the y
236
- # values have to be within the range of 0 to 127.
237
256
  #
238
257
  # If you set fill to true, the box will be filled with the
239
258
  # color. Otherwise only the outline will be drawn.
259
+ #
260
+ # This function writes the pixels into the black/white/red|gray pixel buffer, to draw the buffer
261
+ # to the display use BrickletEPaper296x128#draw.
240
262
  def draw_box(position_x_start, position_y_start, position_x_end, position_y_end, fill, color)
241
- send_request FUNCTION_DRAW_BOX, [position_x_start, position_y_start, position_x_end, position_y_end, fill, color], 'S C S C ? C', 0, ''
263
+ check_validity
264
+
265
+ send_request FUNCTION_DRAW_BOX, [position_x_start, position_y_start, position_x_end, position_y_end, fill, color], 'S C S C ? C', 8, ''
242
266
  end
243
267
 
244
268
  # .. note::
@@ -276,12 +300,16 @@ module Tinkerforge
276
300
  # three available colors a few times. This will get rid of the ghosting and after that you can
277
301
  # go back to the delta mode with flicker-free updates.
278
302
  def set_update_mode(update_mode)
279
- send_request FUNCTION_SET_UPDATE_MODE, [update_mode], 'C', 0, ''
303
+ check_validity
304
+
305
+ send_request FUNCTION_SET_UPDATE_MODE, [update_mode], 'C', 8, ''
280
306
  end
281
307
 
282
308
  # Returns the update mode as set by BrickletEPaper296x128#set_update_mode.
283
309
  def get_update_mode
284
- send_request FUNCTION_GET_UPDATE_MODE, [], '', 1, 'C'
310
+ check_validity
311
+
312
+ send_request FUNCTION_GET_UPDATE_MODE, [], '', 9, 'C'
285
313
  end
286
314
 
287
315
  # Sets the type of the display. The e-paper display is available
@@ -289,13 +317,17 @@ module Tinkerforge
289
317
  # during the flashing and testing phase. The value is saved in
290
318
  # non-volatile memory and will stay after a power cycle.
291
319
  def set_display_type(display_type)
292
- send_request FUNCTION_SET_DISPLAY_TYPE, [display_type], 'C', 0, ''
320
+ check_validity
321
+
322
+ send_request FUNCTION_SET_DISPLAY_TYPE, [display_type], 'C', 8, ''
293
323
  end
294
324
 
295
325
  # Returns the type of the e-paper display. It can either be
296
326
  # black/white/red or black/white/gray.
297
327
  def get_display_type
298
- send_request FUNCTION_GET_DISPLAY_TYPE, [], '', 1, 'C'
328
+ check_validity
329
+
330
+ send_request FUNCTION_GET_DISPLAY_TYPE, [], '', 9, 'C'
299
331
  end
300
332
 
301
333
  # Returns the error count for the communication between Brick and Bricklet.
@@ -310,7 +342,9 @@ module Tinkerforge
310
342
  # The errors counts are for errors that occur on the Bricklet side. All
311
343
  # Bricks have a similar function that returns the errors on the Brick side.
312
344
  def get_spitfp_error_count
313
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
345
+ check_validity
346
+
347
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
314
348
  end
315
349
 
316
350
  # Sets the bootloader mode and returns the status after the requested
@@ -323,12 +357,16 @@ module Tinkerforge
323
357
  # This function is used by Brick Viewer during flashing. It should not be
324
358
  # necessary to call it in a normal user program.
325
359
  def set_bootloader_mode(mode)
326
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
360
+ check_validity
361
+
362
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
327
363
  end
328
364
 
329
365
  # Returns the current bootloader mode, see BrickletEPaper296x128#set_bootloader_mode.
330
366
  def get_bootloader_mode
331
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
367
+ check_validity
368
+
369
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
332
370
  end
333
371
 
334
372
  # Sets the firmware pointer for BrickletEPaper296x128#write_firmware. The pointer has
@@ -338,7 +376,9 @@ module Tinkerforge
338
376
  # This function is used by Brick Viewer during flashing. It should not be
339
377
  # necessary to call it in a normal user program.
340
378
  def set_write_firmware_pointer(pointer)
341
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
379
+ check_validity
380
+
381
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
342
382
  end
343
383
 
344
384
  # Writes 64 Bytes of firmware at the position as written by
@@ -350,7 +390,9 @@ module Tinkerforge
350
390
  # This function is used by Brick Viewer during flashing. It should not be
351
391
  # necessary to call it in a normal user program.
352
392
  def write_firmware(data)
353
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
393
+ check_validity
394
+
395
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
354
396
  end
355
397
 
356
398
  # Sets the status LED configuration. By default the LED shows
@@ -361,22 +403,28 @@ module Tinkerforge
361
403
  #
362
404
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
363
405
  def set_status_led_config(config)
364
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
406
+ check_validity
407
+
408
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
365
409
  end
366
410
 
367
411
  # Returns the configuration as set by BrickletEPaper296x128#set_status_led_config
368
412
  def get_status_led_config
369
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
413
+ check_validity
414
+
415
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
370
416
  end
371
417
 
372
- # Returns the temperature in °C as measured inside the microcontroller. The
418
+ # Returns the temperature as measured inside the microcontroller. The
373
419
  # value returned is not the ambient temperature!
374
420
  #
375
421
  # The temperature is only proportional to the real temperature and it has bad
376
422
  # accuracy. Practically it is only useful as an indicator for
377
423
  # temperature changes.
378
424
  def get_chip_temperature
379
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
425
+ check_validity
426
+
427
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
380
428
  end
381
429
 
382
430
  # Calling this function will reset the Bricklet. All configurations
@@ -386,7 +434,9 @@ module Tinkerforge
386
434
  # calling functions on the existing ones will result in
387
435
  # undefined behavior!
388
436
  def reset
389
- send_request FUNCTION_RESET, [], '', 0, ''
437
+ check_validity
438
+
439
+ send_request FUNCTION_RESET, [], '', 8, ''
390
440
  end
391
441
 
392
442
  # Writes a new UID into flash. If you want to set a new UID
@@ -395,32 +445,37 @@ module Tinkerforge
395
445
  #
396
446
  # We recommend that you use Brick Viewer to change the UID.
397
447
  def write_uid(uid)
398
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
448
+ check_validity
449
+
450
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
399
451
  end
400
452
 
401
453
  # Returns the current UID as an integer. Encode as
402
454
  # Base58 to get the usual string version.
403
455
  def read_uid
404
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
456
+ check_validity
457
+
458
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
405
459
  end
406
460
 
407
461
  # Returns the UID, the UID where the Bricklet is connected to,
408
462
  # the position, the hardware and firmware version as well as the
409
463
  # device identifier.
410
464
  #
411
- # The position can be 'a', 'b', 'c' or 'd'.
465
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
466
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
467
+ # position 'z'.
412
468
  #
413
469
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
414
470
  # |device_identifier_constant|
415
471
  def get_identity
416
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
472
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
417
473
  end
418
474
 
419
475
  # Writes black/white pixels to the specified window into the buffer.
420
476
  #
421
- # The x-axis goes from 0 to 295 and the y-axis from 0 to 127. The pixels are written
422
- # into the window line by line top to bottom and each line is written from left to
423
- # right.
477
+ # The pixels are written into the window line by line top to bottom
478
+ # and each line is written from left to right.
424
479
  #
425
480
  # The value 0 (false) corresponds to a black pixel and the value 1 (true) to a
426
481
  # white pixel.
@@ -462,9 +517,8 @@ module Tinkerforge
462
517
 
463
518
  # Returns the current content of the black/white pixel buffer for the specified window.
464
519
  #
465
- # The x-axis goes from 0 to 295 and the y-axis from 0 to 127. The pixels are written
466
- # into the window line by line top to bottom and each line is written from left to
467
- # right.
520
+ # The pixels are read into the window line by line top to bottom and
521
+ # each line is read from left to right.
468
522
  #
469
523
  # The current content of the buffer does not have to be the current content of the display.
470
524
  # It is possible that the data was not drawn to the display yet and after a restart of
@@ -506,9 +560,8 @@ module Tinkerforge
506
560
  # black/white/gray. Depending on the model this function writes either red or
507
561
  # gray pixels to the specified window into the buffer.
508
562
  #
509
- # The x-axis goes from 0 to 295 and the y-axis from 0 to 127. The pixels are written
510
- # into the window line by line top to bottom and each line is written from left to
511
- # right.
563
+ # The pixels are written into the window line by line top to bottom
564
+ # and each line is written from left to right.
512
565
  #
513
566
  # The value 0 (false) means that this pixel does not have color. It will be either black
514
567
  # or white (see BrickletEPaper296x128#write_black_white). The value 1 (true) corresponds to a red or gray
@@ -551,9 +604,8 @@ module Tinkerforge
551
604
 
552
605
  # Returns the current content of the red or gray pixel buffer for the specified window.
553
606
  #
554
- # The x-axis goes from 0 to 295 and the y-axis from 0 to 127. The pixels are written
555
- # into the window line by line top to bottom and each line is written from left to
556
- # right.
607
+ # The pixels are written into the window line by line top to bottom
608
+ # and each line is written from left to right.
557
609
  #
558
610
  # The current content of the buffer does not have to be the current content of the display.
559
611
  # It is possible that the data was not drawn to the display yet and after a restart of
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-08-23. #
3
+ # This file was automatically generated on 2021-01-15. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.23 #
5
+ # Ruby Bindings Version 2.1.28 #
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 Voltage, Current, Energy, Real/Apparent/Reactive Power, Power Factor and Frequency
14
16
  class BrickletEnergyMonitor < Device
@@ -62,7 +64,7 @@ module Tinkerforge
62
64
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
63
65
  # the IP Connection <tt>ipcon</tt>.
64
66
  def initialize(uid, ipcon)
65
- super uid, ipcon
67
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
66
68
 
67
69
  @api_version = [2, 0, 0]
68
70
 
@@ -88,20 +90,21 @@ module Tinkerforge
88
90
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
89
91
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
90
92
 
91
- @callback_formats[CALLBACK_ENERGY_DATA] = 'l l l l l l S S'
93
+ @callback_formats[CALLBACK_ENERGY_DATA] = [36, 'l l l l l l S S']
92
94
 
95
+ @ipcon.add_device self
93
96
  end
94
97
 
95
98
  # Returns all of the measurements that are done by the Energy Monitor Bricklet.
96
99
  #
97
- # * Voltage (V): Voltage RMS with a resolution of 10mV (example: 230.05V = 23005)
98
- # * Current (A): Current RMS with a resolution of 10mA (example: 1.42A = 142)
99
- # * Energy (Wh): Energy (integrated over time) with a resolution of 10mWh (example: 1.1kWh = 110000)
100
- # * Real Power (W): Real Power with a resolution of 10mW (example: 1234.56W = 123456)
101
- # * Apparent Power (VA): Apparent Power with a resolution of 10mVA (example: 1234.56VA = 123456)
102
- # * Reactive Power (VAR): Reactive Power with a resolution of 10mVAR (example: 1234.56VAR = 123456)
103
- # * Power Factor: Power Factor with a resolution of 1/1000 (example: PF 0.995 = 995)
104
- # * Frequency (Hz): AC Frequency of the mains voltage with a resolution of 1/100 Hz (example: 50Hz = 5000)
100
+ # * Voltage RMS
101
+ # * Current RMS
102
+ # * Energy (integrated over time)
103
+ # * Real Power
104
+ # * Apparent Power
105
+ # * Reactive Power
106
+ # * Power Factor
107
+ # * Frequency (AC Frequency of the mains voltage)
105
108
  #
106
109
  # The frequency is recalculated every 6 seconds.
107
110
  #
@@ -113,12 +116,16 @@ module Tinkerforge
113
116
  # to calculate the frequency and it will use an integration time of
114
117
  # 10 zero-crossings of the current waveform.
115
118
  def get_energy_data
116
- send_request FUNCTION_GET_ENERGY_DATA, [], '', 28, 'l l l l l l S S'
119
+ check_validity
120
+
121
+ send_request FUNCTION_GET_ENERGY_DATA, [], '', 36, 'l l l l l l S S'
117
122
  end
118
123
 
119
124
  # Sets the energy value (see BrickletEnergyMonitor#get_energy_data) back to 0Wh.
120
125
  def reset_energy
121
- send_request FUNCTION_RESET_ENERGY, [], '', 0, ''
126
+ check_validity
127
+
128
+ send_request FUNCTION_RESET_ENERGY, [], '', 8, ''
122
129
  end
123
130
 
124
131
  # Returns a snapshot of the voltage and current waveform. The values
@@ -132,12 +139,16 @@ module Tinkerforge
132
139
  # This data is meant to be used for a non-realtime graphical representation of
133
140
  # the voltage and current waveforms.
134
141
  def get_waveform_low_level
135
- send_request FUNCTION_GET_WAVEFORM_LOW_LEVEL, [], '', 62, 'S s30'
142
+ check_validity
143
+
144
+ send_request FUNCTION_GET_WAVEFORM_LOW_LEVEL, [], '', 70, 'S s30'
136
145
  end
137
146
 
138
147
  # Returns *true* if a voltage/current transformer is connected to the Bricklet.
139
148
  def get_transformer_status
140
- send_request FUNCTION_GET_TRANSFORMER_STATUS, [], '', 2, '? ?'
149
+ check_validity
150
+
151
+ send_request FUNCTION_GET_TRANSFORMER_STATUS, [], '', 10, '? ?'
141
152
  end
142
153
 
143
154
  # Sets the transformer ratio for the voltage and current transformer in 1/100 form.
@@ -151,16 +162,18 @@ module Tinkerforge
151
162
  #
152
163
  # The calibration is saved in non-volatile memory, you only have to set it once.
153
164
  #
154
- # By default the voltage ratio is set to 1923 and the current ratio is set to 3000.
155
- #
156
165
  # Set the phase shift to 0. It is for future use and currently not supported by the Bricklet.
157
166
  def set_transformer_calibration(voltage_ratio, current_ratio, phase_shift)
158
- send_request FUNCTION_SET_TRANSFORMER_CALIBRATION, [voltage_ratio, current_ratio, phase_shift], 'S S s', 0, ''
167
+ check_validity
168
+
169
+ send_request FUNCTION_SET_TRANSFORMER_CALIBRATION, [voltage_ratio, current_ratio, phase_shift], 'S S s', 8, ''
159
170
  end
160
171
 
161
172
  # Returns the transformer calibration as set by BrickletEnergyMonitor#set_transformer_calibration.
162
173
  def get_transformer_calibration
163
- send_request FUNCTION_GET_TRANSFORMER_CALIBRATION, [], '', 6, 'S S s'
174
+ check_validity
175
+
176
+ send_request FUNCTION_GET_TRANSFORMER_CALIBRATION, [], '', 14, 'S S s'
164
177
  end
165
178
 
166
179
  # Calling this function will start an offset calibration. The offset calibration will
@@ -176,10 +189,12 @@ module Tinkerforge
176
189
  #
177
190
  # The calibration is saved in non-volatile memory, you only have to set it once.
178
191
  def calibrate_offset
179
- send_request FUNCTION_CALIBRATE_OFFSET, [], '', 0, ''
192
+ check_validity
193
+
194
+ send_request FUNCTION_CALIBRATE_OFFSET, [], '', 8, ''
180
195
  end
181
196
 
182
- # The period in ms is the period with which the CALLBACK_ENERGY_DATA
197
+ # The period is the period with which the CALLBACK_ENERGY_DATA
183
198
  # callback is triggered periodically. A value of 0 turns the callback off.
184
199
  #
185
200
  # If the `value has to change`-parameter is set to true, the callback is only
@@ -188,16 +203,18 @@ module Tinkerforge
188
203
  #
189
204
  # If it is set to false, the callback is continuously triggered with the period,
190
205
  # independent of the value.
191
- #
192
- # The default value is (0, false).
193
206
  def set_energy_data_callback_configuration(period, value_has_to_change)
194
- send_request FUNCTION_SET_ENERGY_DATA_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 0, ''
207
+ check_validity
208
+
209
+ send_request FUNCTION_SET_ENERGY_DATA_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
195
210
  end
196
211
 
197
212
  # Returns the callback configuration as set by
198
213
  # BrickletEnergyMonitor#set_energy_data_callback_configuration.
199
214
  def get_energy_data_callback_configuration
200
- send_request FUNCTION_GET_ENERGY_DATA_CALLBACK_CONFIGURATION, [], '', 5, 'L ?'
215
+ check_validity
216
+
217
+ send_request FUNCTION_GET_ENERGY_DATA_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
201
218
  end
202
219
 
203
220
  # Returns the error count for the communication between Brick and Bricklet.
@@ -212,7 +229,9 @@ module Tinkerforge
212
229
  # The errors counts are for errors that occur on the Bricklet side. All
213
230
  # Bricks have a similar function that returns the errors on the Brick side.
214
231
  def get_spitfp_error_count
215
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
232
+ check_validity
233
+
234
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
216
235
  end
217
236
 
218
237
  # Sets the bootloader mode and returns the status after the requested
@@ -225,12 +244,16 @@ module Tinkerforge
225
244
  # This function is used by Brick Viewer during flashing. It should not be
226
245
  # necessary to call it in a normal user program.
227
246
  def set_bootloader_mode(mode)
228
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
247
+ check_validity
248
+
249
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
229
250
  end
230
251
 
231
252
  # Returns the current bootloader mode, see BrickletEnergyMonitor#set_bootloader_mode.
232
253
  def get_bootloader_mode
233
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
254
+ check_validity
255
+
256
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
234
257
  end
235
258
 
236
259
  # Sets the firmware pointer for BrickletEnergyMonitor#write_firmware. The pointer has
@@ -240,7 +263,9 @@ module Tinkerforge
240
263
  # This function is used by Brick Viewer during flashing. It should not be
241
264
  # necessary to call it in a normal user program.
242
265
  def set_write_firmware_pointer(pointer)
243
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
266
+ check_validity
267
+
268
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
244
269
  end
245
270
 
246
271
  # Writes 64 Bytes of firmware at the position as written by
@@ -252,7 +277,9 @@ module Tinkerforge
252
277
  # This function is used by Brick Viewer during flashing. It should not be
253
278
  # necessary to call it in a normal user program.
254
279
  def write_firmware(data)
255
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
280
+ check_validity
281
+
282
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
256
283
  end
257
284
 
258
285
  # Sets the status LED configuration. By default the LED shows
@@ -263,22 +290,28 @@ module Tinkerforge
263
290
  #
264
291
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
265
292
  def set_status_led_config(config)
266
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
293
+ check_validity
294
+
295
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
267
296
  end
268
297
 
269
298
  # Returns the configuration as set by BrickletEnergyMonitor#set_status_led_config
270
299
  def get_status_led_config
271
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
300
+ check_validity
301
+
302
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
272
303
  end
273
304
 
274
- # Returns the temperature in °C as measured inside the microcontroller. The
305
+ # Returns the temperature as measured inside the microcontroller. The
275
306
  # value returned is not the ambient temperature!
276
307
  #
277
308
  # The temperature is only proportional to the real temperature and it has bad
278
309
  # accuracy. Practically it is only useful as an indicator for
279
310
  # temperature changes.
280
311
  def get_chip_temperature
281
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
312
+ check_validity
313
+
314
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
282
315
  end
283
316
 
284
317
  # Calling this function will reset the Bricklet. All configurations
@@ -288,7 +321,9 @@ module Tinkerforge
288
321
  # calling functions on the existing ones will result in
289
322
  # undefined behavior!
290
323
  def reset
291
- send_request FUNCTION_RESET, [], '', 0, ''
324
+ check_validity
325
+
326
+ send_request FUNCTION_RESET, [], '', 8, ''
292
327
  end
293
328
 
294
329
  # Writes a new UID into flash. If you want to set a new UID
@@ -297,25 +332,31 @@ module Tinkerforge
297
332
  #
298
333
  # We recommend that you use Brick Viewer to change the UID.
299
334
  def write_uid(uid)
300
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
335
+ check_validity
336
+
337
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
301
338
  end
302
339
 
303
340
  # Returns the current UID as an integer. Encode as
304
341
  # Base58 to get the usual string version.
305
342
  def read_uid
306
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
343
+ check_validity
344
+
345
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
307
346
  end
308
347
 
309
348
  # Returns the UID, the UID where the Bricklet is connected to,
310
349
  # the position, the hardware and firmware version as well as the
311
350
  # device identifier.
312
351
  #
313
- # The position can be 'a', 'b', 'c' or 'd'.
352
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
353
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
354
+ # position 'z'.
314
355
  #
315
356
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
316
357
  # |device_identifier_constant|
317
358
  def get_identity
318
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
359
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
319
360
  end
320
361
 
321
362
  # Returns a snapshot of the voltage and current waveform. The values