tinkerforge 2.1.24 → 2.1.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tinkerforge/brick_dc.rb +155 -74
  3. data/lib/tinkerforge/brick_hat.rb +70 -30
  4. data/lib/tinkerforge/brick_hat_zero.rb +56 -22
  5. data/lib/tinkerforge/brick_imu.rb +184 -77
  6. data/lib/tinkerforge/brick_imu_v2.rb +208 -105
  7. data/lib/tinkerforge/brick_master.rb +484 -182
  8. data/lib/tinkerforge/brick_red.rb +197 -74
  9. data/lib/tinkerforge/brick_servo.rb +185 -101
  10. data/lib/tinkerforge/brick_silent_stepper.rb +246 -166
  11. data/lib/tinkerforge/brick_stepper.rb +210 -98
  12. data/lib/tinkerforge/bricklet_accelerometer.rb +58 -23
  13. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +105 -54
  14. data/lib/tinkerforge/bricklet_air_quality.rb +117 -59
  15. data/lib/tinkerforge/bricklet_ambient_light.rb +51 -21
  16. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +40 -22
  17. data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -25
  18. data/lib/tinkerforge/bricklet_analog_in.rb +63 -25
  19. data/lib/tinkerforge/bricklet_analog_in_v2.rb +57 -23
  20. data/lib/tinkerforge/bricklet_analog_in_v3.rb +67 -25
  21. data/lib/tinkerforge/bricklet_analog_out.rb +23 -9
  22. data/lib/tinkerforge/bricklet_analog_out_v2.rb +20 -8
  23. data/lib/tinkerforge/bricklet_analog_out_v3.rb +54 -20
  24. data/lib/tinkerforge/bricklet_barometer.rb +66 -26
  25. data/lib/tinkerforge/bricklet_barometer_v2.rb +99 -37
  26. data/lib/tinkerforge/bricklet_can.rb +83 -18
  27. data/lib/tinkerforge/bricklet_can_v2.rb +172 -38
  28. data/lib/tinkerforge/bricklet_co2.rb +34 -14
  29. data/lib/tinkerforge/bricklet_co2_v2.rb +97 -37
  30. data/lib/tinkerforge/bricklet_color.rb +69 -27
  31. data/lib/tinkerforge/bricklet_color_v2.rb +87 -33
  32. data/lib/tinkerforge/bricklet_compass.rb +78 -30
  33. data/lib/tinkerforge/bricklet_current12.rb +58 -24
  34. data/lib/tinkerforge/bricklet_current25.rb +58 -24
  35. data/lib/tinkerforge/bricklet_distance_ir.rb +57 -23
  36. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +83 -31
  37. data/lib/tinkerforge/bricklet_distance_us.rb +40 -16
  38. data/lib/tinkerforge/bricklet_distance_us_v2.rb +67 -25
  39. data/lib/tinkerforge/bricklet_dmx.rb +88 -34
  40. data/lib/tinkerforge/bricklet_dual_button.rb +24 -10
  41. data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -24
  42. data/lib/tinkerforge/bricklet_dual_relay.rb +27 -11
  43. data/lib/tinkerforge/bricklet_dust_detector.rb +40 -16
  44. data/lib/tinkerforge/bricklet_e_paper_296x128.rb +88 -32
  45. data/lib/tinkerforge/bricklet_energy_monitor.rb +73 -27
  46. data/lib/tinkerforge/bricklet_gps.rb +64 -26
  47. data/lib/tinkerforge/bricklet_gps_v2.rb +117 -47
  48. data/lib/tinkerforge/bricklet_hall_effect.rb +43 -23
  49. data/lib/tinkerforge/bricklet_hall_effect_v2.rb +71 -27
  50. data/lib/tinkerforge/bricklet_humidity.rb +51 -21
  51. data/lib/tinkerforge/bricklet_humidity_v2.rb +83 -31
  52. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +38 -14
  53. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +81 -29
  54. data/lib/tinkerforge/bricklet_industrial_counter.rb +101 -39
  55. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +45 -17
  56. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +77 -29
  57. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -14
  58. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +73 -27
  59. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +40 -16
  60. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +79 -29
  61. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +49 -19
  62. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +82 -30
  63. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +61 -23
  64. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -14
  65. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -25
  66. data/lib/tinkerforge/bricklet_io16.rb +55 -21
  67. data/lib/tinkerforge/bricklet_io16_v2.rb +90 -34
  68. data/lib/tinkerforge/bricklet_io4.rb +55 -23
  69. data/lib/tinkerforge/bricklet_io4_v2.rb +96 -36
  70. data/lib/tinkerforge/bricklet_isolator.rb +72 -28
  71. data/lib/tinkerforge/bricklet_joystick.rb +59 -25
  72. data/lib/tinkerforge/bricklet_joystick_v2.rb +68 -26
  73. data/lib/tinkerforge/bricklet_laser_range_finder.rb +82 -32
  74. data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +96 -36
  75. data/lib/tinkerforge/bricklet_lcd_128x64.rb +192 -70
  76. data/lib/tinkerforge/bricklet_lcd_16x2.rb +45 -18
  77. data/lib/tinkerforge/bricklet_lcd_20x4.rb +58 -23
  78. data/lib/tinkerforge/bricklet_led_strip.rb +60 -22
  79. data/lib/tinkerforge/bricklet_led_strip_v2.rb +91 -46
  80. data/lib/tinkerforge/bricklet_line.rb +34 -14
  81. data/lib/tinkerforge/bricklet_linear_poti.rb +51 -21
  82. data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -21
  83. data/lib/tinkerforge/bricklet_load_cell.rb +61 -23
  84. data/lib/tinkerforge/bricklet_load_cell_v2.rb +80 -30
  85. data/lib/tinkerforge/bricklet_moisture.rb +40 -16
  86. data/lib/tinkerforge/bricklet_motion_detector.rb +22 -10
  87. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -24
  88. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -27
  89. data/lib/tinkerforge/bricklet_multi_touch.rb +31 -13
  90. data/lib/tinkerforge/bricklet_multi_touch_v2.rb +76 -28
  91. data/lib/tinkerforge/bricklet_nfc.rb +123 -58
  92. data/lib/tinkerforge/bricklet_nfc_rfid.rb +33 -13
  93. data/lib/tinkerforge/bricklet_oled_128x64.rb +29 -11
  94. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +66 -24
  95. data/lib/tinkerforge/bricklet_oled_64x48.rb +29 -11
  96. data/lib/tinkerforge/bricklet_one_wire.rb +66 -24
  97. data/lib/tinkerforge/bricklet_outdoor_weather.rb +71 -27
  98. data/lib/tinkerforge/bricklet_particulate_matter.rb +75 -30
  99. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -9
  100. data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -10
  101. data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +80 -42
  102. data/lib/tinkerforge/bricklet_ptc.rb +74 -42
  103. data/lib/tinkerforge/bricklet_ptc_v2.rb +95 -48
  104. data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -33
  105. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -44
  106. data/lib/tinkerforge/bricklet_remote_switch.rb +39 -29
  107. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +87 -49
  108. data/lib/tinkerforge/bricklet_rgb_led.rb +18 -8
  109. data/lib/tinkerforge/bricklet_rgb_led_button.rb +62 -30
  110. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +79 -33
  111. data/lib/tinkerforge/bricklet_rgb_led_v2.rb +52 -20
  112. data/lib/tinkerforge/bricklet_rotary_encoder.rb +39 -19
  113. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -24
  114. data/lib/tinkerforge/bricklet_rotary_poti.rb +53 -28
  115. data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +57 -23
  116. data/lib/tinkerforge/bricklet_rs232.rb +90 -28
  117. data/lib/tinkerforge/bricklet_rs232_v2.rb +118 -44
  118. data/lib/tinkerforge/bricklet_rs485.rb +223 -95
  119. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +25 -14
  120. data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -35
  121. data/lib/tinkerforge/bricklet_solid_state_relay.rb +25 -13
  122. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +59 -25
  123. data/lib/tinkerforge/bricklet_sound_intensity.rb +35 -18
  124. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +72 -31
  125. data/lib/tinkerforge/bricklet_temperature.rb +40 -16
  126. data/lib/tinkerforge/bricklet_temperature_ir.rb +57 -23
  127. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +71 -27
  128. data/lib/tinkerforge/bricklet_temperature_v2.rb +61 -25
  129. data/lib/tinkerforge/bricklet_thermal_imaging.rb +105 -44
  130. data/lib/tinkerforge/bricklet_thermocouple.rb +45 -24
  131. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -27
  132. data/lib/tinkerforge/bricklet_tilt.rb +24 -10
  133. data/lib/tinkerforge/bricklet_uv_light.rb +36 -18
  134. data/lib/tinkerforge/bricklet_uv_light_v2.rb +85 -37
  135. data/lib/tinkerforge/bricklet_voltage.rb +52 -28
  136. data/lib/tinkerforge/bricklet_voltage_current.rb +91 -73
  137. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +90 -68
  138. data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +80 -30
  139. data/lib/tinkerforge/device_display_names.rb +163 -0
  140. data/lib/tinkerforge/ip_connection.rb +151 -32
  141. data/lib/tinkerforge/version.rb +1 -1
  142. metadata +3 -2
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-11-25. #
3
+ # This file was automatically generated on 2020-04-07. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.25 #
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
@@ -110,24 +121,31 @@ 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
- send_request FUNCTION_SET_ELECTRODE_SENSITIVITY, [sensitivity], 'C', 0, ''
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
- send_request FUNCTION_GET_ELECTRODE_SENSITIVITY, [], '', 1, 'C'
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 'd'.
140
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
141
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
142
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
143
+ # position 'z'.
126
144
  #
