Package not found. Please check the package name and try again.

tinkerforge 2.1.24 → 2.1.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. checksums.yaml +5 -5
  2. data/lib/tinkerforge/brick_dc.rb +156 -75
  3. data/lib/tinkerforge/brick_hat.rb +69 -31
  4. data/lib/tinkerforge/brick_hat_zero.rb +55 -23
  5. data/lib/tinkerforge/brick_imu.rb +185 -78
  6. data/lib/tinkerforge/brick_imu_v2.rb +209 -106
  7. data/lib/tinkerforge/brick_master.rb +491 -183
  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 +247 -167
  11. data/lib/tinkerforge/brick_stepper.rb +211 -99
  12. data/lib/tinkerforge/bricklet_accelerometer.rb +57 -23
  13. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +104 -54
  14. data/lib/tinkerforge/bricklet_air_quality.rb +116 -59
  15. data/lib/tinkerforge/bricklet_ambient_light.rb +50 -21
  16. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +44 -24
  17. data/lib/tinkerforge/bricklet_ambient_light_v3.rb +65 -27
  18. data/lib/tinkerforge/bricklet_analog_in.rb +62 -25
  19. data/lib/tinkerforge/bricklet_analog_in_v2.rb +56 -23
  20. data/lib/tinkerforge/bricklet_analog_in_v3.rb +66 -25
  21. data/lib/tinkerforge/bricklet_analog_out.rb +22 -9
  22. data/lib/tinkerforge/bricklet_analog_out_v2.rb +19 -8
  23. data/lib/tinkerforge/bricklet_analog_out_v3.rb +53 -20
  24. data/lib/tinkerforge/bricklet_barometer.rb +100 -27
  25. data/lib/tinkerforge/bricklet_barometer_v2.rb +98 -37
  26. data/lib/tinkerforge/bricklet_can.rb +83 -19
  27. data/lib/tinkerforge/bricklet_can_v2.rb +171 -38
  28. data/lib/tinkerforge/bricklet_co2.rb +33 -14
  29. data/lib/tinkerforge/bricklet_co2_v2.rb +97 -38
  30. data/lib/tinkerforge/bricklet_color.rb +68 -27
  31. data/lib/tinkerforge/bricklet_color_v2.rb +86 -33
  32. data/lib/tinkerforge/bricklet_compass.rb +77 -30
  33. data/lib/tinkerforge/bricklet_current12.rb +57 -24
  34. data/lib/tinkerforge/bricklet_current25.rb +57 -24
  35. data/lib/tinkerforge/bricklet_dc_v2.rb +521 -0
  36. data/lib/tinkerforge/bricklet_distance_ir.rb +56 -23
  37. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +82 -31
  38. data/lib/tinkerforge/bricklet_distance_us.rb +39 -16
  39. data/lib/tinkerforge/bricklet_distance_us_v2.rb +66 -25
  40. data/lib/tinkerforge/bricklet_dmx.rb +87 -34
  41. data/lib/tinkerforge/bricklet_dual_button.rb +23 -10
  42. data/lib/tinkerforge/bricklet_dual_button_v2.rb +63 -24
  43. data/lib/tinkerforge/bricklet_dual_relay.rb +26 -11
  44. data/lib/tinkerforge/bricklet_dust_detector.rb +39 -16
  45. data/lib/tinkerforge/bricklet_e_paper_296x128.rb +87 -32
  46. data/lib/tinkerforge/bricklet_energy_monitor.rb +72 -27
  47. data/lib/tinkerforge/bricklet_gps.rb +63 -26
  48. data/lib/tinkerforge/bricklet_gps_v2.rb +116 -47
  49. data/lib/tinkerforge/bricklet_hall_effect.rb +42 -23
  50. data/lib/tinkerforge/bricklet_hall_effect_v2.rb +70 -27
  51. data/lib/tinkerforge/bricklet_humidity.rb +50 -21
  52. data/lib/tinkerforge/bricklet_humidity_v2.rb +82 -31
  53. data/lib/tinkerforge/bricklet_imu_v3.rb +784 -0
  54. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +37 -14
  55. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +80 -29
  56. data/lib/tinkerforge/bricklet_industrial_counter.rb +100 -39
  57. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +44 -17
  58. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +76 -29
  59. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +35 -14
  60. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +72 -27
  61. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +39 -16
  62. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +79 -30
  63. data/lib/tinkerforge/bricklet_industrial_dual_ac_relay.rb +325 -0
  64. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +48 -19
  65. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +137 -31
  66. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +60 -23
  67. data/lib/tinkerforge/bricklet_industrial_ptc.rb +475 -0
  68. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +35 -14
  69. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +66 -25
  70. data/lib/tinkerforge/bricklet_io16.rb +54 -21
  71. data/lib/tinkerforge/bricklet_io16_v2.rb +89 -34
  72. data/lib/tinkerforge/bricklet_io4.rb +54 -23
  73. data/lib/tinkerforge/bricklet_io4_v2.rb +95 -36
  74. data/lib/tinkerforge/bricklet_isolator.rb +72 -29
  75. data/lib/tinkerforge/bricklet_joystick.rb +58 -25
  76. data/lib/tinkerforge/bricklet_joystick_v2.rb +67 -26
  77. data/lib/tinkerforge/bricklet_laser_range_finder.rb +81 -32
  78. data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +95 -36
  79. data/lib/tinkerforge/bricklet_lcd_128x64.rb +191 -70
  80. data/lib/tinkerforge/bricklet_lcd_16x2.rb +44 -18
  81. data/lib/tinkerforge/bricklet_lcd_20x4.rb +57 -23
  82. data/lib/tinkerforge/bricklet_led_strip.rb +59 -22
  83. data/lib/tinkerforge/bricklet_led_strip_v2.rb +90 -46
  84. data/lib/tinkerforge/bricklet_line.rb +33 -14
  85. data/lib/tinkerforge/bricklet_linear_poti.rb +50 -21
  86. data/lib/tinkerforge/bricklet_linear_poti_v2.rb +54 -21
  87. data/lib/tinkerforge/bricklet_load_cell.rb +60 -23
  88. data/lib/tinkerforge/bricklet_load_cell_v2.rb +79 -30
  89. data/lib/tinkerforge/bricklet_moisture.rb +39 -16
  90. data/lib/tinkerforge/bricklet_motion_detector.rb +21 -10
  91. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +61 -27
  92. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +70 -27
  93. data/lib/tinkerforge/bricklet_multi_touch.rb +30 -13
  94. data/lib/tinkerforge/bricklet_multi_touch_v2.rb +75 -28
  95. data/lib/tinkerforge/bricklet_nfc.rb +126 -62
  96. data/lib/tinkerforge/bricklet_nfc_rfid.rb +32 -13
  97. data/lib/tinkerforge/bricklet_oled_128x64.rb +28 -11
  98. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +65 -24
  99. data/lib/tinkerforge/bricklet_oled_64x48.rb +28 -11
  100. data/lib/tinkerforge/bricklet_one_wire.rb +65 -24
  101. data/lib/tinkerforge/bricklet_outdoor_weather.rb +71 -28
  102. data/lib/tinkerforge/bricklet_particulate_matter.rb +74 -30
  103. data/lib/tinkerforge/bricklet_performance_dc.rb +682 -0
  104. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +18 -9
  105. data/lib/tinkerforge/bricklet_piezo_speaker.rb +21 -10
  106. data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +79 -42
  107. data/lib/tinkerforge/bricklet_ptc.rb +73 -42
  108. data/lib/tinkerforge/bricklet_ptc_v2.rb +94 -48
  109. data/lib/tinkerforge/bricklet_real_time_clock.rb +44 -33
  110. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +77 -44
  111. data/lib/tinkerforge/bricklet_remote_switch.rb +38 -29
  112. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +86 -49
  113. data/lib/tinkerforge/bricklet_rgb_led.rb +17 -8
  114. data/lib/tinkerforge/bricklet_rgb_led_button.rb +61 -30
  115. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +78 -33
  116. data/lib/tinkerforge/bricklet_rgb_led_v2.rb +51 -20
  117. data/lib/tinkerforge/bricklet_rotary_encoder.rb +38 -19
  118. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +59 -24
  119. data/lib/tinkerforge/bricklet_rotary_poti.rb +52 -28
  120. data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +56 -23
  121. data/lib/tinkerforge/bricklet_rs232.rb +89 -28
  122. data/lib/tinkerforge/bricklet_rs232_v2.rb +117 -44
  123. data/lib/tinkerforge/bricklet_rs485.rb +222 -95
  124. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
  125. data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +74 -35
  126. data/lib/tinkerforge/bricklet_servo_v2.rb +565 -0
  127. data/lib/tinkerforge/bricklet_silent_stepper_v2.rb +1024 -0
  128. data/lib/tinkerforge/bricklet_solid_state_relay.rb +24 -13
  129. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +58 -25
  130. data/lib/tinkerforge/bricklet_sound_intensity.rb +34 -18
  131. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +71 -31
  132. data/lib/tinkerforge/bricklet_temperature.rb +39 -16
  133. data/lib/tinkerforge/bricklet_temperature_ir.rb +56 -23
  134. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +70 -27
  135. data/lib/tinkerforge/bricklet_temperature_v2.rb +60 -25
  136. data/lib/tinkerforge/bricklet_thermal_imaging.rb +104 -44
  137. data/lib/tinkerforge/bricklet_thermocouple.rb +44 -24
  138. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +64 -27
  139. data/lib/tinkerforge/bricklet_tilt.rb +23 -10
  140. data/lib/tinkerforge/bricklet_uv_light.rb +35 -18
  141. data/lib/tinkerforge/bricklet_uv_light_v2.rb +84 -37
  142. data/lib/tinkerforge/bricklet_voltage.rb +51 -28
  143. data/lib/tinkerforge/bricklet_voltage_current.rb +90 -73
  144. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +89 -68
  145. data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +79 -30
  146. data/lib/tinkerforge/device_display_names.rb +170 -0
  147. data/lib/tinkerforge/ip_connection.rb +153 -33
  148. data/lib/tinkerforge/version.rb +1 -1
  149. metadata +11 -3
