tinkerforge 2.1.22 → 2.1.27

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 (144) hide show
  1. checksums.yaml +5 -5
  2. data/lib/tinkerforge/brick_dc.rb +157 -76
  3. data/lib/tinkerforge/brick_hat.rb +115 -32
  4. data/lib/tinkerforge/brick_hat_zero.rb +119 -21
  5. data/lib/tinkerforge/brick_imu.rb +192 -87
  6. data/lib/tinkerforge/brick_imu_v2.rb +220 -119
  7. data/lib/tinkerforge/brick_master.rb +498 -198
  8. data/lib/tinkerforge/brick_red.rb +197 -74
  9. data/lib/tinkerforge/brick_servo.rb +187 -103
  10. data/lib/tinkerforge/brick_silent_stepper.rb +249 -169
  11. data/lib/tinkerforge/brick_stepper.rb +214 -102
  12. data/lib/tinkerforge/bricklet_accelerometer.rb +61 -36
  13. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +167 -48
  14. data/lib/tinkerforge/bricklet_air_quality.rb +123 -76
  15. data/lib/tinkerforge/bricklet_ambient_light.rb +62 -46
  16. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +41 -28
  17. data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -28
  18. data/lib/tinkerforge/bricklet_analog_in.rb +66 -45
  19. data/lib/tinkerforge/bricklet_analog_in_v2.rb +60 -43
  20. data/lib/tinkerforge/bricklet_analog_in_v3.rb +68 -32
  21. data/lib/tinkerforge/bricklet_analog_out.rb +25 -16
  22. data/lib/tinkerforge/bricklet_analog_out_v2.rb +21 -10
  23. data/lib/tinkerforge/bricklet_analog_out_v3.rb +55 -22
  24. data/lib/tinkerforge/bricklet_barometer.rb +108 -58
  25. data/lib/tinkerforge/bricklet_barometer_v2.rb +109 -67
  26. data/lib/tinkerforge/bricklet_can.rb +84 -24
  27. data/lib/tinkerforge/bricklet_can_v2.rb +173 -72
  28. data/lib/tinkerforge/bricklet_co2.rb +36 -25
  29. data/lib/tinkerforge/bricklet_co2_v2.rb +119 -60
  30. data/lib/tinkerforge/bricklet_color.rb +77 -49
  31. data/lib/tinkerforge/bricklet_color_v2.rb +493 -0
  32. data/lib/tinkerforge/bricklet_compass.rb +397 -0
  33. data/lib/tinkerforge/bricklet_current12.rb +61 -40
  34. data/lib/tinkerforge/bricklet_current25.rb +61 -40
  35. data/lib/tinkerforge/bricklet_distance_ir.rb +60 -38
  36. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +85 -45
  37. data/lib/tinkerforge/bricklet_distance_us.rb +43 -30
  38. data/lib/tinkerforge/bricklet_distance_us_v2.rb +335 -0
  39. data/lib/tinkerforge/bricklet_dmx.rb +92 -48
  40. data/lib/tinkerforge/bricklet_dual_button.rb +23 -12
  41. data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -29
  42. data/lib/tinkerforge/bricklet_dual_relay.rb +27 -14
  43. data/lib/tinkerforge/bricklet_dust_detector.rb +43 -30
  44. data/lib/tinkerforge/bricklet_e_paper_296x128.rb +115 -63
  45. data/lib/tinkerforge/bricklet_energy_monitor.rb +416 -0
  46. data/lib/tinkerforge/bricklet_gps.rb +72 -48
  47. data/lib/tinkerforge/bricklet_gps_v2.rb +124 -73
  48. data/lib/tinkerforge/bricklet_hall_effect.rb +43 -28
  49. data/lib/tinkerforge/bricklet_hall_effect_v2.rb +76 -44
  50. data/lib/tinkerforge/bricklet_humidity.rb +54 -38
  51. data/lib/tinkerforge/bricklet_humidity_v2.rb +86 -49
  52. data/lib/tinkerforge/bricklet_imu_v3.rb +784 -0
  53. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +41 -18
  54. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +84 -40
  55. data/lib/tinkerforge/bricklet_industrial_counter.rb +102 -59
  56. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +51 -24
  57. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +79 -40
  58. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -15
  59. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +75 -33
  60. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +43 -29
  61. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +81 -44
  62. data/lib/tinkerforge/bricklet_industrial_dual_ac_relay.rb +325 -0
  63. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +51 -30
  64. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +139 -40
  65. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +63 -28
  66. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -15
  67. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -28
  68. data/lib/tinkerforge/bricklet_io16.rb +57 -32
  69. data/lib/tinkerforge/bricklet_io16_v2.rb +93 -48
  70. data/lib/tinkerforge/bricklet_io4.rb +56 -31
  71. data/lib/tinkerforge/bricklet_io4_v2.rb +109 -57
  72. data/lib/tinkerforge/bricklet_isolator.rb +111 -35
  73. data/lib/tinkerforge/bricklet_joystick.rb +63 -42
  74. data/lib/tinkerforge/bricklet_joystick_v2.rb +71 -35
  75. data/lib/tinkerforge/bricklet_laser_range_finder.rb +87 -59
  76. data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +101 -53
  77. data/lib/tinkerforge/bricklet_lcd_128x64.rb +241 -131
  78. data/lib/tinkerforge/bricklet_lcd_16x2.rb +49 -25
  79. data/lib/tinkerforge/bricklet_lcd_20x4.rb +59 -29
  80. data/lib/tinkerforge/bricklet_led_strip.rb +69 -47
  81. data/lib/tinkerforge/bricklet_led_strip_v2.rb +105 -48
  82. data/lib/tinkerforge/bricklet_line.rb +35 -22
  83. data/lib/tinkerforge/bricklet_linear_poti.rb +53 -35
  84. data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -24
  85. data/lib/tinkerforge/bricklet_load_cell.rb +64 -40
  86. data/lib/tinkerforge/bricklet_load_cell_v2.rb +81 -41
  87. data/lib/tinkerforge/bricklet_moisture.rb +43 -30
  88. data/lib/tinkerforge/bricklet_motion_detector.rb +21 -10
  89. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -29
  90. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -32
  91. data/lib/tinkerforge/bricklet_multi_touch.rb +30 -17
  92. data/lib/tinkerforge/bricklet_multi_touch_v2.rb +371 -0
  93. data/lib/tinkerforge/bricklet_nfc.rb +130 -80
  94. data/lib/tinkerforge/bricklet_nfc_rfid.rb +32 -13
  95. data/lib/tinkerforge/bricklet_oled_128x64.rb +30 -17
  96. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +97 -40
  97. data/lib/tinkerforge/bricklet_oled_64x48.rb +30 -17
  98. data/lib/tinkerforge/bricklet_one_wire.rb +65 -24
  99. data/lib/tinkerforge/bricklet_outdoor_weather.rb +84 -41
  100. data/lib/tinkerforge/bricklet_particulate_matter.rb +85 -37
  101. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -13
  102. data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -19
  103. data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +84 -57
  104. data/lib/tinkerforge/bricklet_ptc.rb +76 -51
  105. data/lib/tinkerforge/bricklet_ptc_v2.rb +96 -54
  106. data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -36
  107. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -47
  108. data/lib/tinkerforge/bricklet_remote_switch.rb +38 -29
  109. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +86 -49
  110. data/lib/tinkerforge/bricklet_rgb_led.rb +17 -8
  111. data/lib/tinkerforge/bricklet_rgb_led_button.rb +61 -30
  112. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +78 -33
  113. data/lib/tinkerforge/bricklet_rgb_led_v2.rb +51 -20
  114. data/lib/tinkerforge/bricklet_rotary_encoder.rb +40 -25
  115. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -27
  116. data/lib/tinkerforge/bricklet_rotary_poti.rb +55 -37
  117. data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +290 -0
  118. data/lib/tinkerforge/bricklet_rs232.rb +89 -28
  119. data/lib/tinkerforge/bricklet_rs232_v2.rb +121 -47
  120. data/lib/tinkerforge/bricklet_rs485.rb +303 -207
  121. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
  122. data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -36
  123. data/lib/tinkerforge/bricklet_solid_state_relay.rb +24 -13
  124. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +58 -25
  125. data/lib/tinkerforge/bricklet_sound_intensity.rb +36 -24
  126. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +77 -41
  127. data/lib/tinkerforge/bricklet_temperature.rb +43 -28
  128. data/lib/tinkerforge/bricklet_temperature_ir.rb +63 -47
  129. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +75 -53
  130. data/lib/tinkerforge/bricklet_temperature_v2.rb +62 -31
  131. data/lib/tinkerforge/bricklet_thermal_imaging.rb +118 -68
  132. data/lib/tinkerforge/bricklet_thermocouple.rb +46 -30
  133. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -30
  134. data/lib/tinkerforge/bricklet_tilt.rb +23 -10
  135. data/lib/tinkerforge/bricklet_uv_light.rb +37 -24
  136. data/lib/tinkerforge/bricklet_uv_light_v2.rb +87 -46
  137. data/lib/tinkerforge/bricklet_voltage.rb +54 -37
  138. data/lib/tinkerforge/bricklet_voltage_current.rb +94 -85
  139. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +103 -77
  140. data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +410 -0
  141. data/lib/tinkerforge/device_display_names.rb +165 -0
  142. data/lib/tinkerforge/ip_connection.rb +155 -33
  143. data/lib/tinkerforge/version.rb +1 -1
  144. metadata +14 -4
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-05-21. #
3
+ # This file was automatically generated on 2020-11-02. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.22 #
5
+ # Ruby Bindings Version 2.1.27 #
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 CO2 concentration in ppm
14
16
  class BrickletCO2 < Device
