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 ambient light up to 64000lux
14
16
  class BrickletAmbientLightV2 < Device
@@ -66,7 +68,7 @@ module Tinkerforge
66
68
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
67
69
  # the IP Connection <tt>ipcon</tt>.
68
70
  def initialize(uid, ipcon)
69
- super uid, ipcon
71
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
70
72
 
71
73
  @api_version = [2, 0, 1]
72
74
 
@@ -81,15 +83,14 @@ module Tinkerforge
81
83
  @response_expected[FUNCTION_GET_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
82
84
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
83
85
 
84
- @callback_formats[CALLBACK_ILLUMINANCE] = 'L'
85
- @callback_formats[CALLBACK_ILLUMINANCE_REACHED] = 'L'
86
+ @callback_formats[CALLBACK_ILLUMINANCE] = [12, 'L']
87
+ @callback_formats[CALLBACK_ILLUMINANCE_REACHED] = [12, 'L']
86
88
 
89
+ @ipcon.add_device self
87
90
  end
88
91
 
89
92
  # Returns the illuminance of the ambient light sensor. The measurement range goes
90
93
  # up to about 100000lux, but above 64000lux the precision starts to drop.
91
- # The illuminance is given in lux/100, i.e. a value of 450000 means that an
92
- # illuminance of 4500lux is measured.
93
94
  #
94
95
  # .. versionchanged:: 2.0.2$nbsp;(Plugin)
95
96
  # An illuminance of 0lux indicates that the sensor is saturated and the
@@ -99,7 +100,9 @@ module Tinkerforge
99
100
  # CALLBACK_ILLUMINANCE callback and set the period with
100
101
  # BrickletAmbientLightV2#set_illuminance_callback_period.
101
102
  def get_illuminance
102
- send_request FUNCTION_GET_ILLUMINANCE, [], '', 4, 'L'
103
+ check_validity
104
+
105
+ send_request FUNCTION_GET_ILLUMINANCE, [], '', 12, 'L'
103
106
  end
104
107
 
105
108
  # Sets the period with which the CALLBACK_ILLUMINANCE callback is triggered
@@ -108,12 +111,16 @@ module Tinkerforge
108
111
  # The CALLBACK_ILLUMINANCE callback is only triggered if the illuminance has changed
109
112
  # since the last triggering.
110
113
  def set_illuminance_callback_period(period)
111
- send_request FUNCTION_SET_ILLUMINANCE_CALLBACK_PERIOD, [period], 'L', 0, ''
114
+ check_validity
115
+
116
+ send_request FUNCTION_SET_ILLUMINANCE_CALLBACK_PERIOD, [period], 'L', 8, ''
112
117
  end
113
118
 
114
119
  # Returns the period as set by BrickletAmbientLightV2#set_illuminance_callback_period.
115
120
  def get_illuminance_callback_period
116
- send_request FUNCTION_GET_ILLUMINANCE_CALLBACK_PERIOD, [], '', 4, 'L'
121
+ check_validity
122
+
123
+ send_request FUNCTION_GET_ILLUMINANCE_CALLBACK_PERIOD, [], '', 12, 'L'
117
124
  end
118
125
 
119
126
  # Sets the thresholds for the CALLBACK_ILLUMINANCE_REACHED callback.
@@ -127,15 +134,17 @@ module Tinkerforge
127
134
  # "'i'", "Callback is triggered when the illuminance is *inside* the min and max values"
128
135
  # "'<'", "Callback is triggered when the illuminance is smaller than the min value (max is ignored)"
129
136
  # "'>'", "Callback is triggered when the illuminance is greater than the min value (max is ignored)"
130
- #
131
- # The default value is ('x', 0, 0).
132
137
  def set_illuminance_callback_threshold(option, min, max)
133
- send_request FUNCTION_SET_ILLUMINANCE_CALLBACK_THRESHOLD, [option, min, max], 'k L L', 0, ''
138
+ check_validity
139
+
140
+ send_request FUNCTION_SET_ILLUMINANCE_CALLBACK_THRESHOLD, [option, min, max], 'k L L', 8, ''
134
141
  end
135
142
 
136
143
  # Returns the threshold as set by BrickletAmbientLightV2#set_illuminance_callback_threshold.
137
144
  def get_illuminance_callback_threshold
138
- send_request FUNCTION_GET_ILLUMINANCE_CALLBACK_THRESHOLD, [], '', 9, 'k L L'
145
+ check_validity
146
+
147
+ send_request FUNCTION_GET_ILLUMINANCE_CALLBACK_THRESHOLD, [], '', 17, 'k L L'
139
148
  end
140
149
 
141
150
  # Sets the period with which the threshold callbacks
@@ -148,12 +157,16 @@ module Tinkerforge
148
157
  #
149
158
  # keep being reached.
150
159
  def set_debounce_period(debounce)
151
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
160
+ check_validity
161
+
162
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
152
163
  end
153
164
 
154
165
  # Returns the debounce period as set by BrickletAmbientLightV2#set_debounce_period.
155
166
  def get_debounce_period
156
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
167
+ check_validity
168
+
169
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
157
170
  end
158
171
 
159
172
  # Sets the configuration. It is possible to configure an illuminance range
@@ -179,27 +192,32 @@ module Tinkerforge
179
192
  # If the measurement is out-of-range or the sensor is saturated then you should
180
193
  # configure the next higher illuminance range. If the highest range is already
181
194
  # in use, then start to reduce the integration time.
182
- #
183
- # The default values are 0-8000lux illuminance range and 200ms integration time.
184
195
  def set_configuration(illuminance_range, integration_time)
185
- send_request FUNCTION_SET_CONFIGURATION, [illuminance_range, integration_time], 'C C', 0, ''
196
+ check_validity
197
+
198
+ send_request FUNCTION_SET_CONFIGURATION, [illuminance_range, integration_time], 'C C', 8, ''
186
199
  end
187
200
 
188
201
  # Returns the configuration as set by BrickletAmbientLightV2#set_configuration.
189
202
  def get_configuration
190
- send_request FUNCTION_GET_CONFIGURATION, [], '', 2, 'C C'
203
+ check_validity
204
+
205
+ send_request FUNCTION_GET_CONFIGURATION, [], '', 10, 'C C'
191
206
  end
192
207
 
193
208
  # Returns the UID, the UID where the Bricklet is connected to,
194
209
  # the position, the hardware and firmware version as well as the
195
210
  # device identifier.
196
211
  #
197
- # The position can be 'a', 'b', 'c' or 'd'.
212
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
213
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
214
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
215
+ # position 'z'.
198
216
  #
199
217
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
200
218
  # |device_identifier_constant|
201
219
  def get_identity
202
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
220
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
203
221
  end
204
222
 
205
223
  # 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 ambient light up to 64000lux
14
16
  class BrickletAmbientLightV3 < 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
 
@@ -100,8 +102,9 @@ module Tinkerforge
100
102
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
101
103
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
102
104
 
103
- @callback_formats[CALLBACK_ILLUMINANCE] = 'L'
105
+ @callback_formats[CALLBACK_ILLUMINANCE] = [12, 'L']
104
106
 
107
+ @ipcon.add_device self
105
108
  end
106
109
 
107
110
  # Returns the illuminance of the ambient light sensor. The measurement range goes
@@ -117,7 +120,9 @@ module Tinkerforge
117
120
  # CALLBACK_ILLUMINANCE callback. You can set the callback configuration
118
121
  # with BrickletAmbientLightV3#set_illuminance_callback_configuration.
119
122
  def get_illuminance
120
- send_request FUNCTION_GET_ILLUMINANCE, [], '', 4, 'L'
123
+ check_validity
124
+
125
+ send_request FUNCTION_GET_ILLUMINANCE, [], '', 12, 'L'
121
126
  end
122
127
 
123
128
  # The period is the period with which the CALLBACK_ILLUMINANCE callback is triggered
@@ -146,12 +151,16 @@ module Tinkerforge
146
151
  #
147
152
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
148
153
  def set_illuminance_callback_configuration(period, value_has_to_change, option, min, max)
149
- send_request FUNCTION_SET_ILLUMINANCE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k L L', 0, ''
154
+ check_validity
155
+
156
+ send_request FUNCTION_SET_ILLUMINANCE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k L L', 8, ''
150
157
  end
151
158
 
152
159
  # Returns the callback configuration as set by BrickletAmbientLightV3#set_illuminance_callback_configuration.
153
160
  def get_illuminance_callback_configuration
154
- send_request FUNCTION_GET_ILLUMINANCE_CALLBACK_CONFIGURATION, [], '', 14, 'L ? k L L'
161
+ check_validity
162
+
163
+ send_request FUNCTION_GET_ILLUMINANCE_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k L L'
155
164
  end
156
165
 
157
166
  # Sets the configuration. It is possible to configure an illuminance range
@@ -174,15 +183,17 @@ module Tinkerforge
174
183
  # If the measurement is out-of-range or the sensor is saturated then you should
175
184
  # configure the next higher illuminance range. If the highest range is already
176
185
  # in use, then start to reduce the integration time.
177
- #
178
- # The default values are 0-8000lux illuminance range and 150ms integration time.
179
186
  def set_configuration(illuminance_range, integration_time)
180
- send_request FUNCTION_SET_CONFIGURATION, [illuminance_range, integration_time], 'C C', 0, ''
187
+ check_validity
188
+
189
+ send_request FUNCTION_SET_CONFIGURATION, [illuminance_range, integration_time], 'C C', 8, ''
181
190
  end
182
191
 
183
192
  # Returns the configuration as set by BrickletAmbientLightV3#set_configuration.
184
193
  def get_configuration
185
- send_request FUNCTION_GET_CONFIGURATION, [], '', 2, 'C C'
194
+ check_validity
195
+
196
+ send_request FUNCTION_GET_CONFIGURATION, [], '', 10, 'C C'
186
197
  end
187
198
 
188
199
  # Returns the error count for the communication between Brick and Bricklet.
@@ -197,7 +208,9 @@ module Tinkerforge
197
208
  # The errors counts are for errors that occur on the Bricklet side. All
198
209
  # Bricks have a similar function that returns the errors on the Brick side.
199
210
  def get_spitfp_error_count
200
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
211
+ check_validity
212
+
213
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
201
214
  end
202
215
 
203
216
  # Sets the bootloader mode and returns the status after the requested
@@ -210,12 +223,16 @@ module Tinkerforge
210
223
  # This function is used by Brick Viewer during flashing. It should not be
211
224
  # necessary to call it in a normal user program.
212
225
  def set_bootloader_mode(mode)
213
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
226
+ check_validity
227
+
228
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
214
229
  end
215
230
 
216
231
  # Returns the current bootloader mode, see BrickletAmbientLightV3#set_bootloader_mode.
217
232
  def get_bootloader_mode
218
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
233
+ check_validity
234
+
235
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
219
236
  end
220
237
 
221
238
  # Sets the firmware pointer for BrickletAmbientLightV3#write_firmware. The pointer has
@@ -225,7 +242,9 @@ module Tinkerforge
225
242
  # This function is used by Brick Viewer during flashing. It should not be
226
243
  # necessary to call it in a normal user program.
227
244
  def set_write_firmware_pointer(pointer)
228
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
245
+ check_validity
246
+
247
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
229
248
  end
230
249
 
231
250
  # Writes 64 Bytes of firmware at the position as written by
@@ -237,7 +256,9 @@ module Tinkerforge
237
256
  # This function is used by Brick Viewer during flashing. It should not be
238
257
  # necessary to call it in a normal user program.
239
258
  def write_firmware(data)
240
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
259
+ check_validity
260
+
261
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
241
262
  end
242
263
 
243
264
  # Sets the status LED configuration. By default the LED shows
@@ -248,22 +269,28 @@ module Tinkerforge
248
269
  #
249
270
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
250
271
  def set_status_led_config(config)
251
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
272
+ check_validity
273
+
274
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
252
275
  end
253
276
 
254
277
  # Returns the configuration as set by BrickletAmbientLightV3#set_status_led_config
255
278
  def get_status_led_config
256
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
279
+ check_validity
280
+
281
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
257
282
  end
258
283
 
259
- # Returns the temperature in °C as measured inside the microcontroller. The
284
+ # Returns the temperature as measured inside the microcontroller. The
260
285
  # value returned is not the ambient temperature!
261
286
  #
262
287
  # The temperature is only proportional to the real temperature and it has bad
263
288
  # accuracy. Practically it is only useful as an indicator for
264
289
  # temperature changes.
265
290
  def get_chip_temperature
266
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
291
+ check_validity
292
+
293
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
267
294
  end
268
295
 
269
296
  # Calling this function will reset the Bricklet. All configurations
@@ -273,7 +300,9 @@ module Tinkerforge
273
300
  # calling functions on the existing ones will result in
274
301
  # undefined behavior!
275
302
  def reset
276
- send_request FUNCTION_RESET, [], '', 0, ''
303
+ check_validity
304
+
305
+ send_request FUNCTION_RESET, [], '', 8, ''
277
306
  end
278
307
 
279
308
  # Writes a new UID into flash. If you want to set a new UID
@@ -282,25 +311,32 @@ module Tinkerforge
282
311
  #
283
312
  # We recommend that you use Brick Viewer to change the UID.
284
313
  def write_uid(uid)
285
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
314
+ check_validity
315
+
316
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
286
317
  end
287
318
 
288
319
  # Returns the current UID as an integer. Encode as
289
320
  # Base58 to get the usual string version.
290
321
  def read_uid
291
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
322
+ check_validity
323
+
324
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
292
325
  end
293
326
 
294
327
  # Returns the UID, the UID where the Bricklet is connected to,
295
328
  # the position, the hardware and firmware version as well as the
296
329
  # device identifier.
297
330
  #
298
- # The position can be 'a', 'b', 'c' or 'd'.
331
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
332
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
333
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
334
+ # position 'z'.
299
335
  #
300
336
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
301
337
  # |device_identifier_constant|
302
338
  def get_identity
303
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
339
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
304
340
  end
305
341
 
306
342
  # 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 DC voltage between 0V and 45V
14
16
  class BrickletAnalogIn < Device
@@ -80,7 +82,7 @@ module Tinkerforge
80
82
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
81
83
  # the IP Connection <tt>ipcon</tt>.
82
84
  def initialize(uid, ipcon)
83
- super uid, ipcon
85
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
84
86
 
85
87
  @api_version = [2, 0, 3]
86
88
 
@@ -102,11 +104,12 @@ module Tinkerforge
102
104
  @response_expected[FUNCTION_GET_AVERAGING] = RESPONSE_EXPECTED_ALWAYS_TRUE
103
105
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
104
106
 
105
- @callback_formats[CALLBACK_VOLTAGE] = 'S'
106
- @callback_formats[CALLBACK_ANALOG_VALUE] = 'S'
107
- @callback_formats[CALLBACK_VOLTAGE_REACHED] = 'S'
108
- @callback_formats[CALLBACK_ANALOG_VALUE_REACHED] = 'S'
107
+ @callback_formats[CALLBACK_VOLTAGE] = [10, 'S']
108
+ @callback_formats[CALLBACK_ANALOG_VALUE] = [10, 'S']
109
+ @callback_formats[CALLBACK_VOLTAGE_REACHED] = [10, 'S']
110
+ @callback_formats[CALLBACK_ANALOG_VALUE_REACHED] = [10, 'S']
109
111
 
112
+ @ipcon.add_device self
110
113
  end
111
114
 
112
115
  # Returns the voltage of the sensor. The resolution between 0 and 6V is about 2mV.
@@ -116,7 +119,9 @@ module Tinkerforge
116
119
  # CALLBACK_VOLTAGE callback and set the period with
117
120
  # BrickletAnalogIn#set_voltage_callback_period.
118
121
  def get_voltage
119
- send_request FUNCTION_GET_VOLTAGE, [], '', 2, 'S'
122
+ check_validity
123
+
124
+ send_request FUNCTION_GET_VOLTAGE, [], '', 10, 'S'
120
125
  end
121
126
 
122
127
  # Returns the value as read by a 12-bit analog-to-digital converter.
@@ -131,7 +136,9 @@ module Tinkerforge
131
136
  # CALLBACK_ANALOG_VALUE callback and set the period with
132
137
  # BrickletAnalogIn#set_analog_value_callback_period.
133
138
  def get_analog_value
134
- send_request FUNCTION_GET_ANALOG_VALUE, [], '', 2, 'S'
139
+ check_validity
140
+
141
+ send_request FUNCTION_GET_ANALOG_VALUE, [], '', 10, 'S'
135
142
  end
136
143
 
137
144
  # Sets the period with which the CALLBACK_VOLTAGE callback is triggered
@@ -140,12 +147,16 @@ module Tinkerforge
140
147
  # The CALLBACK_VOLTAGE callback is only triggered if the voltage has changed since
141
148
  # the last triggering.
142
149
  def set_voltage_callback_period(period)
143
- send_request FUNCTION_SET_VOLTAGE_CALLBACK_PERIOD, [period], 'L', 0, ''
150
+ check_validity
151
+
152
+ send_request FUNCTION_SET_VOLTAGE_CALLBACK_PERIOD, [period], 'L', 8, ''
144
153
  end
145
154
 
146
155
  # Returns the period as set by BrickletAnalogIn#set_voltage_callback_period.
147
156
  def get_voltage_callback_period
148
- send_request FUNCTION_GET_VOLTAGE_CALLBACK_PERIOD, [], '', 4, 'L'
157
+ check_validity
158
+
159
+ send_request FUNCTION_GET_VOLTAGE_CALLBACK_PERIOD, [], '', 12, 'L'
149
160
  end
150
161
 
151
162
  # Sets the period with which the CALLBACK_ANALOG_VALUE callback is triggered
@@ -154,12 +165,16 @@ module Tinkerforge
154
165
  # The CALLBACK_ANALOG_VALUE callback is only triggered if the analog value has
155
166
  # changed since the last triggering.
156
167
  def set_analog_value_callback_period(period)
157
- send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD, [period], 'L', 0, ''
168
+ check_validity
169
+
170
+ send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD, [period], 'L', 8, ''
158
171
  end
159
172
 
160
173
  # Returns the period as set by BrickletAnalogIn#set_analog_value_callback_period.
161
174
  def get_analog_value_callback_period
162
- send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD, [], '', 4, 'L'
175
+ check_validity
176
+
177
+ send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD, [], '', 12, 'L'
163
178
  end
164
179
 
165
180
  # Sets the thresholds for the CALLBACK_VOLTAGE_REACHED callback.
@@ -174,12 +189,16 @@ module Tinkerforge
174
189
  # "'<'", "Callback is triggered when the voltage is smaller than the min value (max is ignored)"
175
190
  # "'>'", "Callback is triggered when the voltage is greater than the min value (max is ignored)"
176
191
  def set_voltage_callback_threshold(option, min, max)
177
- send_request FUNCTION_SET_VOLTAGE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
192
+ check_validity
193
+
194
+ send_request FUNCTION_SET_VOLTAGE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
178
195
  end
179
196
 
180
197
  # Returns the threshold as set by BrickletAnalogIn#set_voltage_callback_threshold.
181
198
  def get_voltage_callback_threshold
182
- send_request FUNCTION_GET_VOLTAGE_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
199
+ check_validity
200
+
201
+ send_request FUNCTION_GET_VOLTAGE_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
183
202
  end
184
203
 
185
204
  # Sets the thresholds for the CALLBACK_ANALOG_VALUE_REACHED callback.
@@ -194,12 +213,16 @@ module Tinkerforge
194
213
  # "'<'", "Callback is triggered when the analog value is smaller than the min value (max is ignored)"
195
214
  # "'>'", "Callback is triggered when the analog value is greater than the min value (max is ignored)"
196
215
  def set_analog_value_callback_threshold(option, min, max)
197
- send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
216
+ check_validity
217
+
218
+ send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
198
219
  end
199
220
 
200
221
  # Returns the threshold as set by BrickletAnalogIn#set_analog_value_callback_threshold.
201
222
  def get_analog_value_callback_threshold
202
- send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
223
+ check_validity
224
+
225
+ send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
203
226
  end
204
227
 
205
228
  # Sets the period with which the threshold callbacks
@@ -214,12 +237,16 @@ module Tinkerforge
214
237
  #
215
238
  # keep being reached.
216
239
  def set_debounce_period(debounce)
217
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
240
+ check_validity
241
+
242
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
218
243
  end
219
244
 
220
245
  # Returns the debounce period as set by BrickletAnalogIn#set_debounce_period.
221
246
  def get_debounce_period
222
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
247
+ check_validity
248
+
249
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
223
250
  end
224
251
 
225
252
  # Sets the measurement range. Possible ranges:
@@ -233,14 +260,18 @@ module Tinkerforge
233
260
  #
234
261
  # .. versionadded:: 2.0.1$nbsp;(Plugin)
235
262
  def set_range(range)
236
- send_request FUNCTION_SET_RANGE, [range], 'C', 0, ''
263
+ check_validity
264
+
265
+ send_request FUNCTION_SET_RANGE, [range], 'C', 8, ''
237
266
  end
238
267
 
239
268
  # Returns the measurement range as set by BrickletAnalogIn#set_range.
240
269
  #
241
270
  # .. versionadded:: 2.0.1$nbsp;(Plugin)
242
271
  def get_range
243
- send_request FUNCTION_GET_RANGE, [], '', 1, 'C'
272
+ check_validity
273
+
274
+ send_request FUNCTION_GET_RANGE, [], '', 9, 'C'
244
275
  end
245
276
 
246
277
  # Set the length of a averaging for the voltage value.
@@ -251,26 +282,33 @@ module Tinkerforge
251
282
  #
252
283
  # .. versionadded:: 2.0.3$nbsp;(Plugin)
253
284
  def set_averaging(average)
254
- send_request FUNCTION_SET_AVERAGING, [average], 'C', 0, ''
285
+ check_validity
286
+
287
+ send_request FUNCTION_SET_AVERAGING, [average], 'C', 8, ''
255
288
  end
256
289
 
257
290
  # Returns the averaging configuration as set by BrickletAnalogIn#set_averaging.
258
291
  #
259
292
  # .. versionadded:: 2.0.3$nbsp;(Plugin)
260
293
  def get_averaging
261
- send_request FUNCTION_GET_AVERAGING, [], '', 1, 'C'
294
+ check_validity
295
+
296
+ send_request FUNCTION_GET_AVERAGING, [], '', 9, 'C'
262
297
  end
263
298
 
264
299
  # Returns the UID, the UID where the Bricklet is connected to,
265
300
  # the position, the hardware and firmware version as well as the
266
301
  # device identifier.
267
302
  #
268
- # The position can be 'a', 'b', 'c' or 'd'.
303
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
304
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
305
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
306
+ # position 'z'.
269
307
  #
270
308
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
271
309
  # |device_identifier_constant|
272
310
  def get_identity
273
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
311
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
274
312
  end
275
313
 
276
314
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.