tinkerforge 2.1.24 → 2.1.29

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 (149) hide show
  1. checksums.yaml +5 -5
  2. data/lib/tinkerforge/brick_dc.rb +156 -75
  3. data/lib/tinkerforge/brick_hat.rb +69 -31
  4. data/lib/tinkerforge/brick_hat_zero.rb +55 -23
  5. data/lib/tinkerforge/brick_imu.rb +185 -78
  6. data/lib/tinkerforge/brick_imu_v2.rb +209 -106
  7. data/lib/tinkerforge/brick_master.rb +491 -183
  8. data/lib/tinkerforge/brick_red.rb +197 -74
  9. data/lib/tinkerforge/brick_servo.rb +186 -102
  10. data/lib/tinkerforge/brick_silent_stepper.rb +247 -167
  11. data/lib/tinkerforge/brick_stepper.rb +211 -99
  12. data/lib/tinkerforge/bricklet_accelerometer.rb +57 -23
  13. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +104 -54
  14. data/lib/tinkerforge/bricklet_air_quality.rb +116 -59
  15. data/lib/tinkerforge/bricklet_ambient_light.rb +50 -21
  16. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +44 -24
  17. data/lib/tinkerforge/bricklet_ambient_light_v3.rb +65 -27
  18. data/lib/tinkerforge/bricklet_analog_in.rb +62 -25
  19. data/lib/tinkerforge/bricklet_analog_in_v2.rb +56 -23
  20. data/lib/tinkerforge/bricklet_analog_in_v3.rb +66 -25
  21. data/lib/tinkerforge/bricklet_analog_out.rb +22 -9
  22. data/lib/tinkerforge/bricklet_analog_out_v2.rb +19 -8
  23. data/lib/tinkerforge/bricklet_analog_out_v3.rb +53 -20
  24. data/lib/tinkerforge/bricklet_barometer.rb +100 -27
  25. data/lib/tinkerforge/bricklet_barometer_v2.rb +98 -37
  26. data/lib/tinkerforge/bricklet_can.rb +83 -19
  27. data/lib/tinkerforge/bricklet_can_v2.rb +171 -38
  28. data/lib/tinkerforge/bricklet_co2.rb +33 -14
  29. data/lib/tinkerforge/bricklet_co2_v2.rb +97 -38
  30. data/lib/tinkerforge/bricklet_color.rb +68 -27
  31. data/lib/tinkerforge/bricklet_color_v2.rb +86 -33
  32. data/lib/tinkerforge/bricklet_compass.rb +77 -30
  33. data/lib/tinkerforge/bricklet_current12.rb +57 -24
  34. data/lib/tinkerforge/bricklet_current25.rb +57 -24
  35. data/lib/tinkerforge/bricklet_dc_v2.rb +521 -0
  36. data/lib/tinkerforge/bricklet_distance_ir.rb +56 -23
  37. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +82 -31
  38. data/lib/tinkerforge/bricklet_distance_us.rb +39 -16
  39. data/lib/tinkerforge/bricklet_distance_us_v2.rb +66 -25
  40. data/lib/tinkerforge/bricklet_dmx.rb +87 -34
  41. data/lib/tinkerforge/bricklet_dual_button.rb +23 -10
  42. data/lib/tinkerforge/bricklet_dual_button_v2.rb +63 -24
  43. data/lib/tinkerforge/bricklet_dual_relay.rb +26 -11
  44. data/lib/tinkerforge/bricklet_dust_detector.rb +39 -16
  45. data/lib/tinkerforge/bricklet_e_paper_296x128.rb +87 -32
  46. data/lib/tinkerforge/bricklet_energy_monitor.rb +72 -27
  47. data/lib/tinkerforge/bricklet_gps.rb +63 -26
  48. data/lib/tinkerforge/bricklet_gps_v2.rb +116 -47
  49. data/lib/tinkerforge/bricklet_hall_effect.rb +42 -23
  50. data/lib/tinkerforge/bricklet_hall_effect_v2.rb +70 -27
  51. data/lib/tinkerforge/bricklet_humidity.rb +50 -21
  52. data/lib/tinkerforge/bricklet_humidity_v2.rb +82 -31
  53. data/lib/tinkerforge/bricklet_imu_v3.rb +784 -0
  54. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +37 -14
  55. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +80 -29
  56. data/lib/tinkerforge/bricklet_industrial_counter.rb +100 -39
  57. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +44 -17
  58. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +76 -29
  59. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +35 -14
  60. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +72 -27
  61. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +39 -16
  62. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +79 -30
  63. data/lib/tinkerforge/bricklet_industrial_dual_ac_relay.rb +325 -0
  64. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +48 -19
  65. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +137 -31
  66. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +60 -23
  67. data/lib/tinkerforge/bricklet_industrial_ptc.rb +475 -0
  68. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +35 -14
  69. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +66 -25
  70. data/lib/tinkerforge/bricklet_io16.rb +54 -21
  71. data/lib/tinkerforge/bricklet_io16_v2.rb +89 -34
  72. data/lib/tinkerforge/bricklet_io4.rb +54 -23
  73. data/lib/tinkerforge/bricklet_io4_v2.rb +95 -36
  74. data/lib/tinkerforge/bricklet_isolator.rb +72 -29
  75. data/lib/tinkerforge/bricklet_joystick.rb +58 -25
  76. data/lib/tinkerforge/bricklet_joystick_v2.rb +67 -26
  77. data/lib/tinkerforge/bricklet_laser_range_finder.rb +81 -32
  78. data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +95 -36
  79. data/lib/tinkerforge/bricklet_lcd_128x64.rb +191 -70
  80. data/lib/tinkerforge/bricklet_lcd_16x2.rb +44 -18
  81. data/lib/tinkerforge/bricklet_lcd_20x4.rb +57 -23
  82. data/lib/tinkerforge/bricklet_led_strip.rb +59 -22
  83. data/lib/tinkerforge/bricklet_led_strip_v2.rb +90 -46
  84. data/lib/tinkerforge/bricklet_line.rb +33 -14
  85. data/lib/tinkerforge/bricklet_linear_poti.rb +50 -21
  86. data/lib/tinkerforge/bricklet_linear_poti_v2.rb +54 -21
  87. data/lib/tinkerforge/bricklet_load_cell.rb +60 -23
  88. data/lib/tinkerforge/bricklet_load_cell_v2.rb +79 -30
  89. data/lib/tinkerforge/bricklet_moisture.rb +39 -16
  90. data/lib/tinkerforge/bricklet_motion_detector.rb +21 -10
  91. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +61 -27
  92. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +70 -27
  93. data/lib/tinkerforge/bricklet_multi_touch.rb +30 -13
  94. data/lib/tinkerforge/bricklet_multi_touch_v2.rb +75 -28
  95. data/lib/tinkerforge/bricklet_nfc.rb +126 -62
  96. data/lib/tinkerforge/bricklet_nfc_rfid.rb +32 -13
  97. data/lib/tinkerforge/bricklet_oled_128x64.rb +28 -11
  98. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +65 -24
  99. data/lib/tinkerforge/bricklet_oled_64x48.rb +28 -11
  100. data/lib/tinkerforge/bricklet_one_wire.rb +65 -24
  101. data/lib/tinkerforge/bricklet_outdoor_weather.rb +71 -28
  102. data/lib/tinkerforge/bricklet_particulate_matter.rb +74 -30
  103. data/lib/tinkerforge/bricklet_performance_dc.rb +682 -0
  104. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +18 -9
  105. data/lib/tinkerforge/bricklet_piezo_speaker.rb +21 -10
  106. data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +79 -42
  107. data/lib/tinkerforge/bricklet_ptc.rb +73 -42
  108. data/lib/tinkerforge/bricklet_ptc_v2.rb +94 -48
  109. data/lib/tinkerforge/bricklet_real_time_clock.rb +44 -33
  110. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +77 -44
  111. data/lib/tinkerforge/bricklet_remote_switch.rb +38 -29
  112. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +86 -49
  113. data/lib/tinkerforge/bricklet_rgb_led.rb +17 -8
  114. data/lib/tinkerforge/bricklet_rgb_led_button.rb +61 -30
  115. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +78 -33
  116. data/lib/tinkerforge/bricklet_rgb_led_v2.rb +51 -20
  117. data/lib/tinkerforge/bricklet_rotary_encoder.rb +38 -19
  118. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +59 -24
  119. data/lib/tinkerforge/bricklet_rotary_poti.rb +52 -28
  120. data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +56 -23
  121. data/lib/tinkerforge/bricklet_rs232.rb +89 -28
  122. data/lib/tinkerforge/bricklet_rs232_v2.rb +117 -44
  123. data/lib/tinkerforge/bricklet_rs485.rb +222 -95
  124. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
  125. data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +74 -35
  126. data/lib/tinkerforge/bricklet_servo_v2.rb +565 -0
  127. data/lib/tinkerforge/bricklet_silent_stepper_v2.rb +1024 -0
  128. data/lib/tinkerforge/bricklet_solid_state_relay.rb +24 -13
  129. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +58 -25
  130. data/lib/tinkerforge/bricklet_sound_intensity.rb +34 -18
  131. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +71 -31
  132. data/lib/tinkerforge/bricklet_temperature.rb +39 -16
  133. data/lib/tinkerforge/bricklet_temperature_ir.rb +56 -23
  134. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +70 -27
  135. data/lib/tinkerforge/bricklet_temperature_v2.rb +60 -25
  136. data/lib/tinkerforge/bricklet_thermal_imaging.rb +104 -44
  137. data/lib/tinkerforge/bricklet_thermocouple.rb +44 -24
  138. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +64 -27
  139. data/lib/tinkerforge/bricklet_tilt.rb +23 -10
  140. data/lib/tinkerforge/bricklet_uv_light.rb +35 -18
  141. data/lib/tinkerforge/bricklet_uv_light_v2.rb +84 -37
  142. data/lib/tinkerforge/bricklet_voltage.rb +51 -28
  143. data/lib/tinkerforge/bricklet_voltage_current.rb +90 -73
  144. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +89 -68
  145. data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +79 -30
  146. data/lib/tinkerforge/device_display_names.rb +170 -0
  147. data/lib/tinkerforge/ip_connection.rb +153 -33
  148. data/lib/tinkerforge/version.rb +1 -1
  149. metadata +11 -3
