tinkerforge 2.1.24 → 2.1.29

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +5 -5
  2. data/lib/tinkerforge/brick_dc.rb +156 -75
  3. data/lib/tinkerforge/brick_hat.rb +69 -31
  4. data/lib/tinkerforge/brick_hat_zero.rb +55 -23
  5. data/lib/tinkerforge/brick_imu.rb +185 -78
  6. data/lib/tinkerforge/brick_imu_v2.rb +209 -106
  7. data/lib/tinkerforge/brick_master.rb +491 -183
  8. data/lib/tinkerforge/brick_red.rb +197 -74
  9. data/lib/tinkerforge/brick_servo.rb +186 -102
  10. data/lib/tinkerforge/brick_silent_stepper.rb +247 -167
  11. data/lib/tinkerforge/brick_stepper.rb +211 -99
  12. data/lib/tinkerforge/bricklet_accelerometer.rb +57 -23
  13. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +104 -54
  14. data/lib/tinkerforge/bricklet_air_quality.rb +116 -59
  15. data/lib/tinkerforge/bricklet_ambient_light.rb +50 -21
  16. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +44 -24
  17. data/lib/tinkerforge/bricklet_ambient_light_v3.rb +65 -27
  18. data/lib/tinkerforge/bricklet_analog_in.rb +62 -25
  19. data/lib/tinkerforge/bricklet_analog_in_v2.rb +56 -23
  20. data/lib/tinkerforge/bricklet_analog_in_v3.rb +66 -25
  21. data/lib/tinkerforge/bricklet_analog_out.rb +22 -9
  22. data/lib/tinkerforge/bricklet_analog_out_v2.rb +19 -8
  23. data/lib/tinkerforge/bricklet_analog_out_v3.rb +53 -20
  24. data/lib/tinkerforge/bricklet_barometer.rb +100 -27
  25. data/lib/tinkerforge/bricklet_barometer_v2.rb +98 -37
  26. data/lib/tinkerforge/bricklet_can.rb +83 -19
  27. data/lib/tinkerforge/bricklet_can_v2.rb +171 -38
  28. data/lib/tinkerforge/bricklet_co2.rb +33 -14
  29. data/lib/tinkerforge/bricklet_co2_v2.rb +97 -38
  30. data/lib/tinkerforge/bricklet_color.rb +68 -27
  31. data/lib/tinkerforge/bricklet_color_v2.rb +86 -33
  32. data/lib/tinkerforge/bricklet_compass.rb +77 -30
  33. data/lib/tinkerforge/bricklet_current12.rb +57 -24
  34. data/lib/tinkerforge/bricklet_current25.rb +57 -24
  35. data/lib/tinkerforge/bricklet_dc_v2.rb +521 -0
  36. data/lib/tinkerforge/bricklet_distance_ir.rb +56 -23
  37. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +82 -31
  38. data/lib/tinkerforge/bricklet_distance_us.rb +39 -16
  39. data/lib/tinkerforge/bricklet_distance_us_v2.rb +66 -25
  40. data/lib/tinkerforge/bricklet_dmx.rb +87 -34
  41. data/lib/tinkerforge/bricklet_dual_button.rb +23 -10
  42. data/lib/tinkerforge/bricklet_dual_button_v2.rb +63 -24
  43. data/lib/tinkerforge/bricklet_dual_relay.rb +26 -11
  44. data/lib/tinkerforge/bricklet_dust_detector.rb +39 -16
  45. data/lib/tinkerforge/bricklet_e_paper_296x128.rb +87 -32
  46. data/lib/tinkerforge/bricklet_energy_monitor.rb +72 -27
  47. data/lib/tinkerforge/bricklet_gps.rb +63 -26
  48. data/lib/tinkerforge/bricklet_gps_v2.rb +116 -47
  49. data/lib/tinkerforge/bricklet_hall_effect.rb +42 -23
  50. data/lib/tinkerforge/bricklet_hall_effect_v2.rb +70 -27
  51. data/lib/tinkerforge/bricklet_humidity.rb +50 -21
  52. data/lib/tinkerforge/bricklet_humidity_v2.rb +82 -31
  53. data/lib/tinkerforge/bricklet_imu_v3.rb +784 -0
  54. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +37 -14
  55. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +80 -29
  56. data/lib/tinkerforge/bricklet_industrial_counter.rb +100 -39
  57. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +44 -17
  58. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +76 -29
  59. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +35 -14
  60. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +72 -27
  61. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +39 -16
  62. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +79 -30
  63. data/lib/tinkerforge/bricklet_industrial_dual_ac_relay.rb +325 -0
  64. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +48 -19
  65. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +137 -31
  66. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +60 -23
  67. data/lib/tinkerforge/bricklet_industrial_ptc.rb +475 -0
  68. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +35 -14
  69. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +66 -25
  70. data/lib/tinkerforge/bricklet_io16.rb +54 -21
  71. data/lib/tinkerforge/bricklet_io16_v2.rb +89 -34
  72. data/lib/tinkerforge/bricklet_io4.rb +54 -23
  73. data/lib/tinkerforge/bricklet_io4_v2.rb +95 -36
  74. data/lib/tinkerforge/bricklet_isolator.rb +72 -29
  75. data/lib/tinkerforge/bricklet_joystick.rb +58 -25
  76. data/lib/tinkerforge/bricklet_joystick_v2.rb +67 -26
  77. data/lib/tinkerforge/bricklet_laser_range_finder.rb +81 -32
  78. data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +95 -36
  79. data/lib/tinkerforge/bricklet_lcd_128x64.rb +191 -70
  80. data/lib/tinkerforge/bricklet_lcd_16x2.rb +44 -18
  81. data/lib/tinkerforge/bricklet_lcd_20x4.rb +57 -23
  82. data/lib/tinkerforge/bricklet_led_strip.rb +59 -22
  83. data/lib/tinkerforge/bricklet_led_strip_v2.rb +90 -46
  84. data/lib/tinkerforge/bricklet_line.rb +33 -14
  85. data/lib/tinkerforge/bricklet_linear_poti.rb +50 -21
  86. data/lib/tinkerforge/bricklet_linear_poti_v2.rb +54 -21
  87. data/lib/tinkerforge/bricklet_load_cell.rb +60 -23
  88. data/lib/tinkerforge/bricklet_load_cell_v2.rb +79 -30
  89. data/lib/tinkerforge/bricklet_moisture.rb +39 -16
  90. data/lib/tinkerforge/bricklet_motion_detector.rb +21 -10
  91. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +61 -27
  92. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +70 -27
  93. data/lib/tinkerforge/bricklet_multi_touch.rb +30 -13
  94. data/lib/tinkerforge/bricklet_multi_touch_v2.rb +75 -28
  95. data/lib/tinkerforge/bricklet_nfc.rb +126 -62
  96. data/lib/tinkerforge/bricklet_nfc_rfid.rb +32 -13
  97. data/lib/tinkerforge/bricklet_oled_128x64.rb +28 -11
  98. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +65 -24
  99. data/lib/tinkerforge/bricklet_oled_64x48.rb +28 -11
  100. data/lib/tinkerforge/bricklet_one_wire.rb +65 -24
  101. data/lib/tinkerforge/bricklet_outdoor_weather.rb +71 -28
  102. data/lib/tinkerforge/bricklet_particulate_matter.rb +74 -30
  103. data/lib/tinkerforge/bricklet_performance_dc.rb +682 -0
  104. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +18 -9
  105. data/lib/tinkerforge/bricklet_piezo_speaker.rb +21 -10
  106. data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +79 -42
  107. data/lib/tinkerforge/bricklet_ptc.rb +73 -42
  108. data/lib/tinkerforge/bricklet_ptc_v2.rb +94 -48
  109. data/lib/tinkerforge/bricklet_real_time_clock.rb +44 -33
  110. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +77 -44
  111. data/lib/tinkerforge/bricklet_remote_switch.rb +38 -29
  112. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +86 -49
  113. data/lib/tinkerforge/bricklet_rgb_led.rb +17 -8
  114. data/lib/tinkerforge/bricklet_rgb_led_button.rb +61 -30
  115. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +78 -33
  116. data/lib/tinkerforge/bricklet_rgb_led_v2.rb +51 -20
  117. data/lib/tinkerforge/bricklet_rotary_encoder.rb +38 -19
  118. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +59 -24
  119. data/lib/tinkerforge/bricklet_rotary_poti.rb +52 -28
  120. data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +56 -23
  121. data/lib/tinkerforge/bricklet_rs232.rb +89 -28
  122. data/lib/tinkerforge/bricklet_rs232_v2.rb +117 -44
  123. data/lib/tinkerforge/bricklet_rs485.rb +222 -95
  124. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
  125. data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +74 -35
  126. data/lib/tinkerforge/bricklet_servo_v2.rb +565 -0
  127. data/lib/tinkerforge/bricklet_silent_stepper_v2.rb +1024 -0
  128. data/lib/tinkerforge/bricklet_solid_state_relay.rb +24 -13
  129. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +58 -25
  130. data/lib/tinkerforge/bricklet_sound_intensity.rb +34 -18
  131. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +71 -31
  132. data/lib/tinkerforge/bricklet_temperature.rb +39 -16
  133. data/lib/tinkerforge/bricklet_temperature_ir.rb +56 -23
  134. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +70 -27
  135. data/lib/tinkerforge/bricklet_temperature_v2.rb +60 -25
  136. data/lib/tinkerforge/bricklet_thermal_imaging.rb +104 -44
  137. data/lib/tinkerforge/bricklet_thermocouple.rb +44 -24
  138. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +64 -27
  139. data/lib/tinkerforge/bricklet_tilt.rb +23 -10
  140. data/lib/tinkerforge/bricklet_uv_light.rb +35 -18
  141. data/lib/tinkerforge/bricklet_uv_light_v2.rb +84 -37
  142. data/lib/tinkerforge/bricklet_voltage.rb +51 -28
  143. data/lib/tinkerforge/bricklet_voltage_current.rb +90 -73
  144. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +89 -68
  145. data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +79 -30
  146. data/lib/tinkerforge/device_display_names.rb +170 -0
  147. data/lib/tinkerforge/ip_connection.rb +153 -33
  148. data/lib/tinkerforge/version.rb +1 -1
  149. metadata +11 -3
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-11-25. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.29 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # 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,23 @@ 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
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
128
+ # position 'z'.
112
129
  #
113
130
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
114
131
  # |device_identifier_constant|
115
132
  def get_identity
116
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
133
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
117
134
  end
118
135
 
119
136
  end
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-11-25. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.29 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # 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,31 @@ 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
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
296
+ # position 'z'.
256
297
  #
257
298
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
258
299
  # |device_identifier_constant|
259
300
  def get_identity
260
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
301
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
261
302
  end
262
303
 
263
304
  # 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 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.29 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # 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.
@@ -153,12 +160,14 @@ module Tinkerforge
153
160
  # * Humidity,
154
161
  # * Wind Speed,
155
162
  # * Gust Speed,
156
- # * Rain Fall,
163
+ # * Rain Fall (accumulated since station power-up),
157
164
  # * Wind Direction,
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,31 @@ 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
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
349
+ # position 'z'.
307
350
  #
308
351
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
309
352
  # |device_identifier_constant|
310
353
  def get_identity
311
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
354
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
312
355
  end
313
356
 
314
357
  # Returns the identifiers (number between 0 and 255) of all `stations