tinkerforge 2.1.17 → 2.1.18
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.
- 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,302 @@
|
|
|
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
|
+
# 4 galvanically isolated digital outputs
|
|
14
|
+
class BrickletIndustrialDigitalOut4V2 < Device
|
|
15
|
+
DEVICE_IDENTIFIER = 2124 # :nodoc:
|
|
16
|
+
DEVICE_DISPLAY_NAME = 'Industrial Digital Out 4 Bricklet 2.0' # :nodoc:
|
|
17
|
+
|
|
18
|
+
# This callback is triggered whenever a monoflop timer reaches 0. The
|
|
19
|
+
# parameters contain the channel and the current value of the channel
|
|
20
|
+
# (the value after the monoflop).
|
|
21
|
+
CALLBACK_MONOFLOP_DONE = 6
|
|
22
|
+
|
|
23
|
+
FUNCTION_SET_VALUE = 1 # :nodoc:
|
|
24
|
+
FUNCTION_GET_VALUE = 2 # :nodoc:
|
|
25
|
+
FUNCTION_SET_SELECTED_VALUE = 3 # :nodoc:
|
|
26
|
+
FUNCTION_SET_MONOFLOP = 4 # :nodoc:
|
|
27
|
+
FUNCTION_GET_MONOFLOP = 5 # :nodoc:
|
|
28
|
+
FUNCTION_SET_CHANNEL_LED_CONFIG = 7 # :nodoc:
|
|
29
|
+
FUNCTION_GET_CHANNEL_LED_CONFIG = 8 # :nodoc:
|
|
30
|
+
FUNCTION_SET_PWM_CONFIGURATION = 9 # :nodoc:
|
|
31
|
+
FUNCTION_GET_PWM_CONFIGURATION = 10 # :nodoc:
|
|
32
|
+
FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
|
|
33
|
+
FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
|
|
34
|
+
FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
|
|
35
|
+
FUNCTION_SET_WRITE_FIRMWARE_POINTER = 237 # :nodoc:
|
|
36
|
+
FUNCTION_WRITE_FIRMWARE = 238 # :nodoc:
|
|
37
|
+
FUNCTION_SET_STATUS_LED_CONFIG = 239 # :nodoc:
|
|
38
|
+
FUNCTION_GET_STATUS_LED_CONFIG = 240 # :nodoc:
|
|
39
|
+
FUNCTION_GET_CHIP_TEMPERATURE = 242 # :nodoc:
|
|
40
|
+
FUNCTION_RESET = 243 # :nodoc:
|
|
41
|
+
FUNCTION_WRITE_UID = 248 # :nodoc:
|
|
42
|
+
FUNCTION_READ_UID = 249 # :nodoc:
|
|
43
|
+
FUNCTION_GET_IDENTITY = 255 # :nodoc:
|
|
44
|
+
|
|
45
|
+
CHANNEL_LED_CONFIG_OFF = 0 # :nodoc:
|
|
46
|
+
CHANNEL_LED_CONFIG_ON = 1 # :nodoc:
|
|
47
|
+
CHANNEL_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
|
|
48
|
+
CHANNEL_LED_CONFIG_SHOW_CHANNEL_STATUS = 3 # :nodoc:
|
|
49
|
+
BOOTLOADER_MODE_BOOTLOADER = 0 # :nodoc:
|
|
50
|
+
BOOTLOADER_MODE_FIRMWARE = 1 # :nodoc:
|
|
51
|
+
BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT = 2 # :nodoc:
|
|
52
|
+
BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT = 3 # :nodoc:
|
|
53
|
+
BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT = 4 # :nodoc:
|
|
54
|
+
BOOTLOADER_STATUS_OK = 0 # :nodoc:
|
|
55
|
+
BOOTLOADER_STATUS_INVALID_MODE = 1 # :nodoc:
|
|
56
|
+
BOOTLOADER_STATUS_NO_CHANGE = 2 # :nodoc:
|
|
57
|
+
BOOTLOADER_STATUS_ENTRY_FUNCTION_NOT_PRESENT = 3 # :nodoc:
|
|
58
|
+
BOOTLOADER_STATUS_DEVICE_IDENTIFIER_INCORRECT = 4 # :nodoc:
|
|
59
|
+
BOOTLOADER_STATUS_CRC_MISMATCH = 5 # :nodoc:
|
|
60
|
+
STATUS_LED_CONFIG_OFF = 0 # :nodoc:
|
|
61
|
+
STATUS_LED_CONFIG_ON = 1 # :nodoc:
|
|
62
|
+
STATUS_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
|
|
63
|
+
STATUS_LED_CONFIG_SHOW_STATUS = 3 # :nodoc:
|
|
64
|
+
|
|
65
|
+
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
66
|
+
# the IP Connection <tt>ipcon</tt>.
|
|
67
|
+
def initialize(uid, ipcon)
|
|
68
|
+
super uid, ipcon
|
|
69
|
+
|
|
70
|
+
@api_version = [2, 0, 0]
|
|
71
|
+
|
|
72
|
+
@response_expected[FUNCTION_SET_VALUE] = RESPONSE_EXPECTED_FALSE
|
|
73
|
+
@response_expected[FUNCTION_GET_VALUE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
74
|
+
@response_expected[FUNCTION_SET_SELECTED_VALUE] = RESPONSE_EXPECTED_FALSE
|
|
75
|
+
@response_expected[FUNCTION_SET_MONOFLOP] = RESPONSE_EXPECTED_FALSE
|
|
76
|
+
@response_expected[FUNCTION_GET_MONOFLOP] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
77
|
+
@response_expected[FUNCTION_SET_CHANNEL_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
|
|
78
|
+
@response_expected[FUNCTION_GET_CHANNEL_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
79
|
+
@response_expected[FUNCTION_SET_PWM_CONFIGURATION] = RESPONSE_EXPECTED_FALSE
|
|
80
|
+
@response_expected[FUNCTION_GET_PWM_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
81
|
+
@response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
82
|
+
@response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
83
|
+
@response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
84
|
+
@response_expected[FUNCTION_SET_WRITE_FIRMWARE_POINTER] = RESPONSE_EXPECTED_FALSE
|
|
85
|
+
@response_expected[FUNCTION_WRITE_FIRMWARE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
86
|
+
@response_expected[FUNCTION_SET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
|
|
87
|
+
@response_expected[FUNCTION_GET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
88
|
+
@response_expected[FUNCTION_GET_CHIP_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
89
|
+
@response_expected[FUNCTION_RESET] = RESPONSE_EXPECTED_FALSE
|
|
90
|
+
@response_expected[FUNCTION_WRITE_UID] = RESPONSE_EXPECTED_FALSE
|
|
91
|
+
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
92
|
+
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
93
|
+
|
|
94
|
+
@callback_formats[CALLBACK_MONOFLOP_DONE] = 'C ?'
|
|
95
|
+
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Sets the output value of all four channels. A value of *true* or *false* outputs
|
|
99
|
+
# logic 1 or logic 0 respectively on the corresponding channel.
|
|
100
|
+
#
|
|
101
|
+
# Use BrickletIndustrialDigitalOut4V2#set_selected_value to change only one output channel state.
|
|
102
|
+
#
|
|
103
|
+
# For example: (True, True, False, False) will turn the channels 0-1 high and the
|
|
104
|
+
# channels 2-3 low.
|
|
105
|
+
def set_value(value)
|
|
106
|
+
send_request FUNCTION_SET_VALUE, [value], '?4', 0, ''
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# Returns the logic levels that are currently output on the channels.
|
|
110
|
+
def get_value
|
|
111
|
+
send_request FUNCTION_GET_VALUE, [], '', 4, '?4'
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# Sets the output value of a specific channel without affecting the other channels.
|
|
115
|
+
def set_selected_value(channel, value)
|
|
116
|
+
send_request FUNCTION_SET_SELECTED_VALUE, [channel, value], 'C ?', 0, ''
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# The first parameter is the desired state of the channel (*true* means output *high*
|
|
120
|
+
# and *false* means output *low*). The second parameter indicates the time (in ms) that
|
|
121
|
+
# the channel should hold the state.
|
|
122
|
+
#
|
|
123
|
+
# If this function is called with the parameters (true, 1500):
|
|
124
|
+
# The channel will turn on and in 1.5s it will turn off again.
|
|
125
|
+
#
|
|
126
|
+
# A monoflop can be used as a failsafe mechanism. For example: Lets assume you
|
|
127
|
+
# have a RS485 bus and a IO-4 Bricklet is connected to one of the slave
|
|
128
|
+
# stacks. You can now call this function every second, with a time parameter
|
|
129
|
+
# of two seconds. The channel will be *high* all the time. If now the RS485
|
|
130
|
+
# connection is lost, the channel will turn *low* in at most two seconds.
|
|
131
|
+
def set_monoflop(channel, value, time)
|
|
132
|
+
send_request FUNCTION_SET_MONOFLOP, [channel, value, time], 'C ? L', 0, ''
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# Returns (for the given channel) the current value and the time as set by
|
|
136
|
+
# BrickletIndustrialDigitalOut4V2#set_monoflop as well as the remaining time until the value flips.
|
|
137
|
+
#
|
|
138
|
+
# If the timer is not running currently, the remaining time will be returned
|
|
139
|
+
# as 0.
|
|
140
|
+
def get_monoflop(channel)
|
|
141
|
+
send_request FUNCTION_GET_MONOFLOP, [channel], 'C', 9, '? L L'
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# Each channel has a corresponding LED. You can turn the LED off, on or show a
|
|
145
|
+
# heartbeat. You can also set the LED to "Channel Status". In this mode the
|
|
146
|
+
# LED is on if the channel is high and off otherwise.
|
|
147
|
+
#
|
|
148
|
+
# By default all channel LEDs are configured as "Channel Status".
|
|
149
|
+
def set_channel_led_config(channel, config)
|
|
150
|
+
send_request FUNCTION_SET_CHANNEL_LED_CONFIG, [channel, config], 'C C', 0, ''
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
# Returns the channel LED configuration as set by BrickletIndustrialDigitalOut4V2#set_channel_led_config
|
|
154
|
+
def get_channel_led_config(channel)
|
|
155
|
+
send_request FUNCTION_GET_CHANNEL_LED_CONFIG, [channel], 'C', 1, 'C'
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
# Activates a PWM for the given channel with the frequency given in 1/10Hz and the duty
|
|
159
|
+
# cycle given in 1/100%.
|
|
160
|
+
#
|
|
161
|
+
# To turn the PWM off again, you can set the frequency to 0 or any other
|
|
162
|
+
# function that changes a value of the channel (e.g. BrickletIndustrialDigitalOut4V2#set_selected_value).
|
|
163
|
+
#
|
|
164
|
+
# The maximum duty cycle value is 10000 (100%). The optocoupler of the Industrial Digital
|
|
165
|
+
# Out 4 Bricklet 2.0 has a rise time and fall time of 11.5us (each) at 24V. So the maximum
|
|
166
|
+
# useful frequency value is about 400000 (40kHz).
|
|
167
|
+
#
|
|
168
|
+
# The default values are 0, 0.
|
|
169
|
+
def set_pwm_configuration(channel, frequency, duty_cycle)
|
|
170
|
+
send_request FUNCTION_SET_PWM_CONFIGURATION, [channel, frequency, duty_cycle], 'C L S', 0, ''
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
# Returns the PWM configuration as set by BrickletIndustrialDigitalOut4V2#set_pwm_configuration.
|
|
174
|
+
def get_pwm_configuration(channel)
|
|
175
|
+
send_request FUNCTION_GET_PWM_CONFIGURATION, [channel], 'C', 6, 'L S'
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
# Returns the error count for the communication between Brick and Bricklet.
|
|
179
|
+
#
|
|
180
|
+
# The errors are divided into
|
|
181
|
+
#
|
|
182
|
+
# * ACK checksum errors,
|
|
183
|
+
# * message checksum errors,
|
|
184
|
+
# * framing errors and
|
|
185
|
+
# * overflow errors.
|
|
186
|
+
#
|
|
187
|
+
# The errors counts are for errors that occur on the Bricklet side. All
|
|
188
|
+
# Bricks have a similar function that returns the errors on the Brick side.
|
|
189
|
+
def get_spitfp_error_count
|
|
190
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
# Sets the bootloader mode and returns the status after the requested
|
|
194
|
+
# mode change was instigated.
|
|
195
|
+
#
|
|
196
|
+
# You can change from bootloader mode to firmware mode and vice versa. A change
|
|
197
|
+
# from bootloader mode to firmware mode will only take place if the entry function,
|
|
198
|
+
# device identifier and CRC are present and correct.
|
|
199
|
+
#
|
|
200
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
|
201
|
+
# necessary to call it in a normal user program.
|
|
202
|
+
def set_bootloader_mode(mode)
|
|
203
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
# Returns the current bootloader mode, see BrickletIndustrialDigitalOut4V2#set_bootloader_mode.
|
|
207
|
+
def get_bootloader_mode
|
|
208
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
# Sets the firmware pointer for BrickletIndustrialDigitalOut4V2#write_firmware. The pointer has
|
|
212
|
+
# to be increased by chunks of size 64. The data is written to flash
|
|
213
|
+
# every 4 chunks (which equals to one page of size 256).
|
|
214
|
+
#
|
|
215
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
|
216
|
+
# necessary to call it in a normal user program.
|
|
217
|
+
def set_write_firmware_pointer(pointer)
|
|
218
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
# Writes 64 Bytes of firmware at the position as written by
|
|
222
|
+
# BrickletIndustrialDigitalOut4V2#set_write_firmware_pointer before. The firmware is written
|
|
223
|
+
# to flash every 4 chunks.
|
|
224
|
+
#
|
|
225
|
+
# You can only write firmware in bootloader mode.
|
|
226
|
+
#
|
|
227
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
|
228
|
+
# necessary to call it in a normal user program.
|
|
229
|
+
def write_firmware(data)
|
|
230
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
# Sets the status LED configuration. By default the LED shows
|
|
234
|
+
# communication traffic between Brick and Bricklet, it flickers once
|
|
235
|
+
# for every 10 received data packets.
|
|
236
|
+
#
|
|
237
|
+
# You can also turn the LED permanently on/off or show a heartbeat.
|
|
238
|
+
#
|
|
239
|
+
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
|
240
|
+
def set_status_led_config(config)
|
|
241
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
# Returns the configuration as set by BrickletIndustrialDigitalOut4V2#set_status_led_config
|
|
245
|
+
def get_status_led_config
|
|
246
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
# Returns the temperature in °C as measured inside the microcontroller. The
|
|
250
|
+
# value returned is not the ambient temperature!
|
|
251
|
+
#
|
|
252
|
+
# The temperature is only proportional to the real temperature and it has bad
|
|
253
|
+
# accuracy. Practically it is only useful as an indicator for
|
|
254
|
+
# temperature changes.
|
|
255
|
+
def get_chip_temperature
|
|
256
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
# Calling this function will reset the Bricklet. All configurations
|
|
260
|
+
# will be lost.
|
|
261
|
+
#
|
|
262
|
+
# After a reset you have to create new device objects,
|
|
263
|
+
# calling functions on the existing ones will result in
|
|
264
|
+
# undefined behavior!
|
|
265
|
+
def reset
|
|
266
|
+
send_request FUNCTION_RESET, [], '', 0, ''
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
# Writes a new UID into flash. If you want to set a new UID
|
|
270
|
+
# you have to decode the Base58 encoded UID string into an
|
|
271
|
+
# integer first.
|
|
272
|
+
#
|
|
273
|
+
# We recommend that you use Brick Viewer to change the UID.
|
|
274
|
+
def write_uid(uid)
|
|
275
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
|
|
276
|
+
end
|
|
277
|
+
|
|
278
|
+
# Returns the current UID as an integer. Encode as
|
|
279
|
+
# Base58 to get the usual string version.
|
|
280
|
+
def read_uid
|
|
281
|
+
send_request FUNCTION_READ_UID, [], '', 4, 'L'
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
# Returns the UID, the UID where the Bricklet is connected to,
|
|
285
|
+
# the position, the hardware and firmware version as well as the
|
|
286
|
+
# device identifier.
|
|
287
|
+
#
|
|
288
|
+
# The position can be 'a', 'b', 'c' or 'd'.
|
|
289
|
+
#
|
|
290
|
+
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
291
|
+
# |device_identifier_constant|
|
|
292
|
+
def get_identity
|
|
293
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|
|
297
|
+
def register_callback(id, &block)
|
|
298
|
+
callback = block
|
|
299
|
+
@registered_callbacks[id] = callback
|
|
300
|
+
end
|
|
301
|
+
end
|
|
302
|
+
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 #
|