tinkerforge 2.1.24 → 2.1.25

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tinkerforge/brick_dc.rb +155 -74
  3. data/lib/tinkerforge/brick_hat.rb +70 -30
  4. data/lib/tinkerforge/brick_hat_zero.rb +56 -22
  5. data/lib/tinkerforge/brick_imu.rb +184 -77
  6. data/lib/tinkerforge/brick_imu_v2.rb +208 -105
  7. data/lib/tinkerforge/brick_master.rb +484 -182
  8. data/lib/tinkerforge/brick_red.rb +197 -74
  9. data/lib/tinkerforge/brick_servo.rb +185 -101
  10. data/lib/tinkerforge/brick_silent_stepper.rb +246 -166
  11. data/lib/tinkerforge/brick_stepper.rb +210 -98
  12. data/lib/tinkerforge/bricklet_accelerometer.rb +58 -23
  13. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +105 -54
  14. data/lib/tinkerforge/bricklet_air_quality.rb +117 -59
  15. data/lib/tinkerforge/bricklet_ambient_light.rb +51 -21
  16. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +40 -22
  17. data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -25
  18. data/lib/tinkerforge/bricklet_analog_in.rb +63 -25
  19. data/lib/tinkerforge/bricklet_analog_in_v2.rb +57 -23
  20. data/lib/tinkerforge/bricklet_analog_in_v3.rb +67 -25
  21. data/lib/tinkerforge/bricklet_analog_out.rb +23 -9
  22. data/lib/tinkerforge/bricklet_analog_out_v2.rb +20 -8
  23. data/lib/tinkerforge/bricklet_analog_out_v3.rb +54 -20
  24. data/lib/tinkerforge/bricklet_barometer.rb +66 -26
  25. data/lib/tinkerforge/bricklet_barometer_v2.rb +99 -37
  26. data/lib/tinkerforge/bricklet_can.rb +83 -18
  27. data/lib/tinkerforge/bricklet_can_v2.rb +172 -38
  28. data/lib/tinkerforge/bricklet_co2.rb +34 -14
  29. data/lib/tinkerforge/bricklet_co2_v2.rb +97 -37
  30. data/lib/tinkerforge/bricklet_color.rb +69 -27
  31. data/lib/tinkerforge/bricklet_color_v2.rb +87 -33
  32. data/lib/tinkerforge/bricklet_compass.rb +78 -30
  33. data/lib/tinkerforge/bricklet_current12.rb +58 -24
  34. data/lib/tinkerforge/bricklet_current25.rb +58 -24
  35. data/lib/tinkerforge/bricklet_distance_ir.rb +57 -23
  36. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +83 -31
  37. data/lib/tinkerforge/bricklet_distance_us.rb +40 -16
  38. data/lib/tinkerforge/bricklet_distance_us_v2.rb +67 -25
  39. data/lib/tinkerforge/bricklet_dmx.rb +88 -34
  40. data/lib/tinkerforge/bricklet_dual_button.rb +24 -10
  41. data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -24
  42. data/lib/tinkerforge/bricklet_dual_relay.rb +27 -11
  43. data/lib/tinkerforge/bricklet_dust_detector.rb +40 -16
  44. data/lib/tinkerforge/bricklet_e_paper_296x128.rb +88 -32
  45. data/lib/tinkerforge/bricklet_energy_monitor.rb +73 -27
  46. data/lib/tinkerforge/bricklet_gps.rb +64 -26
  47. data/lib/tinkerforge/bricklet_gps_v2.rb +117 -47
  48. data/lib/tinkerforge/bricklet_hall_effect.rb +43 -23
  49. data/lib/tinkerforge/bricklet_hall_effect_v2.rb +71 -27
  50. data/lib/tinkerforge/bricklet_humidity.rb +51 -21
  51. data/lib/tinkerforge/bricklet_humidity_v2.rb +83 -31
  52. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +38 -14
  53. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +81 -29
  54. data/lib/tinkerforge/bricklet_industrial_counter.rb +101 -39
  55. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +45 -17
  56. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +77 -29
  57. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -14
  58. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +73 -27
  59. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +40 -16
  60. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +79 -29
  61. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +49 -19
  62. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +82 -30
  63. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +61 -23
  64. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -14
  65. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -25
  66. data/lib/tinkerforge/bricklet_io16.rb +55 -21
  67. data/lib/tinkerforge/bricklet_io16_v2.rb +90 -34
  68. data/lib/tinkerforge/bricklet_io4.rb +55 -23
  69. data/lib/tinkerforge/bricklet_io4_v2.rb +96 -36
  70. data/lib/tinkerforge/bricklet_isolator.rb +72 -28
  71. data/lib/tinkerforge/bricklet_joystick.rb +59 -25
  72. data/lib/tinkerforge/bricklet_joystick_v2.rb +68 -26
  73. data/lib/tinkerforge/bricklet_laser_range_finder.rb +82 -32
  74. data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +96 -36
  75. data/lib/tinkerforge/bricklet_lcd_128x64.rb +192 -70
  76. data/lib/tinkerforge/bricklet_lcd_16x2.rb +45 -18
  77. data/lib/tinkerforge/bricklet_lcd_20x4.rb +58 -23
  78. data/lib/tinkerforge/bricklet_led_strip.rb +60 -22
  79. data/lib/tinkerforge/bricklet_led_strip_v2.rb +91 -46
  80. data/lib/tinkerforge/bricklet_line.rb +34 -14
  81. data/lib/tinkerforge/bricklet_linear_poti.rb +51 -21
  82. data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -21
  83. data/lib/tinkerforge/bricklet_load_cell.rb +61 -23
  84. data/lib/tinkerforge/bricklet_load_cell_v2.rb +80 -30
  85. data/lib/tinkerforge/bricklet_moisture.rb +40 -16
  86. data/lib/tinkerforge/bricklet_motion_detector.rb +22 -10
  87. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -24
  88. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -27
  89. data/lib/tinkerforge/bricklet_multi_touch.rb +31 -13
  90. data/lib/tinkerforge/bricklet_multi_touch_v2.rb +76 -28
  91. data/lib/tinkerforge/bricklet_nfc.rb +123 -58
  92. data/lib/tinkerforge/bricklet_nfc_rfid.rb +33 -13
  93. data/lib/tinkerforge/bricklet_oled_128x64.rb +29 -11
  94. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +66 -24
  95. data/lib/tinkerforge/bricklet_oled_64x48.rb +29 -11
  96. data/lib/tinkerforge/bricklet_one_wire.rb +66 -24
  97. data/lib/tinkerforge/bricklet_outdoor_weather.rb +71 -27
  98. data/lib/tinkerforge/bricklet_particulate_matter.rb +75 -30
  99. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -9
  100. data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -10
  101. data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +80 -42
  102. data/lib/tinkerforge/bricklet_ptc.rb +74 -42
  103. data/lib/tinkerforge/bricklet_ptc_v2.rb +95 -48
  104. data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -33
  105. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -44
  106. data/lib/tinkerforge/bricklet_remote_switch.rb +39 -29
  107. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +87 -49
  108. data/lib/tinkerforge/bricklet_rgb_led.rb +18 -8
  109. data/lib/tinkerforge/bricklet_rgb_led_button.rb +62 -30
  110. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +79 -33
  111. data/lib/tinkerforge/bricklet_rgb_led_v2.rb +52 -20
  112. data/lib/tinkerforge/bricklet_rotary_encoder.rb +39 -19
  113. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -24
  114. data/lib/tinkerforge/bricklet_rotary_poti.rb +53 -28
  115. data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +57 -23
  116. data/lib/tinkerforge/bricklet_rs232.rb +90 -28
  117. data/lib/tinkerforge/bricklet_rs232_v2.rb +118 -44
  118. data/lib/tinkerforge/bricklet_rs485.rb +223 -95
  119. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +25 -14
  120. data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -35
  121. data/lib/tinkerforge/bricklet_solid_state_relay.rb +25 -13
  122. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +59 -25
  123. data/lib/tinkerforge/bricklet_sound_intensity.rb +35 -18
  124. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +72 -31
  125. data/lib/tinkerforge/bricklet_temperature.rb +40 -16
  126. data/lib/tinkerforge/bricklet_temperature_ir.rb +57 -23
  127. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +71 -27
  128. data/lib/tinkerforge/bricklet_temperature_v2.rb +61 -25
  129. data/lib/tinkerforge/bricklet_thermal_imaging.rb +105 -44
  130. data/lib/tinkerforge/bricklet_thermocouple.rb +45 -24
  131. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -27
  132. data/lib/tinkerforge/bricklet_tilt.rb +24 -10
  133. data/lib/tinkerforge/bricklet_uv_light.rb +36 -18
  134. data/lib/tinkerforge/bricklet_uv_light_v2.rb +85 -37
  135. data/lib/tinkerforge/bricklet_voltage.rb +52 -28
  136. data/lib/tinkerforge/bricklet_voltage_current.rb +91 -73
  137. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +90 -68
  138. data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +80 -30
  139. data/lib/tinkerforge/device_display_names.rb +163 -0
  140. data/lib/tinkerforge/ip_connection.rb +151 -32
  141. data/lib/tinkerforge/version.rb +1 -1
  142. metadata +3 -2
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-11-25. #
3
+ # This file was automatically generated on 2020-04-07. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.25 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # Measures two DC voltages between -35V and +35V with 24bit resolution each
14
16
  class BrickletIndustrialDualAnalogIn < Device
