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,418 @@
|
|
|
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
|
+
# 16-channel digital input/output
|
|
14
|
+
class BrickletIO16V2 < Device
|
|
15
|
+
DEVICE_IDENTIFIER = 2114 # :nodoc:
|
|
16
|
+
DEVICE_DISPLAY_NAME = 'IO-16 Bricklet 2.0' # :nodoc:
|
|
17
|
+
|
|
18
|
+
# This callback is triggered periodically according to the configuration set by
|
|
19
|
+
# BrickletIO16V2#set_input_value_callback_configuration.
|
|
20
|
+
#
|
|
21
|
+
# The parameters are the channel, a value-changed indicator and the actual value
|
|
22
|
+
# for the channel. The `changed` parameter is true if the value has changed since
|
|
23
|
+
# the last callback.
|
|
24
|
+
CALLBACK_INPUT_VALUE = 15
|
|
25
|
+
|
|
26
|
+
# This callback is triggered periodically according to the configuration set by
|
|
27
|
+
# BrickletIO16V2#set_all_input_value_callback_configuration.
|
|
28
|
+
#
|
|
29
|
+
# The parameters are the same as BrickletIO16V2#get_value. Additional the
|
|
30
|
+
# `changed` parameter is true if the value has changed since
|
|
31
|
+
# the last callback.
|
|
32
|
+
CALLBACK_ALL_INPUT_VALUE = 16
|
|
33
|
+
|
|
34
|
+
# This callback is triggered whenever a monoflop timer reaches 0. The
|
|
35
|
+
# parameters contain the channel and the current value of the channel
|
|
36
|
+
# (the value after the monoflop).
|
|
37
|
+
CALLBACK_MONOFLOP_DONE = 17
|
|
38
|
+
|
|
39
|
+
FUNCTION_SET_VALUE = 1 # :nodoc:
|
|
40
|
+
FUNCTION_GET_VALUE = 2 # :nodoc:
|
|
41
|
+
FUNCTION_SET_SELECTED_VALUE = 3 # :nodoc:
|
|
42
|
+
FUNCTION_SET_CONFIGURATION = 4 # :nodoc:
|
|
43
|
+
FUNCTION_GET_CONFIGURATION = 5 # :nodoc:
|
|
44
|
+
FUNCTION_SET_INPUT_VALUE_CALLBACK_CONFIGURATION = 6 # :nodoc:
|
|
45
|
+
FUNCTION_GET_INPUT_VALUE_CALLBACK_CONFIGURATION = 7 # :nodoc:
|
|
46
|
+
FUNCTION_SET_ALL_INPUT_VALUE_CALLBACK_CONFIGURATION = 8 # :nodoc:
|
|
47
|
+
FUNCTION_GET_ALL_INPUT_VALUE_CALLBACK_CONFIGURATION = 9 # :nodoc:
|
|
48
|
+
FUNCTION_SET_MONOFLOP = 10 # :nodoc:
|
|
49
|
+
FUNCTION_GET_MONOFLOP = 11 # :nodoc:
|
|
50
|
+
FUNCTION_GET_EDGE_COUNT = 12 # :nodoc:
|
|
51
|
+
FUNCTION_SET_EDGE_COUNT_CONFIGURATION = 13 # :nodoc:
|
|
52
|
+
FUNCTION_GET_EDGE_COUNT_CONFIGURATION = 14 # :nodoc:
|
|
53
|
+
FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
|
|
54
|
+
FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
|
|
55
|
+
FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
|
|
56
|
+
FUNCTION_SET_WRITE_FIRMWARE_POINTER = 237 # :nodoc:
|
|
57
|
+
FUNCTION_WRITE_FIRMWARE = 238 # :nodoc:
|
|
58
|
+
FUNCTION_SET_STATUS_LED_CONFIG = 239 # :nodoc:
|
|
59
|
+
FUNCTION_GET_STATUS_LED_CONFIG = 240 # :nodoc:
|
|
60
|
+
FUNCTION_GET_CHIP_TEMPERATURE = 242 # :nodoc:
|
|
61
|
+
FUNCTION_RESET = 243 # :nodoc:
|
|
62
|
+
FUNCTION_WRITE_UID = 248 # :nodoc:
|
|
63
|
+
FUNCTION_READ_UID = 249 # :nodoc:
|
|
64
|
+
FUNCTION_GET_IDENTITY = 255 # :nodoc:
|
|
65
|
+
|
|
66
|
+
DIRECTION_IN = 'i' # :nodoc:
|
|
67
|
+
DIRECTION_OUT = 'o' # :nodoc:
|
|
68
|
+
EDGE_TYPE_RISING = 0 # :nodoc:
|
|
69
|
+
EDGE_TYPE_FALLING = 1 # :nodoc:
|
|
70
|
+
EDGE_TYPE_BOTH = 2 # :nodoc:
|
|
71
|
+
BOOTLOADER_MODE_BOOTLOADER = 0 # :nodoc:
|
|
72
|
+
BOOTLOADER_MODE_FIRMWARE = 1 # :nodoc:
|
|
73
|
+
BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT = 2 # :nodoc:
|
|
74
|
+
BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT = 3 # :nodoc:
|
|
75
|
+
BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT = 4 # :nodoc:
|
|
76
|
+
BOOTLOADER_STATUS_OK = 0 # :nodoc:
|
|
77
|
+
BOOTLOADER_STATUS_INVALID_MODE = 1 # :nodoc:
|
|
78
|
+
BOOTLOADER_STATUS_NO_CHANGE = 2 # :nodoc:
|
|
79
|
+
BOOTLOADER_STATUS_ENTRY_FUNCTION_NOT_PRESENT = 3 # :nodoc:
|
|
80
|
+
BOOTLOADER_STATUS_DEVICE_IDENTIFIER_INCORRECT = 4 # :nodoc:
|
|
81
|
+
BOOTLOADER_STATUS_CRC_MISMATCH = 5 # :nodoc:
|
|
82
|
+
STATUS_LED_CONFIG_OFF = 0 # :nodoc:
|
|
83
|
+
STATUS_LED_CONFIG_ON = 1 # :nodoc:
|
|
84
|
+
STATUS_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
|
|
85
|
+
STATUS_LED_CONFIG_SHOW_STATUS = 3 # :nodoc:
|
|
86
|
+
|
|
87
|
+
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
88
|
+
# the IP Connection <tt>ipcon</tt>.
|
|
89
|
+
def initialize(uid, ipcon)
|
|
90
|
+
super uid, ipcon
|
|
91
|
+
|
|
92
|
+
@api_version = [2, 0, 0]
|
|
93
|
+
|
|
94
|
+
@response_expected[FUNCTION_SET_VALUE] = RESPONSE_EXPECTED_FALSE
|
|
95
|
+
@response_expected[FUNCTION_GET_VALUE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
96
|
+
@response_expected[FUNCTION_SET_SELECTED_VALUE] = RESPONSE_EXPECTED_FALSE
|
|
97
|
+
@response_expected[FUNCTION_SET_CONFIGURATION] = RESPONSE_EXPECTED_FALSE
|
|
98
|
+
@response_expected[FUNCTION_GET_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
99
|
+
@response_expected[FUNCTION_SET_INPUT_VALUE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
|
|
100
|
+
@response_expected[FUNCTION_GET_INPUT_VALUE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
101
|
+
@response_expected[FUNCTION_SET_ALL_INPUT_VALUE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
|
|
102
|
+
@response_expected[FUNCTION_GET_ALL_INPUT_VALUE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
103
|
+
@response_expected[FUNCTION_SET_MONOFLOP] = RESPONSE_EXPECTED_FALSE
|
|
104
|
+
@response_expected[FUNCTION_GET_MONOFLOP] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
105
|
+
@response_expected[FUNCTION_GET_EDGE_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
106
|
+
@response_expected[FUNCTION_SET_EDGE_COUNT_CONFIGURATION] = RESPONSE_EXPECTED_FALSE
|
|
107
|
+
@response_expected[FUNCTION_GET_EDGE_COUNT_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
108
|
+
@response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
109
|
+
@response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
110
|
+
@response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
111
|
+
@response_expected[FUNCTION_SET_WRITE_FIRMWARE_POINTER] = RESPONSE_EXPECTED_FALSE
|
|
112
|
+
@response_expected[FUNCTION_WRITE_FIRMWARE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
113
|
+
@response_expected[FUNCTION_SET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
|
|
114
|
+
@response_expected[FUNCTION_GET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
115
|
+
@response_expected[FUNCTION_GET_CHIP_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
116
|
+
@response_expected[FUNCTION_RESET] = RESPONSE_EXPECTED_FALSE
|
|
117
|
+
@response_expected[FUNCTION_WRITE_UID] = RESPONSE_EXPECTED_FALSE
|
|
118
|
+
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
119
|
+
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
120
|
+
|
|
121
|
+
@callback_formats[CALLBACK_INPUT_VALUE] = 'C ? ?'
|
|
122
|
+
@callback_formats[CALLBACK_ALL_INPUT_VALUE] = '?16 ?16'
|
|
123
|
+
@callback_formats[CALLBACK_MONOFLOP_DONE] = 'C ?'
|
|
124
|
+
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
# Sets the output value of all sixteen channels. A value of *true* or *false* outputs
|
|
128
|
+
# logic 1 or logic 0 respectively on the corresponding channel.
|
|
129
|
+
#
|
|
130
|
+
# Use BrickletIO16V2#set_selected_value to change only one output channel state.
|
|
131
|
+
#
|
|
132
|
+
# For example: (True, True, False, False, ..., False) will turn the channels 0-1
|
|
133
|
+
# high and the channels 2-15 low.
|
|
134
|
+
#
|
|
135
|
+
# .. note::
|
|
136
|
+
# This function does nothing for channels that are configured as input. Pull-up
|
|
137
|
+
# resistors can be switched on with BrickletIO16V2#set_configuration.
|
|
138
|
+
def set_value(value)
|
|
139
|
+
send_request FUNCTION_SET_VALUE, [value], '?16', 0, ''
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
# Returns the logic levels that are currently measured on the channels.
|
|
143
|
+
# This function works if the channel is configured as input as well as if it is
|
|
144
|
+
# configured as output.
|
|
145
|
+
def get_value
|
|
146
|
+
send_request FUNCTION_GET_VALUE, [], '', 16, '?16'
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
# Sets the output value of a specific channel without affecting the other channels.
|
|
150
|
+
#
|
|
151
|
+
# .. note::
|
|
152
|
+
# This function does nothing for channels that are configured as input. Pull-up
|
|
153
|
+
# resistors can be switched on with BrickletIO16V2#set_configuration.
|
|
154
|
+
def set_selected_value(channel, value)
|
|
155
|
+
send_request FUNCTION_SET_SELECTED_VALUE, [channel, value], 'C ?', 0, ''
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
# Configures the value and direction of a specific channel. Possible directions
|
|
159
|
+
# are 'i' and 'o' for input and output.
|
|
160
|
+
#
|
|
161
|
+
# If the direction is configured as output, the value is either high or low
|
|
162
|
+
# (set as *true* or *false*).
|
|
163
|
+
#
|
|
164
|
+
# If the direction is configured as input, the value is either pull-up or
|
|
165
|
+
# default (set as *true* or *false*).
|
|
166
|
+
#
|
|
167
|
+
# For example:
|
|
168
|
+
#
|
|
169
|
+
# * (0, 'i', true) will set channel-0 as input pull-up.
|
|
170
|
+
# * (1, 'i', false) will set channel-1 as input default (floating if nothing is connected).
|
|
171
|
+
# * (2, 'o', true) will set channel-2 as output high.
|
|
172
|
+
# * (3, 'o', false) will set channel-3 as output low.
|
|
173
|
+
#
|
|
174
|
+
# The default configuration is input with pull-up.
|
|
175
|
+
def set_configuration(channel, direction, value)
|
|
176
|
+
send_request FUNCTION_SET_CONFIGURATION, [channel, direction, value], 'C k ?', 0, ''
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
# Returns the channel configuration as set by BrickletIO16V2#set_configuration.
|
|
180
|
+
def get_configuration(channel)
|
|
181
|
+
send_request FUNCTION_GET_CONFIGURATION, [channel], 'C', 2, 'k ?'
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
# This callback can be configured per channel.
|
|
185
|
+
#
|
|
186
|
+
# The period in ms is the period with which the CALLBACK_INPUT_VALUE
|
|
187
|
+
# callback is triggered periodically. A value of 0 turns the callback off.
|
|
188
|
+
#
|
|
189
|
+
# If the `value has to change`-parameter is set to true, the callback is only
|
|
190
|
+
# triggered after the value has changed. If the value didn't change within the
|
|
191
|
+
# period, the callback is triggered immediately on change.
|
|
192
|
+
#
|
|
193
|
+
# If it is set to false, the callback is continuously triggered with the period,
|
|
194
|
+
# independent of the value.
|
|
195
|
+
#
|
|
196
|
+
# The default value is (0, false).
|
|
197
|
+
def set_input_value_callback_configuration(channel, period, value_has_to_change)
|
|
198
|
+
send_request FUNCTION_SET_INPUT_VALUE_CALLBACK_CONFIGURATION, [channel, period, value_has_to_change], 'C L ?', 0, ''
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
# Returns the callback configuration as set by
|
|
202
|
+
# BrickletIO16V2#set_input_value_callback_configuration.
|
|
203
|
+
def get_input_value_callback_configuration(channel)
|
|
204
|
+
send_request FUNCTION_GET_INPUT_VALUE_CALLBACK_CONFIGURATION, [channel], 'C', 5, 'L ?'
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
# The period in ms is the period with which the CALLBACK_ALL_INPUT_VALUE
|
|
208
|
+
# callback is triggered periodically. A value of 0 turns the callback off.
|
|
209
|
+
#
|
|
210
|
+
# If the `value has to change`-parameter is set to true, the callback is only
|
|
211
|
+
# triggered after the value has changed. If the value didn't change within the
|
|
212
|
+
# period, the callback is triggered immediately on change.
|
|
213
|
+
#
|
|
214
|
+
# If it is set to false, the callback is continuously triggered with the period,
|
|
215
|
+
# independent of the value.
|
|
216
|
+
#
|
|
217
|
+
# The default value is (0, false).
|
|
218
|
+
def set_all_input_value_callback_configuration(period, value_has_to_change)
|
|
219
|
+
send_request FUNCTION_SET_ALL_INPUT_VALUE_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 0, ''
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
# Returns the callback configuration as set by
|
|
223
|
+
# BrickletIO16V2#set_all_input_value_callback_configuration.
|
|
224
|
+
def get_all_input_value_callback_configuration
|
|
225
|
+
send_request FUNCTION_GET_ALL_INPUT_VALUE_CALLBACK_CONFIGURATION, [], '', 5, 'L ?'
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
# Configures a monoflop of the specified channel.
|
|
229
|
+
#
|
|
230
|
+
# The second parameter is the desired value of the specified
|
|
231
|
+
# channel. A *true* means relay closed and a *false* means relay open.
|
|
232
|
+
#
|
|
233
|
+
# The third parameter indicates the time (in ms) that the channels should hold
|
|
234
|
+
# the value.
|
|
235
|
+
#
|
|
236
|
+
# If this function is called with the parameters (0, 1, 1500) channel 0 will
|
|
237
|
+
# close and in 1.5s channel 0 will open again
|
|
238
|
+
#
|
|
239
|
+
# A monoflop can be used as a fail-safe mechanism. For example: Lets assume you
|
|
240
|
+
# have a RS485 bus and a IO-16 Bricklet 2.0 connected to one of
|
|
241
|
+
# the slave stacks. You can now call this function every second, with a time
|
|
242
|
+
# parameter of two seconds and channel 0 closed. Channel 0 will be closed all the
|
|
243
|
+
# time. If now the RS485 connection is lost, then channel 0 will be opened in at
|
|
244
|
+
# most two seconds.
|
|
245
|
+
def set_monoflop(channel, value, time)
|
|
246
|
+
send_request FUNCTION_SET_MONOFLOP, [channel, value, time], 'C ? L', 0, ''
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
# Returns (for the given channel) the current value and the time as set by
|
|
250
|
+
# BrickletIO16V2#set_monoflop as well as the remaining time until the value flips.
|
|
251
|
+
#
|
|
252
|
+
# If the timer is not running currently, the remaining time will be returned
|
|
253
|
+
# as 0.
|
|
254
|
+
def get_monoflop(channel)
|
|
255
|
+
send_request FUNCTION_GET_MONOFLOP, [channel], 'C', 9, '? L L'
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
# Returns the current value of the edge counter for the selected channel. You can
|
|
259
|
+
# configure the edges that are counted with BrickletIO16V2#set_edge_count_configuration.
|
|
260
|
+
#
|
|
261
|
+
# If you set the reset counter to *true*, the count is set back to 0
|
|
262
|
+
# directly after it is read.
|
|
263
|
+
def get_edge_count(channel, reset_counter)
|
|
264
|
+
send_request FUNCTION_GET_EDGE_COUNT, [channel, reset_counter], 'C ?', 4, 'L'
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
# Configures the edge counter for a specific channel.
|
|
268
|
+
#
|
|
269
|
+
# The edge type parameter configures if rising edges, falling edges or
|
|
270
|
+
# both are counted if the channel is configured for input. Possible edge types are:
|
|
271
|
+
#
|
|
272
|
+
# * 0 = rising (default)
|
|
273
|
+
# * 1 = falling
|
|
274
|
+
# * 2 = both
|
|
275
|
+
#
|
|
276
|
+
# The debounce time is given in ms.
|
|
277
|
+
#
|
|
278
|
+
# Configuring an edge counter resets its value to 0.
|
|
279
|
+
#
|
|
280
|
+
# If you don't know what any of this means, just leave it at default. The
|
|
281
|
+
# default configuration is very likely OK for you.
|
|
282
|
+
#
|
|
283
|
+
# Default values: 0 (edge type) and 100ms (debounce time)
|
|
284
|
+
def set_edge_count_configuration(channel, edge_type, debounce)
|
|
285
|
+
send_request FUNCTION_SET_EDGE_COUNT_CONFIGURATION, [channel, edge_type, debounce], 'C C C', 0, ''
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
# Returns the edge type and debounce time for the selected channel as set by
|
|
289
|
+
# BrickletIO16V2#set_edge_count_configuration.
|
|
290
|
+
def get_edge_count_configuration(channel)
|
|
291
|
+
send_request FUNCTION_GET_EDGE_COUNT_CONFIGURATION, [channel], 'C', 2, 'C C'
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
# Returns the error count for the communication between Brick and Bricklet.
|
|
295
|
+
#
|
|
296
|
+
# The errors are divided into
|
|
297
|
+
#
|
|
298
|
+
# * ACK checksum errors,
|
|
299
|
+
# * message checksum errors,
|
|
300
|
+
# * framing errors and
|
|
301
|
+
# * overflow errors.
|
|
302
|
+
#
|
|
303
|
+
# The errors counts are for errors that occur on the Bricklet side. All
|
|
304
|
+
# Bricks have a similar function that returns the errors on the Brick side.
|
|
305
|
+
def get_spitfp_error_count
|
|
306
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
|
|
307
|
+
end
|
|
308
|
+
|
|
309
|
+
# Sets the bootloader mode and returns the status after the requested
|
|
310
|
+
# mode change was instigated.
|
|
311
|
+
#
|
|
312
|
+
# You can change from bootloader mode to firmware mode and vice versa. A change
|
|
313
|
+
# from bootloader mode to firmware mode will only take place if the entry function,
|
|
314
|
+
# device identifier and CRC are present and correct.
|
|
315
|
+
#
|
|
316
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
|
317
|
+
# necessary to call it in a normal user program.
|
|
318
|
+
def set_bootloader_mode(mode)
|
|
319
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
|
|
320
|
+
end
|
|
321
|
+
|
|
322
|
+
# Returns the current bootloader mode, see BrickletIO16V2#set_bootloader_mode.
|
|
323
|
+
def get_bootloader_mode
|
|
324
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
|
|
325
|
+
end
|
|
326
|
+
|
|
327
|
+
# Sets the firmware pointer for BrickletIO16V2#write_firmware. The pointer has
|
|
328
|
+
# to be increased by chunks of size 64. The data is written to flash
|
|
329
|
+
# every 4 chunks (which equals to one page of size 256).
|
|
330
|
+
#
|
|
331
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
|
332
|
+
# necessary to call it in a normal user program.
|
|
333
|
+
def set_write_firmware_pointer(pointer)
|
|
334
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
|
|
335
|
+
end
|
|
336
|
+
|
|
337
|
+
# Writes 64 Bytes of firmware at the position as written by
|
|
338
|
+
# BrickletIO16V2#set_write_firmware_pointer before. The firmware is written
|
|
339
|
+
# to flash every 4 chunks.
|
|
340
|
+
#
|
|
341
|
+
# You can only write firmware in bootloader mode.
|
|
342
|
+
#
|
|
343
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
|
344
|
+
# necessary to call it in a normal user program.
|
|
345
|
+
def write_firmware(data)
|
|
346
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
|
|
347
|
+
end
|
|
348
|
+
|
|
349
|
+
# Sets the status LED configuration. By default the LED shows
|
|
350
|
+
# communication traffic between Brick and Bricklet, it flickers once
|
|
351
|
+
# for every 10 received data packets.
|
|
352
|
+
#
|
|
353
|
+
# You can also turn the LED permanently on/off or show a heartbeat.
|
|
354
|
+
#
|
|
355
|
+
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
|
356
|
+
def set_status_led_config(config)
|
|
357
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
|
|
358
|
+
end
|
|
359
|
+
|
|
360
|
+
# Returns the configuration as set by BrickletIO16V2#set_status_led_config
|
|
361
|
+
def get_status_led_config
|
|
362
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
|
|
363
|
+
end
|
|
364
|
+
|
|
365
|
+
# Returns the temperature in °C as measured inside the microcontroller. The
|
|
366
|
+
# value returned is not the ambient temperature!
|
|
367
|
+
#
|
|
368
|
+
# The temperature is only proportional to the real temperature and it has bad
|
|
369
|
+
# accuracy. Practically it is only useful as an indicator for
|
|
370
|
+
# temperature changes.
|
|
371
|
+
def get_chip_temperature
|
|
372
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
|
|
373
|
+
end
|
|
374
|
+
|
|
375
|
+
# Calling this function will reset the Bricklet. All configurations
|
|
376
|
+
# will be lost.
|
|
377
|
+
#
|
|
378
|
+
# After a reset you have to create new device objects,
|
|
379
|
+
# calling functions on the existing ones will result in
|
|
380
|
+
# undefined behavior!
|
|
381
|
+
def reset
|
|
382
|
+
send_request FUNCTION_RESET, [], '', 0, ''
|
|
383
|
+
end
|
|
384
|
+
|
|
385
|
+
# Writes a new UID into flash. If you want to set a new UID
|
|
386
|
+
# you have to decode the Base58 encoded UID string into an
|
|
387
|
+
# integer first.
|
|
388
|
+
#
|
|
389
|
+
# We recommend that you use Brick Viewer to change the UID.
|
|
390
|
+
def write_uid(uid)
|
|
391
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
|
|
392
|
+
end
|
|
393
|
+
|
|
394
|
+
# Returns the current UID as an integer. Encode as
|
|
395
|
+
# Base58 to get the usual string version.
|
|
396
|
+
def read_uid
|
|
397
|
+
send_request FUNCTION_READ_UID, [], '', 4, 'L'
|
|
398
|
+
end
|
|
399
|
+
|
|
400
|
+
# Returns the UID, the UID where the Bricklet is connected to,
|
|
401
|
+
# the position, the hardware and firmware version as well as the
|
|
402
|
+
# device identifier.
|
|
403
|
+
#
|
|
404
|
+
# The position can be 'a', 'b', 'c' or 'd'.
|
|
405
|
+
#
|
|
406
|
+
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
407
|
+
# |device_identifier_constant|
|
|
408
|
+
def get_identity
|
|
409
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
|
410
|
+
end
|
|
411
|
+
|
|
412
|
+
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|
|
413
|
+
def register_callback(id, &block)
|
|
414
|
+
callback = block
|
|
415
|
+
@registered_callbacks[id] = callback
|
|
416
|
+
end
|
|
417
|
+
end
|
|
418
|
+
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 #
|
|
@@ -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 #
|
|
@@ -297,7 +297,7 @@ module Tinkerforge
|
|
|
297
297
|
# be ignored. To turn the PWM off again, you can set the frequency to 0 or any other
|
|
298
298
|
# function that changes a value of the channel (e.g. BrickletIO4V2#set_selected_value).
|
|
299
299
|
#
|
|
300
|
-
# The maximum frequency value is 320000000 (32MHz). The maximum duty cycle value is
|
|
300
|
+
# The maximum frequency value is 320000000 (32MHz). The maximum duty cycle value is
|
|
301
301
|
# 10000 (100%).
|
|
302
302
|
#
|
|
303
303
|
# The default values are 0, 0.
|
|
@@ -314,9 +314,9 @@ module Tinkerforge
|
|
|
314
314
|
#
|
|
315
315
|
# The errors are divided into
|
|
316
316
|
#
|
|
317
|
-
# *
|
|
317
|
+
# * ACK checksum errors,
|
|
318
318
|
# * message checksum errors,
|
|
319
|
-
# *
|
|
319
|
+
# * framing errors and
|
|
320
320
|
# * overflow errors.
|
|
321
321
|
#
|
|
322
322
|
# The errors counts are for errors that occur on the Bricklet side. All
|
|
@@ -330,7 +330,7 @@ module Tinkerforge
|
|
|
330
330
|
#
|
|
331
331
|
# You can change from bootloader mode to firmware mode and vice versa. A change
|
|
332
332
|
# from bootloader mode to firmware mode will only take place if the entry function,
|
|
333
|
-
# device identifier
|
|
333
|
+
# device identifier and CRC are present and correct.
|
|
334
334
|
#
|
|
335
335
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
336
336
|
# necessary to call it in a normal user program.
|