tinkerforge 2.1.23 → 2.1.28

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. checksums.yaml +5 -5
  2. data/lib/tinkerforge/brick_dc.rb +156 -75
  3. data/lib/tinkerforge/brick_hat.rb +109 -30
  4. data/lib/tinkerforge/brick_hat_zero.rb +119 -21
  5. data/lib/tinkerforge/brick_imu.rb +191 -86
  6. data/lib/tinkerforge/brick_imu_v2.rb +219 -118
  7. data/lib/tinkerforge/brick_master.rb +495 -195
  8. data/lib/tinkerforge/brick_red.rb +197 -74
  9. data/lib/tinkerforge/brick_servo.rb +186 -102
  10. data/lib/tinkerforge/brick_silent_stepper.rb +248 -168
  11. data/lib/tinkerforge/brick_stepper.rb +212 -100
  12. data/lib/tinkerforge/bricklet_accelerometer.rb +61 -36
  13. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +107 -63
  14. data/lib/tinkerforge/bricklet_air_quality.rb +123 -76
  15. data/lib/tinkerforge/bricklet_ambient_light.rb +62 -46
  16. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +41 -28
  17. data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -28
  18. data/lib/tinkerforge/bricklet_analog_in.rb +66 -45
  19. data/lib/tinkerforge/bricklet_analog_in_v2.rb +60 -43
  20. data/lib/tinkerforge/bricklet_analog_in_v3.rb +68 -32
  21. data/lib/tinkerforge/bricklet_analog_out.rb +25 -16
  22. data/lib/tinkerforge/bricklet_analog_out_v2.rb +21 -10
  23. data/lib/tinkerforge/bricklet_analog_out_v3.rb +55 -22
  24. data/lib/tinkerforge/bricklet_barometer.rb +108 -58
  25. data/lib/tinkerforge/bricklet_barometer_v2.rb +109 -67
  26. data/lib/tinkerforge/bricklet_can.rb +84 -24
  27. data/lib/tinkerforge/bricklet_can_v2.rb +173 -72
  28. data/lib/tinkerforge/bricklet_co2.rb +36 -25
  29. data/lib/tinkerforge/bricklet_co2_v2.rb +119 -60
  30. data/lib/tinkerforge/bricklet_color.rb +75 -47
  31. data/lib/tinkerforge/bricklet_color_v2.rb +91 -47
  32. data/lib/tinkerforge/bricklet_compass.rb +81 -40
  33. data/lib/tinkerforge/bricklet_current12.rb +61 -40
  34. data/lib/tinkerforge/bricklet_current25.rb +61 -40
  35. data/lib/tinkerforge/bricklet_distance_ir.rb +60 -38
  36. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +85 -45
  37. data/lib/tinkerforge/bricklet_distance_us.rb +43 -30
  38. data/lib/tinkerforge/bricklet_distance_us_v2.rb +68 -33
  39. data/lib/tinkerforge/bricklet_dmx.rb +92 -48
  40. data/lib/tinkerforge/bricklet_dual_button.rb +23 -12
  41. data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -29
  42. data/lib/tinkerforge/bricklet_dual_relay.rb +27 -14
  43. data/lib/tinkerforge/bricklet_dust_detector.rb +43 -30
  44. data/lib/tinkerforge/bricklet_e_paper_296x128.rb +115 -63
  45. data/lib/tinkerforge/bricklet_energy_monitor.rb +81 -40
  46. data/lib/tinkerforge/bricklet_gps.rb +72 -48
  47. data/lib/tinkerforge/bricklet_gps_v2.rb +124 -73
  48. data/lib/tinkerforge/bricklet_hall_effect.rb +43 -28
  49. data/lib/tinkerforge/bricklet_hall_effect_v2.rb +76 -44
  50. data/lib/tinkerforge/bricklet_humidity.rb +54 -38
  51. data/lib/tinkerforge/bricklet_humidity_v2.rb +86 -49
  52. data/lib/tinkerforge/bricklet_imu_v3.rb +784 -0
  53. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +41 -18
  54. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +84 -40
  55. data/lib/tinkerforge/bricklet_industrial_counter.rb +102 -59
  56. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +51 -24
  57. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +79 -40
  58. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -15
  59. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +75 -33
  60. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +43 -29
  61. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +81 -44
  62. data/lib/tinkerforge/bricklet_industrial_dual_ac_relay.rb +325 -0
  63. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +51 -30
  64. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +139 -40
  65. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +63 -28
  66. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -15
  67. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -28
  68. data/lib/tinkerforge/bricklet_io16.rb +57 -32
  69. data/lib/tinkerforge/bricklet_io16_v2.rb +93 -48
  70. data/lib/tinkerforge/bricklet_io4.rb +56 -31
  71. data/lib/tinkerforge/bricklet_io4_v2.rb +109 -57
  72. data/lib/tinkerforge/bricklet_isolator.rb +111 -35
  73. data/lib/tinkerforge/bricklet_joystick.rb +63 -42
  74. data/lib/tinkerforge/bricklet_joystick_v2.rb +71 -35
  75. data/lib/tinkerforge/bricklet_laser_range_finder.rb +87 -59
  76. data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +99 -51
  77. data/lib/tinkerforge/bricklet_lcd_128x64.rb +219 -131
  78. data/lib/tinkerforge/bricklet_lcd_16x2.rb +49 -25
  79. data/lib/tinkerforge/bricklet_lcd_20x4.rb +59 -29
  80. data/lib/tinkerforge/bricklet_led_strip.rb +69 -47
  81. data/lib/tinkerforge/bricklet_led_strip_v2.rb +105 -48
  82. data/lib/tinkerforge/bricklet_line.rb +35 -22
  83. data/lib/tinkerforge/bricklet_linear_poti.rb +53 -35
  84. data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -24
  85. data/lib/tinkerforge/bricklet_load_cell.rb +64 -40
  86. data/lib/tinkerforge/bricklet_load_cell_v2.rb +81 -41
  87. data/lib/tinkerforge/bricklet_moisture.rb +43 -30
  88. data/lib/tinkerforge/bricklet_motion_detector.rb +21 -10
  89. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -29
  90. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -32
  91. data/lib/tinkerforge/bricklet_multi_touch.rb +30 -17
  92. data/lib/tinkerforge/bricklet_multi_touch_v2.rb +76 -39
  93. data/lib/tinkerforge/bricklet_nfc.rb +130 -80
  94. data/lib/tinkerforge/bricklet_nfc_rfid.rb +32 -13
  95. data/lib/tinkerforge/bricklet_oled_128x64.rb +30 -17
  96. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +75 -40
  97. data/lib/tinkerforge/bricklet_oled_64x48.rb +30 -17
  98. data/lib/tinkerforge/bricklet_one_wire.rb +65 -24
  99. data/lib/tinkerforge/bricklet_outdoor_weather.rb +84 -41
  100. data/lib/tinkerforge/bricklet_particulate_matter.rb +85 -37
  101. data/lib/tinkerforge/bricklet_performance_dc.rb +676 -0
  102. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -13
  103. data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -19
  104. data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +84 -57
  105. data/lib/tinkerforge/bricklet_ptc.rb +76 -51
  106. data/lib/tinkerforge/bricklet_ptc_v2.rb +96 -54
  107. data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -36
  108. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -47
  109. data/lib/tinkerforge/bricklet_remote_switch.rb +38 -29
  110. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +86 -49
  111. data/lib/tinkerforge/bricklet_rgb_led.rb +17 -8
  112. data/lib/tinkerforge/bricklet_rgb_led_button.rb +61 -30
  113. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +78 -33
  114. data/lib/tinkerforge/bricklet_rgb_led_v2.rb +51 -20
  115. data/lib/tinkerforge/bricklet_rotary_encoder.rb +40 -25
  116. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -27
  117. data/lib/tinkerforge/bricklet_rotary_poti.rb +55 -37
  118. data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +57 -26
  119. data/lib/tinkerforge/bricklet_rs232.rb +89 -28
  120. data/lib/tinkerforge/bricklet_rs232_v2.rb +121 -47
  121. data/lib/tinkerforge/bricklet_rs485.rb +250 -164
  122. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
  123. data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -36
  124. data/lib/tinkerforge/bricklet_servo_v2.rb +565 -0
  125. data/lib/tinkerforge/bricklet_solid_state_relay.rb +24 -13
  126. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +58 -25
  127. data/lib/tinkerforge/bricklet_sound_intensity.rb +36 -24
  128. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +77 -41
  129. data/lib/tinkerforge/bricklet_temperature.rb +43 -28
  130. data/lib/tinkerforge/bricklet_temperature_ir.rb +61 -47
  131. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +74 -44
  132. data/lib/tinkerforge/bricklet_temperature_v2.rb +62 -31
  133. data/lib/tinkerforge/bricklet_thermal_imaging.rb +118 -68
  134. data/lib/tinkerforge/bricklet_thermocouple.rb +46 -30
  135. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -30
  136. data/lib/tinkerforge/bricklet_tilt.rb +23 -10
  137. data/lib/tinkerforge/bricklet_uv_light.rb +37 -24
  138. data/lib/tinkerforge/bricklet_uv_light_v2.rb +87 -46
  139. data/lib/tinkerforge/bricklet_voltage.rb +54 -37
  140. data/lib/tinkerforge/bricklet_voltage_current.rb +94 -85
  141. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +92 -77
  142. data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +81 -36
  143. data/lib/tinkerforge/device_display_names.rb +167 -0
  144. data/lib/tinkerforge/ip_connection.rb +156 -33
  145. data/lib/tinkerforge/version.rb +1 -1
  146. metadata +8 -3
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-08-23. #
3
+ # This file was automatically generated on 2021-01-15. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.23 #
5
+ # Ruby Bindings Version 2.1.28 #
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
- send_request FUNCTION_GET_TOUCH_STATE, [], '', 2, 'S'
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
- send_request FUNCTION_RECALIBRATE, [], '', 0, ''
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
- send_request FUNCTION_SET_ELECTRODE_CONFIG, [enabled_electrodes], 'S', 0, ''
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
- send_request FUNCTION_GET_ELECTRODE_CONFIG, [], '', 2, 'S'
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
@@ -109,29 +120,31 @@ module Tinkerforge
109
120
  #
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
- #
113
- # The valid sensitivity value range is 5-201.
114
- #
115
- # The default sensitivity value is 181.
116
123
  def set_electrode_sensitivity(sensitivity)
