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
  # Two tactile buttons with built-in blue LEDs
14
16
  class BrickletDualButton < Device
@@ -48,7 +50,7 @@ module Tinkerforge
48
50
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
49
51
  # the IP Connection <tt>ipcon</tt>.
50
52
  def initialize(uid, ipcon)
51
- super uid, ipcon
53
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
52
54
 
53
55
  @api_version = [2, 0, 0]
54
56
 
@@ -58,8 +60,9 @@ module Tinkerforge
58
60
  @response_expected[FUNCTION_SET_SELECTED_LED_STATE] = RESPONSE_EXPECTED_FALSE
59
61
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
60
62
 
61
- @callback_formats[CALLBACK_STATE_CHANGED] = 'C C C C'
63
+ @callback_formats[CALLBACK_STATE_CHANGED] = [12, 'C C C C']
62
64
 
65
+ @ipcon.add_device self
63
66
  end
64
67
 
65
68
  # Sets the state of the LEDs. Possible states are:
@@ -75,12 +78,16 @@ module Tinkerforge
75
78
  # of the other LED, you can get the state with BrickletDualButton#get_led_state or you
76
79
  # can use BrickletDualButton#set_selected_led_state.
77
80
  def set_led_state(led_l, led_r)
78
- send_request FUNCTION_SET_LED_STATE, [led_l, led_r], 'C C', 0, ''
81
+ check_validity
82
+
83
+ send_request FUNCTION_SET_LED_STATE, [led_l, led_r], 'C C', 8, ''
79
84
  end
80
85
 
81
86
  # Returns the current state of the LEDs, as set by BrickletDualButton#set_led_state.
82
87
  def get_led_state
83
- send_request FUNCTION_GET_LED_STATE, [], '', 2, 'C C'
88
+ check_validity
89
+
90
+ send_request FUNCTION_GET_LED_STATE, [], '', 10, 'C C'
84
91
  end
85
92
 
86
93
  # Returns the current state for both buttons. Possible states are:
@@ -88,26 +95,32 @@ module Tinkerforge
88
95
  # * 0 = pressed
89
96
  # * 1 = released
90
97
  def get_button_state
91
- send_request FUNCTION_GET_BUTTON_STATE, [], '', 2, 'C C'
98
+ check_validity
99
+
100
+ send_request FUNCTION_GET_BUTTON_STATE, [], '', 10, 'C C'
92
101
  end
93
102
 
94
103
  # Sets the state of the selected LED (0 or 1).
95
104
  #
96
105
  # The other LED remains untouched.
97
106
  def set_selected_led_state(led, state)
98
- send_request FUNCTION_SET_SELECTED_LED_STATE, [led, state], 'C C', 0, ''
107
+ check_validity
108
+
109
+ send_request FUNCTION_SET_SELECTED_LED_STATE, [led, state], 'C C', 8, ''
99
110
  end
100
111
 
101
112
  # Returns the UID, the UID where the Bricklet is connected to,
102
113
  # the position, the hardware and firmware version as well as the
103
114
  # device identifier.
104
115
  #
105
- # The position can be 'a', 'b', 'c' or 'd'.
116
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
117
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
118
+ # position 'z'.
106
119
  #
107
120
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
108
121
  # |device_identifier_constant|
109
122
  def get_identity
110
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
123
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
111
124
  end
112
125
 
113
126
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-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
  # Two tactile buttons with built-in blue LEDs
14
16
  class BrickletDualButtonV2 < Device
@@ -78,7 +80,7 @@ module Tinkerforge
78
80
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
79
81
  # the IP Connection <tt>ipcon</tt>.
80
82
  def initialize(uid, ipcon)
81
- super uid, ipcon
83
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
82
84
 
83
85
  @api_version = [2, 0, 0]
84
86
 
@@ -101,8 +103,9 @@ module Tinkerforge
101
103
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
102
104
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
103
105
 
104
- @callback_formats[CALLBACK_STATE_CHANGED] = 'C C C C'
106
+ @callback_formats[CALLBACK_STATE_CHANGED] = [12, 'C C C C']
105
107
 
108
+ @ipcon.add_device self
106
109
  end
107
110
 
108
111
  # Sets the state of the LEDs. Possible states are:
@@ -118,12 +121,16 @@ module Tinkerforge
118
121
  # of the other LED, you can get the state with BrickletDualButtonV2#get_led_state or you
119
122
  # can use BrickletDualButtonV2#set_selected_led_state.
120
123
  def set_led_state(led_l, led_r)
121
- send_request FUNCTION_SET_LED_STATE, [led_l, led_r], 'C C', 0, ''
124
+ check_validity
125
+
126
+ send_request FUNCTION_SET_LED_STATE, [led_l, led_r], 'C C', 8, ''
122
127
  end
123
128
 
124
129
  # Returns the current state of the LEDs, as set by BrickletDualButtonV2#set_led_state.
125
130
  def get_led_state
126
- send_request FUNCTION_GET_LED_STATE, [], '', 2, 'C C'
131
+ check_validity
132
+
133
+ send_request FUNCTION_GET_LED_STATE, [], '', 10, 'C C'
127
134
  end
128
135
 
129
136
  # Returns the current state for both buttons. Possible states are:
@@ -131,25 +138,33 @@ module Tinkerforge
131
138
  # * 0 = pressed
132
139
  # * 1 = released
133
140
  def get_button_state
134
- send_request FUNCTION_GET_BUTTON_STATE, [], '', 2, 'C C'
141
+ check_validity
142
+
143
+ send_request FUNCTION_GET_BUTTON_STATE, [], '', 10, 'C C'
135
144
  end
136
145
 
137
146
  # Sets the state of the selected LED.
138
147
  #
139
148
  # The other LED remains untouched.
140
149
  def set_selected_led_state(led, state)
141
- send_request FUNCTION_SET_SELECTED_LED_STATE, [led, state], 'C C', 0, ''
150
+ check_validity
151
+
152
+ send_request FUNCTION_SET_SELECTED_LED_STATE, [led, state], 'C C', 8, ''
142
153
  end
143
154
 
144
155
  # If you enable this callback, the CALLBACK_STATE_CHANGED callback is triggered
145
156
  # every time a button is pressed/released
146
157
  def set_state_changed_callback_configuration(enabled)
147
- send_request FUNCTION_SET_STATE_CHANGED_CALLBACK_CONFIGURATION, [enabled], '?', 0, ''
158
+ check_validity
159
+
160
+ send_request FUNCTION_SET_STATE_CHANGED_CALLBACK_CONFIGURATION, [enabled], '?', 8, ''
148
161
  end
149
162
 
150
163
  # Returns the configuration as set by BrickletDualButtonV2#set_state_changed_callback_configuration.
151
164
  def get_state_changed_callback_configuration
152
- send_request FUNCTION_GET_STATE_CHANGED_CALLBACK_CONFIGURATION, [], '', 1, '?'
165
+ check_validity
166
+
167
+ send_request FUNCTION_GET_STATE_CHANGED_CALLBACK_CONFIGURATION, [], '', 9, '?'
153
168
  end
154
169
 
155
170
  # Returns the error count for the communication between Brick and Bricklet.
@@ -164,7 +179,9 @@ module Tinkerforge
164
179
  # The errors counts are for errors that occur on the Bricklet side. All
165
180
  # Bricks have a similar function that returns the errors on the Brick side.
166
181
  def get_spitfp_error_count
167
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
182
+ check_validity
183
+
184
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
168
185
  end
169
186
 
170
187
  # Sets the bootloader mode and returns the status after the requested
@@ -177,12 +194,16 @@ module Tinkerforge
177
194
  # This function is used by Brick Viewer during flashing. It should not be
178
195
  # necessary to call it in a normal user program.
179
196
  def set_bootloader_mode(mode)
180
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
197
+ check_validity
198
+
199
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
181
200
  end
182
201
 
183
202
  # Returns the current bootloader mode, see BrickletDualButtonV2#set_bootloader_mode.
184
203
  def get_bootloader_mode
185
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
204
+ check_validity
205
+
206
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
186
207
  end
187
208
 
188
209
  # Sets the firmware pointer for BrickletDualButtonV2#write_firmware. The pointer has
@@ -192,7 +213,9 @@ module Tinkerforge
192
213
  # This function is used by Brick Viewer during flashing. It should not be
193
214
  # necessary to call it in a normal user program.