@@ -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 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.29 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # Measures soil moisture
14
16
  class BrickletMoisture < Device
@@ -51,7 +53,7 @@ module Tinkerforge
51
53
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
52
54
  # the IP Connection <tt>ipcon</tt>.
53
55
  def initialize(uid, ipcon)
54
- super uid, ipcon
56
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
55
57
 
56
58
  @api_version = [2, 0, 0]
57
59
 
@@ -66,9 +68,10 @@ module Tinkerforge
66
68
  @response_expected[FUNCTION_GET_MOVING_AVERAGE] = RESPONSE_EXPECTED_ALWAYS_TRUE
67
69
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
68
70
 
69
- @callback_formats[CALLBACK_MOISTURE] = 'S'
70
- @callback_formats[CALLBACK_MOISTURE_REACHED] = 'S'
71
+ @callback_formats[CALLBACK_MOISTURE] = [10, 'S']
72
+ @callback_formats[CALLBACK_MOISTURE_REACHED] = [10, 'S']
71
73
 
74
+ @ipcon.add_device self
72
75
  end
73
76
 
74
77
  # Returns the current moisture value.
@@ -79,7 +82,9 @@ module Tinkerforge
79
82
  # to use the CALLBACK_MOISTURE callback and set the period with
80
83
  # BrickletMoisture#set_moisture_callback_period.
