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
|
# Passive infrared (PIR) motion sensor with 7m range
|
|
14
16
|
class BrickletMotionDetector < Device
|
|
@@ -37,7 +39,7 @@ module Tinkerforge
|
|
|
37
39
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
38
40
|
# the IP Connection <tt>ipcon</tt>.
|
|
39
41
|
def initialize(uid, ipcon)
|
|
40
|
-
super uid, ipcon
|
|
42
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
41
43
|
|
|
42
44
|
@api_version = [2, 0, 1]
|
|
43
45
|
|
|
@@ -46,9 +48,10 @@ module Tinkerforge
|
|
|
46
48
|
@response_expected[FUNCTION_GET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
47
49
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
48
50
|
|
|
49
|
-
@callback_formats[CALLBACK_MOTION_DETECTED] = ''
|
|
50
|
-
@callback_formats[CALLBACK_DETECTION_CYCLE_ENDED] = ''
|
|
51
|
+
@callback_formats[CALLBACK_MOTION_DETECTED] = [8, '']
|
|
52
|
+
@callback_formats[CALLBACK_DETECTION_CYCLE_ENDED] = [8, '']
|
|
51
53
|
|
|
54
|
+
@ipcon.add_device self
|
|
52
55
|
end
|
|
53
56
|
|
|
54
57
|
# Returns 1 if a motion was detected. How long this returns 1 after a motion
|
|
@@ -59,7 +62,9 @@ module Tinkerforge
|
|
|
59
62
|
# There is also a blue LED on the Bricklet that is on as long as the Bricklet is
|
|
60
63
|
# in the "motion detected" state.
|
|
61
64
|
def get_motion_detected
|
|
62
|
-
|
|
65
|
+
check_validity
|
|
66
|
+
|
|
67
|
+
send_request FUNCTION_GET_MOTION_DETECTED, [], '', 9, 'C'
|
|
63
68
|
end
|
|
64
69
|
|
|
65
70
|
# Sets the status led configuration.
|
|
@@ -71,26 +76,32 @@ module Tinkerforge
|
|
|
71
76
|
#
|
|
72
77
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
|
73
78
|
def set_status_led_config(config)
|
|
74
|
-
|
|
79
|
+
check_validity
|
|
80
|
+
|
|
81
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
|
75
82
|
end
|
|
76
83
|
|
|
77
84
|
# Returns the configuration as set by BrickletMotionDetector#set_status_led_config.
|
|
78
85
|
#
|
|
79
86
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
|
80
87
|
def get_status_led_config
|
|
81
|
-
|
|
88
|
+
check_validity
|
|
89
|
+
|
|
90
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
|
82
91
|
end
|
|
83
92
|
|
|
84
93
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
85
94
|
# the position, the hardware and firmware version as well as the
|
|
86
95
|
# device identifier.
|
|
87
96
|
#
|
|
88
|
-
# The position can be 'a', 'b', 'c' or '
|
|
97
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
98
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
99
|
+
# position 'z'.
|
|
89
100
|
#
|
|
90
101
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
91
102
|
# |device_identifier_constant|
|
|
92
103
|
def get_identity
|
|
93
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
104
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
94
105
|
end
|
|
95
106
|
|
|
96
107
|
# 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
|
# Passive infrared (PIR) motion sensor with 12m range and dimmable backlight
|
|
14
16
|
class BrickletMotionDetectorV2 < Device
|
|
@@ -62,7 +64,7 @@ module Tinkerforge
|
|
|
62
64
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
63
65
|
# the IP Connection <tt>ipcon</tt>.
|
|
64
66
|
def initialize(uid, ipcon)
|
|
65
|
-
super uid, ipcon
|
|
67
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
66
68
|
|
|
67
69
|
@api_version = [2, 0, 0]
|
|
68
70
|
|
|
@@ -84,9 +86,10 @@ module Tinkerforge
|
|
|
84
86
|
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
85
87
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
86
88
|
|
|
87
|
-
@callback_formats[CALLBACK_MOTION_DETECTED] = ''
|
|
88
|
-
@callback_formats[CALLBACK_DETECTION_CYCLE_ENDED] = ''
|
|
89
|
+
@callback_formats[CALLBACK_MOTION_DETECTED] = [8, '']
|
|
90
|
+
@callback_formats[CALLBACK_DETECTION_CYCLE_ENDED] = [8, '']
|
|
89
91
|
|
|
92
|
+
@ipcon.add_device self
|
|
90
93
|
end
|
|
91
94
|
|
|
92
95
|
# Returns 1 if a motion was detected. It returns 1 approx. for 1.8 seconds
|
|
@@ -95,10 +98,12 @@ module Tinkerforge
|
|
|
95
98
|
# There is also a blue LED on the Bricklet that is on as long as the Bricklet is
|
|
96
99
|
# in the "motion detected" state.
|
|
97
100
|
def get_motion_detected
|
|
98
|
-
|
|
101
|
+
check_validity
|
|
102
|
+
|
|
103
|
+
send_request FUNCTION_GET_MOTION_DETECTED, [], '', 9, 'C'
|
|
99
104
|
end
|
|
100
105
|
|
|
101
|
-
# Sets the sensitivity of the PIR sensor.
|
|
106
|
+
# Sets the sensitivity of the PIR sensor. At full
|
|
102
107
|
# sensitivity (100), the Bricklet can detect motion in a range of approximately 12m.
|
|
103
108
|
#
|
|
104
109
|
# The actual range depends on many things in the environment (e.g. reflections) and the
|
|
@@ -106,30 +111,34 @@ module Tinkerforge
|
|
|
106
111
|
# of 10m a cat may only be detected at 2m distance with the same setting.
|
|
107
112
|
#
|
|
108
113
|
# So you will have to find a good sensitivity for your application by trial and error.
|
|
109
|
-
#
|
|
110
|
-
# The default value is 50.
|
|
111
114
|
def set_sensitivity(sensitivity)
|
|
112
|
-
|
|
115
|
+
check_validity
|
|
116
|
+
|
|
117
|
+
send_request FUNCTION_SET_SENSITIVITY, [sensitivity], 'C', 8, ''
|
|
113
118
|
end
|
|
114
119
|
|
|
115
120
|
# Returns the sensitivity as set by BrickletMotionDetectorV2#set_sensitivity.
|
|
116
121
|
def get_sensitivity
|
|
117
|
-
|
|
122
|
+
check_validity
|
|
123
|
+
|
|
124
|
+
send_request FUNCTION_GET_SENSITIVITY, [], '', 9, 'C'
|
|
118
125
|
end
|
|
119
126
|
|
|
120
127
|
# Sets the blue backlight of the fresnel lens. The backlight consists of
|
|
121
128
|
# three LEDs. The brightness of each LED can be controlled with a 8-bit value
|
|
122
129
|
# (0-255). A value of 0 turns the LED off and a value of 255 turns the LED
|
|
123
130
|
# to full brightness.
|
|
124
|
-
#
|
|
125
|
-
# The default value is 0, 0, 0.
|
|
126
131
|
def set_indicator(top_left, top_right, bottom)
|
|
127
|
-
|
|
132
|
+
check_validity
|
|
133
|
+
|
|
134
|
+
send_request FUNCTION_SET_INDICATOR, [top_left, top_right, bottom], 'C C C', 8, ''
|
|
128
135
|
end
|
|
129
136
|
|
|
130
137
|
# Returns the indicator configuration as set by BrickletMotionDetectorV2#set_indicator.
|
|
131
138
|
def get_indicator
|
|
132
|
-
|
|
139
|
+
check_validity
|
|
140
|
+
|
|
141
|
+
send_request FUNCTION_GET_INDICATOR, [], '', 11, 'C C C'
|
|
133
142
|
end
|
|
134
143
|
|
|
135
144
|
# Returns the error count for the communication between Brick and Bricklet.
|
|
@@ -144,7 +153,9 @@ module Tinkerforge
|
|
|
144
153
|
# The errors counts are for errors that occur on the Bricklet side. All
|
|
145
154
|
# Bricks have a similar function that returns the errors on the Brick side.
|
|
146
155
|
def get_spitfp_error_count
|
|
147
|
-
|
|
156
|
+
check_validity
|
|
157
|
+
|
|
158
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
|
148
159
|
end
|
|
149
160
|
|
|
150
161
|
# Sets the bootloader mode and returns the status after the requested
|
|
@@ -157,12 +168,16 @@ module Tinkerforge
|
|
|
157
168
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
158
169
|
# necessary to call it in a normal user program.
|
|
159
170
|
def set_bootloader_mode(mode)
|
|
160
|
-
|
|
171
|
+
check_validity
|
|
172
|
+
|
|
173
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
|
161
174
|
end
|
|
162
175
|
|
|
163
176
|
# Returns the current bootloader mode, see BrickletMotionDetectorV2#set_bootloader_mode.
|
|
164
177
|
def get_bootloader_mode
|
|
165
|
-
|
|
178
|
+
check_validity
|
|
179
|
+
|
|
180
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
|
166
181
|
end
|
|
167
182
|
|
|
168
183
|
# Sets the firmware pointer for BrickletMotionDetectorV2#write_firmware. The pointer has
|
|
@@ -172,7 +187,9 @@ module Tinkerforge
|
|
|
172
187
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
173
188
|
# necessary to call it in a normal user program.
|
|
174
189
|
def set_write_firmware_pointer(pointer)
|
|
175
|
-
|
|
190
|
+
check_validity
|
|
191
|
+
|
|
192
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
|
176
193
|
end
|
|
177
194
|
|
|
178
195
|
# Writes 64 Bytes of firmware at the position as written by
|
|
@@ -184,7 +201,9 @@ module Tinkerforge
|
|
|
184
201
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
185
202
|
# necessary to call it in a normal user program.
|
|
186
203
|
def write_firmware(data)
|
|
187
|
-
|
|
204
|
+
check_validity
|
|
205
|
+
|
|
206
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
|
188
207
|
end
|
|
189
208
|
|
|
190
209
|
# Sets the status LED configuration. By default the LED shows
|
|
@@ -195,22 +214,28 @@ module Tinkerforge
|
|
|
195
214
|
#
|
|
196
215
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
|
197
216
|
def set_status_led_config(config)
|
|
198
|
-
|
|
217
|
+
check_validity
|
|
218
|
+
|
|
219
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
|
199
220
|
end
|
|
200
221
|
|
|
201
222
|
# Returns the configuration as set by BrickletMotionDetectorV2#set_status_led_config
|
|
202
223
|
def get_status_led_config
|
|
203
|
-
|
|
224
|
+
check_validity
|
|
225
|
+
|
|
226
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
|
204
227
|
end
|
|
205
228
|
|
|
206
|
-
# Returns the temperature
|
|
229
|
+
# Returns the temperature as measured inside the microcontroller. The
|
|
207
230
|
# value returned is not the ambient temperature!
|
|
208
231
|
#
|
|
209
232
|
# The temperature is only proportional to the real temperature and it has bad
|
|
210
233
|
# accuracy. Practically it is only useful as an indicator for
|
|
211
234
|
# temperature changes.
|
|
212
235
|
def get_chip_temperature
|
|
213
|
-
|
|
236
|
+
check_validity
|
|
237
|
+
|
|
238
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
|
214
239
|
end
|
|
215
240
|
|
|
216
241
|
# Calling this function will reset the Bricklet. All configurations
|
|
@@ -220,7 +245,9 @@ module Tinkerforge
|
|
|
220
245
|
# calling functions on the existing ones will result in
|
|
221
246
|
# undefined behavior!
|
|
222
247
|
def reset
|
|
223
|
-
|
|
248
|
+
check_validity
|
|
249
|
+
|
|
250
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
|
224
251
|
end
|
|
225
252
|
|
|
226
253
|
# Writes a new UID into flash. If you want to set a new UID
|
|
@@ -229,25 +256,31 @@ module Tinkerforge
|
|
|
229
256
|
#
|
|
230
257
|
# We recommend that you use Brick Viewer to change the UID.
|
|
231
258
|
def write_uid(uid)
|
|
232
|
-
|
|
259
|
+
check_validity
|
|
260
|
+
|
|
261
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
|
233
262
|
end
|
|
234
263
|
|
|
235
264
|
# Returns the current UID as an integer. Encode as
|
|
236
265
|
# Base58 to get the usual string version.
|
|
237
266
|
def read_uid
|
|
238
|
-
|
|
267
|
+
check_validity
|
|
268
|
+
|
|
269
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
|
239
270
|
end
|
|
240
271
|
|
|
241
272
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
242
273
|
# the position, the hardware and firmware version as well as the
|
|
243
274
|
# device identifier.
|
|
244
275
|
#
|
|
245
|
-
# The position can be 'a', 'b', 'c' or '
|
|
276
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
277
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
278
|
+
# position 'z'.
|
|
246
279
|
#
|
|
247
280
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
248
281
|
# |device_identifier_constant|
|
|
249
282
|
def get_identity
|
|
250
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
283
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
251
284
|
end
|
|
252
285
|
|
|
253
286
|
# 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
|
# Motorized Linear Potentiometer
|
|
14
16
|
class BrickletMotorizedLinearPoti < Device
|
|
@@ -74,7 +76,7 @@ module Tinkerforge
|
|
|
74
76
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
75
77
|
# the IP Connection <tt>ipcon</tt>.
|
|
76
78
|
def initialize(uid, ipcon)
|
|
77
|
-
super uid, ipcon
|
|
79
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
78
80
|
|
|
79
81
|
@api_version = [2, 0, 0]
|
|
80
82
|
|
|
@@ -99,9 +101,10 @@ module Tinkerforge
|
|
|
99
101
|
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
100
102
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
101
103
|
|
|
102
|
-
@callback_formats[CALLBACK_POSITION] = 'S'
|
|
103
|
-
@callback_formats[CALLBACK_POSITION_REACHED] = 'S'
|
|
104
|
+
@callback_formats[CALLBACK_POSITION] = [10, 'S']
|
|
105
|
+
@callback_formats[CALLBACK_POSITION_REACHED] = [10, 'S']
|
|
104
106
|
|
|
107
|
+
@ipcon.add_device self
|
|
105
108
|
end
|
|
106
109
|
|
|
107
110
|
# Returns the position of the linear potentiometer. The value is
|
|
@@ -112,10 +115,12 @@ module Tinkerforge
|
|
|
112
115
|
# CALLBACK_POSITION callback. You can set the callback configuration
|
|
113
116
|
# with BrickletMotorizedLinearPoti#set_position_callback_configuration.
|
|
114
117
|
def get_position
|
|
115
|
-
|
|
118
|
+
check_validity
|
|
119
|
+
|
|
120
|
+
send_request FUNCTION_GET_POSITION, [], '', 10, 'S'
|
|
116
121
|
end
|
|
117
122
|
|
|
118
|
-
# The period
|
|
123
|
+
# The period is the period with which the CALLBACK_POSITION callback is triggered
|
|
119
124
|
# periodically. A value of 0 turns the callback off.
|
|
120
125
|
#
|
|
121
126
|
# If the `value has to change`-parameter is set to true, the callback is only
|
|
@@ -140,15 +145,17 @@ module Tinkerforge
|
|
|
140
145
|
# "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
|
|
141
146
|
#
|
|
142
147
|
# If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
|
|
143
|
-
#
|
|
144
|
-
# The default value is (0, false, 'x', 0, 0).
|
|
145
148
|
def set_position_callback_configuration(period, value_has_to_change, option, min, max)
|
|
146
|
-
|
|
149
|
+
check_validity
|
|
150
|
+
|
|
151
|
+
send_request FUNCTION_SET_POSITION_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k S S', 8, ''
|
|
147
152
|
end
|
|
148
153
|
|
|
149
154
|
# Returns the callback configuration as set by BrickletMotorizedLinearPoti#set_position_callback_configuration.
|
|
150
155
|
def get_position_callback_configuration
|
|
151
|
-
|
|
156
|
+
check_validity
|
|
157
|
+
|
|
158
|
+
send_request FUNCTION_GET_POSITION_CALLBACK_CONFIGURATION, [], '', 18, 'L ? k S S'
|
|
152
159
|
end
|
|
153
160
|
|
|
154
161
|
# Sets the position of the potentiometer. The motorized potentiometer will
|
|
@@ -165,7 +172,9 @@ module Tinkerforge
|
|
|
165
172
|
# If the hold position parameter is set to false, the potentiometer can be changed
|
|
166
173
|
# again by the user as soon as the set point was reached once.
|
|
167
174
|
def set_motor_position(position, drive_mode, hold_position)
|
|
168
|
-
|
|
175
|
+
check_validity
|
|
176
|
+
|
|
177
|
+
send_request FUNCTION_SET_MOTOR_POSITION, [position, drive_mode, hold_position], 'S C ?', 8, ''
|
|
169
178
|
end
|
|
170
179
|
|
|
171
180
|
# Returns the last motor position as set by BrickletMotorizedLinearPoti#set_motor_position. This is not
|
|
@@ -175,7 +184,9 @@ module Tinkerforge
|
|
|
175
184
|
# The position reached parameter is true if the position has been reached at one point.
|
|
176
185
|
# The position may have been changed again in the meantime by the user.
|
|
177
186
|
def get_motor_position
|
|
178
|
-
|
|
187
|
+
check_validity
|
|
188
|
+
|
|
189
|
+
send_request FUNCTION_GET_MOTOR_POSITION, [], '', 13, 'S C ? ?'
|
|
179
190
|
end
|
|
180
191
|
|
|
181
192
|
# Starts a calibration procedure. The potentiometer will be driven to the extreme
|
|
@@ -186,20 +197,24 @@ module Tinkerforge
|
|
|
186
197
|
# The Motorized Linear Poti Bricklet is already factory-calibrated during
|
|
187
198
|
# testing at Tinkerforge.
|
|
188
199
|
def calibrate
|
|
189
|
-
|
|
200
|
+
check_validity
|
|
201
|
+
|
|
202
|
+
send_request FUNCTION_CALIBRATE, [], '', 8, ''
|
|
190
203
|
end
|
|
191
204
|
|
|
192
205
|
# Enables/Disables CALLBACK_POSITION_REACHED callback.
|
|
193
|
-
#
|
|
194
|
-
# By default the callback is enabled.
|
|
195
206
|
def set_position_reached_callback_configuration(enabled)
|
|
196
|
-
|
|
207
|
+
check_validity
|
|
208
|
+
|
|
209
|
+
send_request FUNCTION_SET_POSITION_REACHED_CALLBACK_CONFIGURATION, [enabled], '?', 8, ''
|
|
197
210
|
end
|
|
198
211
|
|
|
199
212
|
# Returns the CALLBACK_POSITION_REACHED callback configuration
|
|
200
213
|
# as set by BrickletMotorizedLinearPoti#set_position_reached_callback_configuration.
|
|
201
214
|
def get_position_reached_callback_configuration
|
|
202
|
-
|
|
215
|
+
check_validity
|
|
216
|
+
|
|
217
|
+
send_request FUNCTION_GET_POSITION_REACHED_CALLBACK_CONFIGURATION, [], '', 9, '?'
|
|
203
218
|
end
|
|
204
219
|
|
|
205
220
|
# Returns the error count for the communication between Brick and Bricklet.
|
|
@@ -214,7 +229,9 @@ module Tinkerforge
|
|
|
214
229
|
# The errors counts are for errors that occur on the Bricklet side. All
|
|
215
230
|
# Bricks have a similar function that returns the errors on the Brick side.
|
|
216
231
|
def get_spitfp_error_count
|
|
217
|
-
|
|
232
|
+
check_validity
|
|
233
|
+
|
|
234
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
|
218
235
|
end
|
|
219
236
|
|
|
220
237
|
# Sets the bootloader mode and returns the status after the requested
|
|
@@ -227,12 +244,16 @@ module Tinkerforge
|
|
|
227
244
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
228
245
|
# necessary to call it in a normal user program.
|
|
229
246
|
def set_bootloader_mode(mode)
|
|
230
|
-
|
|
247
|
+
check_validity
|
|
248
|
+
|
|
249
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
|
231
250
|
end
|
|
232
251
|
|
|
233
252
|
# Returns the current bootloader mode, see BrickletMotorizedLinearPoti#set_bootloader_mode.
|
|
234
253
|
def get_bootloader_mode
|
|
235
|
-
|
|
254
|
+
check_validity
|
|
255
|
+
|
|
256
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
|
236
257
|
end
|
|
237
258
|
|
|
238
259
|
# Sets the firmware pointer for BrickletMotorizedLinearPoti#write_firmware. The pointer has
|
|
@@ -242,7 +263,9 @@ module Tinkerforge
|
|
|
242
263
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
243
264
|
# necessary to call it in a normal user program.
|
|
244
265
|
def set_write_firmware_pointer(pointer)
|
|
245
|
-
|
|
266
|
+
check_validity
|
|
267
|
+
|
|
268
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
|
246
269
|
end
|
|
247
270
|
|
|
248
271
|
# Writes 64 Bytes of firmware at the position as written by
|
|
@@ -254,7 +277,9 @@ module Tinkerforge
|
|
|
254
277
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
255
278
|
# necessary to call it in a normal user program.
|
|
256
279
|
def write_firmware(data)
|
|
257
|
-
|
|
280
|
+
check_validity
|
|
281
|
+
|
|
282
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
|
258
283
|
end
|
|
259
284
|
|
|
260
285
|
# Sets the status LED configuration. By default the LED shows
|
|
@@ -265,22 +290,28 @@ module Tinkerforge
|
|
|
265
290
|
#
|
|
266
291
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
|
267
292
|
def set_status_led_config(config)
|
|
268
|
-
|
|
293
|
+
check_validity
|
|
294
|
+
|
|
295
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
|
269
296
|
end
|
|
270
297
|
|
|
271
298
|
# Returns the configuration as set by BrickletMotorizedLinearPoti#set_status_led_config
|
|
272
299
|
def get_status_led_config
|
|
273
|
-
|
|
300
|
+
check_validity
|
|
301
|
+
|
|
302
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
|
274
303
|
end
|
|
275
304
|
|
|
276
|
-
# Returns the temperature
|
|
305
|
+
# Returns the temperature as measured inside the microcontroller. The
|
|
277
306
|
# value returned is not the ambient temperature!
|
|
278
307
|
#
|
|
279
308
|
# The temperature is only proportional to the real temperature and it has bad
|
|
280
309
|
# accuracy. Practically it is only useful as an indicator for
|
|
281
310
|
# temperature changes.
|
|
282
311
|
def get_chip_temperature
|
|
283
|
-
|
|
312
|
+
check_validity
|
|
313
|
+
|
|
314
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
|
284
315
|
end
|
|
285
316
|
|
|
286
317
|
# Calling this function will reset the Bricklet. All configurations
|
|
@@ -290,7 +321,9 @@ module Tinkerforge
|
|
|
290
321
|
# calling functions on the existing ones will result in
|
|
291
322
|
# undefined behavior!
|
|
292
323
|
def reset
|
|
293
|
-
|
|
324
|
+
check_validity
|
|
325
|
+
|
|
326
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
|
294
327
|
end
|
|
295
328
|
|
|
296
329
|
# Writes a new UID into flash. If you want to set a new UID
|
|
@@ -299,25 +332,31 @@ module Tinkerforge
|
|
|
299
332
|
#
|
|
300
333
|
# We recommend that you use Brick Viewer to change the UID.
|
|
301
334
|
def write_uid(uid)
|
|
302
|
-
|
|
335
|
+
check_validity
|
|
336
|
+
|
|
337
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
|
303
338
|
end
|
|
304
339
|
|
|
305
340
|
# Returns the current UID as an integer. Encode as
|
|
306
341
|
# Base58 to get the usual string version.
|
|
307
342
|
def read_uid
|
|
308
|
-
|
|
343
|
+
check_validity
|
|
344
|
+
|
|
345
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
|
309
346
|
end
|
|
310
347
|
|
|
311
348
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
312
349
|
# the position, the hardware and firmware version as well as the
|
|
313
350
|
# device identifier.
|
|
314
351
|
#
|
|
315
|
-
# The position can be 'a', 'b', 'c' or '
|
|
352
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
353
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
354
|
+
# position 'z'.
|
|
316
355
|
#
|
|
317
356
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
318
357
|
# |device_identifier_constant|
|
|
319
358
|
def get_identity
|
|
320
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
359
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
321
360
|
end
|
|
322
361
|
|
|
323
362
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|