@@ -62,7 +64,7 @@ module Tinkerforge
62
64
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
63
65
  # the IP Connection <tt>ipcon</tt>.
64
66
  def initialize(uid, ipcon)
65
- super uid, ipcon
67
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
66
68
 
67
69
  @api_version = [2, 0, 0]
68
70
 
@@ -80,9 +82,10 @@ module Tinkerforge
80
82
  @response_expected[FUNCTION_GET_ADC_VALUES] = RESPONSE_EXPECTED_ALWAYS_TRUE
81
83
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
82
84
 
83
- @callback_formats[CALLBACK_VOLTAGE] = 'C l'
84
- @callback_formats[CALLBACK_VOLTAGE_REACHED] = 'C l'
85
+ @callback_formats[CALLBACK_VOLTAGE] = [13, 'C l']
86
+ @callback_formats[CALLBACK_VOLTAGE_REACHED] = [13, 'C l']
85
87
 
88
+ @ipcon.add_device self
86
89
  end
87
90
 
88
91
  # Returns the voltage for the given channel.
@@ -91,7 +94,9 @@ module Tinkerforge
91
94
  # CALLBACK_VOLTAGE callback and set the period with
92
95
  # BrickletIndustrialDualAnalogIn#set_voltage_callback_period.
93
96
  def get_voltage(channel)
