tinkerforge 2.1.22 → 2.1.27
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 +5 -5
- data/lib/tinkerforge/brick_dc.rb +157 -76
- data/lib/tinkerforge/brick_hat.rb +115 -32
- data/lib/tinkerforge/brick_hat_zero.rb +119 -21
- data/lib/tinkerforge/brick_imu.rb +192 -87
- data/lib/tinkerforge/brick_imu_v2.rb +220 -119
- data/lib/tinkerforge/brick_master.rb +498 -198
- data/lib/tinkerforge/brick_red.rb +197 -74
- data/lib/tinkerforge/brick_servo.rb +187 -103
- data/lib/tinkerforge/brick_silent_stepper.rb +249 -169
- data/lib/tinkerforge/brick_stepper.rb +214 -102
- data/lib/tinkerforge/bricklet_accelerometer.rb +61 -36
- data/lib/tinkerforge/bricklet_accelerometer_v2.rb +167 -48
- data/lib/tinkerforge/bricklet_air_quality.rb +123 -76
- data/lib/tinkerforge/bricklet_ambient_light.rb +62 -46
- data/lib/tinkerforge/bricklet_ambient_light_v2.rb +41 -28
- data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -28
- data/lib/tinkerforge/bricklet_analog_in.rb +66 -45
- data/lib/tinkerforge/bricklet_analog_in_v2.rb +60 -43
- data/lib/tinkerforge/bricklet_analog_in_v3.rb +68 -32
- data/lib/tinkerforge/bricklet_analog_out.rb +25 -16
- data/lib/tinkerforge/bricklet_analog_out_v2.rb +21 -10
- data/lib/tinkerforge/bricklet_analog_out_v3.rb +55 -22
- data/lib/tinkerforge/bricklet_barometer.rb +108 -58
- data/lib/tinkerforge/bricklet_barometer_v2.rb +109 -67
- data/lib/tinkerforge/bricklet_can.rb +84 -24
- data/lib/tinkerforge/bricklet_can_v2.rb +173 -72
- data/lib/tinkerforge/bricklet_co2.rb +36 -25
- data/lib/tinkerforge/bricklet_co2_v2.rb +119 -60
- data/lib/tinkerforge/bricklet_color.rb +77 -49
- data/lib/tinkerforge/bricklet_color_v2.rb +493 -0
- data/lib/tinkerforge/bricklet_compass.rb +397 -0
- data/lib/tinkerforge/bricklet_current12.rb +61 -40
- data/lib/tinkerforge/bricklet_current25.rb +61 -40
- data/lib/tinkerforge/bricklet_distance_ir.rb +60 -38
- data/lib/tinkerforge/bricklet_distance_ir_v2.rb +85 -45
- data/lib/tinkerforge/bricklet_distance_us.rb +43 -30
- data/lib/tinkerforge/bricklet_distance_us_v2.rb +335 -0
- data/lib/tinkerforge/bricklet_dmx.rb +92 -48
- data/lib/tinkerforge/bricklet_dual_button.rb +23 -12
- data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -29
- data/lib/tinkerforge/bricklet_dual_relay.rb +27 -14
- data/lib/tinkerforge/bricklet_dust_detector.rb +43 -30
- data/lib/tinkerforge/bricklet_e_paper_296x128.rb +115 -63
- data/lib/tinkerforge/bricklet_energy_monitor.rb +416 -0
- data/lib/tinkerforge/bricklet_gps.rb +72 -48
- data/lib/tinkerforge/bricklet_gps_v2.rb +124 -73
- data/lib/tinkerforge/bricklet_hall_effect.rb +43 -28
- data/lib/tinkerforge/bricklet_hall_effect_v2.rb +76 -44
- data/lib/tinkerforge/bricklet_humidity.rb +54 -38
- data/lib/tinkerforge/bricklet_humidity_v2.rb +86 -49
- data/lib/tinkerforge/bricklet_imu_v3.rb +784 -0
- data/lib/tinkerforge/bricklet_industrial_analog_out.rb +41 -18
- data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +84 -40
- data/lib/tinkerforge/bricklet_industrial_counter.rb +102 -59
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +51 -24
- data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +79 -40
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -15
- data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +75 -33
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +43 -29
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +81 -44
- data/lib/tinkerforge/bricklet_industrial_dual_ac_relay.rb +325 -0
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +51 -30
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +139 -40
- data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +63 -28
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -15
- data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -28
- data/lib/tinkerforge/bricklet_io16.rb +57 -32
- data/lib/tinkerforge/bricklet_io16_v2.rb +93 -48
- data/lib/tinkerforge/bricklet_io4.rb +56 -31
- data/lib/tinkerforge/bricklet_io4_v2.rb +109 -57
- data/lib/tinkerforge/bricklet_isolator.rb +111 -35
- data/lib/tinkerforge/bricklet_joystick.rb +63 -42
- data/lib/tinkerforge/bricklet_joystick_v2.rb +71 -35
- data/lib/tinkerforge/bricklet_laser_range_finder.rb +87 -59
- data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +101 -53
- data/lib/tinkerforge/bricklet_lcd_128x64.rb +241 -131
- data/lib/tinkerforge/bricklet_lcd_16x2.rb +49 -25
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +59 -29
- data/lib/tinkerforge/bricklet_led_strip.rb +69 -47
- data/lib/tinkerforge/bricklet_led_strip_v2.rb +105 -48
- data/lib/tinkerforge/bricklet_line.rb +35 -22
- data/lib/tinkerforge/bricklet_linear_poti.rb +53 -35
- data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -24
- data/lib/tinkerforge/bricklet_load_cell.rb +64 -40
- data/lib/tinkerforge/bricklet_load_cell_v2.rb +81 -41
- data/lib/tinkerforge/bricklet_moisture.rb +43 -30
- data/lib/tinkerforge/bricklet_motion_detector.rb +21 -10
- data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -29
- data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -32
- data/lib/tinkerforge/bricklet_multi_touch.rb +30 -17
- data/lib/tinkerforge/bricklet_multi_touch_v2.rb +371 -0
- data/lib/tinkerforge/bricklet_nfc.rb +130 -80
- data/lib/tinkerforge/bricklet_nfc_rfid.rb +32 -13
- data/lib/tinkerforge/bricklet_oled_128x64.rb +30 -17
- data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +97 -40
- data/lib/tinkerforge/bricklet_oled_64x48.rb +30 -17
- data/lib/tinkerforge/bricklet_one_wire.rb +65 -24
- data/lib/tinkerforge/bricklet_outdoor_weather.rb +84 -41
- data/lib/tinkerforge/bricklet_particulate_matter.rb +85 -37
- data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -13
- data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -19
- data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +84 -57
- data/lib/tinkerforge/bricklet_ptc.rb +76 -51
- data/lib/tinkerforge/bricklet_ptc_v2.rb +96 -54
- data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -36
- data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -47
- data/lib/tinkerforge/bricklet_remote_switch.rb +38 -29
- data/lib/tinkerforge/bricklet_remote_switch_v2.rb +86 -49
- data/lib/tinkerforge/bricklet_rgb_led.rb +17 -8
- data/lib/tinkerforge/bricklet_rgb_led_button.rb +61 -30
- data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +78 -33
- data/lib/tinkerforge/bricklet_rgb_led_v2.rb +51 -20
- data/lib/tinkerforge/bricklet_rotary_encoder.rb +40 -25
- data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -27
- data/lib/tinkerforge/bricklet_rotary_poti.rb +55 -37
- data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +290 -0
- data/lib/tinkerforge/bricklet_rs232.rb +89 -28
- data/lib/tinkerforge/bricklet_rs232_v2.rb +121 -47
- data/lib/tinkerforge/bricklet_rs485.rb +303 -207
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
- data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -36
- data/lib/tinkerforge/bricklet_solid_state_relay.rb +24 -13
- data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +58 -25
- data/lib/tinkerforge/bricklet_sound_intensity.rb +36 -24
- data/lib/tinkerforge/bricklet_sound_pressure_level.rb +77 -41
- data/lib/tinkerforge/bricklet_temperature.rb +43 -28
- data/lib/tinkerforge/bricklet_temperature_ir.rb +63 -47
- data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +75 -53
- data/lib/tinkerforge/bricklet_temperature_v2.rb +62 -31
- data/lib/tinkerforge/bricklet_thermal_imaging.rb +118 -68
- data/lib/tinkerforge/bricklet_thermocouple.rb +46 -30
- data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -30
- data/lib/tinkerforge/bricklet_tilt.rb +23 -10
- data/lib/tinkerforge/bricklet_uv_light.rb +37 -24
- data/lib/tinkerforge/bricklet_uv_light_v2.rb +87 -46
- data/lib/tinkerforge/bricklet_voltage.rb +54 -37
- data/lib/tinkerforge/bricklet_voltage_current.rb +94 -85
- data/lib/tinkerforge/bricklet_voltage_current_v2.rb +103 -77
- data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +410 -0
- data/lib/tinkerforge/device_display_names.rb +165 -0
- data/lib/tinkerforge/ip_connection.rb +155 -33
- data/lib/tinkerforge/version.rb +1 -1
- metadata +14 -4
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on
|
|
3
|
+
# This file was automatically generated on 2020-11-02. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.27 #
|
|
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 #
|
|
9
9
|
# to the generators git repository on tinkerforge.com #
|
|
10
10
|
#############################################################
|
|
11
11
|
|
|
12
|
+
require_relative './ip_connection'
|
|
13
|
+
|
|
12
14
|
module Tinkerforge
|
|
13
15
|
# Four 7-segment displays with switchable colon
|
|
14
16
|
class BrickletSegmentDisplay4x7 < Device
|
|
@@ -29,7 +31,7 @@ module Tinkerforge
|
|
|
29
31
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
30
32
|
# the IP Connection <tt>ipcon</tt>.
|
|
31
33
|
def initialize(uid, ipcon)
|
|
32
|
-
super uid, ipcon
|
|
34
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
33
35
|
|
|
34
36
|
@api_version = [2, 0, 0]
|
|
35
37
|
|
|
@@ -39,8 +41,9 @@ module Tinkerforge
|
|
|
39
41
|
@response_expected[FUNCTION_GET_COUNTER_VALUE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
40
42
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
41
43
|
|
|
42
|
-
@callback_formats[CALLBACK_COUNTER_FINISHED] = ''
|
|
44
|
+
@callback_formats[CALLBACK_COUNTER_FINISHED] = [8, '']
|
|
43
45
|
|
|
46
|
+
@ipcon.add_device self
|
|
44
47
|
end
|
|
45
48
|
|
|
46
49
|
# The 7-segment display can be set with bitmaps. Every bit controls one
|
|
@@ -57,50 +60,57 @@ module Tinkerforge
|
|
|
57
60
|
# The brightness can be set between 0 (dark) and 7 (bright). The colon
|
|
58
61
|
# parameter turns the colon of the display on or off.
|
|
59
62
|
def set_segments(segments, brightness, colon)
|
|
60
|
-
|
|
63
|
+
check_validity
|
|
64
|
+
|
|
65
|
+
send_request FUNCTION_SET_SEGMENTS, [segments, brightness, colon], 'C4 C ?', 8, ''
|
|
61
66
|
end
|
|
62
67
|
|
|
63
68
|
# Returns the segment, brightness and color data as set by
|
|
64
69
|
# BrickletSegmentDisplay4x7#set_segments.
|
|
65
70
|
def get_segments
|
|
66
|
-
|
|
71
|
+
check_validity
|
|
72
|
+
|
|
73
|
+
send_request FUNCTION_GET_SEGMENTS, [], '', 14, 'C4 C ?'
|
|
67
74
|
end
|
|
68
75
|
|
|
69
76
|
# Starts a counter with the *from* value that counts to the *to*
|
|
70
77
|
# value with the each step incremented by *increment*.
|
|
71
|
-
#
|
|
78
|
+
# *length* is the pause between each increment.
|
|
72
79
|
#
|
|
73
80
|
# Example: If you set *from* to 0, *to* to 100, *increment* to 1 and
|
|
74
81
|
# *length* to 1000, a counter that goes from 0 to 100 with one second
|
|
75
82
|
# pause between each increment will be started.
|
|
76
83
|
#
|
|
77
|
-
# The maximum values for *from*, *to* and *increment* is 9999,
|
|
78
|
-
# the minimum value is -999.
|
|
79
|
-
#
|
|
80
84
|
# Using a negative increment allows to count backwards.
|
|
81
85
|
#
|
|
82
86
|
# You can stop the counter at every time by calling BrickletSegmentDisplay4x7#set_segments.
|
|
83
87
|
def start_counter(value_from, value_to, increment, length)
|
|
84
|
-
|
|
88
|
+
check_validity
|
|
89
|
+
|
|
90
|
+
send_request FUNCTION_START_COUNTER, [value_from, value_to, increment, length], 's s s L', 8, ''
|
|
85
91
|
end
|
|
86
92
|
|
|
87
93
|
# Returns the counter value that is currently shown on the display.
|
|
88
94
|
#
|
|
89
95
|
# If there is no counter running a 0 will be returned.
|
|
90
96
|
def get_counter_value
|
|
91
|
-
|
|
97
|
+
check_validity
|
|
98
|
+
|
|
99
|
+
send_request FUNCTION_GET_COUNTER_VALUE, [], '', 10, 'S'
|
|
92
100
|
end
|
|
93
101
|
|
|
94
102
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
95
103
|
# the position, the hardware and firmware version as well as the
|
|
96
104
|
# device identifier.
|
|
97
105
|
#
|
|
98
|
-
# The position can be 'a', 'b', 'c' or '
|
|
106
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
107
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
108
|
+
# position 'z'.
|
|
99
109
|
#
|
|
100
110
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
101
111
|
# |device_identifier_constant|
|
|
102
112
|
def get_identity
|
|
103
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
113
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
104
114
|
end
|
|
105
115
|
|
|
106
116
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on
|
|
3
|
+
# This file was automatically generated on 2020-11-02. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.27 #
|
|
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 #
|
|
9
9
|
# to the generators git repository on tinkerforge.com #
|
|
10
10
|
#############################################################
|
|
11
11
|
|
|
12
|
+
require_relative './ip_connection'
|
|
13
|
+
|
|
12
14
|
module Tinkerforge
|
|
13
15
|
# Four 7-segment displays with switchable dots
|
|
14
16
|
class BrickletSegmentDisplay4x7V2 < Device
|
|
@@ -60,7 +62,7 @@ module Tinkerforge
|
|
|
60
62
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
61
63
|
# the IP Connection <tt>ipcon</tt>.
|
|
62
64
|
def initialize(uid, ipcon)
|
|
63
|
-
super uid, ipcon
|
|
65
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
64
66
|
|
|
65
67
|
@api_version = [2, 0, 0]
|
|
66
68
|
|
|
@@ -86,8 +88,9 @@ module Tinkerforge
|
|
|
86
88
|
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
87
89
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
88
90
|
|
|
89
|
-
@callback_formats[CALLBACK_COUNTER_FINISHED] = ''
|
|
91
|
+
@callback_formats[CALLBACK_COUNTER_FINISHED] = [8, '']
|
|
90
92
|
|
|
93
|
+
@ipcon.add_device self
|
|
91
94
|
end
|
|
92
95
|
|
|
93
96
|
# Sets the segments of the Segment Display 4x7 Bricklet 2.0 segment-by-segment.
|
|
@@ -101,28 +104,33 @@ module Tinkerforge
|
|
|
101
104
|
# :alt: Indices of segments
|
|
102
105
|
# :align: center
|
|
103
106
|
def set_segments(digit0, digit1, digit2, digit3, colon, tick)
|
|
104
|
-
|
|
107
|
+
check_validity
|
|
108
|
+
|
|
109
|
+
send_request FUNCTION_SET_SEGMENTS, [digit0, digit1, digit2, digit3, colon, tick], '?8 ?8 ?8 ?8 ?2 ?', 8, ''
|
|
105
110
|
end
|
|
106
111
|
|
|
107
112
|
# Returns the segment data as set by BrickletSegmentDisplay4x7V2#set_segments.
|
|
108
113
|
def get_segments
|
|
109
|
-
|
|
114
|
+
check_validity
|
|
115
|
+
|
|
116
|
+
send_request FUNCTION_GET_SEGMENTS, [], '', 14, '?8 ?8 ?8 ?8 ?2 ?'
|
|
110
117
|
end
|
|
111
118
|
|
|
112
|
-
# The brightness can be set between 0 (dark) and 7 (bright).
|
|
113
|
-
#
|
|
114
|
-
# The default value is 7.
|
|
119
|
+
# The brightness can be set between 0 (dark) and 7 (bright).
|
|
115
120
|
def set_brightness(brightness)
|
|
116
|
-
|
|
121
|
+
check_validity
|
|
122
|
+
|
|
123
|
+
send_request FUNCTION_SET_BRIGHTNESS, [brightness], 'C', 8, ''
|
|
117
124
|
end
|
|
118
125
|
|
|
119
126
|
# Returns the brightness as set by BrickletSegmentDisplay4x7V2#set_brightness.
|
|
120
127
|
def get_brightness
|
|
121
|
-
|
|
128
|
+
check_validity
|
|
129
|
+
|
|
130
|
+
send_request FUNCTION_GET_BRIGHTNESS, [], '', 9, 'C'
|
|
122
131
|
end
|
|
123
132
|
|
|
124
|
-
# Sets a numeric value for each of the digits.
|
|
125
|
-
# -2 and 15. They represent:
|
|
133
|
+
# Sets a numeric value for each of the digits. They represent:
|
|
126
134
|
#
|
|
127
135
|
# * -2: minus sign
|
|
128
136
|
# * -1: blank
|
|
@@ -136,7 +144,9 @@ module Tinkerforge
|
|
|
136
144
|
#
|
|
137
145
|
# Example: A call with [-2, -1, 4, 2] will result in a display of "- 42".
|
|
138
146
|
def set_numeric_value(value)
|
|
139
|
-
|
|
147
|
+
check_validity
|
|
148
|
+
|
|
149
|
+
send_request FUNCTION_SET_NUMERIC_VALUE, [value], 'c4', 8, ''
|
|
140
150
|
end
|
|
141
151
|
|
|
142
152
|
# Turns one specified segment on or off.
|
|
@@ -148,38 +158,43 @@ module Tinkerforge
|
|
|
148
158
|
# :alt: Indices of selected segments
|
|
149
159
|
# :align: center
|
|
150
160
|
def set_selected_segment(segment, value)
|
|
151
|
-
|
|
161
|
+
check_validity
|
|
162
|
+
|
|
163
|
+
send_request FUNCTION_SET_SELECTED_SEGMENT, [segment, value], 'C ?', 8, ''
|
|
152
164
|
end
|
|
153
165
|
|
|
154
166
|
# Returns the value of a single segment.
|
|
155
167
|
def get_selected_segment(segment)
|
|
156
|
-
|
|
168
|
+
check_validity
|
|
169
|
+
|
|
170
|
+
send_request FUNCTION_GET_SELECTED_SEGMENT, [segment], 'C', 9, '?'
|
|
157
171
|
end
|
|
158
172
|
|
|
159
173
|
# Starts a counter with the *from* value that counts to the *to*
|
|
160
174
|
# value with the each step incremented by *increment*.
|
|
161
|
-
#
|
|
175
|
+
# *length* is the pause between each increment.
|
|
162
176
|
#
|
|
163
177
|
# Example: If you set *from* to 0, *to* to 100, *increment* to 1 and
|
|
164
178
|
# *length* to 1000, a counter that goes from 0 to 100 with one second
|
|
165
179
|
# pause between each increment will be started.
|
|
166
180
|
#
|
|
167
|
-
# The maximum values for *from*, *to* and *increment* is 9999,
|
|
168
|
-
# the minimum value is -999.
|
|
169
|
-
#
|
|
170
181
|
# Using a negative *increment* allows to count backwards.
|
|
171
182
|
#
|
|
172
183
|
# You can stop the counter at every time by calling BrickletSegmentDisplay4x7V2#set_segments
|
|
173
184
|
# or BrickletSegmentDisplay4x7V2#set_numeric_value.
|
|
174
185
|
def start_counter(value_from, value_to, increment, length)
|
|
175
|
-
|
|
186
|
+
check_validity
|
|
187
|
+
|
|
188
|
+
send_request FUNCTION_START_COUNTER, [value_from, value_to, increment, length], 's s s L', 8, ''
|
|
176
189
|
end
|
|
177
190
|
|
|
178
191
|
# Returns the counter value that is currently shown on the display.
|
|
179
192
|
#
|
|
180
193
|
# If there is no counter running a 0 will be returned.
|
|
181
194
|
def get_counter_value
|
|
182
|
-
|
|
195
|
+
check_validity
|
|
196
|
+
|
|
197
|
+
send_request FUNCTION_GET_COUNTER_VALUE, [], '', 10, 'S'
|
|
183
198
|
end
|
|
184
199
|
|
|
185
200
|
# Returns the error count for the communication between Brick and Bricklet.
|
|
@@ -194,7 +209,9 @@ module Tinkerforge
|
|
|
194
209
|
# The errors counts are for errors that occur on the Bricklet side. All
|
|
195
210
|
# Bricks have a similar function that returns the errors on the Brick side.
|
|
196
211
|
def get_spitfp_error_count
|
|
197
|
-
|
|
212
|
+
check_validity
|
|
213
|
+
|
|
214
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
|
198
215
|
end
|
|
199
216
|
|
|
200
217
|
# Sets the bootloader mode and returns the status after the requested
|
|
@@ -207,12 +224,16 @@ module Tinkerforge
|
|
|
207
224
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
208
225
|
# necessary to call it in a normal user program.
|
|
209
226
|
def set_bootloader_mode(mode)
|
|
210
|
-
|
|
227
|
+
check_validity
|
|
228
|
+
|
|
229
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
|
211
230
|
end
|
|
212
231
|
|
|
213
232
|
# Returns the current bootloader mode, see BrickletSegmentDisplay4x7V2#set_bootloader_mode.
|
|
214
233
|
def get_bootloader_mode
|
|
215
|
-
|
|
234
|
+
check_validity
|
|
235
|
+
|
|
236
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
|
216
237
|
end
|
|
217
238
|
|
|
218
239
|
# Sets the firmware pointer for BrickletSegmentDisplay4x7V2#write_firmware. The pointer has
|
|
@@ -222,7 +243,9 @@ module Tinkerforge
|
|
|
222
243
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
223
244
|
# necessary to call it in a normal user program.
|
|
224
245
|
def set_write_firmware_pointer(pointer)
|
|
225
|
-
|
|
246
|
+
check_validity
|
|
247
|
+
|
|
248
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
|
226
249
|
end
|
|
227
250
|
|
|
228
251
|
# Writes 64 Bytes of firmware at the position as written by
|
|
@@ -234,7 +257,9 @@ module Tinkerforge
|
|
|
234
257
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
235
258
|
# necessary to call it in a normal user program.
|
|
236
259
|
def write_firmware(data)
|
|
237
|
-
|
|
260
|
+
check_validity
|
|
261
|
+
|
|
262
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
|
238
263
|
end
|
|
239
264
|
|
|
240
265
|
# Sets the status LED configuration. By default the LED shows
|
|
@@ -245,22 +270,28 @@ module Tinkerforge
|
|
|
245
270
|
#
|
|
246
271
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
|
247
272
|
def set_status_led_config(config)
|
|
248
|
-
|
|
273
|
+
check_validity
|
|
274
|
+
|
|
275
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
|
249
276
|
end
|
|
250
277
|
|
|
251
278
|
# Returns the configuration as set by BrickletSegmentDisplay4x7V2#set_status_led_config
|
|
252
279
|
def get_status_led_config
|
|
253
|
-
|
|
280
|
+
check_validity
|
|
281
|
+
|
|
282
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
|
254
283
|
end
|
|
255
284
|
|
|
256
|
-
# Returns the temperature
|
|
285
|
+
# Returns the temperature as measured inside the microcontroller. The
|
|
257
286
|
# value returned is not the ambient temperature!
|
|
258
287
|
#
|
|
259
288
|
# The temperature is only proportional to the real temperature and it has bad
|
|
260
289
|
# accuracy. Practically it is only useful as an indicator for
|
|
261
290
|
# temperature changes.
|
|
262
291
|
def get_chip_temperature
|
|
263
|
-
|
|
292
|
+
check_validity
|
|
293
|
+
|
|
294
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
|
264
295
|
end
|
|
265
296
|
|
|
266
297
|
# Calling this function will reset the Bricklet. All configurations
|
|
@@ -270,7 +301,9 @@ module Tinkerforge
|
|
|
270
301
|
# calling functions on the existing ones will result in
|
|
271
302
|
# undefined behavior!
|
|
272
303
|
def reset
|
|
273
|
-
|
|
304
|
+
check_validity
|
|
305
|
+
|
|
306
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
|
274
307
|
end
|
|
275
308
|
|
|
276
309
|
# Writes a new UID into flash. If you want to set a new UID
|
|
@@ -279,25 +312,31 @@ module Tinkerforge
|
|
|
279
312
|
#
|
|
280
313
|
# We recommend that you use Brick Viewer to change the UID.
|
|
281
314
|
def write_uid(uid)
|
|
282
|
-
|
|
315
|
+
check_validity
|
|
316
|
+
|
|
317
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
|
283
318
|
end
|
|
284
319
|
|
|
285
320
|
# Returns the current UID as an integer. Encode as
|
|
286
321
|
# Base58 to get the usual string version.
|
|
287
322
|
def read_uid
|
|
288
|
-
|
|
323
|
+
check_validity
|
|
324
|
+
|
|
325
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
|
289
326
|
end
|
|
290
327
|
|
|
291
328
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
292
329
|
# the position, the hardware and firmware version as well as the
|
|
293
330
|
# device identifier.
|
|
294
331
|
#
|
|
295
|
-
# The position can be 'a', 'b', 'c' or '
|
|
332
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
333
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
334
|
+
# position 'z'.
|
|
296
335
|
#
|
|
297
336
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
298
337
|
# |device_identifier_constant|
|
|
299
338
|
def get_identity
|
|
300
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
339
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
301
340
|
end
|
|
302
341
|
|
|
303
342
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on
|
|
3
|
+
# This file was automatically generated on 2020-11-02. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.27 #
|
|
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 #
|
|
9
9
|
# to the generators git repository on tinkerforge.com #
|
|
10
10
|
#############################################################
|
|
11
11
|
|
|
12
|
+
require_relative './ip_connection'
|
|
13
|
+
|
|
12
14
|
module Tinkerforge
|
|
13
15
|
# Controls AC and DC Solid State Relays
|
|
14
16
|
class BrickletSolidStateRelay < Device
|
|
@@ -30,7 +32,7 @@ module Tinkerforge
|
|
|
30
32
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
31
33
|
# the IP Connection <tt>ipcon</tt>.
|
|
32
34
|
def initialize(uid, ipcon)
|
|
33
|
-
super uid, ipcon
|
|
35
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
34
36
|
|
|
35
37
|
@api_version = [2, 0, 0]
|
|
36
38
|
|
|
@@ -40,26 +42,29 @@ module Tinkerforge
|
|
|
40
42
|
@response_expected[FUNCTION_GET_MONOFLOP] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
41
43
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
42
44
|
|
|
43
|
-
@callback_formats[CALLBACK_MONOFLOP_DONE] = '?'
|
|
45
|
+
@callback_formats[CALLBACK_MONOFLOP_DONE] = [9, '?']
|
|
44
46
|
|
|
47
|
+
@ipcon.add_device self
|
|
45
48
|
end
|
|
46
49
|
|
|
47
50
|
# Sets the state of the relays *true* means on and *false* means off.
|
|
48
51
|
#
|
|
49
52
|
# A running monoflop timer will be aborted if this function is called.
|
|
50
|
-
#
|
|
51
|
-
# The default value is *false*.
|
|
52
53
|
def set_state(state)
|
|
53
|
-
|
|
54
|
+
check_validity
|
|
55
|
+
|
|
56
|
+
send_request FUNCTION_SET_STATE, [state], '?', 8, ''
|
|
54
57
|
end
|
|
55
58
|
|
|
56
59
|
# Returns the state of the relay, *true* means on and *false* means off.
|
|
57
60
|
def get_state
|
|
58
|
-
|
|
61
|
+
check_validity
|
|
62
|
+
|
|
63
|
+
send_request FUNCTION_GET_STATE, [], '', 9, '?'
|
|
59
64
|
end
|
|
60
65
|
|
|
61
66
|
# The first parameter is the desired state of the relay (*true* means on
|
|
62
|
-
# and *false* means off). The second parameter indicates the time
|
|
67
|
+
# and *false* means off). The second parameter indicates the time that
|
|
63
68
|
# the relay should hold the state.
|
|
64
69
|
#
|
|
65
70
|
# If this function is called with the parameters (true, 1500):
|
|
@@ -71,7 +76,9 @@ module Tinkerforge
|
|
|
71
76
|
# of two seconds. The relay will be on all the time. If now the RS485
|
|
72
77
|
# connection is lost, the relay will turn off in at most two seconds.
|
|
73
78
|
def set_monoflop(state, time)
|
|
74
|
-
|
|
79
|
+
check_validity
|
|
80
|
+
|
|
81
|
+
send_request FUNCTION_SET_MONOFLOP, [state, time], '? L', 8, ''
|
|
75
82
|
end
|
|
76
83
|
|
|
77
84
|
# Returns the current state and the time as set by
|
|
@@ -80,19 +87,23 @@ module Tinkerforge
|
|
|
80
87
|
# If the timer is not running currently, the remaining time will be returned
|
|
81
88
|
# as 0.
|
|
82
89
|
def get_monoflop
|
|
83
|
-
|
|
90
|
+
check_validity
|
|
91
|
+
|
|
92
|
+
send_request FUNCTION_GET_MONOFLOP, [], '', 17, '? L L'
|
|
84
93
|
end
|
|
85
94
|
|
|
86
95
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
87
96
|
# the position, the hardware and firmware version as well as the
|
|
88
97
|
# device identifier.
|
|
89
98
|
#
|
|
90
|
-
# The position can be 'a', 'b', 'c' or '
|
|
99
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
100
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
101
|
+
# position 'z'.
|
|
91
102
|
#
|
|
92
103
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
93
104
|
# |device_identifier_constant|
|
|
94
105
|
def get_identity
|
|
95
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
106
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
96
107
|
end
|
|
97
108
|
|
|
98
109
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|