tinkerforge 2.1.16 → 2.1.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tinkerforge/brick_dc.rb +3 -3
  3. data/lib/tinkerforge/brick_imu.rb +3 -3
  4. data/lib/tinkerforge/brick_imu_v2.rb +3 -3
  5. data/lib/tinkerforge/brick_master.rb +3 -3
  6. data/lib/tinkerforge/brick_red.rb +2 -2
  7. data/lib/tinkerforge/brick_servo.rb +3 -3
  8. data/lib/tinkerforge/brick_silent_stepper.rb +3 -3
  9. data/lib/tinkerforge/brick_stepper.rb +3 -3
  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_in_v3.rb +5 -6
  16. data/lib/tinkerforge/bricklet_analog_out.rb +2 -2
  17. data/lib/tinkerforge/bricklet_analog_out_v2.rb +2 -2
  18. data/lib/tinkerforge/bricklet_barometer.rb +2 -2
  19. data/lib/tinkerforge/bricklet_can.rb +3 -3
  20. data/lib/tinkerforge/bricklet_can_v2.rb +770 -0
  21. data/lib/tinkerforge/bricklet_co2.rb +2 -2
  22. data/lib/tinkerforge/bricklet_color.rb +2 -2
  23. data/lib/tinkerforge/bricklet_current12.rb +2 -2
  24. data/lib/tinkerforge/bricklet_current25.rb +2 -2
  25. data/lib/tinkerforge/bricklet_distance_ir.rb +2 -2
  26. data/lib/tinkerforge/bricklet_distance_us.rb +2 -2
  27. data/lib/tinkerforge/bricklet_dmx.rb +3 -3
  28. data/lib/tinkerforge/bricklet_dual_button.rb +2 -2
  29. data/lib/tinkerforge/bricklet_dual_relay.rb +2 -2
  30. data/lib/tinkerforge/bricklet_dust_detector.rb +2 -2
  31. data/lib/tinkerforge/bricklet_gps.rb +2 -2
  32. data/lib/tinkerforge/bricklet_gps_v2.rb +3 -3
  33. data/lib/tinkerforge/bricklet_hall_effect.rb +2 -2
  34. data/lib/tinkerforge/bricklet_humidity.rb +2 -2
  35. data/lib/tinkerforge/bricklet_humidity_v2.rb +11 -13
  36. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +2 -2
  37. data/lib/tinkerforge/bricklet_industrial_counter.rb +445 -0
  38. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +2 -2
  39. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +342 -0
  40. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +2 -2
  41. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +2 -2
  42. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +2 -2
  43. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +263 -0
  44. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +2 -2
  45. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +281 -0
  46. data/lib/tinkerforge/bricklet_io16.rb +2 -2
  47. data/lib/tinkerforge/bricklet_io4.rb +2 -2
  48. data/lib/tinkerforge/bricklet_io4_v2.rb +437 -0
  49. data/lib/tinkerforge/bricklet_joystick.rb +2 -2
  50. data/lib/tinkerforge/bricklet_laser_range_finder.rb +2 -2
  51. data/lib/tinkerforge/bricklet_lcd_16x2.rb +3 -3
  52. data/lib/tinkerforge/bricklet_lcd_20x4.rb +3 -3
  53. data/lib/tinkerforge/bricklet_led_strip.rb +2 -2
  54. data/lib/tinkerforge/bricklet_led_strip_v2.rb +493 -0
  55. data/lib/tinkerforge/bricklet_line.rb +2 -2
  56. data/lib/tinkerforge/bricklet_linear_poti.rb +2 -2
  57. data/lib/tinkerforge/bricklet_load_cell.rb +2 -2
  58. data/lib/tinkerforge/bricklet_load_cell_v2.rb +354 -0
  59. data/lib/tinkerforge/bricklet_moisture.rb +2 -2
  60. data/lib/tinkerforge/bricklet_motion_detector.rb +3 -3
  61. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +2 -2
  62. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +5 -6
  63. data/lib/tinkerforge/bricklet_multi_touch.rb +2 -2
  64. data/lib/tinkerforge/bricklet_nfc.rb +39 -3
  65. data/lib/tinkerforge/bricklet_nfc_rfid.rb +2 -2
  66. data/lib/tinkerforge/bricklet_oled_128x64.rb +2 -2
  67. data/lib/tinkerforge/bricklet_oled_64x48.rb +2 -2
  68. data/lib/tinkerforge/bricklet_outdoor_weather.rb +2 -2
  69. data/lib/tinkerforge/bricklet_particulate_matter.rb +320 -0
  70. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +2 -2
  71. data/lib/tinkerforge/bricklet_piezo_speaker.rb +2 -2
  72. data/lib/tinkerforge/bricklet_ptc.rb +33 -3
  73. data/lib/tinkerforge/bricklet_ptc_v2.rb +433 -0
  74. data/lib/tinkerforge/bricklet_real_time_clock.rb +2 -2
  75. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +353 -0
  76. data/lib/tinkerforge/bricklet_remote_switch.rb +2 -2
  77. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +2 -2
  78. data/lib/tinkerforge/bricklet_rgb_led.rb +2 -2
  79. data/lib/tinkerforge/bricklet_rgb_led_button.rb +2 -2
  80. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +2 -2
  81. data/lib/tinkerforge/bricklet_rotary_encoder.rb +2 -2
  82. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +8 -9
  83. data/lib/tinkerforge/bricklet_rotary_poti.rb +2 -2
  84. data/lib/tinkerforge/bricklet_rs232.rb +3 -3
  85. data/lib/tinkerforge/bricklet_rs232_v2.rb +421 -0
  86. data/lib/tinkerforge/bricklet_rs485.rb +6 -6
  87. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +2 -2
  88. data/lib/tinkerforge/bricklet_solid_state_relay.rb +2 -2
  89. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +3 -3
  90. data/lib/tinkerforge/bricklet_sound_intensity.rb +2 -2
  91. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +420 -0
  92. data/lib/tinkerforge/bricklet_temperature.rb +3 -3
  93. data/lib/tinkerforge/bricklet_temperature_ir.rb +2 -2
  94. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +13 -15
  95. data/lib/tinkerforge/bricklet_thermal_imaging.rb +2 -2
  96. data/lib/tinkerforge/bricklet_thermocouple.rb +4 -4
  97. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +340 -0
  98. data/lib/tinkerforge/bricklet_tilt.rb +2 -2
  99. data/lib/tinkerforge/bricklet_uv_light.rb +2 -2
  100. data/lib/tinkerforge/bricklet_voltage.rb +2 -2
  101. data/lib/tinkerforge/bricklet_voltage_current.rb +2 -2
  102. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +453 -0
  103. data/lib/tinkerforge/ip_connection.rb +4 -4
  104. data/lib/tinkerforge/version.rb +1 -1
  105. metadata +17 -2
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2018-02-28. #
3
+ # This file was automatically generated on 2018-06-08. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.16 #
5
+ # Ruby Bindings Version 2.1.17 #
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 #
@@ -55,7 +55,7 @@ module Tinkerforge
55
55
  def initialize(uid, ipcon)
