tinkerforge 2.1.24 → 2.1.29
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 +156 -75
- data/lib/tinkerforge/brick_hat.rb +69 -31
- data/lib/tinkerforge/brick_hat_zero.rb +55 -23
- data/lib/tinkerforge/brick_imu.rb +185 -78
- data/lib/tinkerforge/brick_imu_v2.rb +209 -106
- data/lib/tinkerforge/brick_master.rb +491 -183
- data/lib/tinkerforge/brick_red.rb +197 -74
- data/lib/tinkerforge/brick_servo.rb +186 -102
- data/lib/tinkerforge/brick_silent_stepper.rb +247 -167
- data/lib/tinkerforge/brick_stepper.rb +211 -99
- data/lib/tinkerforge/bricklet_accelerometer.rb +57 -23
- data/lib/tinkerforge/bricklet_accelerometer_v2.rb +104 -54
- data/lib/tinkerforge/bricklet_air_quality.rb +116 -59
- data/lib/tinkerforge/bricklet_ambient_light.rb +50 -21
- data/lib/tinkerforge/bricklet_ambient_light_v2.rb +44 -24
- data/lib/tinkerforge/bricklet_ambient_light_v3.rb +65 -27
- data/lib/tinkerforge/bricklet_analog_in.rb +62 -25
- data/lib/tinkerforge/bricklet_analog_in_v2.rb +56 -23
- data/lib/tinkerforge/bricklet_analog_in_v3.rb +66 -25
- data/lib/tinkerforge/bricklet_analog_out.rb +22 -9
- data/lib/tinkerforge/bricklet_analog_out_v2.rb +19 -8
- data/lib/tinkerforge/bricklet_analog_out_v3.rb +53 -20
- data/lib/tinkerforge/bricklet_barometer.rb +100 -27
- data/lib/tinkerforge/bricklet_barometer_v2.rb +98 -37
- data/lib/tinkerforge/bricklet_can.rb +83 -19
- data/lib/tinkerforge/bricklet_can_v2.rb +171 -38
- data/lib/tinkerforge/bricklet_co2.rb +33 -14
- data/lib/tinkerforge/bricklet_co2_v2.rb +97 -38
- data/lib/tinkerforge/bricklet_color.rb +68 -27
- data/lib/tinkerforge/bricklet_color_v2.rb +86 -33
- data/lib/tinkerforge/bricklet_compass.rb +77 -30
- data/lib/tinkerforge/bricklet_current12.rb +57 -24
- data/lib/tinkerforge/bricklet_current25.rb +57 -24
- data/lib/tinkerforge/bricklet_dc_v2.rb +521 -0
- data/lib/tinkerforge/bricklet_distance_ir.rb +56 -23
- data/lib/tinkerforge/bricklet_distance_ir_v2.rb +82 -31
- data/lib/tinkerforge/bricklet_distance_us.rb +39 -16
- data/lib/tinkerforge/bricklet_distance_us_v2.rb +66 -25
- data/lib/tinkerforge/bricklet_dmx.rb +87 -34
- data/lib/tinkerforge/bricklet_dual_button.rb +23 -10
- data/lib/tinkerforge/bricklet_dual_button_v2.rb +63 -24
- data/lib/tinkerforge/bricklet_dual_relay.rb +26 -11
- data/lib/tinkerforge/bricklet_dust_detector.rb +39 -16
- data/lib/tinkerforge/bricklet_e_paper_296x128.rb +87 -32
- data/lib/tinkerforge/bricklet_energy_monitor.rb +72 -27
- data/lib/tinkerforge/bricklet_gps.rb +63 -26
- data/lib/tinkerforge/bricklet_gps_v2.rb +116 -47
- data/lib/tinkerforge/bricklet_hall_effect.rb +42 -23
- data/lib/tinkerforge/bricklet_hall_effect_v2.rb +70 -27
- data/lib/tinkerforge/bricklet_humidity.rb +50 -21
- data/lib/tinkerforge/bricklet_humidity_v2.rb +82 -31
- data/lib/tinkerforge/bricklet_imu_v3.rb +784 -0
- data/lib/tinkerforge/bricklet_industrial_analog_out.rb +37 -14
- data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +80 -29
- data/lib/tinkerforge/bricklet_industrial_counter.rb +100 -39
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +44 -17
- data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +76 -29
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +35 -14
- data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +72 -27
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +39 -16
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +79 -30
- data/lib/tinkerforge/bricklet_industrial_dual_ac_relay.rb +325 -0
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +48 -19
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +137 -31
- data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +60 -23
- data/lib/tinkerforge/bricklet_industrial_ptc.rb +475 -0
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +35 -14
- data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +66 -25
- data/lib/tinkerforge/bricklet_io16.rb +54 -21
- data/lib/tinkerforge/bricklet_io16_v2.rb +89 -34
- data/lib/tinkerforge/bricklet_io4.rb +54 -23
- data/lib/tinkerforge/bricklet_io4_v2.rb +95 -36
- data/lib/tinkerforge/bricklet_isolator.rb +72 -29
- data/lib/tinkerforge/bricklet_joystick.rb +58 -25
- data/lib/tinkerforge/bricklet_joystick_v2.rb +67 -26
- data/lib/tinkerforge/bricklet_laser_range_finder.rb +81 -32
- data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +95 -36
- data/lib/tinkerforge/bricklet_lcd_128x64.rb +191 -70
- data/lib/tinkerforge/bricklet_lcd_16x2.rb +44 -18
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +57 -23
- data/lib/tinkerforge/bricklet_led_strip.rb +59 -22
- data/lib/tinkerforge/bricklet_led_strip_v2.rb +90 -46
- data/lib/tinkerforge/bricklet_line.rb +33 -14
- data/lib/tinkerforge/bricklet_linear_poti.rb +50 -21
- data/lib/tinkerforge/bricklet_linear_poti_v2.rb +54 -21
- data/lib/tinkerforge/bricklet_load_cell.rb +60 -23
- data/lib/tinkerforge/bricklet_load_cell_v2.rb +79 -30
- data/lib/tinkerforge/bricklet_moisture.rb +39 -16
- data/lib/tinkerforge/bricklet_motion_detector.rb +21 -10
- data/lib/tinkerforge/bricklet_motion_detector_v2.rb +61 -27
- data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +70 -27
- data/lib/tinkerforge/bricklet_multi_touch.rb +30 -13
- data/lib/tinkerforge/bricklet_multi_touch_v2.rb +75 -28
- data/lib/tinkerforge/bricklet_nfc.rb +126 -62
- data/lib/tinkerforge/bricklet_nfc_rfid.rb +32 -13
- data/lib/tinkerforge/bricklet_oled_128x64.rb +28 -11
- data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +65 -24
- data/lib/tinkerforge/bricklet_oled_64x48.rb +28 -11
- data/lib/tinkerforge/bricklet_one_wire.rb +65 -24
- data/lib/tinkerforge/bricklet_outdoor_weather.rb +71 -28
- data/lib/tinkerforge/bricklet_particulate_matter.rb +74 -30
- data/lib/tinkerforge/bricklet_performance_dc.rb +682 -0
- data/lib/tinkerforge/bricklet_piezo_buzzer.rb +18 -9
- data/lib/tinkerforge/bricklet_piezo_speaker.rb +21 -10
- data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +79 -42
- data/lib/tinkerforge/bricklet_ptc.rb +73 -42
- data/lib/tinkerforge/bricklet_ptc_v2.rb +94 -48
- data/lib/tinkerforge/bricklet_real_time_clock.rb +44 -33
- data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +77 -44
- 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 +38 -19
- data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +59 -24
- data/lib/tinkerforge/bricklet_rotary_poti.rb +52 -28
- data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +56 -23
- data/lib/tinkerforge/bricklet_rs232.rb +89 -28
- data/lib/tinkerforge/bricklet_rs232_v2.rb +117 -44
- data/lib/tinkerforge/bricklet_rs485.rb +222 -95
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
- data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +74 -35
- data/lib/tinkerforge/bricklet_servo_v2.rb +565 -0
- data/lib/tinkerforge/bricklet_silent_stepper_v2.rb +1024 -0
- 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 +34 -18
- data/lib/tinkerforge/bricklet_sound_pressure_level.rb +71 -31
- data/lib/tinkerforge/bricklet_temperature.rb +39 -16
- data/lib/tinkerforge/bricklet_temperature_ir.rb +56 -23
- data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +70 -27
- data/lib/tinkerforge/bricklet_temperature_v2.rb +60 -25
- data/lib/tinkerforge/bricklet_thermal_imaging.rb +104 -44
- data/lib/tinkerforge/bricklet_thermocouple.rb +44 -24
- data/lib/tinkerforge/bricklet_thermocouple_v2.rb +64 -27
- data/lib/tinkerforge/bricklet_tilt.rb +23 -10
- data/lib/tinkerforge/bricklet_uv_light.rb +35 -18
- data/lib/tinkerforge/bricklet_uv_light_v2.rb +84 -37
- data/lib/tinkerforge/bricklet_voltage.rb +51 -28
- data/lib/tinkerforge/bricklet_voltage_current.rb +90 -73
- data/lib/tinkerforge/bricklet_voltage_current_v2.rb +89 -68
- data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +79 -30
- data/lib/tinkerforge/device_display_names.rb +170 -0
- data/lib/tinkerforge/ip_connection.rb +153 -33
- data/lib/tinkerforge/version.rb +1 -1
- metadata +11 -3
|
@@ -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 2021-05-06. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.29 #
|
|
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>.
|
|
@@ -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 2021-05-06. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.29 #
|
|
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 BrickletSolidStateRelayV2 < Device
|
|
@@ -56,7 +58,7 @@ module Tinkerforge
|
|
|
56
58
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
57
59
|
# the IP Connection <tt>ipcon</tt>.
|
|
58
60
|
def initialize(uid, ipcon)
|
|
59
|
-
super uid, ipcon
|
|
61
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
60
62
|
|
|
61
63
|
@api_version = [2, 0, 0]
|
|
62
64
|
|
|
@@ -77,26 +79,29 @@ module Tinkerforge
|
|
|
77
79
|
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
78
80
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
79
81
|
|
|
80
|
-
@callback_formats[CALLBACK_MONOFLOP_DONE] = '?'
|
|
82
|
+
@callback_formats[CALLBACK_MONOFLOP_DONE] = [9, '?']
|
|
81
83
|
|
|
84
|
+
@ipcon.add_device self
|
|
82
85
|
end
|
|
83
86
|
|
|
84
87
|
# Sets the state of the relays *true* means on and *false* means off.
|
|
85
88
|
#
|
|
86
89
|
# A running monoflop timer will be aborted if this function is called.
|
|
87
|
-
#
|
|
88
|
-
# The default value is *false*.
|
|
89
90
|
def set_state(state)
|
|
90
|
-
|
|
91
|
+
check_validity
|
|
92
|
+
|
|
93
|
+
send_request FUNCTION_SET_STATE, [state], '?', 8, ''
|
|
91
94
|
end
|
|
92
95
|
|
|
93
96
|
# Returns the state of the relay, *true* means on and *false* means off.
|
|
94
97
|
def get_state
|
|
95
|
-
|
|
98
|
+
check_validity
|
|
99
|
+
|
|
100
|
+
send_request FUNCTION_GET_STATE, [], '', 9, '?'
|
|
96
101
|
end
|
|
97
102
|
|
|
98
103
|
# The first parameter is the desired state of the relay (*true* means on
|
|
99
|
-
# and *false* means off). The second parameter indicates the time
|
|
104
|
+
# and *false* means off). The second parameter indicates the time that
|
|
100
105
|
# the relay should hold the state.
|
|
101
106
|
#
|
|
102
107
|
# If this function is called with the parameters (true, 1500):
|
|
@@ -108,7 +113,9 @@ module Tinkerforge
|
|
|
108
113
|
# of two seconds. The relay will be on all the time. If now the RS485
|
|
109
114
|
# connection is lost, the relay will turn off in at most two seconds.
|
|
110
115
|
def set_monoflop(state, time)
|
|
111
|
-
|
|
116
|
+
check_validity
|
|
117
|
+
|
|
118
|
+
send_request FUNCTION_SET_MONOFLOP, [state, time], '? L', 8, ''
|
|
112
119
|
end
|
|
113
120
|
|
|
114
121
|
# Returns the current state and the time as set by
|
|
@@ -117,7 +124,9 @@ module Tinkerforge
|
|
|
117
124
|
# If the timer is not running currently, the remaining time will be returned
|
|
118
125
|
# as 0.
|
|
119
126
|
def get_monoflop
|
|
120
|
-
|
|
127
|
+
check_validity
|
|
128
|
+
|
|
129
|
+
send_request FUNCTION_GET_MONOFLOP, [], '', 17, '? L L'
|
|
121
130
|
end
|
|
122
131
|
|
|
123
132
|
# Returns the error count for the communication between Brick and Bricklet.
|
|
@@ -132,7 +141,9 @@ module Tinkerforge
|
|
|
132
141
|
# The errors counts are for errors that occur on the Bricklet side. All
|
|
133
142
|
# Bricks have a similar function that returns the errors on the Brick side.
|
|
134
143
|
def get_spitfp_error_count
|
|
135
|
-
|
|
144
|
+
check_validity
|
|
145
|
+
|
|
146
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
|
136
147
|
end
|
|
137
148
|
|
|
138
149
|
# Sets the bootloader mode and returns the status after the requested
|
|
@@ -145,12 +156,16 @@ module Tinkerforge
|
|
|
145
156
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
146
157
|
# necessary to call it in a normal user program.
|
|
147
158
|
def set_bootloader_mode(mode)
|
|
148
|
-
|
|
159
|
+
check_validity
|
|
160
|
+
|
|
161
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
|
149
162
|
end
|
|
150
163
|
|
|
151
164
|
# Returns the current bootloader mode, see BrickletSolidStateRelayV2#set_bootloader_mode.
|
|
152
165
|
def get_bootloader_mode
|
|
153
|
-
|
|
166
|
+
check_validity
|
|
167
|
+
|
|
168
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
|
154
169
|
end
|
|
155
170
|
|
|
156
171
|
# Sets the firmware pointer for BrickletSolidStateRelayV2#write_firmware. The pointer has
|
|
@@ -160,7 +175,9 @@ module Tinkerforge
|
|
|
160
175
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
161
176
|
# necessary to call it in a normal user program.
|
|
162
177
|
def set_write_firmware_pointer(pointer)
|
|
163
|
-
|
|
178
|
+
check_validity
|
|
179
|
+
|
|
180
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
|
164
181
|
end
|
|
165
182
|
|
|
166
183
|
# Writes 64 Bytes of firmware at the position as written by
|
|
@@ -172,7 +189,9 @@ module Tinkerforge
|
|
|
172
189
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
173
190
|
# necessary to call it in a normal user program.
|
|
174
191
|
def write_firmware(data)
|
|
175
|
-
|
|
192
|
+
check_validity
|
|
193
|
+
|
|
194
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
|
176
195
|
end
|
|
177
196
|
|
|
178
197
|
# Sets the status LED configuration. By default the LED shows
|
|
@@ -183,22 +202,28 @@ module Tinkerforge
|
|
|
183
202
|
#
|
|
184
203
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
|
185
204
|
def set_status_led_config(config)
|
|
186
|
-
|
|
205
|
+
check_validity
|
|
206
|
+
|
|
207
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
|
187
208
|
end
|
|
188
209
|
|
|
189
210
|
# Returns the configuration as set by BrickletSolidStateRelayV2#set_status_led_config
|
|
190
211
|
def get_status_led_config
|
|
191
|
-
|
|
212
|
+
check_validity
|
|
213
|
+
|
|
214
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
|
192
215
|
end
|
|
193
216
|
|
|
194
|
-
# Returns the temperature
|
|
217
|
+
# Returns the temperature as measured inside the microcontroller. The
|
|
195
218
|
# value returned is not the ambient temperature!
|
|
196
219
|
#
|
|
197
220
|
# The temperature is only proportional to the real temperature and it has bad
|
|
198
221
|
# accuracy. Practically it is only useful as an indicator for
|
|
199
222
|
# temperature changes.
|
|
200
223
|
def get_chip_temperature
|
|
201
|
-
|
|
224
|
+
check_validity
|
|
225
|
+
|
|
226
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
|
202
227
|
end
|
|
203
228
|
|
|
204
229
|
# Calling this function will reset the Bricklet. All configurations
|
|
@@ -208,7 +233,9 @@ module Tinkerforge
|
|
|
208
233
|
# calling functions on the existing ones will result in
|
|
209
234
|
# undefined behavior!
|
|
210
235
|
def reset
|
|
211
|
-
|
|
236
|
+
check_validity
|
|
237
|
+
|
|
238
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
|
212
239
|
end
|
|
213
240
|
|
|
214
241
|
# Writes a new UID into flash. If you want to set a new UID
|
|
@@ -217,25 +244,31 @@ module Tinkerforge
|
|
|
217
244
|
#
|
|
218
245
|
# We recommend that you use Brick Viewer to change the UID.
|
|
219
246
|
def write_uid(uid)
|
|
220
|
-
|
|
247
|
+
check_validity
|
|
248
|
+
|
|
249
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
|
221
250
|
end
|
|
222
251
|
|
|
223
252
|
# Returns the current UID as an integer. Encode as
|
|
224
253
|
# Base58 to get the usual string version.
|
|
225
254
|
def read_uid
|
|
226
|
-
|
|
255
|
+
check_validity
|
|
256
|
+
|
|
257
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
|
227
258
|
end
|
|
228
259
|
|
|
229
260
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
230
261
|
# the position, the hardware and firmware version as well as the
|
|
231
262
|
# device identifier.
|
|
232
263
|
#
|
|
233
|
-
# The position can be 'a', 'b', 'c' or '
|
|
264
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
265
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
266
|
+
# position 'z'.
|
|
234
267
|
#
|
|
235
268
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
236
269
|
# |device_identifier_constant|
|
|
237
270
|
def get_identity
|
|
238
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
271
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
239
272
|
end
|
|
240
273
|
|
|
241
274
|
# 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 2021-05-06. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.29 #
|
|
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
|
# Measures sound intensity
|
|
14
16
|
class BrickletSoundIntensity < Device
|
|
@@ -49,7 +51,7 @@ module Tinkerforge
|
|
|
49
51
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
50
52
|
# the IP Connection <tt>ipcon</tt>.
|
|
51
53
|
def initialize(uid, ipcon)
|
|
52
|
-
super uid, ipcon
|
|
54
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
53
55
|
|
|
54
56
|
@api_version = [2, 0, 0]
|
|
55
57
|
|
|
@@ -62,13 +64,13 @@ module Tinkerforge
|
|
|
62
64
|
@response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
63
65
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
64
66
|
|
|
65
|
-
@callback_formats[CALLBACK_INTENSITY] = 'S'
|
|
66
|
-
@callback_formats[CALLBACK_INTENSITY_REACHED] = 'S'
|
|
67
|
+
@callback_formats[CALLBACK_INTENSITY] = [10, 'S']
|
|
68
|
+
@callback_formats[CALLBACK_INTENSITY_REACHED] = [10, 'S']
|
|
67
69
|
|
|
70
|
+
@ipcon.add_device self
|
|
68
71
|
end
|
|
69
72
|
|
|
70
|
-
# Returns the current sound intensity.
|
|
71
|
-
# 0 to 4095.
|
|
73
|
+
# Returns the current sound intensity.
|
|
72
74
|
#
|
|
73
75
|
# The value corresponds to the
|
|
74
76
|
# `upper envelop <https://en.wikipedia.org/wiki/Envelope_(waves)>`__
|
|
@@ -78,7 +80,9 @@ module Tinkerforge
|
|
|
78
80
|
# CALLBACK_INTENSITY callback and set the period with
|
|
79
81
|
# BrickletSoundIntensity#set_intensity_callback_period.
|
|
80
82
|
def get_intensity
|
|
81
|
-
|
|
83
|
+
check_validity
|
|
84
|
+
|
|
85
|
+
send_request FUNCTION_GET_INTENSITY, [], '', 10, 'S'
|
|
82
86
|
end
|
|
83
87
|
|
|
84
88
|
# Sets the period with which the CALLBACK_INTENSITY callback is triggered
|
|
@@ -87,12 +91,16 @@ module Tinkerforge
|
|
|
87
91
|
# The CALLBACK_INTENSITY callback is only triggered if the intensity has changed
|
|
88
92
|
# since the last triggering.
|
|
89
93
|
def set_intensity_callback_period(period)
|
|
90
|
-
|
|
94
|
+
check_validity
|
|
95
|
+
|
|
96
|
+
send_request FUNCTION_SET_INTENSITY_CALLBACK_PERIOD, [period], 'L', 8, ''
|
|
91
97
|
end
|
|
92
98
|
|
|
93
99
|
# Returns the period as set by BrickletSoundIntensity#set_intensity_callback_period.
|
|
94
100
|
def get_intensity_callback_period
|
|
95
|
-
|
|
101
|
+
check_validity
|
|
102
|
+
|
|
103
|
+
send_request FUNCTION_GET_INTENSITY_CALLBACK_PERIOD, [], '', 12, 'L'
|
|
96
104
|
end
|
|
97
105
|
|
|
98
106
|
# Sets the thresholds for the CALLBACK_INTENSITY_REACHED callback.
|
|
@@ -106,15 +114,17 @@ module Tinkerforge
|
|
|
106
114
|
# "'i'", "Callback is triggered when the intensity is *inside* the min and max values"
|
|
107
115
|
# "'<'", "Callback is triggered when the intensity is smaller than the min value (max is ignored)"
|
|
108
116
|
# "'>'", "Callback is triggered when the intensity is greater than the min value (max is ignored)"
|
|
109
|
-
#
|
|
110
|
-
# The default value is ('x', 0, 0).
|
|
111
117
|
def set_intensity_callback_threshold(option, min, max)
|
|
112
|
-
|
|
118
|
+
check_validity
|
|
119
|
+
|
|
120
|
+
send_request FUNCTION_SET_INTENSITY_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
|
|
113
121
|
end
|
|
114
122
|
|
|
115
123
|
# Returns the threshold as set by BrickletSoundIntensity#set_intensity_callback_threshold.
|
|
116
124
|
def get_intensity_callback_threshold
|
|
117
|
-
|
|
125
|
+
check_validity
|
|
126
|
+
|
|
127
|
+
send_request FUNCTION_GET_INTENSITY_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
|
|
118
128
|
end
|
|
119
129
|
|
|
120
130
|
# Sets the period with which the threshold callback
|
|
@@ -127,24 +137,30 @@ module Tinkerforge
|
|
|
127
137
|
#
|
|
128
138
|
# keeps being reached.
|
|
129
139
|
def set_debounce_period(debounce)
|
|
130
|
-
|
|
140
|
+
check_validity
|
|
141
|
+
|
|
142
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
|
|
131
143
|
end
|
|
132
144
|
|
|
133
145
|
# Returns the debounce period as set by BrickletSoundIntensity#set_debounce_period.
|
|
134
146
|
def get_debounce_period
|
|
135
|
-
|
|
147
|
+
check_validity
|
|
148
|
+
|
|
149
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
|
|
136
150
|
end
|
|
137
151
|
|
|
138
152
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
139
153
|
# the position, the hardware and firmware version as well as the
|
|
140
154
|
# device identifier.
|
|
141
155
|
#
|
|
142
|
-
# The position can be 'a', 'b', 'c' or '
|
|
156
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
157
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
158
|
+
# position 'z'.
|
|
143
159
|
#
|
|
144
160
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
145
161
|
# |device_identifier_constant|
|
|
146
162
|
def get_identity
|
|
147
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
163
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
148
164
|
end
|
|
149
165
|
|
|
150
166
|
# 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 2021-05-06. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.29 #
|
|
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
|
# Measures Sound Pressure Level in dB(A/B/C/D/Z)
|
|
14
16
|
class BrickletSoundPressureLevel < Device
|
|
@@ -88,7 +90,7 @@ module Tinkerforge
|
|
|
88
90
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
89
91
|
# the IP Connection <tt>ipcon</tt>.
|
|
90
92
|
def initialize(uid, ipcon)
|
|
91
|
-
super uid, ipcon
|
|
93
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
92
94
|
|
|
93
95
|
@api_version = [2, 0, 0]
|
|
94
96
|
|
|
@@ -113,14 +115,14 @@ module Tinkerforge
|
|
|
113
115
|
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
114
116
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
115
117
|
|
|
116
|
-
@callback_formats[CALLBACK_DECIBEL] = 'S'
|
|
117
|
-
@callback_formats[CALLBACK_SPECTRUM_LOW_LEVEL] = 'S S S30'
|
|
118
|
+
@callback_formats[CALLBACK_DECIBEL] = [10, 'S']
|
|
119
|
+
@callback_formats[CALLBACK_SPECTRUM_LOW_LEVEL] = [72, 'S S S30']
|
|
118
120
|
|
|
119
121
|
@high_level_callbacks[CALLBACK_SPECTRUM] = [['stream_length', 'stream_chunk_offset', 'stream_chunk_data'], {'fixed_length' => nil, 'single_chunk' => false}, nil]
|
|
122
|
+
@ipcon.add_device self
|
|
120
123
|
end
|
|
121
124
|
|
|
122
|
-
# Returns the measured sound pressure in decibels.
|
|
123
|
-
# dB/10 (tenths dB).
|
|
125
|
+
# Returns the measured sound pressure in decibels.
|
|
124
126
|
#
|
|
125
127
|
# The Bricklet supports the weighting standards dB(A), dB(B), dB(C), dB(D),
|
|
126
128
|
# dB(Z) and ITU-R 468. You can configure the weighting with BrickletSoundPressureLevel#set_configuration.
|
|
@@ -132,7 +134,9 @@ module Tinkerforge
|
|
|
132
134
|
# CALLBACK_DECIBEL callback. You can set the callback configuration
|
|
133
135
|
# with BrickletSoundPressureLevel#set_decibel_callback_configuration.
|
|
134
136
|
def get_decibel
|
|
135
|
-
|
|
137
|
+
check_validity
|
|
138
|
+
|
|
139
|
+
send_request FUNCTION_GET_DECIBEL, [], '', 10, 'S'
|
|
136
140
|
end
|
|
137
141
|
|
|
138
142
|
# The period is the period with which the CALLBACK_DECIBEL callback is triggered
|
|
@@ -161,12 +165,16 @@ module Tinkerforge
|
|
|
161
165
|
#
|
|
162
166
|
# If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
|
|
163
167
|
def set_decibel_callback_configuration(period, value_has_to_change, option, min, max)
|
|
164
|
-
|
|
168
|
+
check_validity
|
|
169
|
+
|
|
170
|
+
send_request FUNCTION_SET_DECIBEL_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k S S', 8, ''
|
|
165
171
|
end
|
|
166
172
|
|
|
167
173
|
# Returns the callback configuration as set by BrickletSoundPressureLevel#set_decibel_callback_configuration.
|
|
168
174
|
def get_decibel_callback_configuration
|
|
169
|
-
|
|
175
|
+
check_validity
|
|
176
|
+
|
|
177
|
+
send_request FUNCTION_GET_DECIBEL_CALLBACK_CONFIGURATION, [], '', 18, 'L ? k S S'
|
|
170
178
|
end
|
|
171
179
|
|
|
172
180
|
# Returns the frequency spectrum. The length of the spectrum is between
|
|
@@ -188,7 +196,9 @@ module Tinkerforge
|
|
|
188
196
|
# spectrum you have to apply the formula f(x) = 20*log10(max(1, x/sqrt(2)))
|
|
189
197
|
# on each value.
|
|
190
198
|
def get_spectrum_low_level
|
|
191
|
-
|
|
199
|
+
check_validity
|
|
200
|
+
|
|
201
|
+
send_request FUNCTION_GET_SPECTRUM_LOW_LEVEL, [], '', 72, 'S S S30'
|
|
192
202
|
end
|
|
193
203
|
|
|
194
204
|
# The period is the period with which the CALLBACK_SPECTRUM callback is
|
|
@@ -197,13 +207,17 @@ module Tinkerforge
|
|
|
197
207
|
# Every new measured spectrum will be send at most once. Set the period to 1 to
|
|
198
208
|
# make sure that you get every spectrum.
|
|
199
209
|
def set_spectrum_callback_configuration(period)
|
|
200
|
-
|
|
210
|
+
check_validity
|
|
211
|
+
|
|
212
|
+
send_request FUNCTION_SET_SPECTRUM_CALLBACK_CONFIGURATION, [period], 'L', 8, ''
|
|
201
213
|
end
|
|
202
214
|
|
|
203
215
|
# Returns the callback configuration as set by
|
|
204
216
|
# BrickletSoundPressureLevel#get_spectrum_callback_configuration.
|
|
205
217
|
def get_spectrum_callback_configuration
|
|
206
|
-
|
|
218
|
+
check_validity
|
|
219
|
+
|
|
220
|
+
send_request FUNCTION_GET_SPECTRUM_CALLBACK_CONFIGURATION, [], '', 12, 'L'
|
|
207
221
|
end
|
|
208
222
|
|
|
209
223
|
# Sets the Sound Pressure Level Bricklet configuration.
|
|
@@ -227,15 +241,17 @@ module Tinkerforge
|
|
|
227
241
|
# often used to measure volumes at concerts etc. dB(Z) has a
|
|
228
242
|
# flat response, no weighting is applied. ITU-R 468 is an ITU
|
|
229
243
|
# weighting standard mostly used in the UK and Europe.
|
|
230
|
-
#
|
|
231
|
-
# The defaults are FFT size 1024 and weighting standard dB(A).
|
|
232
244
|
def set_configuration(fft_size, weighting)
|
|
233
|
-
|
|
245
|
+
check_validity
|
|
246
|
+
|
|
247
|
+
send_request FUNCTION_SET_CONFIGURATION, [fft_size, weighting], 'C C', 8, ''
|
|
234
248
|
end
|
|
235
249
|
|
|
236
250
|
# Returns the configuration as set by BrickletSoundPressureLevel#set_configuration.
|
|
237
251
|
def get_configuration
|
|
238
|
-
|
|
252
|
+
check_validity
|
|
253
|
+
|
|
254
|
+
send_request FUNCTION_GET_CONFIGURATION, [], '', 10, 'C C'
|
|
239
255
|
end
|
|
240
256
|
|
|
241
257
|
# Returns the error count for the communication between Brick and Bricklet.
|
|
@@ -250,7 +266,9 @@ module Tinkerforge
|
|
|
250
266
|
# The errors counts are for errors that occur on the Bricklet side. All
|
|
251
267
|
# Bricks have a similar function that returns the errors on the Brick side.
|
|
252
268
|
def get_spitfp_error_count
|
|
253
|
-
|
|
269
|
+
check_validity
|
|
270
|
+
|
|
271
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
|
254
272
|
end
|
|
255
273
|
|
|
256
274
|
# Sets the bootloader mode and returns the status after the requested
|
|
@@ -263,12 +281,16 @@ module Tinkerforge
|
|
|
263
281
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
264
282
|
# necessary to call it in a normal user program.
|
|
265
283
|
def set_bootloader_mode(mode)
|
|
266
|
-
|
|
284
|
+
check_validity
|
|
285
|
+
|
|
286
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
|
267
287
|
end
|
|
268
288
|
|
|
269
289
|
# Returns the current bootloader mode, see BrickletSoundPressureLevel#set_bootloader_mode.
|
|
270
290
|
def get_bootloader_mode
|
|
271
|
-
|
|
291
|
+
check_validity
|
|
292
|
+
|
|
293
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
|
272
294
|
end
|
|
273
295
|
|
|
274
296
|
# Sets the firmware pointer for BrickletSoundPressureLevel#write_firmware. The pointer has
|
|
@@ -278,7 +300,9 @@ module Tinkerforge
|
|
|
278
300
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
279
301
|
# necessary to call it in a normal user program.
|
|
280
302
|
def set_write_firmware_pointer(pointer)
|
|
281
|
-
|
|
303
|
+
check_validity
|
|
304
|
+
|
|
305
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
|
282
306
|
end
|
|
283
307
|
|
|
284
308
|
# Writes 64 Bytes of firmware at the position as written by
|
|
@@ -290,7 +314,9 @@ module Tinkerforge
|
|
|
290
314
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
291
315
|
# necessary to call it in a normal user program.
|
|
292
316
|
def write_firmware(data)
|
|
293
|
-
|
|
317
|
+
check_validity
|
|
318
|
+
|
|
319
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
|
294
320
|
end
|
|
295
321
|
|
|
296
322
|
# Sets the status LED configuration. By default the LED shows
|
|
@@ -301,22 +327,28 @@ module Tinkerforge
|
|
|
301
327
|
#
|
|
302
328
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
|
303
329
|
def set_status_led_config(config)
|
|
304
|
-
|
|
330
|
+
check_validity
|
|
331
|
+
|
|
332
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
|
305
333
|
end
|
|
306
334
|
|
|
307
335
|
# Returns the configuration as set by BrickletSoundPressureLevel#set_status_led_config
|
|
308
336
|
def get_status_led_config
|
|
309
|
-
|
|
337
|
+
check_validity
|
|
338
|
+
|
|
339
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
|
310
340
|
end
|
|
311
341
|
|
|
312
|
-
# Returns the temperature
|
|
342
|
+
# Returns the temperature as measured inside the microcontroller. The
|
|
313
343
|
# value returned is not the ambient temperature!
|
|
314
344
|
#
|
|
315
345
|
# The temperature is only proportional to the real temperature and it has bad
|
|
316
346
|
# accuracy. Practically it is only useful as an indicator for
|
|
317
347
|
# temperature changes.
|
|
318
348
|
def get_chip_temperature
|
|
319
|
-
|
|
349
|
+
check_validity
|
|
350
|
+
|
|
351
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
|
320
352
|
end
|
|
321
353
|
|
|
322
354
|
# Calling this function will reset the Bricklet. All configurations
|
|
@@ -326,7 +358,9 @@ module Tinkerforge
|
|
|
326
358
|
# calling functions on the existing ones will result in
|
|
327
359
|
# undefined behavior!
|
|
328
360
|
def reset
|
|
329
|
-
|
|
361
|
+
check_validity
|
|
362
|
+
|
|
363
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
|
330
364
|
end
|
|
331
365
|
|
|
332
366
|
# Writes a new UID into flash. If you want to set a new UID
|
|
@@ -335,25 +369,31 @@ module Tinkerforge
|
|
|
335
369
|
#
|
|
336
370
|
# We recommend that you use Brick Viewer to change the UID.
|
|
337
371
|
def write_uid(uid)
|
|
338
|
-
|
|
372
|
+
check_validity
|
|
373
|
+
|
|
374
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
|
339
375
|
end
|
|
340
376
|
|
|
341
377
|
# Returns the current UID as an integer. Encode as
|
|
342
378
|
# Base58 to get the usual string version.
|
|
343
379
|
def read_uid
|
|
344
|
-
|
|
380
|
+
check_validity
|
|
381
|
+
|
|
382
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
|
345
383
|
end
|
|
346
384
|
|
|
347
385
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
348
386
|
# the position, the hardware and firmware version as well as the
|
|
349
387
|
# device identifier.
|
|
350
388
|
#
|
|
351
|
-
# The position can be 'a', 'b', 'c' or '
|
|
389
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
390
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
391
|
+
# position 'z'.
|
|
352
392
|
#
|
|
353
393
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
354
394
|
# |device_identifier_constant|
|
|
355
395
|
def get_identity
|
|
356
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
396
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
357
397
|
end
|
|
358
398
|
|
|
359
399
|
# Returns the frequency spectrum. The length of the spectrum is between
|