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
  # 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,25 +83,29 @@ 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
- # An illuminance of 0lux indicates that the sensor is saturated and the
96
- # configuration should be modified, see BrickletAmbientLightV2#set_configuration.
96
+ # An illuminance of 0lux indicates an error condition where the sensor cannot
97
+ # perform a reasonable measurement. This can happen with very dim or very bright
98
+ # light conditions. In bright light conditions this might indicate that the sensor
99
+ # is saturated and the configuration should be modified (BrickletAmbientLightV2#set_configuration)
100
+ # to better match the light conditions.
97
101
  #
98
102
  # If you want to get the illuminance periodically, it is recommended to use the
99
103
  # CALLBACK_ILLUMINANCE callback and set the period with
100
104
  # BrickletAmbientLightV2#set_illuminance_callback_period.
101
105
  def get_illuminance
102
- send_request FUNCTION_GET_ILLUMINANCE, [], '', 4, 'L'
106
+ check_validity
107
+
108
+ send_request FUNCTION_GET_ILLUMINANCE, [], '', 12, 'L'
103
109
  end
104
110
 
105
111
  # Sets the period with which the CALLBACK_ILLUMINANCE callback is triggered
@@ -108,12 +114,16 @@ module Tinkerforge
108
114
  # The CALLBACK_ILLUMINANCE callback is only triggered if the illuminance has changed
109
115
  # since the last triggering.
110
116
  def set_illuminance_callback_period(period)
111
- send_request FUNCTION_SET_ILLUMINANCE_CALLBACK_PERIOD, [period], 'L', 0, ''
117
+ check_validity
118
+
119
+ send_request FUNCTION_SET_ILLUMINANCE_CALLBACK_PERIOD, [period], 'L', 8, ''
112
120
  end
113
121
 
114
122
  # Returns the period as set by BrickletAmbientLightV2#set_illuminance_callback_period.
115
123
  def get_illuminance_callback_period
116
- send_request FUNCTION_GET_ILLUMINANCE_CALLBACK_PERIOD, [], '', 4, 'L'
124
+ check_validity
125
+
126
+ send_request FUNCTION_GET_ILLUMINANCE_CALLBACK_PERIOD, [], '', 12, 'L'
117
127
  end
118
128
 
119
129
  # Sets the thresholds for the CALLBACK_ILLUMINANCE_REACHED callback.
@@ -127,15 +137,17 @@ module Tinkerforge
127
137
  # "'i'", "Callback is triggered when the illuminance is *inside* the min and max values"
128
138
  # "'<'", "Callback is triggered when the illuminance is smaller than the min value (max is ignored)"
129
139
  # "'>'", "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
140
  def set_illuminance_callback_threshold(option, min, max)
133
- send_request FUNCTION_SET_ILLUMINANCE_CALLBACK_THRESHOLD, [option, min, max], 'k L L', 0, ''
141
+ check_validity
142
+
143
+ send_request FUNCTION_SET_ILLUMINANCE_CALLBACK_THRESHOLD, [option, min, max], 'k L L', 8, ''
134
144
  end
135
145
 
136
146
  # Returns the threshold as set by BrickletAmbientLightV2#set_illuminance_callback_threshold.
137
147
  def get_illuminance_callback_threshold
138
- send_request FUNCTION_GET_ILLUMINANCE_CALLBACK_THRESHOLD, [], '', 9, 'k L L'
148
+ check_validity
149
+
150
+ send_request FUNCTION_GET_ILLUMINANCE_CALLBACK_THRESHOLD, [], '', 17, 'k L L'
139
151
  end
140
152
 
141
153
  # Sets the period with which the threshold callbacks
@@ -148,12 +160,16 @@ module Tinkerforge
148
160
  #
149
161
  # keep being reached.
150
162
  def set_debounce_period(debounce)
151
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
163
+ check_validity
164
+
165
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
152
166
  end
153
167
 
154
168
  # Returns the debounce period as set by BrickletAmbientLightV2#set_debounce_period.
155
169
  def get_debounce_period
156
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
170
+ check_validity
171
+
172
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
157
173
  end
158
174
 
159
175
  # Sets the configuration. It is possible to configure an illuminance range
@@ -179,27 +195,31 @@ module Tinkerforge
179
195
  # If the measurement is out-of-range or the sensor is saturated then you should
180
196
  # configure the next higher illuminance range. If the highest range is already
181
197
  # in use, then start to reduce the integration time.
182
- #
183
- # The default values are 0-8000lux illuminance range and 200ms integration time.
184
198
  def set_configuration(illuminance_range, integration_time)