@@ -49,7 +51,7 @@ module Tinkerforge
49
51
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
50
52
  # the IP Connection <tt>ipcon</tt>.
51
53
  def initialize(uid, ipcon)
52
- super uid, ipcon
54
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
53
55
 
54
56
  @api_version = [2, 0, 0]
55
57
 
@@ -62,36 +64,39 @@ module Tinkerforge
62
64
  @response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
63
65
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
64
66
 
65
- @callback_formats[CALLBACK_CO2_CONCENTRATION] = 'S'
66
- @callback_formats[CALLBACK_CO2_CONCENTRATION_REACHED] = 'S'
67
+ @callback_formats[CALLBACK_CO2_CONCENTRATION] = [10, 'S']
68
+ @callback_formats[CALLBACK_CO2_CONCENTRATION_REACHED] = [10, 'S']
67
69
 
70
+ @ipcon.add_device self
68
71
  end
69
72
 
70
- # Returns the measured CO2 concentration. The value is in
71
- # `ppm (parts per million) <https://en.wikipedia.org/wiki/Parts-per_notation>`__
72
- # and between 0 to 10000.
73
+ # Returns the measured CO2 concentration.
73
74
  #
74
75
  # If you want to get the CO2 concentration periodically, it is recommended to use
75
76
  # the CALLBACK_CO2_CONCENTRATION callback and set the period with
