tinkerforge 2.1.24 → 2.1.25

Sign up to get free protection for your applications and to get access to all the features.
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
  # Four 7-segment displays with switchable colon
14
16
  class BrickletSegmentDisplay4x7 < Device
@@ -29,7 +31,7 @@ module Tinkerforge
29
31
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
30
32
  # the IP Connection <tt>ipcon</tt>.
31
33
  def initialize(uid, ipcon)
32
- super uid, ipcon
34
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
33
35
 
34
36
  @api_version = [2, 0, 0]
35
37
 
@@ -39,8 +41,9 @@ module Tinkerforge
39
41
  @response_expected[FUNCTION_GET_COUNTER_VALUE] = RESPONSE_EXPECTED_ALWAYS_TRUE
40
42
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
41
43
 
42
- @callback_formats[CALLBACK_COUNTER_FINISHED] = ''
44
+ @callback_formats[CALLBACK_COUNTER_FINISHED] = [8, '']
43
45
 
46
+ @ipcon.add_device self
44
47
  end
45
48
 
46
49
  # The 7-segment display can be set with bitmaps. Every bit controls one
@@ -57,50 +60,58 @@ module Tinkerforge
57
60
  # The brightness can be set between 0 (dark) and 7 (bright). The colon
58
61
  # parameter turns the colon of the display on or off.
59
62
  def set_segments(segments, brightness, colon)
60
- send_request FUNCTION_SET_SEGMENTS, [segments, brightness, colon], 'C4 C ?', 0, ''
63
+ check_validity
64
+
65
+ send_request FUNCTION_SET_SEGMENTS, [segments, brightness, colon], 'C4 C ?', 8, ''
61
66
  end
62
67
 
63
68
  # Returns the segment, brightness and color data as set by
64
69
  # BrickletSegmentDisplay4x7#set_segments.
65
70
  def get_segments
66
- send_request FUNCTION_GET_SEGMENTS, [], '', 6, 'C4 C ?'
71
+ check_validity
72
+
73
+ send_request FUNCTION_GET_SEGMENTS, [], '', 14, 'C4 C ?'
67
74
  end
68
75
 
69
76
  # Starts a counter with the *from* value that counts to the *to*
70
77
  # value with the each step incremented by *increment*.
71
- # The *length* of the increment is given in ms.
78
+ # *length* is the pause between each increment.
72
79
  #
73
80
  # Example: If you set *from* to 0, *to* to 100, *increment* to 1 and
74
81
  # *length* to 1000, a counter that goes from 0 to 100 with one second
75
82
  # pause between each increment will be started.
76
83
  #
77
- # The maximum values for *from*, *to* and *increment* is 9999,
78
- # the minimum value is -999.
79
- #
80
84
  # Using a negative increment allows to count backwards.
81
85
  #
82
86
  # You can stop the counter at every time by calling BrickletSegmentDisplay4x7#set_segments.
83
87
  def start_counter(value_from, value_to, increment, length)
84
- send_request FUNCTION_START_COUNTER, [value_from, value_to, increment, length], 's s s L', 0, ''
88
+ check_validity
89
+
90
+ send_request FUNCTION_START_COUNTER, [value_from, value_to, increment, length], 's s s L', 8, ''
85
91
  end
86
92
 
87
93
  # Returns the counter value that is currently shown on the display.
88
94
  #
89
95
  # If there is no counter running a 0 will be returned.
90
96
  def get_counter_value
91
- send_request FUNCTION_GET_COUNTER_VALUE, [], '', 2, 'S'
97
+ check_validity
98
+
99
+ send_request FUNCTION_GET_COUNTER_VALUE, [], '', 10, 'S'
92
100
  end
93
101
 
94
102
  # Returns the UID, the UID where the Bricklet is connected to,
95
103
  # the position, the hardware and firmware version as well as the
96
104
  # device identifier.
97
105
  #
98
- # The position can be 'a', 'b', 'c' or 'd'.
106
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
107
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
108
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
109
+ # position 'z'.
99
110
  #
100
111
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
101
112
  # |device_identifier_constant|
102
113
  def get_identity
103
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
114
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
104
115
  end
105
116
 
106
117
  # 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
  # Four 7-segment displays with switchable dots
14
16
  class BrickletSegmentDisplay4x7V2 < Device
@@ -60,7 +62,7 @@ module Tinkerforge
60
62
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
61
63
  # the IP Connection <tt>ipcon</tt>.
62
64
  def initialize(uid, ipcon)
63
- super uid, ipcon
65
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
64
66
 