185
- send_request FUNCTION_SET_CONFIGURATION, [illuminance_range, integration_time], 'C C', 0, ''
199
+ check_validity
200
+
201
+ send_request FUNCTION_SET_CONFIGURATION, [illuminance_range, integration_time], 'C C', 8, ''
186
202
  end
187
203
 
188
204
  # Returns the configuration as set by BrickletAmbientLightV2#set_configuration.
189
205
  def get_configuration
190
- send_request FUNCTION_GET_CONFIGURATION, [], '', 2, 'C C'
206
+ check_validity
207
+
208
+ send_request FUNCTION_GET_CONFIGURATION, [], '', 10, 'C C'
191
209
  end
192
210
 
193
211
  # Returns the UID, the UID where the Bricklet is connected to,
194
212
  # the position, the hardware and firmware version as well as the
195
213
  # device identifier.
196
214
  #
197
- # The position can be 'a', 'b', 'c' or 'd'.
215
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
216
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
217
+ # position 'z'.
198
218
  #
199
219
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
200
220
  # |device_identifier_constant|
201
221
  def get_identity
202
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
222
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
203
223
  end
204
224
 
205
225
  # 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 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
@@ -109,15 +112,20 @@ module Tinkerforge
109
112
  # The illuminance is given in lux/100, i.e. a value of 450000 means that an
110
113
  # illuminance of 4500lux is measured.
111
114
  #
112
- # An illuminance of 0lux indicates that the sensor is saturated and the
113
- # configuration should be modified, see BrickletAmbientLightV3#set_configuration.
115
+ # An illuminance of 0lux indicates an error condition where the sensor cannot
116
+ # perform a reasonable measurement. This can happen with very dim or very bright
117
+ # light conditions. In bright light conditions this might indicate that the sensor
118
+ # is saturated and the configuration should be modified (BrickletAmbientLightV3#set_configuration)
119
+ # to better match the conditions.
114
120
  #
115
121
  #
116
122
  # If you want to get the value periodically, it is recommended to use the
117
123
  # CALLBACK_ILLUMINANCE callback. You can set the callback configuration
118
124
  # with BrickletAmbientLightV3#set_illuminance_callback_configuration.
119
125
  def get_illuminance
120
- send_request FUNCTION_GET_ILLUMINANCE, [], '', 4, 'L'
126
+ check_validity
127
+
128
+ send_request FUNCTION_GET_ILLUMINANCE, [], '', 12, 'L'
121
129
  end
122
130
 
123
131
  # The period is the period with which the CALLBACK_ILLUMINANCE callback is triggered
@@ -146,12 +154,16 @@ module Tinkerforge
146
154
  #
147
155
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
148
156
  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, ''
157
+ check_validity
158
+
159
+ send_request FUNCTION_SET_ILLUMINANCE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k L L', 8, ''
150
160
  end
151
161
 
152
162
  # Returns the callback configuration as set by BrickletAmbientLightV3#set_illuminance_callback_configuration.
153
163
  def get_illuminance_callback_configuration
154
- send_request FUNCTION_GET_ILLUMINANCE_CALLBACK_CONFIGURATION, [], '', 14, 'L ? k L L'
164
+ check_validity
165
+
166
+ send_request FUNCTION_GET_ILLUMINANCE_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k L L'
155
167
  end
156
168
 
157
169
  # Sets the configuration. It is possible to configure an illuminance range
@@ -174,15 +186,17 @@ module Tinkerforge
174
186
  # If the measurement is out-of-range or the sensor is saturated then you should
175
187
  # configure the next higher illuminance range. If the highest range is already
176
188
  # in use, then start to reduce the integration time.
177
- #
178
- # The default values are 0-8000lux illuminance range and 150ms integration time.
179
189
  def set_configuration(illuminance_range, integration_time)
180
- send_request FUNCTION_SET_CONFIGURATION, [illuminance_range, integration_time], 'C C', 0, ''
190
+ check_validity
191
+
192
+ send_request FUNCTION_SET_CONFIGURATION, [illuminance_range, integration_time], 'C C', 8, ''
181
193
  end
182
194
 
183
195
  # Returns the configuration as set by BrickletAmbientLightV3#set_configuration.
184
196
  def get_configuration
185
- send_request FUNCTION_GET_CONFIGURATION, [], '', 2, 'C C'
197
+ check_validity
198
+
199
+ send_request FUNCTION_GET_CONFIGURATION, [], '', 10, 'C C'
186
200
  end
187
201
 
