tinkerforge 2.1.26 → 2.1.27

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. checksums.yaml +5 -5
  2. data/lib/tinkerforge/brick_dc.rb +3 -3
  3. data/lib/tinkerforge/brick_hat.rb +5 -7
  4. data/lib/tinkerforge/brick_hat_zero.rb +5 -7
  5. data/lib/tinkerforge/brick_imu.rb +3 -3
  6. data/lib/tinkerforge/brick_imu_v2.rb +3 -3
  7. data/lib/tinkerforge/brick_master.rb +3 -3
  8. data/lib/tinkerforge/brick_red.rb +2 -2
  9. data/lib/tinkerforge/brick_servo.rb +3 -3
  10. data/lib/tinkerforge/brick_silent_stepper.rb +3 -3
  11. data/lib/tinkerforge/brick_stepper.rb +3 -3
  12. data/lib/tinkerforge/bricklet_accelerometer.rb +3 -4
  13. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +3 -4
  14. data/lib/tinkerforge/bricklet_air_quality.rb +3 -4
  15. data/lib/tinkerforge/bricklet_ambient_light.rb +3 -4
  16. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +3 -4
  17. data/lib/tinkerforge/bricklet_ambient_light_v3.rb +3 -4
  18. data/lib/tinkerforge/bricklet_analog_in.rb +3 -4
  19. data/lib/tinkerforge/bricklet_analog_in_v2.rb +3 -4
  20. data/lib/tinkerforge/bricklet_analog_in_v3.rb +3 -4
  21. data/lib/tinkerforge/bricklet_analog_out.rb +3 -4
  22. data/lib/tinkerforge/bricklet_analog_out_v2.rb +3 -4
  23. data/lib/tinkerforge/bricklet_analog_out_v3.rb +3 -4
  24. data/lib/tinkerforge/bricklet_barometer.rb +3 -4
  25. data/lib/tinkerforge/bricklet_barometer_v2.rb +3 -4
  26. data/lib/tinkerforge/bricklet_can.rb +3 -4
  27. data/lib/tinkerforge/bricklet_can_v2.rb +3 -4
  28. data/lib/tinkerforge/bricklet_co2.rb +3 -4
  29. data/lib/tinkerforge/bricklet_co2_v2.rb +3 -4
  30. data/lib/tinkerforge/bricklet_color.rb +3 -4
  31. data/lib/tinkerforge/bricklet_color_v2.rb +3 -4
  32. data/lib/tinkerforge/bricklet_compass.rb +3 -4
  33. data/lib/tinkerforge/bricklet_current12.rb +3 -4
  34. data/lib/tinkerforge/bricklet_current25.rb +3 -4
  35. data/lib/tinkerforge/bricklet_distance_ir.rb +3 -4
  36. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +3 -4
  37. data/lib/tinkerforge/bricklet_distance_us.rb +3 -4
  38. data/lib/tinkerforge/bricklet_distance_us_v2.rb +3 -4
  39. data/lib/tinkerforge/bricklet_dmx.rb +3 -4
  40. data/lib/tinkerforge/bricklet_dual_button.rb +3 -4
  41. data/lib/tinkerforge/bricklet_dual_button_v2.rb +3 -4
  42. data/lib/tinkerforge/bricklet_dual_relay.rb +3 -4
  43. data/lib/tinkerforge/bricklet_dust_detector.rb +3 -4
  44. data/lib/tinkerforge/bricklet_e_paper_296x128.rb +3 -4
  45. data/lib/tinkerforge/bricklet_energy_monitor.rb +3 -4
  46. data/lib/tinkerforge/bricklet_gps.rb +3 -4
  47. data/lib/tinkerforge/bricklet_gps_v2.rb +3 -4
  48. data/lib/tinkerforge/bricklet_hall_effect.rb +3 -4
  49. data/lib/tinkerforge/bricklet_hall_effect_v2.rb +3 -4
  50. data/lib/tinkerforge/bricklet_humidity.rb +3 -4
  51. data/lib/tinkerforge/bricklet_humidity_v2.rb +3 -4
  52. data/lib/tinkerforge/bricklet_imu_v3.rb +784 -0
  53. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +3 -4
  54. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +3 -4
  55. data/lib/tinkerforge/bricklet_industrial_counter.rb +3 -4
  56. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +3 -4
  57. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +3 -4
  58. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +3 -4
  59. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +3 -4
  60. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +3 -4
  61. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +4 -5
  62. data/lib/tinkerforge/bricklet_industrial_dual_ac_relay.rb +325 -0
  63. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +3 -4
  64. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +3 -4
  65. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +3 -4
  66. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +3 -4
  67. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +3 -4
  68. data/lib/tinkerforge/bricklet_io16.rb +3 -4
  69. data/lib/tinkerforge/bricklet_io16_v2.rb +3 -4
  70. data/lib/tinkerforge/bricklet_io4.rb +3 -4
  71. data/lib/tinkerforge/bricklet_io4_v2.rb +3 -4
  72. data/lib/tinkerforge/bricklet_isolator.rb +4 -5
  73. data/lib/tinkerforge/bricklet_joystick.rb +3 -4
  74. data/lib/tinkerforge/bricklet_joystick_v2.rb +3 -4
  75. data/lib/tinkerforge/bricklet_laser_range_finder.rb +3 -4
  76. data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +3 -4
  77. data/lib/tinkerforge/bricklet_lcd_128x64.rb +3 -4
  78. data/lib/tinkerforge/bricklet_lcd_16x2.rb +3 -4
  79. data/lib/tinkerforge/bricklet_lcd_20x4.rb +3 -4
  80. data/lib/tinkerforge/bricklet_led_strip.rb +3 -4
  81. data/lib/tinkerforge/bricklet_led_strip_v2.rb +3 -4
  82. data/lib/tinkerforge/bricklet_line.rb +3 -4
  83. data/lib/tinkerforge/bricklet_linear_poti.rb +3 -4
  84. data/lib/tinkerforge/bricklet_linear_poti_v2.rb +3 -4
  85. data/lib/tinkerforge/bricklet_load_cell.rb +3 -4
  86. data/lib/tinkerforge/bricklet_load_cell_v2.rb +3 -4
  87. data/lib/tinkerforge/bricklet_moisture.rb +3 -4
  88. data/lib/tinkerforge/bricklet_motion_detector.rb +3 -4
  89. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +3 -4
  90. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +3 -4
  91. data/lib/tinkerforge/bricklet_multi_touch.rb +3 -4
  92. data/lib/tinkerforge/bricklet_multi_touch_v2.rb +3 -4
  93. data/lib/tinkerforge/bricklet_nfc.rb +7 -8
  94. data/lib/tinkerforge/bricklet_nfc_rfid.rb +3 -4
  95. data/lib/tinkerforge/bricklet_oled_128x64.rb +3 -4
  96. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +3 -4
  97. data/lib/tinkerforge/bricklet_oled_64x48.rb +3 -4
  98. data/lib/tinkerforge/bricklet_one_wire.rb +3 -4
  99. data/lib/tinkerforge/bricklet_outdoor_weather.rb +4 -5
  100. data/lib/tinkerforge/bricklet_particulate_matter.rb +3 -4
  101. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +3 -4
  102. data/lib/tinkerforge/bricklet_piezo_speaker.rb +3 -4
  103. data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +3 -4
  104. data/lib/tinkerforge/bricklet_ptc.rb +3 -4
  105. data/lib/tinkerforge/bricklet_ptc_v2.rb +3 -4
  106. data/lib/tinkerforge/bricklet_real_time_clock.rb +3 -4
  107. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +3 -4
  108. data/lib/tinkerforge/bricklet_remote_switch.rb +3 -4
  109. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +3 -4
  110. data/lib/tinkerforge/bricklet_rgb_led.rb +3 -4
  111. data/lib/tinkerforge/bricklet_rgb_led_button.rb +3 -4
  112. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +3 -4
  113. data/lib/tinkerforge/bricklet_rgb_led_v2.rb +3 -4
  114. data/lib/tinkerforge/bricklet_rotary_encoder.rb +3 -4
  115. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +3 -4
  116. data/lib/tinkerforge/bricklet_rotary_poti.rb +3 -4
  117. data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +3 -4
  118. data/lib/tinkerforge/bricklet_rs232.rb +3 -4
  119. data/lib/tinkerforge/bricklet_rs232_v2.rb +3 -4
  120. data/lib/tinkerforge/bricklet_rs485.rb +3 -4
  121. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +3 -4
  122. data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +3 -4
  123. data/lib/tinkerforge/bricklet_solid_state_relay.rb +3 -4
  124. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +3 -4
  125. data/lib/tinkerforge/bricklet_sound_intensity.rb +3 -4
  126. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +3 -4
  127. data/lib/tinkerforge/bricklet_temperature.rb +3 -4
  128. data/lib/tinkerforge/bricklet_temperature_ir.rb +3 -4
  129. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +3 -4
  130. data/lib/tinkerforge/bricklet_temperature_v2.rb +3 -4
  131. data/lib/tinkerforge/bricklet_thermal_imaging.rb +3 -4
  132. data/lib/tinkerforge/bricklet_thermocouple.rb +3 -4
  133. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +3 -4
  134. data/lib/tinkerforge/bricklet_tilt.rb +3 -4
  135. data/lib/tinkerforge/bricklet_uv_light.rb +3 -4
  136. data/lib/tinkerforge/bricklet_uv_light_v2.rb +3 -4
  137. data/lib/tinkerforge/bricklet_voltage.rb +3 -4
  138. data/lib/tinkerforge/bricklet_voltage_current.rb +3 -4
  139. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +3 -4
  140. data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +3 -4
  141. data/lib/tinkerforge/device_display_names.rb +5 -3
  142. data/lib/tinkerforge/version.rb +1 -1
  143. metadata +5 -3
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2020-05-19. #
3
+ # This file was automatically generated on 2020-11-02. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.26 #
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 #
@@ -148,8 +148,7 @@ module Tinkerforge
148
148
  # device identifier.
