tinkerforge 2.1.17 → 2.1.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tinkerforge/brick_dc.rb +6 -6
  3. data/lib/tinkerforge/brick_imu.rb +6 -6
  4. data/lib/tinkerforge/brick_imu_v2.rb +13 -6
  5. data/lib/tinkerforge/brick_master.rb +6 -6
  6. data/lib/tinkerforge/brick_red.rb +2 -2
  7. data/lib/tinkerforge/brick_servo.rb +9 -7
  8. data/lib/tinkerforge/brick_silent_stepper.rb +13 -13
  9. data/lib/tinkerforge/brick_stepper.rb +6 -6
  10. data/lib/tinkerforge/bricklet_accelerometer.rb +2 -2
  11. data/lib/tinkerforge/bricklet_air_quality.rb +514 -0
  12. data/lib/tinkerforge/bricklet_ambient_light.rb +2 -2
  13. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +2 -2
  14. data/lib/tinkerforge/bricklet_analog_in.rb +2 -2
  15. data/lib/tinkerforge/bricklet_analog_in_v2.rb +2 -2
  16. data/lib/tinkerforge/bricklet_analog_in_v3.rb +5 -5
  17. data/lib/tinkerforge/bricklet_analog_out.rb +2 -2
  18. data/lib/tinkerforge/bricklet_analog_out_v2.rb +2 -2
  19. data/lib/tinkerforge/bricklet_analog_out_v3.rb +210 -0
  20. data/lib/tinkerforge/bricklet_barometer.rb +2 -2
  21. data/lib/tinkerforge/bricklet_barometer_v2.rb +497 -0
  22. data/lib/tinkerforge/bricklet_can.rb +2 -2
  23. data/lib/tinkerforge/bricklet_can_v2.rb +5 -5
  24. data/lib/tinkerforge/bricklet_co2.rb +2 -2
  25. data/lib/tinkerforge/bricklet_color.rb +2 -2
  26. data/lib/tinkerforge/bricklet_current12.rb +2 -2
  27. data/lib/tinkerforge/bricklet_current25.rb +2 -2
  28. data/lib/tinkerforge/bricklet_distance_ir.rb +2 -2
  29. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +398 -0
  30. data/lib/tinkerforge/bricklet_distance_us.rb +2 -2
  31. data/lib/tinkerforge/bricklet_dmx.rb +7 -5
  32. data/lib/tinkerforge/bricklet_dual_button.rb +2 -2
  33. data/lib/tinkerforge/bricklet_dual_button_v2.rb +283 -0
  34. data/lib/tinkerforge/bricklet_dual_relay.rb +2 -2
  35. data/lib/tinkerforge/bricklet_dust_detector.rb +2 -2
  36. data/lib/tinkerforge/bricklet_gps.rb +2 -2
  37. data/lib/tinkerforge/bricklet_gps_v2.rb +6 -6
  38. data/lib/tinkerforge/bricklet_hall_effect.rb +2 -2
  39. data/lib/tinkerforge/bricklet_humidity.rb +2 -2
  40. data/lib/tinkerforge/bricklet_humidity_v2.rb +5 -5
  41. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +2 -2
  42. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +336 -0
  43. data/lib/tinkerforge/bricklet_industrial_counter.rb +12 -12
  44. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +2 -2
  45. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +7 -7
  46. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +2 -2
  47. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +302 -0
  48. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +2 -2
  49. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +382 -0
  50. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +2 -2
  51. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +374 -0
  52. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +5 -5
  53. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +2 -2
  54. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +11 -11
  55. data/lib/tinkerforge/bricklet_io16.rb +2 -2
  56. data/lib/tinkerforge/bricklet_io16_v2.rb +418 -0
  57. data/lib/tinkerforge/bricklet_io4.rb +2 -2
  58. data/lib/tinkerforge/bricklet_io4_v2.rb +6 -6
  59. data/lib/tinkerforge/bricklet_isolator.rb +282 -0
  60. data/lib/tinkerforge/bricklet_joystick.rb +2 -2
  61. data/lib/tinkerforge/bricklet_laser_range_finder.rb +2 -2
  62. data/lib/tinkerforge/bricklet_lcd_128x64.rb +486 -0
  63. data/lib/tinkerforge/bricklet_lcd_16x2.rb +2 -2
  64. data/lib/tinkerforge/bricklet_lcd_20x4.rb +2 -2
  65. data/lib/tinkerforge/bricklet_led_strip.rb +2 -2
  66. data/lib/tinkerforge/bricklet_led_strip_v2.rb +8 -8
  67. data/lib/tinkerforge/bricklet_line.rb +2 -2
  68. data/lib/tinkerforge/bricklet_linear_poti.rb +2 -2
  69. data/lib/tinkerforge/bricklet_load_cell.rb +2 -2
  70. data/lib/tinkerforge/bricklet_load_cell_v2.rb +5 -5
  71. data/lib/tinkerforge/bricklet_moisture.rb +2 -2
  72. data/lib/tinkerforge/bricklet_motion_detector.rb +2 -2
  73. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +6 -6
  74. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +5 -5
  75. data/lib/tinkerforge/bricklet_multi_touch.rb +2 -2
  76. data/lib/tinkerforge/bricklet_nfc.rb +6 -6
  77. data/lib/tinkerforge/bricklet_nfc_rfid.rb +2 -2
  78. data/lib/tinkerforge/bricklet_oled_128x64.rb +2 -2
  79. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +387 -0
  80. data/lib/tinkerforge/bricklet_oled_64x48.rb +2 -2
  81. data/lib/tinkerforge/bricklet_one_wire.rb +305 -0
  82. data/lib/tinkerforge/bricklet_outdoor_weather.rb +5 -5
  83. data/lib/tinkerforge/bricklet_particulate_matter.rb +5 -5
  84. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +2 -2
  85. data/lib/tinkerforge/bricklet_piezo_speaker.rb +2 -2
  86. data/lib/tinkerforge/bricklet_ptc.rb +2 -2
  87. data/lib/tinkerforge/bricklet_ptc_v2.rb +5 -5
  88. data/lib/tinkerforge/bricklet_real_time_clock.rb +2 -2
  89. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +5 -5
  90. data/lib/tinkerforge/bricklet_remote_switch.rb +2 -2
  91. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +5 -5
  92. data/lib/tinkerforge/bricklet_rgb_led.rb +2 -2
  93. data/lib/tinkerforge/bricklet_rgb_led_button.rb +5 -5
  94. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +5 -5
  95. data/lib/tinkerforge/bricklet_rotary_encoder.rb +2 -2
  96. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +5 -5
  97. data/lib/tinkerforge/bricklet_rotary_poti.rb +2 -2
  98. data/lib/tinkerforge/bricklet_rs232.rb +2 -2
  99. data/lib/tinkerforge/bricklet_rs232_v2.rb +5 -5
  100. data/lib/tinkerforge/bricklet_rs485.rb +5 -5
  101. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +2 -2
  102. data/lib/tinkerforge/bricklet_solid_state_relay.rb +2 -2
  103. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +5 -5
  104. data/lib/tinkerforge/bricklet_sound_intensity.rb +2 -2
  105. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +9 -9
  106. data/lib/tinkerforge/bricklet_temperature.rb +2 -2
  107. data/lib/tinkerforge/bricklet_temperature_ir.rb +2 -2
  108. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +5 -5
  109. data/lib/tinkerforge/bricklet_temperature_v2.rb +278 -0
  110. data/lib/tinkerforge/bricklet_thermal_imaging.rb +5 -5
  111. data/lib/tinkerforge/bricklet_thermocouple.rb +2 -2
  112. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +5 -5
  113. data/lib/tinkerforge/bricklet_tilt.rb +2 -2
  114. data/lib/tinkerforge/bricklet_uv_light.rb +6 -5
  115. data/lib/tinkerforge/bricklet_uv_light_v2.rb +430 -0
  116. data/lib/tinkerforge/bricklet_voltage.rb +2 -2
  117. data/lib/tinkerforge/bricklet_voltage_current.rb +2 -2
  118. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +5 -5
  119. data/lib/tinkerforge/version.rb +1 -1
  120. metadata +18 -2