76
77
  # BrickletCO2#set_co2_concentration_callback_period.
77
78
  def get_co2_concentration
78
- send_request FUNCTION_GET_CO2_CONCENTRATION, [], '', 2, 'S'
79
+ check_validity
80
+
81
+ send_request FUNCTION_GET_CO2_CONCENTRATION, [], '', 10, 'S'
79
82
  end
80
83
 
81
- # Sets the period in ms with which the CALLBACK_CO2_CONCENTRATION callback is
84
+ # Sets the period with which the CALLBACK_CO2_CONCENTRATION callback is
82
85
  # triggered periodically. A value of 0 turns the callback off.
83
86
  #
84
87
  # The CALLBACK_CO2_CONCENTRATION callback is only triggered if the CO2 concentration
85
88
  # has changed since the last triggering.
86
- #
87
- # The default value is 0.
88
89
  def set_co2_concentration_callback_period(period)
89
- send_request FUNCTION_SET_CO2_CONCENTRATION_CALLBACK_PERIOD, [period], 'L', 0, ''
90
+ check_validity
91
+
92
+ send_request FUNCTION_SET_CO2_CONCENTRATION_CALLBACK_PERIOD, [period], 'L', 8, ''
90
93
  end
91
94
 
92
95
  # Returns the period as set by BrickletCO2#set_co2_concentration_callback_period.
