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
  # Reads and writes NFC and RFID tags
14
16
  class BrickletNFCRFID < Device
@@ -52,7 +54,7 @@ module Tinkerforge
52
54
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
53
55
  # the IP Connection <tt>ipcon</tt>.
54
56
  def initialize(uid, ipcon)
55
- super uid, ipcon
57
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
56
58
 
57
59
  @api_version = [2, 0, 0]
58
60
 
@@ -65,8 +67,9 @@ module Tinkerforge
65
67
  @response_expected[FUNCTION_GET_PAGE] = RESPONSE_EXPECTED_ALWAYS_TRUE
66
68
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
67
69
 
68
- @callback_formats[CALLBACK_STATE_CHANGED] = 'C ?'
70
+ @callback_formats[CALLBACK_STATE_CHANGED] = [10, 'C ?']
69
71
 
72
+ @ipcon.add_device self
70
73
  end
71
74
 
72
75
  # To read or write a tag that is in proximity of the NFC/RFID Bricklet you
@@ -98,7 +101,9 @@ module Tinkerforge
98
101
  # In case of any *Error* state the selection is lost and you have to
99
102
  # start again by calling BrickletNFCRFID#request_tag_id.
100
103
  def request_tag_id(tag_type)
101
- send_request FUNCTION_REQUEST_TAG_ID, [tag_type], 'C', 0, ''
104
+ check_validity
105
+
106
+ send_request FUNCTION_REQUEST_TAG_ID, [tag_type], 'C', 8, ''
102
107
  end
103
108
 
104
109
  # Returns the tag type, tag ID and the length of the tag ID
@@ -113,7 +118,9 @@ module Tinkerforge
113
118
  # CALLBACK_STATE_CHANGED callback)
114
119
  # 3. Call BrickletNFCRFID#get_tag_id
115
120
  def get_tag_id
116
- send_request FUNCTION_GET_TAG_ID, [], '', 9, 'C C C7'
121
+ check_validity
122
+
123
+ send_request FUNCTION_GET_TAG_ID, [], '', 17, 'C C C7'
117
124
  end
118
125
 
119
126
  # Returns the current state of the NFC/RFID Bricklet.
@@ -131,7 +138,9 @@ module Tinkerforge
131
138
  #
132
139
  # The same approach is used analogously for the other API functions.
133
140
  def get_state
134
- send_request FUNCTION_GET_STATE, [], '', 2, 'C ?'
141
+ check_validity
142
+
143
+ send_request FUNCTION_GET_STATE, [], '', 10, 'C ?'
135
144
  end
136
145
 
137
146
  # Mifare Classic tags use authentication. If you want to read from or write to
@@ -153,7 +162,9 @@ module Tinkerforge
153
162
  # BrickletNFCRFID#get_state or CALLBACK_STATE_CHANGED callback)
154
163
  # 6. Call BrickletNFCRFID#request_page or BrickletNFCRFID#write_page to read/write page
155
164
  def authenticate_mifare_classic_page(page, key_number, key)
156
- send_request FUNCTION_AUTHENTICATE_MIFARE_CLASSIC_PAGE, [page, key_number, key], 'S C C6', 0, ''
165
+ check_validity
166
+
167
+ send_request FUNCTION_AUTHENTICATE_MIFARE_CLASSIC_PAGE, [page, key_number, key], 'S C C6', 8, ''
157
168
  end
158
169
 
159
170
  # Writes 16 bytes starting from the given page. How many pages are written
@@ -177,7 +188,9 @@ module Tinkerforge
177
188
  # If you use a Mifare Classic tag you have to authenticate a page before you
178
189
  # can write to it. See BrickletNFCRFID#authenticate_mifare_classic_page.
179
190
  def write_page(page, data)
180
- send_request FUNCTION_WRITE_PAGE, [page, data], 'S C16', 0, ''
191
+ check_validity
192
+
193
+ send_request FUNCTION_WRITE_PAGE, [page, data], 'S C16', 8, ''
181
194
  end
182
195
 
183
196
  # Reads 16 bytes starting from the given page and stores them into a buffer.
@@ -204,25 +217,31 @@ module Tinkerforge
204
217
  # If you use a Mifare Classic tag you have to authenticate a page before you
205
218
  # can read it. See BrickletNFCRFID#authenticate_mifare_classic_page.
206
219
  def request_page(page)
