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
  # 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,31 @@ 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
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
178
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
179
+ # position 'z'.
156
180
  #
157
181
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
158
182
  # |device_identifier_constant|
159
183
  def get_identity
160
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
184
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
161
185
  end
162
186
 
163
187
  # 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
  # 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,33 @@ 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
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
99
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
100
+ # position 'z'.
89
101
  #
90
102
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
91
103
  # |device_identifier_constant|
92
104
  def get_identity
93
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
105
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
94
106
  end
95
107
 
96
108
  # 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
  # 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,9 +86,10 @@ 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
@@ -95,7 +98,9 @@ module Tinkerforge
95
98
  # There is also a blue LED on the Bricklet that is on as long as the Bricklet is
96
99
  # in the "motion detected" state.
97
100
  def get_motion_detected
98
- send_request FUNCTION_GET_MOTION_DETECTED, [], '', 1, 'C'
101
+ check_validity
102
+
103
+ send_request FUNCTION_GET_MOTION_DETECTED, [], '', 9, 'C'
99
104
  end
100
105
 
101
106
  # Sets the sensitivity of the PIR sensor. At full
@@ -107,12 +112,16 @@ module Tinkerforge
107
112
  #
108
113
  # So you will have to find a good sensitivity for your application by trial and error.
109
114
  def set_sensitivity(sensitivity)
110
- send_request FUNCTION_SET_SENSITIVITY, [sensitivity], 'C', 0, ''
115
+ check_validity
116
+
117
+ send_request FUNCTION_SET_SENSITIVITY, [sensitivity], 'C', 8, ''
111
118
  end
112
119
 
113
120
  # Returns the sensitivity as set by BrickletMotionDetectorV2#set_sensitivity.
114
121
  def get_sensitivity
115
- send_request FUNCTION_GET_SENSITIVITY, [], '', 1, 'C'
122
+ check_validity
123
+
124
+ send_request FUNCTION_GET_SENSITIVITY, [], '', 9, 'C'
116
125
  end
117
126
 
118
127
  # Sets the blue backlight of the fresnel lens. The backlight consists of
@@ -120,12 +129,16 @@ module Tinkerforge
120
129
  # (0-255). A value of 0 turns the LED off and a value of 255 turns the LED
121
130
  # to full brightness.
122
131
  def set_indicator(top_left, top_right, bottom)
123
- send_request FUNCTION_SET_INDICATOR, [top_left, top_right, bottom], 'C C C', 0, ''
132
+ check_validity
133
+
134
+ send_request FUNCTION_SET_INDICATOR, [top_left, top_right, bottom], 'C C C', 8, ''
124
135
  end
125
136
 
126
137
  # Returns the indicator configuration as set by BrickletMotionDetectorV2#set_indicator.
127
138
  def get_indicator
128
- send_request FUNCTION_GET_INDICATOR, [], '', 3, 'C C C'
139
+ check_validity
140
+
141
+ send_request FUNCTION_GET_INDICATOR, [], '', 11, 'C C C'
129
142
  end
130
143
 
131
144
  # Returns the error count for the communication between Brick and Bricklet.
@@ -140,7 +153,9 @@ module Tinkerforge
140
153
  # The errors counts are for errors that occur on the Bricklet side. All
141
154
  # Bricks have a similar function that returns the errors on the Brick side.
142
155
  def get_spitfp_error_count
143
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
156
+ check_validity
157
+
158
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
144
159
  end
145
160
 
146
161
  # Sets the bootloader mode and returns the status after the requested
@@ -153,12 +168,16 @@ module Tinkerforge
153
168
  # This function is used by Brick Viewer during flashing. It should not be
154
169
  # necessary to call it in a normal user program.
155
170
  def set_bootloader_mode(mode)
156
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
171
+ check_validity
172
+
173
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
157
174
  end
158
175
 
159
176
  # Returns the current bootloader mode, see BrickletMotionDetectorV2#set_bootloader_mode.
160
177
  def get_bootloader_mode
161
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
178
+ check_validity
179
+
180
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
162
181
  end
163
182
 
164
183
  # Sets the firmware pointer for BrickletMotionDetectorV2#write_firmware. The pointer has
@@ -168,7 +187,9 @@ module Tinkerforge
168
187
  # This function is used by Brick Viewer during flashing. It should not be
169
188
  # necessary to call it in a normal user program.
170
189
  def set_write_firmware_pointer(pointer)
171
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
190
+ check_validity
191
+
192
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
172
193
  end
173
194
 
174
195
  # Writes 64 Bytes of firmware at the position as written by
@@ -180,7 +201,9 @@ module Tinkerforge
180
201
  # This function is used by Brick Viewer during flashing. It should not be
181
202
  # necessary to call it in a normal user program.
182
203
  def write_firmware(data)
183
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
204
+ check_validity
205
+
206
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
184
207
  end
185
208
 
186
209
  # Sets the status LED configuration. By default the LED shows
@@ -191,22 +214,28 @@ module Tinkerforge
191
214
  #
192
215
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
193
216
  def set_status_led_config(config)
194
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
217
+ check_validity
218
+
219
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
195
220
  end
196
221
 
197
222
  # Returns the configuration as set by BrickletMotionDetectorV2#set_status_led_config
198
223
  def get_status_led_config
199
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
224
+ check_validity
225
+
226
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
200
227
  end
201
228
 
202
- # Returns the temperature in °C as measured inside the microcontroller. The
229
+ # Returns the temperature as measured inside the microcontroller. The
203
230
  # value returned is not the ambient temperature!
204
231
  #
205
232
  # The temperature is only proportional to the real temperature and it has bad
206
233
  # accuracy. Practically it is only useful as an indicator for
207
234
  # temperature changes.
208
235
  def get_chip_temperature
209
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
236
+ check_validity
237
+
238
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
210
239
  end
211
240
 
212
241
  # Calling this function will reset the Bricklet. All configurations
@@ -216,7 +245,9 @@ module Tinkerforge
216
245
  # calling functions on the existing ones will result in
217
246
  # undefined behavior!
218
247
  def reset
219
- send_request FUNCTION_RESET, [], '', 0, ''
248
+ check_validity
249
+
250
+ send_request FUNCTION_RESET, [], '', 8, ''
220
251
  end
221
252
 
222
253
  # Writes a new UID into flash. If you want to set a new UID
@@ -225,25 +256,32 @@ module Tinkerforge
225
256
  #
226
257
  # We recommend that you use Brick Viewer to change the UID.
227
258
  def write_uid(uid)
228
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
259
+ check_validity
260
+
261
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
229
262
  end
230
263
 
231
264
  # Returns the current UID as an integer. Encode as
232
265
  # Base58 to get the usual string version.
233
266
  def read_uid
234
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
267
+ check_validity
268
+
269
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
235
270
  end
236
271
 
237
272
  # Returns the UID, the UID where the Bricklet is connected to,
238
273
  # the position, the hardware and firmware version as well as the
239
274
  # device identifier.
240
275
  #
241
- # The position can be 'a', 'b', 'c' or 'd'.
276
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
277
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
278
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
279
+ # position 'z'.
242
280
  #
243
281
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
244
282
  # |device_identifier_constant|
245
283
  def get_identity
246
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
284
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
247
285
  end
248
286
 
249
287
  # 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
  # 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,32 @@ 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
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
354
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
355
+ # position 'z'.
312
356
  #
313
357
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
314
358
  # |device_identifier_constant|
315
359
  def get_identity
316
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
360
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
317
361
  end
318
362
 
319
363
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.