81
84
  def get_moisture_value
82
- send_request FUNCTION_GET_MOISTURE_VALUE, [], '', 2, 'S'
85
+ check_validity
86
+
87
+ send_request FUNCTION_GET_MOISTURE_VALUE, [], '', 10, 'S'
83
88
  end
84
89
 
85
90
  # Sets the period with which the CALLBACK_MOISTURE callback is triggered
@@ -88,12 +93,16 @@ module Tinkerforge
88
93
  # The CALLBACK_MOISTURE callback is only triggered if the moisture value has changed
89
94
  # since the last triggering.
90
95
  def set_moisture_callback_period(period)
91
- send_request FUNCTION_SET_MOISTURE_CALLBACK_PERIOD, [period], 'L', 0, ''
96
+ check_validity
97
+
98
+ send_request FUNCTION_SET_MOISTURE_CALLBACK_PERIOD, [period], 'L', 8, ''
92
99
  end
93
100
 
94
101
  # Returns the period as set by BrickletMoisture#set_moisture_callback_period.
95
102
  def get_moisture_callback_period
96
- send_request FUNCTION_GET_MOISTURE_CALLBACK_PERIOD, [], '', 4, 'L'
103
+ check_validity
104
+
105
+ send_request FUNCTION_GET_MOISTURE_CALLBACK_PERIOD, [], '', 12, 'L'
97
106
  end
98
107
 
99
108
  # Sets the thresholds for the CALLBACK_MOISTURE_REACHED callback.
@@ -108,12 +117,16 @@ module Tinkerforge
108
117
  # "'<'", "Callback is triggered when the moisture value is smaller than the min value (max is ignored)"
109
118
  # "'>'", "Callback is triggered when the moisture value is greater than the min value (max is ignored)"
110
119
  def set_moisture_callback_threshold(option, min, max)
111
- send_request FUNCTION_SET_MOISTURE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
120
+ check_validity
121
+
122
+ send_request FUNCTION_SET_MOISTURE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
112
123
  end