@@ -0,0 +1,374 @@
1
+ # -*- ruby encoding: utf-8 -*-
2
+ #############################################################
3
+ # This file was automatically generated on 2018-09-28. #
4
+ # #
5
+ # Ruby Bindings Version 2.1.18 #
6
+ # #
7
+ # If you have a bugfix for this file and want to commit it, #
8
+ # please fix the bug in the generator. You can find a link #
9
+ # to the generators git repository on tinkerforge.com #
10
+ #############################################################
11
+
12
+ module Tinkerforge
13
+ # Measures two DC voltages between -35V and +35V with 24bit resolution each
14
+ class BrickletIndustrialDualAnalogInV2 < Device
15
+ DEVICE_IDENTIFIER = 2121 # :nodoc:
16
+ DEVICE_DISPLAY_NAME = 'Industrial Dual Analog In Bricklet 2.0' # :nodoc:
17
+
18
+ # This callback is triggered periodically according to the configuration set by
19
+ # BrickletIndustrialDualAnalogInV2#set_voltage_callback_configuration.
20
+ #
21
+ # The parameter is the same as BrickletIndustrialDualAnalogInV2#get_voltage.
22
+ CALLBACK_VOLTAGE = 4
23
+
24
+ FUNCTION_GET_VOLTAGE = 1 # :nodoc:
25
+ FUNCTION_SET_VOLTAGE_CALLBACK_CONFIGURATION = 2 # :nodoc:
26
+ FUNCTION_GET_VOLTAGE_CALLBACK_CONFIGURATION = 3 # :nodoc:
27
+ FUNCTION_SET_SAMPLE_RATE = 5 # :nodoc:
28
+ FUNCTION_GET_SAMPLE_RATE = 6 # :nodoc:
29
+ FUNCTION_SET_CALIBRATION = 7 # :nodoc:
30
+ FUNCTION_GET_CALIBRATION = 8 # :nodoc:
31
+ FUNCTION_GET_ADC_VALUES = 9 # :nodoc:
32
+ FUNCTION_SET_CHANNEL_LED_CONFIG = 10 # :nodoc:
33
+ FUNCTION_GET_CHANNEL_LED_CONFIG = 11 # :nodoc:
34
+ FUNCTION_SET_CHANNEL_LED_STATUS_CONFIG = 12 # :nodoc:
35
+ FUNCTION_GET_CHANNEL_LED_STATUS_CONFIG = 13 # :nodoc:
36
+ FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
37
+ FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
38
+ FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
39
+ FUNCTION_SET_WRITE_FIRMWARE_POINTER = 237 # :nodoc:
40
+ FUNCTION_WRITE_FIRMWARE = 238 # :nodoc:
41
+ FUNCTION_SET_STATUS_LED_CONFIG = 239 # :nodoc:
42
+ FUNCTION_GET_STATUS_LED_CONFIG = 240 # :nodoc:
43
+ FUNCTION_GET_CHIP_TEMPERATURE = 242 # :nodoc:
44
+ FUNCTION_RESET = 243 # :nodoc:
45
+ FUNCTION_WRITE_UID = 248 # :nodoc:
46
+ FUNCTION_READ_UID = 249 # :nodoc:
47
+ FUNCTION_GET_IDENTITY = 255 # :nodoc:
48
+
49
+ THRESHOLD_OPTION_OFF = 'x' # :nodoc:
50
+ THRESHOLD_OPTION_OUTSIDE = 'o' # :nodoc:
51
+ THRESHOLD_OPTION_INSIDE = 'i' # :nodoc:
52
+ THRESHOLD_OPTION_SMALLER = '<' # :nodoc:
53
+ THRESHOLD_OPTION_GREATER = '>' # :nodoc:
54
+ SAMPLE_RATE_976_SPS = 0 # :nodoc:
55
+ SAMPLE_RATE_488_SPS = 1 # :nodoc:
56
+ SAMPLE_RATE_244_SPS = 2 # :nodoc:
57
+ SAMPLE_RATE_122_SPS = 3 # :nodoc:
58
+ SAMPLE_RATE_61_SPS = 4 # :nodoc:
59
+ SAMPLE_RATE_4_SPS = 5 # :nodoc:
60
+ SAMPLE_RATE_2_SPS = 6 # :nodoc:
61
+ SAMPLE_RATE_1_SPS = 7 # :nodoc:
62
+ CHANNEL_LED_CONFIG_OFF = 0 # :nodoc:
63
+ CHANNEL_LED_CONFIG_ON = 1 # :nodoc:
64
+ CHANNEL_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
65
+ CHANNEL_LED_CONFIG_SHOW_CHANNEL_STATUS = 3 # :nodoc:
66
+ CHANNEL_LED_STATUS_CONFIG_THRESHOLD = 0 # :nodoc:
67
+ CHANNEL_LED_STATUS_CONFIG_INTENSITY = 1 # :nodoc:
68
+ BOOTLOADER_MODE_BOOTLOADER = 0 # :nodoc:
69
+ BOOTLOADER_MODE_FIRMWARE = 1 # :nodoc:
70
+ BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT = 2 # :nodoc:
71
+ BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT = 3 # :nodoc:
72
+ BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT = 4 # :nodoc:
73
+ BOOTLOADER_STATUS_OK = 0 # :nodoc:
74
+ BOOTLOADER_STATUS_INVALID_MODE = 1 # :nodoc:
75
+ BOOTLOADER_STATUS_NO_CHANGE = 2 # :nodoc:
76
+ BOOTLOADER_STATUS_ENTRY_FUNCTION_NOT_PRESENT = 3 # :nodoc:
77
+ BOOTLOADER_STATUS_DEVICE_IDENTIFIER_INCORRECT = 4 # :nodoc:
78
+ BOOTLOADER_STATUS_CRC_MISMATCH = 5 # :nodoc:
79
+ STATUS_LED_CONFIG_OFF = 0 # :nodoc:
80
+ STATUS_LED_CONFIG_ON = 1 # :nodoc:
81
+ STATUS_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
82
+ STATUS_LED_CONFIG_SHOW_STATUS = 3 # :nodoc:
83
+
84
+ # Creates an object with the unique device ID <tt>uid</tt> and adds it to
85
+ # the IP Connection <tt>ipcon</tt>.
86
+ def initialize(uid, ipcon)
87
+ super uid, ipcon
88
+
89
+ @api_version = [2, 0, 0]
90
+
91
+ @response_expected[FUNCTION_GET_VOLTAGE] = RESPONSE_EXPECTED_ALWAYS_TRUE
92
+ @response_expected[FUNCTION_SET_VOLTAGE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
93
+ @response_expected[FUNCTION_GET_VOLTAGE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
94
+ @response_expected[FUNCTION_SET_SAMPLE_RATE] = RESPONSE_EXPECTED_FALSE
95
+ @response_expected[FUNCTION_GET_SAMPLE_RATE] = RESPONSE_EXPECTED_ALWAYS_TRUE
96
+ @response_expected[FUNCTION_SET_CALIBRATION] = RESPONSE_EXPECTED_FALSE
97
+ @response_expected[FUNCTION_GET_CALIBRATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
98
+ @response_expected[FUNCTION_GET_ADC_VALUES] = RESPONSE_EXPECTED_ALWAYS_TRUE
99
+ @response_expected[FUNCTION_SET_CHANNEL_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
100
+ @response_expected[FUNCTION_GET_CHANNEL_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
101
+ @response_expected[FUNCTION_SET_CHANNEL_LED_STATUS_CONFIG] = RESPONSE_EXPECTED_FALSE
102
+ @response_expected[FUNCTION_GET_CHANNEL_LED_STATUS_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
103
+ @response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
104
+ @response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
105
+ @response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
106
+ @response_expected[FUNCTION_SET_WRITE_FIRMWARE_POINTER] = RESPONSE_EXPECTED_FALSE
107
+ @response_expected[FUNCTION_WRITE_FIRMWARE] = RESPONSE_EXPECTED_ALWAYS_TRUE
108
+ @response_expected[FUNCTION_SET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
109
+ @response_expected[FUNCTION_GET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
110
+ @response_expected[FUNCTION_GET_CHIP_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
111
+ @response_expected[FUNCTION_RESET] = RESPONSE_EXPECTED_FALSE
112
+ @response_expected[FUNCTION_WRITE_UID] = RESPONSE_EXPECTED_FALSE
113
+ @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
114
+ @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
115
+
116
+ @callback_formats[CALLBACK_VOLTAGE] = 'C l'
117
+
118
+ end
119
+
120
+ # Returns the voltage for the given channel in mV.
121
+ #
122
+ #
123
+ # If you want to get the value periodically, it is recommended to use the
124
+ # CALLBACK_VOLTAGE callback. You can set the callback configuration
125
+ # with BrickletIndustrialDualAnalogInV2#set_voltage_callback_configuration.
126
+ def get_voltage(channel)
127
+ send_request FUNCTION_GET_VOLTAGE, [channel], 'C', 4, 'l'
128
+ end
129
+
130
+ # The period in ms is the period with which the CALLBACK_VOLTAGE callback is triggered
131
+ # periodically. A value of 0 turns the callback off.
132
+ #
133
+ # If the `value has to change`-parameter is set to true, the callback is only
134
+ # triggered after the value has changed. If the value didn't change
135
+ # within the period, the callback is triggered immediately on change.
136
+ #
137
+ # If it is set to false, the callback is continuously triggered with the period,
138
+ # independent of the value.
139
+ #
140
+ # It is furthermore possible to constrain the callback with thresholds.
141
+ #
142
+ # The `option`-parameter together with min/max sets a threshold for the CALLBACK_VOLTAGE callback.
143
+ #
144
+ # The following options are possible:
145
+ #
146
+ # "Option", "Description"
147
+ #
148
+ # "'x'", "Threshold is turned off"
149
+ # "'o'", "Threshold is triggered when the value is *outside* the min and max values"
150
+ # "'i'", "Threshold is triggered when the value is *inside* or equal to the min and max values"
151
+ # "'<'", "Threshold is triggered when the value is smaller than the min value (max is ignored)"
152
+ # "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
153
+ #
154
+ # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
155
+ #
156
+ # The default value is (0, false, 'x', 0, 0).
157
+ def set_voltage_callback_configuration(channel, period, value_has_to_change, option, min, max)
158
+ send_request FUNCTION_SET_VOLTAGE_CALLBACK_CONFIGURATION, [channel, period, value_has_to_change, option, min, max], 'C L ? k l l', 0, ''
159
+ end
160
+
161
+ # Returns the callback configuration as set by BrickletIndustrialDualAnalogInV2#set_voltage_callback_configuration.
162
+ def get_voltage_callback_configuration(channel)
163
+ send_request FUNCTION_GET_VOLTAGE_CALLBACK_CONFIGURATION, [channel], 'C', 14, 'L ? k l l'
164
+ end
165
+
166
+ # Sets the sample rate. The sample rate can be between 1 sample per second
167
+ # and 976 samples per second. Decreasing the sample rate will also decrease the
168
+ # noise on the data.
169
+ #
170
+ # The default value is 6 (2 samples per second).
171
+ def set_sample_rate(rate)
172
+ send_request FUNCTION_SET_SAMPLE_RATE, [rate], 'C', 0, ''
173
+ end
174
+
175
+ # Returns the sample rate as set by BrickletIndustrialDualAnalogInV2#set_sample_rate.
176
+ def get_sample_rate
177
+ send_request FUNCTION_GET_SAMPLE_RATE, [], '', 1, 'C'
178
+ end
179
+
180
+ # Sets offset and gain of MCP3911 internal calibration registers.
181
+ #
182
+ # See MCP3911 datasheet 7.7 and 7.8. The Industrial Dual Analog In Bricklet 2.0
183
+ # is already factory calibrated by Tinkerforge. It should not be necessary
184
+ # for you to use this function
185
+ def set_calibration(offset, gain)
186
+ send_request FUNCTION_SET_CALIBRATION, [offset, gain], 'l2 l2', 0, ''
187
+ end
188
+
189
+ # Returns the calibration as set by BrickletIndustrialDualAnalogInV2#set_calibration.
190
+ def get_calibration
191
+ send_request FUNCTION_GET_CALIBRATION, [], '', 16, 'l2 l2'
192
+ end
193
+
194
+ # Returns the ADC values as given by the MCP3911 IC. This function
195
+ # is needed for proper calibration, see BrickletIndustrialDualAnalogInV2#set_calibration.
196
+ def get_adc_values
197
+ send_request FUNCTION_GET_ADC_VALUES, [], '', 8, 'l2'
198
+ end
199
+
200
+ # Each channel has a corresponding LED. You can turn the LED off, on or show a
201
+ # heartbeat. You can also set the LED to "Channel Status". In this mode the
202
+ # LED can either be turned on with a pre-defined threshold or the intensity
203
+ # of the LED can change with the measured value.
204
+ #
205
+ # You can configure the channel status behavior with BrickletIndustrialDualAnalogInV2#set_channel_led_status_config.
206
+ #
207
+ # By default all channel LEDs are configured as "Channel Status".
208
+ def set_channel_led_config(channel, config)
209
+ send_request FUNCTION_SET_CHANNEL_LED_CONFIG, [channel, config], 'C C', 0, ''
210
+ end
211
+
212
+ # Returns the channel LED configuration as set by BrickletIndustrialDualAnalogInV2#set_channel_led_config
213
+ def get_channel_led_config(channel)
214
+ send_request FUNCTION_GET_CHANNEL_LED_CONFIG, [channel], 'C', 1, 'C'
215
+ end
216
+
217
+ # Sets the channel LED status config. This config is used if the channel LED is
218
+ # configured as "Channel Status", see BrickletIndustrialDualAnalogInV2#set_channel_led_config.
219
+ #
220
+ # For each channel you can choose between threshold and intensity mode.
221
+ #
222
+ # In threshold mode you can define a positive or a negative threshold.
223
+ # For a positive threshold set the "min" parameter to the threshold value in mV
224
+ # above which the LED should turn on and set the "max" parameter to 0. Example:
225
+ # If you set a positive threshold of 10V, the LED will turn on as soon as the
226
+ # voltage exceeds 10V and turn off again if it goes below 10V.
227
+ # For a negative threshold set the "max" parameter to the threshold value in mV
228
+ # below which the LED should turn on and set the "min" parameter to 0. Example:
229
+ # If you set a negative threshold of 10V, the LED will turn on as soon as the
230
+ # voltage goes below 10V and the LED will turn off when the voltage exceeds 10V.
231
+ #
232
+ # In intensity mode you can define a range in mV that is used to scale the brightness
233
+ # of the LED. Example with min=4V, max=20V: The LED is off at 4V, on at 20V
234
+ # and the brightness is linearly scaled between the values 4V and 20V. If the
235
+ # min value is greater than the max value, the LED brightness is scaled the other
236
+ # way around.
237
+ #
238
+ # By default the channel LED status config is set to intensity with min=0V and
239
+ # max=10V.
240
+ def set_channel_led_status_config(channel, min, max, config)
241
+ send_request FUNCTION_SET_CHANNEL_LED_STATUS_CONFIG, [channel, min, max, config], 'C l l C', 0, ''
242
+ end
243
+
244
+ # Returns the channel LED status configuration as set by
245
+ # BrickletIndustrialDualAnalogInV2#set_channel_led_status_config.
246
+ def get_channel_led_status_config(channel)
247
+ send_request FUNCTION_GET_CHANNEL_LED_STATUS_CONFIG, [channel], 'C', 9, 'l l C'
248
+ end
249
+
250
+ # Returns the error count for the communication between Brick and Bricklet.
251
+ #
252
+ # The errors are divided into
253
+ #
254
+ # * ACK checksum errors,
255
+ # * message checksum errors,
256
+ # * framing errors and
257
+ # * overflow errors.
258
+ #
259
+ # The errors counts are for errors that occur on the Bricklet side. All
260
+ # Bricks have a similar function that returns the errors on the Brick side.
261
+ def get_spitfp_error_count
262
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
263
+ end
264
+
265
+ # Sets the bootloader mode and returns the status after the requested
266
+ # mode change was instigated.
267
+ #
268
+ # You can change from bootloader mode to firmware mode and vice versa. A change
269
+ # from bootloader mode to firmware mode will only take place if the entry function,
270
+ # device identifier and CRC are present and correct.
271
+ #
272
+ # This function is used by Brick Viewer during flashing. It should not be
273
+ # necessary to call it in a normal user program.
274
+ def set_bootloader_mode(mode)
275
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
276
+ end
277
+
278
+ # Returns the current bootloader mode, see BrickletIndustrialDualAnalogInV2#set_bootloader_mode.
279
+ def get_bootloader_mode
280
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
281
+ end
282
+
283
+ # Sets the firmware pointer for BrickletIndustrialDualAnalogInV2#write_firmware. The pointer has
284
+ # to be increased by chunks of size 64. The data is written to flash
285
+ # every 4 chunks (which equals to one page of size 256).
286
+ #
287
+ # This function is used by Brick Viewer during flashing. It should not be
288
+ # necessary to call it in a normal user program.
289
+ def set_write_firmware_pointer(pointer)
290
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
291
+ end
292
+
293
+ # Writes 64 Bytes of firmware at the position as written by
294
+ # BrickletIndustrialDualAnalogInV2#set_write_firmware_pointer before. The firmware is written
295
+ # to flash every 4 chunks.
296
+ #
297
+ # You can only write firmware in bootloader mode.
298
+ #
299
+ # This function is used by Brick Viewer during flashing. It should not be
300
+ # necessary to call it in a normal user program.
301
+ def write_firmware(data)
302
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
303
+ end
304
+
305
+ # Sets the status LED configuration. By default the LED shows
306
+ # communication traffic between Brick and Bricklet, it flickers once
307
+ # for every 10 received data packets.
308
+ #
309
+ # You can also turn the LED permanently on/off or show a heartbeat.
310
+ #
311
+ # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
312
+ def set_status_led_config(config)
313
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
314
+ end
315
+
316
+ # Returns the configuration as set by BrickletIndustrialDualAnalogInV2#set_status_led_config
317
+ def get_status_led_config
318
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
319
+ end
320
+
321
+ # Returns the temperature in °C as measured inside the microcontroller. The
322
+ # value returned is not the ambient temperature!
323
+ #
324
+ # The temperature is only proportional to the real temperature and it has bad
325
+ # accuracy. Practically it is only useful as an indicator for
326
+ # temperature changes.
327
+ def get_chip_temperature
328
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
329
+ end
330
+
331
+ # Calling this function will reset the Bricklet. All configurations
332
+ # will be lost.
333
+ #
334
+ # After a reset you have to create new device objects,
335
+ # calling functions on the existing ones will result in
336
+ # undefined behavior!
337
+ def reset
338
+ send_request FUNCTION_RESET, [], '', 0, ''
339
+ end
340
+
341
+ # Writes a new UID into flash. If you want to set a new UID
342
+ # you have to decode the Base58 encoded UID string into an
343
+ # integer first.
344
+ #
345
+ # We recommend that you use Brick Viewer to change the UID.
346
+ def write_uid(uid)
347
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
348
+ end
349
+
350
+ # Returns the current UID as an integer. Encode as
351
+ # Base58 to get the usual string version.
352
+ def read_uid
353
+ send_request FUNCTION_READ_UID, [], '', 4, 'L'
354
+ end
355
+
356
+ # Returns the UID, the UID where the Bricklet is connected to,
357
+ # the position, the hardware and firmware version as well as the
358
+ # device identifier.
359
+ #
360
+ # The position can be 'a', 'b', 'c' or 'd'.
361
+ #
362
+ # The device identifier numbers can be found :ref:`here <device_identifier>`.
363
+ # |device_identifier_constant|
364
+ def get_identity
365
+ send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
366
+ end
367
+
368
+ # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
369
+ def register_callback(id, &block)
370
+ callback = block
371
+ @registered_callbacks[id] = callback
372
+ end
373
+ end
374
+ end
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2018-06-08. #
3
+ # This file was automatically generated on 2018-09-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.17 #
5
+ # Ruby Bindings Version 2.1.18 #
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 #
@@ -140,9 +140,9 @@ module Tinkerforge
140
140
  #
141
141
  # The errors are divided into
142
142
  #
143
- # * ack checksum errors,
143
+ # * ACK checksum errors,
144
144
  # * message checksum errors,
145
- # * frameing errors and
145
+ # * framing errors and
146
146
  # * overflow errors.
147
147
  #
148
148
  # The errors counts are for errors that occur on the Bricklet side. All
@@ -156,7 +156,7 @@ module Tinkerforge
156
156
  #
157
157
  # You can change from bootloader mode to firmware mode and vice versa. A change
158
158
  # from bootloader mode to firmware mode will only take place if the entry function,
159
- # device identifier und crc are present and correct.
159
+ # device identifier and CRC are present and correct.
160
160
  #
161
161
  # This function is used by Brick Viewer during flashing. It should not be
162
162
  # necessary to call it in a normal user program.
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2018-06-08. #
3
+ # This file was automatically generated on 2018-09-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.17 #
5
+ # Ruby Bindings Version 2.1.18 #
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 #
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2018-06-08. #
3
+ # This file was automatically generated on 2018-09-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.17 #
5
+ # Ruby Bindings Version 2.1.18 #
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 #
@@ -140,27 +140,27 @@ module Tinkerforge
140
140
  send_request FUNCTION_SET_SELECTED_VALUE, [channel, value], 'C ?', 0, ''
141
141
  end
142
142
 
143
- # Each channel has a corresponding LED. You can turn the LED Off, On or show a
143
+ # Each channel has a corresponding LED. You can turn the LED off, on or show a
144
144
  # heartbeat. You can also set the LED to "Channel Status". In this mode the
145
145
  # LED is on if the channel is high and off otherwise.
146
146
  #
147
147
  # By default all channel LEDs are configured as "Channel Status".
148
- def set_channel_led_config(led, config)
149
- send_request FUNCTION_SET_CHANNEL_LED_CONFIG, [led, config], 'C C', 0, ''
148
+ def set_channel_led_config(channel, config)
149
+ send_request FUNCTION_SET_CHANNEL_LED_CONFIG, [channel, config], 'C C', 0, ''
150
150
  end
151
151
 
152
- # Returns the Channel LED configuration as set by BrickletIndustrialQuadRelayV2#set_channel_led_config
153
- def get_channel_led_config(led)
154
- send_request FUNCTION_GET_CHANNEL_LED_CONFIG, [led], 'C', 1, 'C'
152
+ # Returns the channel LED configuration as set by BrickletIndustrialQuadRelayV2#set_channel_led_config
153
+ def get_channel_led_config(channel)
154
+ send_request FUNCTION_GET_CHANNEL_LED_CONFIG, [channel], 'C', 1, 'C'
155
155
  end
156
156
 
157
157
  # Returns the error count for the communication between Brick and Bricklet.
158
158
  #
159
159
  # The errors are divided into
160
160
  #
161
- # * ack checksum errors,
161
+ # * ACK checksum errors,
162
162
  # * message checksum errors,
163
- # * frameing errors and
163
+ # * framing errors and
164
164
  # * overflow errors.
165
165
  #
166
166
  # The errors counts are for errors that occur on the Bricklet side. All
@@ -174,7 +174,7 @@ module Tinkerforge
174
174
  #
175
175
  # You can change from bootloader mode to firmware mode and vice versa. A change
176
176
  # from bootloader mode to firmware mode will only take place if the entry function,
177
- # device identifier und crc are present and correct.
177
+ # device identifier and CRC are present and correct.
178
178
  #
179
179
  # This function is used by Brick Viewer during flashing. It should not be
180
180
  # necessary to call it in a normal user program.
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2018-06-08. #
3
+ # This file was automatically generated on 2018-09-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.17 #
5
+ # Ruby Bindings Version 2.1.18 #
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 #