tinkerforge 2.1.22 → 2.1.27

Sign up to get free protection for your applications and to get access to all the features.
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 UV light
14
16
  class BrickletUVLight < 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,13 +64,14 @@ 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_UV_LIGHT] = 'L'
66
- @callback_formats[CALLBACK_UV_LIGHT_REACHED] = 'L'
67
+ @callback_formats[CALLBACK_UV_LIGHT] = [12, 'L']
68
+ @callback_formats[CALLBACK_UV_LIGHT_REACHED] = [12, 'L']
67
69
 
70
+ @ipcon.add_device self
68
71
  end
69
72
 
70
- # Returns the UV light intensity of the sensor, the intensity is given
71
- # in 1/10 mW/m². The sensor has already weighted the intensity with the erythemal
73
+ # Returns the UV light intensity of the sensor.
74
+ # The sensor has already weighted the intensity with the erythemal
72
75
  # action spectrum to get the skin-affecting irradiation.
73
76
  #
74
77
  # To get UV index you just have to divide the value by 250. For example, a UV
@@ -78,23 +81,27 @@ module Tinkerforge
78
81
  # CALLBACK_UV_LIGHT callback and set the period with
79
82
  # BrickletUVLight#set_uv_light_callback_period.
80
83
  def get_uv_light
81
- send_request FUNCTION_GET_UV_LIGHT, [], '', 4, 'L'
84
+ check_validity
85
+
86
+ send_request FUNCTION_GET_UV_LIGHT, [], '', 12, 'L'
82
87
  end
83
88
 
84
- # Sets the period in ms with which the CALLBACK_UV_LIGHT callback is triggered
89
+ # Sets the period with which the CALLBACK_UV_LIGHT callback is triggered
85
90
  # periodically. A value of 0 turns the callback off.
86
91
  #
87
92
  # The CALLBACK_UV_LIGHT callback is only triggered if the intensity has changed since
88
93
  # the last triggering.
89
- #
90
- # The default value is 0.
91
94
  def set_uv_light_callback_period(period)
92
- send_request FUNCTION_SET_UV_LIGHT_CALLBACK_PERIOD, [period], 'L', 0, ''
95
+ check_validity
96
+
97
+ send_request FUNCTION_SET_UV_LIGHT_CALLBACK_PERIOD, [period], 'L', 8, ''
93
98
  end
94
99
 
95
100
  # Returns the period as set by BrickletUVLight#set_uv_light_callback_period.
96
101
  def get_uv_light_callback_period
97
- send_request FUNCTION_GET_UV_LIGHT_CALLBACK_PERIOD, [], '', 4, 'L'
102
+ check_validity
103
+
104
+ send_request FUNCTION_GET_UV_LIGHT_CALLBACK_PERIOD, [], '', 12, 'L'
98
105
  end
99
106
 
100
107
  # Sets the thresholds for the CALLBACK_UV_LIGHT_REACHED callback.
@@ -108,18 +115,20 @@ module Tinkerforge
108
115
  # "'i'", "Callback is triggered when the intensity is *inside* the min and max values"
109
116
  # "'<'", "Callback is triggered when the intensity is smaller than the min value (max is ignored)"
110
117
  # "'>'", "Callback is triggered when the intensity is greater than the min value (max is ignored)"
111
- #
112
- # The default value is ('x', 0, 0).
113
118
  def set_uv_light_callback_threshold(option, min, max)
114
- send_request FUNCTION_SET_UV_LIGHT_CALLBACK_THRESHOLD, [option, min, max], 'k L L', 0, ''
119
+ check_validity
120
+
121
+ send_request FUNCTION_SET_UV_LIGHT_CALLBACK_THRESHOLD, [option, min, max], 'k L L', 8, ''
115
122
  end
116
123
 
117
124
  # Returns the threshold as set by BrickletUVLight#set_uv_light_callback_threshold.
118
125
  def get_uv_light_callback_threshold
119
- send_request FUNCTION_GET_UV_LIGHT_CALLBACK_THRESHOLD, [], '', 9, 'k L L'
126
+ check_validity
127
+
128
+ send_request FUNCTION_GET_UV_LIGHT_CALLBACK_THRESHOLD, [], '', 17, 'k L L'
120
129
  end
121
130
 
122
- # Sets the period in ms with which the threshold callbacks
131
+ # Sets the period with which the threshold callbacks
123
132
  #
124
133
  # * CALLBACK_UV_LIGHT_REACHED,
125
134
  #