117
- send_request FUNCTION_SET_ELECTRODE_SENSITIVITY, [sensitivity], 'C', 0, ''
124
+ check_validity
125
+
126
+ send_request FUNCTION_SET_ELECTRODE_SENSITIVITY, [sensitivity], 'C', 8, ''
118
127
  end
119
128
 
120
129
  # Returns the current sensitivity, as set by BrickletMultiTouch#set_electrode_sensitivity.
121
130
  def get_electrode_sensitivity
122
- send_request FUNCTION_GET_ELECTRODE_SENSITIVITY, [], '', 1, 'C'
131
+ check_validity
132
+
133
+ send_request FUNCTION_GET_ELECTRODE_SENSITIVITY, [], '', 9, 'C'
123
134
  end
124
135
 
125
136
  # Returns the UID, the UID where the Bricklet is connected to,
126
137
  # the position, the hardware and firmware version as well as the
127
138
  # device identifier.
128
139
  #
129
- # The position can be 'a', 'b', 'c' or 'd'.
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'.
130
143
  #
131
144
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
132
145
  # |device_identifier_constant|
133
146
  def get_identity
134
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
147
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
135
148
  end
136
149
 
137
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 2019-08-23. #
3
+ # This file was automatically generated on 2021-01-15. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.23 #
5
+ # Ruby Bindings Version 2.1.28 #
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,10 +122,12 @@ 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
- send_request FUNCTION_GET_TOUCH_STATE, [], '', 13, '?13'
125
+ check_validity
126
+
127
+ send_request FUNCTION_GET_TOUCH_STATE, [], '', 10, '?13'
123
128
  end
