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
@@ -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 #
@@ -949,7 +949,7 @@ module Tinkerforge
949
949
  send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
950
950
  end
951
951
 
952
- # Sets the firmware pointer for func:`WriteFirmware`. The pointer has
952
+ # Sets the firmware pointer for BrickletRS485#write_firmware. The pointer has
953
953
  # to be increased by chunks of size 64. The data is written to flash
954
954
  # every 4 chunks (which equals to one page of size 256).
955
955
  #
@@ -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,555 @@
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
+ # 80x60 pixel thermal imaging camera
14
+ class BrickletThermalImaging < Device
15
+ DEVICE_IDENTIFIER = 278 # :nodoc:
16
+ DEVICE_DISPLAY_NAME = 'Thermal Imaging Bricklet' # :nodoc:
17
+
18
+ # This callback is triggered with every new high contrast image if the transfer image
19
+ # config is configured for high contrast callback (see BrickletThermalImaging#set_image_transfer_config).
20
+ #
21
+ # The data is organized as a 8-bit value 80x60 pixel matrix linearized in
22
+ # a one-dimensional array. The data is arranged line by line from top left to
23
+ # bottom right.
24
+ #
25
+ # Each 8-bit value represents one gray-scale image pixel that can directly be
26
+ # shown to a user on a display.
27
+ CALLBACK_HIGH_CONTRAST_IMAGE_LOW_LEVEL = 12
28
+
29
+ # This callback is triggered with every new temperature image if the transfer image
30
+ # config is configured for temperature callback (see BrickletThermalImaging#set_image_transfer_config).
31
+ #
32
+ # The data is organized as a 16-bit value 80x60 pixel matrix linearized in
33
+ # a one-dimensional array. The data is arranged line by line from top left to
34
+ # bottom right.
35
+ #
36
+ # Each 16-bit value represents one temperature measurement in either
37
+ # Kelvin/10 or Kelvin/100 (depending on the resolution set with BrickletThermalImaging#set_resolution).
38
+ CALLBACK_TEMPERATURE_IMAGE_LOW_LEVEL = 13
39
+
40
+ # This callback is triggered with every new high contrast image if the transfer image
41
+ # config is configured for high contrast callback (see BrickletThermalImaging#set_image_transfer_config).
42
+ #
43
+ # The data is organized as a 8-bit value 80x60 pixel matrix linearized in
44
+ # a one-dimensional array. The data is arranged line by line from top left to
45
+ # bottom right.
46
+ #
47
+ # Each 8-bit value represents one gray-scale image pixel that can directly be
48
+ # shown to a user on a display.
49
+ CALLBACK_HIGH_CONTRAST_IMAGE = -12
50
+
51
+ # This callback is triggered with every new temperature image if the transfer image
52
+ # config is configured for temperature callback (see BrickletThermalImaging#set_image_transfer_config).
53
+ #
54
+ # The data is organized as a 16-bit value 80x60 pixel matrix linearized in
55
+ # a one-dimensional array. The data is arranged line by line from top left to
56
+ # bottom right.
57
+ #
58
+ # Each 16-bit value represents one temperature measurement in either
59
+ # Kelvin/10 or Kelvin/100 (depending on the resolution set with BrickletThermalImaging#set_resolution).
60
+ CALLBACK_TEMPERATURE_IMAGE = -13
61
+
62
+ FUNCTION_GET_HIGH_CONTRAST_IMAGE_LOW_LEVEL = 1 # :nodoc:
63
+ FUNCTION_GET_TEMPERATURE_IMAGE_LOW_LEVEL = 2 # :nodoc:
64
+ FUNCTION_GET_STATISTICS = 3 # :nodoc:
65
+ FUNCTION_SET_RESOLUTION = 4 # :nodoc:
66
+ FUNCTION_GET_RESOLUTION = 5 # :nodoc:
67
+ FUNCTION_SET_SPOTMETER_CONFIG = 6 # :nodoc:
68
+ FUNCTION_GET_SPOTMETER_CONFIG = 7 # :nodoc:
69
+ FUNCTION_SET_HIGH_CONTRAST_CONFIG = 8 # :nodoc:
70
+ FUNCTION_GET_HIGH_CONTRAST_CONFIG = 9 # :nodoc:
71
+ FUNCTION_SET_IMAGE_TRANSFER_CONFIG = 10 # :nodoc:
72
+ FUNCTION_GET_IMAGE_TRANSFER_CONFIG = 11 # :nodoc:
73
+ FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
74
+ FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
75
+ FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
76
+ FUNCTION_SET_WRITE_FIRMWARE_POINTER = 237 # :nodoc:
77
+ FUNCTION_WRITE_FIRMWARE = 238 # :nodoc:
78
+ FUNCTION_SET_STATUS_LED_CONFIG = 239 # :nodoc:
79
+ FUNCTION_GET_STATUS_LED_CONFIG = 240 # :nodoc:
80
+ FUNCTION_GET_CHIP_TEMPERATURE = 242 # :nodoc:
81
+ FUNCTION_RESET = 243 # :nodoc:
82
+ FUNCTION_WRITE_UID = 248 # :nodoc:
83
+ FUNCTION_READ_UID = 249 # :nodoc:
84
+ FUNCTION_GET_IDENTITY = 255 # :nodoc:
85
+
86
+ RESOLUTION_0_TO_6553_KELVIN = 0 # :nodoc:
87
+ RESOLUTION_0_TO_655_KELVIN = 1 # :nodoc:
88
+ FFC_STATUS_NEVER_COMMANDED = 0 # :nodoc:
89
+ FFC_STATUS_IMMINENT = 1 # :nodoc:
90
+ FFC_STATUS_IN_PROGRESS = 2 # :nodoc:
91
+ FFC_STATUS_COMPLETE = 3 # :nodoc:
92
+ IMAGE_TRANSFER_MANUAL_HIGH_CONTRAST_IMAGE = 0 # :nodoc:
93
+ IMAGE_TRANSFER_MANUAL_TEMPERATURE_IMAGE = 1 # :nodoc:
94
+ IMAGE_TRANSFER_CALLBACK_HIGH_CONTRAST_IMAGE = 2 # :nodoc:
95
+ IMAGE_TRANSFER_CALLBACK_TEMPERATURE_IMAGE = 3 # :nodoc:
96
+ BOOTLOADER_MODE_BOOTLOADER = 0 # :nodoc:
97
+ BOOTLOADER_MODE_FIRMWARE = 1 # :nodoc:
98
+ BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT = 2 # :nodoc:
99
+ BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT = 3 # :nodoc:
100
+ BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT = 4 # :nodoc:
101
+ BOOTLOADER_STATUS_OK = 0 # :nodoc:
102
+ BOOTLOADER_STATUS_INVALID_MODE = 1 # :nodoc:
103
+ BOOTLOADER_STATUS_NO_CHANGE = 2 # :nodoc:
104
+ BOOTLOADER_STATUS_ENTRY_FUNCTION_NOT_PRESENT = 3 # :nodoc:
105
+ BOOTLOADER_STATUS_DEVICE_IDENTIFIER_INCORRECT = 4 # :nodoc:
106
+ BOOTLOADER_STATUS_CRC_MISMATCH = 5 # :nodoc:
107
+ STATUS_LED_CONFIG_OFF = 0 # :nodoc:
108
+ STATUS_LED_CONFIG_ON = 1 # :nodoc:
109
+ STATUS_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
110
+ STATUS_LED_CONFIG_SHOW_STATUS = 3 # :nodoc:
111
+
112
+ # Creates an object with the unique device ID <tt>uid</tt> and adds it to
113
+ # the IP Connection <tt>ipcon</tt>.
114
+ def initialize(uid, ipcon)
115
+ super uid, ipcon
116
+
117
+ @api_version = [2, 0, 0]
118
+
119
+ @response_expected[FUNCTION_GET_HIGH_CONTRAST_IMAGE_LOW_LEVEL] = RESPONSE_EXPECTED_ALWAYS_TRUE
120
+ @response_expected[FUNCTION_GET_TEMPERATURE_IMAGE_LOW_LEVEL] = RESPONSE_EXPECTED_ALWAYS_TRUE
121
+ @response_expected[FUNCTION_GET_STATISTICS] = RESPONSE_EXPECTED_ALWAYS_TRUE
122
+ @response_expected[FUNCTION_SET_RESOLUTION] = RESPONSE_EXPECTED_FALSE
123
+ @response_expected[FUNCTION_GET_RESOLUTION] = RESPONSE_EXPECTED_ALWAYS_TRUE
124
+ @response_expected[FUNCTION_SET_SPOTMETER_CONFIG] = RESPONSE_EXPECTED_FALSE
125
+ @response_expected[FUNCTION_GET_SPOTMETER_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
126
+ @response_expected[FUNCTION_SET_HIGH_CONTRAST_CONFIG] = RESPONSE_EXPECTED_FALSE
127
+ @response_expected[FUNCTION_GET_HIGH_CONTRAST_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
128
+ @response_expected[FUNCTION_SET_IMAGE_TRANSFER_CONFIG] = RESPONSE_EXPECTED_TRUE
129
+ @response_expected[FUNCTION_GET_IMAGE_TRANSFER_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
130
+ @response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
131
+ @response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
132
+ @response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
133
+ @response_expected[FUNCTION_SET_WRITE_FIRMWARE_POINTER] = RESPONSE_EXPECTED_FALSE
134
+ @response_expected[FUNCTION_WRITE_FIRMWARE] = RESPONSE_EXPECTED_ALWAYS_TRUE
135
+ @response_expected[FUNCTION_SET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
136
+ @response_expected[FUNCTION_GET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
137
+ @response_expected[FUNCTION_GET_CHIP_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
138
+ @response_expected[FUNCTION_RESET] = RESPONSE_EXPECTED_FALSE
139
+ @response_expected[FUNCTION_WRITE_UID] = RESPONSE_EXPECTED_FALSE
140
+ @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
141
+ @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
142
+
143
+ @callback_formats[CALLBACK_HIGH_CONTRAST_IMAGE_LOW_LEVEL] = 'S C62'
144
+ @callback_formats[CALLBACK_TEMPERATURE_IMAGE_LOW_LEVEL] = 'S S31'
145
+
146
+ @high_level_callbacks[CALLBACK_HIGH_CONTRAST_IMAGE] = [['stream_chunk_offset', 'stream_chunk_data'], {'fixed_length' => 4800, 'single_chunk' => false}, nil]
147
+ @high_level_callbacks[CALLBACK_TEMPERATURE_IMAGE] = [['stream_chunk_offset', 'stream_chunk_data'], {'fixed_length' => 4800, 'single_chunk' => false}, nil]
148
+ end
149
+
150
+ # Returns the current high contrast image. See `here <https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Thermal_Imaging.html#high-contrast-image-vs-temperature-image>`__
151
+ # for the difference between
152
+ # High Contrast and Temperature Image. If you don't know what to use
153
+ # the High Contrast Image is probably right for you.
154
+ #
155
+ # The data is organized as a 8-bit value 80x60 pixel matrix linearized in
156
+ # a one-dimensional array. The data is arranged line by line from top left to
157
+ # bottom right.
158
+ #
159
+ # Each 8-bit value represents one gray-scale image pixel that can directly be
160
+ # shown to a user on a display.
161
+ #
162
+ # Before you can use this function you have to enable it with
163
+ # BrickletThermalImaging#set_image_transfer_config.
164
+ def get_high_contrast_image_low_level
165
+ send_request FUNCTION_GET_HIGH_CONTRAST_IMAGE_LOW_LEVEL, [], '', 64, 'S C62'
166
+ end
167
+
168
+ # Returns the current temperature image. See `here <https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Thermal_Imaging.html#high-contrast-image-vs-temperature-image>`__
169
+ # for the difference between High Contrast and Temperature Image.
170
+ # If you don't know what to use the High Contrast Image is probably right for you.
171
+ #
172
+ # The data is organized as a 16-bit value 80x60 pixel matrix linearized in
173
+ # a one-dimensional array. The data is arranged line by line from top left to
174
+ # bottom right.
175
+ #
176
+ # Each 16-bit value represents one temperature measurement in either
177
+ # Kelvin/10 or Kelvin/100 (depending on the resolution set withBrickletThermalImaging#set_resolution).
178
+ #
179
+ # Before you can use this function you have to enable it with
180
+ # BrickletThermalImaging#set_image_transfer_config.
181
+ def get_temperature_image_low_level
182
+ send_request FUNCTION_GET_TEMPERATURE_IMAGE_LOW_LEVEL, [], '', 64, 'S S31'
183
+ end
184
+
185
+ # Returns the spotmeter statistics, various temperatures, current resolution and status bits.
186
+ #
187
+ # The spotmeter statistics are:
188
+ #
189
+ # * Index 0: Mean Temperature.
190
+ # * Index 1: Maximum Temperature.
191
+ # * Index 2: Minimum Temperature.
192
+ # * Index 3: Pixel Count of spotmeter region of interest.
193
+ #
194
+ # The temperatures are:
195
+ #
196
+ # * Index 0: Focal Plain Array temperature.
197
+ # * Index 1: Focal Plain Array temperature at last FFC (Flat Field Correction).
198
+ # * Index 2: Housing temperature.
199
+ # * Index 3: Housing temperature at last FFC.
200
+ #
201
+ # The resolution is either `0 to 6553 Kelvin` or `0 to 655 Kelvin`. If the resolution is the former,
202
+ # the temperatures are in Kelvin/10, if it is the latter the temperatures are in Kelvin/100.
203
+ #
204
+ # FFC (Flat Field Correction) Status:
205
+ #
206
+ # * FFC Never Commanded: Only seen on startup before first FFC.
207
+ # * FFC Imminent: This state is entered 2 seconds prior to initiating FFC.
208
+ # * FFC In Progress: Flat field correction is started (shutter moves in front of lens and back). Takes about 1 second.
209
+ # * FFC Complete: Shutter is in waiting position again, FFC done.
210
+ #
211
+ # Temperature warning bits:
212
+ #
213
+ # * Index 0: Shutter lockout (if true shutter is locked out because temperature is outside -10°C to +65°C)
214
+ # * Index 1: Overtemperature shut down imminent (goes true 10 seconds before shutdown)
215
+ def get_statistics
216
+ send_request FUNCTION_GET_STATISTICS, [], '', 20, 'S4 S4 C C ?2'
217
+ end
218
+
219
+ # Sets the resolution. The Thermal Imaging Bricklet can either measure
220
+ #
221
+ # * from 0 to 6553 Kelvin (-273.15°C to +6279.85°C) with 0.1°C resolution or
222
+ # * from 0 to 655 Kelvin (-273.15°C to +381.85°C) with 0.01°C resolution.
223
+ #
224
+ # The default value is 0 to 655 Kelvin.
225
+ def set_resolution(resolution)
226
+ send_request FUNCTION_SET_RESOLUTION, [resolution], 'C', 0, ''
227
+ end
228
+
229
+ # Returns the resolution as set by BrickletThermalImaging#set_resolution.
230
+ def get_resolution
231
+ send_request FUNCTION_GET_RESOLUTION, [], '', 1, 'C'
232
+ end
233
+
234
+ # Sets the spotmeter region of interest. The 4 values are
235
+ #
236
+ # * Index 0: Column start (has to be smaller then Column end).
237
+ # * Index 1: Row start (has to be smaller then Row end).
238
+ # * Index 2: Column end (has to be smaller then 80).
239
+ # * Index 3: Row end (has to be smaller then 60).
240
+ #
241
+ # The spotmeter statistics can be read out with BrickletThermalImaging#get_statistics.
242
+ #
243
+ # The default region of interest is (39, 29, 40, 30).
244
+ def set_spotmeter_config(region_of_interest)
245
+ send_request FUNCTION_SET_SPOTMETER_CONFIG, [region_of_interest], 'C4', 0, ''
246
+ end
247
+
248
+ # Returns the spotmeter config as set by BrickletThermalImaging#set_spotmeter_config.
249
+ def get_spotmeter_config
250
+ send_request FUNCTION_GET_SPOTMETER_CONFIG, [], '', 4, 'C4'
251
+ end
252
+
253
+ # Sets the high contrast region of interest, dampening factor, clip limit and empty counts.
254
+ # This config is only used in high contrast mode (see BrickletThermalImaging#set_image_transfer_config).
255
+ #
256
+ # The high contrast region of interest consists of four values:
257
+ #
258
+ # * Index 0: Column start (has to be smaller or equal then Column end).
259
+ # * Index 1: Row start (has to be smaller then Row end).
260
+ # * Index 2: Column end (has to be smaller then 80).
261
+ # * Index 3: Row end (has to be smaller then 60).
262
+ #
263
+ # The algorithm to generate the high contrast image is applied to this region.
264
+ #
265
+ # Dampening Factor: This parameter is the amount of temporal dampening applied to the HEQ
266
+ # (history equalization) transformation function. An IIR filter of the form::
267
+ #
268
+ # (N / 256) * previous + ((256 - N) / 256) * current
269
+ #
270
+ # is applied, and the HEQ dampening factor
271
+ # represents the value N in the equation, i.e., a value that applies to the amount of
272
+ # influence the previous HEQ transformation function has on the current function. The
273
+ # lower the value of N the higher the influence of the current video frame whereas
274
+ # the higher the value of N the more influence the previous damped transfer function has.
275
+ #
276
+ # Clip Limit Index 0 (AGC HEQ Clip Limit Low): This parameter defines an artificial population that is added to
277
+ # every non-empty histogram bin. In other words, if the Clip Limit Low is set to L, a bin
278
+ # with an actual population of X will have an effective population of L + X. Any empty bin
279
+ # that is nearby a populated bin will be given an artificial population of L. The effect of
280
+ # higher values is to provide a more linear transfer function; lower values provide a more
281
+ # non-linear (equalized) transfer function.
282
+ #
283
+ # Clip Limit Index 1 (AGC HEQ Clip Limit High): This parameter defines the maximum number of pixels allowed
284
+ # to accumulate in any given histogram bin. Any additional pixels in a given bin are clipped.
285
+ # The effect of this parameter is to limit the influence of highly-populated bins on the
286
+ # resulting HEQ transformation function.
287
+ #
288
+ # Empty Counts: This parameter specifies the maximum number of pixels in a bin that will be
289
+ # interpreted as an empty bin. Histogram bins with this number of pixels or less will be
290
+ # processed as an empty bin.
291
+ #
292
+ # The default values are
293
+ #
294
+ # * Region Of Interest = (0, 0, 79, 59),
295
+ # * Dampening Factor = 64,
296
+ # * Clip Limit = (4800, 512) and
297
+ # * Empty Counts = 2.
298
+ def set_high_contrast_config(region_of_interest, dampening_factor, clip_limit, empty_counts)
299
+ send_request FUNCTION_SET_HIGH_CONTRAST_CONFIG, [region_of_interest, dampening_factor, clip_limit, empty_counts], 'C4 S S2 S', 0, ''
300
+ end
301
+
302
+ # Returns the high contrast config as set by BrickletThermalImaging#set_high_contrast_config.
303
+ def get_high_contrast_config
304
+ send_request FUNCTION_GET_HIGH_CONTRAST_CONFIG, [], '', 12, 'C4 S S2 S'
305
+ end
306
+
307
+ # The necessary bandwidth of this Bricklet is too high to use getter/callback or
308
+ # high contrast/temperature image at the same time. You have to configure the one
309
+ # you want to use, the Bricklet will optimize the internal configuration accordingly.
310
+ #
311
+ # Corresponding functions:
312
+ #
313
+ # * Manual High Contrast Image: BrickletThermalImaging#get_high_contrast_image.
314
+ # * Manual Temperature Image: BrickletThermalImaging#get_temperature_image.
315
+ # * Callback High Contrast Image: CALLBACK_HIGH_CONTRAST_IMAGE callback.
316
+ # * Callback Temperature Image: CALLBACK_TEMPERATURE_IMAGE callback.
317
+ #
318
+ # The default is Manual High Contrast Image (0).
319
+ def set_image_transfer_config(config)
320
+ send_request FUNCTION_SET_IMAGE_TRANSFER_CONFIG, [config], 'C', 0, ''
321
+ end
322
+
323
+ # Returns the image transfer config, as set by BrickletThermalImaging#set_image_transfer_config.
324
+ def get_image_transfer_config
325
+ send_request FUNCTION_GET_IMAGE_TRANSFER_CONFIG, [], '', 1, 'C'
326
+ end
327
+
328
+ # Returns the error count for the communication between Brick and Bricklet.
329
+ #
330
+ # The errors are divided into
331
+ #
332
+ # * ack checksum errors,
333
+ # * message checksum errors,
334
+ # * frameing errors and
335
+ # * overflow errors.
336
+ #
337
+ # The errors counts are for errors that occur on the Bricklet side. All
338
+ # Bricks have a similar function that returns the errors on the Brick side.
339
+ def get_spitfp_error_count
340
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
341
+ end
342
+
343
+ # Sets the bootloader mode and returns the status after the requested
344
+ # mode change was instigated.
345
+ #
346
+ # You can change from bootloader mode to firmware mode and vice versa. A change
347
+ # from bootloader mode to firmware mode will only take place if the entry function,
348
+ # device identifier und crc are present and correct.
349
+ #
350
+ # This function is used by Brick Viewer during flashing. It should not be
351
+ # necessary to call it in a normal user program.
352
+ def set_bootloader_mode(mode)
353
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
354
+ end
355
+
356
+ # Returns the current bootloader mode, see BrickletThermalImaging#set_bootloader_mode.
357
+ def get_bootloader_mode
358
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
359
+ end
360
+
361
+ # Sets the firmware pointer for BrickletThermalImaging#write_firmware. The pointer has
362
+ # to be increased by chunks of size 64. The data is written to flash
363
+ # every 4 chunks (which equals to one page of size 256).
364
+ #
365
+ # This function is used by Brick Viewer during flashing. It should not be
366
+ # necessary to call it in a normal user program.
367
+ def set_write_firmware_pointer(pointer)
368
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
369
+ end
370
+
371
+ # Writes 64 Bytes of firmware at the position as written by
372
+ # BrickletThermalImaging#set_write_firmware_pointer before. The firmware is written
373
+ # to flash every 4 chunks.
374
+ #
375
+ # You can only write firmware in bootloader mode.
376
+ #
377
+ # This function is used by Brick Viewer during flashing. It should not be
378
+ # necessary to call it in a normal user program.
379
+ def write_firmware(data)
380
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
381
+ end
382
+
383
+ # Sets the status LED configuration. By default the LED shows
384
+ # communication traffic between Brick and Bricklet, it flickers once
385
+ # for every 10 received data packets.
386
+ #
387
+ # You can also turn the LED permanently on/off or show a heartbeat.
388
+ #
389
+ # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
390
+ def set_status_led_config(config)
391
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
392
+ end
393
+
394
+ # Returns the configuration as set by BrickletThermalImaging#set_status_led_config
395
+ def get_status_led_config
396
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
397
+ end
398
+
399
+ # Returns the temperature in °C as measured inside the microcontroller. The
400
+ # value returned is not the ambient temperature!
401
+ #
402
+ # The temperature is only proportional to the real temperature and it has bad
403
+ # accuracy. Practically it is only useful as an indicator for
404
+ # temperature changes.
405
+ def get_chip_temperature
406
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
407
+ end
408
+
409
+ # Calling this function will reset the Bricklet. All configurations
410
+ # will be lost.
411
+ #
412
+ # After a reset you have to create new device objects,
413
+ # calling functions on the existing ones will result in
414
+ # undefined behavior!
415
+ def reset
416
+ send_request FUNCTION_RESET, [], '', 0, ''
417
+ end
418
+
419
+ # Writes a new UID into flash. If you want to set a new UID
420
+ # you have to decode the Base58 encoded UID string into an
421
+ # integer first.
422
+ #
423
+ # We recommend that you use Brick Viewer to change the UID.
424
+ def write_uid(uid)
425
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
426
+ end
427
+
428
+ # Returns the current UID as an integer. Encode as
429
+ # Base58 to get the usual string version.
430
+ def read_uid
431
+ send_request FUNCTION_READ_UID, [], '', 4, 'L'
432
+ end
433
+
434
+ # Returns the UID, the UID where the Bricklet is connected to,
435
+ # the position, the hardware and firmware version as well as the
436
+ # device identifier.
437
+ #
438
+ # The position can be 'a', 'b', 'c' or 'd'.
439
+ #
440
+ # The device identifier numbers can be found :ref:`here <device_identifier>`.
441
+ # |device_identifier_constant|
442
+ def get_identity
443
+ send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
444
+ end
445
+
446
+ # Returns the current high contrast image. See `here <https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Thermal_Imaging.html#high-contrast-image-vs-temperature-image>`__
447
+ # for the difference between
448
+ # High Contrast and Temperature Image. If you don't know what to use
449
+ # the High Contrast Image is probably right for you.
450
+ #
451
+ # The data is organized as a 8-bit value 80x60 pixel matrix linearized in
452
+ # a one-dimensional array. The data is arranged line by line from top left to
453
+ # bottom right.
454
+ #
455
+ # Each 8-bit value represents one gray-scale image pixel that can directly be
456
+ # shown to a user on a display.
457
+ #
458
+ # Before you can use this function you have to enable it with
459
+ # BrickletThermalImaging#set_image_transfer_config.
460
+ def get_high_contrast_image
461
+ image_length = 4800
462
+ image_data = nil # assigned in block
463
+
464
+ @stream_mutex.synchronize {
465
+ ret = get_high_contrast_image_low_level
466
+ image_chunk_offset = ret[0]
467
+
468
+ if image_chunk_offset == (1 << 16) - 1 # maximum chunk offset -> stream has no data
469
+ image_length = 0
470
+ image_chunk_offset = 0
471
+ image_out_of_sync = false
472
+ image_data = []
473
+ else
474
+ image_out_of_sync = image_chunk_offset != 0
475
+ image_data = ret[1]
476
+ end
477
+
478
+ while not image_out_of_sync and image_data.length < image_length
479
+ ret = get_high_contrast_image_low_level
480
+ image_chunk_offset = ret[0]
481
+ image_out_of_sync = image_chunk_offset != image_data.length
482
+ image_data += ret[1]
483
+ end
484
+
485
+ if image_out_of_sync # discard remaining stream to bring it back in-sync
486
+ while image_chunk_offset + 62 < image_length
487
+ ret = get_high_contrast_image_low_level
488
+ image_chunk_offset = ret[0]
489
+ end
490
+
491
+ raise StreamOutOfSyncException, 'Image stream is out-of-sync'
492
+ end
493
+ }
494
+
495
+ image_data[0, image_length]
496
+ end
497
+
498
+ # Returns the current temperature image. See `here <https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Thermal_Imaging.html#high-contrast-image-vs-temperature-image>`__
499
+ # for the difference between High Contrast and Temperature Image.
500
+ # If you don't know what to use the High Contrast Image is probably right for you.
501
+ #
502
+ # The data is organized as a 16-bit value 80x60 pixel matrix linearized in
503
+ # a one-dimensional array. The data is arranged line by line from top left to
504
+ # bottom right.
505
+ #
506
+ # Each 16-bit value represents one temperature measurement in either
507
+ # Kelvin/10 or Kelvin/100 (depending on the resolution set withBrickletThermalImaging#set_resolution).
508
+ #
509
+ # Before you can use this function you have to enable it with
510
+ # BrickletThermalImaging#set_image_transfer_config.
511
+ def get_temperature_image
512
+ image_length = 4800
513
+ image_data = nil # assigned in block
514
+
515
+ @stream_mutex.synchronize {
516
+ ret = get_temperature_image_low_level
517
+ image_chunk_offset = ret[0]
518
+
519
+ if image_chunk_offset == (1 << 16) - 1 # maximum chunk offset -> stream has no data
520
+ image_length = 0
521
+ image_chunk_offset = 0
522
+ image_out_of_sync = false
523
+ image_data = []
524
+ else
525
+ image_out_of_sync = image_chunk_offset != 0
526
+ image_data = ret[1]
527
+ end
528
+
529
+ while not image_out_of_sync and image_data.length < image_length
530
+ ret = get_temperature_image_low_level
531
+ image_chunk_offset = ret[0]
532
+ image_out_of_sync = image_chunk_offset != image_data.length
533
+ image_data += ret[1]
534
+ end
535
+
536
+ if image_out_of_sync # discard remaining stream to bring it back in-sync
537
+ while image_chunk_offset + 31 < image_length
538
+ ret = get_temperature_image_low_level
539
+ image_chunk_offset = ret[0]
540
+ end
541
+
542
+ raise StreamOutOfSyncException, 'Image stream is out-of-sync'
543
+ end
544
+ }
545
+
546
+ image_data[0, image_length]
547
+ end
548
+
549
+ # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
550
+ def register_callback(id, &block)
551
+ callback = block
552
+ @registered_callbacks[id] = callback
553
+ end
554
+ end
555
+ end