tinkerforge 2.1.16 → 2.1.17

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 (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 #
@@ -0,0 +1,353 @@
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
+ # Battery-backed real-time clock
14
+ class BrickletRealTimeClockV2 < Device
15
+ DEVICE_IDENTIFIER = 2106 # :nodoc:
16
+ DEVICE_DISPLAY_NAME = 'Real-Time Clock Bricklet 2.0' # :nodoc:
17
+
18
+ # This callback is triggered periodically with the period that is set by
19
+ # BrickletRealTimeClockV2#set_date_time_callback_configuration. The parameters are the
20
+ # same as for BrickletRealTimeClockV2#get_date_time.
21
+ CALLBACK_DATE_TIME = 10
22
+
23
+ # This callback is triggered every time the current date and time matches the
24
+ # configured alarm (see BrickletRealTimeClockV2#set_alarm). The parameters are the same
25
+ # as for BrickletRealTimeClockV2#get_date_time.
26
+ CALLBACK_ALARM = 11
27
+
28
+ FUNCTION_SET_DATE_TIME = 1 # :nodoc:
29
+ FUNCTION_GET_DATE_TIME = 2 # :nodoc:
30
+ FUNCTION_GET_TIMESTAMP = 3 # :nodoc:
31
+ FUNCTION_SET_OFFSET = 4 # :nodoc:
32
+ FUNCTION_GET_OFFSET = 5 # :nodoc:
33
+ FUNCTION_SET_DATE_TIME_CALLBACK_CONFIGURATION = 6 # :nodoc:
34
+ FUNCTION_GET_DATE_TIME_CALLBACK_CONFIGURATION = 7 # :nodoc:
35
+ FUNCTION_SET_ALARM = 8 # :nodoc:
36
+ FUNCTION_GET_ALARM = 9 # :nodoc:
37
+ FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
38
+ FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
39
+ FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
40
+ FUNCTION_SET_WRITE_FIRMWARE_POINTER = 237 # :nodoc:
41
+ FUNCTION_WRITE_FIRMWARE = 238 # :nodoc:
42
+ FUNCTION_SET_STATUS_LED_CONFIG = 239 # :nodoc:
43
+ FUNCTION_GET_STATUS_LED_CONFIG = 240 # :nodoc:
44
+ FUNCTION_GET_CHIP_TEMPERATURE = 242 # :nodoc:
45
+ FUNCTION_RESET = 243 # :nodoc:
46
+ FUNCTION_WRITE_UID = 248 # :nodoc:
47
+ FUNCTION_READ_UID = 249 # :nodoc:
48
+ FUNCTION_GET_IDENTITY = 255 # :nodoc:
49
+
50
+ WEEKDAY_MONDAY = 1 # :nodoc:
51
+ WEEKDAY_TUESDAY = 2 # :nodoc:
52
+ WEEKDAY_WEDNESDAY = 3 # :nodoc:
53
+ WEEKDAY_THURSDAY = 4 # :nodoc:
54
+ WEEKDAY_FRIDAY = 5 # :nodoc:
55
+ WEEKDAY_SATURDAY = 6 # :nodoc:
56
+ WEEKDAY_SUNDAY = 7 # :nodoc:
57
+ ALARM_MATCH_DISABLED = -1 # :nodoc:
58
+ ALARM_INTERVAL_DISABLED = -1 # :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_SET_DATE_TIME] = RESPONSE_EXPECTED_FALSE
83
+ @response_expected[FUNCTION_GET_DATE_TIME] = RESPONSE_EXPECTED_ALWAYS_TRUE
84
+ @response_expected[FUNCTION_GET_TIMESTAMP] = RESPONSE_EXPECTED_ALWAYS_TRUE
85
+ @response_expected[FUNCTION_SET_OFFSET] = RESPONSE_EXPECTED_FALSE
86
+ @response_expected[FUNCTION_GET_OFFSET] = RESPONSE_EXPECTED_ALWAYS_TRUE
87
+ @response_expected[FUNCTION_SET_DATE_TIME_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
88
+ @response_expected[FUNCTION_GET_DATE_TIME_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
89
+ @response_expected[FUNCTION_SET_ALARM] = RESPONSE_EXPECTED_TRUE
90
+ @response_expected[FUNCTION_GET_ALARM] = RESPONSE_EXPECTED_ALWAYS_TRUE
91
+ @response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
92
+ @response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
93
+ @response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
94
+ @response_expected[FUNCTION_SET_WRITE_FIRMWARE_POINTER] = RESPONSE_EXPECTED_FALSE
95
+ @response_expected[FUNCTION_WRITE_FIRMWARE] = RESPONSE_EXPECTED_ALWAYS_TRUE
96
+ @response_expected[FUNCTION_SET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
97
+ @response_expected[FUNCTION_GET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
98
+ @response_expected[FUNCTION_GET_CHIP_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
99
+ @response_expected[FUNCTION_RESET] = RESPONSE_EXPECTED_FALSE
100
+ @response_expected[FUNCTION_WRITE_UID] = RESPONSE_EXPECTED_FALSE
101
+ @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
102
+ @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
103
+
104
+ @callback_formats[CALLBACK_DATE_TIME] = 'S C C C C C C C q'
105
+ @callback_formats[CALLBACK_ALARM] = 'S C C C C C C C q'
106
+
107
+ end
108
+
109
+ # Sets the current date (including weekday) and the current time with hundredths
110
+ # of a second resolution.
111
+ #
112
+ # Possible value ranges:
113
+ #
114
+ # * Year: 2000 to 2099
115
+ # * Month: 1 to 12 (January to December)
116
+ # * Day: 1 to 31
117
+ # * Hour: 0 to 23
118
+ # * Minute: 0 to 59
119
+ # * Second: 0 to 59
120
+ # * Centisecond: 0 to 99
121
+ # * Weekday: 1 to 7 (Monday to Sunday)
122
+ #
123
+ # If the backup battery is installed then the real-time clock keeps date and
124
+ # time even if the Bricklet is not powered by a Brick.
125
+ #
126
+ # The real-time clock handles leap year and inserts the 29th of February
127
+ # accordingly. But leap seconds, time zones and daylight saving time are not
128
+ # handled.
129
+ def set_date_time(year, month, day, hour, minute, second, centisecond, weekday)
130
+ send_request FUNCTION_SET_DATE_TIME, [year, month, day, hour, minute, second, centisecond, weekday], 'S C C C C C C C', 0, ''
131
+ end
132
+
133
+ # Returns the current date (including weekday) and the current time of the
134
+ # real-time clock with hundredths of a second resolution.
135
+ #
136
+ # The timestamp represents the current date and the the current time of the
137
+ # real-time clock converted to milliseconds.
138
+ def get_date_time
139
+ send_request FUNCTION_GET_DATE_TIME, [], '', 17, 'S C C C C C C C q'
140
+ end
141
+
142
+ # Returns the current date and the time of the real-time clock converted to
143
+ # milliseconds. The timestamp has an effective resolution of hundredths of a
144
+ # second.
145
+ def get_timestamp
146
+ send_request FUNCTION_GET_TIMESTAMP, [], '', 8, 'q'
147
+ end
148
+
149
+ # Sets the offset the real-time clock should compensate for in 2.17 ppm steps
150
+ # between -277.76 ppm (-128) and +275.59 ppm (127).
151
+ #
152
+ # The real-time clock time can deviate from the actual time due to the frequency
153
+ # deviation of its 32.768 kHz crystal. Even without compensation (factory
154
+ # default) the resulting time deviation should be at most ±20 ppm (±52.6
155
+ # seconds per month).
156
+ #
157
+ # This deviation can be calculated by comparing the same duration measured by the
158
+ # real-time clock (``rtc_duration``) an accurate reference clock
159
+ # (``ref_duration``).
160
+ #
161
+ # For best results the configured offset should be set to 0 ppm first and then a
162
+ # duration of at least 6 hours should be measured.
163
+ #
164
+ # The new offset (``new_offset``) can be calculated from the currently configured
165
+ # offset (``current_offset``) and the measured durations as follow::
166
+ #
167
+ # new_offset = current_offset - round(1000000 * (rtc_duration - ref_duration) / rtc_duration / 2.17)
168
+ #
169
+ # If you want to calculate the offset, then we recommend using the calibration
170
+ # dialog in Brick Viewer, instead of doing it manually.
171
+ #
172
+ # The offset is saved in the EEPROM of the Bricklet and only needs to be
173
+ # configured once.
174
+ def set_offset(offset)
175
+ send_request FUNCTION_SET_OFFSET, [offset], 'c', 0, ''
176
+ end
177
+
178
+ # Returns the offset as set by BrickletRealTimeClockV2#set_offset.
179
+ def get_offset
180
+ send_request FUNCTION_GET_OFFSET, [], '', 1, 'c'
181
+ end
182
+
183
+ # Sets the period in ms with which the CALLBACK_DATE_TIME callback is triggered
184
+ # periodically. A value of 0 turns the callback off.
185
+ #
186
+ # The default value is 0.
187
+ def set_date_time_callback_configuration(period)
188
+ send_request FUNCTION_SET_DATE_TIME_CALLBACK_CONFIGURATION, [period], 'L', 0, ''
189
+ end
190
+
191
+ # Returns the period as set by BrickletRealTimeClockV2#set_date_time_callback_configuration.
192
+ def get_date_time_callback_configuration
193
+ send_request FUNCTION_GET_DATE_TIME_CALLBACK_CONFIGURATION, [], '', 4, 'L'
194
+ end
195
+
196
+ # Configures a repeatable alarm. The CALLBACK_ALARM callback is triggered if the
197
+ # current date and time matches the configured alarm.
198
+ #
199
+ # Setting a parameter to -1 means that it should be disabled and doesn't take part
200
+ # in the match. Setting all parameters to -1 disables the alarm completely.
201
+ #
202
+ # For example, to make the alarm trigger every day at 7:30 AM it can be
203
+ # configured as (-1, -1, 7, 30, -1, -1, -1). The hour is set to match 7 and the
204
+ # minute is set to match 30. The alarm is triggered if all enabled parameters
205
+ # match.
206
+ #
207
+ # The interval has a special role. It allows to make the alarm reconfigure itself.
208
+ # This is useful if you need a repeated alarm that cannot be expressed by matching
209
+ # the current date and time. For example, to make the alarm trigger every 23
210
+ # seconds it can be configured as (-1, -1, -1, -1, -1, -1, 23). Internally the
211
+ # Bricklet will take the current date and time, add 23 seconds to it and set the
212
+ # result as its alarm. The first alarm will be triggered 23 seconds after the
213
+ # call. Because the interval is not -1, the Bricklet will do the same again
214
+ # internally, take the current date and time, add 23 seconds to it and set that
215
+ # as its alarm. This results in a repeated alarm that triggers every 23 seconds.
216
+ #
217
+ # The interval can also be used in combination with the other parameters. For
218
+ # example, configuring the alarm as (-1, -1, 7, 30, -1, -1, 300) results in an
219
+ # alarm that triggers every day at 7:30 AM and is then repeated every 5 minutes.
220
+ def set_alarm(month, day, hour, minute, second, weekday, interval)
221
+ send_request FUNCTION_SET_ALARM, [month, day, hour, minute, second, weekday, interval], 'c c c c c c l', 0, ''
222
+ end
223
+
224
+ # Returns the alarm configuration as set by BrickletRealTimeClockV2#set_alarm.
225
+ def get_alarm
226
+ send_request FUNCTION_GET_ALARM, [], '', 10, 'c c c c c c l'
227
+ end
228
+
229
+ # Returns the error count for the communication between Brick and Bricklet.
230
+ #
231
+ # The errors are divided into
232
+ #
233
+ # * ack checksum errors,
234
+ # * message checksum errors,
235
+ # * frameing errors and
236
+ # * overflow errors.
237
+ #
238
+ # The errors counts are for errors that occur on the Bricklet side. All
239
+ # Bricks have a similar function that returns the errors on the Brick side.
240
+ def get_spitfp_error_count
241
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
242
+ end
243
+
244
+ # Sets the bootloader mode and returns the status after the requested
245
+ # mode change was instigated.
246
+ #
247
+ # You can change from bootloader mode to firmware mode and vice versa. A change
248
+ # from bootloader mode to firmware mode will only take place if the entry function,
249
+ # device identifier und crc are present and correct.
250
+ #
251
+ # This function is used by Brick Viewer during flashing. It should not be
252
+ # necessary to call it in a normal user program.
253
+ def set_bootloader_mode(mode)
254
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
255
+ end
256
+
257
+ # Returns the current bootloader mode, see BrickletRealTimeClockV2#set_bootloader_mode.
258
+ def get_bootloader_mode
259
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
260
+ end
261
+
262
+ # Sets the firmware pointer for BrickletRealTimeClockV2#write_firmware. The pointer has
263
+ # to be increased by chunks of size 64. The data is written to flash
264
+ # every 4 chunks (which equals to one page of size 256).
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_write_firmware_pointer(pointer)
269
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
270
+ end
271
+
272
+ # Writes 64 Bytes of firmware at the position as written by
273
+ # BrickletRealTimeClockV2#set_write_firmware_pointer before. The firmware is written
274
+ # to flash every 4 chunks.
275
+ #
276
+ # You can only write firmware in bootloader mode.
277
+ #
278
+ # This function is used by Brick Viewer during flashing. It should not be
279
+ # necessary to call it in a normal user program.
280
+ def write_firmware(data)
281
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
282
+ end
283
+
284
+ # Sets the status LED configuration. By default the LED shows
285
+ # communication traffic between Brick and Bricklet, it flickers once
286
+ # for every 10 received data packets.
287
+ #
288
+ # You can also turn the LED permanently on/off or show a heartbeat.
289
+ #
290
+ # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
291
+ def set_status_led_config(config)
292
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
293
+ end
294
+
295
+ # Returns the configuration as set by BrickletRealTimeClockV2#set_status_led_config
296
+ def get_status_led_config
297
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
298
+ end
299
+
300
+ # Returns the temperature in °C as measured inside the microcontroller. The
301
+ # value returned is not the ambient temperature!
302
+ #
303
+ # The temperature is only proportional to the real temperature and it has bad
304
+ # accuracy. Practically it is only useful as an indicator for
305
+ # temperature changes.
306
+ def get_chip_temperature
307
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
308
+ end
309
+
310
+ # Calling this function will reset the Bricklet. All configurations
311
+ # will be lost.
312
+ #
313
+ # After a reset you have to create new device objects,
314
+ # calling functions on the existing ones will result in
315
+ # undefined behavior!
316
+ def reset
317
+ send_request FUNCTION_RESET, [], '', 0, ''
318
+ end
319
+
320
+ # Writes a new UID into flash. If you want to set a new UID
321
+ # you have to decode the Base58 encoded UID string into an
322
+ # integer first.
323
+ #
324
+ # We recommend that you use Brick Viewer to change the UID.
325
+ def write_uid(uid)
326
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
327
+ end
328
+
329
+ # Returns the current UID as an integer. Encode as
330
+ # Base58 to get the usual string version.
331
+ def read_uid
332
+ send_request FUNCTION_READ_UID, [], '', 4, 'L'
333
+ end
334
+
335
+ # Returns the UID, the UID where the Bricklet is connected to,
336
+ # the position, the hardware and firmware version as well as the
337
+ # device identifier.
338
+ #
339
+ # The position can be 'a', 'b', 'c' or 'd'.
340
+ #
341
+ # The device identifier numbers can be found :ref:`here <device_identifier>`.
342
+ # |device_identifier_constant|
343
+ def get_identity
344
+ send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
345
+ end
346
+
347
+ # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
348
+ def register_callback(id, &block)
349
+ callback = block
350
+ @registered_callbacks[id] = callback
351
+ end
352
+ end
353
+ end
@@ -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 #
@@ -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 #
@@ -16,9 +16,9 @@ module Tinkerforge
16
16
  DEVICE_DISPLAY_NAME = 'Rotary Encoder Bricklet 2.0' # :nodoc:
17
17
 
18
18
  # This callback is triggered periodically according to the configuration set by
19
- # BrickletRotaryEncoderV2#set_count_callback_configuration.
19
+ # BrickletRotaryEncoderV2#set_count_callback_configuration.
20
20
  #
21
- # The `parameter` is the same as BrickletRotaryEncoderV2#get_count.
21
+ # The parameter is the same as BrickletRotaryEncoderV2#get_count.
22
22
  CALLBACK_COUNT = 4
23
23
 
24
24
  # This callback is triggered when the button is pressed.
@@ -70,7 +70,7 @@ module Tinkerforge
70
70
  def initialize(uid, ipcon)
71
71
  super uid, ipcon
72
72
 
73
- @api_version = [2, 0, 0]
73
+ @api_version = [2, 0, 1]
74
74
 
75
75
  @response_expected[FUNCTION_GET_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
76
76
  @response_expected[FUNCTION_SET_COUNT_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
@@ -132,21 +132,20 @@ module Tinkerforge
132
132
  #
133
133
  # "'x'", "Threshold is turned off"
134
134
  # "'o'", "Threshold is triggered when the value is *outside* the min and max values"
135
- # "'i'", "Threshold is triggered when the value is *inside* the min and max values"
135
+ # "'i'", "Threshold is triggered when the value is *inside* or equal to the min and max values"
136
136
  # "'<'", "Threshold is triggered when the value is smaller than the min value (max is ignored)"
137
137
  # "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
138
138
  #
139
- #
140
139
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
141
140
  #
142
141
  # The default value is (0, false, 'x', 0, 0).
143
142
  def set_count_callback_configuration(period, value_has_to_change, option, min, max)
144
- send_request FUNCTION_SET_COUNT_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k S S', 0, ''
143
+ send_request FUNCTION_SET_COUNT_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 0, ''
145
144
  end
146
145
 
147
146
  # Returns the callback configuration as set by BrickletRotaryEncoderV2#set_count_callback_configuration.
148
147
  def get_count_callback_configuration
149
- send_request FUNCTION_GET_COUNT_CALLBACK_CONFIGURATION, [], '', 10, 'L ? k S S'
148
+ send_request FUNCTION_GET_COUNT_CALLBACK_CONFIGURATION, [], '', 14, 'L ? k l l'
150
149
  end
151
150
 
152
151
  # Returns *true* if the button is pressed and *false* otherwise.