194
215
  def set_write_firmware_pointer(pointer)
195
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
216
+ check_validity
217
+
218
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
196
219
  end
197
220
 
198
221
  # Writes 64 Bytes of firmware at the position as written by
@@ -204,7 +227,9 @@ module Tinkerforge
204
227
  # This function is used by Brick Viewer during flashing. It should not be
205
228
  # necessary to call it in a normal user program.
206
229
  def write_firmware(data)
207
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
230
+ check_validity
231
+
232
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
208
233
  end
209
234
 
210
235
  # Sets the status LED configuration. By default the LED shows
@@ -215,22 +240,28 @@ module Tinkerforge
215
240
  #
216
241
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
217
242
  def set_status_led_config(config)
218
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
243
+ check_validity
244
+
245
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
219
246
  end
220
247
 
221
248
  # Returns the configuration as set by BrickletDualButtonV2#set_status_led_config
222
249
  def get_status_led_config
223
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
250
+ check_validity
251
+
252
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
224
253
  end
225
254
 
226
- # Returns the temperature in °C as measured inside the microcontroller. The
255
+ # Returns the temperature as measured inside the microcontroller. The
227
256
  # value returned is not the ambient temperature!
228
257
  #
229
258
  # The temperature is only proportional to the real temperature and it has bad
230
259
  # accuracy. Practically it is only useful as an indicator for
231
260
  # temperature changes.
232
261
  def get_chip_temperature
233
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
262
+ check_validity
263
+
264
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
234
265
  end
235
266
 
236
267
  # Calling this function will reset the Bricklet. All configurations
@@ -240,7 +271,9 @@ module Tinkerforge
240
271
  # calling functions on the existing ones will result in
241
272
  # undefined behavior!
242
273
  def reset
243
- send_request FUNCTION_RESET, [], '', 0, ''
274
+ check_validity
275
+
276
+ send_request FUNCTION_RESET, [], '', 8, ''
244
277
  end
245
278
 
246
279
  # Writes a new UID into flash. If you want to set a new UID
@@ -249,25 +282,31 @@ module Tinkerforge
249
282
  #
250
283
  # We recommend that you use Brick Viewer to change the UID.
251
284
  def write_uid(uid)
252
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
285
+ check_validity
286
+
287
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
253
288
  end
254
289
 
255
290
  # Returns the current UID as an integer. Encode as
256
291
  # Base58 to get the usual string version.
257
292
  def read_uid
258
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
293
+ check_validity
294
+
295
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
259
296
  end
260
297
 
261
298
  # Returns the UID, the UID where the Bricklet is connected to,
262
299
  # the position, the hardware and firmware version as well as the
263
300
  # device identifier.
264
301
  #
265
- # The position can be 'a', 'b', 'c' or 'd'.
302
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
303
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
304
+ # position 'z'.
266
305
  #
267
306
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
268
307
  # |device_identifier_constant|
269
308
  def get_identity
270
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
309
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
271
310
  end
272
311
 
273
312
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-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
  # Two relays to switch AC/DC devices
14
16
  class BrickletDualRelay < Device
@@ -31,7 +33,7 @@ module Tinkerforge
31
33
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
32
34
  # the IP Connection <tt>ipcon</tt>.
33
35
  def initialize(uid, ipcon)
34
- super uid, ipcon
36
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
35
37
 
36
38
  @api_version = [2, 0, 0]
37
39
 
@@ -42,8 +44,9 @@ module Tinkerforge
42
44
  @response_expected[FUNCTION_SET_SELECTED_STATE] = RESPONSE_EXPECTED_FALSE
43
45
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
44
46
 
45
- @callback_formats[CALLBACK_MONOFLOP_DONE] = 'C ?'
47
+ @callback_formats[CALLBACK_MONOFLOP_DONE] = [10, 'C ?']
46
48
 
49
+ @ipcon.add_device self
47
50
  end
48
51
 
49
52
  # Sets the state of the relays, *true* means on and *false* means off.
@@ -55,12 +58,16 @@ module Tinkerforge
55
58
  #
56
59
  # All running monoflop timers will be aborted if this function is called.
57
60
  def set_state(relay1, relay2)
