tinkerforge 2.1.24 → 2.1.29

Sign up to get free protection for your applications and to get access to all the features.
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
  # Detects presence of magnetic field
14
16
  class BrickletHallEffect < Device
@@ -42,7 +44,7 @@ module Tinkerforge
42
44
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
43
45
  # the IP Connection <tt>ipcon</tt>.
44
46
  def initialize(uid, ipcon)
45
- super uid, ipcon
47
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
46
48
 
47
49
  @api_version = [2, 0, 0]
48
50
 
@@ -57,13 +59,16 @@ module Tinkerforge
57
59
  @response_expected[FUNCTION_EDGE_INTERRUPT] = RESPONSE_EXPECTED_ALWAYS_TRUE
58
60
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
59
61
 
60
- @callback_formats[CALLBACK_EDGE_COUNT] = 'L ?'
62
+ @callback_formats[CALLBACK_EDGE_COUNT] = [13, 'L ?']
61
63
 
64
+ @ipcon.add_device self
62
65
  end
63
66
 
64
- # Returns *true* if a magnetic field of 35 Gauss (3.5mT) or greater is detected.
67
+ # Returns *true* if a magnetic field of 3.5 millitesla or greater is detected.
65
68
  def get_value
66
- send_request FUNCTION_GET_VALUE, [], '', 1, '?'
69
+ check_validity
70
+
71
+ send_request FUNCTION_GET_VALUE, [], '', 9, '?'
67
72
  end
68
73
 
69
74
  # Returns the current value of the edge counter. You can configure
@@ -73,35 +78,39 @@ module Tinkerforge
73
78
  # If you set the reset counter to *true*, the count is set back to 0
74
79
  # directly after it is read.
75
80
  def get_edge_count(reset_counter)
76
- send_request FUNCTION_GET_EDGE_COUNT, [reset_counter], '?', 4, 'L'
81
+ check_validity
82
+
83
+ send_request FUNCTION_GET_EDGE_COUNT, [reset_counter], '?', 12, 'L'
77
84
  end
78
85
 
79
86
  # The edge type parameter configures if rising edges, falling edges or
80
87
  # both are counted. Possible edge types are:
81
88
  #
82
- # * 0 = rising (default)
89
+ # * 0 = rising
83
90
  # * 1 = falling
84
91
  # * 2 = both
85
92
  #
86
- # A magnetic field of 35 Gauss (3.5mT) or greater causes a falling edge and a
87
- # magnetic field of 25 Gauss (2.5mT) or smaller causes a rising edge.
93
+ # A magnetic field of 3.5 millitesla or greater causes a falling edge and a
94
+ # magnetic field of 2.5 millitesla or smaller causes a rising edge.
88
95
  #
89
96
  # If a magnet comes near the Bricklet the signal goes low (falling edge), if
90
97
  # a magnet is removed from the vicinity the signal goes high (rising edge).
91
98
  #
92
- # The debounce time is given in ms.
93
- #
94
99
  # Configuring an edge counter resets its value to 0.
95
100
  #
96
101
  # If you don't know what any of this means, just leave it at default. The
97
102
  # default configuration is very likely OK for you.
98
103
  def set_edge_count_config(edge_type, debounce)
99
- send_request FUNCTION_SET_EDGE_COUNT_CONFIG, [edge_type, debounce], 'C C', 0, ''
104
+ check_validity
105
+
106
+ send_request FUNCTION_SET_EDGE_COUNT_CONFIG, [edge_type, debounce], 'C C', 8, ''
100
107
  end
101
108
 
102
109
  # Returns the edge type and debounce time as set by BrickletHallEffect#set_edge_count_config.
103
110
  def get_edge_count_config
104
- send_request FUNCTION_GET_EDGE_COUNT_CONFIG, [], '', 2, 'C C'
111
+ check_validity
112
+
113
+ send_request FUNCTION_GET_EDGE_COUNT_CONFIG, [], '', 10, 'C C'
105
114
  end
106
115
 
107
116
  # Sets the number of edges until an interrupt is invoked.