94
- send_request FUNCTION_GET_VOLTAGE, [channel], 'C', 4, 'l'
97
+ check_validity
98
+
99
+ send_request FUNCTION_GET_VOLTAGE, [channel], 'C', 12, 'l'
95
100
  end
96
101
 
97
102
  # Sets the period with which the CALLBACK_VOLTAGE callback is triggered
@@ -100,12 +105,16 @@ module Tinkerforge
100
105
  # The CALLBACK_VOLTAGE callback is only triggered if the voltage has changed since the
101
106
  # last triggering.
102
107
  def set_voltage_callback_period(channel, period)
103
- send_request FUNCTION_SET_VOLTAGE_CALLBACK_PERIOD, [channel, period], 'C L', 0, ''
108
+ check_validity
109
+
110
+ send_request FUNCTION_SET_VOLTAGE_CALLBACK_PERIOD, [channel, period], 'C L', 8, ''
104
111
  end
105
112
 
106
113
  # Returns the period as set by BrickletIndustrialDualAnalogIn#set_voltage_callback_period.
107
114
  def get_voltage_callback_period(channel)
108
- send_request FUNCTION_GET_VOLTAGE_CALLBACK_PERIOD, [channel], 'C', 4, 'L'
115
+ check_validity
116
+
117
+ send_request FUNCTION_GET_VOLTAGE_CALLBACK_PERIOD, [channel], 'C', 12, 'L'
109
118
  end
110
119
 
111
120
  # Sets the thresholds for the CALLBACK_VOLTAGE_REACHED callback for the given
@@ -121,12 +130,16 @@ module Tinkerforge
121
130
  # "'<'", "Callback is triggered when the voltage is smaller than the min value (max is ignored)"
122
131
  # "'>'", "Callback is triggered when the voltage is greater than the min value (max is ignored)"
123
132
  def set_voltage_callback_threshold(channel, option, min, max)
124
- send_request FUNCTION_SET_VOLTAGE_CALLBACK_THRESHOLD, [channel, option, min, max], 'C k l l', 0, ''
133
+ check_validity
134
+
135
+ send_request FUNCTION_SET_VOLTAGE_CALLBACK_THRESHOLD, [channel, option, min, max], 'C k l l', 8, ''
125
136
  end
126
137
 
127
138
  # Returns the threshold as set by BrickletIndustrialDualAnalogIn#set_voltage_callback_threshold.
128
139
  def get_voltage_callback_threshold(channel)
129
- send_request FUNCTION_GET_VOLTAGE_CALLBACK_THRESHOLD, [channel], 'C', 9, 'k l l'
140
+ check_validity
141
+
142
+ send_request FUNCTION_GET_VOLTAGE_CALLBACK_THRESHOLD, [channel], 'C', 17, 'k l l'
130
143
  end
131
144
 
132
145
  # Sets the period with which the threshold callback