124
129
 
125
- # The period in ms is the period with which the CALLBACK_TOUCH_STATE callback
130
+ # The period is the period with which the CALLBACK_TOUCH_STATE callback
126
131
  # is triggered periodically. A value of 0 turns the callback off.
127
132
  #
128
133
  # If the `value has to change`-parameter is set to true, the callback is only
@@ -131,22 +136,26 @@ module Tinkerforge
131
136
  #
132
137
  # If it is set to false, the callback is continuously triggered with the period,
133
138
  # independent of the value.
134
- #
135
- # The default value is (0, false).
136
139
  def set_touch_state_callback_configuration(period, value_has_to_change)
137
- send_request FUNCTION_SET_TOUCH_STATE_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 0, ''
140
+ check_validity
141
+
142
+ send_request FUNCTION_SET_TOUCH_STATE_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
138
143
  end
139
144
 
140
145
  # Returns the callback configuration as set by
141
146
  # BrickletMultiTouchV2#set_touch_state_callback_configuration.
142
147
  def get_touch_state_callback_configuration
143
- send_request FUNCTION_GET_TOUCH_STATE_CALLBACK_CONFIGURATION, [], '', 5, 'L ?'
148
+ check_validity
149
+
150
+ send_request FUNCTION_GET_TOUCH_STATE_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
144
151
  end
145
152
 
146
153
  # Recalibrates the electrodes. Call this function whenever you changed
147
154
  # or moved you electrodes.
148
155
  def recalibrate
149
- send_request FUNCTION_RECALIBRATE, [], '', 0, ''
156
+ check_validity
157
+
158
+ send_request FUNCTION_RECALIBRATE, [], '', 8, ''
150
159
  end
151
160
 
152
161
  # Enables/disables electrodes with a bool array (see BrickletMultiTouchV2#get_touch_state).
@@ -161,15 +170,17 @@ module Tinkerforge
161
170
  # traffic that is produced by the CALLBACK_TOUCH_STATE callback.
162
171
  #
163
172
  # Disabling electrodes will also reduce power consumption.
164
- #
165
- # Default: All electrodes enabled.
166
173
  def set_electrode_config(enabled_electrodes)
167
- send_request FUNCTION_SET_ELECTRODE_CONFIG, [enabled_electrodes], '?13', 0, ''
174
+ check_validity
175
+
176
+ send_request FUNCTION_SET_ELECTRODE_CONFIG, [enabled_electrodes], '?13', 8, ''
168
177
  end
169
178
 
170
179
  # Returns the electrode configuration, as set by BrickletMultiTouchV2#set_electrode_config.
171
180
  def get_electrode_config
172
- send_request FUNCTION_GET_ELECTRODE_CONFIG, [], '', 13, '?13'
181
+ check_validity
182
+
183
+ send_request FUNCTION_GET_ELECTRODE_CONFIG, [], '', 10, '?13'
173
184
  end
174
185
 
175
186
  # Sets the sensitivity of the electrodes. An electrode with a high sensitivity
@@ -181,30 +192,32 @@ module Tinkerforge
181
192
  #
182
193
  # After a new sensitivity is set, you likely want to call BrickletMultiTouchV2#recalibrate
183
194
  # to calibrate the electrodes with the newly defined sensitivity.
184
- #
185
- # The valid sensitivity value range is 5-201.
186
- #
187
- # The default sensitivity value is 181.
188
195
  def set_electrode_sensitivity(sensitivity)
189
- send_request FUNCTION_SET_ELECTRODE_SENSITIVITY, [sensitivity], 'C', 0, ''
196
+ check_validity
197
+
198
+ send_request FUNCTION_SET_ELECTRODE_SENSITIVITY, [sensitivity], 'C', 8, ''
190
199
  end
191
200
 
192
201
  # Returns the current sensitivity, as set by BrickletMultiTouchV2#set_electrode_sensitivity.
193
202
  def get_electrode_sensitivity
194
- send_request FUNCTION_GET_ELECTRODE_SENSITIVITY, [], '', 1, 'C'
203
+ check_validity
204
+
205
+ send_request FUNCTION_GET_ELECTRODE_SENSITIVITY, [], '', 9, 'C'
195
206
  end
196
207
 
197
208
  # Configures the touch LED to be either turned off, turned on, blink in
198
209
  # heartbeat mode or show the touch state (electrode touched = LED on).
199
- #
200
- # The default value is 3 (show touch state).
201
210
  def set_touch_led_config(config)
202
- send_request FUNCTION_SET_TOUCH_LED_CONFIG, [config], 'C', 0, ''
211
+ check_validity
212
+
213
+ send_request FUNCTION_SET_TOUCH_LED_CONFIG, [config], 'C', 8, ''
203
214
  end