@@ -109,15 +118,17 @@ module Tinkerforge
109
118
  # If *edges* is set to n, an interrupt is invoked for every n-th detected edge.
110
119
  #
111
120
  # If *edges* is set to 0, the interrupt is disabled.
112
- #
113
- # Default value is 0.
114
121
  def set_edge_interrupt(edges)
115
- send_request FUNCTION_SET_EDGE_INTERRUPT, [edges], 'L', 0, ''
122
+ check_validity
123
+
124
+ send_request FUNCTION_SET_EDGE_INTERRUPT, [edges], 'L', 8, ''
116
125
  end
117
126
 
118
127
  # Returns the edges as set by BrickletHallEffect#set_edge_interrupt.
119
128
  def get_edge_interrupt
120
- send_request FUNCTION_GET_EDGE_INTERRUPT, [], '', 4, 'L'
129
+ check_validity
130
+
131
+ send_request FUNCTION_GET_EDGE_INTERRUPT, [], '', 12, 'L'
121
132
  end
122
133
 
123
134
  # Sets the period with which the CALLBACK_EDGE_COUNT callback is triggered
@@ -126,12 +137,16 @@ module Tinkerforge
126
137
  # The CALLBACK_EDGE_COUNT callback is only triggered if the edge count has changed
127
138
  # since the last triggering.
128
139
  def set_edge_count_callback_period(period)
129
- send_request FUNCTION_SET_EDGE_COUNT_CALLBACK_PERIOD, [period], 'L', 0, ''
140
+ check_validity
141
+
142
+ send_request FUNCTION_SET_EDGE_COUNT_CALLBACK_PERIOD, [period], 'L', 8, ''
130
143
  end
131
144
 
132
145
  # Returns the period as set by BrickletHallEffect#set_edge_count_callback_period.
133
146
  def get_edge_count_callback_period
134
- send_request FUNCTION_GET_EDGE_COUNT_CALLBACK_PERIOD, [], '', 4, 'L'
147
+ check_validity
148
+
149
+ send_request FUNCTION_GET_EDGE_COUNT_CALLBACK_PERIOD, [], '', 12, 'L'
135
150
  end
136
151
 
137
152
  # This callback is triggered every n-th count, as configured with
@@ -139,19 +154,23 @@ module Tinkerforge
139
154
  # current count and the current value (see BrickletHallEffect#get_value and
140
155
  # BrickletHallEffect#get_edge_count).
141
156
  def edge_interrupt
142
- send_request FUNCTION_EDGE_INTERRUPT, [], '', 5, 'L ?'
157
+ check_validity
158
+
159
+ send_request FUNCTION_EDGE_INTERRUPT, [], '', 13, 'L ?'
143
160
  end
144
161
 
145
162
  # Returns the UID, the UID where the Bricklet is connected to,
146
163
  # the position, the hardware and firmware version as well as the
147
164
  # device identifier.
148
165
  #
149
- # The position can be 'a', 'b', 'c' or 'd'.
166
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
167
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
168
+ # position 'z'.
150
169
  #
151
170
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
152
171
  # |device_identifier_constant|
153
172
  def get_identity
154
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
173
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
155
174
  end
156
175
 
157
176
  # 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
  # Measures magnetic flux density between -7mT and +7mT
14
16
  class BrickletHallEffectV2 < Device
@@ -72,7 +74,7 @@ module Tinkerforge
72
74
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
73
75
  # the IP Connection <tt>ipcon</tt>.
74
76
  def initialize(uid, ipcon)
75
- super uid, ipcon
77
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
76
78
 
77
79
  @api_version = [2, 0, 0]
78
80
 
@@ -97,9 +99,10 @@ module Tinkerforge
97
99
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
98
100
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
99
101
 
100
- @callback_formats[CALLBACK_MAGNETIC_FLUX_DENSITY] = 's'
101
- @callback_formats[CALLBACK_COUNTER] = 'L'
102
+ @callback_formats[CALLBACK_MAGNETIC_FLUX_DENSITY] = [10, 's']
103
+ @callback_formats[CALLBACK_COUNTER] = [12, 'L']
102
104
 