56
56
  super uid, ipcon
57
57
 
58
- @api_version = [2, 0, 0]
58
+ @api_version = [2, 0, 1]
59
59
 
60
60
  @response_expected[FUNCTION_GET_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
61
61
  @response_expected[FUNCTION_SET_TEMPERATURE_CALLBACK_PERIOD] = RESPONSE_EXPECTED_TRUE
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2018-02-28. #
3
+ # This file was automatically generated on 2018-06-08. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.16 #
5
+ # Ruby Bindings Version 2.1.17 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2018-02-28. #
3
+ # This file was automatically generated on 2018-06-08. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.16 #
5
+ # Ruby Bindings Version 2.1.17 #
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 #
@@ -16,15 +16,15 @@ module Tinkerforge
16
16
  DEVICE_DISPLAY_NAME = 'Temperature IR Bricklet 2.0' # :nodoc:
17
17
 
18
18
  # This callback is triggered periodically according to the configuration set by
19
- # BrickletTemperatureIRV2#set_ambient_temperature_callback_configuration.
19
+ # BrickletTemperatureIRV2#set_ambient_temperature_callback_configuration.
20
20
  #
21
- # The `parameter` is the same as BrickletTemperatureIRV2#get_ambient_temperature.
21
+ # The parameter is the same as BrickletTemperatureIRV2#get_ambient_temperature.
22
22
  CALLBACK_AMBIENT_TEMPERATURE = 4
23
23
 
24
24
  # This callback is triggered periodically according to the configuration set by
25
- # BrickletTemperatureIRV2#set_object_temperature_callback_configuration.
25
+ # BrickletTemperatureIRV2#set_object_temperature_callback_configuration.
26
26
  #
27
- # The `parameter` is the same as BrickletTemperatureIRV2#get_object_temperature.
27
+ # The parameter is the same as BrickletTemperatureIRV2#get_object_temperature.
28
28
  CALLBACK_OBJECT_TEMPERATURE = 8
29
29
 
30
30
  FUNCTION_GET_AMBIENT_TEMPERATURE = 1 # :nodoc:
@@ -74,7 +74,7 @@ module Tinkerforge
74
74
  def initialize(uid, ipcon)
75
75
  super uid, ipcon
76
76
 
77
- @api_version = [2, 0, 0]
77
+ @api_version = [2, 0, 1]
78
78
 
79
79
  @response_expected[FUNCTION_GET_AMBIENT_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
80
80
  @response_expected[FUNCTION_SET_AMBIENT_TEMPERATURE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
@@ -139,21 +139,20 @@ module Tinkerforge
139
139
  #
140
140
  # "'x'", "Threshold is turned off"
141
141
  # "'o'", "Threshold is triggered when the value is *outside* the min and max values"
142
- # "'i'", "Threshold is triggered when the value is *inside* the min and max values"
142
+ # "'i'", "Threshold is triggered when the value is *inside* or equal to the min and max values"
143
143
  # "'<'", "Threshold is triggered when the value is smaller than the min value (max is ignored)"
144
144
  # "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
145
145
  #
146
- #
147
146
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
148
147
  #
149
148
  # The default value is (0, false, 'x', 0, 0).
150
149
  def set_ambient_temperature_callback_configuration(period, value_has_to_change, option, min, max)
151
- send_request FUNCTION_SET_AMBIENT_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k S S', 0, ''
150
+ send_request FUNCTION_SET_AMBIENT_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k s s', 0, ''
152
151
  end
153
152
 
154
153
  # Returns the callback configuration as set by BrickletTemperatureIRV2#set_ambient_temperature_callback_configuration.
155
154
  def get_ambient_temperature_callback_configuration
156
- send_request FUNCTION_GET_AMBIENT_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 10, 'L ? k S S'
155
+ send_request FUNCTION_GET_AMBIENT_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 10, 'L ? k s s'
157
156
  end
158
157
 
159
158
  # Returns the object temperature of the sensor, i.e. the temperature
@@ -198,21 +197,20 @@ module Tinkerforge
198
197
  #
199
198
  # "'x'", "Threshold is turned off"
200
199
  # "'o'", "Threshold is triggered when the value is *outside* the min and max values"
201
- # "'i'", "Threshold is triggered when the value is *inside* the min and max values"
200
+ # "'i'", "Threshold is triggered when the value is *inside* or equal to the min and max values"
202
201
  # "'<'", "Threshold is triggered when the value is smaller than the min value (max is ignored)"
203
202
  # "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
204
203
  #
205
- #
206
204
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
207
205
  #
208
206
  # The default value is (0, false, 'x', 0, 0).
209
207
  def set_object_temperature_callback_configuration(period, value_has_to_change, option, min, max)
210
- send_request FUNCTION_SET_OBJECT_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k S S', 0, ''
208
+ send_request FUNCTION_SET_OBJECT_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k s s', 0, ''
211
209
  end
212
210
 
213
211
  # Returns the callback configuration as set by BrickletTemperatureIRV2#set_object_temperature_callback_configuration.
214
212
  def get_object_temperature_callback_configuration
215
- send_request FUNCTION_GET_OBJECT_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 10, 'L ? k S S'
213
+ send_request FUNCTION_GET_OBJECT_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 10, 'L ? k s s'
216
214
  end
217
215
 
218
216
  # Sets the `emissivity <https://en.wikipedia.org/wiki/Emissivity>`__ that is
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2018-02-28. #
3
+ # This file was automatically generated on 2018-06-08. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.16 #
5
+ # Ruby Bindings Version 2.1.17 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2018-02-28. #
3
+ # This file was automatically generated on 2018-06-08. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.16 #
5
+ # Ruby Bindings Version 2.1.17 #
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 #
@@ -32,7 +32,7 @@ module Tinkerforge
32
32
  CALLBACK_TEMPERATURE_REACHED = 9
33
33
 
34
34
  # This Callback is triggered every time the error state changes
35
- # (see func:`GetErrorStatus`).
35
+ # (see BrickletThermocouple#get_error_state).
36
36
  CALLBACK_ERROR_STATE = 13
37
37
 
38
38
  FUNCTION_GET_TEMPERATURE = 1 # :nodoc:
@@ -206,7 +206,7 @@ module Tinkerforge
206
206
  # it is very likely that your thermocouple is defective. An Open Circuit error
207
207
  # indicates that there is no thermocouple connected.
208
208
  #
209
- # You can use the func:`ErrorState` callback to automatically get triggered
209
+ # You can use the CALLBACK_ERROR_STATE callback to automatically get triggered
210
210
  # when the error state changes.
211
211
  def get_error_state
212
212
  send_request FUNCTION_GET_ERROR_STATE, [], '', 2, '? ?'
@@ -0,0 +1,340 @@
1
+ # -*- ruby encoding: utf-8 -*-
2
+ #############################################################
3
+ # This file was automatically generated on 2018-06-08. #
4
+ # #
5
+ # Ruby Bindings Version 2.1.17 #
6
+ # #
7
+ # If you have a bugfix for this file and want to commit it, #
8
+ # please fix the bug in the generator. You can find a link #
9
+ # to the generators git repository on tinkerforge.com #
10
+ #############################################################
11
+
12
+ module Tinkerforge
13
+ # Measures temperature with thermocouples
14
+ class BrickletThermocoupleV2 < Device
15
+ DEVICE_IDENTIFIER = 2109 # :nodoc:
16
+ DEVICE_DISPLAY_NAME = 'Thermocouple Bricklet 2.0' # :nodoc:
17
+
18
+ # This callback is triggered periodically according to the configuration set by
19
+ # BrickletThermocoupleV2#set_temperature_callback_configuration.
20
+ #
21
+ # The parameter is the same as BrickletThermocoupleV2#get_temperature.
22
+ CALLBACK_TEMPERATURE = 4
23
+
24
+ # This Callback is triggered every time the error state changes
25
+ # (see BrickletThermocoupleV2#get_error_state).
26
+ CALLBACK_ERROR_STATE = 8
27
+
28
+ FUNCTION_GET_TEMPERATURE = 1 # :nodoc:
29
+ FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION = 2 # :nodoc:
30
+ FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION = 3 # :nodoc:
31
+ FUNCTION_SET_CONFIGURATION = 5 # :nodoc:
32
+ FUNCTION_GET_CONFIGURATION = 6 # :nodoc:
33
+ FUNCTION_GET_ERROR_STATE = 7 # :nodoc:
34
+ FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
35
+ FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
36
+ FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
37
+ FUNCTION_SET_WRITE_FIRMWARE_POINTER = 237 # :nodoc:
38
+ FUNCTION_WRITE_FIRMWARE = 238 # :nodoc:
39
+ FUNCTION_SET_STATUS_LED_CONFIG = 239 # :nodoc:
40
+ FUNCTION_GET_STATUS_LED_CONFIG = 240 # :nodoc:
41
+ FUNCTION_GET_CHIP_TEMPERATURE = 242 # :nodoc:
42
+ FUNCTION_RESET = 243 # :nodoc:
43
+ FUNCTION_WRITE_UID = 248 # :nodoc:
44
+ FUNCTION_READ_UID = 249 # :nodoc:
45
+ FUNCTION_GET_IDENTITY = 255 # :nodoc:
46
+
47
+ THRESHOLD_OPTION_OFF = 'x' # :nodoc:
48
+ THRESHOLD_OPTION_OUTSIDE = 'o' # :nodoc:
49
+ THRESHOLD_OPTION_INSIDE = 'i' # :nodoc:
50
+ THRESHOLD_OPTION_SMALLER = '<' # :nodoc:
51
+ THRESHOLD_OPTION_GREATER = '>' # :nodoc:
52
+ AVERAGING_1 = 1 # :nodoc:
53
+ AVERAGING_2 = 2 # :nodoc:
54
+ AVERAGING_4 = 4 # :nodoc:
55
+ AVERAGING_8 = 8 # :nodoc:
56
+ AVERAGING_16 = 16 # :nodoc:
57
+ TYPE_B = 0 # :nodoc:
58
+ TYPE_E = 1 # :nodoc:
59
+ TYPE_J = 2 # :nodoc:
60
+ TYPE_K = 3 # :nodoc:
61
+ TYPE_N = 4 # :nodoc:
62
+ TYPE_R = 5 # :nodoc:
63
+ TYPE_S = 6 # :nodoc:
64
+ TYPE_T = 7 # :nodoc:
65
+ TYPE_G8 = 8 # :nodoc:
66
+ TYPE_G32 = 9 # :nodoc:
67
+ FILTER_OPTION_50HZ = 0 # :nodoc:
68
+ FILTER_OPTION_60HZ = 1 # :nodoc:
69
+ BOOTLOADER_MODE_BOOTLOADER = 0 # :nodoc:
70
+ BOOTLOADER_MODE_FIRMWARE = 1 # :nodoc:
71
+ BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT = 2 # :nodoc:
72
+ BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT = 3 # :nodoc:
73
+ BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT = 4 # :nodoc:
74
+ BOOTLOADER_STATUS_OK = 0 # :nodoc:
75
+ BOOTLOADER_STATUS_INVALID_MODE = 1 # :nodoc:
76
+ BOOTLOADER_STATUS_NO_CHANGE = 2 # :nodoc:
77
+ BOOTLOADER_STATUS_ENTRY_FUNCTION_NOT_PRESENT = 3 # :nodoc:
78
+ BOOTLOADER_STATUS_DEVICE_IDENTIFIER_INCORRECT = 4 # :nodoc:
79
+ BOOTLOADER_STATUS_CRC_MISMATCH = 5 # :nodoc:
80
+ STATUS_LED_CONFIG_OFF = 0 # :nodoc:
81
+ STATUS_LED_CONFIG_ON = 1 # :nodoc:
82
+ STATUS_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
83
+ STATUS_LED_CONFIG_SHOW_STATUS = 3 # :nodoc:
84
+
85
+ # Creates an object with the unique device ID <tt>uid</tt> and adds it to
86
+ # the IP Connection <tt>ipcon</tt>.
87
+ def initialize(uid, ipcon)
88
+ super uid, ipcon
89
+
90
+ @api_version = [2, 0, 0]
91
+
92
+ @response_expected[FUNCTION_GET_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
93
+ @response_expected[FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
94
+ @response_expected[FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
95
+ @response_expected[FUNCTION_SET_CONFIGURATION] = RESPONSE_EXPECTED_FALSE
96
+ @response_expected[FUNCTION_GET_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
97
+ @response_expected[FUNCTION_GET_ERROR_STATE] = RESPONSE_EXPECTED_ALWAYS_TRUE
98
+ @response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
99
+ @response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
100
+ @response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
101
+ @response_expected[FUNCTION_SET_WRITE_FIRMWARE_POINTER] = RESPONSE_EXPECTED_FALSE
102
+ @response_expected[FUNCTION_WRITE_FIRMWARE] = RESPONSE_EXPECTED_ALWAYS_TRUE
103
+ @response_expected[FUNCTION_SET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
104
+ @response_expected[FUNCTION_GET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
105
+ @response_expected[FUNCTION_GET_CHIP_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
106
+ @response_expected[FUNCTION_RESET] = RESPONSE_EXPECTED_FALSE
107
+ @response_expected[FUNCTION_WRITE_UID] = RESPONSE_EXPECTED_FALSE
108
+ @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
109
+ @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
110
+
111
+ @callback_formats[CALLBACK_TEMPERATURE] = 'l'
112
+ @callback_formats[CALLBACK_ERROR_STATE] = '? ?'
113
+
114
+ end
115
+
116
+ # Returns the temperature of the thermocouple. The value is given in °C/100,
117
+ # e.g. a value of 4223 means that a temperature of 42.23 °C is measured.
118
+ #
119
+ # If you want to get the temperature periodically, it is recommended
120
+ # to use the CALLBACK_TEMPERATURE callback and set the period with
121
+ # BrickletThermocoupleV2#set_temperature_callback_configuration.
122
+ #
123
+ #
124
+ # If you want to get the value periodically, it is recommended to use the
125
+ # CALLBACK_TEMPERATURE callback. You can set the callback configuration
126
+ # with BrickletThermocoupleV2#set_temperature_callback_configuration.
127
+ def get_temperature
128
+ send_request FUNCTION_GET_TEMPERATURE, [], '', 4, 'l'
129
+ end
130
+
131
+ # The period in ms is the period with which the CALLBACK_TEMPERATURE callback is triggered
132
+ # periodically. A value of 0 turns the callback off.
133
+ #
134
+ # If the `value has to change`-parameter is set to true, the callback is only
135
+ # triggered after the value has changed. If the value didn't change
136
+ # within the period, the callback is triggered immediately on change.
137
+ #
138
+ # If it is set to false, the callback is continuously triggered with the period,
139
+ # independent of the value.
140
+ #
141
+ # It is furthermore possible to constrain the callback with thresholds.
142
+ #
143
+ # The `option`-parameter together with min/max sets a threshold for the CALLBACK_TEMPERATURE callback.
144
+ #
145
+ # The following options are possible:
146
+ #
147
+ # "Option", "Description"
148
+ #
149
+ # "'x'", "Threshold is turned off"
150
+ # "'o'", "Threshold is triggered when the value is *outside* the min and max values"
151
+ # "'i'", "Threshold is triggered when the value is *inside* or equal to the min and max values"
152
+ # "'<'", "Threshold is triggered when the value is smaller than the min value (max is ignored)"
153
+ # "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
154
+ #
155
+ # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
156
+ #
157
+ # The default value is (0, false, 'x', 0, 0).
158
+ def set_temperature_callback_configuration(period, value_has_to_change, option, min, max)
159
+ send_request FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 0, ''
160
+ end
161
+
162
+ # Returns the callback configuration as set by BrickletThermocoupleV2#set_temperature_callback_configuration.
163
+ def get_temperature_callback_configuration
164
+ send_request FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 14, 'L ? k l l'
165
+ end
166
+
167
+ # You can configure averaging size, thermocouple type and frequency
168
+ # filtering.
169
+ #
170
+ # Available averaging sizes are 1, 2, 4, 8 and 16 samples.
171
+ #
172
+ # As thermocouple type you can use B, E, J, K, N, R, S and T. If you have a
173
+ # different thermocouple or a custom thermocouple you can also use
174
+ # G8 and G32. With these types the returned value will not be in °C/100,
175
+ # it will be calculated by the following formulas:
176
+ #
177
+ # * G8: ``value = 8 * 1.6 * 2^17 * Vin``
178
+ # * G32: ``value = 32 * 1.6 * 2^17 * Vin``
179
+ #
180
+ # where Vin is the thermocouple input voltage.
181
+ #
182
+ # The frequency filter can be either configured to 50Hz or to 60Hz. You should
183
+ # configure it according to your utility frequency.
184
+ #
185
+ # The conversion time depends on the averaging and filter configuration, it can
186
+ # be calculated as follows:
187
+ #
188
+ # * 60Hz: ``time = 82 + (samples - 1) * 16.67``
189
+ # * 50Hz: ``time = 98 + (samples - 1) * 20``
190
+ #
191
+ # The default configuration is 16 samples, K type and 50Hz.
192
+ def set_configuration(averaging, thermocouple_type, filter)
193
+ send_request FUNCTION_SET_CONFIGURATION, [averaging, thermocouple_type, filter], 'C C C', 0, ''
194
+ end
195
+
196
+ # Returns the configuration as set by BrickletThermocoupleV2#set_configuration.
197
+ def get_configuration
198
+ send_request FUNCTION_GET_CONFIGURATION, [], '', 3, 'C C C'
199
+ end
200
+
201
+ # Returns the current error state. There are two possible errors:
202
+ #
203
+ # * Over/Under Voltage and
204
+ # * Open Circuit.
205
+ #
206
+ # Over/Under Voltage happens for voltages below 0V or above 3.3V. In this case
207
+ # it is very likely that your thermocouple is defective. An Open Circuit error
208
+ # indicates that there is no thermocouple connected.
209
+ #
210
+ # You can use the CALLBACK_ERROR_STATE callback to automatically get triggered
211
+ # when the error state changes.
212
+ def get_error_state
213
+ send_request FUNCTION_GET_ERROR_STATE, [], '', 2, '? ?'
214
+ end
215
+
216
+ # Returns the error count for the communication between Brick and Bricklet.
217
+ #
218
+ # The errors are divided into
219
+ #
220
+ # * ack checksum errors,
221
+ # * message checksum errors,
222
+ # * frameing errors and
223
+ # * overflow errors.
224
+ #
225
+ # The errors counts are for errors that occur on the Bricklet side. All
226
+ # Bricks have a similar function that returns the errors on the Brick side.
227
+ def get_spitfp_error_count
228
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
229
+ end
230
+
231
+ # Sets the bootloader mode and returns the status after the requested
232
+ # mode change was instigated.
233
+ #
234
+ # You can change from bootloader mode to firmware mode and vice versa. A change
235
+ # from bootloader mode to firmware mode will only take place if the entry function,
236
+ # device identifier und crc are present and correct.
237
+ #
238
+ # This function is used by Brick Viewer during flashing. It should not be
239
+ # necessary to call it in a normal user program.
240
+ def set_bootloader_mode(mode)
241
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
242
+ end
243
+
244
+ # Returns the current bootloader mode, see BrickletThermocoupleV2#set_bootloader_mode.
245
+ def get_bootloader_mode
246
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
247
+ end
248
+
249
+ # Sets the firmware pointer for BrickletThermocoupleV2#write_firmware. The pointer has
250
+ # to be increased by chunks of size 64. The data is written to flash
251
+ # every 4 chunks (which equals to one page of size 256).
252
+ #
253
+ # This function is used by Brick Viewer during flashing. It should not be
254
+ # necessary to call it in a normal user program.
255
+ def set_write_firmware_pointer(pointer)
256
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
257
+ end
258
+
259
+ # Writes 64 Bytes of firmware at the position as written by
260
+ # BrickletThermocoupleV2#set_write_firmware_pointer before. The firmware is written
261
+ # to flash every 4 chunks.
262
+ #
263
+ # You can only write firmware in bootloader mode.
264
+ #
265
+ # This function is used by Brick Viewer during flashing. It should not be
266
+ # necessary to call it in a normal user program.
267
+ def write_firmware(data)
268
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
269
+ end
270
+
271
+ # Sets the status LED configuration. By default the LED shows
272
+ # communication traffic between Brick and Bricklet, it flickers once
273
+ # for every 10 received data packets.
274
+ #
275
+ # You can also turn the LED permanently on/off or show a heartbeat.
276
+ #
277
+ # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
278
+ def set_status_led_config(config)
279
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
280
+ end
281
+
282
+ # Returns the configuration as set by BrickletThermocoupleV2#set_status_led_config
283
+ def get_status_led_config
284
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
285
+ end
286
+
287
+ # Returns the temperature in °C as measured inside the microcontroller. The
288
+ # value returned is not the ambient temperature!
289
+ #
290
+ # The temperature is only proportional to the real temperature and it has bad
291
+ # accuracy. Practically it is only useful as an indicator for
292
+ # temperature changes.
293
+ def get_chip_temperature
294
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
295
+ end
296
+
297
+ # Calling this function will reset the Bricklet. All configurations
298
+ # will be lost.
299
+ #
300
+ # After a reset you have to create new device objects,
301
+ # calling functions on the existing ones will result in
302
+ # undefined behavior!
303
+ def reset
304
+ send_request FUNCTION_RESET, [], '', 0, ''
305
+ end
306
+
307
+ # Writes a new UID into flash. If you want to set a new UID
308
+ # you have to decode the Base58 encoded UID string into an
309
+ # integer first.
310
+ #
311
+ # We recommend that you use Brick Viewer to change the UID.
312
+ def write_uid(uid)
313
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
314
+ end
315
+
316
+ # Returns the current UID as an integer. Encode as
317
+ # Base58 to get the usual string version.
318
+ def read_uid
319
+ send_request FUNCTION_READ_UID, [], '', 4, 'L'
320
+ end
321
+
322
+ # Returns the UID, the UID where the Bricklet is connected to,
323
+ # the position, the hardware and firmware version as well as the
324
+ # device identifier.
325
+ #
326
+ # The position can be 'a', 'b', 'c' or 'd'.
327
+ #
328
+ # The device identifier numbers can be found :ref:`here <device_identifier>`.
329
+ # |device_identifier_constant|
330
+ def get_identity
331
+ send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
332
+ end
333
+
334
+ # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
335
+ def register_callback(id, &block)
336
+ callback = block
337
+ @registered_callbacks[id] = callback
338
+ end
339
+ end
340
+ end