@@ -139,24 +152,32 @@ module Tinkerforge
139
152
  #
140
153
  # keeps being reached.
141
154
  def set_debounce_period(debounce)
142
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
155
+ check_validity
156
+
157
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
143
158
  end
144
159
 
145
160
  # Returns the debounce period as set by BrickletIndustrialDualAnalogIn#set_debounce_period.
146
161
  def get_debounce_period
147
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
162
+ check_validity
163
+
164
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
148
165
  end
149
166
 
150
167
  # Sets the sample rate. The sample rate can be between 1 sample per second
151
168
  # and 976 samples per second. Decreasing the sample rate will also decrease the
152
169
  # noise on the data.
153
170
  def set_sample_rate(rate)
154
- send_request FUNCTION_SET_SAMPLE_RATE, [rate], 'C', 0, ''
171
+ check_validity
172
+
173
+ send_request FUNCTION_SET_SAMPLE_RATE, [rate], 'C', 8, ''
155
174
  end
156
175
 
157
176
  # Returns the sample rate as set by BrickletIndustrialDualAnalogIn#set_sample_rate.
158
177
  def get_sample_rate
159
- send_request FUNCTION_GET_SAMPLE_RATE, [], '', 1, 'C'
178
+ check_validity
179
+
180
+ send_request FUNCTION_GET_SAMPLE_RATE, [], '', 9, 'C'
160
181
  end
161
182
 
162
183
  # Sets offset and gain of MCP3911 internal calibration registers.
@@ -165,30 +186,39 @@ module Tinkerforge
165
186
  # is already factory calibrated by Tinkerforge. It should not be necessary
166
187
  # for you to use this function
167
188
  def set_calibration(offset, gain)
168
- send_request FUNCTION_SET_CALIBRATION, [offset, gain], 'l2 l2', 0, ''
189
+ check_validity
190
+
191
+ send_request FUNCTION_SET_CALIBRATION, [offset, gain], 'l2 l2', 8, ''
169
192
  end
170
193
 
171
194
  # Returns the calibration as set by BrickletIndustrialDualAnalogIn#set_calibration.
172
195
  def get_calibration
173
- send_request FUNCTION_GET_CALIBRATION, [], '', 16, 'l2 l2'
196
+ check_validity
197
+
198
+ send_request FUNCTION_GET_CALIBRATION, [], '', 24, 'l2 l2'
174
199
  end
175
200
 
176
201
  # Returns the ADC values as given by the MCP3911 IC. This function
177
202
  # is needed for proper calibration, see BrickletIndustrialDualAnalogIn#set_calibration.
178
203
  def get_adc_values
179
- send_request FUNCTION_GET_ADC_VALUES, [], '', 8, 'l2'
204
+ check_validity
205
+
206
+ send_request FUNCTION_GET_ADC_VALUES, [], '', 16, 'l2'
180
207
  end
181
208
 
182
209
  # Returns the UID, the UID where the Bricklet is connected to,
183
210
  # the position, the hardware and firmware version as well as the
184
211
  # device identifier.
185
212
  #
186
- # The position can be 'a', 'b', 'c' or 'd'.
213
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
214
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
215
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
216
+ # position 'z'.
187
217
  #
188
218
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
189
219
  # |device_identifier_constant|
190
220
  def get_identity
191
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
221
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
192
222
  end
193
223
 
194
224
  # 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 2020-04-07. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.25 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # Measures two DC voltages between -35V and +35V with 24bit resolution each
14
16
  class BrickletIndustrialDualAnalogInV2 < Device
@@ -84,7 +86,7 @@ module Tinkerforge
84
86
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
85
87
  # the IP Connection <tt>ipcon</tt>.
86
88
  def initialize(uid, ipcon)
87
- super uid, ipcon
89
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
88
90
 
89
91
  @api_version = [2, 0, 0]
90
92
 
@@ -113,8 +115,9 @@ module Tinkerforge
113
115
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
114
116
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
115
117
 
116
- @callback_formats[CALLBACK_VOLTAGE] = 'C l'
118
+ @callback_formats[CALLBACK_VOLTAGE] = [13, 'C l']
117
119
 
120
+ @ipcon.add_device self
118
121
  end
119
122
 
120
123
  # Returns the voltage for the given channel.
@@ -124,7 +127,9 @@ module Tinkerforge
124
127
  # CALLBACK_VOLTAGE callback. You can set the callback configuration
125
128
  # with BrickletIndustrialDualAnalogInV2#set_voltage_callback_configuration.
126
129
  def get_voltage(channel)