207
- send_request FUNCTION_REQUEST_PAGE, [page], 'S', 0, ''
220
+ check_validity
221
+
222
+ send_request FUNCTION_REQUEST_PAGE, [page], 'S', 8, ''
208
223
  end
209
224
 
210
225
  # Returns 16 bytes of data from an internal buffer. To fill the buffer
211
226
  # with specific pages you have to call BrickletNFCRFID#request_page beforehand.
212
227
  def get_page
213
- send_request FUNCTION_GET_PAGE, [], '', 16, 'C16'
228
+ check_validity
229
+
230
+ send_request FUNCTION_GET_PAGE, [], '', 24, 'C16'
214
231
  end
215
232
 
216
233
  # Returns the UID, the UID where the Bricklet is connected to,
217
234
  # the position, the hardware and firmware version as well as the
218
235
  # device identifier.
219
236
  #
220
- # The position can be 'a', 'b', 'c' or 'd'.
237
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
238
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
239
+ # position 'z'.
221
240
  #
222
241
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
223
242
  # |device_identifier_constant|
224
243
  def get_identity
225
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
244
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
226
245
  end
227
246
 
228
247
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-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
  # 3.3cm (1.3") OLED display with 128x64 pixels
14
16
  class BrickletOLED128x64 < Device
@@ -27,7 +29,7 @@ module Tinkerforge
27
29
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
28
30
  # the IP Connection <tt>ipcon</tt>.
29
31
  def initialize(uid, ipcon)
30
- super uid, ipcon
32
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
31
33
 
32
34
  @api_version = [2, 0, 0]
33
35
 
@@ -40,6 +42,7 @@ module Tinkerforge
40
42
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
41
43
 
42
44
 
45
+ @ipcon.add_device self
43
46
  end
44
47
 
45
48
  # Appends 64 byte of data to the window as set by BrickletOLED128x64#new_window.
@@ -63,39 +66,45 @@ module Tinkerforge
63
66
  # and the next two the second row and so on. To fill the whole display
64
67
  # you need to call BrickletOLED128x64#write 16 times.
65
68
  def write(data)
66
- send_request FUNCTION_WRITE, [data], 'C64', 0, ''
69
+ check_validity
70
+
71
+ send_request FUNCTION_WRITE, [data], 'C64', 8, ''
67
72
  end
68
73
 
69
74
  # Sets the window in which you can write with BrickletOLED128x64#write. One row
70
75
  # has a height of 8 pixels.
71
- #
72
- # The columns have a range of 0 to 127 and the rows have a range of 0 to 7.
73
76
  def new_window(column_from, column_to, row_from, row_to)
74
- send_request FUNCTION_NEW_WINDOW, [column_from, column_to, row_from, row_to], 'C C C C', 0, ''
77
+ check_validity
78
+
79
+ send_request FUNCTION_NEW_WINDOW, [column_from, column_to, row_from, row_to], 'C C C C', 8, ''
75
80
  end
76
81
 
77
82
  # Clears the current content of the window as set by BrickletOLED128x64#new_window.
78
83
  def clear_display
79
- send_request FUNCTION_CLEAR_DISPLAY, [], '', 0, ''
84
+ check_validity
85
+
86
+ send_request FUNCTION_CLEAR_DISPLAY, [], '', 8, ''
80
87
  end
81
88
 
82
89
  # Sets the configuration of the display.
83
90
  #
84
91
  # You can set a contrast value from 0 to 255 and you can invert the color
85
92
  # (black/white) of the display.
86
- #
87
- # The default values are contrast 143 and inverting off.
88
93
  def set_display_configuration(contrast, invert)
89
- send_request FUNCTION_SET_DISPLAY_CONFIGURATION, [contrast, invert], 'C ?', 0, ''
94
+ check_validity
95
+
96
+ send_request FUNCTION_SET_DISPLAY_CONFIGURATION, [contrast, invert], 'C ?', 8, ''
90
97
  end
91
98
 
92
99
  # Returns the configuration as set by BrickletOLED128x64#set_display_configuration.
93
100
  def get_display_configuration
94
- send_request FUNCTION_GET_DISPLAY_CONFIGURATION, [], '', 2, 'C ?'
101
+ check_validity
102
+
103
+ send_request FUNCTION_GET_DISPLAY_CONFIGURATION, [], '', 10, 'C ?'
95
104
  end
96
105
 