113
124
 
114
125
  # Returns the threshold as set by BrickletMoisture#set_moisture_callback_threshold.
115
126
  def get_moisture_callback_threshold
116
- send_request FUNCTION_GET_MOISTURE_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
127
+ check_validity
128
+
129
+ send_request FUNCTION_GET_MOISTURE_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
117
130
  end
118
131
 
119
132
  # Sets the period with which the threshold callback
@@ -126,12 +139,16 @@ module Tinkerforge
126
139
  #
127
140
  # keeps being reached.
128
141
  def set_debounce_period(debounce)
129
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
142
+ check_validity
143
+
144
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
130
145
  end
131
146
 
132
147
  # Returns the debounce period as set by BrickletMoisture#set_debounce_period.
133
148
  def get_debounce_period
134
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
149
+ check_validity
150
+
151
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
135
152
  end
136
153
 
137
154
  # Sets the length of a `moving averaging <https://en.wikipedia.org/wiki/Moving_average>`__
@@ -140,24 +157,30 @@ module Tinkerforge
140
157
  # Setting the length to 0 will turn the averaging completely off. With less
141
158
  # averaging, there is more noise on the data.
142
159
  def set_moving_average(average)
143
- send_request FUNCTION_SET_MOVING_AVERAGE, [average], 'C', 0, ''
160
+ check_validity
161
+
162
+ send_request FUNCTION_SET_MOVING_AVERAGE, [average], 'C', 8, ''
144
163
  end
145
164
 
146
165
  # Returns the length moving average as set by BrickletMoisture#set_moving_average.
147
166
  def get_moving_average
148
- send_request FUNCTION_GET_MOVING_AVERAGE, [], '', 1, 'C'
167
+ check_validity
168
+
169
+ send_request FUNCTION_GET_MOVING_AVERAGE, [], '', 9, 'C'
149
170
  end
150
171
 
151
172
  # Returns the UID, the UID where the Bricklet is connected to,
152
173
  # the position, the hardware and firmware version as well as the
153
174
  # device identifier.
154
175
  #
155
- # The position can be 'a', 'b', 'c' or 'd'.
176
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
177
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
178
+ # position 'z'.
156
179
  #
157
180
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
158
181
  # |device_identifier_constant|
159
182
  def get_identity
160
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
183
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
161
184
  end
162
185
 
163
186
  # 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 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.29 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # Passive infrared (PIR) motion sensor with 7m range
14
16
  class BrickletMotionDetector < Device
@@ -37,7 +39,7 @@ module Tinkerforge
37
39
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
38
40
  # the IP Connection <tt>ipcon</tt>.
39
41
  def initialize(uid, ipcon)
40
- super uid, ipcon
42
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
41
43
 
42
44
  @api_version = [2, 0, 1]
43
45
 
