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
  # 1.68cm (0.66") OLED display with 64x48 pixels
14
16
  class BrickletOLED64x48 < 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 BrickletOLED64x48#new_window.
@@ -62,18 +65,24 @@ module Tinkerforge
62
65
  # The next call of BrickletOLED64x48#write will write the second row and so on. To
63
66
  # fill the whole display you need to call BrickletOLED64x48#write 6 times.
64
67
  def write(data)
65
- send_request FUNCTION_WRITE, [data], 'C64', 0, ''
68
+ check_validity
69
+
70
+ send_request FUNCTION_WRITE, [data], 'C64', 8, ''
66
71
  end
67
72
 
68
73
  # Sets the window in which you can write with BrickletOLED64x48#write. One row
69
74
  # has a height of 8 pixels.
70
75
  def new_window(column_from, column_to, row_from, row_to)
71
- send_request FUNCTION_NEW_WINDOW, [column_from, column_to, row_from, row_to], 'C C C C', 0, ''
76
+ check_validity
77
+
78
+ send_request FUNCTION_NEW_WINDOW, [column_from, column_to, row_from, row_to], 'C C C C', 8, ''
72
79
  end
73
80
 
74
81
  # Clears the current content of the window as set by BrickletOLED64x48#new_window.
75
82
  def clear_display
76
- send_request FUNCTION_CLEAR_DISPLAY, [], '', 0, ''
83
+ check_validity
84
+
85
+ send_request FUNCTION_CLEAR_DISPLAY, [], '', 8, ''
77
86
  end
78
87
 
79
88
  # Sets the configuration of the display.
@@ -81,12 +90,16 @@ module Tinkerforge
81
90
  # You can set a contrast value from 0 to 255 and you can invert the color
82
91
  # (black/white) of the display.
83
92
  def set_display_configuration(contrast, invert)
84
- send_request FUNCTION_SET_DISPLAY_CONFIGURATION, [contrast, invert], 'C ?', 0, ''
93
+ check_validity
94
+
95
+ send_request FUNCTION_SET_DISPLAY_CONFIGURATION, [contrast, invert], 'C ?', 8, ''
85
96
  end
86
97
 
87
98
  # Returns the configuration as set by BrickletOLED64x48#set_display_configuration.
88
99
  def get_display_configuration
89
- send_request FUNCTION_GET_DISPLAY_CONFIGURATION, [], '', 2, 'C ?'
100
+ check_validity
101
+
102
+ send_request FUNCTION_GET_DISPLAY_CONFIGURATION, [], '', 10, 'C ?'
90
103
  end
91
104
 
92
105
  # Writes text to a specific line with a specific position.
@@ -101,19 +114,24 @@ module Tinkerforge
101
114
  # The display uses a special 5x7 pixel charset. You can view the characters
102
115
  # of the charset in Brick Viewer.
103
116
  def write_line(line, position, text)
104
- send_request FUNCTION_WRITE_LINE, [line, position, text], 'C C Z13', 0, ''
117
+ check_validity
118
+
119
+ send_request FUNCTION_WRITE_LINE, [line, position, text], 'C C Z13', 8, ''
105
120
  end
106
121
 
107
122
  # Returns the UID, the UID where the Bricklet is connected to,
108
123
  # the position, the hardware and firmware version as well as the
109
124
  # device identifier.
110
125
  #
111
- # The position can be 'a', 'b', 'c' or 'd'.
126
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
127
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
128
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
129
+ # position 'z'.
112
130
  #
113
131
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
114
132
  # |device_identifier_constant|
115
133
  def get_identity
116
- 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'
117
135
  end
118
136
 
119
137
  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
  # Communicates with up 64 1-Wire devices
14
16
  class BrickletOneWire < Device
@@ -63,7 +65,7 @@ module Tinkerforge
63
65
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
64
66
  # the IP Connection <tt>ipcon</tt>.
65
67
  def initialize(uid, ipcon)
66
- super uid, ipcon
68
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
67
69
 
68
70
  @api_version = [2, 0, 0]
69
71
 
@@ -88,6 +90,7 @@ module Tinkerforge
88
90
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
89
91
 
90
92
 
93
+ @ipcon.add_device self
91
94
  end
92
95
 
93
96
  # Returns a list of up to 64 identifiers of the connected 1-Wire devices.