97
- # Writes text to a specific line (0 to 7) with a specific position
98
- # (0 to 25). The text can have a maximum of 26 characters.
106
+ # Writes text to a specific line with a specific position.
107
+ # The text can have a maximum of 26 characters.
99
108
  #
100
109
  # For example: (1, 10, "Hello") will write *Hello* in the middle of the
101
110
  # second line of the display.
@@ -106,19 +115,23 @@ module Tinkerforge
106
115
  # The display uses a special 5x7 pixel charset. You can view the characters
107
116
  # of the charset in Brick Viewer.
108
117
  def write_line(line, position, text)
109
- send_request FUNCTION_WRITE_LINE, [line, position, text], 'C C Z26', 0, ''
118
+ check_validity
119
+
120
+ send_request FUNCTION_WRITE_LINE, [line, position, text], 'C C Z26', 8, ''
110
121
  end
111
122
 
112
123
  # Returns the UID, the UID where the Bricklet is connected to,
113
124
  # the position, the hardware and firmware version as well as the
114
125
  # device identifier.
115
126
  #
116
- # The position can be 'a', 'b', 'c' or 'd'.
127
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
128
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
129
+ # position 'z'.
117
130
  #
118
131
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
119
132
  # |device_identifier_constant|
120
133
  def get_identity
121
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
134
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
122
135
  end
123
136
 
124
137
  end
@@ -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
  # 3.3cm (1.3") OLED display with 128x64 pixels
14
16
  class BrickletOLED128x64V2 < Device
@@ -54,7 +56,7 @@ module Tinkerforge
54
56
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
55
57
  # the IP Connection <tt>ipcon</tt>.
56
58
  def initialize(uid, ipcon)
57
- super uid, ipcon
59
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
58
60
 
59
61
  @api_version = [2, 0, 0]
60
62
 
@@ -79,13 +81,13 @@ module Tinkerforge
79
81
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
80
82
 
81
83
 
84
+ @ipcon.add_device self
82
85
  end
83
86
 
84
87
  # Writes pixels to the specified window.
85
88
  #
86
- # The x-axis goes from 0 to 127 and the y-axis from 0 to 63. The pixels are written
87
- # into the window line by line top to bottom and each line is written from left to
88
- # right.
89
+ # The pixels are written into the window line by line top to bottom
90
+ # and each line is written from left to right.
89
91
  #
90
92
  # If automatic draw is enabled (default) the pixels are directly written to
91
93
  # the screen. Only pixels that have actually changed are updated on the screen,
@@ -99,14 +101,15 @@ module Tinkerforge
99
101
  # Automatic draw can be configured with the BrickletOLED128x64V2#set_display_configuration
100
102
  # function.
101
103
  def write_pixels_low_level(x_start, y_start, x_end, y_end, pixels_length, pixels_chunk_offset, pixels_chunk_data)
102
- send_request FUNCTION_WRITE_PIXELS_LOW_LEVEL, [x_start, y_start, x_end, y_end, pixels_length, pixels_chunk_offset, pixels_chunk_data], 'C C C C S S ?448', 0, ''
104
+ check_validity
105
+
106
+ send_request FUNCTION_WRITE_PIXELS_LOW_LEVEL, [x_start, y_start, x_end, y_end, pixels_length, pixels_chunk_offset, pixels_chunk_data], 'C C C C S S ?448', 8, ''
103
107
  end
104
108
 
105
109
  # Reads pixels from the specified window.
106
110
  #
107
- # The x-axis goes from 0 to 127 and the y-axis from 0 to 63. The pixels are read
108
- # from the window line by line top to bottom and each line is read from left to
109
- # right.
111
+ # The pixels are read from the window line by line top to bottom
112
+ # and each line is read from left to right.
110
113
  #
111
114
  # If automatic draw is enabled (default) the pixels that are read are always the
112
115
  # same that are shown on the display.
@@ -117,7 +120,9 @@ module Tinkerforge
117
120
  # Automatic draw can be configured with the BrickletOLED128x64V2#set_display_configuration
118
121
  # function.
119
122
  def read_pixels_low_level(x_start, y_start, x_end, y_end)
120
- send_request FUNCTION_READ_PIXELS_LOW_LEVEL, [x_start, y_start, x_end, y_end], 'C C C C', 484, 'S S ?480'
123
+ check_validity
124
+
125
+ send_request FUNCTION_READ_PIXELS_LOW_LEVEL, [x_start, y_start, x_end, y_end], 'C C C C', 72, 'S S ?480'
121
126
  end