@@ -128,27 +137,31 @@ module Tinkerforge
128
137
  # * BrickletUVLight#set_uv_light_callback_threshold,
129
138
  #
130
139
  # keep being reached.
131
- #
132
- # The default value is 100.
133
140
  def set_debounce_period(debounce)
134
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
141
+ check_validity
142
+
143
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
135
144
  end
136
145
 
137
146
  # Returns the debounce period as set by BrickletUVLight#set_debounce_period.
138
147
  def get_debounce_period
139
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
148
+ check_validity
149
+
150
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
140
151
  end
141
152
 
142
153
  # Returns the UID, the UID where the Bricklet is connected to,
143
154
  # the position, the hardware and firmware version as well as the
144
155
  # device identifier.
145
156
  #
146
- # The position can be 'a', 'b', 'c' or 'd'.
157
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
158
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
159
+ # position 'z'.
147
160
  #
148
161
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
149
162
  # |device_identifier_constant|
150
163
  def get_identity
151
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
164
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
152
165
  end
153
166
 
154
167
  # 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 UV-A, UV-B and UV index
14
16
  class BrickletUVLightV2 < Device
@@ -86,7 +88,7 @@ module Tinkerforge
86
88
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
87
89
  # the IP Connection <tt>ipcon</tt>.
88
90
  def initialize(uid, ipcon)
89
- super uid, ipcon
91
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
90
92
 
91
93
  @api_version = [2, 0, 0]
92
94
 
@@ -114,14 +116,15 @@ module Tinkerforge
114
116
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
115
117
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
116
118
 
117
- @callback_formats[CALLBACK_UVA] = 'l'
118
- @callback_formats[CALLBACK_UVB] = 'l'
119
- @callback_formats[CALLBACK_UVI] = 'l'
119
+ @callback_formats[CALLBACK_UVA] = [12, 'l']
120
+ @callback_formats[CALLBACK_UVB] = [12, 'l']
121
+ @callback_formats[CALLBACK_UVI] = [12, 'l']
120
122
 
123
+ @ipcon.add_device self
121
124
  end
122
125
 
123
- # Returns the UVA intensity of the sensor, the intensity is given
124
- # in 1/10 mW/m². The sensor has not weighted the intensity with the erythemal
126
+ # Returns the UVA intensity of the sensor.
127
+ # The sensor has not weighted the intensity with the erythemal
125
128
  # action spectrum to get the skin-affecting irradiation. Therefore, you cannot
126
129
  # just divide the value by 250 to get the UVA index. To get the UV index use
127
130
  # BrickletUVLightV2#get_uvi.
@@ -137,10 +140,12 @@ module Tinkerforge
137
140
  # CALLBACK_UVA callback. You can set the callback configuration
138
141
  # with BrickletUVLightV2#set_uva_callback_configuration.
139
142
  def get_uva
140
- send_request FUNCTION_GET_UVA, [], '', 4, 'l'
143
+ check_validity
144
+
145
+ send_request FUNCTION_GET_UVA, [], '', 12, 'l'
141
146
  end
142
147
 
143
- # The period in ms is the period with which the CALLBACK_UVA callback is triggered
148
+ # The period is the period with which the CALLBACK_UVA callback is triggered
144
149
  # periodically. A value of 0 turns the callback off.
145
150
  #
146
151
  # If the `value has to change`-parameter is set to true, the callback is only
@@ -165,19 +170,21 @@ module Tinkerforge
165
170
  # "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
166
171
  #
167
172
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
168
- #
169
- # The default value is (0, false, 'x', 0, 0).
170
173
  def set_uva_callback_configuration(period, value_has_to_change, option, min, max)
171
- send_request FUNCTION_SET_UVA_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 0, ''
174
+ check_validity
175
+
176
+ send_request FUNCTION_SET_UVA_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 8, ''
172
177
  end
173
178
 
174
179
  # Returns the callback configuration as set by BrickletUVLightV2#set_uva_callback_configuration.
175
180
  def get_uva_callback_configuration
176
- send_request FUNCTION_GET_UVA_CALLBACK_CONFIGURATION, [], '', 14, 'L ? k l l'
181
+ check_validity
182
+
183
+ send_request FUNCTION_GET_UVA_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k l l'
177
184
  end
178
185
 
179
- # Returns the UVB intensity of the sensor, the intensity is given
180
- # in 1/10 mW/m². The sensor has not weighted the intensity with the erythemal
186
+ # Returns the UVB intensity of the sensor.
187
+ # The sensor has not weighted the intensity with the erythemal
181
188
  # action spectrum to get the skin-affecting irradiation. Therefore, you cannot
