tinkerforge 2.1.22 → 2.1.27

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 (144) hide show
  1. checksums.yaml +5 -5
  2. data/lib/tinkerforge/brick_dc.rb +157 -76
  3. data/lib/tinkerforge/brick_hat.rb +115 -32
  4. data/lib/tinkerforge/brick_hat_zero.rb +119 -21
  5. data/lib/tinkerforge/brick_imu.rb +192 -87
  6. data/lib/tinkerforge/brick_imu_v2.rb +220 -119
  7. data/lib/tinkerforge/brick_master.rb +498 -198
  8. data/lib/tinkerforge/brick_red.rb +197 -74
  9. data/lib/tinkerforge/brick_servo.rb +187 -103
  10. data/lib/tinkerforge/brick_silent_stepper.rb +249 -169
  11. data/lib/tinkerforge/brick_stepper.rb +214 -102
  12. data/lib/tinkerforge/bricklet_accelerometer.rb +61 -36
  13. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +167 -48
  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 +77 -49
  31. data/lib/tinkerforge/bricklet_color_v2.rb +493 -0
  32. data/lib/tinkerforge/bricklet_compass.rb +397 -0
  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 +335 -0
  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 +416 -0
  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 +101 -53
  77. data/lib/tinkerforge/bricklet_lcd_128x64.rb +241 -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 +371 -0
  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 +97 -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_piezo_buzzer.rb +19 -13
  102. data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -19
  103. data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +84 -57
  104. data/lib/tinkerforge/bricklet_ptc.rb +76 -51
  105. data/lib/tinkerforge/bricklet_ptc_v2.rb +96 -54
  106. data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -36
  107. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -47
  108. data/lib/tinkerforge/bricklet_remote_switch.rb +38 -29
  109. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +86 -49
  110. data/lib/tinkerforge/bricklet_rgb_led.rb +17 -8
  111. data/lib/tinkerforge/bricklet_rgb_led_button.rb +61 -30
  112. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +78 -33
  113. data/lib/tinkerforge/bricklet_rgb_led_v2.rb +51 -20
  114. data/lib/tinkerforge/bricklet_rotary_encoder.rb +40 -25
  115. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -27
  116. data/lib/tinkerforge/bricklet_rotary_poti.rb +55 -37
  117. data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +290 -0
  118. data/lib/tinkerforge/bricklet_rs232.rb +89 -28
  119. data/lib/tinkerforge/bricklet_rs232_v2.rb +121 -47
  120. data/lib/tinkerforge/bricklet_rs485.rb +303 -207
  121. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
  122. data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -36
  123. data/lib/tinkerforge/bricklet_solid_state_relay.rb +24 -13
  124. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +58 -25
  125. data/lib/tinkerforge/bricklet_sound_intensity.rb +36 -24
  126. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +77 -41
  127. data/lib/tinkerforge/bricklet_temperature.rb +43 -28
  128. data/lib/tinkerforge/bricklet_temperature_ir.rb +63 -47
  129. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +75 -53
  130. data/lib/tinkerforge/bricklet_temperature_v2.rb +62 -31
  131. data/lib/tinkerforge/bricklet_thermal_imaging.rb +118 -68
  132. data/lib/tinkerforge/bricklet_thermocouple.rb +46 -30
  133. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -30
  134. data/lib/tinkerforge/bricklet_tilt.rb +23 -10
  135. data/lib/tinkerforge/bricklet_uv_light.rb +37 -24
  136. data/lib/tinkerforge/bricklet_uv_light_v2.rb +87 -46
  137. data/lib/tinkerforge/bricklet_voltage.rb +54 -37
  138. data/lib/tinkerforge/bricklet_voltage_current.rb +94 -85
  139. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +103 -77
  140. data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +410 -0
  141. data/lib/tinkerforge/device_display_names.rb +165 -0
  142. data/lib/tinkerforge/ip_connection.rb +155 -33
  143. data/lib/tinkerforge/version.rb +1 -1
  144. metadata +14 -4
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-05-21. #
3
+ # This file was automatically generated on 2020-11-02. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.22 #
5
+ # Ruby Bindings Version 2.1.27 #
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,39 +65,45 @@ 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
- #
71
- # The columns have a range of 0 to 63 and the rows have a range of 0 to 5.
72
75
  def new_window(column_from, column_to, row_from, row_to)
73
- 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, ''
74
79
  end