105
+ @ipcon.add_device self
103
106
  end
104
107
 
105
108
  # Returns the `magnetic flux density (magnetic induction) <https://en.wikipedia.org/wiki/Magnetic_flux>`__.
@@ -109,7 +112,9 @@ module Tinkerforge
109
112
  # CALLBACK_MAGNETIC_FLUX_DENSITY callback. You can set the callback configuration
110
113
  # with BrickletHallEffectV2#set_magnetic_flux_density_callback_configuration.
111
114
  def get_magnetic_flux_density
112
- send_request FUNCTION_GET_MAGNETIC_FLUX_DENSITY, [], '', 2, 's'
115
+ check_validity
116
+
117
+ send_request FUNCTION_GET_MAGNETIC_FLUX_DENSITY, [], '', 10, 's'
113
118
  end
114
119
 
115
120
  # The period is the period with which the CALLBACK_MAGNETIC_FLUX_DENSITY callback is triggered
@@ -138,12 +143,16 @@ module Tinkerforge
138
143
  #
139
144
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
140
145
  def set_magnetic_flux_density_callback_configuration(period, value_has_to_change, option, min, max)
141
- send_request FUNCTION_SET_MAGNETIC_FLUX_DENSITY_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k s s', 0, ''
146
+ check_validity
147
+
148
+ send_request FUNCTION_SET_MAGNETIC_FLUX_DENSITY_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k s s', 8, ''
142
149
  end
143
150
 
144
151
  # Returns the callback configuration as set by BrickletHallEffectV2#set_magnetic_flux_density_callback_configuration.
145
152
  def get_magnetic_flux_density_callback_configuration
146
- send_request FUNCTION_GET_MAGNETIC_FLUX_DENSITY_CALLBACK_CONFIGURATION, [], '', 10, 'L ? k s s'
153
+ check_validity
154
+
155
+ send_request FUNCTION_GET_MAGNETIC_FLUX_DENSITY_CALLBACK_CONFIGURATION, [], '', 18, 'L ? k s s'
147
156
  end
148
157
 
149
158
  # Returns the current value of the counter.
@@ -158,7 +167,9 @@ module Tinkerforge
158
167
  # CALLBACK_COUNTER callback. You can set the callback configuration
159
168
  # with BrickletHallEffectV2#set_counter_callback_configuration.
160
169
  def get_counter(reset_counter)
161
- send_request FUNCTION_GET_COUNTER, [reset_counter], '?', 4, 'L'
170
+ check_validity
171
+
172
+ send_request FUNCTION_GET_COUNTER, [reset_counter], '?', 12, 'L'
162
173
  end
163
174
 
164
175
  # Sets a high and a low threshold as well as a debounce time.
@@ -168,12 +179,16 @@ module Tinkerforge
168
179
  #
169
180
  # The debounce time is the minimum time between two count increments.
170
181
  def set_counter_config(high_threshold, low_threshold, debounce)
171
- send_request FUNCTION_SET_COUNTER_CONFIG, [high_threshold, low_threshold, debounce], 's s L', 0, ''
182
+ check_validity
183
+
184
+ send_request FUNCTION_SET_COUNTER_CONFIG, [high_threshold, low_threshold, debounce], 's s L', 8, ''
172
185
  end
173
186
 
174
187
  # Returns the counter config as set by BrickletHallEffectV2#set_counter_config.
175
188
  def get_counter_config
176
- send_request FUNCTION_GET_COUNTER_CONFIG, [], '', 8, 's s L'
189
+ check_validity
190
+
191
+ send_request FUNCTION_GET_COUNTER_CONFIG, [], '', 16, 's s L'
177
192
  end
178
193
 
179
194
  # The period is the period with which the CALLBACK_COUNTER
@@ -186,13 +201,17 @@ module Tinkerforge
186
201
  # If it is set to false, the callback is continuously triggered with the period,
187
202
  # independent of the value.