93
96
  def get_co2_concentration_callback_period
94
- send_request FUNCTION_GET_CO2_CONCENTRATION_CALLBACK_PERIOD, [], '', 4, 'L'
97
+ check_validity
98
+
99
+ send_request FUNCTION_GET_CO2_CONCENTRATION_CALLBACK_PERIOD, [], '', 12, 'L'
95
100
  end
96
101
 
97
102
  # Sets the thresholds for the CALLBACK_CO2_CONCENTRATION_REACHED callback.
@@ -105,18 +110,20 @@ module Tinkerforge
105
110
  # "'i'", "Callback is triggered when the CO2 concentration is *inside* the min and max values"
106
111
  # "'<'", "Callback is triggered when the CO2 concentration is smaller than the min value (max is ignored)"
107
112
  # "'>'", "Callback is triggered when the CO2 concentration is greater than the min value (max is ignored)"
108
- #
109
- # The default value is ('x', 0, 0).
110
113
  def set_co2_concentration_callback_threshold(option, min, max)
111
- send_request FUNCTION_SET_CO2_CONCENTRATION_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
114
+ check_validity
115
+
116
+ send_request FUNCTION_SET_CO2_CONCENTRATION_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
112
117
  end
113
118
 
114
119
  # Returns the threshold as set by BrickletCO2#set_co2_concentration_callback_threshold.
115
120
  def get_co2_concentration_callback_threshold
116
- send_request FUNCTION_GET_CO2_CONCENTRATION_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
121
+ check_validity
122
+
123
+ send_request FUNCTION_GET_CO2_CONCENTRATION_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
117
124
  end
118
125
 
119
- # Sets the period in ms with which the threshold callbacks
126
+ # Sets the period with which the threshold callbacks
120
127
  #
121
128
  # * CALLBACK_CO2_CONCENTRATION_REACHED,
122
129
  #
@@ -125,27 +132,31 @@ module Tinkerforge
125
132
  # * BrickletCO2#set_co2_concentration_callback_threshold,
126
133
  #
127
134
  # keep being reached.
128
- #
129
- # The default value is 100.
130
135
  def set_debounce_period(debounce)
131
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
136
+ check_validity
137
+
138
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
132
139
  end
133
140
 
134
141
  # Returns the debounce period as set by BrickletCO2#set_debounce_period.
135
142
  def get_debounce_period
136
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
143
+ check_validity
144
+
145
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
137
146
  end
138
147
 
139
148
  # Returns the UID, the UID where the Bricklet is connected to,
140
149
  # the position, the hardware and firmware version as well as the
141
150
  # device identifier.
142
151
  #
143
- # The position can be 'a', 'b', 'c' or 'd'.
152
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
153
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
154
+ # position 'z'.
144
155
  #
145
156
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
146
157
  # |device_identifier_constant|
147
158
  def get_identity
148
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
159
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
149
160
  end
150
161
 
151
162
  # 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-05-21. #
3
+ # This file was automatically generated on 2020-11-02. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.22 #
5
+ # Ruby Bindings Version 2.1.27 #
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 CO2 concentration, temperature and humidity
14
16
  class BrickletCO2V2 < Device
@@ -19,6 +21,10 @@ module Tinkerforge
19
21
  # BrickletCO2V2#set_all_values_callback_configuration.
20
22
  #
21
23
  # The parameters are the same as BrickletCO2V2#get_all_values.
24
+ #
25
+ # .. note::
26
+ # The sensor is able to messure up to 120 °C. However it is only specified up to 70 °C.
27
+ # Exposing the Bricklet to higher temperatures might result in permanent damage.
22
28
  CALLBACK_ALL_VALUES = 8
23
29
 
24
30
  # This callback is triggered periodically according to the configuration set by
@@ -92,7 +98,7 @@ module Tinkerforge
92
98
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
93
99
  # the IP Connection <tt>ipcon</tt>.
94
100
  def initialize(uid, ipcon)
95
- super uid, ipcon
101
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
96
102
 
97
103
  @api_version = [2, 0, 0]