127
- send_request FUNCTION_GET_VOLTAGE, [channel], 'C', 4, 'l'
130
+ check_validity
131
+
132
+ send_request FUNCTION_GET_VOLTAGE, [channel], 'C', 12, 'l'
128
133
  end
129
134
 
130
135
  # The period is the period with which the CALLBACK_VOLTAGE callback is triggered
@@ -153,24 +158,32 @@ module Tinkerforge
153
158
  #
154
159
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
155
160
  def set_voltage_callback_configuration(channel, period, value_has_to_change, option, min, max)
156
- send_request FUNCTION_SET_VOLTAGE_CALLBACK_CONFIGURATION, [channel, period, value_has_to_change, option, min, max], 'C L ? k l l', 0, ''
161
+ check_validity
162
+
163
+ send_request FUNCTION_SET_VOLTAGE_CALLBACK_CONFIGURATION, [channel, period, value_has_to_change, option, min, max], 'C L ? k l l', 8, ''
157
164
  end
158
165
 
159
166
  # Returns the callback configuration as set by BrickletIndustrialDualAnalogInV2#set_voltage_callback_configuration.
160
167
  def get_voltage_callback_configuration(channel)
161
- send_request FUNCTION_GET_VOLTAGE_CALLBACK_CONFIGURATION, [channel], 'C', 14, 'L ? k l l'
168
+ check_validity
169
+
170
+ send_request FUNCTION_GET_VOLTAGE_CALLBACK_CONFIGURATION, [channel], 'C', 22, 'L ? k l l'
162
171
  end
163
172
 
164
173
  # Sets the sample rate. The sample rate can be between 1 sample per second
165
174
  # and 976 samples per second. Decreasing the sample rate will also decrease the
166
175
  # noise on the data.
167
176
  def set_sample_rate(rate)
168
- send_request FUNCTION_SET_SAMPLE_RATE, [rate], 'C', 0, ''
177
+ check_validity
178
+
179
+ send_request FUNCTION_SET_SAMPLE_RATE, [rate], 'C', 8, ''
169
180
  end
170
181
 
171
182
  # Returns the sample rate as set by BrickletIndustrialDualAnalogInV2#set_sample_rate.
172
183
  def get_sample_rate
173
- send_request FUNCTION_GET_SAMPLE_RATE, [], '', 1, 'C'
184
+ check_validity
185
+
186
+ send_request FUNCTION_GET_SAMPLE_RATE, [], '', 9, 'C'
174
187
  end
175
188
 
176
189
  # Sets offset and gain of MCP3911 internal calibration registers.
@@ -179,18 +192,24 @@ module Tinkerforge
179
192
  # is already factory calibrated by Tinkerforge. It should not be necessary
180
193
  # for you to use this function
181
194
  def set_calibration(offset, gain)
182
- send_request FUNCTION_SET_CALIBRATION, [offset, gain], 'l2 l2', 0, ''
195
+ check_validity
196
+
197
+ send_request FUNCTION_SET_CALIBRATION, [offset, gain], 'l2 l2', 8, ''
183
198
  end
184
199
 
185
200
  # Returns the calibration as set by BrickletIndustrialDualAnalogInV2#set_calibration.
186
201
  def get_calibration
187
- send_request FUNCTION_GET_CALIBRATION, [], '', 16, 'l2 l2'
202
+ check_validity
203
+
204
+ send_request FUNCTION_GET_CALIBRATION, [], '', 24, 'l2 l2'
188
205
  end
189
206
 
190
207
  # Returns the ADC values as given by the MCP3911 IC. This function
191
208
  # is needed for proper calibration, see BrickletIndustrialDualAnalogInV2#set_calibration.
192
209
  def get_adc_values
193
- send_request FUNCTION_GET_ADC_VALUES, [], '', 8, 'l2'
210
+ check_validity
211
+
212
+ send_request FUNCTION_GET_ADC_VALUES, [], '', 16, 'l2'
194
213
  end
195
214
 
196
215
  # Each channel has a corresponding LED. You can turn the LED off, on or show a
@@ -202,12 +221,16 @@ module Tinkerforge
202
221
  #
203
222
  # By default all channel LEDs are configured as "Channel Status".
204
223
  def set_channel_led_config(channel, config)
205
- send_request FUNCTION_SET_CHANNEL_LED_CONFIG, [channel, config], 'C C', 0, ''
224
+ check_validity
225
+
226
+ send_request FUNCTION_SET_CHANNEL_LED_CONFIG, [channel, config], 'C C', 8, ''
206
227
  end
207
228
 
