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 temperature with 0.5°C accuracy
14
16
  class BrickletTemperature < Device
@@ -53,7 +55,7 @@ module Tinkerforge
53
55
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
54
56
  # the IP Connection <tt>ipcon</tt>.
55
57
  def initialize(uid, ipcon)
56
- super uid, ipcon
58
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
57
59
 
58
60
  @api_version = [2, 0, 1]
59
61
 
@@ -68,9 +70,10 @@ module Tinkerforge
68
70
  @response_expected[FUNCTION_GET_I2C_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
69
71
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
70
72
 
71
- @callback_formats[CALLBACK_TEMPERATURE] = 's'
72
- @callback_formats[CALLBACK_TEMPERATURE_REACHED] = 's'
73
+ @callback_formats[CALLBACK_TEMPERATURE] = [10, 's']
74
+ @callback_formats[CALLBACK_TEMPERATURE_REACHED] = [10, 's']
73
75
 
76
+ @ipcon.add_device self
74
77
  end
75
78
 
76
79
  # Returns the temperature of the sensor.
@@ -79,7 +82,9 @@ module Tinkerforge
79
82
  # to use the CALLBACK_TEMPERATURE callback and set the period with
80
83
  # BrickletTemperature#set_temperature_callback_period.
81
84
  def get_temperature
82
- send_request FUNCTION_GET_TEMPERATURE, [], '', 2, 's'
85
+ check_validity
86
+
87
+ send_request FUNCTION_GET_TEMPERATURE, [], '', 10, 's'
83
88
  end
84
89
 
85
90
  # Sets the period with which the CALLBACK_TEMPERATURE callback is triggered
@@ -88,12 +93,16 @@ module Tinkerforge
88
93
  # The CALLBACK_TEMPERATURE callback is only triggered if the temperature has changed
89
94
  # since the last triggering.
90
95
  def set_temperature_callback_period(period)
91
- send_request FUNCTION_SET_TEMPERATURE_CALLBACK_PERIOD, [period], 'L', 0, ''
96
+ check_validity
97
+
98
+ send_request FUNCTION_SET_TEMPERATURE_CALLBACK_PERIOD, [period], 'L', 8, ''
92
99
  end
93
100
 
94
101
  # Returns the period as set by BrickletTemperature#set_temperature_callback_period.
95
102
  def get_temperature_callback_period
96
- send_request FUNCTION_GET_TEMPERATURE_CALLBACK_PERIOD, [], '', 4, 'L'
103
+ check_validity
104
+
105
+ send_request FUNCTION_GET_TEMPERATURE_CALLBACK_PERIOD, [], '', 12, 'L'
97
106
  end
98
107
 
99
108
  # Sets the thresholds for the CALLBACK_TEMPERATURE_REACHED callback.
@@ -108,12 +117,16 @@ module Tinkerforge
108
117
  # "'<'", "Callback is triggered when the temperature is smaller than the min value (max is ignored)"
109
118
  # "'>'", "Callback is triggered when the temperature is greater than the min value (max is ignored)"
110
119
  def set_temperature_callback_threshold(option, min, max)
111
- send_request FUNCTION_SET_TEMPERATURE_CALLBACK_THRESHOLD, [option, min, max], 'k s s', 0, ''
120
+ check_validity
121
+
122
+ send_request FUNCTION_SET_TEMPERATURE_CALLBACK_THRESHOLD, [option, min, max], 'k s s', 8, ''
112
123
  end
113
124
 
114
125
  # Returns the threshold as set by BrickletTemperature#set_temperature_callback_threshold.
115
126
  def get_temperature_callback_threshold
116
- send_request FUNCTION_GET_TEMPERATURE_CALLBACK_THRESHOLD, [], '', 5, 'k s s'
127
+ check_validity
128
+
129
+ send_request FUNCTION_GET_TEMPERATURE_CALLBACK_THRESHOLD, [], '', 13, 'k s s'
117
130
  end
118
131
 
119
132
  # Sets the period with which the threshold callback
@@ -126,12 +139,16 @@ module Tinkerforge
126
139
  #
127
140
  # keeps being reached.
128
141
  def set_debounce_period(debounce)
129
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
142
+ check_validity
143
+
144
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
130
145
  end
131
146
 
132
147
  # Returns the debounce period as set by BrickletTemperature#set_debounce_period.
133
148
  def get_debounce_period
134
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
149
+ check_validity
150
+
151
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
135
152
  end
136
153
 
137
154
  # Sets the I2C mode. Possible modes are:
@@ -148,26 +165,32 @@ module Tinkerforge
148
165
  #
149
166
  # .. versionadded:: 2.0.1$nbsp;(Plugin)
150
167
  def set_i2c_mode(mode)
151
- send_request FUNCTION_SET_I2C_MODE, [mode], 'C', 0, ''
168
+ check_validity
169
+
170
+ send_request FUNCTION_SET_I2C_MODE, [mode], 'C', 8, ''
152
171
  end
153
172
 
154
173
  # Returns the I2C mode as set by BrickletTemperature#set_i2c_mode.
155
174
  #
156
175
  # .. versionadded:: 2.0.1$nbsp;(Plugin)
157
176
  def get_i2c_mode
158
- send_request FUNCTION_GET_I2C_MODE, [], '', 1, 'C'
177
+ check_validity
178
+
179
+ send_request FUNCTION_GET_I2C_MODE, [], '', 9, 'C'
159
180
  end
160
181
 
161
182
  # Returns the UID, the UID where the Bricklet is connected to,
162
183
  # the position, the hardware and firmware version as well as the
163
184
  # device identifier.
164
185
  #
165
- # The position can be 'a', 'b', 'c' or 'd'.
186
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
187
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
188
+ # position 'z'.
166
189
  #
167
190
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
168
191
  # |device_identifier_constant|
169
192
  def get_identity
170
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
193
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
171
194
  end
172
195
 
173
196
  # 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 contactless object temperature between -70°C and +380°C
14
16
  class BrickletTemperatureIR < Device
@@ -72,7 +74,7 @@ module Tinkerforge
72
74
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
73
75
  # the IP Connection <tt>ipcon</tt>.
74
76
  def initialize(uid, ipcon)
75
- super uid, ipcon
77
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
76
78
 
77
79
  @api_version = [2, 0, 0]
78
80
 
@@ -92,11 +94,12 @@ module Tinkerforge
92
94
  @response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
93
95
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
94
96
 
95
- @callback_formats[CALLBACK_AMBIENT_TEMPERATURE] = 's'
96
- @callback_formats[CALLBACK_OBJECT_TEMPERATURE] = 's'
97
- @callback_formats[CALLBACK_AMBIENT_TEMPERATURE_REACHED] = 's'
98
- @callback_formats[CALLBACK_OBJECT_TEMPERATURE_REACHED] = 's'
97
+ @callback_formats[CALLBACK_AMBIENT_TEMPERATURE] = [10, 's']
98
+ @callback_formats[CALLBACK_OBJECT_TEMPERATURE] = [10, 's']
99
+ @callback_formats[CALLBACK_AMBIENT_TEMPERATURE_REACHED] = [10, 's']
100
+ @callback_formats[CALLBACK_OBJECT_TEMPERATURE_REACHED] = [10, 's']
99
101
 
102
+ @ipcon.add_device self
100
103
  end
101
104
 
102
105
  # Returns the ambient temperature of the sensor.
@@ -105,7 +108,9 @@ module Tinkerforge
105
108
  # to use the CALLBACK_AMBIENT_TEMPERATURE callback and set the period with
106
109
  # BrickletTemperatureIR#set_ambient_temperature_callback_period.
107
110
  def get_ambient_temperature
108
- send_request FUNCTION_GET_AMBIENT_TEMPERATURE, [], '', 2, 's'
111
+ check_validity
112
+
113
+ send_request FUNCTION_GET_AMBIENT_TEMPERATURE, [], '', 10, 's'
109
114
  end
110
115
 
111
116
  # Returns the object temperature of the sensor, i.e. the temperature
@@ -119,7 +124,9 @@ module Tinkerforge
119
124
  # to use the CALLBACK_OBJECT_TEMPERATURE callback and set the period with
120
125
  # BrickletTemperatureIR#set_object_temperature_callback_period.
121
126
  def get_object_temperature
122
- send_request FUNCTION_GET_OBJECT_TEMPERATURE, [], '', 2, 's'
127
+ check_validity
128
+
129
+ send_request FUNCTION_GET_OBJECT_TEMPERATURE, [], '', 10, 's'
123
130
  end
124
131
 
125
132
  # Sets the `emissivity <https://en.wikipedia.org/wiki/Emissivity>`__ that is
@@ -140,12 +147,16 @@ module Tinkerforge
140
147
  #
141
148
  # The emissivity is stored in non-volatile memory and will still be used after a restart or power cycle of the Bricklet.
142
149
  def set_emissivity(emissivity)
143
- send_request FUNCTION_SET_EMISSIVITY, [emissivity], 'S', 0, ''
150
+ check_validity
151
+
152
+ send_request FUNCTION_SET_EMISSIVITY, [emissivity], 'S', 8, ''
144
153
  end
145
154
 
146
155
  # Returns the emissivity as set by BrickletTemperatureIR#set_emissivity.
147
156
  def get_emissivity
148
- send_request FUNCTION_GET_EMISSIVITY, [], '', 2, 'S'
157
+ check_validity
158
+
159
+ send_request FUNCTION_GET_EMISSIVITY, [], '', 10, 'S'
149
160
  end
150
161
 
151
162
  # Sets the period with which the CALLBACK_AMBIENT_TEMPERATURE callback is
@@ -154,12 +165,16 @@ module Tinkerforge
154
165
  # The CALLBACK_AMBIENT_TEMPERATURE callback is only triggered if the temperature has
155
166
  # changed since the last triggering.
156
167
  def set_ambient_temperature_callback_period(period)
157
- send_request FUNCTION_SET_AMBIENT_TEMPERATURE_CALLBACK_PERIOD, [period], 'L', 0, ''
168
+ check_validity
169
+
170
+ send_request FUNCTION_SET_AMBIENT_TEMPERATURE_CALLBACK_PERIOD, [period], 'L', 8, ''
158
171
  end
159
172
 
160
173
  # Returns the period as set by BrickletTemperatureIR#set_ambient_temperature_callback_period.
161
174
  def get_ambient_temperature_callback_period
162
- send_request FUNCTION_GET_AMBIENT_TEMPERATURE_CALLBACK_PERIOD, [], '', 4, 'L'
175
+ check_validity
176
+
177
+ send_request FUNCTION_GET_AMBIENT_TEMPERATURE_CALLBACK_PERIOD, [], '', 12, 'L'
163
178
  end
164
179
 
165
180
  # Sets the period with which the CALLBACK_OBJECT_TEMPERATURE callback is
@@ -168,12 +183,16 @@ module Tinkerforge
168
183
  # The CALLBACK_OBJECT_TEMPERATURE callback is only triggered if the temperature
169
184
  # has changed since the last triggering.
170
185
  def set_object_temperature_callback_period(period)
171
- send_request FUNCTION_SET_OBJECT_TEMPERATURE_CALLBACK_PERIOD, [period], 'L', 0, ''
186
+ check_validity
187
+
188
+ send_request FUNCTION_SET_OBJECT_TEMPERATURE_CALLBACK_PERIOD, [period], 'L', 8, ''
172
189
  end
173
190
 
174
191
  # Returns the period as set by BrickletTemperatureIR#set_object_temperature_callback_period.
175
192
  def get_object_temperature_callback_period
176
- send_request FUNCTION_GET_OBJECT_TEMPERATURE_CALLBACK_PERIOD, [], '', 4, 'L'
193
+ check_validity
194
+
195
+ send_request FUNCTION_GET_OBJECT_TEMPERATURE_CALLBACK_PERIOD, [], '', 12, 'L'
177
196
  end
178
197
 
179
198
  # Sets the thresholds for the CALLBACK_AMBIENT_TEMPERATURE_REACHED callback.
@@ -188,12 +207,16 @@ module Tinkerforge
188
207
  # "'<'", "Callback is triggered when the ambient temperature is smaller than the min value (max is ignored)"
189
208
  # "'>'", "Callback is triggered when the ambient temperature is greater than the min value (max is ignored)"
190
209
  def set_ambient_temperature_callback_threshold(option, min, max)
191
- send_request FUNCTION_SET_AMBIENT_TEMPERATURE_CALLBACK_THRESHOLD, [option, min, max], 'k s s', 0, ''
210
+ check_validity
211
+
212
+ send_request FUNCTION_SET_AMBIENT_TEMPERATURE_CALLBACK_THRESHOLD, [option, min, max], 'k s s', 8, ''
192
213
  end
193
214
 
194
215
  # Returns the threshold as set by BrickletTemperatureIR#set_ambient_temperature_callback_threshold.
195
216
  def get_ambient_temperature_callback_threshold
196
- send_request FUNCTION_GET_AMBIENT_TEMPERATURE_CALLBACK_THRESHOLD, [], '', 5, 'k s s'
217
+ check_validity
218
+
219
+ send_request FUNCTION_GET_AMBIENT_TEMPERATURE_CALLBACK_THRESHOLD, [], '', 13, 'k s s'
197
220
  end
198
221
 
199
222
  # Sets the thresholds for the CALLBACK_OBJECT_TEMPERATURE_REACHED callback.
@@ -208,12 +231,16 @@ module Tinkerforge
208
231
  # "'<'", "Callback is triggered when the object temperature is smaller than the min value (max is ignored)"
209
232
  # "'>'", "Callback is triggered when the object temperature is greater than the min value (max is ignored)"
210
233
  def set_object_temperature_callback_threshold(option, min, max)
211
- send_request FUNCTION_SET_OBJECT_TEMPERATURE_CALLBACK_THRESHOLD, [option, min, max], 'k s s', 0, ''
234
+ check_validity
235
+
236
+ send_request FUNCTION_SET_OBJECT_TEMPERATURE_CALLBACK_THRESHOLD, [option, min, max], 'k s s', 8, ''
212
237
  end
213
238
 
214
239
  # Returns the threshold as set by BrickletTemperatureIR#set_object_temperature_callback_threshold.
215
240
  def get_object_temperature_callback_threshold
216
- send_request FUNCTION_GET_OBJECT_TEMPERATURE_CALLBACK_THRESHOLD, [], '', 5, 'k s s'
241
+ check_validity
242
+
243
+ send_request FUNCTION_GET_OBJECT_TEMPERATURE_CALLBACK_THRESHOLD, [], '', 13, 'k s s'
217
244
  end
218
245
 
219
246
  # Sets the period with which the threshold callbacks
@@ -228,24 +255,30 @@ module Tinkerforge
228
255
  #
229
256
  # keep being reached.
230
257
  def set_debounce_period(debounce)
231
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
258
+ check_validity
259
+
260
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
232
261
  end
233
262
 
234
263
  # Returns the debounce period as set by BrickletTemperatureIR#set_debounce_period.
235
264
  def get_debounce_period
236
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
265
+ check_validity
266
+
267
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
237
268
  end
238
269
 
239
270
  # Returns the UID, the UID where the Bricklet is connected to,
240
271
  # the position, the hardware and firmware version as well as the
241
272
  # device identifier.
242
273
  #
243
- # The position can be 'a', 'b', 'c' or 'd'.
274
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
275
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
276
+ # position 'z'.
244
277
  #
245
278
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
246
279
  # |device_identifier_constant|
247
280
  def get_identity
248
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
281
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
249
282
  end
250
283
 
251
284
  # 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 contactless object temperature between -70°C and +380°C
14
16
  class BrickletTemperatureIRV2 < Device
@@ -72,7 +74,7 @@ module Tinkerforge
72
74
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
73
75
  # the IP Connection <tt>ipcon</tt>.
74
76
  def initialize(uid, ipcon)
75
- super uid, ipcon
77
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
76
78
 
77
79
  @api_version = [2, 0, 1]
78
80
 
@@ -97,9 +99,10 @@ module Tinkerforge
97
99
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
98
100
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
99
101
 
100
- @callback_formats[CALLBACK_AMBIENT_TEMPERATURE] = 's'
101
- @callback_formats[CALLBACK_OBJECT_TEMPERATURE] = 's'
102
+ @callback_formats[CALLBACK_AMBIENT_TEMPERATURE] = [10, 's']
103
+ @callback_formats[CALLBACK_OBJECT_TEMPERATURE] = [10, 's']
102
104
 
105
+ @ipcon.add_device self
103
106
  end
104
107
 
105
108
  # Returns the ambient temperature of the sensor.
@@ -109,7 +112,9 @@ module Tinkerforge
109
112
  # CALLBACK_AMBIENT_TEMPERATURE callback. You can set the callback configuration
110
113
  # with BrickletTemperatureIRV2#set_ambient_temperature_callback_configuration.
111
114
  def get_ambient_temperature
112
- send_request FUNCTION_GET_AMBIENT_TEMPERATURE, [], '', 2, 's'
115
+ check_validity
116
+
117
+ send_request FUNCTION_GET_AMBIENT_TEMPERATURE, [], '', 10, 's'
113
118
  end
114
119
 
115
120
  # The period is the period with which the CALLBACK_AMBIENT_TEMPERATURE callback is triggered
@@ -138,12 +143,16 @@ module Tinkerforge
138
143
  #
139
144
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
140
145
  def set_ambient_temperature_callback_configuration(period, value_has_to_change, option, min, max)
141
- send_request FUNCTION_SET_AMBIENT_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k s s', 0, ''
146
+ check_validity
147
+
148
+ send_request FUNCTION_SET_AMBIENT_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k s s', 8, ''
142
149
  end
143
150
 
144
151
  # Returns the callback configuration as set by BrickletTemperatureIRV2#set_ambient_temperature_callback_configuration.
145
152
  def get_ambient_temperature_callback_configuration
146
- send_request FUNCTION_GET_AMBIENT_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 10, 'L ? k s s'
153
+ check_validity
154
+
155
+ send_request FUNCTION_GET_AMBIENT_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 18, 'L ? k s s'
147
156
  end
148
157
 
149
158
  # Returns the object temperature of the sensor, i.e. the temperature
@@ -158,7 +167,9 @@ module Tinkerforge
158
167
  # CALLBACK_OBJECT_TEMPERATURE callback. You can set the callback configuration
159
168
  # with BrickletTemperatureIRV2#set_object_temperature_callback_configuration.
160
169
  def get_object_temperature
161
- send_request FUNCTION_GET_OBJECT_TEMPERATURE, [], '', 2, 's'
170
+ check_validity
171
+
172
+ send_request FUNCTION_GET_OBJECT_TEMPERATURE, [], '', 10, 's'
162
173
  end
163
174
 
164
175
  # The period is the period with which the CALLBACK_OBJECT_TEMPERATURE callback is triggered
@@ -187,12 +198,16 @@ module Tinkerforge
187
198
  #
188
199
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
189
200
  def set_object_temperature_callback_configuration(period, value_has_to_change, option, min, max)
190
- send_request FUNCTION_SET_OBJECT_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k s s', 0, ''
201
+ check_validity
202
+
203
+ send_request FUNCTION_SET_OBJECT_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k s s', 8, ''
191
204
  end
192
205
 
193
206
  # Returns the callback configuration as set by BrickletTemperatureIRV2#set_object_temperature_callback_configuration.
194
207
  def get_object_temperature_callback_configuration
195
- send_request FUNCTION_GET_OBJECT_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 10, 'L ? k s s'
208
+ check_validity
209
+
210
+ send_request FUNCTION_GET_OBJECT_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 18, 'L ? k s s'
196
211
  end
197
212
 
198
213
  # Sets the `emissivity <https://en.wikipedia.org/wiki/Emissivity>`__ that is
@@ -214,12 +229,16 @@ module Tinkerforge
214
229
  # The emissivity is stored in non-volatile memory and will still be
215
230
  # used after a restart or power cycle of the Bricklet.
216
231
  def set_emissivity(emissivity)
217
- send_request FUNCTION_SET_EMISSIVITY, [emissivity], 'S', 0, ''
232
+ check_validity
233
+
234
+ send_request FUNCTION_SET_EMISSIVITY, [emissivity], 'S', 8, ''
218
235
  end
219
236
 
220
237
  # Returns the emissivity as set by BrickletTemperatureIRV2#set_emissivity.
221
238
  def get_emissivity
222
- send_request FUNCTION_GET_EMISSIVITY, [], '', 2, 'S'
239
+ check_validity
240
+
241
+ send_request FUNCTION_GET_EMISSIVITY, [], '', 10, 'S'
223
242
  end
224
243
 
225
244
  # Returns the error count for the communication between Brick and Bricklet.
@@ -234,7 +253,9 @@ module Tinkerforge
234
253
  # The errors counts are for errors that occur on the Bricklet side. All
235
254
  # Bricks have a similar function that returns the errors on the Brick side.
236
255
  def get_spitfp_error_count
237
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
256
+ check_validity
257
+
258
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
238
259
  end
239
260
 
240
261
  # Sets the bootloader mode and returns the status after the requested
@@ -247,12 +268,16 @@ module Tinkerforge
247
268
  # This function is used by Brick Viewer during flashing. It should not be
248
269
  # necessary to call it in a normal user program.
249
270
  def set_bootloader_mode(mode)
250
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
271
+ check_validity
272
+
273
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
251
274
  end
252
275
 
253
276
  # Returns the current bootloader mode, see BrickletTemperatureIRV2#set_bootloader_mode.
254
277
  def get_bootloader_mode
255
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
278
+ check_validity
279
+
280
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
256
281
  end
257
282
 
258
283
  # Sets the firmware pointer for BrickletTemperatureIRV2#write_firmware. The pointer has
@@ -262,7 +287,9 @@ module Tinkerforge
262
287
  # This function is used by Brick Viewer during flashing. It should not be
263
288
  # necessary to call it in a normal user program.
264
289
  def set_write_firmware_pointer(pointer)
265
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
290
+ check_validity
291
+
292
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
266
293
  end
267
294
 
268
295
  # Writes 64 Bytes of firmware at the position as written by
@@ -274,7 +301,9 @@ module Tinkerforge
274
301
  # This function is used by Brick Viewer during flashing. It should not be
275
302
  # necessary to call it in a normal user program.
276
303
  def write_firmware(data)
277
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
304
+ check_validity
305
+
306
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
278
307
  end
279
308
 
280
309
  # Sets the status LED configuration. By default the LED shows
@@ -285,22 +314,28 @@ module Tinkerforge
285
314
  #
286
315
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
287
316
  def set_status_led_config(config)
288
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
317
+ check_validity
318
+
319
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
289
320
  end
290
321
 
291
322
  # Returns the configuration as set by BrickletTemperatureIRV2#set_status_led_config
292
323
  def get_status_led_config
293
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
324
+ check_validity
325
+
326
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
294
327
  end
295
328
 
296
- # Returns the temperature in °C as measured inside the microcontroller. The
329
+ # Returns the temperature as measured inside the microcontroller. The
297
330
  # value returned is not the ambient temperature!
298
331
  #
299
332
  # The temperature is only proportional to the real temperature and it has bad
300
333
  # accuracy. Practically it is only useful as an indicator for
301
334
  # temperature changes.
302
335
  def get_chip_temperature
303
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
336
+ check_validity
337
+
338
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
304
339
  end
305
340
 
306
341
  # Calling this function will reset the Bricklet. All configurations
@@ -310,7 +345,9 @@ module Tinkerforge
310
345
  # calling functions on the existing ones will result in
311
346
  # undefined behavior!
312
347
  def reset
313
- send_request FUNCTION_RESET, [], '', 0, ''
348
+ check_validity
349
+
350
+ send_request FUNCTION_RESET, [], '', 8, ''
314
351
  end
315
352
 
316
353
  # Writes a new UID into flash. If you want to set a new UID
@@ -319,25 +356,31 @@ module Tinkerforge
319
356
  #
320
357
  # We recommend that you use Brick Viewer to change the UID.
321
358
  def write_uid(uid)
322
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
359
+ check_validity
360
+
361
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
323
362
  end
324
363
 
325
364
  # Returns the current UID as an integer. Encode as
326
365
  # Base58 to get the usual string version.
327
366
  def read_uid
328
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
367
+ check_validity
368
+
369
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
329
370
  end
330
371
 
331
372
  # Returns the UID, the UID where the Bricklet is connected to,
332
373
  # the position, the hardware and firmware version as well as the
333
374
  # device identifier.
334
375
  #
335
- # The position can be 'a', 'b', 'c' or 'd'.
376
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
377
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
378
+ # position 'z'.
336
379
  #
337
380
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
338
381
  # |device_identifier_constant|
339
382
  def get_identity
340
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
383
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
341
384
  end
342
385
 
343
386
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.