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 #
@@ -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 #
@@ -87,6 +87,8 @@ module Tinkerforge
87
87
  FUNCTION_GET_MOTION_CALLBACK_PERIOD = 18 # :nodoc:
88
88
  FUNCTION_SET_DATE_TIME_CALLBACK_PERIOD = 19 # :nodoc:
89
89
  FUNCTION_GET_DATE_TIME_CALLBACK_PERIOD = 20 # :nodoc:
90
+ FUNCTION_SET_SBAS_CONFIG = 27 # :nodoc:
91
+ FUNCTION_GET_SBAS_CONFIG = 28 # :nodoc:
90
92
  FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
91
93
  FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
92
94
  FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
@@ -115,6 +117,8 @@ module Tinkerforge
115
117
  FIX_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
116
118
  FIX_LED_CONFIG_SHOW_FIX = 3 # :nodoc:
117
119
  FIX_LED_CONFIG_SHOW_PPS = 4 # :nodoc:
120
+ SBAS_ENABLED = 0 # :nodoc:
121
+ SBAS_DISABLED = 1 # :nodoc:
118
122
  BOOTLOADER_MODE_BOOTLOADER = 0 # :nodoc:
119
123
  BOOTLOADER_MODE_FIRMWARE = 1 # :nodoc:
120
124
  BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT = 2 # :nodoc:
@@ -158,6 +162,8 @@ module Tinkerforge
158
162
  @response_expected[FUNCTION_GET_MOTION_CALLBACK_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
159
163
  @response_expected[FUNCTION_SET_DATE_TIME_CALLBACK_PERIOD] = RESPONSE_EXPECTED_TRUE
160
164
  @response_expected[FUNCTION_GET_DATE_TIME_CALLBACK_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
165
+ @response_expected[FUNCTION_SET_SBAS_CONFIG] = RESPONSE_EXPECTED_FALSE
166
+ @response_expected[FUNCTION_GET_SBAS_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
161
167
  @response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
162
168
  @response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
163
169
  @response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
@@ -375,6 +381,24 @@ module Tinkerforge
375
381
  send_request FUNCTION_GET_DATE_TIME_CALLBACK_PERIOD, [], '', 4, 'L'
376
382
  end
377
383
 
384
+ # If `SBAS <https://en.wikipedia.org/wiki/GNSS_augmentation#Satellite-based_augmentation_system>`__ is enabled,
385
+ # the position accuracy increases (if SBAS satellites are in view),
386
+ # but the update rate is limited to 5Hz. With SBAS disabled the update rate is increased to 10Hz.
387
+ #
388
+ # By default SBAS is enabled and the update rate is 5Hz.
389
+ #
390
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
391
+ def set_sbas_config(sbas_config)
392
+ send_request FUNCTION_SET_SBAS_CONFIG, [sbas_config], 'C', 0, ''
393
+ end
394
+
395
+ # Returns the SBAS configuration as set by BrickletGPSV2#set_sbas_config
396
+ #
397
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
398
+ def get_sbas_config
399
+ send_request FUNCTION_GET_SBAS_CONFIG, [], '', 1, 'C'
400
+ end
401
+
378
402
  # Returns the error count for the communication between Brick and Bricklet.
379
403
  #
380
404
  # The errors are divided into
@@ -408,7 +432,7 @@ module Tinkerforge
408
432
  send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
409
433
  end
410
434
 
411
- # Sets the firmware pointer for func:`WriteFirmware`. The pointer has
435
+ # Sets the firmware pointer for BrickletGPSV2#write_firmware. The pointer has
412
436
  # to be increased by chunks of size 64. The data is written to flash
413
437
  # every 4 chunks (which equals to one page of size 256).
414
438
  #
@@ -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,368 @@
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
+ # Measures relative humidity
14
+ class BrickletHumidityV2 < Device
15
+ DEVICE_IDENTIFIER = 283 # :nodoc:
16
+ DEVICE_DISPLAY_NAME = 'Humidity Bricklet 2.0' # :nodoc:
17
+
18
+ # This callback is triggered periodically according to the configuration set by
19
+ # BrickletHumidityV2#set_humidity_callback_configuration.
20
+ #
21
+ # The `parameter` is the same as BrickletHumidityV2#get_humidity.
22
+ CALLBACK_HUMIDITY = 4
23
+
24
+ # This callback is triggered periodically according to the configuration set by
25
+ # BrickletHumidityV2#set_temperature_callback_configuration.
26
+ #
27
+ # The `parameter` is the same as BrickletHumidityV2#get_temperature.
28
+ CALLBACK_TEMPERATURE = 8
29
+
30
+ FUNCTION_GET_HUMIDITY = 1 # :nodoc:
31
+ FUNCTION_SET_HUMIDITY_CALLBACK_CONFIGURATION = 2 # :nodoc:
32
+ FUNCTION_GET_HUMIDITY_CALLBACK_CONFIGURATION = 3 # :nodoc:
33
+ FUNCTION_GET_TEMPERATURE = 5 # :nodoc:
34
+ FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION = 6 # :nodoc:
35
+ FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION = 7 # :nodoc:
36
+ FUNCTION_SET_HEATER_CONFIGURATION = 9 # :nodoc:
37
+ FUNCTION_GET_HEATER_CONFIGURATION = 10 # :nodoc:
38
+ FUNCTION_SET_MOVING_AVERAGE_CONFIGURATION = 11 # :nodoc:
39
+ FUNCTION_GET_MOVING_AVERAGE_CONFIGURATION = 12 # :nodoc:
40
+ FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
41
+ FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
42
+ FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
43
+ FUNCTION_SET_WRITE_FIRMWARE_POINTER = 237 # :nodoc:
44
+ FUNCTION_WRITE_FIRMWARE = 238 # :nodoc:
45
+ FUNCTION_SET_STATUS_LED_CONFIG = 239 # :nodoc:
46
+ FUNCTION_GET_STATUS_LED_CONFIG = 240 # :nodoc:
47
+ FUNCTION_GET_CHIP_TEMPERATURE = 242 # :nodoc:
48
+ FUNCTION_RESET = 243 # :nodoc:
49
+ FUNCTION_WRITE_UID = 248 # :nodoc:
50
+ FUNCTION_READ_UID = 249 # :nodoc:
51
+ FUNCTION_GET_IDENTITY = 255 # :nodoc:
52
+
53
+ THRESHOLD_OPTION_OFF = 'x' # :nodoc:
54
+ THRESHOLD_OPTION_OUTSIDE = 'o' # :nodoc:
55
+ THRESHOLD_OPTION_INSIDE = 'i' # :nodoc:
56
+ THRESHOLD_OPTION_SMALLER = '<' # :nodoc:
57
+ THRESHOLD_OPTION_GREATER = '>' # :nodoc:
58
+ HEATER_CONFIG_DISABLED = 0 # :nodoc:
59
+ HEATER_CONFIG_ENABLED = 1 # :nodoc:
60
+ BOOTLOADER_MODE_BOOTLOADER = 0 # :nodoc:
61
+ BOOTLOADER_MODE_FIRMWARE = 1 # :nodoc:
62
+ BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT = 2 # :nodoc:
63
+ BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT = 3 # :nodoc:
64
+ BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT = 4 # :nodoc:
65
+ BOOTLOADER_STATUS_OK = 0 # :nodoc:
66
+ BOOTLOADER_STATUS_INVALID_MODE = 1 # :nodoc:
67
+ BOOTLOADER_STATUS_NO_CHANGE = 2 # :nodoc:
68
+ BOOTLOADER_STATUS_ENTRY_FUNCTION_NOT_PRESENT = 3 # :nodoc:
69
+ BOOTLOADER_STATUS_DEVICE_IDENTIFIER_INCORRECT = 4 # :nodoc:
70
+ BOOTLOADER_STATUS_CRC_MISMATCH = 5 # :nodoc:
71
+ STATUS_LED_CONFIG_OFF = 0 # :nodoc:
72
+ STATUS_LED_CONFIG_ON = 1 # :nodoc:
73
+ STATUS_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
74
+ STATUS_LED_CONFIG_SHOW_STATUS = 3 # :nodoc:
75
+
76
+ # Creates an object with the unique device ID <tt>uid</tt> and adds it to
77
+ # the IP Connection <tt>ipcon</tt>.
78
+ def initialize(uid, ipcon)
79
+ super uid, ipcon
80
+
81
+ @api_version = [2, 0, 0]
82
+
83
+ @response_expected[FUNCTION_GET_HUMIDITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
84
+ @response_expected[FUNCTION_SET_HUMIDITY_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
85
+ @response_expected[FUNCTION_GET_HUMIDITY_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
86
+ @response_expected[FUNCTION_GET_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
87
+ @response_expected[FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
88
+ @response_expected[FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
89
+ @response_expected[FUNCTION_SET_HEATER_CONFIGURATION] = RESPONSE_EXPECTED_FALSE
90
+ @response_expected[FUNCTION_GET_HEATER_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
91
+ @response_expected[FUNCTION_SET_MOVING_AVERAGE_CONFIGURATION] = RESPONSE_EXPECTED_FALSE
92
+ @response_expected[FUNCTION_GET_MOVING_AVERAGE_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
93
+ @response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
94
+ @response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
95
+ @response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
96
+ @response_expected[FUNCTION_SET_WRITE_FIRMWARE_POINTER] = RESPONSE_EXPECTED_FALSE
97
+ @response_expected[FUNCTION_WRITE_FIRMWARE] = RESPONSE_EXPECTED_ALWAYS_TRUE
98
+ @response_expected[FUNCTION_SET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
99
+ @response_expected[FUNCTION_GET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
100
+ @response_expected[FUNCTION_GET_CHIP_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
101
+ @response_expected[FUNCTION_RESET] = RESPONSE_EXPECTED_FALSE
102
+ @response_expected[FUNCTION_WRITE_UID] = RESPONSE_EXPECTED_FALSE
103
+ @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
104
+ @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
105
+
106
+ @callback_formats[CALLBACK_HUMIDITY] = 'S'
107
+ @callback_formats[CALLBACK_TEMPERATURE] = 's'
108
+
109
+ end
110
+
111
+ # Returns the humidity measured by the sensor. The value
112
+ # has a range of 0 to 10000 and is given in %RH/100 (Relative Humidity),
113
+ # i.e. a value of 4223 means that a humidity of 42.23 %RH is measured.
114
+ #
115
+ #
116
+ # If you want to get the value periodically, it is recommended to use the
117
+ # CALLBACK_HUMIDITY callback. You can set the callback configuration
118
+ # with BrickletHumidityV2#set_humidity_callback_configuration.
119
+ def get_humidity
120
+ send_request FUNCTION_GET_HUMIDITY, [], '', 2, 'S'
121
+ end
122
+
123
+ # The period in ms is the period with which the CALLBACK_HUMIDITY callback is triggered
124
+ # periodically. A value of 0 turns the callback off.
125
+ #
126
+ # If the `value has to change`-parameter is set to true, the callback is only
127
+ # triggered after the value has changed. If the value didn't change
128
+ # within the period, the callback is triggered immediately on change.
129
+ #
130
+ # If it is set to false, the callback is continuously triggered with the period,
131
+ # independent of the value.
132
+ #
133
+ # It is furthermore possible to constrain the callback with thresholds.
134
+ #
135
+ # The `option`-parameter together with min/max sets a threshold for the CALLBACK_HUMIDITY callback.
136
+ #
137
+ # The following options are possible:
138
+ #
139
+ # "Option", "Description"
140
+ #
141
+ # "'x'", "Threshold is turned off"
142
+ # "'o'", "Threshold is triggered when the value is *outside* the min and max values"
143
+ # "'i'", "Threshold is triggered when the value is *inside* the min and max values"
144
+ # "'<'", "Threshold is triggered when the value is smaller than the min value (max is ignored)"
145
+ # "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
146
+ #
147
+ #
148
+ # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
149
+ #
150
+ # The default value is (0, false, 'x', 0, 0).
151
+ def set_humidity_callback_configuration(period, value_has_to_change, option, min, max)
152
+ send_request FUNCTION_SET_HUMIDITY_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k S S', 0, ''
153
+ end
154
+
155
+ # Returns the callback configuration as set by BrickletHumidityV2#set_humidity_callback_configuration.
156
+ def get_humidity_callback_configuration
157
+ send_request FUNCTION_GET_HUMIDITY_CALLBACK_CONFIGURATION, [], '', 10, 'L ? k S S'
158
+ end
159
+
160
+ # Returns the temperature measured by the sensor. The value
161
+ # has a range of -4000 to 16500 and is given in °C/100,
162
+ # i.e. a value of 3200 means that a temperature of 32.00 °C is measured.
163
+ #
164
+ #
165
+ # If you want to get the value periodically, it is recommended to use the
166
+ # CALLBACK_TEMPERATURE callback. You can set the callback configuration
167
+ # with BrickletHumidityV2#set_temperature_callback_configuration.
168
+ def get_temperature
169
+ send_request FUNCTION_GET_TEMPERATURE, [], '', 2, 's'
170
+ end
171
+
172
+ # The period in ms is the period with which the CALLBACK_TEMPERATURE callback is triggered
173
+ # periodically. A value of 0 turns the callback off.
174
+ #
175
+ # If the `value has to change`-parameter is set to true, the callback is only
176
+ # triggered after the value has changed. If the value didn't change
177
+ # within the period, the callback is triggered immediately on change.
178
+ #
179
+ # If it is set to false, the callback is continuously triggered with the period,
180
+ # independent of the value.
181
+ #
182
+ # It is furthermore possible to constrain the callback with thresholds.
183
+ #
184
+ # The `option`-parameter together with min/max sets a threshold for the CALLBACK_TEMPERATURE callback.
185
+ #
186
+ # The following options are possible:
187
+ #
188
+ # "Option", "Description"
189
+ #
190
+ # "'x'", "Threshold is turned off"
191
+ # "'o'", "Threshold is triggered when the value is *outside* the min and max values"
192
+ # "'i'", "Threshold is triggered when the value is *inside* the min and max values"
193
+ # "'<'", "Threshold is triggered when the value is smaller than the min value (max is ignored)"
194
+ # "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
195
+ #
196
+ #
197
+ # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
198
+ #
199
+ # The default value is (0, false, 'x', 0, 0).
200
+ def set_temperature_callback_configuration(period, value_has_to_change, option, min, max)
201
+ send_request FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k S S', 0, ''
202
+ end
203
+
204
+ # Returns the callback configuration as set by BrickletHumidityV2#set_temperature_callback_configuration.
205
+ def get_temperature_callback_configuration
206
+ send_request FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 10, 'L ? k S S'
207
+ end
208
+
209
+ # Enables/disables the heater. The heater can be used to dry the sensor in
210
+ # extremely wet conditions.
211
+ #
212
+ # By default the heater is disabled.
213
+ def set_heater_configuration(heater_config)
214
+ send_request FUNCTION_SET_HEATER_CONFIGURATION, [heater_config], 'C', 0, ''
215
+ end
216
+
217
+ # Returns the heater configuration as set by BrickletHumidityV2#set_heater_configuration.
218
+ def get_heater_configuration
219
+ send_request FUNCTION_GET_HEATER_CONFIGURATION, [], '', 1, 'C'
220
+ end
221
+
222
+ # Sets the length of a `moving averaging <https://en.wikipedia.org/wiki/Moving_average>`__
223
+ # for the humidity and temperature.
224
+ #
225
+ # Setting the length to 1 will turn the averaging off. With less
226
+ # averaging, there is more noise on the data.
227
+ #
228
+ # The range for the averaging is 1-1000.
229
+ #
230
+ # New data is gathered every 50ms. With a moving average of length 1000 the resulting
231
+ # averaging window has a length of 50s. If you want to do long term measurements the longest
232
+ # moving average will give the cleanest results.
233
+ #
234
+ # The default value is 100.
235
+ def set_moving_average_configuration(moving_average_length_humidity, moving_average_length_temperature)
236
+ send_request FUNCTION_SET_MOVING_AVERAGE_CONFIGURATION, [moving_average_length_humidity, moving_average_length_temperature], 'S S', 0, ''
237
+ end
238
+
239
+ # Returns the moving average configuration as set by BrickletHumidityV2#set_moving_average_configuration.
240
+ def get_moving_average_configuration
241
+ send_request FUNCTION_GET_MOVING_AVERAGE_CONFIGURATION, [], '', 4, 'S S'
242
+ end
243
+
244
+ # Returns the error count for the communication between Brick and Bricklet.
245
+ #
246
+ # The errors are divided into
247
+ #
248
+ # * ack checksum errors,
249
+ # * message checksum errors,
250
+ # * frameing errors and
251
+ # * overflow errors.
252
+ #
253
+ # The errors counts are for errors that occur on the Bricklet side. All
254
+ # Bricks have a similar function that returns the errors on the Brick side.
255
+ def get_spitfp_error_count
256
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
257
+ end
258
+
259
+ # Sets the bootloader mode and returns the status after the requested
260
+ # mode change was instigated.
261
+ #
262
+ # You can change from bootloader mode to firmware mode and vice versa. A change
263
+ # from bootloader mode to firmware mode will only take place if the entry function,
264
+ # device identifier und crc are present and correct.
265
+ #
266
+ # This function is used by Brick Viewer during flashing. It should not be
267
+ # necessary to call it in a normal user program.
268
+ def set_bootloader_mode(mode)
269
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
270
+ end
271
+
272
+ # Returns the current bootloader mode, see BrickletHumidityV2#set_bootloader_mode.
273
+ def get_bootloader_mode
274
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
275
+ end
276
+
277
+ # Sets the firmware pointer for BrickletHumidityV2#write_firmware. The pointer has
278
+ # to be increased by chunks of size 64. The data is written to flash
279
+ # every 4 chunks (which equals to one page of size 256).
280
+ #
281
+ # This function is used by Brick Viewer during flashing. It should not be
282
+ # necessary to call it in a normal user program.
283
+ def set_write_firmware_pointer(pointer)
284
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
285
+ end
286
+
287
+ # Writes 64 Bytes of firmware at the position as written by
288
+ # BrickletHumidityV2#set_write_firmware_pointer before. The firmware is written
289
+ # to flash every 4 chunks.
290
+ #
291
+ # You can only write firmware in bootloader mode.
292
+ #
293
+ # This function is used by Brick Viewer during flashing. It should not be
294
+ # necessary to call it in a normal user program.
295
+ def write_firmware(data)
296
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
297
+ end
298
+
299
+ # Sets the status LED configuration. By default the LED shows
300
+ # communication traffic between Brick and Bricklet, it flickers once
301
+ # for every 10 received data packets.
302
+ #
303
+ # You can also turn the LED permanently on/off or show a heartbeat.
304
+ #
305
+ # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
306
+ def set_status_led_config(config)
307
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
308
+ end
309
+
310
+ # Returns the configuration as set by BrickletHumidityV2#set_status_led_config
311
+ def get_status_led_config
312
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
313
+ end
314
+
315
+ # Returns the temperature in °C as measured inside the microcontroller. The
316
+ # value returned is not the ambient temperature!
317
+ #
318
+ # The temperature is only proportional to the real temperature and it has bad
319
+ # accuracy. Practically it is only useful as an indicator for
320
+ # temperature changes.
321
+ def get_chip_temperature
322
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
323
+ end
324
+
325
+ # Calling this function will reset the Bricklet. All configurations
326
+ # will be lost.
327
+ #
328
+ # After a reset you have to create new device objects,
329
+ # calling functions on the existing ones will result in
330
+ # undefined behavior!
331
+ def reset
332
+ send_request FUNCTION_RESET, [], '', 0, ''
333
+ end
334
+
335
+ # Writes a new UID into flash. If you want to set a new UID
336
+ # you have to decode the Base58 encoded UID string into an
337
+ # integer first.
338
+ #
339
+ # We recommend that you use Brick Viewer to change the UID.
340
+ def write_uid(uid)
341
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
342
+ end
343
+
344
+ # Returns the current UID as an integer. Encode as
345
+ # Base58 to get the usual string version.
346
+ def read_uid
347
+ send_request FUNCTION_READ_UID, [], '', 4, 'L'
348
+ end
349
+
350
+ # Returns the UID, the UID where the Bricklet is connected to,
351
+ # the position, the hardware and firmware version as well as the
352
+ # device identifier.
353
+ #
354
+ # The position can be 'a', 'b', 'c' or 'd'.
355
+ #
356
+ # The device identifier numbers can be found :ref:`here <device_identifier>`.
357
+ # |device_identifier_constant|
358
+ def get_identity
359
+ send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
360
+ end
361
+
362
+ # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
363
+ def register_callback(id, &block)
364
+ callback = block
365
+ @registered_callbacks[id] = callback
366
+ end
367
+ end
368
+ end