188
202
  # Returns the error count for the communication between Brick and Bricklet.
@@ -197,7 +211,9 @@ module Tinkerforge
197
211
  # The errors counts are for errors that occur on the Bricklet side. All
198
212
  # Bricks have a similar function that returns the errors on the Brick side.
199
213
  def get_spitfp_error_count
200
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
214
+ check_validity
215
+
216
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
201
217
  end
202
218
 
203
219
  # Sets the bootloader mode and returns the status after the requested
@@ -210,12 +226,16 @@ module Tinkerforge
210
226
  # This function is used by Brick Viewer during flashing. It should not be
211
227
  # necessary to call it in a normal user program.
212
228
  def set_bootloader_mode(mode)
213
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
229
+ check_validity
230
+
231
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
214
232
  end
215
233
 
216
234
  # Returns the current bootloader mode, see BrickletAmbientLightV3#set_bootloader_mode.
217
235
  def get_bootloader_mode
218
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
236
+ check_validity
237
+
238
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
219
239
  end
220
240
 
221
241
  # Sets the firmware pointer for BrickletAmbientLightV3#write_firmware. The pointer has
@@ -225,7 +245,9 @@ module Tinkerforge
225
245
  # This function is used by Brick Viewer during flashing. It should not be
226
246
  # necessary to call it in a normal user program.
227
247
  def set_write_firmware_pointer(pointer)
228
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
248
+ check_validity
249
+
250
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
229
251
  end
230
252
 
231
253
  # Writes 64 Bytes of firmware at the position as written by
@@ -237,7 +259,9 @@ module Tinkerforge
237
259
  # This function is used by Brick Viewer during flashing. It should not be
238
260
  # necessary to call it in a normal user program.
239
261
  def write_firmware(data)
240
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
262
+ check_validity
263
+
264
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
241
265
  end
242
266
 
243
267
  # Sets the status LED configuration. By default the LED shows
@@ -248,22 +272,28 @@ module Tinkerforge
248
272
  #
249
273
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
250
274
  def set_status_led_config(config)
251
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
275
+ check_validity
276
+
277
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
252
278
  end
253
279
 
254
280
  # Returns the configuration as set by BrickletAmbientLightV3#set_status_led_config
255
281
  def get_status_led_config
256
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
282
+ check_validity
283
+
284
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
257
285
  end
258
286
 
259
- # Returns the temperature in °C as measured inside the microcontroller. The
287
+ # Returns the temperature as measured inside the microcontroller. The
260
288
  # value returned is not the ambient temperature!
261
289
  #
262
290
  # The temperature is only proportional to the real temperature and it has bad
263
291
  # accuracy. Practically it is only useful as an indicator for
264
292
  # temperature changes.
265
293
  def get_chip_temperature
266
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
294
+ check_validity
295
+
296
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
267
297
  end
268
298
 
269
299
  # Calling this function will reset the Bricklet. All configurations
@@ -273,7 +303,9 @@ module Tinkerforge
273
303
  # calling functions on the existing ones will result in
274
304
  # undefined behavior!
275
305
  def reset
276
- send_request FUNCTION_RESET, [], '', 0, ''
306
+ check_validity
307
+
308
+ send_request FUNCTION_RESET, [], '', 8, ''
277
309
  end
278
310
 
279
311
  # Writes a new UID into flash. If you want to set a new UID
@@ -282,25 +314,31 @@ module Tinkerforge
282
314
  #
283
315
  # We recommend that you use Brick Viewer to change the UID.
284
316
  def write_uid(uid)
285
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
317
+ check_validity
318
+
319
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
286
320
  end
287
321
 
288
322
  # Returns the current UID as an integer. Encode as
289
323
  # Base58 to get the usual string version.
290
324
  def read_uid
291
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
325
+ check_validity
326
+
327
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
292
328
  end
293
329
 
294
330
  # Returns the UID, the UID where the Bricklet is connected to,
295
331
  # the position, the hardware and firmware version as well as the
296
332
  # device identifier.
297
333
  #
298
- # The position can be 'a', 'b', 'c' or 'd'.
334
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
335
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
336
+ # position 'z'.
299
337
  #
300
338
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
301
339
  # |device_identifier_constant|
302
340
  def get_identity
303
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
341
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
304
342
  end
305
343
 
306
344
  # 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 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,32 @@ 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
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
305
+ # position 'z'.
269
306
  #
270
307
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
271
308
  # |device_identifier_constant|
272
309
  def get_identity
273
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
310
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
274
311
  end
275
312
 
276
313
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.