@@ -0,0 +1,325 @@
1
+ # -*- ruby encoding: utf-8 -*-
2
+ #############################################################
3
+ # This file was automatically generated on 2021-05-06. #
4
+ # #
5
+ # Ruby Bindings Version 2.1.29 #
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
+ require_relative './ip_connection'
13
+
14
+ module Tinkerforge
15
+ # Two relays to switch AC devices
16
+ class BrickletIndustrialDualACRelay < Device
17
+ DEVICE_IDENTIFIER = 2162 # :nodoc:
18
+ DEVICE_DISPLAY_NAME = 'Industrial Dual AC Relay Bricklet' # :nodoc:
19
+
20
+ # This callback is triggered whenever a monoflop timer reaches 0. The
21
+ # parameters contain the relay and the current state of the relay
22
+ # (the state after the monoflop).
23
+ CALLBACK_MONOFLOP_DONE = 7
24
+
25
+ FUNCTION_SET_VALUE = 1 # :nodoc:
26
+ FUNCTION_GET_VALUE = 2 # :nodoc:
27
+ FUNCTION_SET_CHANNEL_LED_CONFIG = 3 # :nodoc:
28
+ FUNCTION_GET_CHANNEL_LED_CONFIG = 4 # :nodoc:
29
+ FUNCTION_SET_MONOFLOP = 5 # :nodoc:
30
+ FUNCTION_GET_MONOFLOP = 6 # :nodoc:
31
+ FUNCTION_SET_SELECTED_VALUE = 8 # :nodoc:
32
+ FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
33
+ FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
34
+ FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
35
+ FUNCTION_SET_WRITE_FIRMWARE_POINTER = 237 # :nodoc:
36
+ FUNCTION_WRITE_FIRMWARE = 238 # :nodoc:
37
+ FUNCTION_SET_STATUS_LED_CONFIG = 239 # :nodoc:
38
+ FUNCTION_GET_STATUS_LED_CONFIG = 240 # :nodoc:
39
+ FUNCTION_GET_CHIP_TEMPERATURE = 242 # :nodoc:
40
+ FUNCTION_RESET = 243 # :nodoc:
41
+ FUNCTION_WRITE_UID = 248 # :nodoc:
42
+ FUNCTION_READ_UID = 249 # :nodoc:
43
+ FUNCTION_GET_IDENTITY = 255 # :nodoc:
44
+
45
+ CHANNEL_LED_CONFIG_OFF = 0 # :nodoc:
46
+ CHANNEL_LED_CONFIG_ON = 1 # :nodoc:
47
+ CHANNEL_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
48
+ CHANNEL_LED_CONFIG_SHOW_CHANNEL_STATUS = 3 # :nodoc:
49
+ BOOTLOADER_MODE_BOOTLOADER = 0 # :nodoc:
50
+ BOOTLOADER_MODE_FIRMWARE = 1 # :nodoc:
51
+ BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT = 2 # :nodoc:
52
+ BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT = 3 # :nodoc:
53
+ BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT = 4 # :nodoc:
54
+ BOOTLOADER_STATUS_OK = 0 # :nodoc:
55
+ BOOTLOADER_STATUS_INVALID_MODE = 1 # :nodoc:
56
+ BOOTLOADER_STATUS_NO_CHANGE = 2 # :nodoc:
57
+ BOOTLOADER_STATUS_ENTRY_FUNCTION_NOT_PRESENT = 3 # :nodoc:
58
+ BOOTLOADER_STATUS_DEVICE_IDENTIFIER_INCORRECT = 4 # :nodoc:
59
+ BOOTLOADER_STATUS_CRC_MISMATCH = 5 # :nodoc:
60
+ STATUS_LED_CONFIG_OFF = 0 # :nodoc:
61
+ STATUS_LED_CONFIG_ON = 1 # :nodoc:
62
+ STATUS_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
63
+ STATUS_LED_CONFIG_SHOW_STATUS = 3 # :nodoc:
64
+
65
+ # Creates an object with the unique device ID <tt>uid</tt> and adds it to
66
+ # the IP Connection <tt>ipcon</tt>.
67
+ def initialize(uid, ipcon)
68
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
69
+
70
+ @api_version = [2, 0, 0]
71
+
72
+ @response_expected[FUNCTION_SET_VALUE] = RESPONSE_EXPECTED_FALSE
73
+ @response_expected[FUNCTION_GET_VALUE] = RESPONSE_EXPECTED_ALWAYS_TRUE
74
+ @response_expected[FUNCTION_SET_CHANNEL_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
75
+ @response_expected[FUNCTION_GET_CHANNEL_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
76
+ @response_expected[FUNCTION_SET_MONOFLOP] = RESPONSE_EXPECTED_FALSE
77
+ @response_expected[FUNCTION_GET_MONOFLOP] = RESPONSE_EXPECTED_ALWAYS_TRUE
78
+ @response_expected[FUNCTION_SET_SELECTED_VALUE] = RESPONSE_EXPECTED_FALSE
79
+ @response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
80
+ @response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
81
+ @response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
82
+ @response_expected[FUNCTION_SET_WRITE_FIRMWARE_POINTER] = RESPONSE_EXPECTED_FALSE
83
+ @response_expected[FUNCTION_WRITE_FIRMWARE] = RESPONSE_EXPECTED_ALWAYS_TRUE
84
+ @response_expected[FUNCTION_SET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
85
+ @response_expected[FUNCTION_GET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
86
+ @response_expected[FUNCTION_GET_CHIP_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
87
+ @response_expected[FUNCTION_RESET] = RESPONSE_EXPECTED_FALSE
88
+ @response_expected[FUNCTION_WRITE_UID] = RESPONSE_EXPECTED_FALSE
89
+ @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
90
+ @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
91
+
92
+ @callback_formats[CALLBACK_MONOFLOP_DONE] = [10, 'C ?']
93
+
94
+ @ipcon.add_device self
95
+ end
96
+
97
+ # Sets the state of the relays, *true* means on and *false* means off.
98
+ # For example: (true, false) turns relay 0 on and relay 1 off.
99
+ #
100
+ # If you just want to set one of the relays and don't know the current state
101
+ # of the other relay, you can get the state with BrickletIndustrialDualACRelay#get_value or you
102
+ # can use BrickletIndustrialDualACRelay#set_selected_value.
103
+ #
104
+ # All running monoflop timers will be aborted if this function is called.
105
+ def set_value(channel0, channel1)
106
+ check_validity
107
+
108
+ send_request FUNCTION_SET_VALUE, [channel0, channel1], '? ?', 8, ''
109
+ end
110
+
111
+ # Returns the state of the relays, *true* means on and *false* means off.
112
+ def get_value
113
+ check_validity
114
+
115
+ send_request FUNCTION_GET_VALUE, [], '', 10, '? ?'
116
+ end
117
+
118
+ # Each channel has a corresponding LED. You can turn the LED off, on or show a
119
+ # heartbeat. You can also set the LED to "Channel Status". In this mode the
120
+ # LED is on if the channel is high and off otherwise.
121
+ def set_channel_led_config(channel, config)
122
+ check_validity
123
+
124
+ send_request FUNCTION_SET_CHANNEL_LED_CONFIG, [channel, config], 'C C', 8, ''
125
+ end
126
+
127
+ # Returns the channel LED configuration as set by BrickletIndustrialDualACRelay#set_channel_led_config
128
+ def get_channel_led_config(channel)
129
+ check_validity
130
+
131
+ send_request FUNCTION_GET_CHANNEL_LED_CONFIG, [channel], 'C', 9, 'C'
132
+ end
133
+
134
+ # The first parameter can be 0 or 1 (relay 0 or relay 1). The second parameter
135
+ # is the desired state of the relay (*true* means on and *false* means off).
136
+ # The third parameter indicates the time that the relay should hold
137
+ # the state.
138
+ #
139
+ # If this function is called with the parameters (1, true, 1500):
140
+ # Relay 1 will turn on and in 1.5s it will turn off again.
141
+ #
142
+ # A monoflop can be used as a failsafe mechanism. For example: Lets assume you
143
+ # have a RS485 bus and a Industrial Dual AC Relay Bricklet connected to one of the
144
+ # slave stacks. You can now call this function every second, with a time parameter
145
+ # of two seconds. The relay will be on all the time. If now the RS485
146
+ # connection is lost, the relay will turn off in at most two seconds.
147
+ def set_monoflop(channel, value, time)
148
+ check_validity
149
+
150
+ send_request FUNCTION_SET_MONOFLOP, [channel, value, time], 'C ? L', 8, ''
151
+ end
152
+
153
+ # Returns (for the given relay) the current state and the time as set by
154
+ # BrickletIndustrialDualACRelay#set_monoflop as well as the remaining time until the state flips.
155
+ #
156
+ # If the timer is not running currently, the remaining time will be returned
157
+ # as 0.
158
+ def get_monoflop(channel)
159
+ check_validity
160
+
161
+ send_request FUNCTION_GET_MONOFLOP, [channel], 'C', 17, '? L L'
162
+ end
163
+
164
+ # Sets the state of the selected relay, *true* means on and *false*
165
+ # means off.
166
+ #
167
+ # A running monoflop timer for the selected relay will be aborted if this function
168
+ # is called.
169
+ #
170
+ # The other relay remains untouched.
171
+ def set_selected_value(channel, value)
172
+ check_validity
173
+
174
+ send_request FUNCTION_SET_SELECTED_VALUE, [channel, value], 'C ?', 8, ''
175
+ end
176
+
177
+ # Returns the error count for the communication between Brick and Bricklet.
178
+ #
179
+ # The errors are divided into
180
+ #
181
+ # * ACK checksum errors,
182
+ # * message checksum errors,
183
+ # * framing errors and
184
+ # * overflow errors.
185
+ #
186
+ # The errors counts are for errors that occur on the Bricklet side. All
187
+ # Bricks have a similar function that returns the errors on the Brick side.
188
+ def get_spitfp_error_count
189
+ check_validity
190
+
191
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
192
+ end
193
+
194
+ # Sets the bootloader mode and returns the status after the requested
195
+ # mode change was instigated.
196
+ #
197
+ # You can change from bootloader mode to firmware mode and vice versa. A change
198
+ # from bootloader mode to firmware mode will only take place if the entry function,
199
+ # device identifier and CRC are present and correct.
200
+ #
201
+ # This function is used by Brick Viewer during flashing. It should not be
202
+ # necessary to call it in a normal user program.
203
+ def set_bootloader_mode(mode)
204
+ check_validity
205
+
206
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
207
+ end
208
+
209
+ # Returns the current bootloader mode, see BrickletIndustrialDualACRelay#set_bootloader_mode.
210
+ def get_bootloader_mode
211
+ check_validity
212
+
213
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
214
+ end
215
+
216
+ # Sets the firmware pointer for BrickletIndustrialDualACRelay#write_firmware. The pointer has
217
+ # to be increased by chunks of size 64. The data is written to flash
218
+ # every 4 chunks (which equals to one page of size 256).
219
+ #
220
+ # This function is used by Brick Viewer during flashing. It should not be
221
+ # necessary to call it in a normal user program.
222
+ def set_write_firmware_pointer(pointer)
223
+ check_validity
224
+
225
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
226
+ end
227
+
228
+ # Writes 64 Bytes of firmware at the position as written by
229
+ # BrickletIndustrialDualACRelay#set_write_firmware_pointer before. The firmware is written
230
+ # to flash every 4 chunks.
231
+ #
232
+ # You can only write firmware in bootloader mode.
233
+ #
234
+ # This function is used by Brick Viewer during flashing. It should not be
235
+ # necessary to call it in a normal user program.
236
+ def write_firmware(data)
237
+ check_validity
238
+
239
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
240
+ end
241
+
242
+ # Sets the status LED configuration. By default the LED shows
243
+ # communication traffic between Brick and Bricklet, it flickers once
244
+ # for every 10 received data packets.
245
+ #
246
+ # You can also turn the LED permanently on/off or show a heartbeat.
247
+ #
248
+ # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
249
+ def set_status_led_config(config)
250
+ check_validity
251
+
252
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
253
+ end
254
+
255
+ # Returns the configuration as set by BrickletIndustrialDualACRelay#set_status_led_config
256
+ def get_status_led_config
257
+ check_validity
258
+
259
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
260
+ end
261
+
262
+ # Returns the temperature as measured inside the microcontroller. The
263
+ # value returned is not the ambient temperature!
264
+ #
265
+ # The temperature is only proportional to the real temperature and it has bad
266
+ # accuracy. Practically it is only useful as an indicator for
267
+ # temperature changes.
268
+ def get_chip_temperature
269
+ check_validity
270
+
271
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
272
+ end
273
+
274
+ # Calling this function will reset the Bricklet. All configurations
275
+ # will be lost.
276
+ #
277
+ # After a reset you have to create new device objects,
278
+ # calling functions on the existing ones will result in
279
+ # undefined behavior!
280
+ def reset
281
+ check_validity
282
+
283
+ send_request FUNCTION_RESET, [], '', 8, ''
284
+ end
285
+
286
+ # Writes a new UID into flash. If you want to set a new UID
287
+ # you have to decode the Base58 encoded UID string into an
288
+ # integer first.
289
+ #
290
+ # We recommend that you use Brick Viewer to change the UID.
291
+ def write_uid(uid)
292
+ check_validity
293
+
294
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
295
+ end
296
+
297
+ # Returns the current UID as an integer. Encode as
298
+ # Base58 to get the usual string version.
299
+ def read_uid
300
+ check_validity
301
+
302
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
303
+ end
304
+
305
+ # Returns the UID, the UID where the Bricklet is connected to,
306
+ # the position, the hardware and firmware version as well as the
307
+ # device identifier.
308
+ #
309
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
310
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
311
+ # position 'z'.
312
+ #
313
+ # The device identifier numbers can be found :ref:`here <device_identifier>`.
314
+ # |device_identifier_constant|
315
+ def get_identity
316
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
317
+ end
318
+
319
+ # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
320
+ def register_callback(id, &block)
321
+ callback = block
322
+ @registered_callbacks[id] = callback
323
+ end
324
+ end
325
+ end
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-11-25. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.29 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # Measures two DC voltages between -35V and +35V with 24bit resolution each
14
16
  class BrickletIndustrialDualAnalogIn < Device
@@ -62,7 +64,7 @@ module Tinkerforge
62
64
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
63
65
  # the IP Connection <tt>ipcon</tt>.
64
66
  def initialize(uid, ipcon)
65
- super uid, ipcon
67
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
66
68
 
67
69
  @api_version = [2, 0, 0]
68
70
 
@@ -80,9 +82,10 @@ module Tinkerforge
80
82
  @response_expected[FUNCTION_GET_ADC_VALUES] = RESPONSE_EXPECTED_ALWAYS_TRUE
81
83
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
82
84
 
83
- @callback_formats[CALLBACK_VOLTAGE] = 'C l'
84
- @callback_formats[CALLBACK_VOLTAGE_REACHED] = 'C l'
85
+ @callback_formats[CALLBACK_VOLTAGE] = [13, 'C l']
86
+ @callback_formats[CALLBACK_VOLTAGE_REACHED] = [13, 'C l']
85
87
 
88
+ @ipcon.add_device self
86
89
  end
87
90
 
88
91
  # Returns the voltage for the given channel.
@@ -91,7 +94,9 @@ module Tinkerforge
91
94
  # CALLBACK_VOLTAGE callback and set the period with
92
95
  # BrickletIndustrialDualAnalogIn#set_voltage_callback_period.
93
96
  def get_voltage(channel)
94
- send_request FUNCTION_GET_VOLTAGE, [channel], 'C', 4, 'l'
97
+ check_validity
98
+
99
+ send_request FUNCTION_GET_VOLTAGE, [channel], 'C', 12, 'l'
95
100
  end
96
101
 
97
102
  # Sets the period with which the CALLBACK_VOLTAGE callback is triggered
@@ -100,12 +105,16 @@ module Tinkerforge
100
105
  # The CALLBACK_VOLTAGE callback is only triggered if the voltage has changed since the
101
106
  # last triggering.
102
107
  def set_voltage_callback_period(channel, period)
103
- send_request FUNCTION_SET_VOLTAGE_CALLBACK_PERIOD, [channel, period], 'C L', 0, ''
108
+ check_validity
109
+
110
+ send_request FUNCTION_SET_VOLTAGE_CALLBACK_PERIOD, [channel, period], 'C L', 8, ''
104
111
  end
105
112
 
106
113
  # Returns the period as set by BrickletIndustrialDualAnalogIn#set_voltage_callback_period.
107
114
  def get_voltage_callback_period(channel)
108
- send_request FUNCTION_GET_VOLTAGE_CALLBACK_PERIOD, [channel], 'C', 4, 'L'
115
+ check_validity
116
+
117
+ send_request FUNCTION_GET_VOLTAGE_CALLBACK_PERIOD, [channel], 'C', 12, 'L'
109
118
  end
110
119
 
111
120
  # Sets the thresholds for the CALLBACK_VOLTAGE_REACHED callback for the given
@@ -121,12 +130,16 @@ module Tinkerforge
121
130
  # "'<'", "Callback is triggered when the voltage is smaller than the min value (max is ignored)"
122
131
  # "'>'", "Callback is triggered when the voltage is greater than the min value (max is ignored)"
123
132
  def set_voltage_callback_threshold(channel, option, min, max)
124
- send_request FUNCTION_SET_VOLTAGE_CALLBACK_THRESHOLD, [channel, option, min, max], 'C k l l', 0, ''
133
+ check_validity
134
+
135
+ send_request FUNCTION_SET_VOLTAGE_CALLBACK_THRESHOLD, [channel, option, min, max], 'C k l l', 8, ''
125
136
  end
126
137
 
127
138
  # Returns the threshold as set by BrickletIndustrialDualAnalogIn#set_voltage_callback_threshold.
128
139
  def get_voltage_callback_threshold(channel)
129
- send_request FUNCTION_GET_VOLTAGE_CALLBACK_THRESHOLD, [channel], 'C', 9, 'k l l'
140
+ check_validity
141
+
142
+ send_request FUNCTION_GET_VOLTAGE_CALLBACK_THRESHOLD, [channel], 'C', 17, 'k l l'
130
143
  end
131
144
 
132
145
  # Sets the period with which the threshold callback
@@ -139,24 +152,32 @@ module Tinkerforge
139
152
  #
140
153
  # keeps being reached.
141
154
  def set_debounce_period(debounce)
142
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
155
+ check_validity
156
+
157
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
143
158
  end
144
159
 
145
160
  # Returns the debounce period as set by BrickletIndustrialDualAnalogIn#set_debounce_period.
146
161
  def get_debounce_period
147
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
162
+ check_validity
163
+
164
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
148
165
  end
149
166
 
150
167
  # Sets the sample rate. The sample rate can be between 1 sample per second
151
168
  # and 976 samples per second. Decreasing the sample rate will also decrease the
152
169
  # noise on the data.
153
170
  def set_sample_rate(rate)
154
- send_request FUNCTION_SET_SAMPLE_RATE, [rate], 'C', 0, ''
171
+ check_validity
172
+
173
+ send_request FUNCTION_SET_SAMPLE_RATE, [rate], 'C', 8, ''
155
174
  end
156
175
 
157
176
  # Returns the sample rate as set by BrickletIndustrialDualAnalogIn#set_sample_rate.
158
177
  def get_sample_rate
159
- send_request FUNCTION_GET_SAMPLE_RATE, [], '', 1, 'C'
178
+ check_validity
179
+
180
+ send_request FUNCTION_GET_SAMPLE_RATE, [], '', 9, 'C'
160
181
  end
161
182
 
162
183
  # Sets offset and gain of MCP3911 internal calibration registers.
@@ -165,30 +186,38 @@ module Tinkerforge
165
186
  # is already factory calibrated by Tinkerforge. It should not be necessary
166
187
  # for you to use this function
167
188
  def set_calibration(offset, gain)
168
- send_request FUNCTION_SET_CALIBRATION, [offset, gain], 'l2 l2', 0, ''
189
+ check_validity
190
+
191
+ send_request FUNCTION_SET_CALIBRATION, [offset, gain], 'l2 l2', 8, ''
169
192
  end
170
193
 
171
194
  # Returns the calibration as set by BrickletIndustrialDualAnalogIn#set_calibration.
172
195
  def get_calibration
173
- send_request FUNCTION_GET_CALIBRATION, [], '', 16, 'l2 l2'
196
+ check_validity
197
+
198
+ send_request FUNCTION_GET_CALIBRATION, [], '', 24, 'l2 l2'
174
199
  end
175
200
 
176
201
  # Returns the ADC values as given by the MCP3911 IC. This function
177
202
  # is needed for proper calibration, see BrickletIndustrialDualAnalogIn#set_calibration.
178
203
  def get_adc_values
179
- send_request FUNCTION_GET_ADC_VALUES, [], '', 8, 'l2'
204
+ check_validity
205
+
206
+ send_request FUNCTION_GET_ADC_VALUES, [], '', 16, 'l2'
180
207
  end
181
208
 
182
209
  # Returns the UID, the UID where the Bricklet is connected to,
183
210
  # the position, the hardware and firmware version as well as the
184
211
  # device identifier.
185
212
  #
186
- # The position can be 'a', 'b', 'c' or 'd'.
213
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
214
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
215
+ # position 'z'.
187
216
  #
188
217
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
189
218
  # |device_identifier_constant|
190
219
  def get_identity
191
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
220
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
192
221
  end
193
222
 
194
223
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.