@@ -98,22 +101,30 @@ module Tinkerforge
98
101
  # `SEARCH ROM algorithm <https://www.maximintegrated.com/en/app-notes/index.mvp/id/187>`__,
99
102
  # as defined by Maxim.
100
103
  def search_bus_low_level
101
- send_request FUNCTION_SEARCH_BUS_LOW_LEVEL, [], '', 61, 'S S Q7 C'
104
+ check_validity
105
+
106
+ send_request FUNCTION_SEARCH_BUS_LOW_LEVEL, [], '', 69, 'S S Q7 C'
102
107
  end
103
108
 
104
109
  # Resets the bus with the 1-Wire reset operation.
105
110
  def reset_bus
106
- send_request FUNCTION_RESET_BUS, [], '', 1, 'C'
111
+ check_validity
112
+
113
+ send_request FUNCTION_RESET_BUS, [], '', 9, 'C'
107
114
  end
108
115
 
109
116
  # Writes a byte of data to the 1-Wire bus.
110
117
  def write(data)
111
- send_request FUNCTION_WRITE, [data], 'C', 1, 'C'
118
+ check_validity
119
+
120
+ send_request FUNCTION_WRITE, [data], 'C', 9, 'C'
112
121
  end
113
122
 
114
123
  # Reads a byte of data from the 1-Wire bus.
115
124
  def read
116
- send_request FUNCTION_READ, [], '', 2, 'C C'
125
+ check_validity
126
+
127
+ send_request FUNCTION_READ, [], '', 10, 'C C'
117
128
  end
118
129
 
119
130
  # Writes a command to the 1-Wire device with the given identifier. You can obtain
@@ -124,7 +135,9 @@ module Tinkerforge
124
135
  # you can set the identifier to 0. In this case the SKIP ROM operation is used to
125
136
  # write the command.
126
137
  def write_command(identifier, command)
127
- send_request FUNCTION_WRITE_COMMAND, [identifier, command], 'Q C', 1, 'C'
138
+ check_validity
139
+
140
+ send_request FUNCTION_WRITE_COMMAND, [identifier, command], 'Q C', 9, 'C'
128
141
  end
129
142
 
130
143
  # Sets the communication LED configuration. By default the LED shows 1-wire
@@ -134,12 +147,16 @@ module Tinkerforge
134
147
  #
135
148
  # If the Bricklet is in bootloader mode, the LED is off.
136
149
  def set_communication_led_config(config)
137
- send_request FUNCTION_SET_COMMUNICATION_LED_CONFIG, [config], 'C', 0, ''
150
+ check_validity
151
+
152
+ send_request FUNCTION_SET_COMMUNICATION_LED_CONFIG, [config], 'C', 8, ''
138
153
  end
139
154
 
140
155
  # Returns the configuration as set by BrickletOneWire#set_communication_led_config
141
156
  def get_communication_led_config
142
- send_request FUNCTION_GET_COMMUNICATION_LED_CONFIG, [], '', 1, 'C'
157
+ check_validity
158
+
159
+ send_request FUNCTION_GET_COMMUNICATION_LED_CONFIG, [], '', 9, 'C'
143
160
  end
144
161
 
145
162
  # Returns the error count for the communication between Brick and Bricklet.
@@ -154,7 +171,9 @@ module Tinkerforge
154
171
  # The errors counts are for errors that occur on the Bricklet side. All
155
172
  # Bricks have a similar function that returns the errors on the Brick side.
156
173
  def get_spitfp_error_count
157
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
174
+ check_validity
175
+
176
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
158
177
  end
159
178
 
160
179
  # Sets the bootloader mode and returns the status after the requested
@@ -167,12 +186,16 @@ module Tinkerforge
167
186
  # This function is used by Brick Viewer during flashing. It should not be
168
187
  # necessary to call it in a normal user program.
169
188
  def set_bootloader_mode(mode)
170
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
189
+ check_validity
190
+
191
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
171
192
  end
172
193
 
173
194
  # Returns the current bootloader mode, see BrickletOneWire#set_bootloader_mode.
174
195
  def get_bootloader_mode
175
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
196
+ check_validity
197
+
198
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
176
199
  end
177
200
 
178
201
  # Sets the firmware pointer for BrickletOneWire#write_firmware. The pointer has