98
104
 
@@ -125,48 +131,55 @@ module Tinkerforge
125
131
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
126
132
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
127
133
 
128
- @callback_formats[CALLBACK_ALL_VALUES] = 'S s S'
129
- @callback_formats[CALLBACK_CO2_CONCENTRATION] = 'S'
130
- @callback_formats[CALLBACK_TEMPERATURE] = 's'
131
- @callback_formats[CALLBACK_HUMIDITY] = 'S'
134
+ @callback_formats[CALLBACK_ALL_VALUES] = [14, 'S s S']
135
+ @callback_formats[CALLBACK_CO2_CONCENTRATION] = [10, 'S']
136
+ @callback_formats[CALLBACK_TEMPERATURE] = [10, 's']
137
+ @callback_formats[CALLBACK_HUMIDITY] = [10, 'S']
132
138
 
139
+ @ipcon.add_device self
133
140
  end
134
141
 
135
- # Returns all values measured by the CO2 Bricklet 2.0. The values are
136
- # CO2 concentration (in ppm), temperature (in 0.01 °C)
137
- # and humidity (in 0.01 %RH).
142
+ # Returns all values measured by the CO2 Bricklet 2.0.
138
143
  #
139
144
  # If you want to get the values periodically, it is recommended to use the
140
145
  # CALLBACK_ALL_VALUES callback. You can set the callback configuration
141
146
  # with BrickletCO2V2#set_all_values_callback_configuration.
147
+ #
148
+ # .. note::
149
+ # The sensor is able to messure up to 120 °C. However it is only specified up to 70 °C.
150
+ # Exposing the Bricklet to higher temperatures might result in permanent damage.
142
151
  def get_all_values
143
- send_request FUNCTION_GET_ALL_VALUES, [], '', 6, 'S s S'
152
+ check_validity
153
+
154
+ send_request FUNCTION_GET_ALL_VALUES, [], '', 14, 'S s S'
144
155
  end
145
156
 
146
- # The CO2 concentration (among other things) depends on the ambient air pressure.
157
+ # The CO2 concentration depends (among other things) on the ambient air pressure.
147
158
  #
148
159
  # To increase the accuracy of the CO2 Bricklet 2.0 you can set the current air pressure.
149
160
  # You use the :ref:`Barometer Bricklet 2.0 <barometer_v2_bricklet>` or the
150
161
  # :ref:`Air Quality Bricklet <air_quality_bricklet>` to get the current air pressure.
151
162
  #
152
- # The expected unit of the ambient air pressure value is mbar.
153
- #
154
163
  # By default air pressure compensation is disabled. Once you set a value it
155
164
  # will be used for compensation. You can turn the compensation off again by
156
165
  # setting the value to 0.
157
166
  #
158
167
  # It is sufficient to update the value every few minutes.
159
168
  def set_air_pressure(air_pressure)
160
- send_request FUNCTION_SET_AIR_PRESSURE, [air_pressure], 'S', 0, ''
169
+ check_validity
170
+
171
+ send_request FUNCTION_SET_AIR_PRESSURE, [air_pressure], 'S', 8, ''
161
172
  end
162
173
 
163
174
  # Returns the ambient air pressure as set by BrickletCO2V2#set_air_pressure.
164
175
  def get_air_pressure
165
- send_request FUNCTION_GET_AIR_PRESSURE, [], '', 2, 'S'
176
+ check_validity
177
+
178
+ send_request FUNCTION_GET_AIR_PRESSURE, [], '', 10, 'S'
166
179
  end
167
180
 
168
- # Sets a temperature offset with resolution 1/100°C. A offset of 10 will decrease
169
- # the measured temperature by 0.1°C.
181
+ # Sets a temperature offset. A offset of 10 will decrease
182
+ # the measured temperature by 0.1 °C.
170
183
  #
171
184
  # If you install this Bricklet into an enclosure and you want to measure the ambient
172
185
  # temperature, you may have to decrease the measured temperature by some value to
@@ -184,16 +197,20 @@ module Tinkerforge
184
197
  # It is sufficient to set the temperature offset once. The offset is saved in
185
198
  # non-volatile memory and is applied again after a power loss.