58
- send_request FUNCTION_SET_STATE, [relay1, relay2], '? ?', 0, ''
61
+ check_validity
62
+
63
+ send_request FUNCTION_SET_STATE, [relay1, relay2], '? ?', 8, ''
59
64
  end
60
65
 
61
66
  # Returns the state of the relays, *true* means on and *false* means off.
62
67
  def get_state
63
- send_request FUNCTION_GET_STATE, [], '', 2, '? ?'
68
+ check_validity
69
+
70
+ send_request FUNCTION_GET_STATE, [], '', 10, '? ?'
64
71
  end
65
72
 
66
73
  # The first parameter can be 1 or 2 (relay 1 or relay 2). The second parameter
@@ -77,7 +84,9 @@ module Tinkerforge
77
84
  # of two seconds. The relay will be on all the time. If now the RS485
78
85
  # connection is lost, the relay will turn off in at most two seconds.
79
86
  def set_monoflop(relay, state, time)
80
- send_request FUNCTION_SET_MONOFLOP, [relay, state, time], 'C ? L', 0, ''
87
+ check_validity
88
+
89
+ send_request FUNCTION_SET_MONOFLOP, [relay, state, time], 'C ? L', 8, ''
81
90
  end
82
91
 
83
92
  # Returns (for the given relay) the current state and the time as set by
@@ -86,7 +95,9 @@ module Tinkerforge
86
95
  # If the timer is not running currently, the remaining time will be returned
87
96
  # as 0.
88
97
  def get_monoflop(relay)
89
- send_request FUNCTION_GET_MONOFLOP, [relay], 'C', 9, '? L L'
98
+ check_validity
99
+
100
+ send_request FUNCTION_GET_MONOFLOP, [relay], 'C', 17, '? L L'
90
101
  end
91
102
 
92
103
  # Sets the state of the selected relay (1 or 2), *true* means on and *false* means off.
@@ -95,19 +106,23 @@ module Tinkerforge
95
106
  #
96
107
  # The other relay remains untouched.
97
108
  def set_selected_state(relay, state)
98
- send_request FUNCTION_SET_SELECTED_STATE, [relay, state], 'C ?', 0, ''
109
+ check_validity
110
+
111
+ send_request FUNCTION_SET_SELECTED_STATE, [relay, state], 'C ?', 8, ''
99
112
  end
100
113
 
101
114
  # Returns the UID, the UID where the Bricklet is connected to,
102
115
  # the position, the hardware and firmware version as well as the
103
116
  # device identifier.
104
117
  #
105
- # The position can be 'a', 'b', 'c' or 'd'.
118
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
119
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
120
+ # position 'z'.
106
121
  #
107
122
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
108
123
  # |device_identifier_constant|
109
124
  def get_identity
110
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
125
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
111
126
  end
112
127
 
113
128
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-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
  # Measures dust density
14
16
  class BrickletDustDetector < Device
@@ -51,7 +53,7 @@ module Tinkerforge
51
53
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
52
54
  # the IP Connection <tt>ipcon</tt>.
53
55
  def initialize(uid, ipcon)
54
- super uid, ipcon
56
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
55
57
 
56
58
  @api_version = [2, 0, 0]
57
59
 
@@ -66,9 +68,10 @@ module Tinkerforge
66
68
  @response_expected[FUNCTION_GET_MOVING_AVERAGE] = RESPONSE_EXPECTED_ALWAYS_TRUE
67
69
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
68
70
 
69
- @callback_formats[CALLBACK_DUST_DENSITY] = 'S'
70
- @callback_formats[CALLBACK_DUST_DENSITY_REACHED] = 'S'
71
+ @callback_formats[CALLBACK_DUST_DENSITY] = [10, 'S']
72
+ @callback_formats[CALLBACK_DUST_DENSITY_REACHED] = [10, 'S']
71
73
 
74
+ @ipcon.add_device self
72
75
  end
73
76
 
74
77
  # Returns the dust density.
@@ -77,7 +80,9 @@ module Tinkerforge
77
80
  # to use the CALLBACK_DUST_DENSITY callback and set the period with
78
81
  # BrickletDustDetector#set_dust_density_callback_period.
79
82
  def get_dust_density
80
- send_request FUNCTION_GET_DUST_DENSITY, [], '', 2, 'S'
83
+ check_validity
84
+
85
+ send_request FUNCTION_GET_DUST_DENSITY, [], '', 10, 'S'
81
86
  end