@@ -182,7 +205,9 @@ module Tinkerforge
182
205
  # This function is used by Brick Viewer during flashing. It should not be
183
206
  # necessary to call it in a normal user program.
184
207
  def set_write_firmware_pointer(pointer)
185
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
208
+ check_validity
209
+
210
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
186
211
  end
187
212
 
188
213
  # Writes 64 Bytes of firmware at the position as written by
@@ -194,7 +219,9 @@ module Tinkerforge
194
219
  # This function is used by Brick Viewer during flashing. It should not be
195
220
  # necessary to call it in a normal user program.
196
221
  def write_firmware(data)
197
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
222
+ check_validity
223
+
224
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
198
225
  end
199
226
 
200
227
  # Sets the status LED configuration. By default the LED shows
@@ -205,22 +232,28 @@ module Tinkerforge
205
232
  #
206
233
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
207
234
  def set_status_led_config(config)
208
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
235
+ check_validity
236
+
237
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
209
238
  end
210
239
 
211
240
  # Returns the configuration as set by BrickletOneWire#set_status_led_config
212
241
  def get_status_led_config
213
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
242
+ check_validity
243
+
244
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
214
245
  end
215
246
 
216
- # Returns the temperature in °C as measured inside the microcontroller. The
247
+ # Returns the temperature as measured inside the microcontroller. The
217
248
  # value returned is not the ambient temperature!
218
249
  #
219
250
  # The temperature is only proportional to the real temperature and it has bad
220
251
  # accuracy. Practically it is only useful as an indicator for
221
252
  # temperature changes.
222
253
  def get_chip_temperature
223
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
254
+ check_validity
255
+
256
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
224
257
  end
225
258
 
226
259
  # Calling this function will reset the Bricklet. All configurations
@@ -230,7 +263,9 @@ module Tinkerforge
230
263
  # calling functions on the existing ones will result in
231
264
  # undefined behavior!
232
265
  def reset
233
- send_request FUNCTION_RESET, [], '', 0, ''
266
+ check_validity
267
+
268
+ send_request FUNCTION_RESET, [], '', 8, ''
234
269
  end
235
270
 
236
271
  # Writes a new UID into flash. If you want to set a new UID
@@ -239,25 +274,32 @@ module Tinkerforge
239
274
  #
240
275
  # We recommend that you use Brick Viewer to change the UID.
241
276
  def write_uid(uid)
242
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
277
+ check_validity
278
+
279
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
243
280
  end
244
281
 
245
282
  # Returns the current UID as an integer. Encode as
246
283
  # Base58 to get the usual string version.
247
284
  def read_uid
248
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
285
+ check_validity
286
+
287
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
249
288
  end
250
289
 
251
290
  # Returns the UID, the UID where the Bricklet is connected to,
252
291
  # the position, the hardware and firmware version as well as the
253
292
  # device identifier.
254
293
  #
255
- # The position can be 'a', 'b', 'c' or 'd'.
294
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
295
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
296
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
297
+ # position 'z'.
256
298
  #
257
299
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
258
300
  # |device_identifier_constant|
259
301
  def get_identity
260
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
302
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
261
303
  end
262
304
 
263
305
  # Returns a list of up to 64 identifiers of the connected 1-Wire devices.
@@ -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
  # 433MHz receiver for outdoor weather station
14
16
  class BrickletOutdoorWeather < Device
@@ -90,7 +92,7 @@ module Tinkerforge
90
92
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
91
93
  # the IP Connection <tt>ipcon</tt>.
92
94
  def initialize(uid, ipcon)
93
- super uid, ipcon
95
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
94
96
 
95
97
  @api_version = [2, 0, 0]
96
98
 
@@ -115,9 +117,10 @@ module Tinkerforge
115
117
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
116
118
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
117
119
 
118
- @callback_formats[CALLBACK_STATION_DATA] = 'C s C L L L C ?'
119
- @callback_formats[CALLBACK_SENSOR_DATA] = 'C s C'
120
+ @callback_formats[CALLBACK_STATION_DATA] = [26, 'C s C L L L C ?']
121
+ @callback_formats[CALLBACK_SENSOR_DATA] = [12, 'C s C']
120
122
 
123
+ @ipcon.add_device self
121
124
  end
122
125
 
123
126
  # Returns the identifiers (number between 0 and 255) of all `stations