127
145
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
128
146
  # |device_identifier_constant|
129
147
  def get_identity
130
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
148
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
131
149
  end
132
150
 
133
151
  # 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-11-25. #
3
+ # This file was automatically generated on 2020-04-07. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.25 #
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
- 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
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
- 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, ''
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
- 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 ?'
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
- send_request FUNCTION_RECALIBRATE, [], '', 0, ''
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
- 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, ''
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
- send_request FUNCTION_GET_ELECTRODE_CONFIG, [], '', 13, '?13'
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
- send_request FUNCTION_SET_ELECTRODE_SENSITIVITY, [sensitivity], 'C', 0, ''
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
- send_request FUNCTION_GET_ELECTRODE_SENSITIVITY, [], '', 1, 'C'
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
- 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, ''
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
- send_request FUNCTION_GET_TOUCH_LED_CONFIG, [], '', 1, 'C'
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
- 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'
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
- 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'
226
253
  end
227
254
 
228
255
  # Returns the current bootloader mode, see BrickletMultiTouchV2#set_bootloader_mode.
229
256
  def get_bootloader_mode
230
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
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
- 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, ''
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
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
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
- 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, ''
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
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
303
+ check_validity
304
+
305
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
269
306
  end
270
307
 
271
- # Returns the temperature in °C as measured inside the microcontroller. The
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
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
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
- send_request FUNCTION_RESET, [], '', 0, ''
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,32 @@ module Tinkerforge
294
335
  #