204
215
 
205
216
  # Returns the LED configuration as set by BrickletMultiTouchV2#set_touch_led_config
206
217
  def get_touch_led_config
207
- send_request FUNCTION_GET_TOUCH_LED_CONFIG, [], '', 1, 'C'
218
+ check_validity
219
+
220
+ send_request FUNCTION_GET_TOUCH_LED_CONFIG, [], '', 9, 'C'
208
221
  end
209
222
 
210
223
  # Returns the error count for the communication between Brick and Bricklet.
@@ -219,7 +232,9 @@ module Tinkerforge
219
232
  # The errors counts are for errors that occur on the Bricklet side. All
220
233
  # Bricks have a similar function that returns the errors on the Brick side.
221
234
  def get_spitfp_error_count
222
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
235
+ check_validity
236
+
237
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
223
238
  end
224
239
 
225
240
  # Sets the bootloader mode and returns the status after the requested
@@ -232,12 +247,16 @@ module Tinkerforge
232
247
  # This function is used by Brick Viewer during flashing. It should not be
233
248
  # necessary to call it in a normal user program.
234
249
  def set_bootloader_mode(mode)
235
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
250
+ check_validity
251
+
252
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
236
253
  end
237
254
 
238
255
  # Returns the current bootloader mode, see BrickletMultiTouchV2#set_bootloader_mode.
239
256
  def get_bootloader_mode
240
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
257
+ check_validity
258
+
259
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
241
260
  end
242
261
 
243
262
  # Sets the firmware pointer for BrickletMultiTouchV2#write_firmware. The pointer has
@@ -247,7 +266,9 @@ module Tinkerforge
247
266
  # This function is used by Brick Viewer during flashing. It should not be
248
267
  # necessary to call it in a normal user program.
249
268
  def set_write_firmware_pointer(pointer)
250
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
269
+ check_validity
270
+
271
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
251
272
  end
252
273
 
253
274
  # Writes 64 Bytes of firmware at the position as written by
@@ -259,7 +280,9 @@ module Tinkerforge
259
280
  # This function is used by Brick Viewer during flashing. It should not be
260
281
  # necessary to call it in a normal user program.
261
282
  def write_firmware(data)
262
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
283
+ check_validity
284
+
285
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
263
286
  end
264
287
 
265
288
  # Sets the status LED configuration. By default the LED shows
@@ -270,22 +293,28 @@ module Tinkerforge
270
293
  #
271
294
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
272
295
  def set_status_led_config(config)
273
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
296
+ check_validity
297
+
298
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
274
299
  end
275
300
 
276
301
  # Returns the configuration as set by BrickletMultiTouchV2#set_status_led_config
277
302
  def get_status_led_config
278
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
303
+ check_validity
304
+
305
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
279
306
  end
280
307
 
281
- # Returns the temperature in °C as measured inside the microcontroller. The
308
+ # Returns the temperature as measured inside the microcontroller. The
282
309
  # value returned is not the ambient temperature!
283
310
  #
284
311
  # The temperature is only proportional to the real temperature and it has bad
285
312
  # accuracy. Practically it is only useful as an indicator for
286
313
  # temperature changes.
287
314
  def get_chip_temperature
288
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
315
+ check_validity
316
+
317
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
289
318
  end
290
319
 
291
320
  # Calling this function will reset the Bricklet. All configurations
@@ -295,7 +324,9 @@ module Tinkerforge
295
324
  # calling functions on the existing ones will result in
296
325
  # undefined behavior!
297
326
  def reset
298
- send_request FUNCTION_RESET, [], '', 0, ''
327
+ check_validity
328
+
329
+ send_request FUNCTION_RESET, [], '', 8, ''
299
330
  end
300
331
 
301
332
  # Writes a new UID into flash. If you want to set a new UID
@@ -304,25 +335,31 @@ module Tinkerforge
304
335
  #
305
336
  # We recommend that you use Brick Viewer to change the UID.
306
337
  def write_uid(uid)
307
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
338
+ check_validity
339
+
340
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
308
341
  end
309
342
 
310
343
  # Returns the current UID as an integer. Encode as
311
344
  # Base58 to get the usual string version.
312
345
  def read_uid
313
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
346
+ check_validity
347
+
348
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
314
349
  end
315
350
 
316
351
  # Returns the UID, the UID where the Bricklet is connected to,
317
352
  # the position, the hardware and firmware version as well as the
318
353
  # device identifier.
319
354
  #
320
- # The position can be 'a', 'b', 'c' or 'd'.
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'.
321
358
  #
322
359
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
323
360
  # |device_identifier_constant|
324
361
  def get_identity
325
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
362
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
326
363
  end
327
364
 
328
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 2019-08-23. #
3
+ # This file was automatically generated on 2021-01-15. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.23 #
5
+ # Ruby Bindings Version 2.1.28 #
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:
@@ -205,30 +208,19 @@ module Tinkerforge
205
208
  # If you change a mode, the Bricklet will reconfigure the hardware for this mode.
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
- #
209
- # The default mode is "off".
210
211
  def set_mode(mode)
211
- send_request FUNCTION_SET_MODE, [mode], 'C', 0, ''
212
+ check_validity
213
+
214
+ send_request FUNCTION_SET_MODE, [mode], 'C', 8, ''
212
215
  end
213
216
 
214
217
  # Returns the mode as set by BrickletNFC#set_mode.
215
218
  def get_mode
