tinkerforge 2.1.24 → 2.1.29
Sign up to get free protection for your applications and to get access to all the features.
- 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
|
# Capacitive touch sensor for 12 electrodes
|
14
16
|
class BrickletMultiTouch < Device
|
@@ -33,7 +35,7 @@ module Tinkerforge
|
|
33
35
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
34
36
|
# the IP Connection <tt>ipcon</tt>.
|
35
37
|
def initialize(uid, ipcon)
|
36
|
-
super uid, ipcon
|
38
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
37
39
|
|
38
40
|
@api_version = [2, 0, 0]
|
39
41
|
|
@@ -45,8 +47,9 @@ module Tinkerforge
|
|
45
47
|
@response_expected[FUNCTION_GET_ELECTRODE_SENSITIVITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
46
48
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
47
49
|
|
48
|
-
@callback_formats[CALLBACK_TOUCH_STATE] = 'S'
|
50
|
+
@callback_formats[CALLBACK_TOUCH_STATE] = [10, 'S']
|
49
51
|
|
52
|
+
@ipcon.add_device self
|
50
53
|
end
|
51
54
|
|
52
55
|
# Returns the current touch state. The state is given as a bitfield.
|
@@ -68,13 +71,17 @@ module Tinkerforge
|
|
68
71
|
# or similar on top of a electrode to build a touch panel with
|
69
72
|
# a professional look.
|
70
73
|
def get_touch_state
|
71
|
-
|
74
|
+
check_validity
|
75
|
+
|
76
|
+
send_request FUNCTION_GET_TOUCH_STATE, [], '', 10, 'S'
|
72
77
|
end
|
73
78
|
|
74
79
|
# Recalibrates the electrodes. Call this function whenever you changed
|
75
80
|
# or moved you electrodes.
|
76
81
|
def recalibrate
|
77
|
-
|
82
|
+
check_validity
|
83
|
+
|
84
|
+
send_request FUNCTION_RECALIBRATE, [], '', 8, ''
|
78
85
|
end
|
79
86
|
|
80
87
|
# Enables/disables electrodes with a bitfield (see BrickletMultiTouch#get_touch_state).
|
@@ -90,14 +97,18 @@ module Tinkerforge
|
|
90
97
|
#
|
91
98
|
# Disabling electrodes will also reduce power consumption.
|
92
99
|
#
|
93
|
-
# Default: 8191 = 0x1FFF = 0b1111111111111 (all electrodes enabled)
|
100
|
+
# Default: 8191 = 0x1FFF = 0b1111111111111 (all electrodes and proximity feature enabled)
|
94
101
|
def set_electrode_config(enabled_electrodes)
|
95
|
-
|
102
|
+
check_validity
|
103
|
+
|
104
|
+
send_request FUNCTION_SET_ELECTRODE_CONFIG, [enabled_electrodes], 'S', 8, ''
|
96
105
|
end
|
97
106
|
|
98
107
|
# Returns the electrode configuration, as set by BrickletMultiTouch#set_electrode_config.
|
99
108
|
def get_electrode_config
|
100
|
-
|
109
|
+
check_validity
|
110
|
+
|
111
|
+
send_request FUNCTION_GET_ELECTRODE_CONFIG, [], '', 10, 'S'
|
101
112
|
end
|
102
113
|
|
103
114
|
# Sets the sensitivity of the electrodes. An electrode with a high sensitivity
|
@@ -110,24 +121,30 @@ module Tinkerforge
|
|
110
121
|
# After a new sensitivity is set, you likely want to call BrickletMultiTouch#recalibrate
|
111
122
|
# to calibrate the electrodes with the newly defined sensitivity.
|
112
123
|
def set_electrode_sensitivity(sensitivity)
|
113
|
-
|
124
|
+
check_validity
|
125
|
+
|
126
|
+
send_request FUNCTION_SET_ELECTRODE_SENSITIVITY, [sensitivity], 'C', 8, ''
|
114
127
|
end
|
115
128
|
|
116
129
|
# Returns the current sensitivity, as set by BrickletMultiTouch#set_electrode_sensitivity.
|
117
130
|
def get_electrode_sensitivity
|
118
|
-
|
131
|
+
check_validity
|
132
|
+
|
133
|
+
send_request FUNCTION_GET_ELECTRODE_SENSITIVITY, [], '', 9, 'C'
|
119
134
|
end
|
120
135
|
|
121
136
|
# Returns the UID, the UID where the Bricklet is connected to,
|
122
137
|
# the position, the hardware and firmware version as well as the
|
123
138
|
# device identifier.
|
124
139
|
#
|
125
|
-
# The position can be 'a', 'b', 'c' or '
|
140
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
141
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
142
|
+
# position 'z'.
|
126
143
|
#
|
127
144
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
128
145
|
# |device_identifier_constant|
|
129
146
|
def get_identity
|
130
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
147
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
131
148
|
end
|
132
149
|
|
133
150
|
# 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
|
# Capacitive touch sensor for 12 electrodes
|
14
16
|
class BrickletMultiTouchV2 < Device
|
@@ -68,7 +70,7 @@ module Tinkerforge
|
|
68
70
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
69
71
|
# the IP Connection <tt>ipcon</tt>.
|
70
72
|
def initialize(uid, ipcon)
|
71
|
-
super uid, ipcon
|
73
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
72
74
|
|
73
75
|
@api_version = [2, 0, 0]
|
74
76
|
|
@@ -95,8 +97,9 @@ module Tinkerforge
|
|
95
97
|
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
96
98
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
97
99
|
|
98
|
-
@callback_formats[CALLBACK_TOUCH_STATE] = '?13'
|
100
|
+
@callback_formats[CALLBACK_TOUCH_STATE] = [10, '?13']
|
99
101
|
|
102
|
+
@ipcon.add_device self
|
100
103
|
end
|
101
104
|
|
102
105
|
# Returns the current touch state. The state is given as a array of
|
@@ -119,7 +122,9 @@ module Tinkerforge
|
|
119
122
|
# CALLBACK_TOUCH_STATE callback. You can set the callback configuration
|
120
123
|
# with BrickletMultiTouchV2#set_touch_state_callback_configuration.
|
121
124
|
def get_touch_state
|
122
|
-
|
125
|
+
check_validity
|
126
|
+
|
127
|
+
send_request FUNCTION_GET_TOUCH_STATE, [], '', 10, '?13'
|
123
128
|
end
|
124
129
|
|
125
130
|
# The period is the period with which the CALLBACK_TOUCH_STATE callback
|
@@ -132,19 +137,25 @@ module Tinkerforge
|
|
132
137
|
# If it is set to false, the callback is continuously triggered with the period,
|
133
138
|
# independent of the value.
|
134
139
|
def set_touch_state_callback_configuration(period, value_has_to_change)
|
135
|
-
|
140
|
+
check_validity
|
141
|
+
|
142
|
+
send_request FUNCTION_SET_TOUCH_STATE_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
|
136
143
|
end
|
137
144
|
|
138
145
|
# Returns the callback configuration as set by
|
139
146
|
# BrickletMultiTouchV2#set_touch_state_callback_configuration.
|
140
147
|
def get_touch_state_callback_configuration
|
141
|
-
|
148
|
+
check_validity
|
149
|
+
|
150
|
+
send_request FUNCTION_GET_TOUCH_STATE_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
|
142
151
|
end
|
143
152
|
|
144
153
|
# Recalibrates the electrodes. Call this function whenever you changed
|
145
154
|
# or moved you electrodes.
|
146
155
|
def recalibrate
|
147
|
-
|
156
|
+
check_validity
|
157
|
+
|
158
|
+
send_request FUNCTION_RECALIBRATE, [], '', 8, ''
|
148
159
|
end
|
149
160
|
|
150
161
|
# Enables/disables electrodes with a bool array (see BrickletMultiTouchV2#get_touch_state).
|
@@ -160,12 +171,16 @@ module Tinkerforge
|
|
160
171
|
#
|
161
172
|
# Disabling electrodes will also reduce power consumption.
|
162
173
|
def set_electrode_config(enabled_electrodes)
|
163
|
-
|
174
|
+
check_validity
|
175
|
+
|
176
|
+
send_request FUNCTION_SET_ELECTRODE_CONFIG, [enabled_electrodes], '?13', 8, ''
|
164
177
|
end
|
165
178
|
|
166
179
|
# Returns the electrode configuration, as set by BrickletMultiTouchV2#set_electrode_config.
|
167
180
|
def get_electrode_config
|
168
|
-
|
181
|
+
check_validity
|
182
|
+
|
183
|
+
send_request FUNCTION_GET_ELECTRODE_CONFIG, [], '', 10, '?13'
|
169
184
|
end
|
170
185
|
|
171
186
|
# Sets the sensitivity of the electrodes. An electrode with a high sensitivity
|
@@ -178,23 +193,31 @@ module Tinkerforge
|
|
178
193
|
# After a new sensitivity is set, you likely want to call BrickletMultiTouchV2#recalibrate
|
179
194
|
# to calibrate the electrodes with the newly defined sensitivity.
|
180
195
|
def set_electrode_sensitivity(sensitivity)
|
181
|
-
|
196
|
+
check_validity
|
197
|
+
|
198
|
+
send_request FUNCTION_SET_ELECTRODE_SENSITIVITY, [sensitivity], 'C', 8, ''
|
182
199
|
end
|
183
200
|
|
184
201
|
# Returns the current sensitivity, as set by BrickletMultiTouchV2#set_electrode_sensitivity.
|
185
202
|
def get_electrode_sensitivity
|
186
|
-
|
203
|
+
check_validity
|
204
|
+
|
205
|
+
send_request FUNCTION_GET_ELECTRODE_SENSITIVITY, [], '', 9, 'C'
|
187
206
|
end
|
188
207
|
|
189
208
|
# Configures the touch LED to be either turned off, turned on, blink in
|
190
209
|
# heartbeat mode or show the touch state (electrode touched = LED on).
|
191
210
|
def set_touch_led_config(config)
|
192
|
-
|
211
|
+
check_validity
|
212
|
+
|
213
|
+
send_request FUNCTION_SET_TOUCH_LED_CONFIG, [config], 'C', 8, ''
|
193
214
|
end
|
194
215
|
|
195
216
|
# Returns the LED configuration as set by BrickletMultiTouchV2#set_touch_led_config
|
196
217
|
def get_touch_led_config
|
197
|
-
|
218
|
+
check_validity
|
219
|
+
|
220
|
+
send_request FUNCTION_GET_TOUCH_LED_CONFIG, [], '', 9, 'C'
|
198
221
|
end
|
199
222
|
|
200
223
|
# Returns the error count for the communication between Brick and Bricklet.
|
@@ -209,7 +232,9 @@ module Tinkerforge
|
|
209
232
|
# The errors counts are for errors that occur on the Bricklet side. All
|
210
233
|
# Bricks have a similar function that returns the errors on the Brick side.
|
211
234
|
def get_spitfp_error_count
|
212
|
-
|
235
|
+
check_validity
|
236
|
+
|
237
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
213
238
|
end
|
214
239
|
|
215
240
|
# Sets the bootloader mode and returns the status after the requested
|
@@ -222,12 +247,16 @@ module Tinkerforge
|
|
222
247
|
# This function is used by Brick Viewer during flashing. It should not be
|
223
248
|
# necessary to call it in a normal user program.
|
224
249
|
def set_bootloader_mode(mode)
|
225
|
-
|
250
|
+
check_validity
|
251
|
+
|
252
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
226
253
|
end
|
227
254
|
|
228
255
|
# Returns the current bootloader mode, see BrickletMultiTouchV2#set_bootloader_mode.
|
229
256
|
def get_bootloader_mode
|
230
|
-
|
257
|
+
check_validity
|
258
|
+
|
259
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
231
260
|
end
|
232
261
|
|
233
262
|
# Sets the firmware pointer for BrickletMultiTouchV2#write_firmware. The pointer has
|
@@ -237,7 +266,9 @@ module Tinkerforge
|
|
237
266
|
# This function is used by Brick Viewer during flashing. It should not be
|
238
267
|
# necessary to call it in a normal user program.
|
239
268
|
def set_write_firmware_pointer(pointer)
|
240
|
-
|
269
|
+
check_validity
|
270
|
+
|
271
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
241
272
|
end
|
242
273
|
|
243
274
|
# Writes 64 Bytes of firmware at the position as written by
|
@@ -249,7 +280,9 @@ module Tinkerforge
|
|
249
280
|
# This function is used by Brick Viewer during flashing. It should not be
|
250
281
|
# necessary to call it in a normal user program.
|
251
282
|
def write_firmware(data)
|
252
|
-
|
283
|
+
check_validity
|
284
|
+
|
285
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
253
286
|
end
|
254
287
|
|
255
288
|
# Sets the status LED configuration. By default the LED shows
|
@@ -260,22 +293,28 @@ module Tinkerforge
|
|
260
293
|
#
|
261
294
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
262
295
|
def set_status_led_config(config)
|
263
|
-
|
296
|
+
check_validity
|
297
|
+
|
298
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
264
299
|
end
|
265
300
|
|
266
301
|
# Returns the configuration as set by BrickletMultiTouchV2#set_status_led_config
|
267
302
|
def get_status_led_config
|
268
|
-
|
303
|
+
check_validity
|
304
|
+
|
305
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
269
306
|
end
|
270
307
|
|
271
|
-
# Returns the temperature
|
308
|
+
# Returns the temperature as measured inside the microcontroller. The
|
272
309
|
# value returned is not the ambient temperature!
|
273
310
|
#
|
274
311
|
# The temperature is only proportional to the real temperature and it has bad
|
275
312
|
# accuracy. Practically it is only useful as an indicator for
|
276
313
|
# temperature changes.
|
277
314
|
def get_chip_temperature
|
278
|
-
|
315
|
+
check_validity
|
316
|
+
|
317
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
279
318
|
end
|
280
319
|
|
281
320
|
# Calling this function will reset the Bricklet. All configurations
|
@@ -285,7 +324,9 @@ module Tinkerforge
|
|
285
324
|
# calling functions on the existing ones will result in
|
286
325
|
# undefined behavior!
|
287
326
|
def reset
|
288
|
-
|
327
|
+
check_validity
|
328
|
+
|
329
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
289
330
|
end
|
290
331
|
|
291
332
|
# Writes a new UID into flash. If you want to set a new UID
|
@@ -294,25 +335,31 @@ module Tinkerforge
|
|
294
335
|
#
|
295
336
|
# We recommend that you use Brick Viewer to change the UID.
|
296
337
|
def write_uid(uid)
|
297
|
-
|
338
|
+
check_validity
|
339
|
+
|
340
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
298
341
|
end
|
299
342
|
|
300
343
|
# Returns the current UID as an integer. Encode as
|
301
344
|
# Base58 to get the usual string version.
|
302
345
|
def read_uid
|
303
|
-
|
346
|
+
check_validity
|
347
|
+
|
348
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
304
349
|
end
|
305
350
|
|
306
351
|
# Returns the UID, the UID where the Bricklet is connected to,
|
307
352
|
# the position, the hardware and firmware version as well as the
|
308
353
|
# device identifier.
|
309
354
|
#
|
310
|
-
# The position can be 'a', 'b', 'c' or '
|
355
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
356
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
357
|
+
# position 'z'.
|
311
358
|
#
|
312
359
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
313
360
|
# |device_identifier_constant|
|
314
361
|
def get_identity
|
315
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
362
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
316
363
|
end
|
317
364
|
|
318
365
|
# 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
|
# NFC tag read/write, NFC P2P and Card Emulation
|
14
16
|
class BrickletNFC < Device
|
@@ -147,7 +149,7 @@ module Tinkerforge
|
|
147
149
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
148
150
|
# the IP Connection <tt>ipcon</tt>.
|
149
151
|
def initialize(uid, ipcon)
|
150
|
-
super uid, ipcon
|
152
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
151
153
|
|
152
154
|
@api_version = [2, 0, 1]
|
153
155
|
|
@@ -189,10 +191,11 @@ module Tinkerforge
|
|
189
191
|
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
190
192
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
191
193
|
|
192
|
-
@callback_formats[CALLBACK_READER_STATE_CHANGED] = 'C ?'
|
193
|
-
@callback_formats[CALLBACK_CARDEMU_STATE_CHANGED] = 'C ?'
|
194
|
-
@callback_formats[CALLBACK_P2P_STATE_CHANGED] = 'C ?'
|
194
|
+
@callback_formats[CALLBACK_READER_STATE_CHANGED] = [10, 'C ?']
|
195
|
+
@callback_formats[CALLBACK_CARDEMU_STATE_CHANGED] = [10, 'C ?']
|
196
|
+
@callback_formats[CALLBACK_P2P_STATE_CHANGED] = [10, 'C ?']
|
195
197
|
|
198
|
+
@ipcon.add_device self
|
196
199
|
end
|
197
200
|
|
198
201
|
# Sets the mode. The NFC Bricklet supports four modes:
|
@@ -206,27 +209,18 @@ module Tinkerforge
|
|
206
209
|
# Therefore, you can only use functions corresponding to the current mode. For
|
207
210
|
# example, in Reader mode you can only use Reader functions.
|
208
211
|
def set_mode(mode)
|
209
|
-
|
212
|
+
check_validity
|
213
|
+
|
214
|
+
send_request FUNCTION_SET_MODE, [mode], 'C', 8, ''
|
210
215
|
end
|
211
216
|
|
212
217
|
# Returns the mode as set by BrickletNFC#set_mode.
|
213
218
|
def get_mode
|
214
|
-
|
219
|
+
check_validity
|
220
|
+
|
221
|
+
send_request FUNCTION_GET_MODE, [], '', 9, 'C'
|
215
222
|
end
|
216
223
|
|
217
|
-
# To read or write a tag that is in proximity of the NFC Bricklet you
|
218
|
-
# first have to call this function with the expected tag type as parameter.
|
219
|
-
# It is no problem if you don't know the tag type. You can cycle through
|
220
|
-
# the available tag types until the tag answers the request.
|
221
|
-
#
|
222
|
-
# Currently the following tag types are supported:
|
223
|
-
#
|
224
|
-
# * Mifare Classic
|
225
|
-
# * NFC Forum Type 1
|
226
|
-
# * NFC Forum Type 2
|
227
|
-
# * NFC Forum Type 3
|
228
|
-
# * NFC Forum Type 4
|
229
|
-
#
|
230
224
|
# After you call BrickletNFC#reader_request_tag_id the NFC Bricklet will try to read
|
231
225
|
# the tag ID from the tag. After this process is done the state will change.
|
232
226
|
# You can either register the CALLBACK_READER_STATE_CHANGED callback or you can poll
|
@@ -245,7 +239,9 @@ module Tinkerforge
|
|
245
239
|
# In case of any *ReaderError* state the selection is lost and you have to
|
246
240
|
# start again by calling BrickletNFC#reader_request_tag_id.
|
247
241
|
def reader_request_tag_id
|
248
|
-
|
242
|
+
check_validity
|
243
|
+
|
244
|
+
send_request FUNCTION_READER_REQUEST_TAG_ID, [], '', 8, ''
|
249
245
|
end
|
250
246
|
|
251
247
|
# Returns the tag type and the tag ID. This function can only be called if the
|
@@ -259,7 +255,9 @@ module Tinkerforge
|
|
259
255
|
# CALLBACK_READER_STATE_CHANGED callback)
|
260
256
|
# 3. Call BrickletNFC#reader_get_tag_id
|
261
257
|
def reader_get_tag_id_low_level
|
262
|
-
|
258
|
+
check_validity
|
259
|
+
|
260
|
+
send_request FUNCTION_READER_GET_TAG_ID_LOW_LEVEL, [], '', 42, 'C C C32'
|
263
261
|
end
|
264
262
|
|
265
263
|
# Returns the current reader state of the NFC Bricklet.
|
@@ -279,7 +277,9 @@ module Tinkerforge
|
|
279
277
|
#
|
280
278
|
# The same approach is used analogously for the other API functions.
|
281
279
|
def reader_get_state
|
282
|
-
|
280
|
+
check_validity
|
281
|
+
|
282
|
+
send_request FUNCTION_READER_GET_STATE, [], '', 10, 'C ?'
|
283
283
|
end
|
284
284
|
|
285
285
|
# Writes NDEF formated data.
|
@@ -297,7 +297,9 @@ module Tinkerforge
|
|
297
297
|
# 5. Wait for state to change to *ReaderWriteNDEFReady* (see BrickletNFC#reader_get_state
|
298
298
|
# or CALLBACK_READER_STATE_CHANGED callback)
|
299
299
|
def reader_write_ndef_low_level(ndef_length, ndef_chunk_offset, ndef_chunk_data)
|
300
|
-
|
300
|
+
check_validity
|
301
|
+
|
302
|
+
send_request FUNCTION_READER_WRITE_NDEF_LOW_LEVEL, [ndef_length, ndef_chunk_offset, ndef_chunk_data], 'S S C60', 8, ''
|
301
303
|
end
|
302
304
|
|
303
305
|
# Reads NDEF formated data from a tag.
|
@@ -316,13 +318,17 @@ module Tinkerforge
|
|
316
318
|
# or CALLBACK_READER_STATE_CHANGED callback)
|
317
319
|
# 6. Call BrickletNFC#reader_read_ndef to retrieve the NDEF message from the buffer
|
318
320
|
def reader_request_ndef
|
319
|
-
|
321
|
+
check_validity
|
322
|
+
|
323
|
+
send_request FUNCTION_READER_REQUEST_NDEF, [], '', 8, ''
|
320
324
|
end
|
321
325
|
|
322
326
|
# Returns the NDEF data from an internal buffer. To fill the buffer
|
323
327
|
# with a NDEF message you have to call BrickletNFC#reader_request_ndef beforehand.
|
324
328
|
def reader_read_ndef_low_level
|
325
|
-
|
329
|
+
check_validity
|
330
|
+
|
331
|
+
send_request FUNCTION_READER_READ_NDEF_LOW_LEVEL, [], '', 72, 'S S C60'
|
326
332
|
end
|
327
333
|
|
328
334
|
# Mifare Classic tags use authentication. If you want to read from or write to
|
@@ -346,7 +352,9 @@ module Tinkerforge
|
|
346
352
|
#
|
347
353
|
# The authentication will always work for one whole sector (4 pages).
|
348
354
|
def reader_authenticate_mifare_classic_page(page, key_number, key)
|
349
|
-
|
355
|
+
check_validity
|
356
|
+
|
357
|
+
send_request FUNCTION_READER_AUTHENTICATE_MIFARE_CLASSIC_PAGE, [page, key_number, key], 'S C C6', 8, ''
|
350
358
|
end
|
351
359
|
|
352
360
|
# Writes a maximum of 8192 bytes starting from the given page. How many pages are written
|
@@ -377,7 +385,9 @@ module Tinkerforge
|
|
377
385
|
#
|
378
386
|
# Choose CC by setting page to 3 or NDEF by setting page to 4.
|
379
387
|
def reader_write_page_low_level(page, data_length, data_chunk_offset, data_chunk_data)
|
380
|
-
|
388
|
+
check_validity
|
389
|
+
|
390
|
+
send_request FUNCTION_READER_WRITE_PAGE_LOW_LEVEL, [page, data_length, data_chunk_offset, data_chunk_data], 'S S S C58', 8, ''
|
381
391
|
end
|
382
392
|
|
383
393
|
# Reads a maximum of 8192 bytes starting from the given page and stores them into a buffer.
|
@@ -411,13 +421,17 @@ module Tinkerforge
|
|
411
421
|
#
|
412
422
|
# Choose CC by setting page to 3 or NDEF by setting page to 4.
|
413
423
|
def reader_request_page(page, length)
|
414
|
-
|
424
|
+
check_validity
|
425
|
+
|
426
|
+
send_request FUNCTION_READER_REQUEST_PAGE, [page, length], 'S S', 8, ''
|
415
427
|
end
|
416
428
|
|
417
429
|
# Returns the page data from an internal buffer. To fill the buffer
|
418
430
|
# with specific pages you have to call BrickletNFC#reader_request_page beforehand.
|
419
431
|
def reader_read_page_low_level
|
420
|
-
|
432
|
+
check_validity
|
433
|
+
|
434
|
+
send_request FUNCTION_READER_READ_PAGE_LOW_LEVEL, [], '', 72, 'S S C60'
|
421
435
|
end
|
422
436
|
|
423
437
|
# Returns the current cardemu state of the NFC Bricklet.
|
@@ -437,7 +451,9 @@ module Tinkerforge
|
|
437
451
|
#
|
438
452
|
# The same approach is used analogously for the other API functions.
|
439
453
|
def cardemu_get_state
|
440
|
-
|
454
|
+
check_validity
|
455
|
+
|
456
|
+
send_request FUNCTION_CARDEMU_GET_STATE, [], '', 10, 'C ?'
|
441
457
|
end
|
442
458
|
|
443
459
|
# Starts the discovery process. If you call this function while a NFC
|
@@ -451,10 +467,12 @@ module Tinkerforge
|
|
451
467
|
# If the cardemu state changes to *CardemuDiscoveryReady* you can start the NDEF message
|
452
468
|
# transfer with BrickletNFC#cardemu_write_ndef and BrickletNFC#cardemu_start_transfer.
|
453
469
|
def cardemu_start_discovery
|
454
|
-
|
470
|
+
check_validity
|
471
|
+
|
472
|
+
send_request FUNCTION_CARDEMU_START_DISCOVERY, [], '', 8, ''
|
455
473
|
end
|
456
474
|
|
457
|
-
# Writes the NDEF
|
475
|
+
# Writes the NDEF message that is to be transferred to the NFC peer.
|
458
476
|
#
|
459
477
|
# The maximum supported NDEF message size in Cardemu mode is 255 byte.
|
460
478
|
#
|
@@ -462,7 +480,9 @@ module Tinkerforge
|
|
462
480
|
# will not be overwritten until you call this function again or change the
|
463
481
|
# mode.
|
464
482
|
def cardemu_write_ndef_low_level(ndef_length, ndef_chunk_offset, ndef_chunk_data)
|
465
|
-
|
483
|
+
check_validity
|
484
|
+
|
485
|
+
send_request FUNCTION_CARDEMU_WRITE_NDEF_LOW_LEVEL, [ndef_length, ndef_chunk_offset, ndef_chunk_data], 'S S C60', 8, ''
|
466
486
|
end
|
467
487
|
|
468
488
|
# You can start the transfer of a NDEF message if the cardemu state is *CardemuDiscoveryReady*.
|
@@ -474,7 +494,9 @@ module Tinkerforge
|
|
474
494
|
# change to *CardemuTransferNDEFReady* if the transfer was successful or
|
475
495
|
# *CardemuTransferNDEFError* if it wasn't.
|
476
496
|
def cardemu_start_transfer(transfer)
|
477
|
-
|
497
|
+
check_validity
|
498
|
+
|
499
|
+
send_request FUNCTION_CARDEMU_START_TRANSFER, [transfer], 'C', 8, ''
|
478
500
|
end
|
479
501
|
|
480
502
|
# Returns the current P2P state of the NFC Bricklet.
|
@@ -494,7 +516,9 @@ module Tinkerforge
|
|
494
516
|
#
|
495
517
|
# The same approach is used analogously for the other API functions.
|
496
518
|
def p2p_get_state
|
497
|
-
|
519
|
+
check_validity
|
520
|
+
|
521
|
+
send_request FUNCTION_P2P_GET_STATE, [], '', 10, 'C ?'
|
498
522
|
end
|
499
523
|
|
500
524
|
# Starts the discovery process. If you call this function while another NFC
|
@@ -508,10 +532,12 @@ module Tinkerforge
|
|
508
532
|
# If the P2P state changes to *P2PDiscoveryReady* you can start the NDEF message
|
509
533
|
# transfer with BrickletNFC#p2p_start_transfer.
|
510
534
|
def p2p_start_discovery
|
511
|
-
|
535
|
+
check_validity
|
536
|
+
|
537
|
+
send_request FUNCTION_P2P_START_DISCOVERY, [], '', 8, ''
|
512
538
|
end
|
513
539
|
|
514
|
-
# Writes the NDEF
|
540
|
+
# Writes the NDEF message that is to be transferred to the NFC peer.
|
515
541
|
#
|
516
542
|
# The maximum supported NDEF message size for P2P transfer is 255 byte.
|
517
543
|
#
|
@@ -519,7 +545,9 @@ module Tinkerforge
|
|
519
545
|
# will not be overwritten until you call this function again, change the
|
520
546
|
# mode or use P2P to read an NDEF messages.
|
521
547
|
def p2p_write_ndef_low_level(ndef_length, ndef_chunk_offset, ndef_chunk_data)
|
522
|
-
|
548
|
+
check_validity
|
549
|
+
|
550
|
+
send_request FUNCTION_P2P_WRITE_NDEF_LOW_LEVEL, [ndef_length, ndef_chunk_offset, ndef_chunk_data], 'S S C60', 8, ''
|
523
551
|
end
|
524
552
|
|
525
553
|
# You can start the transfer of a NDEF message if the P2P state is *P2PDiscoveryReady*.
|
@@ -535,7 +563,9 @@ module Tinkerforge
|
|
535
563
|
# you can now use BrickletNFC#p2p_read_ndef to read the NDEF message that was written
|
536
564
|
# by the NFC peer.
|
537
565
|
def p2p_start_transfer(transfer)
|
538
|
-
|
566
|
+
check_validity
|
567
|
+
|
568
|
+
send_request FUNCTION_P2P_START_TRANSFER, [transfer], 'C', 8, ''
|
539
569
|
end
|
540
570
|
|
541
571
|
# Returns the NDEF message that was written by a NFC peer in NFC P2P mode.
|
@@ -543,7 +573,9 @@ module Tinkerforge
|
|
543
573
|
# The NDEF message is ready if you called BrickletNFC#p2p_start_transfer with a
|
544
574
|
# read transfer and the P2P state changed to *P2PTransferNDEFReady*.
|
545
575
|
def p2p_read_ndef_low_level
|
546
|
-
|
576
|
+
check_validity
|
577
|
+
|
578
|
+
send_request FUNCTION_P2P_READ_NDEF_LOW_LEVEL, [], '', 72, 'S S C60'
|
547
579
|
end
|
548
580
|
|
549
581
|
# Sets the detection LED configuration. By default the LED shows
|
@@ -553,12 +585,16 @@ module Tinkerforge
|
|
553
585
|
#
|
554
586
|
# If the Bricklet is in bootloader mode, the LED is off.
|
555
587
|
def set_detection_led_config(config)
|
556
|
-
|
588
|
+
check_validity
|
589
|
+
|
590
|
+
send_request FUNCTION_SET_DETECTION_LED_CONFIG, [config], 'C', 8, ''
|
557
591
|
end
|
558
592
|
|
559
593
|
# Returns the configuration as set by BrickletNFC#set_detection_led_config
|
560
594
|
def get_detection_led_config
|
561
|
-
|
595
|
+
check_validity
|
596
|
+
|
597
|
+
send_request FUNCTION_GET_DETECTION_LED_CONFIG, [], '', 9, 'C'
|
562
598
|
end
|
563
599
|
|
564
600
|
# Sets the maximum timeout.
|
@@ -581,14 +617,18 @@ module Tinkerforge
|
|
581
617
|
#
|
582
618
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
583
619
|
def set_maximum_timeout(timeout)
|
584
|
-
|
620
|
+
check_validity
|
621
|
+
|
622
|
+
send_request FUNCTION_SET_MAXIMUM_TIMEOUT, [timeout], 'S', 8, ''
|
585
623
|
end
|
586
624
|
|
587
625
|
# Returns the timeout as set by BrickletNFC#set_maximum_timeout
|
588
626
|
#
|
589
627
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
590
628
|
def get_maximum_timeout
|
591
|
-
|
629
|
+
check_validity
|
630
|
+
|
631
|
+
send_request FUNCTION_GET_MAXIMUM_TIMEOUT, [], '', 10, 'S'
|
592
632
|
end
|
593
633
|
|
594
634
|
# Returns the error count for the communication between Brick and Bricklet.
|
@@ -603,7 +643,9 @@ module Tinkerforge
|
|
603
643
|
# The errors counts are for errors that occur on the Bricklet side. All
|
604
644
|
# Bricks have a similar function that returns the errors on the Brick side.
|
605
645
|
def get_spitfp_error_count
|
606
|
-
|
646
|
+
check_validity
|
647
|
+
|
648
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
607
649
|
end
|
608
650
|
|
609
651
|
# Sets the bootloader mode and returns the status after the requested
|
@@ -616,12 +658,16 @@ module Tinkerforge
|
|
616
658
|
# This function is used by Brick Viewer during flashing. It should not be
|
617
659
|
# necessary to call it in a normal user program.
|
618
660
|
def set_bootloader_mode(mode)
|
619
|
-
|
661
|
+
check_validity
|
662
|
+
|
663
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
620
664
|
end
|
621
665
|
|
622
666
|
# Returns the current bootloader mode, see BrickletNFC#set_bootloader_mode.
|
623
667
|
def get_bootloader_mode
|
624
|
-
|
668
|
+
check_validity
|
669
|
+
|
670
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
625
671
|
end
|
626
672
|
|
627
673
|
# Sets the firmware pointer for BrickletNFC#write_firmware. The pointer has
|
@@ -631,7 +677,9 @@ module Tinkerforge
|
|
631
677
|
# This function is used by Brick Viewer during flashing. It should not be
|
632
678
|
# necessary to call it in a normal user program.
|
633
679
|
def set_write_firmware_pointer(pointer)
|
634
|
-
|
680
|
+
check_validity
|
681
|
+
|
682
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
635
683
|
end
|
636
684
|
|
637
685
|
# Writes 64 Bytes of firmware at the position as written by
|
@@ -643,7 +691,9 @@ module Tinkerforge
|
|
643
691
|
# This function is used by Brick Viewer during flashing. It should not be
|
644
692
|
# necessary to call it in a normal user program.
|
645
693
|
def write_firmware(data)
|
646
|
-
|
694
|
+
check_validity
|
695
|
+
|
696
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
647
697
|
end
|
648
698
|
|
649
699
|
# Sets the status LED configuration. By default the LED shows
|
@@ -654,22 +704,28 @@ module Tinkerforge
|
|
654
704
|
#
|
655
705
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
656
706
|
def set_status_led_config(config)
|
657
|
-
|
707
|
+
check_validity
|
708
|
+
|
709
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
658
710
|
end
|
659
711
|
|
660
712
|
# Returns the configuration as set by BrickletNFC#set_status_led_config
|
661
713
|
def get_status_led_config
|
662
|
-
|
714
|
+
check_validity
|
715
|
+
|
716
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
663
717
|
end
|
664
718
|
|
665
|
-
# Returns the temperature
|
719
|
+
# Returns the temperature as measured inside the microcontroller. The
|
666
720
|
# value returned is not the ambient temperature!
|
667
721
|
#
|
668
722
|
# The temperature is only proportional to the real temperature and it has bad
|
669
723
|
# accuracy. Practically it is only useful as an indicator for
|
670
724
|
# temperature changes.
|
671
725
|
def get_chip_temperature
|
672
|
-
|
726
|
+
check_validity
|
727
|
+
|
728
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
673
729
|
end
|
674
730
|
|
675
731
|
# Calling this function will reset the Bricklet. All configurations
|
@@ -679,7 +735,9 @@ module Tinkerforge
|
|
679
735
|
# calling functions on the existing ones will result in
|
680
736
|
# undefined behavior!
|
681
737
|
def reset
|
682
|
-
|
738
|
+
check_validity
|
739
|
+
|
740
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
683
741
|
end
|
684
742
|
|
685
743
|
# Writes a new UID into flash. If you want to set a new UID
|
@@ -688,25 +746,31 @@ module Tinkerforge
|
|
688
746
|
#
|
689
747
|
# We recommend that you use Brick Viewer to change the UID.
|
690
748
|
def write_uid(uid)
|
691
|
-
|
749
|
+
check_validity
|
750
|
+
|
751
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
692
752
|
end
|
693
753
|
|
694
754
|
# Returns the current UID as an integer. Encode as
|
695
755
|
# Base58 to get the usual string version.
|
696
756
|
def read_uid
|
697
|
-
|
757
|
+
check_validity
|
758
|
+
|
759
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
698
760
|
end
|
699
761
|
|
700
762
|
# Returns the UID, the UID where the Bricklet is connected to,
|
701
763
|
# the position, the hardware and firmware version as well as the
|
702
764
|
# device identifier.
|
703
765
|
#
|
704
|
-
# The position can be 'a', 'b', 'c' or '
|
766
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
767
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
768
|
+
# position 'z'.
|
705
769
|
#
|
706
770
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
707
771
|
# |device_identifier_constant|
|
708
772
|
def get_identity
|
709
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
773
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
710
774
|
end
|
711
775
|
|
712
776
|
# Returns the tag type and the tag ID. This function can only be called if the
|
@@ -898,7 +962,7 @@ module Tinkerforge
|
|
898
962
|
data_data[0, data_length]
|
899
963
|
end
|
900
964
|
|
901
|
-
# Writes the NDEF
|
965
|
+
# Writes the NDEF message that is to be transferred to the NFC peer.
|
902
966
|
#
|
903
967
|
# The maximum supported NDEF message size in Cardemu mode is 255 byte.
|
904
968
|
#
|
@@ -936,7 +1000,7 @@ module Tinkerforge
|
|
936
1000
|
ret
|
937
1001
|
end
|
938
1002
|
|
939
|
-
# Writes the NDEF
|
1003
|
+
# Writes the NDEF message that is to be transferred to the NFC peer.
|
940
1004
|
#
|
941
1005
|
# The maximum supported NDEF message size for P2P transfer is 255 byte.
|
942
1006
|
#
|