188
203
  def set_counter_callback_configuration(period, value_has_to_change)
189
- send_request FUNCTION_SET_COUNTER_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 0, ''
204
+ check_validity
205
+
206
+ send_request FUNCTION_SET_COUNTER_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
190
207
  end
191
208
 
192
209
  # Returns the callback configuration as set by
193
210
  # BrickletHallEffectV2#set_counter_callback_configuration.
194
211
  def get_counter_callback_configuration
195
- send_request FUNCTION_GET_COUNTER_CALLBACK_CONFIGURATION, [], '', 5, 'L ?'
212
+ check_validity
213
+
214
+ send_request FUNCTION_GET_COUNTER_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
196
215
  end
197
216
 
198
217
  # Returns the error count for the communication between Brick and Bricklet.
@@ -207,7 +226,9 @@ module Tinkerforge
207
226
  # The errors counts are for errors that occur on the Bricklet side. All
208
227
  # Bricks have a similar function that returns the errors on the Brick side.
209
228
  def get_spitfp_error_count
210
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
229
+ check_validity
230
+
231
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
211
232
  end
212
233
 
213
234
  # Sets the bootloader mode and returns the status after the requested
@@ -220,12 +241,16 @@ module Tinkerforge
220
241
  # This function is used by Brick Viewer during flashing. It should not be
221
242
  # necessary to call it in a normal user program.
222
243
  def set_bootloader_mode(mode)
223
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
244
+ check_validity
245
+
246
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
224
247
  end
225
248
 
226
249
  # Returns the current bootloader mode, see BrickletHallEffectV2#set_bootloader_mode.
227
250
  def get_bootloader_mode
228
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
251
+ check_validity
252
+
253
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
229
254
  end
230
255
 
231
256
  # Sets the firmware pointer for BrickletHallEffectV2#write_firmware. The pointer has
@@ -235,7 +260,9 @@ module Tinkerforge
235
260
  # This function is used by Brick Viewer during flashing. It should not be
236
261
  # necessary to call it in a normal user program.
237
262
  def set_write_firmware_pointer(pointer)
238
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
263
+ check_validity
264
+
265
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
239
266
  end
240
267
 
241
268
  # Writes 64 Bytes of firmware at the position as written by
@@ -247,7 +274,9 @@ module Tinkerforge
247
274
  # This function is used by Brick Viewer during flashing. It should not be
248
275
  # necessary to call it in a normal user program.
249
276
  def write_firmware(data)
250
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
277
+ check_validity
278
+
279
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
251
280
  end
252
281
 
253
282
  # Sets the status LED configuration. By default the LED shows
@@ -258,22 +287,28 @@ module Tinkerforge
258
287
  #
259
288
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
260
289
  def set_status_led_config(config)
261
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
290
+ check_validity
291
+
292
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
262
293
  end
263
294
 
264
295
  # Returns the configuration as set by BrickletHallEffectV2#set_status_led_config
265
296
  def get_status_led_config
266
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
297
+ check_validity
298
+
299
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
267
300
  end
268
301
 
269
- # Returns the temperature in °C as measured inside the microcontroller. The
302
+ # Returns the temperature as measured inside the microcontroller. The
270
303
  # value returned is not the ambient temperature!
271
304
  #
272
305
  # The temperature is only proportional to the real temperature and it has bad
273
306
  # accuracy. Practically it is only useful as an indicator for
274
307
  # temperature changes.
275
308
  def get_chip_temperature
276
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
309
+ check_validity
310
+
311
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
277
312
  end
278
313
 
279
314
  # Calling this function will reset the Bricklet. All configurations
@@ -283,7 +318,9 @@ module Tinkerforge
283
318
  # calling functions on the existing ones will result in
284
319
  # undefined behavior!
285
320
  def reset
286
- send_request FUNCTION_RESET, [], '', 0, ''
321
+ check_validity
322
+
323
+ send_request FUNCTION_RESET, [], '', 8, ''
287
324
  end
288
325
 
289
326
  # Writes a new UID into flash. If you want to set a new UID
