tinkerforge 2.1.14 → 2.1.15

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 (81) hide show
  1. checksums.yaml +7 -0
  2. data/lib/tinkerforge/brick_dc.rb +2 -2
  3. data/lib/tinkerforge/brick_imu.rb +2 -2
  4. data/lib/tinkerforge/brick_imu_v2.rb +2 -2
  5. data/lib/tinkerforge/brick_master.rb +2 -2
  6. data/lib/tinkerforge/brick_red.rb +2 -2
  7. data/lib/tinkerforge/brick_servo.rb +2 -2
  8. data/lib/tinkerforge/brick_silent_stepper.rb +2 -2
  9. data/lib/tinkerforge/brick_stepper.rb +2 -2
  10. data/lib/tinkerforge/bricklet_accelerometer.rb +2 -2
  11. data/lib/tinkerforge/bricklet_ambient_light.rb +2 -2
  12. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +2 -2
  13. data/lib/tinkerforge/bricklet_analog_in.rb +2 -2
  14. data/lib/tinkerforge/bricklet_analog_in_v2.rb +2 -2
  15. data/lib/tinkerforge/bricklet_analog_out.rb +2 -2
  16. data/lib/tinkerforge/bricklet_analog_out_v2.rb +2 -2
  17. data/lib/tinkerforge/bricklet_barometer.rb +2 -2
  18. data/lib/tinkerforge/bricklet_can.rb +2 -2
  19. data/lib/tinkerforge/bricklet_co2.rb +2 -2
  20. data/lib/tinkerforge/bricklet_color.rb +2 -2
  21. data/lib/tinkerforge/bricklet_current12.rb +2 -2
  22. data/lib/tinkerforge/bricklet_current25.rb +2 -2
  23. data/lib/tinkerforge/bricklet_distance_ir.rb +2 -2
  24. data/lib/tinkerforge/bricklet_distance_us.rb +2 -2
  25. data/lib/tinkerforge/bricklet_dmx.rb +520 -0
  26. data/lib/tinkerforge/bricklet_dual_button.rb +2 -2
  27. data/lib/tinkerforge/bricklet_dual_relay.rb +2 -2
  28. data/lib/tinkerforge/bricklet_dust_detector.rb +2 -2
  29. data/lib/tinkerforge/bricklet_gps.rb +2 -2
  30. data/lib/tinkerforge/bricklet_gps_v2.rb +27 -3
  31. data/lib/tinkerforge/bricklet_hall_effect.rb +2 -2
  32. data/lib/tinkerforge/bricklet_humidity.rb +2 -2
  33. data/lib/tinkerforge/bricklet_humidity_v2.rb +368 -0
  34. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +2 -2
  35. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +2 -2
  36. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +2 -2
  37. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +2 -2
  38. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +2 -2
  39. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +2 -2
  40. data/lib/tinkerforge/bricklet_io16.rb +2 -2
  41. data/lib/tinkerforge/bricklet_io4.rb +2 -2
  42. data/lib/tinkerforge/bricklet_joystick.rb +2 -2
  43. data/lib/tinkerforge/bricklet_laser_range_finder.rb +2 -2
  44. data/lib/tinkerforge/bricklet_lcd_16x2.rb +2 -2
  45. data/lib/tinkerforge/bricklet_lcd_20x4.rb +2 -2
  46. data/lib/tinkerforge/bricklet_led_strip.rb +2 -2
  47. data/lib/tinkerforge/bricklet_line.rb +2 -2
  48. data/lib/tinkerforge/bricklet_linear_poti.rb +2 -2
  49. data/lib/tinkerforge/bricklet_load_cell.rb +2 -2
  50. data/lib/tinkerforge/bricklet_moisture.rb +2 -2
  51. data/lib/tinkerforge/bricklet_motion_detector.rb +2 -2
  52. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +330 -0
  53. data/lib/tinkerforge/bricklet_multi_touch.rb +2 -2
  54. data/lib/tinkerforge/bricklet_nfc_rfid.rb +2 -2
  55. data/lib/tinkerforge/bricklet_oled_128x64.rb +2 -2
  56. data/lib/tinkerforge/bricklet_oled_64x48.rb +2 -2
  57. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +2 -2
  58. data/lib/tinkerforge/bricklet_piezo_speaker.rb +2 -2
  59. data/lib/tinkerforge/bricklet_ptc.rb +2 -2
  60. data/lib/tinkerforge/bricklet_real_time_clock.rb +2 -2
  61. data/lib/tinkerforge/bricklet_remote_switch.rb +2 -2
  62. data/lib/tinkerforge/bricklet_rgb_led.rb +3 -3
  63. data/lib/tinkerforge/bricklet_rgb_led_button.rb +248 -0
  64. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +300 -0
  65. data/lib/tinkerforge/bricklet_rotary_encoder.rb +2 -2
  66. data/lib/tinkerforge/bricklet_rotary_poti.rb +2 -2
  67. data/lib/tinkerforge/bricklet_rs232.rb +2 -2
  68. data/lib/tinkerforge/bricklet_rs485.rb +3 -3
  69. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +2 -2
  70. data/lib/tinkerforge/bricklet_solid_state_relay.rb +2 -2
  71. data/lib/tinkerforge/bricklet_sound_intensity.rb +2 -2
  72. data/lib/tinkerforge/bricklet_temperature.rb +2 -2
  73. data/lib/tinkerforge/bricklet_temperature_ir.rb +2 -2
  74. data/lib/tinkerforge/bricklet_thermal_imaging.rb +555 -0
  75. data/lib/tinkerforge/bricklet_thermocouple.rb +2 -2
  76. data/lib/tinkerforge/bricklet_tilt.rb +2 -2
  77. data/lib/tinkerforge/bricklet_uv_light.rb +2 -2
  78. data/lib/tinkerforge/bricklet_voltage.rb +2 -2
  79. data/lib/tinkerforge/bricklet_voltage_current.rb +2 -2
  80. data/lib/tinkerforge/version.rb +1 -1
  81. metadata +74 -70
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3f05ead98338ead488cabeac20156b97fba8ad5e
4
+ data.tar.gz: 6a2248c9d3a0a3000c289800a4def1e54d54cebd
5
+ SHA512:
6
+ metadata.gz: f8689604a21263fd246c9e7d3abd8f61918c3785440023485caeda3ceeffcdaa527cda67e40cd7e2e3d4face22623312468c84ae20055a93b5e9b9656b2b4ebe
7
+ data.tar.gz: a5c5ff0d40367bace070c1a0cd2d6f10395efe627ad67ccecf5d1fefa800cb7ef2415840ee46c0ee3315e9c7cd782cf6734bdc3f45df92fa6007e46a0ecdd5df
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2017-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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 2017-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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 2017-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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 2017-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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 2017-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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 2017-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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 2017-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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 2017-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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 2017-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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 2017-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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 2017-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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 2017-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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 2017-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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 2017-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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 2017-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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 2017-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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 2017-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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 2017-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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 2017-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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 2017-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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 2017-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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 2017-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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 2017-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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 #
@@ -0,0 +1,520 @@
1
+ # -*- ruby encoding: utf-8 -*-
2
+ #############################################################
3
+ # This file was automatically generated on 2017-11-20. #
4
+ # #
5
+ # Ruby Bindings Version 2.1.15 #
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
+ # DMX Master and Slave
14
+ class BrickletDMX < Device
15
+ DEVICE_IDENTIFIER = 285 # :nodoc:
16
+ DEVICE_DISPLAY_NAME = 'DMX Bricklet' # :nodoc:
17
+
18
+ # This callback is triggered as soon as a new frame write is started.
19
+ # You should send the data for the next frame directly after this callback
20
+ # was triggered.
21
+ #
22
+ # For an explanation of the general approach see BrickletDMX#write_frame.
23
+ #
24
+ # This callback can be enabled via BrickletDMX#set_frame_callback_config.
25
+ #
26
+ # This callback can only be triggered in master mode.
27
+ CALLBACK_FRAME_STARTED = 14
28
+
29
+ # This callback is triggered in slave mode when a new frame was received from the DMX master
30
+ # and it can be read out. You have to read the frame before the master has written
31
+ # the next frame, see BrickletDMX#read_frame for more details.
32
+ #
33
+ # The parameter is the frame number, it is increased by one with each received frame.
34
+ #
35
+ # This callback can be enabled via BrickletDMX#set_frame_callback_config.
36
+ #
37
+ # This callback can only be triggered in slave mode.
38
+ CALLBACK_FRAME_AVAILABLE = 15
39
+
40
+ # This callback is called as soon as a new frame is available
41
+ # (written by the DMX master).
42
+ #
43
+ # The size of the array is equivalent to the number of channels in
44
+ # the frame. Each byte represents one channel.
45
+ #
46
+ # This callback can be enabled via BrickletDMX#set_frame_callback_config.
47
+ #
48
+ # This callback can only be triggered in slave mode.
49
+ CALLBACK_FRAME_LOW_LEVEL = 16
50
+
51
+ # This callback is called if a new error occurs. It returns
52
+ # the current overrun and framing error count.
53
+ CALLBACK_FRAME_ERROR_COUNT = 17
54
+
55
+ # This callback is called as soon as a new frame is available
56
+ # (written by the DMX master).
57
+ #
58
+ # The size of the array is equivalent to the number of channels in
59
+ # the frame. Each byte represents one channel.
60
+ #
61
+ # This callback can be enabled via BrickletDMX#set_frame_callback_config.
62
+ #
63
+ # This callback can only be triggered in slave mode.
64
+ CALLBACK_FRAME = -16
65
+
66
+ FUNCTION_SET_DMX_MODE = 1 # :nodoc:
67
+ FUNCTION_GET_DMX_MODE = 2 # :nodoc:
68
+ FUNCTION_WRITE_FRAME_LOW_LEVEL = 3 # :nodoc:
69
+ FUNCTION_READ_FRAME_LOW_LEVEL = 4 # :nodoc:
70
+ FUNCTION_SET_FRAME_DURATION = 5 # :nodoc:
71
+ FUNCTION_GET_FRAME_DURATION = 6 # :nodoc:
72
+ FUNCTION_GET_FRAME_ERROR_COUNT = 7 # :nodoc:
73
+ FUNCTION_SET_COMMUNICATION_LED_CONFIG = 8 # :nodoc:
74
+ FUNCTION_GET_COMMUNICATION_LED_CONFIG = 9 # :nodoc:
75
+ FUNCTION_SET_ERROR_LED_CONFIG = 10 # :nodoc:
76
+ FUNCTION_GET_ERROR_LED_CONFIG = 11 # :nodoc:
77
+ FUNCTION_SET_FRAME_CALLBACK_CONFIG = 12 # :nodoc:
78
+ FUNCTION_GET_FRAME_CALLBACK_CONFIG = 13 # :nodoc:
79
+ FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
80
+ FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
81
+ FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
82
+ FUNCTION_SET_WRITE_FIRMWARE_POINTER = 237 # :nodoc:
83
+ FUNCTION_WRITE_FIRMWARE = 238 # :nodoc:
84
+ FUNCTION_SET_STATUS_LED_CONFIG = 239 # :nodoc:
85
+ FUNCTION_GET_STATUS_LED_CONFIG = 240 # :nodoc:
86
+ FUNCTION_GET_CHIP_TEMPERATURE = 242 # :nodoc:
87
+ FUNCTION_RESET = 243 # :nodoc:
88
+ FUNCTION_WRITE_UID = 248 # :nodoc:
89
+ FUNCTION_READ_UID = 249 # :nodoc:
90
+ FUNCTION_GET_IDENTITY = 255 # :nodoc:
91
+
92
+ DMX_MODE_MASTER = 0 # :nodoc:
93
+ DMX_MODE_SLAVE = 1 # :nodoc:
94
+ COMMUNICATION_LED_CONFIG_OFF = 0 # :nodoc:
95
+ COMMUNICATION_LED_CONFIG_ON = 1 # :nodoc:
96
+ COMMUNICATION_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
97
+ COMMUNICATION_LED_CONFIG_SHOW_COMMUNICATION = 3 # :nodoc:
98
+ ERROR_LED_CONFIG_OFF = 0 # :nodoc:
99
+ ERROR_LED_CONFIG_ON = 1 # :nodoc:
100
+ ERROR_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
101
+ ERROR_LED_CONFIG_SHOW_ERROR = 3 # :nodoc:
102
+ BOOTLOADER_MODE_BOOTLOADER = 0 # :nodoc:
103
+ BOOTLOADER_MODE_FIRMWARE = 1 # :nodoc:
104
+ BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT = 2 # :nodoc:
105
+ BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT = 3 # :nodoc:
106
+ BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT = 4 # :nodoc:
107
+ BOOTLOADER_STATUS_OK = 0 # :nodoc:
108
+ BOOTLOADER_STATUS_INVALID_MODE = 1 # :nodoc:
109
+ BOOTLOADER_STATUS_NO_CHANGE = 2 # :nodoc:
110
+ BOOTLOADER_STATUS_ENTRY_FUNCTION_NOT_PRESENT = 3 # :nodoc:
111
+ BOOTLOADER_STATUS_DEVICE_IDENTIFIER_INCORRECT = 4 # :nodoc:
112
+ BOOTLOADER_STATUS_CRC_MISMATCH = 5 # :nodoc:
113
+ STATUS_LED_CONFIG_OFF = 0 # :nodoc:
114
+ STATUS_LED_CONFIG_ON = 1 # :nodoc:
115
+ STATUS_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
116
+ STATUS_LED_CONFIG_SHOW_STATUS = 3 # :nodoc:
117
+
118
+ # Creates an object with the unique device ID <tt>uid</tt> and adds it to
119
+ # the IP Connection <tt>ipcon</tt>.
120
+ def initialize(uid, ipcon)
121
+ super uid, ipcon
122
+
123
+ @api_version = [2, 0, 0]
124
+
125
+ @response_expected[FUNCTION_SET_DMX_MODE] = RESPONSE_EXPECTED_FALSE
126
+ @response_expected[FUNCTION_GET_DMX_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
127
+ @response_expected[FUNCTION_WRITE_FRAME_LOW_LEVEL] = RESPONSE_EXPECTED_TRUE
128
+ @response_expected[FUNCTION_READ_FRAME_LOW_LEVEL] = RESPONSE_EXPECTED_ALWAYS_TRUE
129
+ @response_expected[FUNCTION_SET_FRAME_DURATION] = RESPONSE_EXPECTED_FALSE
130
+ @response_expected[FUNCTION_GET_FRAME_DURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
131
+ @response_expected[FUNCTION_GET_FRAME_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
132
+ @response_expected[FUNCTION_SET_COMMUNICATION_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
133
+ @response_expected[FUNCTION_GET_COMMUNICATION_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
134
+ @response_expected[FUNCTION_SET_ERROR_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
135
+ @response_expected[FUNCTION_GET_ERROR_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
136
+ @response_expected[FUNCTION_SET_FRAME_CALLBACK_CONFIG] = RESPONSE_EXPECTED_TRUE
137
+ @response_expected[FUNCTION_GET_FRAME_CALLBACK_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
138
+ @response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
139
+ @response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
140
+ @response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
141
+ @response_expected[FUNCTION_SET_WRITE_FIRMWARE_POINTER] = RESPONSE_EXPECTED_FALSE
142
+ @response_expected[FUNCTION_WRITE_FIRMWARE] = RESPONSE_EXPECTED_ALWAYS_TRUE
143
+ @response_expected[FUNCTION_SET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
144
+ @response_expected[FUNCTION_GET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
145
+ @response_expected[FUNCTION_GET_CHIP_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
146
+ @response_expected[FUNCTION_RESET] = RESPONSE_EXPECTED_FALSE
147
+ @response_expected[FUNCTION_WRITE_UID] = RESPONSE_EXPECTED_FALSE
148
+ @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
149
+ @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
150
+
151
+ @callback_formats[CALLBACK_FRAME_STARTED] = ''
152
+ @callback_formats[CALLBACK_FRAME_AVAILABLE] = 'L'
153
+ @callback_formats[CALLBACK_FRAME_LOW_LEVEL] = 'S S C56 L'
154
+ @callback_formats[CALLBACK_FRAME_ERROR_COUNT] = 'L L'
155
+
156
+ @high_level_callbacks[CALLBACK_FRAME] = [['stream_length', 'stream_chunk_offset', 'stream_chunk_data', nil], {'fixed_length' => nil, 'single_chunk' => false}, nil]
157
+ end
158
+
159
+ # Sets the DMX mode to either master or slave.
160
+ #
161
+ # Calling this function sets frame number to 0.
162
+ def set_dmx_mode(dmx_mode)
163
+ send_request FUNCTION_SET_DMX_MODE, [dmx_mode], 'C', 0, ''
164
+ end
165
+
166
+ # Returns the DMX mode, as set by func:`Set DMX Mode`.
167
+ def get_dmx_mode
168
+ send_request FUNCTION_GET_DMX_MODE, [], '', 1, 'C'
169
+ end
170
+
171
+ # Writes a DMX frame. The maximum frame size is 512 byte. Each byte represents one channel.
172
+ #
173
+ # The next frame can be written after the CALLBACK_FRAME_STARTED callback was called. The frame
174
+ # is double buffered, so a new frame can be written as soon as the writing of the prior frame
175
+ # starts.
176
+ #
177
+ # The data will be transfered when the next frame duration ends, see BrickletDMX#set_frame_duration.
178
+ #
179
+ # Generic approach:
180
+ #
181
+ # * Set the frame duration to a value that represents the number of frames per second you want to achieve.
182
+ # * Set channels for first frame.
183
+ # * Wait for the CALLBACK_FRAME_STARTED callback.
184
+ # * Set channels for next frame.
185
+ # * Wait for the CALLBACK_FRAME_STARTED callback.
186
+ # * and so on.
187
+ #
188
+ # This approach ensures that you can set new DMX data with a fixed frame rate.
189
+ #
190
+ # This function can only be called in master mode.
191
+ def write_frame_low_level(frame_length, frame_chunk_offset, frame_chunk_data)
192
+ send_request FUNCTION_WRITE_FRAME_LOW_LEVEL, [frame_length, frame_chunk_offset, frame_chunk_data], 'S S C60', 0, ''
193
+ end
194
+
195
+ # Returns the last frame that was written by the DMX master. The size of the array
196
+ # is equivalent to the number of channels in the frame. Each byte represents one channel.
197
+ #
198
+ # The next frame is available after the CALLBACK_FRAME_AVAILABLE callback was called.
199
+ #
200
+ # Generic approach:
201
+ #
202
+ # * Call BrickletDMX#read_frame to get first frame.
203
+ # * Wait for the CALLBACK_FRAME_AVAILABLE callback.
204
+ # * Call BrickletDMX#read_frame to get second frame.
205
+ # * Wait for the CALLBACK_FRAME_AVAILABLE callback.
206
+ # * and so on.
207
+ #
208
+ # Instead of polling this function you can also use the CALLBACK_FRAME callback.
209
+ # You can enable it with BrickletDMX#set_frame_callback_config.
210
+ #
211
+ # The frame number starts at 0 and it is increased by one with each received frame.
212
+ #
213
+ # This function can only be called in slave mode.
214
+ def read_frame_low_level
215
+ send_request FUNCTION_READ_FRAME_LOW_LEVEL, [], '', 64, 'S S C56 L'
216
+ end
217
+
218
+ # Sets the duration of a frame in ms.
219
+ #
220
+ # Example: If you want to achieve 20 frames per second, you should
221
+ # set the frame duration to 50ms (50ms * 20 = 1 second).
222
+ #
223
+ # If you always want to send a frame as fast as possible you can set
224
+ # this value to 0.
225
+ #
226
+ # This setting is only used in master mode.
227
+ #
228
+ # Default value: 100ms (10 frames per second).
229
+ def set_frame_duration(frame_duration)
230
+ send_request FUNCTION_SET_FRAME_DURATION, [frame_duration], 'S', 0, ''
231
+ end
232
+
233
+ # Returns the frame duration as set by BrickletDMX#set_frame_duration.
234
+ def get_frame_duration
235
+ send_request FUNCTION_GET_FRAME_DURATION, [], '', 2, 'S'
236
+ end
237
+
238
+ # Returns the current number of overrun and framing errors.
239
+ def get_frame_error_count
240
+ send_request FUNCTION_GET_FRAME_ERROR_COUNT, [], '', 8, 'L L'
241
+ end
242
+
243
+ # Sets the communication LED configuration. By default the LED shows
244
+ # communication traffic, it flickers once 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 off.
249
+ def set_communication_led_config(config)
250
+ send_request FUNCTION_SET_COMMUNICATION_LED_CONFIG, [config], 'C', 0, ''
251
+ end
252
+
253
+ # Returns the configuration as set by BrickletDMX#set_communication_led_config
254
+ def get_communication_led_config
255
+ send_request FUNCTION_GET_COMMUNICATION_LED_CONFIG, [], '', 1, 'C'
256
+ end
257
+
258
+ # Sets the error LED configuration.
259
+ #
260
+ # By default the error LED turns on if there is any error (see CALLBACK_FRAME_ERROR_COUNT
261
+ # callback). If you call this function with the Show-Error option again, the LED
262
+ # will turn off until the next error occurs.
263
+ #
264
+ # You can also turn the LED permanently on/off or show a heartbeat.
265
+ #
266
+ # If the Bricklet is in bootloader mode, the LED is off.
267
+ def set_error_led_config(config)
268
+ send_request FUNCTION_SET_ERROR_LED_CONFIG, [config], 'C', 0, ''
269
+ end
270
+
271
+ # Returns the configuration as set by BrickletDMX#set_error_led_config.
272
+ def get_error_led_config
273
+ send_request FUNCTION_GET_ERROR_LED_CONFIG, [], '', 1, 'C'
274
+ end
275
+
276
+ # Enables/Disables the different callbacks. By default the
277
+ # CALLBACK_FRAME_STARTED callback and CALLBACK_FRAME_AVAILABLE callback are enabled while
278
+ # the CALLBACK_FRAME callback and CALLBACK_FRAME_ERROR_COUNT callback are disabled.
279
+ #
280
+ # If you want to use the CALLBACK_FRAME callback you can enable it and disable
281
+ # the cb:`Frame Available` callback at the same time. It becomes redundant in
282
+ # this case.
283
+ def set_frame_callback_config(frame_started_callback_enabled, frame_available_callback_enabled, frame_callback_enabled, frame_error_count_callback_enabled)
284
+ send_request FUNCTION_SET_FRAME_CALLBACK_CONFIG, [frame_started_callback_enabled, frame_available_callback_enabled, frame_callback_enabled, frame_error_count_callback_enabled], '? ? ? ?', 0, ''
285
+ end
286
+
287
+ # Returns the frame callback config as set by BrickletDMX#set_frame_callback_config.
288
+ def get_frame_callback_config
289
+ send_request FUNCTION_GET_FRAME_CALLBACK_CONFIG, [], '', 4, '? ? ? ?'
290
+ end
291
+
292
+ # Returns the error count for the communication between Brick and Bricklet.
293
+ #
294
+ # The errors are divided into
295
+ #
296
+ # * ack checksum errors,
297
+ # * message checksum errors,
298
+ # * frameing errors and
299
+ # * overflow errors.
300
+ #
301
+ # The errors counts are for errors that occur on the Bricklet side. All
302
+ # Bricks have a similar function that returns the errors on the Brick side.
303
+ def get_spitfp_error_count
304
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
305
+ end
306
+
307
+ # Sets the bootloader mode and returns the status after the requested
308
+ # mode change was instigated.
309
+ #
310
+ # You can change from bootloader mode to firmware mode and vice versa. A change
311
+ # from bootloader mode to firmware mode will only take place if the entry function,
312
+ # device identifier und crc are present and correct.
313
+ #
314
+ # This function is used by Brick Viewer during flashing. It should not be
315
+ # necessary to call it in a normal user program.
316
+ def set_bootloader_mode(mode)
317
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
318
+ end
319
+
320
+ # Returns the current bootloader mode, see BrickletDMX#set_bootloader_mode.
321
+ def get_bootloader_mode
322
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
323
+ end
324
+
325
+ # Sets the firmware pointer for BrickletDMX#write_firmware. The pointer has
326
+ # to be increased by chunks of size 64. The data is written to flash
327
+ # every 4 chunks (which equals to one page of size 256).
328
+ #
329
+ # This function is used by Brick Viewer during flashing. It should not be
330
+ # necessary to call it in a normal user program.
331
+ def set_write_firmware_pointer(pointer)
332
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
333
+ end
334
+
335
+ # Writes 64 Bytes of firmware at the position as written by
336
+ # BrickletDMX#set_write_firmware_pointer before. The firmware is written
337
+ # to flash every 4 chunks.
338
+ #
339
+ # You can only write firmware in bootloader mode.
340
+ #
341
+ # This function is used by Brick Viewer during flashing. It should not be
342
+ # necessary to call it in a normal user program.
343
+ def write_firmware(data)
344
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
345
+ end
346
+
347
+ # Sets the status LED configuration. By default the LED shows
348
+ # communication traffic between Brick and Bricklet, it flickers once
349
+ # for every 10 received data packets.
350
+ #
351
+ # You can also turn the LED permanently on/off or show a heartbeat.
352
+ #
353
+ # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
354
+ def set_status_led_config(config)
355
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
356
+ end
357
+
358
+ # Returns the configuration as set by BrickletDMX#set_status_led_config
359
+ def get_status_led_config
360
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
361
+ end
362
+
363
+ # Returns the temperature in °C as measured inside the microcontroller. The
364
+ # value returned is not the ambient temperature!
365
+ #
366
+ # The temperature is only proportional to the real temperature and it has bad
367
+ # accuracy. Practically it is only useful as an indicator for
368
+ # temperature changes.
369
+ def get_chip_temperature
370
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
371
+ end
372
+
373
+ # Calling this function will reset the Bricklet. All configurations
374
+ # will be lost.
375
+ #
376
+ # After a reset you have to create new device objects,
377
+ # calling functions on the existing ones will result in
378
+ # undefined behavior!
379
+ def reset
380
+ send_request FUNCTION_RESET, [], '', 0, ''
381
+ end
382
+
383
+ # Writes a new UID into flash. If you want to set a new UID
384
+ # you have to decode the Base58 encoded UID string into an
385
+ # integer first.
386
+ #
387
+ # We recommend that you use Brick Viewer to change the UID.
388
+ def write_uid(uid)
389
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
390
+ end
391
+
392
+ # Returns the current UID as an integer. Encode as
393
+ # Base58 to get the usual string version.
394
+ def read_uid
395
+ send_request FUNCTION_READ_UID, [], '', 4, 'L'
396
+ end
397
+
398
+ # Returns the UID, the UID where the Bricklet is connected to,
399
+ # the position, the hardware and firmware version as well as the
400
+ # device identifier.
401
+ #
402
+ # The position can be 'a', 'b', 'c' or 'd'.
403
+ #
404
+ # The device identifier numbers can be found :ref:`here <device_identifier>`.
405
+ # |device_identifier_constant|
406
+ def get_identity
407
+ send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
408
+ end
409
+
410
+ # Writes a DMX frame. The maximum frame size is 512 byte. Each byte represents one channel.
411
+ #
412
+ # The next frame can be written after the CALLBACK_FRAME_STARTED callback was called. The frame
413
+ # is double buffered, so a new frame can be written as soon as the writing of the prior frame
414
+ # starts.
415
+ #
416
+ # The data will be transfered when the next frame duration ends, see BrickletDMX#set_frame_duration.
417
+ #
418
+ # Generic approach:
419
+ #
420
+ # * Set the frame duration to a value that represents the number of frames per second you want to achieve.
421
+ # * Set channels for first frame.
422
+ # * Wait for the CALLBACK_FRAME_STARTED callback.
423
+ # * Set channels for next frame.
424
+ # * Wait for the CALLBACK_FRAME_STARTED callback.
425
+ # * and so on.
426
+ #
427
+ # This approach ensures that you can set new DMX data with a fixed frame rate.
428
+ #
429
+ # This function can only be called in master mode.
430
+ def write_frame(frame)
431
+ if frame.length > 65535
432
+ raise ArgumentError, 'Frame can be at most 65535 items long'
433
+ end
434
+
435
+ frame_length = frame.length
436
+ frame_chunk_offset = 0
437
+
438
+ if frame_length == 0
439
+ frame_chunk_data = [0] * 60
440
+ ret = write_frame_low_level frame_length, frame_chunk_offset, frame_chunk_data
441
+ else
442
+ ret = nil # assigned in block
443
+
444
+ @stream_mutex.synchronize {
445
+ while frame_chunk_offset < frame_length
446
+ frame_chunk_data = frame[frame_chunk_offset, 60]
447
+
448
+ if frame_chunk_data.length < 60
449
+ frame_chunk_data += [0] * (60 - frame_chunk_data.length)
450
+ end
451
+
452
+ ret = write_frame_low_level frame_length, frame_chunk_offset, frame_chunk_data
453
+ frame_chunk_offset += 60
454
+ end
455
+ }
456
+ end
457
+
458
+ ret
459
+ end
460
+
461
+ # Returns the last frame that was written by the DMX master. The size of the array
462
+ # is equivalent to the number of channels in the frame. Each byte represents one channel.
463
+ #
464
+ # The next frame is available after the CALLBACK_FRAME_AVAILABLE callback was called.
465
+ #
466
+ # Generic approach:
467
+ #
468
+ # * Call BrickletDMX#read_frame to get first frame.
469
+ # * Wait for the CALLBACK_FRAME_AVAILABLE callback.
470
+ # * Call BrickletDMX#read_frame to get second frame.
471
+ # * Wait for the CALLBACK_FRAME_AVAILABLE callback.
472
+ # * and so on.
473
+ #
474
+ # Instead of polling this function you can also use the CALLBACK_FRAME callback.
475
+ # You can enable it with BrickletDMX#set_frame_callback_config.
476
+ #
477
+ # The frame number starts at 0 and it is increased by one with each received frame.
478
+ #
479
+ # This function can only be called in slave mode.
480
+ def read_frame
481
+ ret = nil # assigned in block
482
+ frame_length = nil # assigned in block
483
+ frame_data = nil # assigned in block
484
+
485
+ @stream_mutex.synchronize {
486
+ ret = read_frame_low_level
487
+ frame_length = ret[0]
488
+ frame_chunk_offset = ret[1]
489
+ frame_out_of_sync = frame_chunk_offset != 0
490
+ frame_data = ret[2]
491
+
492
+ while not frame_out_of_sync and frame_data.length < frame_length
493
+ ret = read_frame_low_level
494
+ frame_length = ret[0]
495
+ frame_chunk_offset = ret[1]
496
+ frame_out_of_sync = frame_chunk_offset != frame_data.length
497
+ frame_data += ret[2]
498
+ end
499
+
500
+ if frame_out_of_sync # discard remaining stream to bring it back in-sync
501
+ while frame_chunk_offset + 56 < frame_length
502
+ ret = read_frame_low_level
503
+ frame_length = ret[0]
504
+ frame_chunk_offset = ret[1]
505
+ end
506
+
507
+ raise StreamOutOfSyncException, 'Frame stream is out-of-sync'
508
+ end
509
+ }
510
+
511
+ [frame_data[0, frame_length], ret[3]]
512
+ end
513
+
514
+ # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
515
+ def register_callback(id, &block)
516
+ callback = block
517
+ @registered_callbacks[id] = callback
518
+ end
519
+ end
520
+ end