75
80
 
76
81
  # Clears the current content of the window as set by BrickletOLED64x48#new_window.
77
82
  def clear_display
78
- send_request FUNCTION_CLEAR_DISPLAY, [], '', 0, ''
83
+ check_validity
84
+
85
+ send_request FUNCTION_CLEAR_DISPLAY, [], '', 8, ''
79
86
  end
80
87
 
81
88
  # Sets the configuration of the display.
82
89
  #
83
90
  # You can set a contrast value from 0 to 255 and you can invert the color
84
91
  # (black/white) of the display.
85
- #
86
- # The default values are contrast 143 and inverting off.
87
92
  def set_display_configuration(contrast, invert)
88
- 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, ''
89
96
  end
90
97
 
91
98
  # Returns the configuration as set by BrickletOLED64x48#set_display_configuration.
92
99
  def get_display_configuration
93
- send_request FUNCTION_GET_DISPLAY_CONFIGURATION, [], '', 2, 'C ?'
100
+ check_validity
101
+
102
+ send_request FUNCTION_GET_DISPLAY_CONFIGURATION, [], '', 10, 'C ?'
94
103
  end
95
104
 
96
- # Writes text to a specific line (0 to 5) with a specific position
97
- # (0 to 12). The text can have a maximum of 13 characters.
105
+ # Writes text to a specific line with a specific position.
106
+ # The text can have a maximum of 13 characters.
98
107
  #
99
108
  # For example: (1, 4, "Hello") will write *Hello* in the middle of the
100
109
  # second line of the display.
@@ -105,19 +114,23 @@ module Tinkerforge
105
114
  # The display uses a special 5x7 pixel charset. You can view the characters
106
115
  # of the charset in Brick Viewer.
107
116
  def write_line(line, position, text)
108
- 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, ''
109
120
  end
110
121
 
111
122
  # Returns the UID, the UID where the Bricklet is connected to,
112
123
  # the position, the hardware and firmware version as well as the
113
124
  # device identifier.
114
125
  #
115
- # 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'.
116
129
  #
117
130
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
118
131
  # |device_identifier_constant|
119
132
  def get_identity
120
- 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'
121
134
  end
122
135
 
123
136
  end
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-05-21. #
3
+ # This file was automatically generated on 2020-11-02. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.22 #
5
+ # Ruby Bindings Version 2.1.27 #
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-05-21. #
3
+ # This file was automatically generated on 2020-11-02. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.22 #
5
+ # Ruby Bindings Version 2.1.27 #
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
@@ -27,7 +29,7 @@ module Tinkerforge
27
29
  # Reports the sensor data every time a new data packet is received.
28
30
  # See BrickletOutdoorWeather#get_sensor_data for information about the data.
29
31
  #
30
- # For each station the callback will be called about every 45 seconds.
32
+ # For each sensor the callback will be called about every 45 seconds.
31
33
  #
32
34
  # Turn the callback on/off with BrickletOutdoorWeather#set_sensor_callback_configuration
33
35
  # (by default it is turned off).
@@ -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.
@@ -149,16 +156,18 @@ module Tinkerforge
149
156
  #
150
157
  # The return values are:
151
158
  #
152
- # * Temperature in °C/10,
153
- # * Humidity in %RH,
154
- # * Wind Speed in m/10s,
155
- # * Gust Speed in m/10s,
156
- # * Rain Fall in mm/10,
157
- # * Wind Direction (N, NNE, NE, ENE, E, ESE, SE, SSE, S, SSW, SW, WSW, W, WNW, NW, NNW),
158
- # * Battery Low (true or false) and
159
- # * Last Change (time in seconds since the reception of this data).
159
+ # * Temperature,
160
+ # * Humidity,
161
+ # * Wind Speed,
162
+ # * Gust Speed,
163
+ # * Rain Fall (accumulated since station power-up),
164
+ # * Wind Direction,
165
+ # * Battery Low (true if battery is low) and
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.
@@ -166,31 +175,41 @@ module Tinkerforge
166
175
  #
167
176
  # The return values are:
168
177
  #
169
- # * Temperature in °C/10,
170
- # * Humidity in %RH and
171
- # * Last Change (time in seconds since the last reception of data).
178
+ # * Temperature,
179
+ # * Humidity and
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
- # Turns callback for station data on or off. Default is off.
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
- # Turns callback for sensor data on or off. Default is off.
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