216
- send_request FUNCTION_GET_MODE, [], '', 1, 'C'
219
+ check_validity
220
+
221
+ send_request FUNCTION_GET_MODE, [], '', 9, 'C'
217
222
  end
218
223
 
219
- # To read or write a tag that is in proximity of the NFC Bricklet you
220
- # first have to call this function with the expected tag type as parameter.
221
- # It is no problem if you don't know the tag type. You can cycle through
222
- # the available tag types until the tag answers the request.
223
- #
224
- # Currently the following tag types are supported:
225
- #
226
- # * Mifare Classic
227
- # * NFC Forum Type 1
228
- # * NFC Forum Type 2
229
- # * NFC Forum Type 3
230
- # * NFC Forum Type 4
231
- #
232
224
  # After you call BrickletNFC#reader_request_tag_id the NFC Bricklet will try to read
233
225
  # the tag ID from the tag. After this process is done the state will change.
234
226
  # You can either register the CALLBACK_READER_STATE_CHANGED callback or you can poll
@@ -247,7 +239,9 @@ module Tinkerforge
247
239
  # In case of any *ReaderError* state the selection is lost and you have to
248
240
  # start again by calling BrickletNFC#reader_request_tag_id.
249
241
  def reader_request_tag_id
250
- send_request FUNCTION_READER_REQUEST_TAG_ID, [], '', 0, ''
242
+ check_validity
243
+
244
+ send_request FUNCTION_READER_REQUEST_TAG_ID, [], '', 8, ''
251
245
  end
252
246
 
253
247
  # Returns the tag type and the tag ID. This function can only be called if the
@@ -261,7 +255,9 @@ module Tinkerforge
261
255
  # CALLBACK_READER_STATE_CHANGED callback)
262
256
  # 3. Call BrickletNFC#reader_get_tag_id
263
257
  def reader_get_tag_id_low_level
264
- send_request FUNCTION_READER_GET_TAG_ID_LOW_LEVEL, [], '', 34, 'C C C32'
258
+ check_validity
259
+
260
+ send_request FUNCTION_READER_GET_TAG_ID_LOW_LEVEL, [], '', 42, 'C C C32'
265
261
  end
266
262
 
267
263
  # Returns the current reader state of the NFC Bricklet.
@@ -281,10 +277,12 @@ module Tinkerforge
281
277
  #
282
278
  # The same approach is used analogously for the other API functions.
283
279
  def reader_get_state
284
- send_request FUNCTION_READER_GET_STATE, [], '', 2, 'C ?'
280
+ check_validity
281
+
282
+ send_request FUNCTION_READER_GET_STATE, [], '', 10, 'C ?'
285
283
  end
286
284
 
287
- # Writes NDEF formated data with a maximum of 255 bytes.
285
+ # Writes NDEF formated data.
288
286
  #
289
287
  # This function currently supports NFC Forum Type 2 and 4.
290
288
  #
@@ -299,7 +297,9 @@ module Tinkerforge
299
297
  # 5. Wait for state to change to *ReaderWriteNDEFReady* (see BrickletNFC#reader_get_state
300
298
  # or CALLBACK_READER_STATE_CHANGED callback)
301
299
  def reader_write_ndef_low_level(ndef_length, ndef_chunk_offset, ndef_chunk_data)
302
- send_request FUNCTION_READER_WRITE_NDEF_LOW_LEVEL, [ndef_length, ndef_chunk_offset, ndef_chunk_data], 'S S C60', 0, ''
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, ''
303
303
  end
304
304
 
305
305
  # Reads NDEF formated data from a tag.
@@ -318,15 +318,17 @@ module Tinkerforge
318
318
  # or CALLBACK_READER_STATE_CHANGED callback)
319
319
  # 6. Call BrickletNFC#reader_read_ndef to retrieve the NDEF message from the buffer
320
320
  def reader_request_ndef
321
- send_request FUNCTION_READER_REQUEST_NDEF, [], '', 0, ''
321
+ check_validity
322
+
323
+ send_request FUNCTION_READER_REQUEST_NDEF, [], '', 8, ''
322
324
  end
323
325
 
324
326
  # Returns the NDEF data from an internal buffer. To fill the buffer
325
327
  # with a NDEF message you have to call BrickletNFC#reader_request_ndef beforehand.
326
- #
327
- # The buffer can have a size of up to 8192 bytes.
328
328
  def reader_read_ndef_low_level
329
- send_request FUNCTION_READER_READ_NDEF_LOW_LEVEL, [], '', 64, 'S S C60'
329
+ check_validity
330
+
331
+ send_request FUNCTION_READER_READ_NDEF_LOW_LEVEL, [], '', 72, 'S S C60'
330
332
  end
331
333
 
332
334
  # Mifare Classic tags use authentication. If you want to read from or write to
@@ -350,7 +352,9 @@ module Tinkerforge
350
352
  #
351
353
  # The authentication will always work for one whole sector (4 pages).
352
354
  def reader_authenticate_mifare_classic_page(page, key_number, key)
353
- send_request FUNCTION_READER_AUTHENTICATE_MIFARE_CLASSIC_PAGE, [page, key_number, key], 'S C C6', 0, ''
355
+ check_validity
356
+
357
+ send_request FUNCTION_READER_AUTHENTICATE_MIFARE_CLASSIC_PAGE, [page, key_number, key], 'S C C6', 8, ''
354
358
  end
355
359
 
356
360
  # Writes a maximum of 8192 bytes starting from the given page. How many pages are written
@@ -381,7 +385,9 @@ module Tinkerforge
381
385
  #
382
386
  # Choose CC by setting page to 3 or NDEF by setting page to 4.