208
229
  # Returns the channel LED configuration as set by BrickletIndustrialDualAnalogInV2#set_channel_led_config
209
230
  def get_channel_led_config(channel)
210
- send_request FUNCTION_GET_CHANNEL_LED_CONFIG, [channel], 'C', 1, 'C'
231
+ check_validity
232
+
233
+ send_request FUNCTION_GET_CHANNEL_LED_CONFIG, [channel], 'C', 9, 'C'
211
234
  end
212
235
 
213
236
  # Sets the channel LED status config. This config is used if the channel LED is
@@ -231,13 +254,17 @@ module Tinkerforge
231
254
  # min value is greater than the max value, the LED brightness is scaled the other
232
255
  # way around.
233
256
  def set_channel_led_status_config(channel, min, max, config)
234
- send_request FUNCTION_SET_CHANNEL_LED_STATUS_CONFIG, [channel, min, max, config], 'C l l C', 0, ''
257
+ check_validity
258
+
259
+ send_request FUNCTION_SET_CHANNEL_LED_STATUS_CONFIG, [channel, min, max, config], 'C l l C', 8, ''
235
260
  end
236
261
 
237
262
  # Returns the channel LED status configuration as set by
238
263
  # BrickletIndustrialDualAnalogInV2#set_channel_led_status_config.
239
264
  def get_channel_led_status_config(channel)
240
- send_request FUNCTION_GET_CHANNEL_LED_STATUS_CONFIG, [channel], 'C', 9, 'l l C'
265
+ check_validity
266
+
267
+ send_request FUNCTION_GET_CHANNEL_LED_STATUS_CONFIG, [channel], 'C', 17, 'l l C'
241
268
  end
242
269
 
243
270
  # Returns the error count for the communication between Brick and Bricklet.
@@ -252,7 +279,9 @@ module Tinkerforge
252
279
  # The errors counts are for errors that occur on the Bricklet side. All
253
280
  # Bricks have a similar function that returns the errors on the Brick side.
254
281
  def get_spitfp_error_count
255
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
282
+ check_validity
283
+
284
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
256
285
  end
257
286
 
258
287
  # Sets the bootloader mode and returns the status after the requested
@@ -265,12 +294,16 @@ module Tinkerforge
265
294
  # This function is used by Brick Viewer during flashing. It should not be
266
295
  # necessary to call it in a normal user program.
267
296
  def set_bootloader_mode(mode)
268
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
297
+ check_validity
298
+
299
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
269
300
  end
270
301
 
271
302
  # Returns the current bootloader mode, see BrickletIndustrialDualAnalogInV2#set_bootloader_mode.
272
303
  def get_bootloader_mode
273
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
304
+ check_validity
305
+
306
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
274
307
  end
275
308
 
276
309
  # Sets the firmware pointer for BrickletIndustrialDualAnalogInV2#write_firmware. The pointer has
@@ -280,7 +313,9 @@ module Tinkerforge
280
313
  # This function is used by Brick Viewer during flashing. It should not be
281
314
  # necessary to call it in a normal user program.
282
315
  def set_write_firmware_pointer(pointer)
283
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
316
+ check_validity
317
+
318
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
284
319
  end
285
320
 
286
321
  # Writes 64 Bytes of firmware at the position as written by
@@ -292,7 +327,9 @@ module Tinkerforge
292
327
  # This function is used by Brick Viewer during flashing. It should not be
293
328
  # necessary to call it in a normal user program.
294
329
  def write_firmware(data)
295
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
330
+ check_validity
331
+
332
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
296
333
  end
297
334
 
298
335
  # Sets the status LED configuration. By default the LED shows
@@ -303,22 +340,28 @@ module Tinkerforge
303
340
  #
304
341
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
305
342
  def set_status_led_config(config)
306
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
343
+ check_validity
344
+
345
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
307
346
  end
308
347
 
309
348
  # Returns the configuration as set by BrickletIndustrialDualAnalogInV2#set_status_led_config
310
349
  def get_status_led_config
311
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
350
+ check_validity
351
+
352
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
312
353
  end
313
354
 
314
- # Returns the temperature in °C as measured inside the microcontroller. The
355
+ # Returns the temperature as measured inside the microcontroller. The
315
356
  # value returned is not the ambient temperature!
316
357
  #
317
358
  # The temperature is only proportional to the real temperature and it has bad
318
359
  # accuracy. Practically it is only useful as an indicator for
319
360
  # temperature changes.
320
361
  def get_chip_temperature
321
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
362
+ check_validity
363
+
364
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
322
365
  end
323
366
 
324
367
  # Calling this function will reset the Bricklet. All configurations
