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
|
# Generates configurable DC voltage and current, 0V to 10V and 4mA to 20mA
|
|
14
16
|
class BrickletIndustrialAnalogOut < Device
|
|
@@ -35,7 +37,7 @@ module Tinkerforge
|
|
|
35
37
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
36
38
|
# the IP Connection <tt>ipcon</tt>.
|
|
37
39
|
def initialize(uid, ipcon)
|
|
38
|
-
super uid, ipcon
|
|
40
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
39
41
|
|
|
40
42
|
@api_version = [2, 0, 0]
|
|
41
43
|
|
|
@@ -51,25 +53,32 @@ module Tinkerforge
|
|
|
51
53
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
52
54
|
|
|
53
55
|
|
|
56
|
+
@ipcon.add_device self
|
|
54
57
|
end
|
|
55
58
|
|
|
56
59
|
# Enables the output of voltage and current.
|
|
57
60
|
#
|
|
58
61
|
# The default is disabled.
|
|
59
62
|
def enable
|
|
60
|
-
|
|
63
|
+
check_validity
|
|
64
|
+
|
|
65
|
+
send_request FUNCTION_ENABLE, [], '', 8, ''
|
|
61
66
|
end
|
|
62
67
|
|
|
63
68
|
# Disables the output of voltage and current.
|
|
64
69
|
#
|
|
65
70
|
# The default is disabled.
|
|
66
71
|
def disable
|
|
67
|
-
|
|
72
|
+
check_validity
|
|
73
|
+
|
|
74
|
+
send_request FUNCTION_DISABLE, [], '', 8, ''
|
|
68
75
|
end
|
|
69
76
|
|
|
70
77
|
# Returns *true* if output of voltage and current is enabled, *false* otherwise.
|
|
71
78
|
def is_enabled
|
|
72
|
-
|
|
79
|
+
check_validity
|
|
80
|
+
|
|
81
|
+
send_request FUNCTION_IS_ENABLED, [], '', 9, '?'
|
|
73
82
|
end
|
|
74
83
|
|
|
75
84
|
# Sets the output voltage.
|
|
@@ -77,12 +86,16 @@ module Tinkerforge
|
|
|
77
86
|
# The output voltage and output current are linked. Changing the output voltage
|
|
78
87
|
# also changes the output current.
|
|
79
88
|
def set_voltage(voltage)
|
|
80
|
-
|
|
89
|
+
check_validity
|
|
90
|
+
|
|
91
|
+
send_request FUNCTION_SET_VOLTAGE, [voltage], 'S', 8, ''
|
|
81
92
|
end
|
|
82
93
|
|
|
83
94
|
# Returns the voltage as set by BrickletIndustrialAnalogOut#set_voltage.
|
|
84
95
|
def get_voltage
|
|
85
|
-
|
|
96
|
+
check_validity
|
|
97
|
+
|
|
98
|
+
send_request FUNCTION_GET_VOLTAGE, [], '', 10, 'S'
|
|
86
99
|
end
|
|
87
100
|
|
|
88
101
|
# Sets the output current.
|
|
@@ -90,12 +103,16 @@ module Tinkerforge
|
|
|
90
103
|
# The output current and output voltage are linked. Changing the output current
|
|
91
104
|
# also changes the output voltage.
|
|
92
105
|
def set_current(current)
|
|
93
|
-
|
|
106
|
+
check_validity
|
|
107
|
+
|
|
108
|
+
send_request FUNCTION_SET_CURRENT, [current], 'S', 8, ''
|
|
94
109
|
end
|
|
95
110
|
|
|
96
111
|
# Returns the current as set by BrickletIndustrialAnalogOut#set_current.
|
|
97
112
|
def get_current
|
|
98
|
-
|
|
113
|
+
check_validity
|
|
114
|
+
|
|
115
|
+
send_request FUNCTION_GET_CURRENT, [], '', 10, 'S'
|
|
99
116
|
end
|
|
100
117
|
|
|
101
118
|
# Configures the voltage and current range.
|
|
@@ -114,24 +131,30 @@ module Tinkerforge
|
|
|
114
131
|
# The resolution will always be 12 bit. This means, that the
|
|
115
132
|
# precision is higher with a smaller range.
|
|
116
133
|
def set_configuration(voltage_range, current_range)
|
|
117
|
-
|
|
134
|
+
check_validity
|
|
135
|
+
|
|
136
|
+
send_request FUNCTION_SET_CONFIGURATION, [voltage_range, current_range], 'C C', 8, ''
|
|
118
137
|
end
|
|
119
138
|
|
|
120
139
|
# Returns the configuration as set by BrickletIndustrialAnalogOut#set_configuration.
|
|
121
140
|
def get_configuration
|
|
122
|
-
|
|
141
|
+
check_validity
|
|
142
|
+
|
|
143
|
+
send_request FUNCTION_GET_CONFIGURATION, [], '', 10, 'C C'
|
|
123
144
|
end
|
|
124
145
|
|
|
125
146
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
126
147
|
# the position, the hardware and firmware version as well as the
|
|
127
148
|
# device identifier.
|
|
128
149
|
#
|
|
129
|
-
# The position can be 'a', 'b', 'c' or '
|
|
150
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
151
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
152
|
+
# position 'z'.
|
|
130
153
|
#
|
|
131
154
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
132
155
|
# |device_identifier_constant|
|
|
133
156
|
def get_identity
|
|
134
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
157
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
135
158
|
end
|
|
136
159
|
|
|
137
160
|
end
|
|
@@ -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
|
# Generates configurable DC voltage and current, 0V to 10V and 4mA to 20mA
|
|
14
16
|
class BrickletIndustrialAnalogOutV2 < Device
|
|
@@ -70,7 +72,7 @@ module Tinkerforge
|
|
|
70
72
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
71
73
|
# the IP Connection <tt>ipcon</tt>.
|
|
72
74
|
def initialize(uid, ipcon)
|
|
73
|
-
super uid, ipcon
|
|
75
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
74
76
|
|
|
75
77
|
@api_version = [2, 0, 0]
|
|
76
78
|
|
|
@@ -100,16 +102,21 @@ module Tinkerforge
|
|
|
100
102
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
101
103
|
|
|
102
104
|
|
|
105
|
+
@ipcon.add_device self
|
|
103
106
|
end
|
|
104
107
|
|
|
105
108
|
# Enables/disables the output of voltage and current.
|
|
106
109
|
def set_enabled(enabled)
|
|
107
|
-
|
|
110
|
+
check_validity
|
|
111
|
+
|
|
112
|
+
send_request FUNCTION_SET_ENABLED, [enabled], '?', 8, ''
|
|
108
113
|
end
|
|
109
114
|
|
|
110
115
|
# Returns *true* if output of voltage and current is enabled, *false* otherwise.
|
|
111
116
|
def get_enabled
|
|
112
|
-
|
|
117
|
+
check_validity
|
|
118
|
+
|
|
119
|
+
send_request FUNCTION_GET_ENABLED, [], '', 9, '?'
|
|
113
120
|
end
|
|
114
121
|
|
|
115
122
|
# Sets the output voltage.
|
|
@@ -117,12 +124,16 @@ module Tinkerforge
|
|
|
117
124
|
# The output voltage and output current are linked. Changing the output voltage
|
|
118
125
|
# also changes the output current.
|
|
119
126
|
def set_voltage(voltage)
|
|
120
|
-
|
|
127
|
+
check_validity
|
|
128
|
+
|
|
129
|
+
send_request FUNCTION_SET_VOLTAGE, [voltage], 'S', 8, ''
|
|
121
130
|
end
|
|
122
131
|
|
|
123
132
|
# Returns the voltage as set by BrickletIndustrialAnalogOutV2#set_voltage.
|
|
124
133
|
def get_voltage
|
|
125
|
-
|
|
134
|
+
check_validity
|
|
135
|
+
|
|
136
|
+
send_request FUNCTION_GET_VOLTAGE, [], '', 10, 'S'
|
|
126
137
|
end
|
|
127
138
|
|
|
128
139
|
# Sets the output current.
|
|
@@ -130,12 +141,16 @@ module Tinkerforge
|
|
|
130
141
|
# The output current and output voltage are linked. Changing the output current
|
|
131
142
|
# also changes the output voltage.
|
|
132
143
|
def set_current(current)
|
|
133
|
-
|
|
144
|
+
check_validity
|
|
145
|
+
|
|
146
|
+
send_request FUNCTION_SET_CURRENT, [current], 'S', 8, ''
|
|
134
147
|
end
|
|
135
148
|
|
|
136
149
|
# Returns the current as set by BrickletIndustrialAnalogOutV2#set_current.
|
|
137
150
|
def get_current
|
|
138
|
-
|
|
151
|
+
check_validity
|
|
152
|
+
|
|
153
|
+
send_request FUNCTION_GET_CURRENT, [], '', 10, 'S'
|
|
139
154
|
end
|
|
140
155
|
|
|
141
156
|
# Configures the voltage and current range.
|
|
@@ -154,12 +169,16 @@ module Tinkerforge
|
|
|
154
169
|
# The resolution will always be 12 bit. This means, that the
|
|
155
170
|
# precision is higher with a smaller range.
|
|
156
171
|
def set_configuration(voltage_range, current_range)
|
|
157
|
-
|
|
172
|
+
check_validity
|
|
173
|
+
|
|
174
|
+
send_request FUNCTION_SET_CONFIGURATION, [voltage_range, current_range], 'C C', 8, ''
|
|
158
175
|
end
|
|
159
176
|
|
|
160
177
|
# Returns the configuration as set by BrickletIndustrialAnalogOutV2#set_configuration.
|
|
161
178
|
def get_configuration
|
|
162
|
-
|
|
179
|
+
check_validity
|
|
180
|
+
|
|
181
|
+
send_request FUNCTION_GET_CONFIGURATION, [], '', 10, 'C C'
|
|
163
182
|
end
|
|
164
183
|
|
|
165
184
|
# You can turn the Out LED off, on or show a
|
|
@@ -169,12 +188,16 @@ module Tinkerforge
|
|
|
169
188
|
#
|
|
170
189
|
# You can configure the channel status behavior with BrickletIndustrialAnalogOutV2#set_out_led_status_config.
|
|
171
190
|
def set_out_led_config(config)
|
|
172
|
-
|
|
191
|
+
check_validity
|
|
192
|
+
|
|
193
|
+
send_request FUNCTION_SET_OUT_LED_CONFIG, [config], 'C', 8, ''
|
|
173
194
|
end
|
|
174
195
|
|
|
175
196
|
# Returns the Out LED configuration as set by BrickletIndustrialAnalogOutV2#set_out_led_config
|
|
176
197
|
def get_out_led_config
|
|
177
|
-
|
|
198
|
+
check_validity
|
|
199
|
+
|
|
200
|
+
send_request FUNCTION_GET_OUT_LED_CONFIG, [], '', 9, 'C'
|
|
178
201
|
end
|
|
179
202
|
|
|
180
203
|
# Sets the Out LED status config. This config is used if the Out LED is
|
|
@@ -199,12 +222,16 @@ module Tinkerforge
|
|
|
199
222
|
# If the min value is greater than the max value, the LED brightness is scaled the
|
|
200
223
|
# other way around.
|
|
201
224
|
def set_out_led_status_config(min, max, config)
|
|
202
|
-
|
|
225
|
+
check_validity
|
|
226
|
+
|
|
227
|
+
send_request FUNCTION_SET_OUT_LED_STATUS_CONFIG, [min, max, config], 'S S C', 8, ''
|
|
203
228
|
end
|
|
204
229
|
|
|
205
230
|
# Returns the Out LED status configuration as set by BrickletIndustrialAnalogOutV2#set_out_led_status_config.
|
|
206
231
|
def get_out_led_status_config
|
|
207
|
-
|
|
232
|
+
check_validity
|
|
233
|
+
|
|
234
|
+
send_request FUNCTION_GET_OUT_LED_STATUS_CONFIG, [], '', 13, 'S S C'
|
|
208
235
|
end
|
|
209
236
|
|
|
210
237
|
# Returns the error count for the communication between Brick and Bricklet.
|
|
@@ -219,7 +246,9 @@ module Tinkerforge
|
|
|
219
246
|
# The errors counts are for errors that occur on the Bricklet side. All
|
|
220
247
|
# Bricks have a similar function that returns the errors on the Brick side.
|
|
221
248
|
def get_spitfp_error_count
|
|
222
|
-
|
|
249
|
+
check_validity
|
|
250
|
+
|
|
251
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
|
223
252
|
end
|
|
224
253
|
|
|
225
254
|
# Sets the bootloader mode and returns the status after the requested
|
|
@@ -232,12 +261,16 @@ module Tinkerforge
|
|
|
232
261
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
233
262
|
# necessary to call it in a normal user program.
|
|
234
263
|
def set_bootloader_mode(mode)
|
|
235
|
-
|
|
264
|
+
check_validity
|
|
265
|
+
|
|
266
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
|
236
267
|
end
|
|
237
268
|
|
|
238
269
|
# Returns the current bootloader mode, see BrickletIndustrialAnalogOutV2#set_bootloader_mode.
|
|
239
270
|
def get_bootloader_mode
|
|
240
|
-
|
|
271
|
+
check_validity
|
|
272
|
+
|
|
273
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
|
241
274
|
end
|
|
242
275
|
|
|
243
276
|
# Sets the firmware pointer for BrickletIndustrialAnalogOutV2#write_firmware. The pointer has
|
|
@@ -247,7 +280,9 @@ module Tinkerforge
|
|
|
247
280
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
248
281
|
# necessary to call it in a normal user program.
|
|
249
282
|
def set_write_firmware_pointer(pointer)
|
|
250
|
-
|
|
283
|
+
check_validity
|
|
284
|
+
|
|
285
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
|
251
286
|
end
|
|
252
287
|
|
|
253
288
|
# Writes 64 Bytes of firmware at the position as written by
|
|
@@ -259,7 +294,9 @@ module Tinkerforge
|
|
|
259
294
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
260
295
|
# necessary to call it in a normal user program.
|
|
261
296
|
def write_firmware(data)
|
|
262
|
-
|
|
297
|
+
check_validity
|
|
298
|
+
|
|
299
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
|
263
300
|
end
|
|
264
301
|
|
|
265
302
|
# Sets the status LED configuration. By default the LED shows
|
|
@@ -270,22 +307,28 @@ module Tinkerforge
|
|
|
270
307
|
#
|
|
271
308
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
|
272
309
|
def set_status_led_config(config)
|
|
273
|
-
|
|
310
|
+
check_validity
|
|
311
|
+
|
|
312
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
|
274
313
|
end
|
|
275
314
|
|
|
276
315
|
# Returns the configuration as set by BrickletIndustrialAnalogOutV2#set_status_led_config
|
|
277
316
|
def get_status_led_config
|
|
278
|
-
|
|
317
|
+
check_validity
|
|
318
|
+
|
|
319
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
|
279
320
|
end
|
|
280
321
|
|
|
281
|
-
# Returns the temperature
|
|
322
|
+
# Returns the temperature as measured inside the microcontroller. The
|
|
282
323
|
# value returned is not the ambient temperature!
|
|
283
324
|
#
|
|
284
325
|
# The temperature is only proportional to the real temperature and it has bad
|
|
285
326
|
# accuracy. Practically it is only useful as an indicator for
|
|
286
327
|
# temperature changes.
|
|
287
328
|
def get_chip_temperature
|
|
288
|
-
|
|
329
|
+
check_validity
|
|
330
|
+
|
|
331
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
|
289
332
|
end
|
|
290
333
|
|
|
291
334
|
# Calling this function will reset the Bricklet. All configurations
|
|
@@ -295,7 +338,9 @@ module Tinkerforge
|
|
|
295
338
|
# calling functions on the existing ones will result in
|
|
296
339
|
# undefined behavior!
|
|
297
340
|
def reset
|
|
298
|
-
|
|
341
|
+
check_validity
|
|
342
|
+
|
|
343
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
|
299
344
|
end
|
|
300
345
|
|
|
301
346
|
# Writes a new UID into flash. If you want to set a new UID
|
|
@@ -304,25 +349,31 @@ module Tinkerforge
|
|
|
304
349
|
#
|
|
305
350
|
# We recommend that you use Brick Viewer to change the UID.
|
|
306
351
|
def write_uid(uid)
|
|
307
|
-
|
|
352
|
+
check_validity
|
|
353
|
+
|
|
354
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
|
308
355
|
end
|
|
309
356
|
|
|
310
357
|
# Returns the current UID as an integer. Encode as
|
|
311
358
|
# Base58 to get the usual string version.
|
|
312
359
|
def read_uid
|
|
313
|
-
|
|
360
|
+
check_validity
|
|
361
|
+
|
|
362
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
|
314
363
|
end
|
|
315
364
|
|
|
316
365
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
317
366
|
# the position, the hardware and firmware version as well as the
|
|
318
367
|
# device identifier.
|
|
319
368
|
#
|
|
320
|
-
# The position can be 'a', 'b', 'c' or '
|
|
369
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
370
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
371
|
+
# position 'z'.
|
|
321
372
|
#
|
|
322
373
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
323
374
|
# |device_identifier_constant|
|
|
324
375
|
def get_identity
|
|
325
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
376
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
326
377
|
end
|
|
327
378
|
|
|
328
379
|
end
|
|
@@ -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
|
# 4 channel counter up to 4MHz
|
|
14
16
|
class BrickletIndustrialCounter < Device
|
|
@@ -117,7 +119,7 @@ module Tinkerforge
|
|
|
117
119
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
118
120
|
# the IP Connection <tt>ipcon</tt>.
|
|
119
121
|
def initialize(uid, ipcon)
|
|
120
|
-
super uid, ipcon
|
|
122
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
121
123
|
|
|
122
124
|
@api_version = [2, 0, 0]
|
|
123
125
|
|
|
@@ -152,45 +154,58 @@ module Tinkerforge
|
|
|
152
154
|
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
153
155
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
154
156
|
|
|
155
|
-
@callback_formats[CALLBACK_ALL_COUNTER] = 'q4'
|
|
156
|
-
@callback_formats[CALLBACK_ALL_SIGNAL_DATA] = 'S4 Q4 L4 ?4'
|
|
157
|
+
@callback_formats[CALLBACK_ALL_COUNTER] = [40, 'q4']
|
|
158
|
+
@callback_formats[CALLBACK_ALL_SIGNAL_DATA] = [65, 'S4 Q4 L4 ?4']
|
|
157
159
|
|
|
160
|
+
@ipcon.add_device self
|
|
158
161
|
end
|
|
159
162
|
|
|
160
163
|
# Returns the current counter value for the given channel.
|
|
161
164
|
def get_counter(channel)
|
|
162
|
-
|
|
165
|
+
check_validity
|
|
166
|
+
|
|
167
|
+
send_request FUNCTION_GET_COUNTER, [channel], 'C', 16, 'q'
|
|
163
168
|
end
|
|
164
169
|
|
|
165
170
|
# Returns the current counter values for all four channels.
|
|
166
171
|
def get_all_counter
|
|
167
|
-
|
|
172
|
+
check_validity
|
|
173
|
+
|
|
174
|
+
send_request FUNCTION_GET_ALL_COUNTER, [], '', 40, 'q4'
|
|
168
175
|
end
|
|
169
176
|
|
|
170
177
|
# Sets the counter value for the given channel.
|
|
171
178
|
#
|
|
172
179
|
# The default value for the counters on startup is 0.
|
|
173
180
|
def set_counter(channel, counter)
|
|
174
|
-
|
|
181
|
+
check_validity
|
|
182
|
+
|
|
183
|
+
send_request FUNCTION_SET_COUNTER, [channel, counter], 'C q', 8, ''
|
|
175
184
|
end
|
|
176
185
|
|
|
177
186
|
# Sets the counter values for all four channels.
|
|
178
187
|
#
|
|
179
188
|
# The default value for the counters on startup is 0.
|
|
180
189
|
def set_all_counter(counter)
|
|
181
|
-
|
|
190
|
+
check_validity
|
|
191
|
+
|
|
192
|
+
send_request FUNCTION_SET_ALL_COUNTER, [counter], 'q4', 8, ''
|
|
182
193
|
end
|
|
183
194
|
|
|
184
195
|
# Returns the signal data (duty cycle, period, frequency and value) for the
|
|
185
196
|
# given channel.
|
|
186
197
|
def get_signal_data(channel)
|
|
187
|
-
|
|
198
|
+
check_validity
|
|
199
|
+
|
|
200
|
+
send_request FUNCTION_GET_SIGNAL_DATA, [channel], 'C', 23, 'S Q L ?'
|
|
188
201
|
end
|
|
189
202
|
|
|
190
203
|
# Returns the signal data (duty cycle, period, frequency and value) for all four
|
|
191
204
|
# channels.
|
|
192
205
|
def get_all_signal_data
|
|
193
|
-
|
|
206
|
+
check_validity
|
|
207
|
+
|
|
208
|
+
send_request FUNCTION_GET_ALL_SIGNAL_DATA, [], '', 65, 'S4 Q4 L4 ?4'
|
|
194
209
|
end
|
|
195
210
|
|
|
196
211
|
# Activates/deactivates the counter of the given channel.
|
|
@@ -199,7 +214,9 @@ module Tinkerforge
|
|
|
199
214
|
#
|
|
200
215
|
# By default all channels are activated.
|
|
201
216
|
def set_counter_active(channel, active)
|
|
202
|
-
|
|
217
|
+
check_validity
|
|
218
|
+
|
|
219
|
+
send_request FUNCTION_SET_COUNTER_ACTIVE, [channel, active], 'C ?', 8, ''
|
|
203
220
|
end
|
|
204
221
|
|
|
205
222
|
# Activates/deactivates the counter of all four channels.
|
|
@@ -208,21 +225,27 @@ module Tinkerforge
|
|
|
208
225
|
#
|
|
209
226
|
# By default all channels are activated.
|
|
210
227
|
def set_all_counter_active(active)
|
|
211
|
-
|
|
228
|
+
check_validity
|
|
229
|
+
|
|
230
|
+
send_request FUNCTION_SET_ALL_COUNTER_ACTIVE, [active], '?4', 8, ''
|
|
212
231
|
end
|
|
213
232
|
|
|
214
233
|
# Returns the activation state of the given channel.
|
|
215
234
|
#
|
|
216
235
|
# true = activated, false = deactivated.
|
|
217
236
|
def get_counter_active(channel)
|
|
218
|
-
|
|
237
|
+
check_validity
|
|
238
|
+
|
|
239
|
+
send_request FUNCTION_GET_COUNTER_ACTIVE, [channel], 'C', 9, '?'
|
|
219
240
|
end
|
|
220
241
|
|
|
221
242
|
# Returns the activation state of all four channels.
|
|
222
243
|
#
|
|
223
244
|
# true = activated, false = deactivated.
|
|
224
245
|
def get_all_counter_active
|
|
225
|
-
|
|
246
|
+
check_validity
|
|
247
|
+
|
|
248
|
+
send_request FUNCTION_GET_ALL_COUNTER_ACTIVE, [], '', 9, '?4'
|
|
226
249
|
end
|
|
227
250
|
|
|
228
251
|
# Sets the counter configuration for the given channel.
|
|
@@ -240,12 +263,16 @@ module Tinkerforge
|
|
|
240
263
|
# `here <https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Industrial_Counter.html#duty-cycle-prescaler-and-frequency-integration-time>`__
|
|
241
264
|
# for details.
|
|
242
265
|
def set_counter_configuration(channel, count_edge, count_direction, duty_cycle_prescaler, frequency_integration_time)
|
|
243
|
-
|
|
266
|
+
check_validity
|
|
267
|
+
|
|
268
|
+
send_request FUNCTION_SET_COUNTER_CONFIGURATION, [channel, count_edge, count_direction, duty_cycle_prescaler, frequency_integration_time], 'C C C C C', 8, ''
|
|
244
269
|
end
|
|
245
270
|
|
|
246
271
|
# Returns the counter configuration as set by BrickletIndustrialCounter#set_counter_configuration.
|
|
247
272
|
def get_counter_configuration(channel)
|
|
248
|
-
|
|
273
|
+
check_validity
|
|
274
|
+
|
|
275
|
+
send_request FUNCTION_GET_COUNTER_CONFIGURATION, [channel], 'C', 12, 'C C C C'
|
|
249
276
|
end
|
|
250
277
|
|
|
251
278
|
# The period is the period with which the CALLBACK_ALL_COUNTER
|
|
@@ -258,13 +285,17 @@ module Tinkerforge
|
|
|
258
285
|
# If it is set to false, the callback is continuously triggered with the period,
|
|
259
286
|
# independent of the value.
|
|
260
287
|
def set_all_counter_callback_configuration(period, value_has_to_change)
|
|
261
|
-
|
|
288
|
+
check_validity
|
|
289
|
+
|
|
290
|
+
send_request FUNCTION_SET_ALL_COUNTER_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
|
|
262
291
|
end
|
|
263
292
|
|
|
264
293
|
# Returns the callback configuration as set by
|
|
265
294
|
# BrickletIndustrialCounter#set_all_counter_callback_configuration.
|
|
266
295
|
def get_all_counter_callback_configuration
|
|
267
|
-
|
|
296
|
+
check_validity
|
|
297
|
+
|
|
298
|
+
send_request FUNCTION_GET_ALL_COUNTER_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
|
|
268
299
|
end
|
|
269
300
|
|
|
270
301
|
# The period is the period with which the CALLBACK_ALL_SIGNAL_DATA
|
|
@@ -277,27 +308,33 @@ module Tinkerforge
|
|
|
277
308
|
# If it is set to false, the callback is continuously triggered with the period,
|
|
278
309
|
# independent of the value.
|
|
279
310
|
def set_all_signal_data_callback_configuration(period, value_has_to_change)
|
|
280
|
-
|
|
311
|
+
check_validity
|
|
312
|
+
|
|
313
|
+
send_request FUNCTION_SET_ALL_SIGNAL_DATA_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
|
|
281
314
|
end
|
|
282
315
|
|
|
283
316
|
# Returns the callback configuration as set by
|
|
284
317
|
# BrickletIndustrialCounter#set_all_signal_data_callback_configuration.
|
|
285
318
|
def get_all_signal_data_callback_configuration
|
|
286
|
-
|
|
319
|
+
check_validity
|
|
320
|
+
|
|
321
|
+
send_request FUNCTION_GET_ALL_SIGNAL_DATA_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
|
|
287
322
|
end
|
|
288
323
|
|
|
289
324
|
# Each channel has a corresponding LED. You can turn the LED off, on or show a
|
|
290
325
|
# heartbeat. You can also set the LED to "Channel Status". In this mode the
|
|
291
326
|
# LED is on if the channel is high and off otherwise.
|
|
292
|
-
#
|
|
293
|
-
# By default all channel LEDs are configured as "Channel Status".
|
|
294
327
|
def set_channel_led_config(channel, config)
|
|
295
|
-
|
|
328
|
+
check_validity
|
|
329
|
+
|
|
330
|
+
send_request FUNCTION_SET_CHANNEL_LED_CONFIG, [channel, config], 'C C', 8, ''
|
|
296
331
|
end
|
|
297
332
|
|
|
298
333
|
# Returns the channel LED configuration as set by BrickletIndustrialCounter#set_channel_led_config
|
|
299
334
|
def get_channel_led_config(channel)
|
|
300
|
-
|
|
335
|
+
check_validity
|
|
336
|
+
|
|
337
|
+
send_request FUNCTION_GET_CHANNEL_LED_CONFIG, [channel], 'C', 9, 'C'
|
|
301
338
|
end
|
|
302
339
|
|
|
303
340
|
# Returns the error count for the communication between Brick and Bricklet.
|
|
@@ -312,7 +349,9 @@ module Tinkerforge
|
|
|
312
349
|
# The errors counts are for errors that occur on the Bricklet side. All
|
|
313
350
|
# Bricks have a similar function that returns the errors on the Brick side.
|
|
314
351
|
def get_spitfp_error_count
|
|
315
|
-
|
|
352
|
+
check_validity
|
|
353
|
+
|
|
354
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
|
316
355
|
end
|
|
317
356
|
|
|
318
357
|
# Sets the bootloader mode and returns the status after the requested
|
|
@@ -325,12 +364,16 @@ module Tinkerforge
|
|
|
325
364
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
326
365
|
# necessary to call it in a normal user program.
|
|
327
366
|
def set_bootloader_mode(mode)
|
|
328
|
-
|
|
367
|
+
check_validity
|
|
368
|
+
|
|
369
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
|
329
370
|
end
|
|
330
371
|
|
|
331
372
|
# Returns the current bootloader mode, see BrickletIndustrialCounter#set_bootloader_mode.
|
|
332
373
|
def get_bootloader_mode
|
|
333
|
-
|
|
374
|
+
check_validity
|
|
375
|
+
|
|
376
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
|
334
377
|
end
|
|
335
378
|
|
|
336
379
|
# Sets the firmware pointer for BrickletIndustrialCounter#write_firmware. The pointer has
|
|
@@ -340,7 +383,9 @@ module Tinkerforge
|
|
|
340
383
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
341
384
|
# necessary to call it in a normal user program.
|
|
342
385
|
def set_write_firmware_pointer(pointer)
|
|
343
|
-
|
|
386
|
+
check_validity
|
|
387
|
+
|
|
388
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
|
344
389
|
end
|
|
345
390
|
|
|
346
391
|
# Writes 64 Bytes of firmware at the position as written by
|
|
@@ -352,7 +397,9 @@ module Tinkerforge
|
|
|
352
397
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
353
398
|
# necessary to call it in a normal user program.
|
|
354
399
|
def write_firmware(data)
|
|
355
|
-
|
|
400
|
+
check_validity
|
|
401
|
+
|
|
402
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
|
356
403
|
end
|
|
357
404
|
|
|
358
405
|
# Sets the status LED configuration. By default the LED shows
|
|
@@ -363,22 +410,28 @@ module Tinkerforge
|
|
|
363
410
|
#
|
|
364
411
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
|
365
412
|
def set_status_led_config(config)
|
|
366
|
-
|
|
413
|
+
check_validity
|
|
414
|
+
|
|
415
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
|
367
416
|
end
|
|
368
417
|
|
|
369
418
|
# Returns the configuration as set by BrickletIndustrialCounter#set_status_led_config
|
|
370
419
|
def get_status_led_config
|
|
371
|
-
|
|
420
|
+
check_validity
|
|
421
|
+
|
|
422
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
|
372
423
|
end
|
|
373
424
|
|
|
374
|
-
# Returns the temperature
|
|
425
|
+
# Returns the temperature as measured inside the microcontroller. The
|
|
375
426
|
# value returned is not the ambient temperature!
|
|
376
427
|
#
|
|
377
428
|
# The temperature is only proportional to the real temperature and it has bad
|
|
378
429
|
# accuracy. Practically it is only useful as an indicator for
|
|
379
430
|
# temperature changes.
|
|
380
431
|
def get_chip_temperature
|
|
381
|
-
|
|
432
|
+
check_validity
|
|
433
|
+
|
|
434
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
|
382
435
|
end
|
|
383
436
|
|
|
384
437
|
# Calling this function will reset the Bricklet. All configurations
|
|
@@ -388,7 +441,9 @@ module Tinkerforge
|
|
|
388
441
|
# calling functions on the existing ones will result in
|
|
389
442
|
# undefined behavior!
|
|
390
443
|
def reset
|
|
391
|
-
|
|
444
|
+
check_validity
|
|
445
|
+
|
|
446
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
|
392
447
|
end
|
|
393
448
|
|
|
394
449
|
# Writes a new UID into flash. If you want to set a new UID
|
|
@@ -397,25 +452,31 @@ module Tinkerforge
|
|
|
397
452
|
#
|
|
398
453
|
# We recommend that you use Brick Viewer to change the UID.
|
|
399
454
|
def write_uid(uid)
|
|
400
|
-
|
|
455
|
+
check_validity
|
|
456
|
+
|
|
457
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
|
401
458
|
end
|
|
402
459
|
|
|
403
460
|
# Returns the current UID as an integer. Encode as
|
|
404
461
|
# Base58 to get the usual string version.
|
|
405
462
|
def read_uid
|
|
406
|
-
|
|
463
|
+
check_validity
|
|
464
|
+
|
|
465
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
|
407
466
|
end
|
|
408
467
|
|
|
409
468
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
410
469
|
# the position, the hardware and firmware version as well as the
|
|
411
470
|
# device identifier.
|
|
412
471
|
#
|
|
413
|
-
# The position can be 'a', 'b', 'c' or '
|
|
472
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
473
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
474
|
+
# position 'z'.
|
|
414
475
|
#
|
|
415
476
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
416
477
|
# |device_identifier_constant|
|
|
417
478
|
def get_identity
|
|
418
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
479
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
419
480
|
end
|
|
420
481
|
|
|
421
482
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|