383
387
  def reader_write_page_low_level(page, data_length, data_chunk_offset, data_chunk_data)
384
- send_request FUNCTION_READER_WRITE_PAGE_LOW_LEVEL, [page, data_length, data_chunk_offset, data_chunk_data], 'S S S C58', 0, ''
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, ''
385
391
  end
386
392
 
387
393
  # Reads a maximum of 8192 bytes starting from the given page and stores them into a buffer.
@@ -415,15 +421,17 @@ module Tinkerforge
415
421
  #
416
422
  # Choose CC by setting page to 3 or NDEF by setting page to 4.
417
423
  def reader_request_page(page, length)
418
- send_request FUNCTION_READER_REQUEST_PAGE, [page, length], 'S S', 0, ''
424
+ check_validity
425
+
426
+ send_request FUNCTION_READER_REQUEST_PAGE, [page, length], 'S S', 8, ''
419
427
  end
420
428
 
421
429
  # Returns the page data from an internal buffer. To fill the buffer
422
430
  # with specific pages you have to call BrickletNFC#reader_request_page beforehand.
423
- #
424
- # The buffer can have a size of up to 8192 bytes.
425
431
  def reader_read_page_low_level
426
- send_request FUNCTION_READER_READ_PAGE_LOW_LEVEL, [], '', 64, 'S S C60'
432
+ check_validity
433
+
434
+ send_request FUNCTION_READER_READ_PAGE_LOW_LEVEL, [], '', 72, 'S S C60'
427
435
  end
428
436
 
429
437
  # Returns the current cardemu state of the NFC Bricklet.
@@ -443,7 +451,9 @@ module Tinkerforge
443
451
  #
444
452
  # The same approach is used analogously for the other API functions.
445
453
  def cardemu_get_state
446
- send_request FUNCTION_CARDEMU_GET_STATE, [], '', 2, 'C ?'
454
+ check_validity
455
+
456
+ send_request FUNCTION_CARDEMU_GET_STATE, [], '', 10, 'C ?'
447
457
  end
448
458
 
449
459
  # Starts the discovery process. If you call this function while a NFC
@@ -457,10 +467,12 @@ module Tinkerforge
457
467
  # If the cardemu state changes to *CardemuDiscoveryReady* you can start the NDEF message
458
468
  # transfer with BrickletNFC#cardemu_write_ndef and BrickletNFC#cardemu_start_transfer.
459
469
  def cardemu_start_discovery
460
- send_request FUNCTION_CARDEMU_START_DISCOVERY, [], '', 0, ''
470
+ check_validity
471
+
472
+ send_request FUNCTION_CARDEMU_START_DISCOVERY, [], '', 8, ''
461
473
  end
462
474
 
463
- # Writes the NDEF messages that is to be transferred to the NFC peer.
475
+ # Writes the NDEF message that is to be transferred to the NFC peer.
464
476
  #
465
477
  # The maximum supported NDEF message size in Cardemu mode is 255 byte.
466
478
  #
@@ -468,7 +480,9 @@ module Tinkerforge
468
480
  # will not be overwritten until you call this function again or change the
469
481
  # mode.
470
482
  def cardemu_write_ndef_low_level(ndef_length, ndef_chunk_offset, ndef_chunk_data)
471
- send_request FUNCTION_CARDEMU_WRITE_NDEF_LOW_LEVEL, [ndef_length, ndef_chunk_offset, ndef_chunk_data], 'S S C60', 0, ''
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, ''
472
486
  end
473
487
 
474
488
  # You can start the transfer of a NDEF message if the cardemu state is *CardemuDiscoveryReady*.
@@ -480,7 +494,9 @@ module Tinkerforge
480
494
  # change to *CardemuTransferNDEFReady* if the transfer was successful or
481
495
  # *CardemuTransferNDEFError* if it wasn't.
482
496
  def cardemu_start_transfer(transfer)
483
- send_request FUNCTION_CARDEMU_START_TRANSFER, [transfer], 'C', 0, ''
497
+ check_validity
498
+
499
+ send_request FUNCTION_CARDEMU_START_TRANSFER, [transfer], 'C', 8, ''
484
500
  end
485
501
 
486
502
  # Returns the current P2P state of the NFC Bricklet.
@@ -500,7 +516,9 @@ module Tinkerforge
500
516
  #
501
517
  # The same approach is used analogously for the other API functions.
502
518
  def p2p_get_state
503
- send_request FUNCTION_P2P_GET_STATE, [], '', 2, 'C ?'
519
+ check_validity
520
+
521
+ send_request FUNCTION_P2P_GET_STATE, [], '', 10, 'C ?'
504
522
  end
505
523
 
506
524
  # Starts the discovery process. If you call this function while another NFC
@@ -514,10 +532,12 @@ module Tinkerforge
514
532
  # If the P2P state changes to *P2PDiscoveryReady* you can start the NDEF message
515
533
  # transfer with BrickletNFC#p2p_start_transfer.
516
534
  def p2p_start_discovery
517
- send_request FUNCTION_P2P_START_DISCOVERY, [], '', 0, ''
535
+ check_validity
536
+
537
+ send_request FUNCTION_P2P_START_DISCOVERY, [], '', 8, ''
518
538
  end
519
539
 
520
- # Writes the NDEF messages that is to be transferred to the NFC peer.
540
+ # Writes the NDEF message that is to be transferred to the NFC peer.
521
541
  #
522
542
  # The maximum supported NDEF message size for P2P transfer is 255 byte.
523
543
  #
@@ -525,7 +545,9 @@ module Tinkerforge
525
545
  # will not be overwritten until you call this function again, change the