@@ -292,25 +329,31 @@ module Tinkerforge
292
329
  #
293
330
  # We recommend that you use Brick Viewer to change the UID.
294
331
  def write_uid(uid)
295
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
332
+ check_validity
333
+
334
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
296
335
  end
297
336
 
298
337
  # Returns the current UID as an integer. Encode as
299
338
  # Base58 to get the usual string version.
300
339
  def read_uid
301
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
340
+ check_validity
341
+
342
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
302
343
  end
303
344
 
304
345
  # Returns the UID, the UID where the Bricklet is connected to,
305
346
  # the position, the hardware and firmware version as well as the
306
347
  # device identifier.
307
348
  #
308
- # The position can be 'a', 'b', 'c' or 'd'.
349
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
350
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
351
+ # position 'z'.
309
352
  #
310
353
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
311
354
  # |device_identifier_constant|
312
355
  def get_identity
313
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
356
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
314
357
  end
315
358
 
316
359
  # 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
  # Measures relative humidity
14
16
  class BrickletHumidity < Device
@@ -70,7 +72,7 @@ module Tinkerforge
70
72
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
71
73
  # the IP Connection <tt>ipcon</tt>.
72
74
  def initialize(uid, ipcon)
73
- super uid, ipcon
75
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
74
76
 
75
77
  @api_version = [2, 0, 1]
76
78
 
@@ -88,11 +90,12 @@ module Tinkerforge
88
90
  @response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
89
91
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
90
92
 
91
- @callback_formats[CALLBACK_HUMIDITY] = 'S'
92
- @callback_formats[CALLBACK_ANALOG_VALUE] = 'S'
93
- @callback_formats[CALLBACK_HUMIDITY_REACHED] = 'S'
94
- @callback_formats[CALLBACK_ANALOG_VALUE_REACHED] = 'S'
93
+ @callback_formats[CALLBACK_HUMIDITY] = [10, 'S']
94
+ @callback_formats[CALLBACK_ANALOG_VALUE] = [10, 'S']
95
+ @callback_formats[CALLBACK_HUMIDITY_REACHED] = [10, 'S']
96
+ @callback_formats[CALLBACK_ANALOG_VALUE_REACHED] = [10, 'S']
95
97
 
98
+ @ipcon.add_device self
96
99
  end
97
100
 
98
101
  # Returns the humidity of the sensor.
@@ -101,7 +104,9 @@ module Tinkerforge
101
104
  # CALLBACK_HUMIDITY callback and set the period with
102
105
  # BrickletHumidity#set_humidity_callback_period.
103
106
  def get_humidity
104
- send_request FUNCTION_GET_HUMIDITY, [], '', 2, 'S'
107
+ check_validity
108
+
109
+ send_request FUNCTION_GET_HUMIDITY, [], '', 10, 'S'
105
110
  end
106
111
 
107
112
  # Returns the value as read by a 12-bit analog-to-digital converter.
@@ -119,7 +124,9 @@ module Tinkerforge
119
124
  # CALLBACK_ANALOG_VALUE callback and set the period with
120
125
  # BrickletHumidity#set_analog_value_callback_period.
121
126
  def get_analog_value
122
- send_request FUNCTION_GET_ANALOG_VALUE, [], '', 2, 'S'
127
+ check_validity
128
+
129
+ send_request FUNCTION_GET_ANALOG_VALUE, [], '', 10, 'S'
123
130
  end
124
131
 
125
132
  # Sets the period with which the CALLBACK_HUMIDITY callback is triggered
@@ -128,12 +135,16 @@ module Tinkerforge
128
135
  # The CALLBACK_HUMIDITY callback is only triggered if the humidity has changed
129
136
  # since the last triggering.
130
137
  def set_humidity_callback_period(period)
131
- send_request FUNCTION_SET_HUMIDITY_CALLBACK_PERIOD, [period], 'L', 0, ''
138
+ check_validity
139
+
140
+ send_request FUNCTION_SET_HUMIDITY_CALLBACK_PERIOD, [period], 'L', 8, ''
132
141
  end