65
67
  @api_version = [2, 0, 0]
66
68
 
@@ -86,8 +88,9 @@ module Tinkerforge
86
88
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
87
89
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
88
90
 
89
- @callback_formats[CALLBACK_COUNTER_FINISHED] = ''
91
+ @callback_formats[CALLBACK_COUNTER_FINISHED] = [8, '']
90
92
 
93
+ @ipcon.add_device self
91
94
  end
92
95
 
93
96
  # Sets the segments of the Segment Display 4x7 Bricklet 2.0 segment-by-segment.
@@ -101,28 +104,33 @@ module Tinkerforge
101
104
  # :alt: Indices of segments
102
105
  # :align: center
103
106
  def set_segments(digit0, digit1, digit2, digit3, colon, tick)
104
- send_request FUNCTION_SET_SEGMENTS, [digit0, digit1, digit2, digit3, colon, tick], '?8 ?8 ?8 ?8 ?2 ?', 0, ''
107
+ check_validity
108
+
109
+ send_request FUNCTION_SET_SEGMENTS, [digit0, digit1, digit2, digit3, colon, tick], '?8 ?8 ?8 ?8 ?2 ?', 8, ''
105
110
  end
106
111
 
107
112
  # Returns the segment data as set by BrickletSegmentDisplay4x7V2#set_segments.
108
113
  def get_segments
109
- send_request FUNCTION_GET_SEGMENTS, [], '', 35, '?8 ?8 ?8 ?8 ?2 ?'
114
+ check_validity
115
+
116
+ send_request FUNCTION_GET_SEGMENTS, [], '', 14, '?8 ?8 ?8 ?8 ?2 ?'
110
117
  end
111
118
 
112
119
  # The brightness can be set between 0 (dark) and 7 (bright).
113
- #
114
- # The default value is 7.
115
120
  def set_brightness(brightness)
116
- send_request FUNCTION_SET_BRIGHTNESS, [brightness], 'C', 0, ''
121
+ check_validity
122
+
123
+ send_request FUNCTION_SET_BRIGHTNESS, [brightness], 'C', 8, ''
117
124
  end
118
125
 
119
126
  # Returns the brightness as set by BrickletSegmentDisplay4x7V2#set_brightness.
120
127
  def get_brightness
121
- send_request FUNCTION_GET_BRIGHTNESS, [], '', 1, 'C'
128
+ check_validity
129
+
130
+ send_request FUNCTION_GET_BRIGHTNESS, [], '', 9, 'C'
122
131
  end
123
132
 
124
- # Sets a numeric value for each of the digits. The values can be between
125
- # -2 and 15. They represent:
133
+ # Sets a numeric value for each of the digits. They represent:
126
134
  #
127
135
  # * -2: minus sign
128
136
  # * -1: blank
@@ -136,7 +144,9 @@ module Tinkerforge
136
144
  #
137
145
  # Example: A call with [-2, -1, 4, 2] will result in a display of "- 42".
138
146
  def set_numeric_value(value)
139
- send_request FUNCTION_SET_NUMERIC_VALUE, [value], 'c4', 0, ''
147
+ check_validity
148
+
149
+ send_request FUNCTION_SET_NUMERIC_VALUE, [value], 'c4', 8, ''
140
150
  end
141
151
 
142
152
  # Turns one specified segment on or off.
@@ -148,38 +158,43 @@ module Tinkerforge
148
158
  # :alt: Indices of selected segments
149
159
  # :align: center
150
160
  def set_selected_segment(segment, value)
151
- send_request FUNCTION_SET_SELECTED_SEGMENT, [segment, value], 'C ?', 0, ''
161
+ check_validity
162
+
163
+ send_request FUNCTION_SET_SELECTED_SEGMENT, [segment, value], 'C ?', 8, ''
152
164
  end
153
165
 
154
166
  # Returns the value of a single segment.
155
167
  def get_selected_segment(segment)
156
- send_request FUNCTION_GET_SELECTED_SEGMENT, [segment], 'C', 1, '?'
168
+ check_validity
169
+
170
+ send_request FUNCTION_GET_SELECTED_SEGMENT, [segment], 'C', 9, '?'
157
171
  end
158
172
 
159
173
  # Starts a counter with the *from* value that counts to the *to*
160
174
  # value with the each step incremented by *increment*.
161
- # The *length* of the increment is given in ms.
175
+ # *length* is the pause between each increment.
162
176
  #
163
177
  # Example: If you set *from* to 0, *to* to 100, *increment* to 1 and
164
178
  # *length* to 1000, a counter that goes from 0 to 100 with one second