526
546
  # mode or use P2P to read an NDEF messages.
527
547
  def p2p_write_ndef_low_level(ndef_length, ndef_chunk_offset, ndef_chunk_data)
528
- send_request FUNCTION_P2P_WRITE_NDEF_LOW_LEVEL, [ndef_length, ndef_chunk_offset, ndef_chunk_data], 'S S C60', 0, ''
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, ''
529
551
  end
530
552
 
531
553
  # You can start the transfer of a NDEF message if the P2P state is *P2PDiscoveryReady*.
@@ -541,16 +563,19 @@ module Tinkerforge
541
563
  # you can now use BrickletNFC#p2p_read_ndef to read the NDEF message that was written
542
564
  # by the NFC peer.
543
565
  def p2p_start_transfer(transfer)
544
- send_request FUNCTION_P2P_START_TRANSFER, [transfer], 'C', 0, ''
566
+ check_validity
567
+
568
+ send_request FUNCTION_P2P_START_TRANSFER, [transfer], 'C', 8, ''
545
569
  end
546
570
 
547
571
  # Returns the NDEF message that was written by a NFC peer in NFC P2P mode.
548
- # The maximum NDEF length is 8192 byte.
549
572
  #
550
573
  # The NDEF message is ready if you called BrickletNFC#p2p_start_transfer with a
551
574
  # read transfer and the P2P state changed to *P2PTransferNDEFReady*.
552
575
  def p2p_read_ndef_low_level
553
- send_request FUNCTION_P2P_READ_NDEF_LOW_LEVEL, [], '', 64, 'S S C60'
576
+ check_validity
577
+
578
+ send_request FUNCTION_P2P_READ_NDEF_LOW_LEVEL, [], '', 72, 'S S C60'
554
579
  end
555
580
 
556
581
  # Sets the detection LED configuration. By default the LED shows
@@ -560,15 +585,19 @@ module Tinkerforge
560
585
  #
561
586
  # If the Bricklet is in bootloader mode, the LED is off.
562
587
  def set_detection_led_config(config)
563
- send_request FUNCTION_SET_DETECTION_LED_CONFIG, [config], 'C', 0, ''
588
+ check_validity
589
+
590
+ send_request FUNCTION_SET_DETECTION_LED_CONFIG, [config], 'C', 8, ''
564
591
  end
565
592
 
566
593
  # Returns the configuration as set by BrickletNFC#set_detection_led_config
567
594
  def get_detection_led_config
568
- send_request FUNCTION_GET_DETECTION_LED_CONFIG, [], '', 1, 'C'
595
+ check_validity
596
+
597
+ send_request FUNCTION_GET_DETECTION_LED_CONFIG, [], '', 9, 'C'
569
598
  end
570
599
 
571
- # Sets the maximum timeout in ms.
600
+ # Sets the maximum timeout.
572
601
  #
573
602
  # This is a global maximum used for all internal state timeouts. The timeouts depend heavily
574
603
  # on the used tags etc. For example: If you use a Type 2 tag and you want to detect if
@@ -583,21 +612,23 @@ module Tinkerforge
583
612
  # If you need a fast response time to discover if a tag is present or not you can find
584
613
  # a good timeout value by trial and error for your specific tag.
585
614
  #
586
- # By default we use a very conservative timeout, to be sure that any Tag can always
615
+ # By default we use a very conservative timeout, to be sure that any tag can always
587
616
  # answer in time.
588
617
  #
589
- # Default timeout: 2000ms.
590
- #
591
618
  # .. versionadded:: 2.0.1$nbsp;(Plugin)
592
619
  def set_maximum_timeout(timeout)
593
- send_request FUNCTION_SET_MAXIMUM_TIMEOUT, [timeout], 'S', 0, ''
620
+ check_validity
621
+
622
+ send_request FUNCTION_SET_MAXIMUM_TIMEOUT, [timeout], 'S', 8, ''
594
623
  end
595
624
 
596
625
  # Returns the timeout as set by BrickletNFC#set_maximum_timeout
597
626
  #
598
627
  # .. versionadded:: 2.0.1$nbsp;(Plugin)
599
628
  def get_maximum_timeout
600
- send_request FUNCTION_GET_MAXIMUM_TIMEOUT, [], '', 2, 'S'
629
+ check_validity
630
+
631
+ send_request FUNCTION_GET_MAXIMUM_TIMEOUT, [], '', 10, 'S'
601
632
  end
602
633
 
603
634
  # Returns the error count for the communication between Brick and Bricklet.
@@ -612,7 +643,9 @@ module Tinkerforge
612
643
  # The errors counts are for errors that occur on the Bricklet side. All
613
644
  # Bricks have a similar function that returns the errors on the Brick side.
614
645
  def get_spitfp_error_count
615
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
646
+ check_validity
647
+
648
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
616
649
  end
617
650
 
618
651
  # Sets the bootloader mode and returns the status after the requested
@@ -625,12 +658,16 @@ module Tinkerforge
625
658
  # This function is used by Brick Viewer during flashing. It should not be
626
659
  # necessary to call it in a normal user program.
627
660
  def set_bootloader_mode(mode)
628
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
661
+ check_validity
662
+
663
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
629
664
  end
630
665
 
631
666
  # Returns the current bootloader mode, see BrickletNFC#set_bootloader_mode.
632
667
  def get_bootloader_mode
633
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
668
+ check_validity
669
+
670
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
634
671
  end
635
672
 
636
673
  # Sets the firmware pointer for BrickletNFC#write_firmware. The pointer has
@@ -640,7 +677,9 @@ module Tinkerforge
640
677
  # This function is used by Brick Viewer during flashing. It should not be