149
149
  #
150
150
  # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
151
- # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
152
- # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
151
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
153
152
  # position 'z'.
154
153
  #
155
154
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2020-05-19. #
3
+ # This file was automatically generated on 2020-11-02. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.26 #
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 #
@@ -367,8 +367,7 @@ module Tinkerforge
367
367
  # device identifier.
368
368
  #
369
369
  # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
370
- # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
371
- # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
370
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
372
371
  # position 'z'.
373
372
  #
374
373
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2020-05-19. #
3
+ # This file was automatically generated on 2020-11-02. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.26 #
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 #
@@ -470,8 +470,7 @@ module Tinkerforge
470
470
  # device identifier.
471
471
  #
472
472
  # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
473
- # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
474
- # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
473
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
475
474
  # position 'z'.
476
475
  #
477
476
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2020-05-19. #
3
+ # This file was automatically generated on 2020-11-02. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.26 #
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 #
@@ -228,8 +228,7 @@ module Tinkerforge
228
228
  # device identifier.
229
229
  #
230
230
  # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
231
- # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
232
- # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
231
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
233
232
  # position 'z'.
234
233
  #
235
234
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2020-05-19. #
3
+ # This file was automatically generated on 2020-11-02. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.26 #
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 #
@@ -363,8 +363,7 @@ module Tinkerforge
363
363
  # device identifier.