@@ -129,7 +132,9 @@ module Tinkerforge
129
132
  # Since firmware version 2.0.2 a station is removed from the list if no data was received for
130
133
  # 12 hours.
131
134
  def get_station_identifiers_low_level
132
- send_request FUNCTION_GET_STATION_IDENTIFIERS_LOW_LEVEL, [], '', 64, 'S S C60'
135
+ check_validity
136
+
137
+ send_request FUNCTION_GET_STATION_IDENTIFIERS_LOW_LEVEL, [], '', 72, 'S S C60'
133
138
  end
134
139
 
135
140
  # Returns the identifiers (number between 0 and 255) of all `sensors
@@ -141,7 +146,9 @@ module Tinkerforge
141
146
  # Since firmware version 2.0.2 a sensor is removed from the list if no data was received for
142
147
  # 12 hours.
143
148
  def get_sensor_identifiers_low_level
144
- send_request FUNCTION_GET_SENSOR_IDENTIFIERS_LOW_LEVEL, [], '', 64, 'S S C60'
149
+ check_validity
150
+
151
+ send_request FUNCTION_GET_SENSOR_IDENTIFIERS_LOW_LEVEL, [], '', 72, 'S S C60'
145
152
  end
146
153
 
147
154
  # Returns the last received data for a station with the given identifier.
@@ -158,7 +165,9 @@ module Tinkerforge
158
165
  # * Battery Low (true if battery is low) and
159
166
  # * Last Change (seconds since the reception of this data).
160
167
  def get_station_data(identifier)
161
- send_request FUNCTION_GET_STATION_DATA, [identifier], 'C', 19, 's C L L L C ? S'
168
+ check_validity
169
+
170
+ send_request FUNCTION_GET_STATION_DATA, [identifier], 'C', 27, 's C L L L C ? S'
162
171
  end
163
172
 
164
173
  # Returns the last measured data for a sensor with the given identifier.
@@ -170,27 +179,37 @@ module Tinkerforge
170
179
  # * Humidity and
171
180
  # * Last Change (seconds since the last reception of data).
172
181
  def get_sensor_data(identifier)
173
- send_request FUNCTION_GET_SENSOR_DATA, [identifier], 'C', 5, 's C S'
182
+ check_validity
183
+
184
+ send_request FUNCTION_GET_SENSOR_DATA, [identifier], 'C', 13, 's C S'
174
185
  end
175
186
 
176
187
  # Turns callback for station data on or off.
177
188
  def set_station_callback_configuration(enable_callback)
178
- send_request FUNCTION_SET_STATION_CALLBACK_CONFIGURATION, [enable_callback], '?', 0, ''
189
+ check_validity
190
+
191
+ send_request FUNCTION_SET_STATION_CALLBACK_CONFIGURATION, [enable_callback], '?', 8, ''
179
192
  end
180
193
 
181
194
  # Returns the configuration as set by BrickletOutdoorWeather#set_station_callback_configuration.
182
195
  def get_station_callback_configuration
183
- send_request FUNCTION_GET_STATION_CALLBACK_CONFIGURATION, [], '', 1, '?'
196
+ check_validity
197
+
198
+ send_request FUNCTION_GET_STATION_CALLBACK_CONFIGURATION, [], '', 9, '?'
184
199
  end
185
200
 
186
201
  # Turns callback for sensor data on or off.
187
202
  def set_sensor_callback_configuration(enable_callback)
188
- send_request FUNCTION_SET_SENSOR_CALLBACK_CONFIGURATION, [enable_callback], '?', 0, ''
203
+ check_validity
204
+
205
+ send_request FUNCTION_SET_SENSOR_CALLBACK_CONFIGURATION, [enable_callback], '?', 8, ''
189
206
  end
190
207
 
191
208
  # Returns the configuration as set by BrickletOutdoorWeather#set_sensor_callback_configuration.
192
209
  def get_sensor_callback_configuration
193
- send_request FUNCTION_GET_SENSOR_CALLBACK_CONFIGURATION, [], '', 1, '?'
210
+ check_validity
211
+
212
+ send_request FUNCTION_GET_SENSOR_CALLBACK_CONFIGURATION, [], '', 9, '?'
194
213
  end
195
214
 
196
215
  # Returns the error count for the communication between Brick and Bricklet.