133
142
 
134
143
  # Returns the period as set by BrickletHumidity#set_humidity_callback_period.
135
144
  def get_humidity_callback_period
136
- send_request FUNCTION_GET_HUMIDITY_CALLBACK_PERIOD, [], '', 4, 'L'
145
+ check_validity
146
+
147
+ send_request FUNCTION_GET_HUMIDITY_CALLBACK_PERIOD, [], '', 12, 'L'
137
148
  end
138
149
 
139
150
  # Sets the period with which the CALLBACK_ANALOG_VALUE callback is triggered
@@ -142,12 +153,16 @@ module Tinkerforge
142
153
  # The CALLBACK_ANALOG_VALUE callback is only triggered if the analog value has
143
154
  # changed since the last triggering.
144
155
  def set_analog_value_callback_period(period)
145
- send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD, [period], 'L', 0, ''
156
+ check_validity
157
+
158
+ send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD, [period], 'L', 8, ''
146
159
  end
147
160
 
148
161
  # Returns the period as set by BrickletHumidity#set_analog_value_callback_period.
149
162
  def get_analog_value_callback_period
150
- send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD, [], '', 4, 'L'
163
+ check_validity
164
+
165
+ send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD, [], '', 12, 'L'
151
166
  end
152
167
 
153
168
  # Sets the thresholds for the CALLBACK_HUMIDITY_REACHED callback.
@@ -162,12 +177,16 @@ module Tinkerforge
162
177
  # "'<'", "Callback is triggered when the humidity is smaller than the min value (max is ignored)"
163
178
  # "'>'", "Callback is triggered when the humidity is greater than the min value (max is ignored)"
164
179
  def set_humidity_callback_threshold(option, min, max)
165
- send_request FUNCTION_SET_HUMIDITY_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
180
+ check_validity
181
+
182
+ send_request FUNCTION_SET_HUMIDITY_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
166
183
  end
167
184
 
168
185
  # Returns the threshold as set by BrickletHumidity#set_humidity_callback_threshold.
169
186
  def get_humidity_callback_threshold
170
- send_request FUNCTION_GET_HUMIDITY_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
187
+ check_validity
188
+
189
+ send_request FUNCTION_GET_HUMIDITY_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
171
190
  end
172
191
 
173
192
  # Sets the thresholds for the CALLBACK_ANALOG_VALUE_REACHED callback.
@@ -182,12 +201,16 @@ module Tinkerforge
182
201
  # "'<'", "Callback is triggered when the analog value is smaller than the min value (max is ignored)"
183
202
  # "'>'", "Callback is triggered when the analog value is greater than the min value (max is ignored)"
184
203
  def set_analog_value_callback_threshold(option, min, max)
185
- send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
204
+ check_validity
205
+
206
+ send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
186
207
  end
187
208
 
188
209
  # Returns the threshold as set by BrickletHumidity#set_analog_value_callback_threshold.
189
210
  def get_analog_value_callback_threshold
190
- send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
211
+ check_validity
212
+
213
+ send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
191
214
  end
192
215
 
193
216
  # Sets the period with which the threshold callbacks
@@ -202,24 +225,30 @@ module Tinkerforge
202
225
  #
203
226
  # keep being reached.
204
227
  def set_debounce_period(debounce)
205
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
228
+ check_validity
229
+
230
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
206
231
  end
207
232
 
208
233
  # Returns the debounce period as set by BrickletHumidity#set_debounce_period.
209
234
  def get_debounce_period
210
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
235
+ check_validity
236
+
237
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
211
238
  end
212
239
 
213
240
  # Returns the UID, the UID where the Bricklet is connected to,
214
241
  # the position, the hardware and firmware version as well as the
215
242
  # device identifier.
216
243
  #
217
- # The position can be 'a', 'b', 'c' or 'd'.
244
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
245
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
246
+ # position 'z'.
218
247
  #
219
248
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
220
249
  # |device_identifier_constant|
221
250
  def get_identity
222
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
251
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
223
252
  end
224
253
 
225
254
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.