@@ -328,7 +371,9 @@ module Tinkerforge
328
371
  # calling functions on the existing ones will result in
329
372
  # undefined behavior!
330
373
  def reset
331
- send_request FUNCTION_RESET, [], '', 0, ''
374
+ check_validity
375
+
376
+ send_request FUNCTION_RESET, [], '', 8, ''
332
377
  end
333
378
 
334
379
  # Writes a new UID into flash. If you want to set a new UID
@@ -337,25 +382,32 @@ module Tinkerforge
337
382
  #
338
383
  # We recommend that you use Brick Viewer to change the UID.
339
384
  def write_uid(uid)
340
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
385
+ check_validity
386
+
387
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
341
388
  end
342
389
 
343
390
  # Returns the current UID as an integer. Encode as
344
391
  # Base58 to get the usual string version.
345
392
  def read_uid
346
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
393
+ check_validity
394
+
395
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
347
396
  end
348
397
 
349
398
  # Returns the UID, the UID where the Bricklet is connected to,
350
399
  # the position, the hardware and firmware version as well as the
351
400
  # device identifier.
352
401
  #
353
- # The position can be 'a', 'b', 'c' or 'd'.
402
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
403
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
404
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
405
+ # position 'z'.
354
406
  #
355
407
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
356
408
  # |device_identifier_constant|
357
409
  def get_identity
358
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
410
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
359
411
  end
360
412
 
361
413
  # 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 2020-04-07. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.25 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # Two relays to switch AC/DC devices
14
16
  class BrickletIndustrialDualRelay < Device
@@ -57,7 +59,7 @@ module Tinkerforge
57
59
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
58
60
  # the IP Connection <tt>ipcon</tt>.
59
61
  def initialize(uid, ipcon)
60
- super uid, ipcon
62
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
61
63
 
62
64
  @api_version = [2, 0, 0]
63
65
 
@@ -79,8 +81,9 @@ module Tinkerforge
79
81
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
80
82
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
81
83
 
82
- @callback_formats[CALLBACK_MONOFLOP_DONE] = 'C ?'
84
+ @callback_formats[CALLBACK_MONOFLOP_DONE] = [10, 'C ?']
83
85
 
86
+ @ipcon.add_device self
84
87
  end
85
88
 
86
89
  # Sets the state of the relays, *true* means on and *false* means off.
@@ -92,12 +95,16 @@ module Tinkerforge
92
95
  #
93
96
  # All running monoflop timers will be aborted if this function is called.
94
97
  def set_value(channel0, channel1)
95
- send_request FUNCTION_SET_VALUE, [channel0, channel1], '? ?', 0, ''
98
+ check_validity
99
+
100
+ send_request FUNCTION_SET_VALUE, [channel0, channel1], '? ?', 8, ''
96
101
  end
97
102
 
98
103
  # Returns the state of the relays, *true* means on and *false* means off.
99
104
  def get_value
100
- send_request FUNCTION_GET_VALUE, [], '', 2, '? ?'
105
+ check_validity
106
+
107
+ send_request FUNCTION_GET_VALUE, [], '', 10, '? ?'
101
108
  end
102
109
 
103
110
  # The first parameter can be 0 or 1 (relay 0 or relay 1). The second parameter
@@ -114,7 +121,9 @@ module Tinkerforge
114
121
  # of two seconds. The relay will be on all the time. If now the RS485
115
122
  # connection is lost, the relay will turn off in at most two seconds.
116
123
  def set_monoflop(channel, value, time)
117
- send_request FUNCTION_SET_MONOFLOP, [channel, value, time], 'C ? L', 0, ''
124
+ check_validity
125
+
126
+ send_request FUNCTION_SET_MONOFLOP, [channel, value, time], 'C ? L', 8, ''
118
127
  end
119
128
 
120
129
  # Returns (for the given relay) the current state and the time as set by
@@ -123,7 +132,9 @@ module Tinkerforge
123
132
  # If the timer is not running currently, the remaining time will be returned
124
133
  # as 0.
125
134
  def get_monoflop(channel)
126
- send_request FUNCTION_GET_MONOFLOP, [channel], 'C', 9, '? L L'
135
+ check_validity
136
+
137
+ send_request FUNCTION_GET_MONOFLOP, [channel], 'C', 17, '? L L'
127
138
  end
128
139
 
129
140
  # Sets the state of the selected relay, *true* means on and *false*
@@ -134,7 +145,9 @@ module Tinkerforge
134
145
  #
135
146
  # The other relay remains untouched.
136
147
  def set_selected_value(channel, value)