182
189
  # just divide the value by 250 to get the UVB index. To get the UV index use
183
190
  # BrickletUVLightV2#get_uvi.
@@ -193,10 +200,12 @@ module Tinkerforge
193
200
  # CALLBACK_UVB callback. You can set the callback configuration
194
201
  # with BrickletUVLightV2#set_uvb_callback_configuration.
195
202
  def get_uvb
196
- send_request FUNCTION_GET_UVB, [], '', 4, 'l'
203
+ check_validity
204
+
205
+ send_request FUNCTION_GET_UVB, [], '', 12, 'l'
197
206
  end
198
207
 
199
- # The period in ms is the period with which the CALLBACK_UVB callback is triggered
208
+ # The period is the period with which the CALLBACK_UVB callback is triggered
200
209
  # periodically. A value of 0 turns the callback off.
201
210
  #
202
211
  # If the `value has to change`-parameter is set to true, the callback is only
@@ -221,15 +230,17 @@ module Tinkerforge
221
230
  # "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
222
231
  #
223
232
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
224
- #
225
- # The default value is (0, false, 'x', 0, 0).
226
233
  def set_uvb_callback_configuration(period, value_has_to_change, option, min, max)
227
- send_request FUNCTION_SET_UVB_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 0, ''
234
+ check_validity
235
+
236
+ send_request FUNCTION_SET_UVB_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 8, ''
228
237
  end
229
238
 
230
239
  # Returns the callback configuration as set by BrickletUVLightV2#set_uvb_callback_configuration.
231
240
  def get_uvb_callback_configuration
232
- send_request FUNCTION_GET_UVB_CALLBACK_CONFIGURATION, [], '', 14, 'L ? k l l'
241
+ check_validity
242
+
243
+ send_request FUNCTION_GET_UVB_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k l l'
233
244
  end
234
245
 
235
246
  # Returns the UV index of the sensor, the index is given in 1/10.
@@ -245,10 +256,12 @@ module Tinkerforge
245
256
  # CALLBACK_UVI callback. You can set the callback configuration
246
257
  # with BrickletUVLightV2#set_uvi_callback_configuration.
247
258
  def get_uvi
248
- send_request FUNCTION_GET_UVI, [], '', 4, 'l'
259
+ check_validity
260
+
261
+ send_request FUNCTION_GET_UVI, [], '', 12, 'l'
249
262
  end
250
263
 
251
- # The period in ms is the period with which the CALLBACK_UVI callback is triggered
264
+ # The period is the period with which the CALLBACK_UVI callback is triggered
252
265
  # periodically. A value of 0 turns the callback off.
253
266
  #
254
267
  # If the `value has to change`-parameter is set to true, the callback is only
@@ -273,15 +286,17 @@ module Tinkerforge
273
286
  # "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
274
287
  #
275
288
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
276
- #
277
- # The default value is (0, false, 'x', 0, 0).
278
289
  def set_uvi_callback_configuration(period, value_has_to_change, option, min, max)
279
- send_request FUNCTION_SET_UVI_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 0, ''
290
+ check_validity
291
+
292
+ send_request FUNCTION_SET_UVI_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 8, ''
280
293
  end
281
294
 
282
295
  # Returns the callback configuration as set by BrickletUVLightV2#set_uvi_callback_configuration.
283
296
  def get_uvi_callback_configuration
284
- send_request FUNCTION_GET_UVI_CALLBACK_CONFIGURATION, [], '', 14, 'L ? k l l'
297
+ check_validity
298
+
299
+ send_request FUNCTION_GET_UVI_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k l l'
285
300
  end
286
301
 
287
302
  # Sets the configuration of the sensor. The integration time can be configured
@@ -292,15 +307,17 @@ module Tinkerforge
292
307
  # With a longer integration time (especially 800 ms) and a higher UV intensity the
293
308
  # sensor can be saturated. If this happens the UVA/UVB/UVI readings are all -1.
294
309
  # In this case you need to choose a shorter integration time.
295
- #
296
- # Default value: 400 ms.
297
310
  def set_configuration(integration_time)
298
- send_request FUNCTION_SET_CONFIGURATION, [integration_time], 'C', 0, ''
311
+ check_validity
312
+
313
+ send_request FUNCTION_SET_CONFIGURATION, [integration_time], 'C', 8, ''
299
314
  end
300
315
 
301
316
  # Returns the configuration as set by BrickletUVLightV2#set_configuration.
302
317
  def get_configuration