186
199
  def set_temperature_offset(offset)
187
- send_request FUNCTION_SET_TEMPERATURE_OFFSET, [offset], 'S', 0, ''
200
+ check_validity
201
+
202
+ send_request FUNCTION_SET_TEMPERATURE_OFFSET, [offset], 'S', 8, ''
188
203
  end
189
204
 
190
205
  # Returns the temperature offset as set by
191
206
  # BrickletCO2V2#set_temperature_offset.
192
207
  def get_temperature_offset
193
- send_request FUNCTION_GET_TEMPERATURE_OFFSET, [], '', 2, 'S'
208
+ check_validity
209
+
210
+ send_request FUNCTION_GET_TEMPERATURE_OFFSET, [], '', 10, 'S'
194
211
  end
195
212
 
196
- # The period in ms is the period with which the CALLBACK_ALL_VALUES
213
+ # The period is the period with which the CALLBACK_ALL_VALUES
197
214
  # callback is triggered periodically. A value of 0 turns the callback off.
198
215
  #
199
216
  # If the `value has to change`-parameter is set to true, the callback is only
@@ -202,29 +219,33 @@ module Tinkerforge
202
219
  #
203
220
  # If it is set to false, the callback is continuously triggered with the period,
204
221
  # independent of the value.
205
- #
206
- # The default value is (0, false).
207
222
  def set_all_values_callback_configuration(period, value_has_to_change)
208
- send_request FUNCTION_SET_ALL_VALUES_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 0, ''
223
+ check_validity
224
+
225
+ send_request FUNCTION_SET_ALL_VALUES_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
209
226
  end
210
227
 
211
228
  # Returns the callback configuration as set by
212
229
  # BrickletCO2V2#set_all_values_callback_configuration.
213
230
  def get_all_values_callback_configuration
214
- send_request FUNCTION_GET_ALL_VALUES_CALLBACK_CONFIGURATION, [], '', 5, 'L ?'
231
+ check_validity
232
+
233
+ send_request FUNCTION_GET_ALL_VALUES_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
215
234
  end
216
235
 
217
- # Returns CO2 concentration in ppm.
236
+ # Returns CO2 concentration.
218
237
  #
219
238
  #
220
239
  # If you want to get the value periodically, it is recommended to use the
221
240
  # CALLBACK_CO2_CONCENTRATION callback. You can set the callback configuration
222
241
  # with BrickletCO2V2#set_co2_concentration_callback_configuration.
223
242
  def get_co2_concentration
224
- send_request FUNCTION_GET_CO2_CONCENTRATION, [], '', 2, 'S'
243
+ check_validity
244
+
245
+ send_request FUNCTION_GET_CO2_CONCENTRATION, [], '', 10, 'S'
225
246
  end
226
247
 
227
- # The period in ms is the period with which the CALLBACK_CO2_CONCENTRATION callback is triggered
248
+ # The period is the period with which the CALLBACK_CO2_CONCENTRATION callback is triggered
228
249
  # periodically. A value of 0 turns the callback off.
229
250
  #
230
251
  # If the `value has to change`-parameter is set to true, the callback is only
@@ -249,28 +270,36 @@ module Tinkerforge
249
270
  # "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
250
271
  #
251
272
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
252
- #
253
- # The default value is (0, false, 'x', 0, 0).
254
273
  def set_co2_concentration_callback_configuration(period, value_has_to_change, option, min, max)
255
- send_request FUNCTION_SET_CO2_CONCENTRATION_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k S S', 0, ''
274
+ check_validity
275
+
276
+ send_request FUNCTION_SET_CO2_CONCENTRATION_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k S S', 8, ''
256
277
  end
257
278
 
258
279
  # Returns the callback configuration as set by BrickletCO2V2#set_co2_concentration_callback_configuration.
259
280
  def get_co2_concentration_callback_configuration
260
- send_request FUNCTION_GET_CO2_CONCENTRATION_CALLBACK_CONFIGURATION, [], '', 10, 'L ? k S S'
281
+ check_validity
282
+
283
+ send_request FUNCTION_GET_CO2_CONCENTRATION_CALLBACK_CONFIGURATION, [], '', 18, 'L ? k S S'
261
284
  end