@@ -205,7 +224,9 @@ module Tinkerforge
205
224
  # The errors counts are for errors that occur on the Bricklet side. All
206
225
  # Bricks have a similar function that returns the errors on the Brick side.
207
226
  def get_spitfp_error_count
208
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
227
+ check_validity
228
+
229
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
209
230
  end
210
231
 
211
232
  # Sets the bootloader mode and returns the status after the requested
@@ -218,12 +239,16 @@ module Tinkerforge
218
239
  # This function is used by Brick Viewer during flashing. It should not be
219
240
  # necessary to call it in a normal user program.
220
241
  def set_bootloader_mode(mode)
221
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
242
+ check_validity
243
+
244
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
222
245
  end
223
246
 
224
247
  # Returns the current bootloader mode, see BrickletOutdoorWeather#set_bootloader_mode.
225
248
  def get_bootloader_mode
226
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
249
+ check_validity
250
+
251
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
227
252
  end
228
253
 
229
254
  # Sets the firmware pointer for BrickletOutdoorWeather#write_firmware. The pointer has
@@ -233,7 +258,9 @@ module Tinkerforge
233
258
  # This function is used by Brick Viewer during flashing. It should not be
234
259
  # necessary to call it in a normal user program.
235
260
  def set_write_firmware_pointer(pointer)
236
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
261
+ check_validity
262
+
263
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
237
264
  end
238
265
 
239
266
  # Writes 64 Bytes of firmware at the position as written by
@@ -245,7 +272,9 @@ module Tinkerforge
245
272
  # This function is used by Brick Viewer during flashing. It should not be
246
273
  # necessary to call it in a normal user program.
247
274
  def write_firmware(data)
248
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
275
+ check_validity
276
+
277
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
249
278
  end
250
279
 
251
280
  # Sets the status LED configuration. By default the LED shows
@@ -256,22 +285,28 @@ module Tinkerforge
256
285
  #
257
286
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
258
287
  def set_status_led_config(config)
259
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
288
+ check_validity
289
+
290
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
260
291
  end
261
292
 
262
293
  # Returns the configuration as set by BrickletOutdoorWeather#set_status_led_config
263
294
  def get_status_led_config
264
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
295
+ check_validity
296
+
297
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
265
298
  end
266
299
 
267
- # Returns the temperature in °C as measured inside the microcontroller. The
300
+ # Returns the temperature as measured inside the microcontroller. The
268
301
  # value returned is not the ambient temperature!
269
302
  #
270
303
  # The temperature is only proportional to the real temperature and it has bad
271
304
  # accuracy. Practically it is only useful as an indicator for
272
305
  # temperature changes.
273
306
  def get_chip_temperature
274
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
307
+ check_validity
308
+
309
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
275
310
  end
276
311
 
277
312
  # Calling this function will reset the Bricklet. All configurations
@@ -281,7 +316,9 @@ module Tinkerforge
281
316
  # calling functions on the existing ones will result in
282
317
  # undefined behavior!
283
318
  def reset
284
- send_request FUNCTION_RESET, [], '', 0, ''
319
+ check_validity
320
+
321
+ send_request FUNCTION_RESET, [], '', 8, ''
285
322
  end
286
323
 
287
324
  # Writes a new UID into flash. If you want to set a new UID
@@ -290,25 +327,32 @@ module Tinkerforge
290
327
  #
291
328
  # We recommend that you use Brick Viewer to change the UID.
292
329
  def write_uid(uid)
293
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
330
+ check_validity
331
+
332
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
294
333
  end
295
334
 
296
335
  # Returns the current UID as an integer. Encode as
297
336
  # Base58 to get the usual string version.
298
337
  def read_uid
299
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
338
+ check_validity
339
+
340
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
300
341
  end
301
342
 
302
343
  # Returns the UID, the UID where the Bricklet is connected to,
303
344
  # the position, the hardware and firmware version as well as the
304
345
  # device identifier.
305
346
  #
306
- # The position can be 'a', 'b', 'c' or 'd'.
347
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
348
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
349
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
350
+ # position 'z'.
307
351
  #
308
352
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
309
353
  # |device_identifier_constant|
310
354
  def get_identity
311
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
355
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
312
356
  end
313
357
 
314
358
  # Returns the identifiers (number between 0 and 255) of all `stations