303
- send_request FUNCTION_GET_CONFIGURATION, [], '', 1, 'C'
318
+ check_validity
319
+
320
+ send_request FUNCTION_GET_CONFIGURATION, [], '', 9, 'C'
304
321
  end
305
322
 
306
323
  # Returns the error count for the communication between Brick and Bricklet.
@@ -315,7 +332,9 @@ module Tinkerforge
315
332
  # The errors counts are for errors that occur on the Bricklet side. All
316
333
  # Bricks have a similar function that returns the errors on the Brick side.
317
334
  def get_spitfp_error_count
318
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
335
+ check_validity
336
+
337
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
319
338
  end
320
339
 
321
340
  # Sets the bootloader mode and returns the status after the requested
@@ -328,12 +347,16 @@ module Tinkerforge
328
347
  # This function is used by Brick Viewer during flashing. It should not be
329
348
  # necessary to call it in a normal user program.
330
349
  def set_bootloader_mode(mode)
331
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
350
+ check_validity
351
+
352
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
332
353
  end
333
354
 
334
355
  # Returns the current bootloader mode, see BrickletUVLightV2#set_bootloader_mode.
335
356
  def get_bootloader_mode
336
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
357
+ check_validity
358
+
359
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
337
360
  end
338
361
 
339
362
  # Sets the firmware pointer for BrickletUVLightV2#write_firmware. The pointer has
@@ -343,7 +366,9 @@ module Tinkerforge
343
366
  # This function is used by Brick Viewer during flashing. It should not be
344
367
  # necessary to call it in a normal user program.
345
368
  def set_write_firmware_pointer(pointer)
346
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
369
+ check_validity
370
+
371
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
347
372
  end
348
373
 
349
374
  # Writes 64 Bytes of firmware at the position as written by
@@ -355,7 +380,9 @@ module Tinkerforge
355
380
  # This function is used by Brick Viewer during flashing. It should not be
356
381
  # necessary to call it in a normal user program.
357
382
  def write_firmware(data)
358
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
383
+ check_validity
384
+
385
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
359
386
  end
360
387
 
361
388
  # Sets the status LED configuration. By default the LED shows
@@ -366,22 +393,28 @@ module Tinkerforge
366
393
  #
367
394
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
368
395
  def set_status_led_config(config)
369
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
396
+ check_validity
397
+
398
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
370
399
  end
371
400
 
372
401
  # Returns the configuration as set by BrickletUVLightV2#set_status_led_config
373
402
  def get_status_led_config
374
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
403
+ check_validity
404
+
405
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
375
406
  end
376
407
 
377
- # Returns the temperature in °C as measured inside the microcontroller. The
408
+ # Returns the temperature as measured inside the microcontroller. The
378
409
  # value returned is not the ambient temperature!
379
410
  #
380
411
  # The temperature is only proportional to the real temperature and it has bad
381
412
  # accuracy. Practically it is only useful as an indicator for
382
413
  # temperature changes.
383
414
  def get_chip_temperature
384
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
415
+ check_validity
416
+
417
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
385
418
  end
386
419
 
387
420
  # Calling this function will reset the Bricklet. All configurations
@@ -391,7 +424,9 @@ module Tinkerforge
391
424
  # calling functions on the existing ones will result in
392
425
  # undefined behavior!
393
426
  def reset
394
- send_request FUNCTION_RESET, [], '', 0, ''
427
+ check_validity
428
+
429
+ send_request FUNCTION_RESET, [], '', 8, ''
395
430
  end
396
431
 
397
432
  # Writes a new UID into flash. If you want to set a new UID
@@ -400,25 +435,31 @@ module Tinkerforge
400
435
  #
401
436
  # We recommend that you use Brick Viewer to change the UID.
402
437
  def write_uid(uid)
403
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
438
+ check_validity
439
+
440
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
404
441
  end
405
442
 
406
443
  # Returns the current UID as an integer. Encode as
407
444
  # Base58 to get the usual string version.
408
445
  def read_uid
409
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
446
+ check_validity
447
+
448
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
410
449
  end
411
450
 
412
451
  # Returns the UID, the UID where the Bricklet is connected to,
413
452
  # the position, the hardware and firmware version as well as the
414
453
  # device identifier.
415
454
  #
416
- # The position can be 'a', 'b', 'c' or 'd'.
455
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
456
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
457
+ # position 'z'.
417
458
  #
418
459
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
419
460
  # |device_identifier_constant|
420
461
  def get_identity
421
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
462
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
422
463
  end
423
464
 
424
465
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.