165
179
  # pause between each increment will be started.
166
180
  #
167
- # The maximum values for *from*, *to* and *increment* is 9999,
168
- # the minimum value is -999.
169
- #
170
181
  # Using a negative *increment* allows to count backwards.
171
182
  #
172
183
  # You can stop the counter at every time by calling BrickletSegmentDisplay4x7V2#set_segments
173
184
  # or BrickletSegmentDisplay4x7V2#set_numeric_value.
174
185
  def start_counter(value_from, value_to, increment, length)
175
- send_request FUNCTION_START_COUNTER, [value_from, value_to, increment, length], 's s s L', 0, ''
186
+ check_validity
187
+
188
+ send_request FUNCTION_START_COUNTER, [value_from, value_to, increment, length], 's s s L', 8, ''
176
189
  end
177
190
 
178
191
  # Returns the counter value that is currently shown on the display.
179
192
  #
180
193
  # If there is no counter running a 0 will be returned.
181
194
  def get_counter_value
182
- send_request FUNCTION_GET_COUNTER_VALUE, [], '', 2, 'S'
195
+ check_validity
196
+
197
+ send_request FUNCTION_GET_COUNTER_VALUE, [], '', 10, 'S'
183
198
  end
184
199
 
185
200
  # Returns the error count for the communication between Brick and Bricklet.
@@ -194,7 +209,9 @@ module Tinkerforge
194
209
  # The errors counts are for errors that occur on the Bricklet side. All
195
210
  # Bricks have a similar function that returns the errors on the Brick side.
196
211
  def get_spitfp_error_count
197
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
212
+ check_validity
213
+
214
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
198
215
  end
199
216
 
200
217
  # Sets the bootloader mode and returns the status after the requested
@@ -207,12 +224,16 @@ module Tinkerforge
207
224
  # This function is used by Brick Viewer during flashing. It should not be
208
225
  # necessary to call it in a normal user program.
209
226
  def set_bootloader_mode(mode)
210
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
227
+ check_validity
228
+
229
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
211
230
  end
212
231
 
213
232
  # Returns the current bootloader mode, see BrickletSegmentDisplay4x7V2#set_bootloader_mode.
214
233
  def get_bootloader_mode
215
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
234
+ check_validity
235
+
236
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
216
237
  end
217
238
 
218
239
  # Sets the firmware pointer for BrickletSegmentDisplay4x7V2#write_firmware. The pointer has
@@ -222,7 +243,9 @@ module Tinkerforge
222
243
  # This function is used by Brick Viewer during flashing. It should not be
223
244
  # necessary to call it in a normal user program.
224
245
  def set_write_firmware_pointer(pointer)
225
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
246
+ check_validity
247
+
248
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
226
249
  end
227
250
 
228
251
  # Writes 64 Bytes of firmware at the position as written by
@@ -234,7 +257,9 @@ module Tinkerforge
234
257
  # This function is used by Brick Viewer during flashing. It should not be
235
258
  # necessary to call it in a normal user program.
236
259
  def write_firmware(data)
237
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
260
+ check_validity
261
+
262
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
238
263
  end
239
264
 
240
265
  # Sets the status LED configuration. By default the LED shows
@@ -245,22 +270,28 @@ module Tinkerforge
245
270
  #
246
271
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
247
272
  def set_status_led_config(config)
248
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
273
+ check_validity
274
+
275
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
249
276
  end
250
277
 
251
278
  # Returns the configuration as set by BrickletSegmentDisplay4x7V2#set_status_led_config
252
279
  def get_status_led_config
253
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
280
+ check_validity
281
+
282
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
254
283
  end
255
284
 
256
- # Returns the temperature in °C as measured inside the microcontroller. The
285
+ # Returns the temperature as measured inside the microcontroller. The
257
286
  # value returned is not the ambient temperature!
258
287
  #
259
288
  # The temperature is only proportional to the real temperature and it has bad
260
289
  # accuracy. Practically it is only useful as an indicator for
261
290
  # temperature changes.
262
291
  def get_chip_temperature
263
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
292
+ check_validity
293
+
294
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
264
295
  end
265
296
 
266
297
  # Calling this function will reset the Bricklet. All configurations
@@ -270,7 +301,9 @@ module Tinkerforge
270
301
  # calling functions on the existing ones will result in
271
302
  # undefined behavior!
272
303
  def reset
273
- send_request FUNCTION_RESET, [], '', 0, ''
304
+ check_validity
305
+
306
+ send_request FUNCTION_RESET, [], '', 8, ''
274
307
  end