122
127
 
123
128
  # Clears the complete content of the display.
@@ -132,7 +137,9 @@ module Tinkerforge
132
137
  # Automatic draw can be configured with the BrickletOLED128x64V2#set_display_configuration
133
138
  # function.
134
139
  def clear_display
135
- send_request FUNCTION_CLEAR_DISPLAY, [], '', 0, ''
140
+ check_validity
141
+
142
+ send_request FUNCTION_CLEAR_DISPLAY, [], '', 8, ''
136
143
  end
137
144
 
138
145
  # Sets the configuration of the display.
@@ -144,19 +151,21 @@ module Tinkerforge
144
151
  # call of BrickletOLED128x64V2#write_pixels or BrickletOLED128x64V2#write_line. If it is set to false, the
145
152
  # changes are written into an internal buffer and only shown on the display after
146
153
  # a call of BrickletOLED128x64V2#draw_buffered_frame.
147
- #
148
- # The default values are contrast 143, inverting off and automatic draw on.
149
154
  def set_display_configuration(contrast, invert, automatic_draw)
150
- send_request FUNCTION_SET_DISPLAY_CONFIGURATION, [contrast, invert, automatic_draw], 'C ? ?', 0, ''
155
+ check_validity
156
+
157
+ send_request FUNCTION_SET_DISPLAY_CONFIGURATION, [contrast, invert, automatic_draw], 'C ? ?', 8, ''
151
158
  end
152
159
 
153
160
  # Returns the configuration as set by BrickletOLED128x64V2#set_display_configuration.
154
161
  def get_display_configuration
155
- send_request FUNCTION_GET_DISPLAY_CONFIGURATION, [], '', 3, 'C ? ?'
162
+ check_validity
163
+
164
+ send_request FUNCTION_GET_DISPLAY_CONFIGURATION, [], '', 11, 'C ? ?'
156
165
  end
157
166
 
158
- # Writes text to a specific line (0 to 7) with a specific position
159
- # (0 to 21). The text can have a maximum of 22 characters.
167
+ # Writes text to a specific line with a specific position.
168
+ # The text can have a maximum of 22 characters.
160
169
  #
161
170
  # For example: (1, 10, "Hello") will write *Hello* in the middle of the
162
171
  # second line of the display.
@@ -176,7 +185,9 @@ module Tinkerforge
176
185
  # Automatic draw can be configured with the BrickletOLED128x64V2#set_display_configuration
177
186
  # function.
178
187
  def write_line(line, position, text)
179
- send_request FUNCTION_WRITE_LINE, [line, position, text], 'C C Z22', 0, ''
188
+ check_validity
189
+
190
+ send_request FUNCTION_WRITE_LINE, [line, position, text], 'C C Z22', 8, ''
180
191
  end
181
192
 
182
193
  # Draws the currently buffered frame. Normally each call of BrickletOLED128x64V2#write_pixels and
@@ -189,7 +200,9 @@ module Tinkerforge
189
200
  # instead of only the changed parts. Normally it should not be necessary to set this to
190
201
  # *true*. It may only become necessary in case of stuck pixels because of errors.
191
202
  def draw_buffered_frame(force_complete_redraw)
192
- send_request FUNCTION_DRAW_BUFFERED_FRAME, [force_complete_redraw], '?', 0, ''
203
+ check_validity
204
+
205
+ send_request FUNCTION_DRAW_BUFFERED_FRAME, [force_complete_redraw], '?', 8, ''
193
206
  end
194
207
 
195
208
  # Returns the error count for the communication between Brick and Bricklet.
@@ -204,7 +217,9 @@ module Tinkerforge
204
217
  # The errors counts are for errors that occur on the Bricklet side. All
205
218
  # Bricks have a similar function that returns the errors on the Brick side.
206
219
  def get_spitfp_error_count
207
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
220
+ check_validity
221
+
222
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
208
223
  end
209
224
 
210
225
  # Sets the bootloader mode and returns the status after the requested
@@ -217,12 +232,16 @@ module Tinkerforge
217
232
  # This function is used by Brick Viewer during flashing. It should not be
218
233
  # necessary to call it in a normal user program.
219
234
  def set_bootloader_mode(mode)
220
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
235
+ check_validity
236
+
237
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
221
238
  end
222
239
 
223
240
  # Returns the current bootloader mode, see BrickletOLED128x64V2#set_bootloader_mode.
224
241
  def get_bootloader_mode