295
336
  # We recommend that you use Brick Viewer to change the UID.
296
337
  def write_uid(uid)
297
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
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
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
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 'd'.
355
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
356
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
357
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
358
+ # position 'z'.
311
359
  #
312
360
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
313
361
  # |device_identifier_constant|
314
362
  def get_identity
315
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
363
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
316
364
  end
317
365
 
318
366
  # 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-11-25. #
3
+ # This file was automatically generated on 2020-04-07. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.25 #
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
- send_request FUNCTION_SET_MODE, [mode], 'C', 0, ''
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
- send_request FUNCTION_GET_MODE, [], '', 1, 'C'
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
- send_request FUNCTION_READER_REQUEST_TAG_ID, [], '', 0, ''
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
- 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'
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
- send_request FUNCTION_READER_GET_STATE, [], '', 2, 'C ?'
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
- 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, ''
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
- send_request FUNCTION_READER_REQUEST_NDEF, [], '', 0, ''
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
- 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'
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
- 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, ''
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
- 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, ''
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
- 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, ''
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
- 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'
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
- send_request FUNCTION_CARDEMU_GET_STATE, [], '', 2, 'C ?'
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,7 +467,9 @@ 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
- send_request FUNCTION_CARDEMU_START_DISCOVERY, [], '', 0, ''
470
+ check_validity
471
+
472
+ send_request FUNCTION_CARDEMU_START_DISCOVERY, [], '', 8, ''
455
473
  end
456
474
 
457
475
  # Writes the NDEF messages that is to be transferred to the NFC peer.
@@ -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
- 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, ''
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
- send_request FUNCTION_CARDEMU_START_TRANSFER, [transfer], 'C', 0, ''
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
- send_request FUNCTION_P2P_GET_STATE, [], '', 2, 'C ?'
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,7 +532,9 @@ 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
- send_request FUNCTION_P2P_START_DISCOVERY, [], '', 0, ''
535
+ check_validity
536
+
537
+ send_request FUNCTION_P2P_START_DISCOVERY, [], '', 8, ''
512
538
  end
513
539
 
514
540
  # Writes the NDEF messages that is to be transferred to the NFC peer.
@@ -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
- 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, ''
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
- send_request FUNCTION_P2P_START_TRANSFER, [transfer], 'C', 0, ''
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
- 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'
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
- 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, ''
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
- send_request FUNCTION_GET_DETECTION_LED_CONFIG, [], '', 1, 'C'
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
- send_request FUNCTION_SET_MAXIMUM_TIMEOUT, [timeout], 'S', 0, ''
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
- send_request FUNCTION_GET_MAXIMUM_TIMEOUT, [], '', 2, 'S'
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
- 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'
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
- 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'
620
664
  end
621
665
 
622
666
  # Returns the current bootloader mode, see BrickletNFC#set_bootloader_mode.
623
667
  def get_bootloader_mode
624
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
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
- 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, ''
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
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
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
- 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, ''
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
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
714
+ check_validity
715
+
716
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
663
717
  end
664
718
 
665
- # Returns the temperature in °C as measured inside the microcontroller. The
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
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
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
- send_request FUNCTION_RESET, [], '', 0, ''
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,32 @@ module Tinkerforge
688
746
  #
689
747
  # We recommend that you use Brick Viewer to change the UID.
690
748
  def write_uid(uid)
691
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
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
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
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 'd'.
766
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
767
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
768
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
769
+ # position 'z'.
705
770
  #
706
771
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
707
772
  # |device_identifier_constant|
708
773
  def get_identity
709
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
774
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
710
775
  end
711
776
 
712
777
  # Returns the tag type and the tag ID. This function can only be called if the