tinkerforge 2.1.24 → 2.1.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 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,33 @@ 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
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
188
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
189
+ # position 'z'.
166
190
  #
167
191
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
168
192
  # |device_identifier_constant|
169
193
  def get_identity
170
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
194
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
171
195
  end
172
196
 
173
197
  # 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 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,31 @@ 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
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
276
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
277
+ # position 'z'.
244
278
  #
245
279
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
246
280
  # |device_identifier_constant|
247
281
  def get_identity
248
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
282
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
249
283
  end
250
284
 
251
285
  # 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 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,32 @@ 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
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
378
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
379
+ # position 'z'.
336
380
  #
337
381
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
338
382
  # |device_identifier_constant|
339
383
  def get_identity
340
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
384
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
341
385
  end
342
386
 
343
387
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.