262
285
 
263
- # Returns temperature in steps of 0.01 °C.
286
+ # Returns temperature.
287
+ #
288
+ # .. note::
289
+ # The sensor is able to messure up to 120 °C. However it is only specified up to 70 °C.
290
+ # Exposing the Bricklet to higher temperatures might result in permanent damage.
264
291
  #
265
292
  #
266
293
  # If you want to get the value periodically, it is recommended to use the
267
294
  # CALLBACK_TEMPERATURE callback. You can set the callback configuration
268
295
  # with BrickletCO2V2#set_temperature_callback_configuration.
269
296
  def get_temperature
270
- send_request FUNCTION_GET_TEMPERATURE, [], '', 2, 's'
297
+ check_validity
298
+
299
+ send_request FUNCTION_GET_TEMPERATURE, [], '', 10, 's'
271
300
  end
272
301
 
273
- # The period in ms is the period with which the CALLBACK_TEMPERATURE callback is triggered
302
+ # The period is the period with which the CALLBACK_TEMPERATURE callback is triggered
274
303
  # periodically. A value of 0 turns the callback off.
275
304
  #
276
305
  # If the `value has to change`-parameter is set to true, the callback is only
@@ -295,28 +324,32 @@ module Tinkerforge
295
324
  # "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
296
325
  #
297
326
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
298
- #
299
- # The default value is (0, false, 'x', 0, 0).
300
327
  def set_temperature_callback_configuration(period, value_has_to_change, option, min, max)
301
- send_request FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k s s', 0, ''
328
+ check_validity
329
+
330
+ send_request FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k s s', 8, ''
302
331
  end
303
332
 
304
333
  # Returns the callback configuration as set by BrickletCO2V2#set_temperature_callback_configuration.
305
334
  def get_temperature_callback_configuration
306
- send_request FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 10, 'L ? k s s'
335
+ check_validity
336
+
337
+ send_request FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 18, 'L ? k s s'
307
338
  end
308
339
 
309
- # Returns relative humidity in steps of 0.01 %RH.
340
+ # Returns relative humidity.
310
341
  #
311
342
  #
312
343
  # If you want to get the value periodically, it is recommended to use the
313
344
  # CALLBACK_HUMIDITY callback. You can set the callback configuration
314
345
  # with BrickletCO2V2#set_humidity_callback_configuration.
315
346
  def get_humidity
316
- send_request FUNCTION_GET_HUMIDITY, [], '', 2, 'S'
347
+ check_validity
348
+
349
+ send_request FUNCTION_GET_HUMIDITY, [], '', 10, 'S'
317
350
  end
318
351
 
319
- # The period in ms is the period with which the CALLBACK_HUMIDITY callback is triggered
352
+ # The period is the period with which the CALLBACK_HUMIDITY callback is triggered
320
353
  # periodically. A value of 0 turns the callback off.
321
354
  #
322
355
  # If the `value has to change`-parameter is set to true, the callback is only
@@ -341,15 +374,17 @@ module Tinkerforge
341
374
  # "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
342
375
  #
343
376
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
344
- #
345
- # The default value is (0, false, 'x', 0, 0).
346
377
  def set_humidity_callback_configuration(period, value_has_to_change, option, min, max)
347
- send_request FUNCTION_SET_HUMIDITY_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k S S', 0, ''
378
+ check_validity
379
+
380
+ send_request FUNCTION_SET_HUMIDITY_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k S S', 8, ''
348
381
  end
349
382
 
350
383
  # Returns the callback configuration as set by BrickletCO2V2#set_humidity_callback_configuration.
351
384
  def get_humidity_callback_configuration
352
- send_request FUNCTION_GET_HUMIDITY_CALLBACK_CONFIGURATION, [], '', 10, 'L ? k S S'
385
+ check_validity
386
+
387
+ send_request FUNCTION_GET_HUMIDITY_CALLBACK_CONFIGURATION, [], '', 18, 'L ? k S S'
353
388
  end
354
389
 
355
390
  # Returns the error count for the communication between Brick and Bricklet.