641
678
  # necessary to call it in a normal user program.
642
679
  def set_write_firmware_pointer(pointer)
643
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
680
+ check_validity
681
+
682
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
644
683
  end
645
684
 
646
685
  # Writes 64 Bytes of firmware at the position as written by
@@ -652,7 +691,9 @@ module Tinkerforge
652
691
  # This function is used by Brick Viewer during flashing. It should not be
653
692
  # necessary to call it in a normal user program.
654
693
  def write_firmware(data)
655
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
694
+ check_validity
695
+
696
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
656
697
  end
657
698
 
658
699
  # Sets the status LED configuration. By default the LED shows
@@ -663,22 +704,28 @@ module Tinkerforge
663
704
  #
664
705
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
665
706
  def set_status_led_config(config)
666
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
707
+ check_validity
708
+
709
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
667
710
  end
668
711
 
669
712
  # Returns the configuration as set by BrickletNFC#set_status_led_config
670
713
  def get_status_led_config
671
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
714
+ check_validity
715
+
716
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
672
717
  end
673
718
 
674
- # Returns the temperature in °C as measured inside the microcontroller. The
719
+ # Returns the temperature as measured inside the microcontroller. The
675
720
  # value returned is not the ambient temperature!
676
721
  #
677
722
  # The temperature is only proportional to the real temperature and it has bad
678
723
  # accuracy. Practically it is only useful as an indicator for
679
724
  # temperature changes.
680
725
  def get_chip_temperature
681
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
726
+ check_validity
727
+
728
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
682
729
  end
683
730
 
684
731
  # Calling this function will reset the Bricklet. All configurations
@@ -688,7 +735,9 @@ module Tinkerforge
688
735
  # calling functions on the existing ones will result in
689
736
  # undefined behavior!
690
737
  def reset
691
- send_request FUNCTION_RESET, [], '', 0, ''
738
+ check_validity
739
+
740
+ send_request FUNCTION_RESET, [], '', 8, ''
692
741
  end
693
742
 
694
743
  # Writes a new UID into flash. If you want to set a new UID
@@ -697,25 +746,31 @@ module Tinkerforge
697
746
  #
698
747
  # We recommend that you use Brick Viewer to change the UID.
699
748
  def write_uid(uid)
700
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
749
+ check_validity
750
+
751
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
701
752
  end
702
753
 
703
754
  # Returns the current UID as an integer. Encode as
704
755
  # Base58 to get the usual string version.
705
756
  def read_uid
706
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
757
+ check_validity
758
+
759
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
707
760
  end
708
761
 
709
762
  # Returns the UID, the UID where the Bricklet is connected to,
710
763
  # the position, the hardware and firmware version as well as the
711
764
  # device identifier.
712
765
  #
713
- # The position can be 'a', 'b', 'c' or 'd'.
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'.
714
769
  #
715
770
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
716
771
  # |device_identifier_constant|
717
772
  def get_identity
718
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
773
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
719
774
  end
720
775
 
721
776
  # Returns the tag type and the tag ID. This function can only be called if the
@@ -734,7 +789,7 @@ module Tinkerforge
734
789
  [ret[0], ret[2][0, ret[1]]]
735
790
  end
736
791
 
737
- # Writes NDEF formated data with a maximum of 255 bytes.
792
+ # Writes NDEF formated data.
738
793
  #
739
794
  # This function currently supports NFC Forum Type 2 and 4.
740
795
  #
@@ -781,8 +836,6 @@ module Tinkerforge
781
836
 
782
837
  # Returns the NDEF data from an internal buffer. To fill the buffer
783
838
  # with a NDEF message you have to call BrickletNFC#reader_request_ndef beforehand.
784
- #
785
- # The buffer can have a size of up to 8192 bytes.
786
839
  def reader_read_ndef
787
840
  ndef_length = nil # assigned in block
788
841
  ndef_data = nil # assigned in block
@@ -876,8 +929,6 @@ module Tinkerforge
876
929
 
877
930
  # Returns the page data from an internal buffer. To fill the buffer
878
931
  # with specific pages you have to call BrickletNFC#reader_request_page beforehand.
879
- #
880
- # The buffer can have a size of up to 8192 bytes.
881
932
  def reader_read_page
882
933
  data_length = nil # assigned in block
883
934
  data_data = nil # assigned in block
@@ -911,7 +962,7 @@ module Tinkerforge
911
962
  data_data[0, data_length]
912
963
  end
913
964
 
914
- # Writes the NDEF messages that is to be transferred to the NFC peer.
965
+ # Writes the NDEF message that is to be transferred to the NFC peer.
915
966
  #
916
967
  # The maximum supported NDEF message size in Cardemu mode is 255 byte.
917
968
  #
@@ -949,7 +1000,7 @@ module Tinkerforge
949
1000
  ret
950
1001
  end
951
1002
 
952
- # Writes the NDEF messages that is to be transferred to the NFC peer.
1003
+ # Writes the NDEF message that is to be transferred to the NFC peer.
953
1004
  #
954
1005
  # The maximum supported NDEF message size for P2P transfer is 255 byte.
955
1006
  #
@@ -988,7 +1039,6 @@ module Tinkerforge
988
1039
  end
989
1040
 
990
1041
  # Returns the NDEF message that was written by a NFC peer in NFC P2P mode.
991
- # The maximum NDEF length is 8192 byte.
992
1042
  #
993
1043
  # The NDEF message is ready if you called BrickletNFC#p2p_start_transfer with a
994
1044
  # read transfer and the P2P state changed to *P2PTransferNDEFReady*.