@@ -46,9 +48,10 @@ module Tinkerforge
46
48
  @response_expected[FUNCTION_GET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
47
49
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
48
50
 
49
- @callback_formats[CALLBACK_MOTION_DETECTED] = ''
50
- @callback_formats[CALLBACK_DETECTION_CYCLE_ENDED] = ''
51
+ @callback_formats[CALLBACK_MOTION_DETECTED] = [8, '']
52
+ @callback_formats[CALLBACK_DETECTION_CYCLE_ENDED] = [8, '']
51
53
 
54
+ @ipcon.add_device self
52
55
  end
53
56
 
54
57
  # Returns 1 if a motion was detected. How long this returns 1 after a motion
@@ -59,7 +62,9 @@ module Tinkerforge
59
62
  # There is also a blue LED on the Bricklet that is on as long as the Bricklet is
60
63
  # in the "motion detected" state.
61
64
  def get_motion_detected
62
- send_request FUNCTION_GET_MOTION_DETECTED, [], '', 1, 'C'
65
+ check_validity
66
+
67
+ send_request FUNCTION_GET_MOTION_DETECTED, [], '', 9, 'C'
63
68
  end
64
69
 
65
70
  # Sets the status led configuration.
@@ -71,26 +76,32 @@ module Tinkerforge
71
76
  #
72
77
  # .. versionadded:: 2.0.1$nbsp;(Plugin)
73
78
  def set_status_led_config(config)
74
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
79
+ check_validity
80
+
81
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
75
82
  end
76
83
 
77
84
  # Returns the configuration as set by BrickletMotionDetector#set_status_led_config.
78
85
  #
79
86
  # .. versionadded:: 2.0.1$nbsp;(Plugin)
80
87
  def get_status_led_config
81
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
88
+ check_validity
89
+
90
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
82
91
  end
83
92
 
84
93
  # Returns the UID, the UID where the Bricklet is connected to,
85
94
  # the position, the hardware and firmware version as well as the
86
95
  # device identifier.
87
96
  #
88
- # The position can be 'a', 'b', 'c' or 'd'.
97
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
98
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
99
+ # position 'z'.
89
100
  #
90
101
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
91
102
  # |device_identifier_constant|
92
103
  def get_identity
93
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
104
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
94
105
  end
95
106
 
96
107
  # 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 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.29 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # Passive infrared (PIR) motion sensor with 12m range and dimmable backlight
14
16
  class BrickletMotionDetectorV2 < Device
@@ -62,7 +64,7 @@ module Tinkerforge
62
64
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
63
65
  # the IP Connection <tt>ipcon</tt>.
64
66
  def initialize(uid, ipcon)
65
- super uid, ipcon
67
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
66
68
 
67
69
  @api_version = [2, 0, 0]
68
70
 
@@ -84,18 +86,18 @@ module Tinkerforge
84
86
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
85
87
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
86
88
 
87
- @callback_formats[CALLBACK_MOTION_DETECTED] = ''
88
- @callback_formats[CALLBACK_DETECTION_CYCLE_ENDED] = ''
89
+ @callback_formats[CALLBACK_MOTION_DETECTED] = [8, '']
90
+ @callback_formats[CALLBACK_DETECTION_CYCLE_ENDED] = [8, '']
89
91
 
92
+ @ipcon.add_device self
90
93
  end
91
94
 
92
95
  # Returns 1 if a motion was detected. It returns 1 approx. for 1.8 seconds
93
96
  # until the sensor checks for a new movement.
94
- #
95
- # There is also a blue LED on the Bricklet that is on as long as the Bricklet is
96
- # in the "motion detected" state.
97
97
  def get_motion_detected
98
- send_request FUNCTION_GET_MOTION_DETECTED, [], '', 1, 'C'
98
+ check_validity
99
+
100
+ send_request FUNCTION_GET_MOTION_DETECTED, [], '', 9, 'C'
99
101
  end
100
102
 
101
103
  # Sets the sensitivity of the PIR sensor. At full
@@ -107,12 +109,16 @@ module Tinkerforge
107
109
  #
108
110
  # So you will have to find a good sensitivity for your application by trial and error.
109
111
  def set_sensitivity(sensitivity)
110
- send_request FUNCTION_SET_SENSITIVITY, [sensitivity], 'C', 0, ''
112
+ check_validity
113
+
114
+ send_request FUNCTION_SET_SENSITIVITY, [sensitivity], 'C', 8, ''
111
115
  end
112
116
 
113
117
  # Returns the sensitivity as set by BrickletMotionDetectorV2#set_sensitivity.
114
118
  def get_sensitivity
115
- send_request FUNCTION_GET_SENSITIVITY, [], '', 1, 'C'
119
+ check_validity
120
+
121
+ send_request FUNCTION_GET_SENSITIVITY, [], '', 9, 'C'
116
122
  end
117
123
 
118
124
  # Sets the blue backlight of the fresnel lens. The backlight consists of
@@ -120,12 +126,16 @@ module Tinkerforge
120
126
  # (0-255). A value of 0 turns the LED off and a value of 255 turns the LED
121
127
  # to full brightness.
122
128
  def set_indicator(top_left, top_right, bottom)
123
- send_request FUNCTION_SET_INDICATOR, [top_left, top_right, bottom], 'C C C', 0, ''
129
+ check_validity
130
+
131
+ send_request FUNCTION_SET_INDICATOR, [top_left, top_right, bottom], 'C C C', 8, ''
124
132
  end
125
133
 
126
134
  # Returns the indicator configuration as set by BrickletMotionDetectorV2#set_indicator.
127
135
  def get_indicator
128
- send_request FUNCTION_GET_INDICATOR, [], '', 3, 'C C C'
136
+ check_validity
137
+
138
+ send_request FUNCTION_GET_INDICATOR, [], '', 11, 'C C C'
129
139
  end
130
140
 
131
141
  # Returns the error count for the communication between Brick and Bricklet.
@@ -140,7 +150,9 @@ module Tinkerforge
140
150
  # The errors counts are for errors that occur on the Bricklet side. All
141
151
  # Bricks have a similar function that returns the errors on the Brick side.
142
152
  def get_spitfp_error_count
143
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
153
+ check_validity
154
+
155
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
144
156
  end
145
157
 
146
158
  # Sets the bootloader mode and returns the status after the requested
@@ -153,12 +165,16 @@ module Tinkerforge
153
165
  # This function is used by Brick Viewer during flashing. It should not be
154
166
  # necessary to call it in a normal user program.
155
167
  def set_bootloader_mode(mode)
156
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
168
+ check_validity
169
+
170
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
157
171
  end
158
172
 
159
173
  # Returns the current bootloader mode, see BrickletMotionDetectorV2#set_bootloader_mode.
160
174
  def get_bootloader_mode
161
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
175
+ check_validity
176
+
177
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
162
178
  end
163
179
 
164
180
  # Sets the firmware pointer for BrickletMotionDetectorV2#write_firmware. The pointer has
@@ -168,7 +184,9 @@ module Tinkerforge
168
184
  # This function is used by Brick Viewer during flashing. It should not be
169
185
  # necessary to call it in a normal user program.
170
186
  def set_write_firmware_pointer(pointer)
171
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
187
+ check_validity
188
+
189
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
172
190
  end
173
191
 
174
192
  # Writes 64 Bytes of firmware at the position as written by
@@ -180,7 +198,9 @@ module Tinkerforge
180
198
  # This function is used by Brick Viewer during flashing. It should not be
181
199
  # necessary to call it in a normal user program.
182
200
  def write_firmware(data)
183
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
201
+ check_validity
202
+
203
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
184
204
  end
185
205
 
186
206
  # Sets the status LED configuration. By default the LED shows
@@ -191,22 +211,28 @@ module Tinkerforge
191
211
  #
192
212
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
193
213
  def set_status_led_config(config)
194
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
214
+ check_validity
215
+
216
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
195
217
  end
196
218
 
197
219
  # Returns the configuration as set by BrickletMotionDetectorV2#set_status_led_config
198
220
  def get_status_led_config
199
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
221
+ check_validity
222
+
223
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
200
224
  end
201
225
 
202
- # Returns the temperature in °C as measured inside the microcontroller. The
226
+ # Returns the temperature as measured inside the microcontroller. The
203
227
  # value returned is not the ambient temperature!
204
228
  #
205
229
  # The temperature is only proportional to the real temperature and it has bad
206
230
  # accuracy. Practically it is only useful as an indicator for
207
231
  # temperature changes.
208
232
  def get_chip_temperature
209
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
233
+ check_validity
234
+
235
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
210
236
  end
211
237
 
212
238
  # Calling this function will reset the Bricklet. All configurations
@@ -216,7 +242,9 @@ module Tinkerforge
216
242
  # calling functions on the existing ones will result in
217
243
  # undefined behavior!
218
244
  def reset
219
- send_request FUNCTION_RESET, [], '', 0, ''
245
+ check_validity
246
+
247
+ send_request FUNCTION_RESET, [], '', 8, ''
220
248
  end
221
249
 
222
250
  # Writes a new UID into flash. If you want to set a new UID
@@ -225,25 +253,31 @@ module Tinkerforge
225
253
  #
226
254
  # We recommend that you use Brick Viewer to change the UID.
227
255
  def write_uid(uid)
228
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
256
+ check_validity
257
+
258
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
229
259
  end
230
260
 
231
261
  # Returns the current UID as an integer. Encode as
232
262
  # Base58 to get the usual string version.
233
263
  def read_uid
234
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
264
+ check_validity
265
+
266
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
235
267
  end
236
268
 
237
269
  # Returns the UID, the UID where the Bricklet is connected to,
238
270
  # the position, the hardware and firmware version as well as the
239
271
  # device identifier.
240
272
  #
241
- # The position can be 'a', 'b', 'c' or 'd'.
273
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
274
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
275
+ # position 'z'.
242
276
  #
243
277
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
244
278
  # |device_identifier_constant|
245
279
  def get_identity
246
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
280
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
247
281
  end
248
282
 
249
283
  # 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 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.29 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # Motorized Linear Potentiometer
14
16
  class BrickletMotorizedLinearPoti < Device
@@ -74,7 +76,7 @@ module Tinkerforge
74
76
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
75
77
  # the IP Connection <tt>ipcon</tt>.
76
78
  def initialize(uid, ipcon)
77
- super uid, ipcon
79
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
78
80
 
79
81
  @api_version = [2, 0, 0]
80
82
 
@@ -99,9 +101,10 @@ module Tinkerforge
99
101
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
100
102
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
101
103
 
102
- @callback_formats[CALLBACK_POSITION] = 'S'
103
- @callback_formats[CALLBACK_POSITION_REACHED] = 'S'
104
+ @callback_formats[CALLBACK_POSITION] = [10, 'S']
105
+ @callback_formats[CALLBACK_POSITION_REACHED] = [10, 'S']
104
106
 
107
+ @ipcon.add_device self
105
108
  end
106
109
 
107
110
  # Returns the position of the linear potentiometer. The value is
@@ -112,7 +115,9 @@ module Tinkerforge
112
115
  # CALLBACK_POSITION callback. You can set the callback configuration
113
116
  # with BrickletMotorizedLinearPoti#set_position_callback_configuration.
114
117
  def get_position
115
- send_request FUNCTION_GET_POSITION, [], '', 2, 'S'
118
+ check_validity
119
+
120
+ send_request FUNCTION_GET_POSITION, [], '', 10, 'S'
116
121
  end
117
122
 
118
123
  # The period is the period with which the CALLBACK_POSITION callback is triggered
@@ -141,12 +146,16 @@ module Tinkerforge
141
146
  #
142
147
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
143
148
  def set_position_callback_configuration(period, value_has_to_change, option, min, max)
144
- send_request FUNCTION_SET_POSITION_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k S S', 0, ''
149
+ check_validity
150
+
151
+ send_request FUNCTION_SET_POSITION_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k S S', 8, ''
145
152
  end
146
153
 
147
154
  # Returns the callback configuration as set by BrickletMotorizedLinearPoti#set_position_callback_configuration.
148
155
  def get_position_callback_configuration
149
- send_request FUNCTION_GET_POSITION_CALLBACK_CONFIGURATION, [], '', 10, 'L ? k S S'
156
+ check_validity
157
+
158
+ send_request FUNCTION_GET_POSITION_CALLBACK_CONFIGURATION, [], '', 18, 'L ? k S S'
150
159
  end
151
160
 
152
161
  # Sets the position of the potentiometer. The motorized potentiometer will
@@ -163,7 +172,9 @@ module Tinkerforge
163
172
  # If the hold position parameter is set to false, the potentiometer can be changed
164
173
  # again by the user as soon as the set point was reached once.
165
174
  def set_motor_position(position, drive_mode, hold_position)
166
- send_request FUNCTION_SET_MOTOR_POSITION, [position, drive_mode, hold_position], 'S C ?', 0, ''
175
+ check_validity
176
+
177
+ send_request FUNCTION_SET_MOTOR_POSITION, [position, drive_mode, hold_position], 'S C ?', 8, ''
167
178
  end
168
179
 
169
180
  # Returns the last motor position as set by BrickletMotorizedLinearPoti#set_motor_position. This is not
@@ -173,7 +184,9 @@ module Tinkerforge
173
184
  # The position reached parameter is true if the position has been reached at one point.
174
185
  # The position may have been changed again in the meantime by the user.
175
186
  def get_motor_position
176
- send_request FUNCTION_GET_MOTOR_POSITION, [], '', 5, 'S C ? ?'
187
+ check_validity
188
+
189
+ send_request FUNCTION_GET_MOTOR_POSITION, [], '', 13, 'S C ? ?'
177
190
  end
178
191
 
179
192
  # Starts a calibration procedure. The potentiometer will be driven to the extreme
@@ -184,18 +197,24 @@ module Tinkerforge
184
197
  # The Motorized Linear Poti Bricklet is already factory-calibrated during
185
198
  # testing at Tinkerforge.
186
199
  def calibrate
187
- send_request FUNCTION_CALIBRATE, [], '', 0, ''
200
+ check_validity
201
+
202
+ send_request FUNCTION_CALIBRATE, [], '', 8, ''
188
203
  end
189
204
 
190
205
  # Enables/Disables CALLBACK_POSITION_REACHED callback.
191
206
  def set_position_reached_callback_configuration(enabled)
192
- send_request FUNCTION_SET_POSITION_REACHED_CALLBACK_CONFIGURATION, [enabled], '?', 0, ''
207
+ check_validity
208
+
209
+ send_request FUNCTION_SET_POSITION_REACHED_CALLBACK_CONFIGURATION, [enabled], '?', 8, ''
193
210
  end
194
211
 
195
212
  # Returns the CALLBACK_POSITION_REACHED callback configuration
196
213
  # as set by BrickletMotorizedLinearPoti#set_position_reached_callback_configuration.
197
214
  def get_position_reached_callback_configuration
198
- send_request FUNCTION_GET_POSITION_REACHED_CALLBACK_CONFIGURATION, [], '', 1, '?'
215
+ check_validity
216
+
217
+ send_request FUNCTION_GET_POSITION_REACHED_CALLBACK_CONFIGURATION, [], '', 9, '?'
199
218
  end
200
219
 
201
220
  # Returns the error count for the communication between Brick and Bricklet.
@@ -210,7 +229,9 @@ module Tinkerforge
210
229
  # The errors counts are for errors that occur on the Bricklet side. All
211
230
  # Bricks have a similar function that returns the errors on the Brick side.
212
231
  def get_spitfp_error_count
213
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
232
+ check_validity
233
+
234
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
214
235
  end
215
236
 
216
237
  # Sets the bootloader mode and returns the status after the requested
@@ -223,12 +244,16 @@ module Tinkerforge
223
244
  # This function is used by Brick Viewer during flashing. It should not be
224
245
  # necessary to call it in a normal user program.
225
246
  def set_bootloader_mode(mode)
226
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
247
+ check_validity
248
+
249
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
227
250
  end
228
251
 
229
252
  # Returns the current bootloader mode, see BrickletMotorizedLinearPoti#set_bootloader_mode.
230
253
  def get_bootloader_mode
231
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
254
+ check_validity
255
+
256
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
232
257
  end
233
258
 
234
259
  # Sets the firmware pointer for BrickletMotorizedLinearPoti#write_firmware. The pointer has
@@ -238,7 +263,9 @@ module Tinkerforge
238
263
  # This function is used by Brick Viewer during flashing. It should not be
239
264
  # necessary to call it in a normal user program.
240
265
  def set_write_firmware_pointer(pointer)
241
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
266
+ check_validity
267
+
268
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
242
269
  end
243
270
 
244
271
  # Writes 64 Bytes of firmware at the position as written by
@@ -250,7 +277,9 @@ module Tinkerforge
250
277
  # This function is used by Brick Viewer during flashing. It should not be
251
278
  # necessary to call it in a normal user program.
252
279
  def write_firmware(data)
253
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
280
+ check_validity
281
+
282
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
254
283
  end
255
284
 
256
285
  # Sets the status LED configuration. By default the LED shows
@@ -261,22 +290,28 @@ module Tinkerforge
261
290
  #
262
291
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
263
292
  def set_status_led_config(config)
264
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
293
+ check_validity
294
+
295
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
265
296
  end
266
297
 
267
298
  # Returns the configuration as set by BrickletMotorizedLinearPoti#set_status_led_config
268
299
  def get_status_led_config
269
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
300
+ check_validity
301
+
302
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
270
303
  end
271
304
 
272
- # Returns the temperature in °C as measured inside the microcontroller. The
305
+ # Returns the temperature as measured inside the microcontroller. The
273
306
  # value returned is not the ambient temperature!
274
307
  #
275
308
  # The temperature is only proportional to the real temperature and it has bad
276
309
  # accuracy. Practically it is only useful as an indicator for
277
310
  # temperature changes.
278
311
  def get_chip_temperature
279
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
312
+ check_validity
313
+
314
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
280
315
  end
281
316
 
282
317
  # Calling this function will reset the Bricklet. All configurations
@@ -286,7 +321,9 @@ module Tinkerforge
286
321
  # calling functions on the existing ones will result in
287
322
  # undefined behavior!
288
323
  def reset
289
- send_request FUNCTION_RESET, [], '', 0, ''
324
+ check_validity
325
+
326
+ send_request FUNCTION_RESET, [], '', 8, ''
290
327
  end
291
328
 
292
329
  # Writes a new UID into flash. If you want to set a new UID
@@ -295,25 +332,31 @@ module Tinkerforge
295
332
  #
296
333
  # We recommend that you use Brick Viewer to change the UID.
297
334
  def write_uid(uid)
298
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
335
+ check_validity
336
+
337
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
299
338
  end
300
339
 
301
340
  # Returns the current UID as an integer. Encode as
302
341
  # Base58 to get the usual string version.
303
342
  def read_uid
304
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
343
+ check_validity
344
+
345
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
305
346
  end
306
347
 
307
348
  # Returns the UID, the UID where the Bricklet is connected to,
308
349
  # the position, the hardware and firmware version as well as the
309
350
  # device identifier.
310
351
  #
311
- # The position can be 'a', 'b', 'c' or 'd'.
352
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
353
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
354
+ # position 'z'.
312
355
  #
313
356
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
314
357
  # |device_identifier_constant|
315
358
  def get_identity
316
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
359
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
317
360
  end
318
361
 
319
362
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.