tinkerforge 2.1.15 → 2.1.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  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_in_v3.rb +319 -0
  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 +2 -2
  20. data/lib/tinkerforge/bricklet_co2.rb +2 -2
  21. data/lib/tinkerforge/bricklet_color.rb +2 -2
  22. data/lib/tinkerforge/bricklet_current12.rb +2 -2
  23. data/lib/tinkerforge/bricklet_current25.rb +2 -2
  24. data/lib/tinkerforge/bricklet_distance_ir.rb +2 -2
  25. data/lib/tinkerforge/bricklet_distance_us.rb +2 -2
  26. data/lib/tinkerforge/bricklet_dmx.rb +3 -3
  27. data/lib/tinkerforge/bricklet_dual_button.rb +2 -2
  28. data/lib/tinkerforge/bricklet_dual_relay.rb +2 -2
  29. data/lib/tinkerforge/bricklet_dust_detector.rb +2 -2
  30. data/lib/tinkerforge/bricklet_gps.rb +2 -2
  31. data/lib/tinkerforge/bricklet_gps_v2.rb +2 -2
  32. data/lib/tinkerforge/bricklet_hall_effect.rb +2 -2
  33. data/lib/tinkerforge/bricklet_humidity.rb +2 -2
  34. data/lib/tinkerforge/bricklet_humidity_v2.rb +2 -2
  35. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +2 -2
  36. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +2 -2
  37. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +2 -2
  38. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +2 -2
  39. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +2 -2
  40. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +2 -2
  41. data/lib/tinkerforge/bricklet_io16.rb +2 -2
  42. data/lib/tinkerforge/bricklet_io4.rb +2 -2
  43. data/lib/tinkerforge/bricklet_joystick.rb +2 -2
  44. data/lib/tinkerforge/bricklet_laser_range_finder.rb +2 -2
  45. data/lib/tinkerforge/bricklet_lcd_16x2.rb +2 -2
  46. data/lib/tinkerforge/bricklet_lcd_20x4.rb +2 -2
  47. data/lib/tinkerforge/bricklet_led_strip.rb +2 -2
  48. data/lib/tinkerforge/bricklet_line.rb +2 -2
  49. data/lib/tinkerforge/bricklet_linear_poti.rb +2 -2
  50. data/lib/tinkerforge/bricklet_load_cell.rb +2 -2
  51. data/lib/tinkerforge/bricklet_moisture.rb +2 -2
  52. data/lib/tinkerforge/bricklet_motion_detector.rb +2 -2
  53. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +261 -0
  54. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +2 -2
  55. data/lib/tinkerforge/bricklet_multi_touch.rb +2 -2
  56. data/lib/tinkerforge/bricklet_nfc.rb +998 -0
  57. data/lib/tinkerforge/bricklet_nfc_rfid.rb +5 -5
  58. data/lib/tinkerforge/bricklet_oled_128x64.rb +2 -2
  59. data/lib/tinkerforge/bricklet_oled_64x48.rb +2 -2
  60. data/lib/tinkerforge/bricklet_outdoor_weather.rb +390 -0
  61. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +2 -2
  62. data/lib/tinkerforge/bricklet_piezo_speaker.rb +2 -2
  63. data/lib/tinkerforge/bricklet_ptc.rb +2 -2
  64. data/lib/tinkerforge/bricklet_real_time_clock.rb +2 -2
  65. data/lib/tinkerforge/bricklet_remote_switch.rb +3 -3
  66. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +403 -0
  67. data/lib/tinkerforge/bricklet_rgb_led.rb +2 -2
  68. data/lib/tinkerforge/bricklet_rgb_led_button.rb +3 -3
  69. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +2 -2
  70. data/lib/tinkerforge/bricklet_rotary_encoder.rb +2 -2
  71. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +284 -0
  72. data/lib/tinkerforge/bricklet_rotary_poti.rb +2 -2
  73. data/lib/tinkerforge/bricklet_rs232.rb +2 -2
  74. data/lib/tinkerforge/bricklet_rs485.rb +2 -2
  75. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +2 -2
  76. data/lib/tinkerforge/bricklet_solid_state_relay.rb +2 -2
  77. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +247 -0
  78. data/lib/tinkerforge/bricklet_sound_intensity.rb +2 -2
  79. data/lib/tinkerforge/bricklet_temperature.rb +2 -2
  80. data/lib/tinkerforge/bricklet_temperature_ir.rb +2 -2
  81. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +369 -0
  82. data/lib/tinkerforge/bricklet_thermal_imaging.rb +5 -2
  83. data/lib/tinkerforge/bricklet_thermocouple.rb +2 -2
  84. data/lib/tinkerforge/bricklet_tilt.rb +2 -2
  85. data/lib/tinkerforge/bricklet_uv_light.rb +2 -2
  86. data/lib/tinkerforge/bricklet_voltage.rb +2 -2
  87. data/lib/tinkerforge/bricklet_voltage_current.rb +2 -2
  88. data/lib/tinkerforge/version.rb +1 -1
  89. metadata +11 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3f05ead98338ead488cabeac20156b97fba8ad5e