225
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
242
+ check_validity
243
+
244
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
226
245
  end
227
246
 
228
247
  # Sets the firmware pointer for BrickletOLED128x64V2#write_firmware. The pointer has
@@ -232,7 +251,9 @@ module Tinkerforge
232
251
  # This function is used by Brick Viewer during flashing. It should not be
233
252
  # necessary to call it in a normal user program.
234
253
  def set_write_firmware_pointer(pointer)
235
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
254
+ check_validity
255
+
256
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
236
257
  end
237
258
 
238
259
  # Writes 64 Bytes of firmware at the position as written by
@@ -244,7 +265,9 @@ module Tinkerforge
244
265
  # This function is used by Brick Viewer during flashing. It should not be
245
266
  # necessary to call it in a normal user program.
246
267
  def write_firmware(data)
247
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
268
+ check_validity
269
+
270
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
248
271
  end
249
272
 
250
273
  # Sets the status LED configuration. By default the LED shows
@@ -255,22 +278,28 @@ module Tinkerforge
255
278
  #
256
279
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
257
280
  def set_status_led_config(config)
258
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
281
+ check_validity
282
+
283
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
259
284
  end
260
285
 
261
286
  # Returns the configuration as set by BrickletOLED128x64V2#set_status_led_config
262
287
  def get_status_led_config
263
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
288
+ check_validity
289
+
290
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
264
291
  end
265
292
 
266
- # Returns the temperature in °C as measured inside the microcontroller. The
293
+ # Returns the temperature as measured inside the microcontroller. The
267
294
  # value returned is not the ambient temperature!
268
295
  #
269
296
  # The temperature is only proportional to the real temperature and it has bad
270
297
  # accuracy. Practically it is only useful as an indicator for
271
298
  # temperature changes.
272
299
  def get_chip_temperature
273
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
300
+ check_validity
301
+
302
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
274
303
  end
275
304
 
276
305
  # Calling this function will reset the Bricklet. All configurations
@@ -280,7 +309,9 @@ module Tinkerforge
280
309
  # calling functions on the existing ones will result in
281
310
  # undefined behavior!
282
311
  def reset
283
- send_request FUNCTION_RESET, [], '', 0, ''
312
+ check_validity
313
+
314
+ send_request FUNCTION_RESET, [], '', 8, ''
284
315
  end
285
316
 
286
317
  # Writes a new UID into flash. If you want to set a new UID
@@ -289,32 +320,37 @@ module Tinkerforge
289
320
  #
290
321
  # We recommend that you use Brick Viewer to change the UID.
291
322
  def write_uid(uid)
292
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
323
+ check_validity
324
+
325
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
293
326
  end
294
327
 
295
328
  # Returns the current UID as an integer. Encode as
296
329
  # Base58 to get the usual string version.
297
330
  def read_uid
298
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
331
+ check_validity
332
+
333
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
299
334
  end
300
335
 
301
336
  # Returns the UID, the UID where the Bricklet is connected to,
302
337
  # the position, the hardware and firmware version as well as the
303
338
  # device identifier.
304
339
  #
305
- # The position can be 'a', 'b', 'c' or 'd'.
340
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
341
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
342
+ # position 'z'.
306
343
  #
307
344
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
308
345
  # |device_identifier_constant|
309
346
  def get_identity
310
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
347
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
311
348
  end
312
349
 
313
350
  # Writes pixels to the specified window.
314
351
  #
315
- # The x-axis goes from 0 to 127 and the y-axis from 0 to 63. The pixels are written
316
- # into the window line by line top to bottom and each line is written from left to
317
- # right.
352
+ # The pixels are written into the window line by line top to bottom
353
+ # and each line is written from left to right.
318
354
  #
319
355
  # If automatic draw is enabled (default) the pixels are directly written to
320
356
  # the screen. Only pixels that have actually changed are updated on the screen,
@@ -360,9 +396,8 @@ module Tinkerforge
360
396
 
361
397
  # Reads pixels from the specified window.
362
398
  #
363
- # The x-axis goes from 0 to 127 and the y-axis from 0 to 63. The pixels are read
364
- # from the window line by line top to bottom and each line is read from left to
365
- # right.
399
+ # The pixels are read from the window line by line top to bottom
400
+ # and each line is read from left to right.
366
401
  #
367
402
  # If automatic draw is enabled (default) the pixels that are read are always the
368
403
  # same that are shown on the display.