364
364
  #
365
365
  # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
366
- # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
367
- # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
366
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
368
367
  # position 'z'.
369
368
  #
370
369
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2020-05-19. #
3
+ # This file was automatically generated on 2020-11-02. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.26 #
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 #
@@ -181,8 +181,7 @@ module Tinkerforge
181
181
  # device identifier.
182
182
  #
183
183
  # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
184
- # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
185
- # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
184
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
186
185
  # position 'z'.
187
186
  #
188
187
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2020-05-19. #
3
+ # This file was automatically generated on 2020-11-02. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.26 #
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 #
@@ -336,8 +336,7 @@ module Tinkerforge
336
336
  # device identifier.
337
337
  #
338
338
  # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
339
- # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
340
- # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
339
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
341
340
  # position 'z'.
342
341
  #
343
342
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2020-05-19. #
3
+ # This file was automatically generated on 2020-11-02. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.26 #
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 #
@@ -188,8 +188,7 @@ module Tinkerforge
188
188
  # device identifier.
189
189
  #
190
190
  # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
191
- # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
192
- # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
191
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
193
192
  # position 'z'.
194
193
  #
195
194
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2020-05-19. #
3
+ # This file was automatically generated on 2020-11-02. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.26 #
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 #
@@ -190,7 +190,7 @@ module Tinkerforge
190
190
  send_request FUNCTION_SET_SAMPLE_RATE, [rate], 'C', 8, ''
191
191
  end
192
192
 
193
- # Returns the gain as set by BrickletIndustrialDual020mAV2#set_sample_rate.
193
+ # Returns the sample rate as set by BrickletIndustrialDual020mAV2#set_sample_rate.
194
194
  def get_sample_rate
195
195
  check_validity
196
196
 
@@ -401,8 +401,7 @@ module Tinkerforge
401
401
  # device identifier.
402
402
  #
403
403
  # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
404
- # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
405
- # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
404
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
406
405
  # position 'z'.
407
406
  #
408
407
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
@@ -0,0 +1,325 @@
1
+ # -*- ruby encoding: utf-8 -*-
2
+ #############################################################
3
+ # This file was automatically generated on 2020-11-02. #
4
+ # #
5
+ # Ruby Bindings Version 2.1.27 #
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