137
- send_request FUNCTION_SET_SELECTED_VALUE, [channel, value], 'C ?', 0, ''
148
+ check_validity
149
+
150
+ send_request FUNCTION_SET_SELECTED_VALUE, [channel, value], 'C ?', 8, ''
138
151
  end
139
152
 
140
153
  # Returns the error count for the communication between Brick and Bricklet.
@@ -149,7 +162,9 @@ module Tinkerforge
149
162
  # The errors counts are for errors that occur on the Bricklet side. All
150
163
  # Bricks have a similar function that returns the errors on the Brick side.
151
164
  def get_spitfp_error_count
152
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
165
+ check_validity
166
+
167
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
153
168
  end
154
169
 
155
170
  # Sets the bootloader mode and returns the status after the requested
@@ -162,12 +177,16 @@ module Tinkerforge
162
177
  # This function is used by Brick Viewer during flashing. It should not be
163
178
  # necessary to call it in a normal user program.
164
179
  def set_bootloader_mode(mode)
165
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
180
+ check_validity
181
+
182
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
166
183
  end
167
184
 
168
185
  # Returns the current bootloader mode, see BrickletIndustrialDualRelay#set_bootloader_mode.
169
186
  def get_bootloader_mode
170
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
187
+ check_validity
188
+
189
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
171
190
  end
172
191
 
173
192
  # Sets the firmware pointer for BrickletIndustrialDualRelay#write_firmware. The pointer has
@@ -177,7 +196,9 @@ module Tinkerforge
177
196
  # This function is used by Brick Viewer during flashing. It should not be
178
197
  # necessary to call it in a normal user program.
179
198
  def set_write_firmware_pointer(pointer)
180
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
199
+ check_validity
200
+
201
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
181
202
  end
182
203
 
183
204
  # Writes 64 Bytes of firmware at the position as written by
@@ -189,7 +210,9 @@ module Tinkerforge
189
210
  # This function is used by Brick Viewer during flashing. It should not be
190
211
  # necessary to call it in a normal user program.
191
212
  def write_firmware(data)
192
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
213
+ check_validity
214
+
215
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
193
216
  end
194
217
 
195
218
  # Sets the status LED configuration. By default the LED shows
@@ -200,22 +223,28 @@ module Tinkerforge
200
223
  #
201
224
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
202
225
  def set_status_led_config(config)
203
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
226
+ check_validity
227
+
228
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
204
229
  end
205
230
 
206
231
  # Returns the configuration as set by BrickletIndustrialDualRelay#set_status_led_config
207
232
  def get_status_led_config
208
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
233
+ check_validity
234
+
235
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
209
236
  end
210
237
 
211
- # Returns the temperature in °C as measured inside the microcontroller. The
238
+ # Returns the temperature as measured inside the microcontroller. The
212
239
  # value returned is not the ambient temperature!
213
240
  #
214
241
  # The temperature is only proportional to the real temperature and it has bad
215
242
  # accuracy. Practically it is only useful as an indicator for
216
243
  # temperature changes.
217
244
  def get_chip_temperature
218
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
245
+ check_validity
246
+
247
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
219
248
  end
220
249
 
221
250
  # Calling this function will reset the Bricklet. All configurations
@@ -225,7 +254,9 @@ module Tinkerforge
225
254
  # calling functions on the existing ones will result in
226
255
  # undefined behavior!
227
256
  def reset
228
- send_request FUNCTION_RESET, [], '', 0, ''
257
+ check_validity
258
+
259
+ send_request FUNCTION_RESET, [], '', 8, ''
229
260
  end
230
261
 
231
262
  # Writes a new UID into flash. If you want to set a new UID
@@ -234,25 +265,32 @@ module Tinkerforge
234
265
  #
235
266
  # We recommend that you use Brick Viewer to change the UID.
236
267
  def write_uid(uid)
237
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
268
+ check_validity
269
+
270
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
238
271
  end
239
272
 
240
273
  # Returns the current UID as an integer. Encode as
241
274
  # Base58 to get the usual string version.
242
275
  def read_uid
243
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
276
+ check_validity
277
+
278
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
244
279
  end
245
280
 
246
281
  # Returns the UID, the UID where the Bricklet is connected to,
247
282
  # the position, the hardware and firmware version as well as the
248
283
  # device identifier.
249
284
  #
250
- # The position can be 'a', 'b', 'c' or 'd'.
285
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
286
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
287
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
288
+ # position 'z'.
251
289
  #
252
290
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
253
291
  # |device_identifier_constant|
254
292
  def get_identity
255
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
293
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
256
294
  end
257
295
 
258
296
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.