@@ -364,7 +399,9 @@ module Tinkerforge
364
399
  # The errors counts are for errors that occur on the Bricklet side. All
365
400
  # Bricks have a similar function that returns the errors on the Brick side.
366
401
  def get_spitfp_error_count
367
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
402
+ check_validity
403
+
404
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
368
405
  end
369
406
 
370
407
  # Sets the bootloader mode and returns the status after the requested
@@ -377,12 +414,16 @@ module Tinkerforge
377
414
  # This function is used by Brick Viewer during flashing. It should not be
378
415
  # necessary to call it in a normal user program.
379
416
  def set_bootloader_mode(mode)
380
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
417
+ check_validity
418
+
419
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
381
420
  end
382
421
 
383
422
  # Returns the current bootloader mode, see BrickletCO2V2#set_bootloader_mode.
384
423
  def get_bootloader_mode
385
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
424
+ check_validity
425
+
426
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
386
427
  end
387
428
 
388
429
  # Sets the firmware pointer for BrickletCO2V2#write_firmware. The pointer has
@@ -392,7 +433,9 @@ module Tinkerforge
392
433
  # This function is used by Brick Viewer during flashing. It should not be
393
434
  # necessary to call it in a normal user program.
394
435
  def set_write_firmware_pointer(pointer)
395
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
436
+ check_validity
437
+
438
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
396
439
  end
397
440
 
398
441
  # Writes 64 Bytes of firmware at the position as written by
@@ -404,7 +447,9 @@ module Tinkerforge
404
447
  # This function is used by Brick Viewer during flashing. It should not be
405
448
  # necessary to call it in a normal user program.
406
449
  def write_firmware(data)
407
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
450
+ check_validity
451
+
452
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
408
453
  end
409
454
 
410
455
  # Sets the status LED configuration. By default the LED shows
@@ -415,22 +460,28 @@ module Tinkerforge
415
460
  #
416
461
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
417
462
  def set_status_led_config(config)
418
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
463
+ check_validity
464
+
465
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
419
466
  end
420
467
 
421
468
  # Returns the configuration as set by BrickletCO2V2#set_status_led_config
422
469
  def get_status_led_config
423
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
470
+ check_validity
471
+
472
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
424
473
  end
425
474
 
426
- # Returns the temperature in °C as measured inside the microcontroller. The
475
+ # Returns the temperature as measured inside the microcontroller. The
427
476
  # value returned is not the ambient temperature!
428
477
  #
429
478
  # The temperature is only proportional to the real temperature and it has bad
430
479
  # accuracy. Practically it is only useful as an indicator for
431
480
  # temperature changes.
432
481
  def get_chip_temperature
433
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
482
+ check_validity
483
+
484
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
434
485
  end
435
486
 
436
487
  # Calling this function will reset the Bricklet. All configurations
@@ -440,7 +491,9 @@ module Tinkerforge
440
491
  # calling functions on the existing ones will result in
441
492
  # undefined behavior!
442
493
  def reset
443
- send_request FUNCTION_RESET, [], '', 0, ''
494
+ check_validity
495
+
496
+ send_request FUNCTION_RESET, [], '', 8, ''
444
497
  end
445
498
 
446
499
  # Writes a new UID into flash. If you want to set a new UID
@@ -449,25 +502,31 @@ module Tinkerforge
449
502
  #
450
503
  # We recommend that you use Brick Viewer to change the UID.
451
504
  def write_uid(uid)
452
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
505
+ check_validity
506
+
507
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
453
508
  end
454
509
 
455
510
  # Returns the current UID as an integer. Encode as
456
511
  # Base58 to get the usual string version.
457
512
  def read_uid
458
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
513
+ check_validity
514
+
515
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
459
516
  end
460
517
 
461
518
  # Returns the UID, the UID where the Bricklet is connected to,
462
519
  # the position, the hardware and firmware version as well as the
463
520
  # device identifier.
464
521
  #
465
- # The position can be 'a', 'b', 'c' or 'd'.
522
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
523
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
524
+ # position 'z'.
466
525
  #
467
526
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
468
527
  # |device_identifier_constant|
469
528
  def get_identity
470
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
529
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
471
530
  end
472
531
 
473
532
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.