275
308
 
276
309
  # Writes a new UID into flash. If you want to set a new UID
@@ -279,25 +312,32 @@ module Tinkerforge
279
312
  #
280
313
  # We recommend that you use Brick Viewer to change the UID.
281
314
  def write_uid(uid)
282
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
315
+ check_validity
316
+
317
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
283
318
  end
284
319
 
285
320
  # Returns the current UID as an integer. Encode as
286
321
  # Base58 to get the usual string version.
287
322
  def read_uid
288
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
323
+ check_validity
324
+
325
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
289
326
  end
290
327
 
291
328
  # Returns the UID, the UID where the Bricklet is connected to,
292
329
  # the position, the hardware and firmware version as well as the
293
330
  # device identifier.
294
331
  #
295
- # The position can be 'a', 'b', 'c' or 'd'.
332
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
333
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
334
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
335
+ # position 'z'.
296
336
  #
297
337
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
298
338
  # |device_identifier_constant|
299
339
  def get_identity
300
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
340
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
301
341
  end
302
342
 
303
343
  # 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
  # Controls AC and DC Solid State Relays
14
16
  class BrickletSolidStateRelay < Device
@@ -30,7 +32,7 @@ module Tinkerforge
30
32
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
31
33
  # the IP Connection <tt>ipcon</tt>.
32
34
  def initialize(uid, ipcon)
33
- super uid, ipcon
35
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
34
36
 
35
37
  @api_version = [2, 0, 0]
36
38
 
@@ -40,26 +42,29 @@ module Tinkerforge
40
42
  @response_expected[FUNCTION_GET_MONOFLOP] = RESPONSE_EXPECTED_ALWAYS_TRUE
41
43
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
42
44
 
43
- @callback_formats[CALLBACK_MONOFLOP_DONE] = '?'
45
+ @callback_formats[CALLBACK_MONOFLOP_DONE] = [9, '?']
44
46
 
47
+ @ipcon.add_device self
45
48
  end
46
49
 
47
50
  # Sets the state of the relays *true* means on and *false* means off.
48
51
  #
49
52
  # A running monoflop timer will be aborted if this function is called.
50
- #
51
- # The default value is *false*.
52
53
  def set_state(state)
53
- send_request FUNCTION_SET_STATE, [state], '?', 0, ''
54
+ check_validity
55
+
56
+ send_request FUNCTION_SET_STATE, [state], '?', 8, ''
54
57
  end
55
58
 
56
59
  # Returns the state of the relay, *true* means on and *false* means off.
57
60
  def get_state
58
- send_request FUNCTION_GET_STATE, [], '', 1, '?'
61
+ check_validity
62
+
63
+ send_request FUNCTION_GET_STATE, [], '', 9, '?'
59
64
  end
60
65
 
61
66
  # The first parameter is the desired state of the relay (*true* means on
62
- # and *false* means off). The second parameter indicates the time (in ms) that
67
+ # and *false* means off). The second parameter indicates the time that
63
68
  # the relay should hold the state.
64
69
  #
65
70
  # If this function is called with the parameters (true, 1500):
@@ -71,7 +76,9 @@ module Tinkerforge
71
76
  # of two seconds. The relay will be on all the time. If now the RS485
72
77
  # connection is lost, the relay will turn off in at most two seconds.
73
78
  def set_monoflop(state, time)
74
- send_request FUNCTION_SET_MONOFLOP, [state, time], '? L', 0, ''
79
+ check_validity
80
+
81
+ send_request FUNCTION_SET_MONOFLOP, [state, time], '? L', 8, ''
75
82
  end
76
83
 
77
84
  # Returns the current state and the time as set by
@@ -80,19 +87,24 @@ module Tinkerforge
80
87
  # If the timer is not running currently, the remaining time will be returned
81
88
  # as 0.
82
89
  def get_monoflop
83
- send_request FUNCTION_GET_MONOFLOP, [], '', 9, '? L L'
90
+ check_validity
91
+
92
+ send_request FUNCTION_GET_MONOFLOP, [], '', 17, '? L L'
84
93
  end
85
94
 
86
95
  # Returns the UID, the UID where the Bricklet is connected to,
87
96
  # the position, the hardware and firmware version as well as the
88
97
  # device identifier.
89
98
  #
90
- # The position can be 'a', 'b', 'c' or 'd'.
99
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
100
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
101
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
102
+ # position 'z'.
91
103
  #
92
104
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
93
105
  # |device_identifier_constant|
94
106
  def get_identity
95
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
107
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
96
108
  end
97
109
 
98
110
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.