4
- data.tar.gz: 6a2248c9d3a0a3000c289800a4def1e54d54cebd
3
+ metadata.gz: 7ad537e60f699af8ac4f2758a2d369f49b9ef617
4
+ data.tar.gz: fce6800517170a6dd09b1e1368a3723fa56e0764
5
5
  SHA512:
6
- metadata.gz: f8689604a21263fd246c9e7d3abd8f61918c3785440023485caeda3ceeffcdaa527cda67e40cd7e2e3d4face22623312468c84ae20055a93b5e9b9656b2b4ebe
7
- data.tar.gz: a5c5ff0d40367bace070c1a0cd2d6f10395efe627ad67ccecf5d1fefa800cb7ef2415840ee46c0ee3315e9c7cd782cf6734bdc3f45df92fa6007e46a0ecdd5df
6
+ metadata.gz: 70ca95c498ac5f5d2cb54d00f0a049201f9a72f48f684b4799c396355252c14bcf0f6146dd73d03dbe759d83fc9228158cb1f595d6b174de8710fb4081585158
7
+ data.tar.gz: 85c8609e7e54fe1338a84f584879ec5682eeb66bdfc42de8475b651204b891517aef972c791d4f7253069bfe3ee600f9600b9c87369dd704608942218347baad
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2017-11-20. #
3
+ # This file was automatically generated on 2018-02-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.15 #
5
+ # Ruby Bindings Version 2.1.16 #
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-11-20. #
3
+ # This file was automatically generated on 2018-02-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.15 #
5
+ # Ruby Bindings Version 2.1.16 #
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-11-20. #
3
+ # This file was automatically generated on 2018-02-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.15 #
5
+ # Ruby Bindings Version 2.1.16 #
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-11-20. #
3
+ # This file was automatically generated on 2018-02-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.15 #
5
+ # Ruby Bindings Version 2.1.16 #
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-11-20. #
3
+ # This file was automatically generated on 2018-02-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.15 #
5
+ # Ruby Bindings Version 2.1.16 #
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-11-20. #
3
+ # This file was automatically generated on 2018-02-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.15 #
5
+ # Ruby Bindings Version 2.1.16 #
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-11-20. #
3
+ # This file was automatically generated on 2018-02-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.15 #
5
+ # Ruby Bindings Version 2.1.16 #
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-11-20. #
3
+ # This file was automatically generated on 2018-02-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.15 #
5
+ # Ruby Bindings Version 2.1.16 #
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-11-20. #
3
+ # This file was automatically generated on 2018-02-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.15 #
5
+ # Ruby Bindings Version 2.1.16 #
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-11-20. #
3
+ # This file was automatically generated on 2018-02-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.15 #
5
+ # Ruby Bindings Version 2.1.16 #
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-11-20. #
3
+ # This file was automatically generated on 2018-02-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.15 #
5
+ # Ruby Bindings Version 2.1.16 #
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-11-20. #
3
+ # This file was automatically generated on 2018-02-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.15 #
5
+ # Ruby Bindings Version 2.1.16 #
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-11-20. #
3
+ # This file was automatically generated on 2018-02-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.15 #
5
+ # Ruby Bindings Version 2.1.16 #
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,319 @@
1
+ # -*- ruby encoding: utf-8 -*-
2
+ #############################################################
3
+ # This file was automatically generated on 2018-02-28. #
4
+ # #
5
+ # Ruby Bindings Version 2.1.16 #
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 DC voltage between 0V and 42V
14
+ class BrickletAnalogInV3 < Device
15
+ DEVICE_IDENTIFIER = 295 # :nodoc:
16
+ DEVICE_DISPLAY_NAME = 'Analog In Bricklet 3.0' # :nodoc:
17
+
18
+ # This callback is triggered periodically according to the configuration set by
19
+ # BrickletAnalogInV3#set_voltage_callback_configuration.
20
+ #
21
+ # The `parameter` is the same as BrickletAnalogInV3#get_voltage.
22
+ CALLBACK_VOLTAGE = 4
23
+
24
+ FUNCTION_GET_VOLTAGE = 1 # :nodoc:
25
+ FUNCTION_SET_VOLTAGE_CALLBACK_CONFIGURATION = 2 # :nodoc:
26
+ FUNCTION_GET_VOLTAGE_CALLBACK_CONFIGURATION = 3 # :nodoc:
27
+ FUNCTION_SET_OVERSAMPLING = 5 # :nodoc:
28
+ FUNCTION_GET_OVERSAMPLING = 6 # :nodoc:
29
+ FUNCTION_SET_CALIBRATION = 7 # :nodoc:
30
+ FUNCTION_GET_CALIBRATION = 8 # :nodoc:
31
+ FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
32
+ FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
33
+ FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
34
+ FUNCTION_SET_WRITE_FIRMWARE_POINTER = 237 # :nodoc:
35
+ FUNCTION_WRITE_FIRMWARE = 238 # :nodoc:
36
+ FUNCTION_SET_STATUS_LED_CONFIG = 239 # :nodoc:
37
+ FUNCTION_GET_STATUS_LED_CONFIG = 240 # :nodoc:
38
+ FUNCTION_GET_CHIP_TEMPERATURE = 242 # :nodoc:
39
+ FUNCTION_RESET = 243 # :nodoc:
40
+ FUNCTION_WRITE_UID = 248 # :nodoc:
41
+ FUNCTION_READ_UID = 249 # :nodoc:
42
+ FUNCTION_GET_IDENTITY = 255 # :nodoc:
43
+
44
+ THRESHOLD_OPTION_OFF = 'x' # :nodoc:
45
+ THRESHOLD_OPTION_OUTSIDE = 'o' # :nodoc:
46
+ THRESHOLD_OPTION_INSIDE = 'i' # :nodoc:
47
+ THRESHOLD_OPTION_SMALLER = '<' # :nodoc:
48
+ THRESHOLD_OPTION_GREATER = '>' # :nodoc:
49
+ OVERSAMPLING_32 = 0 # :nodoc:
50
+ OVERSAMPLING_64 = 1 # :nodoc:
51
+ OVERSAMPLING_128 = 2 # :nodoc:
52
+ OVERSAMPLING_256 = 3 # :nodoc:
53
+ OVERSAMPLING_512 = 4 # :nodoc:
54
+ OVERSAMPLING_1024 = 5 # :nodoc:
55
+ OVERSAMPLING_2048 = 6 # :nodoc:
56
+ OVERSAMPLING_4096 = 7 # :nodoc:
57
+ OVERSAMPLING_8192 = 8 # :nodoc:
58
+ OVERSAMPLING_16384 = 9 # :nodoc:
59
+ BOOTLOADER_MODE_BOOTLOADER = 0 # :nodoc:
60
+ BOOTLOADER_MODE_FIRMWARE = 1 # :nodoc:
61
+ BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT = 2 # :nodoc:
62
+ BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT = 3 # :nodoc:
63
+ BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT = 4 # :nodoc:
64
+ BOOTLOADER_STATUS_OK = 0 # :nodoc:
65
+ BOOTLOADER_STATUS_INVALID_MODE = 1 # :nodoc:
66
+ BOOTLOADER_STATUS_NO_CHANGE = 2 # :nodoc:
67
+ BOOTLOADER_STATUS_ENTRY_FUNCTION_NOT_PRESENT = 3 # :nodoc:
68
+ BOOTLOADER_STATUS_DEVICE_IDENTIFIER_INCORRECT = 4 # :nodoc:
69
+ BOOTLOADER_STATUS_CRC_MISMATCH = 5 # :nodoc:
70
+ STATUS_LED_CONFIG_OFF = 0 # :nodoc:
71
+ STATUS_LED_CONFIG_ON = 1 # :nodoc:
72
+ STATUS_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
73
+ STATUS_LED_CONFIG_SHOW_STATUS = 3 # :nodoc:
74
+
75
+ # Creates an object with the unique device ID <tt>uid</tt> and adds it to
76
+ # the IP Connection <tt>ipcon</tt>.
77
+ def initialize(uid, ipcon)
78
+ super uid, ipcon
79
+
80
+ @api_version = [2, 0, 0]
81
+
82
+ @response_expected[FUNCTION_GET_VOLTAGE] = RESPONSE_EXPECTED_ALWAYS_TRUE
83
+ @response_expected[FUNCTION_SET_VOLTAGE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
84
+ @response_expected[FUNCTION_GET_VOLTAGE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
85
+ @response_expected[FUNCTION_SET_OVERSAMPLING] = RESPONSE_EXPECTED_FALSE
86
+ @response_expected[FUNCTION_GET_OVERSAMPLING] = RESPONSE_EXPECTED_ALWAYS_TRUE
87
+ @response_expected[FUNCTION_SET_CALIBRATION] = RESPONSE_EXPECTED_FALSE
88
+ @response_expected[FUNCTION_GET_CALIBRATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
89
+ @response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
90
+ @response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
91
+ @response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
92
+ @response_expected[FUNCTION_SET_WRITE_FIRMWARE_POINTER] = RESPONSE_EXPECTED_FALSE
93
+ @response_expected[FUNCTION_WRITE_FIRMWARE] = RESPONSE_EXPECTED_ALWAYS_TRUE
94
+ @response_expected[FUNCTION_SET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
95
+ @response_expected[FUNCTION_GET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
96
+ @response_expected[FUNCTION_GET_CHIP_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
97
+ @response_expected[FUNCTION_RESET] = RESPONSE_EXPECTED_FALSE
98
+ @response_expected[FUNCTION_WRITE_UID] = RESPONSE_EXPECTED_FALSE
99
+ @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
100
+ @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
101
+
102
+ @callback_formats[CALLBACK_VOLTAGE] = 'S'
103
+
104
+ end
105
+
106
+ # Returns the measured voltage. The value is in mV and
107
+ # between 0V and 42V. The resolution is approximately 10mV to 1mV
108
+ # depending on the oversampling configuration (BrickletAnalogInV3#set_oversampling).
109
+ #
110
+ #
111
+ # If you want to get the value periodically, it is recommended to use the
112
+ # CALLBACK_VOLTAGE callback. You can set the callback configuration
113
+ # with BrickletAnalogInV3#set_voltage_callback_configuration.
114
+ def get_voltage
115
+ send_request FUNCTION_GET_VOLTAGE, [], '', 2, 'S'
116
+ end
117
+
118
+ # The period in ms is the period with which the CALLBACK_VOLTAGE callback is triggered
119
+ # periodically. A value of 0 turns the callback off.
120
+ #
121
+ # If the `value has to change`-parameter is set to true, the callback is only
122
+ # triggered after the value has changed. If the value didn't change
123
+ # within the period, the callback is triggered immediately on change.
124
+ #
125
+ # If it is set to false, the callback is continuously triggered with the period,
126
+ # independent of the value.
127
+ #
128
+ # It is furthermore possible to constrain the callback with thresholds.
129
+ #
130
+ # The `option`-parameter together with min/max sets a threshold for the CALLBACK_VOLTAGE callback.
131
+ #
132
+ # The following options are possible:
133
+ #
134
+ # "Option", "Description"
135
+ #
136
+ # "'x'", "Threshold is turned off"
137
+ # "'o'", "Threshold is triggered when the value is *outside* the min and max values"
138
+ # "'i'", "Threshold is triggered when the value is *inside* the min and max values"
139
+ # "'<'", "Threshold is triggered when the value is smaller than the min value (max is ignored)"
140
+ # "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
141
+ #
142
+ #
143
+ # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
144
+ #
145
+ # The default value is (0, false, 'x', 0, 0).
146
+ def set_voltage_callback_configuration(period, value_has_to_change, option, min, max)
147
+ send_request FUNCTION_SET_VOLTAGE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k S S', 0, ''
148
+ end
149
+
150
+ # Returns the callback configuration as set by BrickletAnalogInV3#set_voltage_callback_configuration.
151
+ def get_voltage_callback_configuration
152
+ send_request FUNCTION_GET_VOLTAGE_CALLBACK_CONFIGURATION, [], '', 10, 'L ? k S S'
153
+ end
154
+
155
+ # Sets the oversampling between 32x and 16384x. The Bricklet
156
+ # takes one 12bit sample every 17.5µs. Thus an oversampling
157
+ # of 32x is equivalent to an integration time of 0.56ms and
158
+ # a oversampling of 16384x is equivalent to an integration
159
+ # time of 286ms.
160
+ #
161
+ # The oversampling uses the moving average principle. A
162
+ # new value is always calculated once per millisecond.
163
+ #
164
+ # With increased oversampling the noise decreases. With decreased
165
+ # oversampling the reaction time increases (changes in voltage will be
166
+ # measured faster).
167
+ #
168
+ # The default value is 4096x.
169
+ def set_oversampling(oversampling)
170
+ send_request FUNCTION_SET_OVERSAMPLING, [oversampling], 'C', 0, ''
171
+ end
172
+
173
+ # Returns the oversampling value as set by BrickletAnalogInV3#set_oversampling.
174
+ def get_oversampling
175
+ send_request FUNCTION_GET_OVERSAMPLING, [], '', 1, 'C'
176
+ end
177
+
178
+ # Sets a calibration for the measured voltage value.
179
+ # The formula for the calibration is as follows::
180
+ #
181
+ # Calibrated Value = (Value + Offset) * Multiplier / Divisor
182
+ #
183
+ # We recommend that you use the Brick Viewer to calibrate
184
+ # the Bricklet. The calibration will be saved internally and only
185
+ # has to be done once.
186
+ def set_calibration(offset, multiplier, divisor)
187
+ send_request FUNCTION_SET_CALIBRATION, [offset, multiplier, divisor], 's S S', 0, ''
188
+ end
189
+
190
+ # Returns the calibration as set by BrickletAnalogInV3#set_calibration.
191
+ def get_calibration
192
+ send_request FUNCTION_GET_CALIBRATION, [], '', 6, 's S S'
193
+ end
194
+
195
+ # Returns the error count for the communication between Brick and Bricklet.
196
+ #
197
+ # The errors are divided into
198
+ #
199
+ # * ack checksum errors,
200
+ # * message checksum errors,
201
+ # * frameing errors and
202
+ # * overflow errors.
203
+ #
204
+ # The errors counts are for errors that occur on the Bricklet side. All
205
+ # Bricks have a similar function that returns the errors on the Brick side.
206
+ def get_spitfp_error_count
207
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
208
+ end
209
+
210
+ # Sets the bootloader mode and returns the status after the requested
211
+ # mode change was instigated.
212
+ #
213
+ # You can change from bootloader mode to firmware mode and vice versa. A change
214
+ # from bootloader mode to firmware mode will only take place if the entry function,
215
+ # device identifier und crc are present and correct.
216
+ #
217
+ # This function is used by Brick Viewer during flashing. It should not be
218
+ # necessary to call it in a normal user program.
219
+ def set_bootloader_mode(mode)
220
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
221
+ end
222
+
223
+ # Returns the current bootloader mode, see BrickletAnalogInV3#set_bootloader_mode.
224
+ def get_bootloader_mode
225
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
226
+ end
227
+
228
+ # Sets the firmware pointer for BrickletAnalogInV3#write_firmware. The pointer has
229
+ # to be increased by chunks of size 64. The data is written to flash
230
+ # every 4 chunks (which equals to one page of size 256).
231
+ #
232
+ # This function is used by Brick Viewer during flashing. It should not be
233
+ # necessary to call it in a normal user program.
234
+ def set_write_firmware_pointer(pointer)
235
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
236
+ end
237
+
238
+ # Writes 64 Bytes of firmware at the position as written by
239
+ # BrickletAnalogInV3#set_write_firmware_pointer before. The firmware is written
240
+ # to flash every 4 chunks.
241
+ #
242
+ # You can only write firmware in bootloader mode.
243
+ #
244
+ # This function is used by Brick Viewer during flashing. It should not be
245
+ # necessary to call it in a normal user program.
246
+ def write_firmware(data)
247
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
248
+ end
249
+
250
+ # Sets the status LED configuration. By default the LED shows
251
+ # communication traffic between Brick and Bricklet, it flickers once
252
+ # for every 10 received data packets.
253
+ #
254
+ # You can also turn the LED permanently on/off or show a heartbeat.
255
+ #
256
+ # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
257
+ def set_status_led_config(config)
258
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
259
+ end
260
+
261
+ # Returns the configuration as set by BrickletAnalogInV3#set_status_led_config
262
+ def get_status_led_config
263
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
264
+ end
265
+
266
+ # Returns the temperature in °C as measured inside the microcontroller. The
267
+ # value returned is not the ambient temperature!
268
+ #
269
+ # The temperature is only proportional to the real temperature and it has bad
270
+ # accuracy. Practically it is only useful as an indicator for
271
+ # temperature changes.
272
+ def get_chip_temperature
273
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
274
+ end
275
+
276
+ # Calling this function will reset the Bricklet. All configurations
277
+ # will be lost.
278
+ #
279
+ # After a reset you have to create new device objects,
280
+ # calling functions on the existing ones will result in
281
+ # undefined behavior!
282
+ def reset
283
+ send_request FUNCTION_RESET, [], '', 0, ''
284
+ end
285
+
286
+ # Writes a new UID into flash. If you want to set a new UID
287
+ # you have to decode the Base58 encoded UID string into an
288
+ # integer first.
289
+ #
290
+ # We recommend that you use Brick Viewer to change the UID.
291
+ def write_uid(uid)
292
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
293
+ end
294
+
295
+ # Returns the current UID as an integer. Encode as
296
+ # Base58 to get the usual string version.
297
+ def read_uid
298
+ send_request FUNCTION_READ_UID, [], '', 4, 'L'
299
+ end
300
+
301
+ # Returns the UID, the UID where the Bricklet is connected to,
302
+ # the position, the hardware and firmware version as well as the
303
+ # device identifier.
304
+ #
305
+ # The position can be 'a', 'b', 'c' or 'd'.
306
+ #
307
+ # The device identifier numbers can be found :ref:`here <device_identifier>`.
308
+ # |device_identifier_constant|
309
+ def get_identity
310
+ send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
311
+ end
312
+
313
+ # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
314
+ def register_callback(id, &block)
315
+ callback = block
316
+ @registered_callbacks[id] = callback
317
+ end
318
+ end
319
+ end