82
87
 
83
88
  # Sets the period with which the CALLBACK_DUST_DENSITY callback is triggered
@@ -86,12 +91,16 @@ module Tinkerforge
86
91
  # The CALLBACK_DUST_DENSITY callback is only triggered if the dust density has
87
92
  # changed since the last triggering.
88
93
  def set_dust_density_callback_period(period)
89
- send_request FUNCTION_SET_DUST_DENSITY_CALLBACK_PERIOD, [period], 'L', 0, ''
94
+ check_validity
95
+
96
+ send_request FUNCTION_SET_DUST_DENSITY_CALLBACK_PERIOD, [period], 'L', 8, ''
90
97
  end
91
98
 
92
99
  # Returns the period as set by BrickletDustDetector#set_dust_density_callback_period.
93
100
  def get_dust_density_callback_period
94
- send_request FUNCTION_GET_DUST_DENSITY_CALLBACK_PERIOD, [], '', 4, 'L'
101
+ check_validity
102
+
103
+ send_request FUNCTION_GET_DUST_DENSITY_CALLBACK_PERIOD, [], '', 12, 'L'
95
104
  end
96
105
 
97
106
  # Sets the thresholds for the CALLBACK_DUST_DENSITY_REACHED callback.
@@ -106,12 +115,16 @@ module Tinkerforge
106
115
  # "'<'", "Callback is triggered when the dust density value is smaller than the min value (max is ignored)"
107
116
  # "'>'", "Callback is triggered when the dust density value is greater than the min value (max is ignored)"
108
117
  def set_dust_density_callback_threshold(option, min, max)
109
- send_request FUNCTION_SET_DUST_DENSITY_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
118
+ check_validity
119
+
120
+ send_request FUNCTION_SET_DUST_DENSITY_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
110
121
  end
111
122
 
112
123
  # Returns the threshold as set by BrickletDustDetector#set_dust_density_callback_threshold.
113
124
  def get_dust_density_callback_threshold
114
- send_request FUNCTION_GET_DUST_DENSITY_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
125
+ check_validity
126
+
127
+ send_request FUNCTION_GET_DUST_DENSITY_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
115
128
  end
116
129
 
117
130
  # Sets the period with which the threshold callback
@@ -124,12 +137,16 @@ module Tinkerforge
124
137
  #
125
138
  # keeps being reached.
126
139
  def set_debounce_period(debounce)
127
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
140
+ check_validity
141
+
142
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
128
143
  end
129
144
 
130
145
  # Returns the debounce period as set by BrickletDustDetector#set_debounce_period.
131
146
  def get_debounce_period
132
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
147
+ check_validity
148
+
149
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
133
150
  end
134
151
 
135
152
  # Sets the length of a `moving averaging <https://en.wikipedia.org/wiki/Moving_average>`__
@@ -138,24 +155,30 @@ module Tinkerforge
138
155
  # Setting the length to 0 will turn the averaging completely off. With less
139
156
  # averaging, there is more noise on the data.
140
157
  def set_moving_average(average)
141
- send_request FUNCTION_SET_MOVING_AVERAGE, [average], 'C', 0, ''
158
+ check_validity
159
+
160
+ send_request FUNCTION_SET_MOVING_AVERAGE, [average], 'C', 8, ''
142
161
  end
143
162
 
144
163
  # Returns the length moving average as set by BrickletDustDetector#set_moving_average.
145
164
  def get_moving_average
146
- send_request FUNCTION_GET_MOVING_AVERAGE, [], '', 1, 'C'
165
+ check_validity
166
+
167
+ send_request FUNCTION_GET_MOVING_AVERAGE, [], '', 9, 'C'
147
168
  end
148
169
 
149
170
  # Returns the UID, the UID where the Bricklet is connected to,
150
171
  # the position, the hardware and firmware version as well as the
151
172
  # device identifier.
152
173
  #
153
- # The position can be 'a', 'b', 'c' or 'd'.
174
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
175
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
176
+ # position 'z'.
154
177
  #
155
178
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
156
179
  # |device_identifier_constant|
157
180
  def get_identity
158
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
181
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
159
182
  end
160
183
 
161
184
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.