tinkerforge 2.1.17 → 2.1.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tinkerforge/brick_dc.rb +6 -6
- data/lib/tinkerforge/brick_imu.rb +6 -6
- data/lib/tinkerforge/brick_imu_v2.rb +13 -6
- data/lib/tinkerforge/brick_master.rb +6 -6
- data/lib/tinkerforge/brick_red.rb +2 -2
- data/lib/tinkerforge/brick_servo.rb +9 -7
- data/lib/tinkerforge/brick_silent_stepper.rb +13 -13
- data/lib/tinkerforge/brick_stepper.rb +6 -6
- data/lib/tinkerforge/bricklet_accelerometer.rb +2 -2
- data/lib/tinkerforge/bricklet_air_quality.rb +514 -0
- data/lib/tinkerforge/bricklet_ambient_light.rb +2 -2
- data/lib/tinkerforge/bricklet_ambient_light_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_analog_in.rb +2 -2
- data/lib/tinkerforge/bricklet_analog_in_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_analog_in_v3.rb +5 -5
- data/lib/tinkerforge/bricklet_analog_out.rb +2 -2
- data/lib/tinkerforge/bricklet_analog_out_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_analog_out_v3.rb +210 -0
- data/lib/tinkerforge/bricklet_barometer.rb +2 -2
- data/lib/tinkerforge/bricklet_barometer_v2.rb +497 -0
- data/lib/tinkerforge/bricklet_can.rb +2 -2
- data/lib/tinkerforge/bricklet_can_v2.rb +5 -5
- data/lib/tinkerforge/bricklet_co2.rb +2 -2
- data/lib/tinkerforge/bricklet_color.rb +2 -2
- data/lib/tinkerforge/bricklet_current12.rb +2 -2
- data/lib/tinkerforge/bricklet_current25.rb +2 -2
- data/lib/tinkerforge/bricklet_distance_ir.rb +2 -2
- data/lib/tinkerforge/bricklet_distance_ir_v2.rb +398 -0
- data/lib/tinkerforge/bricklet_distance_us.rb +2 -2
- data/lib/tinkerforge/bricklet_dmx.rb +7 -5
- data/lib/tinkerforge/bricklet_dual_button.rb +2 -2
- data/lib/tinkerforge/bricklet_dual_button_v2.rb +283 -0
- data/lib/tinkerforge/bricklet_dual_relay.rb +2 -2
- data/lib/tinkerforge/bricklet_dust_detector.rb +2 -2
- data/lib/tinkerforge/bricklet_gps.rb +2 -2
- data/lib/tinkerforge/bricklet_gps_v2.rb +6 -6
- data/lib/tinkerforge/bricklet_hall_effect.rb +2 -2
- data/lib/tinkerforge/bricklet_humidity.rb +2 -2
- data/lib/tinkerforge/bricklet_humidity_v2.rb +5 -5
- data/lib/tinkerforge/bricklet_industrial_analog_out.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +336 -0
- data/lib/tinkerforge/bricklet_industrial_counter.rb +12 -12
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +7 -7
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +302 -0
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +382 -0
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +374 -0
- data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +5 -5
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +11 -11
- data/lib/tinkerforge/bricklet_io16.rb +2 -2
- data/lib/tinkerforge/bricklet_io16_v2.rb +418 -0
- data/lib/tinkerforge/bricklet_io4.rb +2 -2
- data/lib/tinkerforge/bricklet_io4_v2.rb +6 -6
- data/lib/tinkerforge/bricklet_isolator.rb +282 -0
- data/lib/tinkerforge/bricklet_joystick.rb +2 -2
- data/lib/tinkerforge/bricklet_laser_range_finder.rb +2 -2
- data/lib/tinkerforge/bricklet_lcd_128x64.rb +486 -0
- data/lib/tinkerforge/bricklet_lcd_16x2.rb +2 -2
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +2 -2
- data/lib/tinkerforge/bricklet_led_strip.rb +2 -2
- data/lib/tinkerforge/bricklet_led_strip_v2.rb +8 -8
- data/lib/tinkerforge/bricklet_line.rb +2 -2
- data/lib/tinkerforge/bricklet_linear_poti.rb +2 -2
- data/lib/tinkerforge/bricklet_load_cell.rb +2 -2
- data/lib/tinkerforge/bricklet_load_cell_v2.rb +5 -5
- data/lib/tinkerforge/bricklet_moisture.rb +2 -2
- data/lib/tinkerforge/bricklet_motion_detector.rb +2 -2
- data/lib/tinkerforge/bricklet_motion_detector_v2.rb +6 -6
- data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +5 -5
- data/lib/tinkerforge/bricklet_multi_touch.rb +2 -2
- data/lib/tinkerforge/bricklet_nfc.rb +6 -6
- data/lib/tinkerforge/bricklet_nfc_rfid.rb +2 -2
- data/lib/tinkerforge/bricklet_oled_128x64.rb +2 -2
- data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +387 -0
- data/lib/tinkerforge/bricklet_oled_64x48.rb +2 -2
- data/lib/tinkerforge/bricklet_one_wire.rb +305 -0
- data/lib/tinkerforge/bricklet_outdoor_weather.rb +5 -5
- data/lib/tinkerforge/bricklet_particulate_matter.rb +5 -5
- data/lib/tinkerforge/bricklet_piezo_buzzer.rb +2 -2
- data/lib/tinkerforge/bricklet_piezo_speaker.rb +2 -2
- data/lib/tinkerforge/bricklet_ptc.rb +2 -2
- data/lib/tinkerforge/bricklet_ptc_v2.rb +5 -5
- data/lib/tinkerforge/bricklet_real_time_clock.rb +2 -2
- data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +5 -5
- data/lib/tinkerforge/bricklet_remote_switch.rb +2 -2
- data/lib/tinkerforge/bricklet_remote_switch_v2.rb +5 -5
- data/lib/tinkerforge/bricklet_rgb_led.rb +2 -2
- data/lib/tinkerforge/bricklet_rgb_led_button.rb +5 -5
- data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +5 -5
- data/lib/tinkerforge/bricklet_rotary_encoder.rb +2 -2
- data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +5 -5
- data/lib/tinkerforge/bricklet_rotary_poti.rb +2 -2
- data/lib/tinkerforge/bricklet_rs232.rb +2 -2
- data/lib/tinkerforge/bricklet_rs232_v2.rb +5 -5
- data/lib/tinkerforge/bricklet_rs485.rb +5 -5
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +2 -2
- data/lib/tinkerforge/bricklet_solid_state_relay.rb +2 -2
- data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +5 -5
- data/lib/tinkerforge/bricklet_sound_intensity.rb +2 -2
- data/lib/tinkerforge/bricklet_sound_pressure_level.rb +9 -9
- data/lib/tinkerforge/bricklet_temperature.rb +2 -2
- data/lib/tinkerforge/bricklet_temperature_ir.rb +2 -2
- data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +5 -5
- data/lib/tinkerforge/bricklet_temperature_v2.rb +278 -0
- data/lib/tinkerforge/bricklet_thermal_imaging.rb +5 -5
- data/lib/tinkerforge/bricklet_thermocouple.rb +2 -2
- data/lib/tinkerforge/bricklet_thermocouple_v2.rb +5 -5
- data/lib/tinkerforge/bricklet_tilt.rb +2 -2
- data/lib/tinkerforge/bricklet_uv_light.rb +6 -5
- data/lib/tinkerforge/bricklet_uv_light_v2.rb +430 -0
- data/lib/tinkerforge/bricklet_voltage.rb +2 -2
- data/lib/tinkerforge/bricklet_voltage_current.rb +2 -2
- data/lib/tinkerforge/bricklet_voltage_current_v2.rb +5 -5
- data/lib/tinkerforge/version.rb +1 -1
- metadata +18 -2
@@ -0,0 +1,305 @@
|
|
1
|
+
# -*- ruby encoding: utf-8 -*-
|
2
|
+
#############################################################
|
3
|
+
# This file was automatically generated on 2018-09-28. #
|
4
|
+
# #
|
5
|
+
# Ruby Bindings Version 2.1.18 #
|
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
|
+
# Communicates with up 64 1-Wire devices
|
14
|
+
class BrickletOneWire < Device
|
15
|
+
DEVICE_IDENTIFIER = 2123 # :nodoc:
|
16
|
+
DEVICE_DISPLAY_NAME = 'One Wire Bricklet' # :nodoc:
|
17
|
+
|
18
|
+
FUNCTION_SEARCH_BUS_LOW_LEVEL = 1 # :nodoc:
|
19
|
+
FUNCTION_RESET_BUS = 2 # :nodoc:
|
20
|
+
FUNCTION_WRITE = 3 # :nodoc:
|
21
|
+
FUNCTION_READ = 4 # :nodoc:
|
22
|
+
FUNCTION_WRITE_COMMAND = 5 # :nodoc:
|
23
|
+
FUNCTION_SET_COMMUNICATION_LED_CONFIG = 6 # :nodoc:
|
24
|
+
FUNCTION_GET_COMMUNICATION_LED_CONFIG = 7 # :nodoc:
|
25
|
+
FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
|
26
|
+
FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
|
27
|
+
FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
|
28
|
+
FUNCTION_SET_WRITE_FIRMWARE_POINTER = 237 # :nodoc:
|
29
|
+
FUNCTION_WRITE_FIRMWARE = 238 # :nodoc:
|
30
|
+
FUNCTION_SET_STATUS_LED_CONFIG = 239 # :nodoc:
|
31
|
+
FUNCTION_GET_STATUS_LED_CONFIG = 240 # :nodoc:
|
32
|
+
FUNCTION_GET_CHIP_TEMPERATURE = 242 # :nodoc:
|
33
|
+
FUNCTION_RESET = 243 # :nodoc:
|
34
|
+
FUNCTION_WRITE_UID = 248 # :nodoc:
|
35
|
+
FUNCTION_READ_UID = 249 # :nodoc:
|
36
|
+
FUNCTION_GET_IDENTITY = 255 # :nodoc:
|
37
|
+
|
38
|
+
STATUS_OK = 0 # :nodoc:
|
39
|
+
STATUS_BUSY = 1 # :nodoc:
|
40
|
+
STATUS_NO_PRESENCE = 2 # :nodoc:
|
41
|
+
STATUS_TIMEOUT = 3 # :nodoc:
|
42
|
+
STATUS_ERROR = 4 # :nodoc:
|
43
|
+
COMMUNICATION_LED_CONFIG_OFF = 0 # :nodoc:
|
44
|
+
COMMUNICATION_LED_CONFIG_ON = 1 # :nodoc:
|
45
|
+
COMMUNICATION_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
|
46
|
+
COMMUNICATION_LED_CONFIG_SHOW_COMMUNICATION = 3 # :nodoc:
|
47
|
+
BOOTLOADER_MODE_BOOTLOADER = 0 # :nodoc:
|
48
|
+
BOOTLOADER_MODE_FIRMWARE = 1 # :nodoc:
|
49
|
+
BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT = 2 # :nodoc:
|
50
|
+
BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT = 3 # :nodoc:
|
51
|
+
BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT = 4 # :nodoc:
|
52
|
+
BOOTLOADER_STATUS_OK = 0 # :nodoc:
|
53
|
+
BOOTLOADER_STATUS_INVALID_MODE = 1 # :nodoc:
|
54
|
+
BOOTLOADER_STATUS_NO_CHANGE = 2 # :nodoc:
|
55
|
+
BOOTLOADER_STATUS_ENTRY_FUNCTION_NOT_PRESENT = 3 # :nodoc:
|
56
|
+
BOOTLOADER_STATUS_DEVICE_IDENTIFIER_INCORRECT = 4 # :nodoc:
|
57
|
+
BOOTLOADER_STATUS_CRC_MISMATCH = 5 # :nodoc:
|
58
|
+
STATUS_LED_CONFIG_OFF = 0 # :nodoc:
|
59
|
+
STATUS_LED_CONFIG_ON = 1 # :nodoc:
|
60
|
+
STATUS_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
|
61
|
+
STATUS_LED_CONFIG_SHOW_STATUS = 3 # :nodoc:
|
62
|
+
|
63
|
+
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
64
|
+
# the IP Connection <tt>ipcon</tt>.
|
65
|
+
def initialize(uid, ipcon)
|
66
|
+
super uid, ipcon
|
67
|
+
|
68
|
+
@api_version = [2, 0, 0]
|
69
|
+
|
70
|
+
@response_expected[FUNCTION_SEARCH_BUS_LOW_LEVEL] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
71
|
+
@response_expected[FUNCTION_RESET_BUS] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
72
|
+
@response_expected[FUNCTION_WRITE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
73
|
+
@response_expected[FUNCTION_READ] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
74
|
+
@response_expected[FUNCTION_WRITE_COMMAND] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
75
|
+
@response_expected[FUNCTION_SET_COMMUNICATION_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
|
76
|
+
@response_expected[FUNCTION_GET_COMMUNICATION_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
77
|
+
@response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
78
|
+
@response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
79
|
+
@response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
80
|
+
@response_expected[FUNCTION_SET_WRITE_FIRMWARE_POINTER] = RESPONSE_EXPECTED_FALSE
|
81
|
+
@response_expected[FUNCTION_WRITE_FIRMWARE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
82
|
+
@response_expected[FUNCTION_SET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
|
83
|
+
@response_expected[FUNCTION_GET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
84
|
+
@response_expected[FUNCTION_GET_CHIP_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
85
|
+
@response_expected[FUNCTION_RESET] = RESPONSE_EXPECTED_FALSE
|
86
|
+
@response_expected[FUNCTION_WRITE_UID] = RESPONSE_EXPECTED_FALSE
|
87
|
+
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
88
|
+
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
89
|
+
|
90
|
+
|
91
|
+
end
|
92
|
+
|
93
|
+
# Returns a list of up to 64 identifiers of the connected 1-Wire devices.
|
94
|
+
# Each identifier is 64-bit and consists of 8-bit family code, 48-bit ID and
|
95
|
+
# 8-bit CRC.
|
96
|
+
#
|
97
|
+
# To get these identifiers the Bricklet runs the
|
98
|
+
# `SEARCH ROM algorithm <https://www.maximintegrated.com/en/app-notes/index.mvp/id/187>`__,
|
99
|
+
# as defined by Maxim.
|
100
|
+
def search_bus_low_level
|
101
|
+
send_request FUNCTION_SEARCH_BUS_LOW_LEVEL, [], '', 61, 'S S Q7 C'
|
102
|
+
end
|
103
|
+
|
104
|
+
# Resets the bus with the 1-Wire reset operation.
|
105
|
+
def reset_bus
|
106
|
+
send_request FUNCTION_RESET_BUS, [], '', 1, 'C'
|
107
|
+
end
|
108
|
+
|
109
|
+
# Writes a byte of data to the 1-Wire bus.
|
110
|
+
def write(data)
|
111
|
+
send_request FUNCTION_WRITE, [data], 'C', 1, 'C'
|
112
|
+
end
|
113
|
+
|
114
|
+
# Reads a byte of data from the 1-Wire bus.
|
115
|
+
def read
|
116
|
+
send_request FUNCTION_READ, [], '', 2, 'C C'
|
117
|
+
end
|
118
|
+
|
119
|
+
# Writes a command to the 1-Wire device with the given identifier. You can obtain
|
120
|
+
# the identifier by calling BrickletOneWire#search_bus. The MATCH ROM operation is used to
|
121
|
+
# write the command.
|
122
|
+
#
|
123
|
+
# If you only have one device connected or want to broadcast to all devices
|
124
|
+
# you can set the identifier to 0. In this case the SKIP ROM operation is used to
|
125
|
+
# write the command.
|
126
|
+
def write_command(identifier, command)
|
127
|
+
send_request FUNCTION_WRITE_COMMAND, [identifier, command], 'Q C', 1, 'C'
|
128
|
+
end
|
129
|
+
|
130
|
+
# Sets the communication LED configuration. By default the LED shows 1-wire
|
131
|
+
# communication traffic by flickering.
|
132
|
+
#
|
133
|
+
# You can also turn the LED permanently on/off or show a heartbeat.
|
134
|
+
#
|
135
|
+
# If the Bricklet is in bootloader mode, the LED is off.
|
136
|
+
def set_communication_led_config(config)
|
137
|
+
send_request FUNCTION_SET_COMMUNICATION_LED_CONFIG, [config], 'C', 0, ''
|
138
|
+
end
|
139
|
+
|
140
|
+
# Returns the configuration as set by BrickletOneWire#set_communication_led_config
|
141
|
+
def get_communication_led_config
|
142
|
+
send_request FUNCTION_GET_COMMUNICATION_LED_CONFIG, [], '', 1, 'C'
|
143
|
+
end
|
144
|
+
|
145
|
+
# Returns the error count for the communication between Brick and Bricklet.
|
146
|
+
#
|
147
|
+
# The errors are divided into
|
148
|
+
#
|
149
|
+
# * ACK checksum errors,
|
150
|
+
# * message checksum errors,
|
151
|
+
# * framing errors and
|
152
|
+
# * overflow errors.
|
153
|
+
#
|
154
|
+
# The errors counts are for errors that occur on the Bricklet side. All
|
155
|
+
# Bricks have a similar function that returns the errors on the Brick side.
|
156
|
+
def get_spitfp_error_count
|
157
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
|
158
|
+
end
|
159
|
+
|
160
|
+
# Sets the bootloader mode and returns the status after the requested
|
161
|
+
# mode change was instigated.
|
162
|
+
#
|
163
|
+
# You can change from bootloader mode to firmware mode and vice versa. A change
|
164
|
+
# from bootloader mode to firmware mode will only take place if the entry function,
|
165
|
+
# device identifier and CRC are present and correct.
|
166
|
+
#
|
167
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
168
|
+
# necessary to call it in a normal user program.
|
169
|
+
def set_bootloader_mode(mode)
|
170
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
|
171
|
+
end
|
172
|
+
|
173
|
+
# Returns the current bootloader mode, see BrickletOneWire#set_bootloader_mode.
|
174
|
+
def get_bootloader_mode
|
175
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
|
176
|
+
end
|
177
|
+
|
178
|
+
# Sets the firmware pointer for BrickletOneWire#write_firmware. The pointer has
|
179
|
+
# to be increased by chunks of size 64. The data is written to flash
|
180
|
+
# every 4 chunks (which equals to one page of size 256).
|
181
|
+
#
|
182
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
183
|
+
# necessary to call it in a normal user program.
|
184
|
+
def set_write_firmware_pointer(pointer)
|
185
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
|
186
|
+
end
|
187
|
+
|
188
|
+
# Writes 64 Bytes of firmware at the position as written by
|
189
|
+
# BrickletOneWire#set_write_firmware_pointer before. The firmware is written
|
190
|
+
# to flash every 4 chunks.
|
191
|
+
#
|
192
|
+
# You can only write firmware in bootloader mode.
|
193
|
+
#
|
194
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
195
|
+
# necessary to call it in a normal user program.
|
196
|
+
def write_firmware(data)
|
197
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
|
198
|
+
end
|
199
|
+
|
200
|
+
# Sets the status LED configuration. By default the LED shows
|
201
|
+
# communication traffic between Brick and Bricklet, it flickers once
|
202
|
+
# for every 10 received data packets.
|
203
|
+
#
|
204
|
+
# You can also turn the LED permanently on/off or show a heartbeat.
|
205
|
+
#
|
206
|
+
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
207
|
+
def set_status_led_config(config)
|
208
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
|
209
|
+
end
|
210
|
+
|
211
|
+
# Returns the configuration as set by BrickletOneWire#set_status_led_config
|
212
|
+
def get_status_led_config
|
213
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
|
214
|
+
end
|
215
|
+
|
216
|
+
# Returns the temperature in °C as measured inside the microcontroller. The
|
217
|
+
# value returned is not the ambient temperature!
|
218
|
+
#
|
219
|
+
# The temperature is only proportional to the real temperature and it has bad
|
220
|
+
# accuracy. Practically it is only useful as an indicator for
|
221
|
+
# temperature changes.
|
222
|
+
def get_chip_temperature
|
223
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
|
224
|
+
end
|
225
|
+
|
226
|
+
# Calling this function will reset the Bricklet. All configurations
|
227
|
+
# will be lost.
|
228
|
+
#
|
229
|
+
# After a reset you have to create new device objects,
|
230
|
+
# calling functions on the existing ones will result in
|
231
|
+
# undefined behavior!
|
232
|
+
def reset
|
233
|
+
send_request FUNCTION_RESET, [], '', 0, ''
|
234
|
+
end
|
235
|
+
|
236
|
+
# Writes a new UID into flash. If you want to set a new UID
|
237
|
+
# you have to decode the Base58 encoded UID string into an
|
238
|
+
# integer first.
|
239
|
+
#
|
240
|
+
# We recommend that you use Brick Viewer to change the UID.
|
241
|
+
def write_uid(uid)
|
242
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
|
243
|
+
end
|
244
|
+
|
245
|
+
# Returns the current UID as an integer. Encode as
|
246
|
+
# Base58 to get the usual string version.
|
247
|
+
def read_uid
|
248
|
+
send_request FUNCTION_READ_UID, [], '', 4, 'L'
|
249
|
+
end
|
250
|
+
|
251
|
+
# Returns the UID, the UID where the Bricklet is connected to,
|
252
|
+
# the position, the hardware and firmware version as well as the
|
253
|
+
# device identifier.
|
254
|
+
#
|
255
|
+
# The position can be 'a', 'b', 'c' or 'd'.
|
256
|
+
#
|
257
|
+
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
258
|
+
# |device_identifier_constant|
|
259
|
+
def get_identity
|
260
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
261
|
+
end
|
262
|
+
|
263
|
+
# Returns a list of up to 64 identifiers of the connected 1-Wire devices.
|
264
|
+
# Each identifier is 64-bit and consists of 8-bit family code, 48-bit ID and
|
265
|
+
# 8-bit CRC.
|
266
|
+
#
|
267
|
+
# To get these identifiers the Bricklet runs the
|
268
|
+
# `SEARCH ROM algorithm <https://www.maximintegrated.com/en/app-notes/index.mvp/id/187>`__,
|
269
|
+
# as defined by Maxim.
|
270
|
+
def search_bus
|
271
|
+
ret = nil # assigned in block
|
272
|
+
identifier_length = nil # assigned in block
|
273
|
+
identifier_data = nil # assigned in block
|
274
|
+
|
275
|
+
@stream_mutex.synchronize {
|
276
|
+
ret = search_bus_low_level
|
277
|
+
identifier_length = ret[0]
|
278
|
+
identifier_chunk_offset = ret[1]
|
279
|
+
identifier_out_of_sync = identifier_chunk_offset != 0
|
280
|
+
identifier_data = ret[2]
|
281
|
+
|
282
|
+
while not identifier_out_of_sync and identifier_data.length < identifier_length
|
283
|
+
ret = search_bus_low_level
|
284
|
+
identifier_length = ret[0]
|
285
|
+
identifier_chunk_offset = ret[1]
|
286
|
+
identifier_out_of_sync = identifier_chunk_offset != identifier_data.length
|
287
|
+
identifier_data += ret[2]
|
288
|
+
end
|
289
|
+
|
290
|
+
if identifier_out_of_sync # discard remaining stream to bring it back in-sync
|
291
|
+
while identifier_chunk_offset + 7 < identifier_length
|
292
|
+
ret = search_bus_low_level
|
293
|
+
identifier_length = ret[0]
|
294
|
+
identifier_chunk_offset = ret[1]
|
295
|
+
end
|
296
|
+
|
297
|
+
raise StreamOutOfSyncException, 'Identifier stream is out-of-sync'
|
298
|
+
end
|
299
|
+
}
|
300
|
+
|
301
|
+
[identifier_data[0, identifier_length], ret[3]]
|
302
|
+
end
|
303
|
+
|
304
|
+
end
|
305
|
+
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2018-
|
3
|
+
# This file was automatically generated on 2018-09-28. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.18 #
|
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 #
|
@@ -191,9 +191,9 @@ module Tinkerforge
|
|
191
191
|
#
|
192
192
|
# The errors are divided into
|
193
193
|
#
|
194
|
-
# *
|
194
|
+
# * ACK checksum errors,
|
195
195
|
# * message checksum errors,
|
196
|
-
# *
|
196
|
+
# * framing errors and
|
197
197
|
# * overflow errors.
|
198
198
|
#
|
199
199
|
# The errors counts are for errors that occur on the Bricklet side. All
|
@@ -207,7 +207,7 @@ module Tinkerforge
|
|
207
207
|
#
|
208
208
|
# You can change from bootloader mode to firmware mode and vice versa. A change
|
209
209
|
# from bootloader mode to firmware mode will only take place if the entry function,
|
210
|
-
# device identifier
|
210
|
+
# device identifier and CRC are present and correct.
|
211
211
|
#
|
212
212
|
# This function is used by Brick Viewer during flashing. It should not be
|
213
213
|
# necessary to call it in a normal user program.
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2018-
|
3
|
+
# This file was automatically generated on 2018-09-28. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.18 #
|
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 #
|
@@ -197,9 +197,9 @@ module Tinkerforge
|
|
197
197
|
#
|
198
198
|
# The errors are divided into
|
199
199
|
#
|
200
|
-
# *
|
200
|
+
# * ACK checksum errors,
|
201
201
|
# * message checksum errors,
|
202
|
-
# *
|
202
|
+
# * framing errors and
|
203
203
|
# * overflow errors.
|
204
204
|
#
|
205
205
|
# The errors counts are for errors that occur on the Bricklet side. All
|
@@ -213,7 +213,7 @@ module Tinkerforge
|
|
213
213
|
#
|
214
214
|
# You can change from bootloader mode to firmware mode and vice versa. A change
|
215
215
|
# from bootloader mode to firmware mode will only take place if the entry function,
|
216
|
-
# device identifier
|
216
|
+
# device identifier and CRC are present and correct.
|
217
217
|
#
|
218
218
|
# This function is used by Brick Viewer during flashing. It should not be
|
219
219
|
# necessary to call it in a normal user program.
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2018-
|
3
|
+
# This file was automatically generated on 2018-09-28. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.18 #
|
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-
|
3
|
+
# This file was automatically generated on 2018-09-28. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.18 #
|
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-
|
3
|
+
# This file was automatically generated on 2018-09-28. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.18 #
|
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-
|
3
|
+
# This file was automatically generated on 2018-09-28. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.18 #
|
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 #
|
@@ -310,9 +310,9 @@ module Tinkerforge
|
|
310
310
|
#
|
311
311
|
# The errors are divided into
|
312
312
|
#
|
313
|
-
# *
|
313
|
+
# * ACK checksum errors,
|
314
314
|
# * message checksum errors,
|
315
|
-
# *
|
315
|
+
# * framing errors and
|
316
316
|
# * overflow errors.
|
317
317
|
#
|
318
318
|
# The errors counts are for errors that occur on the Bricklet side. All
|
@@ -326,7 +326,7 @@ module Tinkerforge
|
|
326
326
|
#
|
327
327
|
# You can change from bootloader mode to firmware mode and vice versa. A change
|
328
328
|
# from bootloader mode to firmware mode will only take place if the entry function,
|
329
|
-
# device identifier
|
329
|
+
# device identifier and CRC are present and correct.
|
330
330
|
#
|
331
331
|
# This function is used by Brick Viewer during flashing. It should not be
|
332
332
|
# necessary to call it in a normal user program.
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2018-
|
3
|
+
# This file was automatically generated on 2018-09-28. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.18 #
|
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-
|
3
|
+
# This file was automatically generated on 2018-09-28. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.18 #
|
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 #
|
@@ -230,9 +230,9 @@ module Tinkerforge
|
|
230
230
|
#
|
231
231
|
# The errors are divided into
|
232
232
|
#
|
233
|
-
# *
|
233
|
+
# * ACK checksum errors,
|
234
234
|
# * message checksum errors,
|
235
|
-
# *
|
235
|
+
# * framing errors and
|
236
236
|
# * overflow errors.
|
237
237
|
#
|
238
238
|
# The errors counts are for errors that occur on the Bricklet side. All
|
@@ -246,7 +246,7 @@ module Tinkerforge
|
|
246
246
|
#
|
247
247
|
# You can change from bootloader mode to firmware mode and vice versa. A change
|
248
248
|
# from bootloader mode to firmware mode will only take place if the entry function,
|
249
|
-
# device identifier
|
249
|
+
# device identifier and CRC are present and correct.
|
250
250
|
#
|
251
251
|
# This function is used by Brick Viewer during flashing. It should not be
|
252
252
|
# necessary to call it in a normal user program.
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2018-
|
3
|
+
# This file was automatically generated on 2018-09-28. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.18 #
|
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-
|
3
|
+
# This file was automatically generated on 2018-09-28. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.18 #
|
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 #
|
@@ -280,9 +280,9 @@ module Tinkerforge
|
|
280
280
|
#
|
281
281
|
# The errors are divided into
|
282
282
|
#
|
283
|
-
# *
|
283
|
+
# * ACK checksum errors,
|
284
284
|
# * message checksum errors,
|
285
|
-
# *
|
285
|
+
# * framing errors and
|
286
286
|
# * overflow errors.
|
287
287
|
#
|
288
288
|
# The errors counts are for errors that occur on the Bricklet side. All
|
@@ -296,7 +296,7 @@ module Tinkerforge
|
|
296
296
|
#
|
297
297
|
# You can change from bootloader mode to firmware mode and vice versa. A change
|
298
298
|
# from bootloader mode to firmware mode will only take place if the entry function,
|
299
|
-
# device identifier
|
299
|
+
# device identifier and CRC are present and correct.
|
300
300
|
#
|
301
301
|
# This function is used by Brick Viewer during flashing. It should not be
|
302
302
|
# necessary to call it in a normal user program.
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2018-
|
3
|
+
# This file was automatically generated on 2018-09-28. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.18 #
|
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-
|
3
|
+
# This file was automatically generated on 2018-09-28. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.18 #
|
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 #
|
@@ -125,9 +125,9 @@ module Tinkerforge
|
|
125
125
|
#
|
126
126
|
# The errors are divided into
|
127
127
|
#
|
128
|
-
# *
|
128
|
+
# * ACK checksum errors,
|
129
129
|
# * message checksum errors,
|
130
|
-
# *
|
130
|
+
# * framing errors and
|
131
131
|
# * overflow errors.
|
132
132
|
#
|
133
133
|
# The errors counts are for errors that occur on the Bricklet side. All
|
@@ -141,7 +141,7 @@ module Tinkerforge
|
|
141
141
|
#
|
142
142
|
# You can change from bootloader mode to firmware mode and vice versa. A change
|
143
143
|
# from bootloader mode to firmware mode will only take place if the entry function,
|
144
|
-
# device identifier
|
144
|
+
# device identifier and CRC are present and correct.
|
145
145
|
#
|
146
146
|
# This function is used by Brick Viewer during flashing. It should not be
|
147
147
|
# necessary to call it in a normal user program.
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2018-
|
3
|
+
# This file was automatically generated on 2018-09-28. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.18 #
|
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 #
|
@@ -177,9 +177,9 @@ module Tinkerforge
|
|
177
177
|
#
|
178
178
|
# The errors are divided into
|
179
179
|
#
|
180
|
-
# *
|
180
|
+
# * ACK checksum errors,
|
181
181
|
# * message checksum errors,
|
182
|
-
# *
|
182
|
+
# * framing errors and
|
183
183
|
# * overflow errors.
|
184
184
|
#
|
185
185
|
# The errors counts are for errors that occur on the Bricklet side. All
|
@@ -193,7 +193,7 @@ module Tinkerforge
|
|
193
193
|
#
|
194
194
|
# You can change from bootloader mode to firmware mode and vice versa. A change
|
195
195
|
# from bootloader mode to firmware mode will only take place if the entry function,
|
196
|
-
# device identifier
|
196
|
+
# device identifier and CRC are present and correct.
|
197
197
|
#
|
198
198
|
# This function is used by Brick Viewer during flashing. It should not be
|
199
199
|
# necessary to call it in a normal user program.
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2018-
|
3
|
+
# This file was automatically generated on 2018-09-28. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.18 #
|
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-
|
3
|
+
# This file was automatically generated on 2018-09-28. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.18 #
|
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 #
|
@@ -160,9 +160,9 @@ module Tinkerforge
|
|
160
160
|
#
|
161
161
|
# The errors are divided into
|
162
162
|
#
|
163
|
-
# *
|
163
|
+
# * ACK checksum errors,
|
164
164
|
# * message checksum errors,
|
165
|
-
# *
|
165
|
+
# * framing errors and
|
166
166
|
# * overflow errors.
|
167
167
|
#
|
168
168
|
# The errors counts are for errors that occur on the Bricklet side. All
|
@@ -176,7 +176,7 @@ module Tinkerforge
|
|
176
176
|
#
|
177
177
|
# You can change from bootloader mode to firmware mode and vice versa. A change
|
178
178
|
# from bootloader mode to firmware mode will only take place if the entry function,
|
179
|
-
# device identifier
|
179
|
+
# device identifier and CRC are present and correct.
|
180
180
|
#
|
181
181
|
# This function is used by Brick Viewer during flashing. It should not be
|
182
182
|
# necessary to call it in a normal user program.
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2018-
|
3
|
+
# This file was automatically generated on 2018-09-28. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.18 #
|
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 #
|