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 #
@@ -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 #
@@ -50,6 +50,8 @@ module Tinkerforge
50
50
  FUNCTION_P2P_READ_NDEF_LOW_LEVEL = 23 # :nodoc:
51
51
  FUNCTION_SET_DETECTION_LED_CONFIG = 25 # :nodoc:
52
52
  FUNCTION_GET_DETECTION_LED_CONFIG = 26 # :nodoc:
53
+ FUNCTION_SET_MAXIMUM_TIMEOUT = 27 # :nodoc:
54
+ FUNCTION_GET_MAXIMUM_TIMEOUT = 28 # :nodoc:
53
55
  FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
54
56
  FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
55
57
  FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
@@ -147,7 +149,7 @@ module Tinkerforge
147
149
  def initialize(uid, ipcon)
148
150
  super uid, ipcon
149
151
 
150
- @api_version = [2, 0, 0]
152
+ @api_version = [2, 0, 1]
151
153
 
152
154
  @response_expected[FUNCTION_SET_MODE] = RESPONSE_EXPECTED_FALSE
153
155
  @response_expected[FUNCTION_GET_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
@@ -172,6 +174,8 @@ module Tinkerforge
172
174
  @response_expected[FUNCTION_P2P_READ_NDEF_LOW_LEVEL] = RESPONSE_EXPECTED_ALWAYS_TRUE
173
175
  @response_expected[FUNCTION_SET_DETECTION_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
174
176
  @response_expected[FUNCTION_GET_DETECTION_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
177
+ @response_expected[FUNCTION_SET_MAXIMUM_TIMEOUT] = RESPONSE_EXPECTED_FALSE
178
+ @response_expected[FUNCTION_GET_MAXIMUM_TIMEOUT] = RESPONSE_EXPECTED_ALWAYS_TRUE
175
179
  @response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
176
180
  @response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
177
181
  @response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
@@ -564,6 +568,38 @@ module Tinkerforge
564
568
  send_request FUNCTION_GET_DETECTION_LED_CONFIG, [], '', 1, 'C'
565
569
  end
566
570
 
571
+ # Sets the maximum timeout in ms.
572
+ #
573
+ # This is a global maximum used for all internal state timeouts. The timeouts depend heavily
574
+ # on the used tags etc. For example: If you use a Type 2 tag and you want to detect if
575
+ # it is present, you have to use BrickletNFC#reader_request_tag_id and wait for the state
576
+ # to change to either the error state or the ready state.
577
+ #
578
+ # With the default configuration this takes 2-3 seconds. By setting the maximum timeout to
579
+ # 100ms you can reduce this time to ~150-200ms. For Type 2 this would also still work
580
+ # with a 20ms timeout (a Type 2 tag answers usually within 10ms). A type 4 tag can take
581
+ # up to 500ms in our tests.
582
+ #
583
+ # If you need a fast response time to discover if a tag is present or not you can find
584
+ # a good timeout value by trial and error for your specific tag.
585
+ #
586
+ # By default we use a very conservative timeout, to be sure that any Tag can always
587
+ # answer in time.
588
+ #
589
+ # Default timeout: 2000ms.
590
+ #
591
+ # .. versionadded:: 2.0.1$nbsp;(Plugin)
592
+ def set_maximum_timeout(timeout)
593
+ send_request FUNCTION_SET_MAXIMUM_TIMEOUT, [timeout], 'S', 0, ''
594
+ end
595
+
596
+ # Returns the timeout as set by BrickletNFC#set_maximum_timeout
597
+ #
598
+ # .. versionadded:: 2.0.1$nbsp;(Plugin)
599
+ def get_maximum_timeout
600
+ send_request FUNCTION_GET_MAXIMUM_TIMEOUT, [], '', 2, 'S'
601
+ end
602
+
567
603
  # Returns the error count for the communication between Brick and Bricklet.
568
604
  #
569
605
  # The errors are divided into
@@ -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 #
@@ -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 #
@@ -0,0 +1,320 @@
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 Particulate Matter concentration (PM1.0, PM2.5 and PM10)
14
+ class BrickletParticulateMatter < Device
15
+ DEVICE_IDENTIFIER = 2110 # :nodoc:
16
+ DEVICE_DISPLAY_NAME = 'Particulate Matter Bricklet' # :nodoc:
17
+
18
+ # This callback is triggered periodically according to the configuration set by
19
+ # BrickletParticulateMatter#set_pm_concentration_callback_configuration.
20
+ #
21
+ # The parameters are the same as BrickletParticulateMatter#get_pm_concentration.
22
+ CALLBACK_PM_CONCENTRATION = 10
23
+
24
+ # This callback is triggered periodically according to the configuration set by
25
+ # BrickletParticulateMatter#set_pm_count_callback_configuration.
26
+ #
27
+ # The parameters are the same as BrickletParticulateMatter#get_pm_count.
28
+ CALLBACK_PM_COUNT = 11
29
+
30
+ FUNCTION_GET_PM_CONCENTRATION = 1 # :nodoc:
31
+ FUNCTION_GET_PM_COUNT = 2 # :nodoc:
32
+ FUNCTION_SET_ENABLE = 3 # :nodoc:
33
+ FUNCTION_GET_ENABLE = 4 # :nodoc:
34
+ FUNCTION_GET_SENSOR_INFO = 5 # :nodoc:
35
+ FUNCTION_SET_PM_CONCENTRATION_CALLBACK_CONFIGURATION = 6 # :nodoc:
36
+ FUNCTION_GET_PM_CONCENTRATION_CALLBACK_CONFIGURATION = 7 # :nodoc:
37
+ FUNCTION_SET_PM_COUNT_CALLBACK_CONFIGURATION = 8 # :nodoc:
38
+ FUNCTION_GET_PM_COUNT_CALLBACK_CONFIGURATION = 9 # :nodoc:
39
+ FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
40
+ FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
41
+ FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
42
+ FUNCTION_SET_WRITE_FIRMWARE_POINTER = 237 # :nodoc:
43
+ FUNCTION_WRITE_FIRMWARE = 238 # :nodoc:
44
+ FUNCTION_SET_STATUS_LED_CONFIG = 239 # :nodoc:
45
+ FUNCTION_GET_STATUS_LED_CONFIG = 240 # :nodoc:
46
+ FUNCTION_GET_CHIP_TEMPERATURE = 242 # :nodoc:
47
+ FUNCTION_RESET = 243 # :nodoc:
48
+ FUNCTION_WRITE_UID = 248 # :nodoc:
49
+ FUNCTION_READ_UID = 249 # :nodoc:
50
+ FUNCTION_GET_IDENTITY = 255 # :nodoc:
51
+
52
+ BOOTLOADER_MODE_BOOTLOADER = 0 # :nodoc:
53
+ BOOTLOADER_MODE_FIRMWARE = 1 # :nodoc:
54
+ BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT = 2 # :nodoc:
55
+ BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT = 3 # :nodoc:
56
+ BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT = 4 # :nodoc:
57
+ BOOTLOADER_STATUS_OK = 0 # :nodoc:
58
+ BOOTLOADER_STATUS_INVALID_MODE = 1 # :nodoc:
59
+ BOOTLOADER_STATUS_NO_CHANGE = 2 # :nodoc:
60
+ BOOTLOADER_STATUS_ENTRY_FUNCTION_NOT_PRESENT = 3 # :nodoc:
61
+ BOOTLOADER_STATUS_DEVICE_IDENTIFIER_INCORRECT = 4 # :nodoc:
62
+ BOOTLOADER_STATUS_CRC_MISMATCH = 5 # :nodoc:
63
+ STATUS_LED_CONFIG_OFF = 0 # :nodoc:
64
+ STATUS_LED_CONFIG_ON = 1 # :nodoc:
65
+ STATUS_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
66
+ STATUS_LED_CONFIG_SHOW_STATUS = 3 # :nodoc:
67
+
68
+ # Creates an object with the unique device ID <tt>uid</tt> and adds it to
69
+ # the IP Connection <tt>ipcon</tt>.
70
+ def initialize(uid, ipcon)
71
+ super uid, ipcon
72
+
73
+ @api_version = [2, 0, 0]
74
+
75
+ @response_expected[FUNCTION_GET_PM_CONCENTRATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
76
+ @response_expected[FUNCTION_GET_PM_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
77
+ @response_expected[FUNCTION_SET_ENABLE] = RESPONSE_EXPECTED_FALSE
78
+ @response_expected[FUNCTION_GET_ENABLE] = RESPONSE_EXPECTED_ALWAYS_TRUE
79
+ @response_expected[FUNCTION_GET_SENSOR_INFO] = RESPONSE_EXPECTED_ALWAYS_TRUE
80
+ @response_expected[FUNCTION_SET_PM_CONCENTRATION_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
81
+ @response_expected[FUNCTION_GET_PM_CONCENTRATION_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
82
+ @response_expected[FUNCTION_SET_PM_COUNT_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
83
+ @response_expected[FUNCTION_GET_PM_COUNT_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
84
+ @response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
85
+ @response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
86
+ @response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
87
+ @response_expected[FUNCTION_SET_WRITE_FIRMWARE_POINTER] = RESPONSE_EXPECTED_FALSE
88
+ @response_expected[FUNCTION_WRITE_FIRMWARE] = RESPONSE_EXPECTED_ALWAYS_TRUE
89
+ @response_expected[FUNCTION_SET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
90
+ @response_expected[FUNCTION_GET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
91
+ @response_expected[FUNCTION_GET_CHIP_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
92
+ @response_expected[FUNCTION_RESET] = RESPONSE_EXPECTED_FALSE
93
+ @response_expected[FUNCTION_WRITE_UID] = RESPONSE_EXPECTED_FALSE
94
+ @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
95
+ @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
96
+
97
+ @callback_formats[CALLBACK_PM_CONCENTRATION] = 'S S S'
98
+ @callback_formats[CALLBACK_PM_COUNT] = 'S S S S S S'
99
+
100
+ end
101
+
102
+ # Returns the particulate matter concentration in µg/m³, broken down as:
103
+ #
104
+ # * PM\ :sub:`1.0`\ ,
105
+ # * PM\ :sub:`2.5`\ and
106
+ # * PM\ :sub:`10.0`\ .
107
+ #
108
+ # If the sensor is disabled (see BrickletParticulateMatter#set_enable) then the last known good
109
+ # values from the sensor are returned.
110
+ def get_pm_concentration
111
+ send_request FUNCTION_GET_PM_CONCENTRATION, [], '', 6, 'S S S'
112
+ end
113
+
114
+ # Returns the number of particulates in 100 ml of air, broken down by their
115
+ # diameter:
116
+ #
117
+ # * greater 0.3µm,
118
+ # * greater 0.5µm,
119
+ # * greater 1.0µm,
120
+ # * greater 2.5µm,
121
+ # * greater 5.0µm and
122
+ # * greater 10.0µm.
123
+ #
124
+ # If the sensor is disabled (see BrickletParticulateMatter#set_enable) then the last known good
125
+ # value from the sensor is returned.
126
+ def get_pm_count
127
+ send_request FUNCTION_GET_PM_COUNT, [], '', 12, 'S S S S S S'
128
+ end
129
+
130
+ # Enables/Disables the fan and the laser diode of the sensors. The sensor is
131
+ # enabled by default.
132
+ #
133
+ # The sensor takes about 30 after it is enabled to settle and produce stable
134
+ # values.
135
+ def set_enable(enable)
136
+ send_request FUNCTION_SET_ENABLE, [enable], '?', 0, ''
137
+ end
138
+
139
+ # Returns the state of the sensor as set by BrickletParticulateMatter#set_enable.
140
+ def get_enable
141
+ send_request FUNCTION_GET_ENABLE, [], '', 1, '?'
142
+ end
143
+
144
+ # Returns information about the sensor:
145
+ #
146
+ # * the sensor version number,
147
+ # * the last error code reported by the sensor (0 means no error) and
148
+ # * the number of framing and checksum errors that occurred in the communication
149
+ # with the sensor.
150
+ def get_sensor_info
151
+ send_request FUNCTION_GET_SENSOR_INFO, [], '', 4, 'C C C C'
152
+ end
153
+
154
+ # The period in ms is the period with which the CALLBACK_PM_CONCENTRATION
155
+ # callback is triggered periodically. A value of 0 turns the callback off.
156
+ #
157
+ # If the `value has to change`-parameter is set to true, the callback is only
158
+ # triggered after the value has changed. If the value didn't change within the
159
+ # period, the callback is triggered immediately on change.
160
+ #
161
+ # If it is set to false, the callback is continuously triggered with the period,
162
+ # independent of the value.
163
+ #
164
+ # The default value is (0, false).
165
+ def set_pm_concentration_callback_configuration(period, value_has_to_change)
166
+ send_request FUNCTION_SET_PM_CONCENTRATION_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 0, ''
167
+ end
168
+
169
+ # Returns the callback configuration as set by
170
+ # BrickletParticulateMatter#set_pm_concentration_callback_configuration.
171
+ def get_pm_concentration_callback_configuration
172
+ send_request FUNCTION_GET_PM_CONCENTRATION_CALLBACK_CONFIGURATION, [], '', 5, 'L ?'
173
+ end
174
+
175
+ # The period in ms is the period with which the CALLBACK_PM_COUNT callback
176
+ # is triggered periodically. A value of 0 turns the callback off.
177
+ #
178
+ # If the `value has to change`-parameter is set to true, the callback is only
179
+ # triggered after the value has changed. If the value didn't change within the
180
+ # period, the callback is triggered immediately on change.
181
+ #
182
+ # If it is set to false, the callback is continuously triggered with the period,
183
+ # independent of the value.
184
+ #
185
+ # The default value is (0, false).
186
+ def set_pm_count_callback_configuration(period, value_has_to_change)
187
+ send_request FUNCTION_SET_PM_COUNT_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 0, ''
188
+ end
189
+
190
+ # Returns the callback configuration as set by
191
+ # BrickletParticulateMatter#set_pm_count_callback_configuration.
192
+ def get_pm_count_callback_configuration
193
+ send_request FUNCTION_GET_PM_COUNT_CALLBACK_CONFIGURATION, [], '', 5, 'L ?'
194
+ end
195
+
196
+ # Returns the error count for the communication between Brick and Bricklet.
197
+ #
198
+ # The errors are divided into
199
+ #
200
+ # * ack checksum errors,
201
+ # * message checksum errors,
202
+ # * frameing errors and
203
+ # * overflow errors.
204
+ #
205
+ # The errors counts are for errors that occur on the Bricklet side. All
206
+ # Bricks have a similar function that returns the errors on the Brick side.
207
+ def get_spitfp_error_count
208
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
209
+ end
210
+
211
+ # Sets the bootloader mode and returns the status after the requested
212
+ # mode change was instigated.
213
+ #
214
+ # You can change from bootloader mode to firmware mode and vice versa. A change
215
+ # from bootloader mode to firmware mode will only take place if the entry function,
216
+ # device identifier und crc are present and correct.
217
+ #
218
+ # This function is used by Brick Viewer during flashing. It should not be
219
+ # necessary to call it in a normal user program.
220
+ def set_bootloader_mode(mode)
221
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
222
+ end
223
+
224
+ # Returns the current bootloader mode, see BrickletParticulateMatter#set_bootloader_mode.
225
+ def get_bootloader_mode
226
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
227
+ end
228
+
229
+ # Sets the firmware pointer for BrickletParticulateMatter#write_firmware. The pointer has
230
+ # to be increased by chunks of size 64. The data is written to flash
231
+ # every 4 chunks (which equals to one page of size 256).
232
+ #
233
+ # This function is used by Brick Viewer during flashing. It should not be
234
+ # necessary to call it in a normal user program.
235
+ def set_write_firmware_pointer(pointer)
236
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
237
+ end
238
+
239
+ # Writes 64 Bytes of firmware at the position as written by
240
+ # BrickletParticulateMatter#set_write_firmware_pointer before. The firmware is written
241
+ # to flash every 4 chunks.
242
+ #
243
+ # You can only write firmware in bootloader mode.
244
+ #
245
+ # This function is used by Brick Viewer during flashing. It should not be
246
+ # necessary to call it in a normal user program.
247
+ def write_firmware(data)
248
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
249
+ end
250
+
251
+ # Sets the status LED configuration. By default the LED shows
252
+ # communication traffic between Brick and Bricklet, it flickers once
253
+ # for every 10 received data packets.
254
+ #
255
+ # You can also turn the LED permanently on/off or show a heartbeat.
256
+ #
257
+ # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
258
+ def set_status_led_config(config)
259
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
260
+ end
261
+
262
+ # Returns the configuration as set by BrickletParticulateMatter#set_status_led_config
263
+ def get_status_led_config
264
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
265
+ end
266
+
267
+ # Returns the temperature in °C as measured inside the microcontroller. The
268
+ # value returned is not the ambient temperature!
269
+ #
270
+ # The temperature is only proportional to the real temperature and it has bad
271
+ # accuracy. Practically it is only useful as an indicator for
272
+ # temperature changes.
273
+ def get_chip_temperature
274
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
275
+ end
276
+
277
+ # Calling this function will reset the Bricklet. All configurations
278
+ # will be lost.
279
+ #
280
+ # After a reset you have to create new device objects,
281
+ # calling functions on the existing ones will result in
282
+ # undefined behavior!
283
+ def reset
284
+ send_request FUNCTION_RESET, [], '', 0, ''
285
+ end
286
+
287
+ # Writes a new UID into flash. If you want to set a new UID
288
+ # you have to decode the Base58 encoded UID string into an
289
+ # integer first.
290
+ #
291
+ # We recommend that you use Brick Viewer to change the UID.
292
+ def write_uid(uid)
293
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
294
+ end
295
+
296
+ # Returns the current UID as an integer. Encode as
297
+ # Base58 to get the usual string version.
298
+ def read_uid
299
+ send_request FUNCTION_READ_UID, [], '', 4, 'L'
300
+ end
301
+
302
+ # Returns the UID, the UID where the Bricklet is connected to,
303
+ # the position, the hardware and firmware version as well as the
304
+ # device identifier.
305
+ #
306
+ # The position can be 'a', 'b', 'c' or 'd'.
307
+ #
308
+ # The device identifier numbers can be found :ref:`here <device_identifier>`.
309
+ # |device_identifier_constant|
310
+ def get_identity
311
+ send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
312
+ end
313
+
314
+ # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
315
+ def register_callback(id, &block)
316
+ callback = block
317
+ @registered_callbacks[id] = callback
318
+ end
319
+ end
320
+ end