tinkerforge 2.1.22 → 2.1.27

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 (144) hide show
  1. checksums.yaml +5 -5
  2. data/lib/tinkerforge/brick_dc.rb +157 -76
  3. data/lib/tinkerforge/brick_hat.rb +115 -32
  4. data/lib/tinkerforge/brick_hat_zero.rb +119 -21
  5. data/lib/tinkerforge/brick_imu.rb +192 -87
  6. data/lib/tinkerforge/brick_imu_v2.rb +220 -119
  7. data/lib/tinkerforge/brick_master.rb +498 -198
  8. data/lib/tinkerforge/brick_red.rb +197 -74
  9. data/lib/tinkerforge/brick_servo.rb +187 -103
  10. data/lib/tinkerforge/brick_silent_stepper.rb +249 -169
  11. data/lib/tinkerforge/brick_stepper.rb +214 -102
  12. data/lib/tinkerforge/bricklet_accelerometer.rb +61 -36
  13. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +167 -48
  14. data/lib/tinkerforge/bricklet_air_quality.rb +123 -76
  15. data/lib/tinkerforge/bricklet_ambient_light.rb +62 -46
  16. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +41 -28
  17. data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -28
  18. data/lib/tinkerforge/bricklet_analog_in.rb +66 -45
  19. data/lib/tinkerforge/bricklet_analog_in_v2.rb +60 -43
  20. data/lib/tinkerforge/bricklet_analog_in_v3.rb +68 -32
  21. data/lib/tinkerforge/bricklet_analog_out.rb +25 -16
  22. data/lib/tinkerforge/bricklet_analog_out_v2.rb +21 -10
  23. data/lib/tinkerforge/bricklet_analog_out_v3.rb +55 -22
  24. data/lib/tinkerforge/bricklet_barometer.rb +108 -58
  25. data/lib/tinkerforge/bricklet_barometer_v2.rb +109 -67
  26. data/lib/tinkerforge/bricklet_can.rb +84 -24
  27. data/lib/tinkerforge/bricklet_can_v2.rb +173 -72
  28. data/lib/tinkerforge/bricklet_co2.rb +36 -25
  29. data/lib/tinkerforge/bricklet_co2_v2.rb +119 -60
  30. data/lib/tinkerforge/bricklet_color.rb +77 -49
  31. data/lib/tinkerforge/bricklet_color_v2.rb +493 -0
  32. data/lib/tinkerforge/bricklet_compass.rb +397 -0
  33. data/lib/tinkerforge/bricklet_current12.rb +61 -40
  34. data/lib/tinkerforge/bricklet_current25.rb +61 -40
  35. data/lib/tinkerforge/bricklet_distance_ir.rb +60 -38
  36. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +85 -45
  37. data/lib/tinkerforge/bricklet_distance_us.rb +43 -30
  38. data/lib/tinkerforge/bricklet_distance_us_v2.rb +335 -0
  39. data/lib/tinkerforge/bricklet_dmx.rb +92 -48
  40. data/lib/tinkerforge/bricklet_dual_button.rb +23 -12
  41. data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -29
  42. data/lib/tinkerforge/bricklet_dual_relay.rb +27 -14
  43. data/lib/tinkerforge/bricklet_dust_detector.rb +43 -30
  44. data/lib/tinkerforge/bricklet_e_paper_296x128.rb +115 -63
  45. data/lib/tinkerforge/bricklet_energy_monitor.rb +416 -0
  46. data/lib/tinkerforge/bricklet_gps.rb +72 -48
  47. data/lib/tinkerforge/bricklet_gps_v2.rb +124 -73
  48. data/lib/tinkerforge/bricklet_hall_effect.rb +43 -28
  49. data/lib/tinkerforge/bricklet_hall_effect_v2.rb +76 -44
  50. data/lib/tinkerforge/bricklet_humidity.rb +54 -38
  51. data/lib/tinkerforge/bricklet_humidity_v2.rb +86 -49
  52. data/lib/tinkerforge/bricklet_imu_v3.rb +784 -0
  53. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +41 -18
  54. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +84 -40
  55. data/lib/tinkerforge/bricklet_industrial_counter.rb +102 -59
  56. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +51 -24
  57. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +79 -40
  58. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -15
  59. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +75 -33
  60. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +43 -29
  61. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +81 -44
  62. data/lib/tinkerforge/bricklet_industrial_dual_ac_relay.rb +325 -0
  63. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +51 -30
  64. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +139 -40
  65. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +63 -28
  66. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -15
  67. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -28
  68. data/lib/tinkerforge/bricklet_io16.rb +57 -32
  69. data/lib/tinkerforge/bricklet_io16_v2.rb +93 -48
  70. data/lib/tinkerforge/bricklet_io4.rb +56 -31
  71. data/lib/tinkerforge/bricklet_io4_v2.rb +109 -57
  72. data/lib/tinkerforge/bricklet_isolator.rb +111 -35
  73. data/lib/tinkerforge/bricklet_joystick.rb +63 -42
  74. data/lib/tinkerforge/bricklet_joystick_v2.rb +71 -35
  75. data/lib/tinkerforge/bricklet_laser_range_finder.rb +87 -59
  76. data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +101 -53
  77. data/lib/tinkerforge/bricklet_lcd_128x64.rb +241 -131
  78. data/lib/tinkerforge/bricklet_lcd_16x2.rb +49 -25
  79. data/lib/tinkerforge/bricklet_lcd_20x4.rb +59 -29
  80. data/lib/tinkerforge/bricklet_led_strip.rb +69 -47
  81. data/lib/tinkerforge/bricklet_led_strip_v2.rb +105 -48
  82. data/lib/tinkerforge/bricklet_line.rb +35 -22
  83. data/lib/tinkerforge/bricklet_linear_poti.rb +53 -35
  84. data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -24
  85. data/lib/tinkerforge/bricklet_load_cell.rb +64 -40
  86. data/lib/tinkerforge/bricklet_load_cell_v2.rb +81 -41
  87. data/lib/tinkerforge/bricklet_moisture.rb +43 -30
  88. data/lib/tinkerforge/bricklet_motion_detector.rb +21 -10
  89. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -29
  90. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -32
  91. data/lib/tinkerforge/bricklet_multi_touch.rb +30 -17
  92. data/lib/tinkerforge/bricklet_multi_touch_v2.rb +371 -0
  93. data/lib/tinkerforge/bricklet_nfc.rb +130 -80
  94. data/lib/tinkerforge/bricklet_nfc_rfid.rb +32 -13
  95. data/lib/tinkerforge/bricklet_oled_128x64.rb +30 -17
  96. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +97 -40
  97. data/lib/tinkerforge/bricklet_oled_64x48.rb +30 -17
  98. data/lib/tinkerforge/bricklet_one_wire.rb +65 -24
  99. data/lib/tinkerforge/bricklet_outdoor_weather.rb +84 -41
  100. data/lib/tinkerforge/bricklet_particulate_matter.rb +85 -37
  101. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -13
  102. data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -19
  103. data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +84 -57
  104. data/lib/tinkerforge/bricklet_ptc.rb +76 -51
  105. data/lib/tinkerforge/bricklet_ptc_v2.rb +96 -54
  106. data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -36
  107. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -47
  108. data/lib/tinkerforge/bricklet_remote_switch.rb +38 -29
  109. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +86 -49
  110. data/lib/tinkerforge/bricklet_rgb_led.rb +17 -8
  111. data/lib/tinkerforge/bricklet_rgb_led_button.rb +61 -30
  112. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +78 -33
  113. data/lib/tinkerforge/bricklet_rgb_led_v2.rb +51 -20
  114. data/lib/tinkerforge/bricklet_rotary_encoder.rb +40 -25
  115. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -27
  116. data/lib/tinkerforge/bricklet_rotary_poti.rb +55 -37
  117. data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +290 -0
  118. data/lib/tinkerforge/bricklet_rs232.rb +89 -28
  119. data/lib/tinkerforge/bricklet_rs232_v2.rb +121 -47
  120. data/lib/tinkerforge/bricklet_rs485.rb +303 -207
  121. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
  122. data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -36
  123. data/lib/tinkerforge/bricklet_solid_state_relay.rb +24 -13
  124. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +58 -25
  125. data/lib/tinkerforge/bricklet_sound_intensity.rb +36 -24
  126. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +77 -41
  127. data/lib/tinkerforge/bricklet_temperature.rb +43 -28
  128. data/lib/tinkerforge/bricklet_temperature_ir.rb +63 -47
  129. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +75 -53
  130. data/lib/tinkerforge/bricklet_temperature_v2.rb +62 -31
  131. data/lib/tinkerforge/bricklet_thermal_imaging.rb +118 -68
  132. data/lib/tinkerforge/bricklet_thermocouple.rb +46 -30
  133. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -30
  134. data/lib/tinkerforge/bricklet_tilt.rb +23 -10
  135. data/lib/tinkerforge/bricklet_uv_light.rb +37 -24
  136. data/lib/tinkerforge/bricklet_uv_light_v2.rb +87 -46
  137. data/lib/tinkerforge/bricklet_voltage.rb +54 -37
  138. data/lib/tinkerforge/bricklet_voltage_current.rb +94 -85
  139. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +103 -77
  140. data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +410 -0
  141. data/lib/tinkerforge/device_display_names.rb +165 -0
  142. data/lib/tinkerforge/ip_connection.rb +155 -33
  143. data/lib/tinkerforge/version.rb +1 -1
  144. metadata +14 -4
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-05-21. #
3
+ # This file was automatically generated on 2020-11-02. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.22 #
5
+ # Ruby Bindings Version 2.1.27 #
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
  # Two relays to switch AC/DC devices
14
16
  class BrickletDualRelay < Device
@@ -31,7 +33,7 @@ module Tinkerforge
31
33
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
32
34
  # the IP Connection <tt>ipcon</tt>.
33
35
  def initialize(uid, ipcon)
34
- super uid, ipcon
36
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
35
37
 
36
38
  @api_version = [2, 0, 0]
37
39
 
@@ -42,8 +44,9 @@ module Tinkerforge
42
44
  @response_expected[FUNCTION_SET_SELECTED_STATE] = RESPONSE_EXPECTED_FALSE
43
45
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
44
46
 
45
- @callback_formats[CALLBACK_MONOFLOP_DONE] = 'C ?'
47
+ @callback_formats[CALLBACK_MONOFLOP_DONE] = [10, 'C ?']
46
48
 
49
+ @ipcon.add_device self
47
50
  end
48
51
 
49
52
  # Sets the state of the relays, *true* means on and *false* means off.
@@ -54,20 +57,22 @@ module Tinkerforge
54
57
  # can use BrickletDualRelay#set_selected_state.
55
58
  #
56
59
  # All running monoflop timers will be aborted if this function is called.
57
- #
58
- # The default value is (*false*, *false*).
59
60
  def set_state(relay1, relay2)
60
- send_request FUNCTION_SET_STATE, [relay1, relay2], '? ?', 0, ''
61
+ check_validity
62
+
63
+ send_request FUNCTION_SET_STATE, [relay1, relay2], '? ?', 8, ''
61
64
  end
62
65
 
63
66
  # Returns the state of the relays, *true* means on and *false* means off.
64
67
  def get_state
65
- send_request FUNCTION_GET_STATE, [], '', 2, '? ?'
68
+ check_validity
69
+
70
+ send_request FUNCTION_GET_STATE, [], '', 10, '? ?'
66
71
  end
67
72
 
68
73
  # The first parameter can be 1 or 2 (relay 1 or relay 2). The second parameter
69
74
  # is the desired state of the relay (*true* means on and *false* means off).
70
- # The third parameter indicates the time (in ms) that the relay should hold
75
+ # The third parameter indicates the time that the relay should hold
71
76
  # the state.
72
77
  #
73
78
  # If this function is called with the parameters (1, true, 1500):
@@ -79,7 +84,9 @@ module Tinkerforge
79
84
  # of two seconds. The relay will be on all the time. If now the RS485
80
85
  # connection is lost, the relay will turn off in at most two seconds.
81
86
  def set_monoflop(relay, state, time)
82
- send_request FUNCTION_SET_MONOFLOP, [relay, state, time], 'C ? L', 0, ''
87
+ check_validity
88
+
89
+ send_request FUNCTION_SET_MONOFLOP, [relay, state, time], 'C ? L', 8, ''
83
90
  end
84
91
 
85
92
  # Returns (for the given relay) the current state and the time as set by
@@ -88,7 +95,9 @@ module Tinkerforge
88
95
  # If the timer is not running currently, the remaining time will be returned
89
96
  # as 0.
90
97
  def get_monoflop(relay)
91
- send_request FUNCTION_GET_MONOFLOP, [relay], 'C', 9, '? L L'
98
+ check_validity
99
+
100
+ send_request FUNCTION_GET_MONOFLOP, [relay], 'C', 17, '? L L'
92
101
  end
93
102
 
94
103
  # Sets the state of the selected relay (1 or 2), *true* means on and *false* means off.
@@ -97,19 +106,23 @@ module Tinkerforge
97
106
  #
98
107
  # The other relay remains untouched.
99
108
  def set_selected_state(relay, state)
100
- send_request FUNCTION_SET_SELECTED_STATE, [relay, state], 'C ?', 0, ''
109
+ check_validity
110
+
111
+ send_request FUNCTION_SET_SELECTED_STATE, [relay, state], 'C ?', 8, ''
101
112
  end
102
113
 
103
114
  # Returns the UID, the UID where the Bricklet is connected to,
104
115
  # the position, the hardware and firmware version as well as the
105
116
  # device identifier.
106
117
  #
107
- # The position can be 'a', 'b', 'c' or 'd'.
118
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
119
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
120
+ # position 'z'.
108
121
  #
109
122
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
110
123
  # |device_identifier_constant|
111
124
  def get_identity
112
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
125
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
113
126
  end
114
127
 
115
128
  # 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-05-21. #
3
+ # This file was automatically generated on 2020-11-02. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.22 #
5
+ # Ruby Bindings Version 2.1.27 #
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 dust density
14
16
  class BrickletDustDetector < 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,34 +68,39 @@ 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_DUST_DENSITY] = 'S'
70
- @callback_formats[CALLBACK_DUST_DENSITY_REACHED] = 'S'
71
+ @callback_formats[CALLBACK_DUST_DENSITY] = [10, 'S']
72
+ @callback_formats[CALLBACK_DUST_DENSITY_REACHED] = [10, 'S']
71
73
 
74
+ @ipcon.add_device self
72
75
  end
73
76
 
74
- # Returns the dust density in µg/m³.
77
+ # Returns the dust density.
75
78
  #
76
79
  # If you want to get the dust density periodically, it is recommended
77
80
  # to use the CALLBACK_DUST_DENSITY callback and set the period with
78
81
  # BrickletDustDetector#set_dust_density_callback_period.
79
82
  def get_dust_density
80
- send_request FUNCTION_GET_DUST_DENSITY, [], '', 2, 'S'
83
+ check_validity
84
+
85
+ send_request FUNCTION_GET_DUST_DENSITY, [], '', 10, 'S'
81
86
  end
82
87
 
83
- # Sets the period in ms with which the CALLBACK_DUST_DENSITY callback is triggered
88
+ # Sets the period with which the CALLBACK_DUST_DENSITY callback is triggered
84
89
  # periodically. A value of 0 turns the callback off.
85
90
  #
86
91
  # The CALLBACK_DUST_DENSITY callback is only triggered if the dust density has
87
92
  # changed since the last triggering.
88
- #
89
- # The default value is 0.
90
93
  def set_dust_density_callback_period(period)
91
- send_request FUNCTION_SET_DUST_DENSITY_CALLBACK_PERIOD, [period], 'L', 0, ''
94
+ check_validity
95
+
96
+ send_request FUNCTION_SET_DUST_DENSITY_CALLBACK_PERIOD, [period], 'L', 8, ''
92
97
  end
93
98
 
94
99
  # Returns the period as set by BrickletDustDetector#set_dust_density_callback_period.
95
100
  def get_dust_density_callback_period
96
- send_request FUNCTION_GET_DUST_DENSITY_CALLBACK_PERIOD, [], '', 4, 'L'
101
+ check_validity
102
+
103
+ send_request FUNCTION_GET_DUST_DENSITY_CALLBACK_PERIOD, [], '', 12, 'L'
97
104
  end
98
105
 
99
106
  # Sets the thresholds for the CALLBACK_DUST_DENSITY_REACHED callback.
@@ -107,18 +114,20 @@ module Tinkerforge
107
114
  # "'i'", "Callback is triggered when the dust density value is *inside* the min and max values"
108
115
  # "'<'", "Callback is triggered when the dust density value is smaller than the min value (max is ignored)"
109
116
  # "'>'", "Callback is triggered when the dust density value is greater than the min value (max is ignored)"
110
- #
111
- # The default value is ('x', 0, 0).
112
117
  def set_dust_density_callback_threshold(option, min, max)
113
- send_request FUNCTION_SET_DUST_DENSITY_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
118
+ check_validity
119
+
120
+ send_request FUNCTION_SET_DUST_DENSITY_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
114
121
  end
115
122
 
116
123
  # Returns the threshold as set by BrickletDustDetector#set_dust_density_callback_threshold.
117
124
  def get_dust_density_callback_threshold
118
- send_request FUNCTION_GET_DUST_DENSITY_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
125
+ check_validity
126
+
127
+ send_request FUNCTION_GET_DUST_DENSITY_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
119
128
  end
120
129
 
121
- # Sets the period in ms with which the threshold callback
130
+ # Sets the period with which the threshold callback
122
131
  #
123
132
  # * CALLBACK_DUST_DENSITY_REACHED
124
133
  #
@@ -127,45 +136,49 @@ module Tinkerforge
127
136
  # * BrickletDustDetector#set_dust_density_callback_threshold
128
137
  #
129
138
  # keeps being reached.
130
- #
131
- # The default value is 100.
132
139
  def set_debounce_period(debounce)
133
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
140
+ check_validity
141
+
142
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
134
143
  end
135
144
 
136
145
  # Returns the debounce period as set by BrickletDustDetector#set_debounce_period.
137
146
  def get_debounce_period
138
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
147
+ check_validity
148
+
149
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
139
150
  end
140
151
 
141
152
  # Sets the length of a `moving averaging <https://en.wikipedia.org/wiki/Moving_average>`__
142
- # for the dust_density.
153
+ # for the dust density.
143
154
  #
144
155
  # Setting the length to 0 will turn the averaging completely off. With less
145
156
  # averaging, there is more noise on the data.
146
- #
147
- # The range for the averaging is 0-100.
148
- #
149
- # The default value is 100.
150
157
  def set_moving_average(average)
151
- send_request FUNCTION_SET_MOVING_AVERAGE, [average], 'C', 0, ''
158
+ check_validity
159
+
160
+ send_request FUNCTION_SET_MOVING_AVERAGE, [average], 'C', 8, ''
152
161
  end
153
162
 
154
163
  # Returns the length moving average as set by BrickletDustDetector#set_moving_average.
155
164
  def get_moving_average
156
- send_request FUNCTION_GET_MOVING_AVERAGE, [], '', 1, 'C'
165
+ check_validity
166
+
167
+ send_request FUNCTION_GET_MOVING_AVERAGE, [], '', 9, 'C'
157
168
  end
158
169
 
159
170
  # Returns the UID, the UID where the Bricklet is connected to,
160
171
  # the position, the hardware and firmware version as well as the
161
172
  # device identifier.
162
173
  #
163
- # The position can be 'a', 'b', 'c' or 'd'.
174
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
175
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
176
+ # position 'z'.
164
177
  #
165
178
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
166
179
  # |device_identifier_constant|
167
180
  def get_identity
168
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
181
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
169
182
  end
170
183
 
171
184
  # 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-05-21. #
3
+ # This file was automatically generated on 2020-11-02. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.22 #
5
+ # Ruby Bindings Version 2.1.27 #
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
  # Three color 296x128 e-paper display
14
16
  class BrickletEPaper296x128 < Device
@@ -89,7 +91,7 @@ module Tinkerforge
89
91
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
90
92
  # the IP Connection <tt>ipcon</tt>.
91
93
  def initialize(uid, ipcon)
92
- super uid, ipcon
94
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
93
95
 
94
96
  @api_version = [2, 0, 0]
95
97
 
@@ -120,8 +122,9 @@ module Tinkerforge
120
122
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
121
123
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
122
124
 
123
- @callback_formats[CALLBACK_DRAW_STATUS] = 'C'
125
+ @callback_formats[CALLBACK_DRAW_STATUS] = [9, 'C']
124
126
 
127
+ @ipcon.add_device self
125
128
  end
126
129
 
127
130
  # Draws the current black/white and red or gray buffer to the e-paper display.
@@ -129,7 +132,9 @@ module Tinkerforge
129
132
  # The Bricklet does not have any double-buffering. You should not call
130
133
  # this function while writing to the buffer. See BrickletEPaper296x128#get_draw_status.
131
134
  def draw
132
- send_request FUNCTION_DRAW, [], '', 0, ''
135
+ check_validity
136
+
137
+ send_request FUNCTION_DRAW, [], '', 8, ''
133
138
  end
134
139
 
135
140
  # Returns one of three draw statuses:
@@ -142,14 +147,15 @@ module Tinkerforge
142
147
  # either *idle* or *drawing*. You should not write to the buffer while it is being *copied* to the
143
148
  # display. There is no double-buffering.
144
149
  def get_draw_status
145
- send_request FUNCTION_GET_DRAW_STATUS, [], '', 1, 'C'
150
+ check_validity
151
+
152
+ send_request FUNCTION_GET_DRAW_STATUS, [], '', 9, 'C'
146
153
  end
147
154
 
148
155
  # Writes black/white pixels to the specified window into the buffer.
149
156
  #
150
- # The x-axis goes from 0 to 295 and the y-axis from 0 to 127. The pixels are written
151
- # into the window line by line top to bottom and each line is written from left to
152
- # right.
157
+ # The pixels are written into the window line by line top to bottom
158
+ # and each line is written from left to right.
153
159
  #
154
160
  # The value 0 (false) corresponds to a black pixel and the value 1 (true) to a
155
161
  # white pixel.
@@ -159,29 +165,31 @@ module Tinkerforge
159
165
  #
160
166
  # Use BrickletEPaper296x128#write_color to write red or gray pixels.
161
167
  def write_black_white_low_level(x_start, y_start, x_end, y_end, pixels_length, pixels_chunk_offset, pixels_chunk_data)
162
- send_request FUNCTION_WRITE_BLACK_WHITE_LOW_LEVEL, [x_start, y_start, x_end, y_end, pixels_length, pixels_chunk_offset, pixels_chunk_data], 'S C S C S S ?432', 0, ''
168
+ check_validity
169
+
170
+ send_request FUNCTION_WRITE_BLACK_WHITE_LOW_LEVEL, [x_start, y_start, x_end, y_end, pixels_length, pixels_chunk_offset, pixels_chunk_data], 'S C S C S S ?432', 8, ''
163
171
  end
164
172
 
165
173
  # Returns the current content of the black/white pixel buffer for the specified window.
166
174
  #
167
- # The x-axis goes from 0 to 295 and the y-axis from 0 to 127. The pixels are written
168
- # into the window line by line top to bottom and each line is written from left to
169
- # right.
175
+ # The pixels are read into the window line by line top to bottom and
176
+ # each line is read from left to right.
170
177
  #
171
178
  # The current content of the buffer does not have to be the current content of the display.
172
179
  # It is possible that the data was not drawn to the display yet and after a restart of
173
180
  # the Bricklet the buffer will be reset to black, while the display retains its content.
174
181
  def read_black_white_low_level(x_start, y_start, x_end, y_end)
175
- send_request FUNCTION_READ_BLACK_WHITE_LOW_LEVEL, [x_start, y_start, x_end, y_end], 'S C S C', 468, 'S S ?464'
182
+ check_validity
183
+
184
+ send_request FUNCTION_READ_BLACK_WHITE_LOW_LEVEL, [x_start, y_start, x_end, y_end], 'S C S C', 70, 'S S ?464'
176
185
  end
177
186
 
178
187
  # The E-Paper 296x128 Bricklet is available with the colors black/white/red and
179
188
  # black/white/gray. Depending on the model this function writes either red or
180
189
  # gray pixels to the specified window into the buffer.
181
190
  #
182
- # The x-axis goes from 0 to 295 and the y-axis from 0 to 127. The pixels are written
183
- # into the window line by line top to bottom and each line is written from left to
184
- # right.
191
+ # The pixels are written into the window line by line top to bottom
192
+ # and each line is written from left to right.
185
193
  #
186
194
  # The value 0 (false) means that this pixel does not have color. It will be either black
187
195
  # or white (see BrickletEPaper296x128#write_black_white). The value 1 (true) corresponds to a red or gray
@@ -192,53 +200,69 @@ module Tinkerforge
192
200
  #
193
201
  # Use BrickletEPaper296x128#write_black_white to write black/white pixels.
194
202
  def write_color_low_level(x_start, y_start, x_end, y_end, pixels_length, pixels_chunk_offset, pixels_chunk_data)
195
- send_request FUNCTION_WRITE_COLOR_LOW_LEVEL, [x_start, y_start, x_end, y_end, pixels_length, pixels_chunk_offset, pixels_chunk_data], 'S C S C S S ?432', 0, ''
203
+ check_validity
204
+
205
+ send_request FUNCTION_WRITE_COLOR_LOW_LEVEL, [x_start, y_start, x_end, y_end, pixels_length, pixels_chunk_offset, pixels_chunk_data], 'S C S C S S ?432', 8, ''
196
206
  end
197
207
 
198
208
  # Returns the current content of the red or gray pixel buffer for the specified window.
199
209
  #
200
- # The x-axis goes from 0 to 295 and the y-axis from 0 to 127. The pixels are written
201
- # into the window line by line top to bottom and each line is written from left to
202
- # right.
210
+ # The pixels are written into the window line by line top to bottom
211
+ # and each line is written from left to right.
203
212
  #
204
213
  # The current content of the buffer does not have to be the current content of the display.
205
214
  # It is possible that the data was not drawn to the display yet and after a restart of
206
215
  # the Bricklet the buffer will be reset to black, while the display retains its content.
207
216
  def read_color_low_level(x_start, y_start, x_end, y_end)
208
- send_request FUNCTION_READ_COLOR_LOW_LEVEL, [x_start, y_start, x_end, y_end], 'S C S C', 468, 'S S ?464'
217
+ check_validity
218
+
219
+ send_request FUNCTION_READ_COLOR_LOW_LEVEL, [x_start, y_start, x_end, y_end], 'S C S C', 70, 'S S ?464'
209
220
  end
210
221
 
211
222
  # Fills the complete content of the display with the given color.
223
+ #
224
+ # This function writes the pixels into the black/white/red|gray pixel buffer, to draw the buffer
225
+ # to the display use BrickletEPaper296x128#draw.
212
226
  def fill_display(color)
213
- send_request FUNCTION_FILL_DISPLAY, [color], 'C', 0, ''
227
+ check_validity
228
+
229
+ send_request FUNCTION_FILL_DISPLAY, [color], 'C', 8, ''
214
230
  end
215
231
 
216
232
  # Draws a text with up to 50 characters at the pixel position (x, y).
217
233
  #
218
- # The x values have to be within the range of 0 to 295 and the y
219
- # values have to be within the range of 0 to 127.
220
- #
221
234
  # You can use one of 9 different font sizes and draw the text in
222
235
  # black/white/red|gray. The text can be drawn horizontal or vertical.
236
+ #
237
+ # This function writes the pixels into the black/white/red|gray pixel buffer, to draw the buffer
238
+ # to the display use BrickletEPaper296x128#draw.
223
239
  def draw_text(position_x, position_y, font, color, orientation, text)
224
- send_request FUNCTION_DRAW_TEXT, [position_x, position_y, font, color, orientation, text], 'S C C C C Z50', 0, ''
240
+ check_validity
241
+
242
+ send_request FUNCTION_DRAW_TEXT, [position_x, position_y, font, color, orientation, text], 'S C C C C Z50', 8, ''
225
243
  end
226
244
 
227
245
  # Draws a line from (x, y)-start to (x, y)-end in the given color.
228
- # The x values have to be within the range of 0 to 295 and the y
229
- # values have t be within the range of 0 to 127.
246
+ #
247
+ # This function writes the pixels into the black/white/red|gray pixel buffer, to draw the buffer
248
+ # to the display use BrickletEPaper296x128#draw.
230
249
  def draw_line(position_x_start, position_y_start, position_x_end, position_y_end, color)
231
- send_request FUNCTION_DRAW_LINE, [position_x_start, position_y_start, position_x_end, position_y_end, color], 'S C S C C', 0, ''
250
+ check_validity
251
+
252
+ send_request FUNCTION_DRAW_LINE, [position_x_start, position_y_start, position_x_end, position_y_end, color], 'S C S C C', 8, ''
232
253
  end
233
254
 
234
255
  # Draws a box from (x, y)-start to (x, y)-end in the given color.
235
- # The x values have to be within the range of 0 to 295 and the y
236
- # values have to be within the range of 0 to 127.
237
256
  #
238
257
  # If you set fill to true, the box will be filled with the
239
258
  # color. Otherwise only the outline will be drawn.
259
+ #
260
+ # This function writes the pixels into the black/white/red|gray pixel buffer, to draw the buffer
261
+ # to the display use BrickletEPaper296x128#draw.
240
262
  def draw_box(position_x_start, position_y_start, position_x_end, position_y_end, fill, color)
241
- send_request FUNCTION_DRAW_BOX, [position_x_start, position_y_start, position_x_end, position_y_end, fill, color], 'S C S C ? C', 0, ''
263
+ check_validity
264
+
265
+ send_request FUNCTION_DRAW_BOX, [position_x_start, position_y_start, position_x_end, position_y_end, fill, color], 'S C S C ? C', 8, ''
242
266
  end
243
267
 
244
268
  # .. note::
@@ -276,12 +300,16 @@ module Tinkerforge
276
300
  # three available colors a few times. This will get rid of the ghosting and after that you can
277
301
  # go back to the delta mode with flicker-free updates.
278
302
  def set_update_mode(update_mode)
279
- send_request FUNCTION_SET_UPDATE_MODE, [update_mode], 'C', 0, ''
303
+ check_validity
304
+
305
+ send_request FUNCTION_SET_UPDATE_MODE, [update_mode], 'C', 8, ''
280
306
  end
281
307
 
282
308
  # Returns the update mode as set by BrickletEPaper296x128#set_update_mode.
283
309
  def get_update_mode
284
- send_request FUNCTION_GET_UPDATE_MODE, [], '', 1, 'C'
310
+ check_validity
311
+
312
+ send_request FUNCTION_GET_UPDATE_MODE, [], '', 9, 'C'
285
313
  end
286
314
 
287
315
  # Sets the type of the display. The e-paper display is available
@@ -289,13 +317,17 @@ module Tinkerforge
289
317
  # during the flashing and testing phase. The value is saved in
290
318
  # non-volatile memory and will stay after a power cycle.
291
319
  def set_display_type(display_type)
292
- send_request FUNCTION_SET_DISPLAY_TYPE, [display_type], 'C', 0, ''
320
+ check_validity
321
+
322
+ send_request FUNCTION_SET_DISPLAY_TYPE, [display_type], 'C', 8, ''
293
323
  end
294
324
 
295
325
  # Returns the type of the e-paper display. It can either be
296
326
  # black/white/red or black/white/gray.
297
327
  def get_display_type
298
- send_request FUNCTION_GET_DISPLAY_TYPE, [], '', 1, 'C'
328
+ check_validity
329
+
330
+ send_request FUNCTION_GET_DISPLAY_TYPE, [], '', 9, 'C'
299
331
  end
300
332
 
301
333
  # Returns the error count for the communication between Brick and Bricklet.
@@ -310,7 +342,9 @@ module Tinkerforge
310
342
  # The errors counts are for errors that occur on the Bricklet side. All
311
343
  # Bricks have a similar function that returns the errors on the Brick side.
312
344
  def get_spitfp_error_count
313
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
345
+ check_validity
346
+
347
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
314
348
  end
315
349
 
316
350
  # Sets the bootloader mode and returns the status after the requested
@@ -323,12 +357,16 @@ module Tinkerforge
323
357
  # This function is used by Brick Viewer during flashing. It should not be
324
358
  # necessary to call it in a normal user program.
325
359
  def set_bootloader_mode(mode)
326
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
360
+ check_validity
361
+
362
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
327
363
  end
328
364
 
329
365
  # Returns the current bootloader mode, see BrickletEPaper296x128#set_bootloader_mode.
330
366
  def get_bootloader_mode
331
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
367
+ check_validity
368
+
369
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
332
370
  end
333
371
 
334
372
  # Sets the firmware pointer for BrickletEPaper296x128#write_firmware. The pointer has
@@ -338,7 +376,9 @@ module Tinkerforge
338
376
  # This function is used by Brick Viewer during flashing. It should not be
339
377
  # necessary to call it in a normal user program.
340
378
  def set_write_firmware_pointer(pointer)
341
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
379
+ check_validity
380
+
381
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
342
382
  end
343
383
 
344
384
  # Writes 64 Bytes of firmware at the position as written by
@@ -350,7 +390,9 @@ module Tinkerforge
350
390
  # This function is used by Brick Viewer during flashing. It should not be
351
391
  # necessary to call it in a normal user program.
352
392
  def write_firmware(data)
353
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
393
+ check_validity
394
+
395
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
354
396
  end
355
397
 
356
398
  # Sets the status LED configuration. By default the LED shows
@@ -361,22 +403,28 @@ module Tinkerforge
361
403
  #
362
404
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
363
405
  def set_status_led_config(config)
364
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
406
+ check_validity
407
+
408
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
365
409
  end
366
410
 
367
411
  # Returns the configuration as set by BrickletEPaper296x128#set_status_led_config
368
412
  def get_status_led_config
369
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
413
+ check_validity
414
+
415
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
370
416
  end
371
417
 
372
- # Returns the temperature in °C as measured inside the microcontroller. The
418
+ # Returns the temperature as measured inside the microcontroller. The
373
419
  # value returned is not the ambient temperature!
374
420
  #
375
421
  # The temperature is only proportional to the real temperature and it has bad
376
422
  # accuracy. Practically it is only useful as an indicator for
377
423
  # temperature changes.
378
424
  def get_chip_temperature
379
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
425
+ check_validity
426
+
427
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
380
428
  end
381
429
 
382
430
  # Calling this function will reset the Bricklet. All configurations
@@ -386,7 +434,9 @@ module Tinkerforge
386
434
  # calling functions on the existing ones will result in
387
435
  # undefined behavior!
388
436
  def reset
389
- send_request FUNCTION_RESET, [], '', 0, ''
437
+ check_validity
438
+
439
+ send_request FUNCTION_RESET, [], '', 8, ''
390
440
  end
391
441
 
392
442
  # Writes a new UID into flash. If you want to set a new UID
@@ -395,32 +445,37 @@ module Tinkerforge
395
445
  #
396
446
  # We recommend that you use Brick Viewer to change the UID.
397
447
  def write_uid(uid)
398
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
448
+ check_validity
449
+
450
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
399
451
  end
400
452
 
401
453
  # Returns the current UID as an integer. Encode as
402
454
  # Base58 to get the usual string version.
403
455
  def read_uid
404
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
456
+ check_validity
457
+
458
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
405
459
  end
406
460
 
407
461
  # Returns the UID, the UID where the Bricklet is connected to,
408
462
  # the position, the hardware and firmware version as well as the
409
463
  # device identifier.
410
464
  #
411
- # The position can be 'a', 'b', 'c' or 'd'.
465
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
466
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
467
+ # position 'z'.
412
468
  #
413
469
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
414
470
  # |device_identifier_constant|
415
471
  def get_identity
416
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
472
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
417
473
  end
418
474
 
419
475
  # Writes black/white pixels to the specified window into the buffer.
420
476
  #
421
- # The x-axis goes from 0 to 295 and the y-axis from 0 to 127. The pixels are written
422
- # into the window line by line top to bottom and each line is written from left to
423
- # right.
477
+ # The pixels are written into the window line by line top to bottom
478
+ # and each line is written from left to right.
424
479
  #
425
480
  # The value 0 (false) corresponds to a black pixel and the value 1 (true) to a
426
481
  # white pixel.
@@ -462,9 +517,8 @@ module Tinkerforge
462
517
 
463
518
  # Returns the current content of the black/white pixel buffer for the specified window.
464
519
  #
465
- # The x-axis goes from 0 to 295 and the y-axis from 0 to 127. The pixels are written
466
- # into the window line by line top to bottom and each line is written from left to
467
- # right.
520
+ # The pixels are read into the window line by line top to bottom and
521
+ # each line is read from left to right.
468
522
  #
469
523
  # The current content of the buffer does not have to be the current content of the display.
470
524
  # It is possible that the data was not drawn to the display yet and after a restart of
@@ -506,9 +560,8 @@ module Tinkerforge
506
560
  # black/white/gray. Depending on the model this function writes either red or
507
561
  # gray pixels to the specified window into the buffer.
508
562
  #
509
- # The x-axis goes from 0 to 295 and the y-axis from 0 to 127. The pixels are written
510
- # into the window line by line top to bottom and each line is written from left to
511
- # right.
563
+ # The pixels are written into the window line by line top to bottom
564
+ # and each line is written from left to right.
512
565
  #
513
566
  # The value 0 (false) means that this pixel does not have color. It will be either black
514
567
  # or white (see BrickletEPaper296x128#write_black_white). The value 1 (true) corresponds to a red or gray
@@ -551,9 +604,8 @@ module Tinkerforge
551
604
 
552
605
  # Returns the current content of the red or gray pixel buffer for the specified window.
553
606
  #
554
- # The x-axis goes from 0 to 295 and the y-axis from 0 to 127. The pixels are written
555
- # into the window line by line top to bottom and each line is written from left to
556
- # right.
607
+ # The pixels are written into the window line by line top to bottom
608
+ # and each line is written from left to right.
557
609
  #
558
610
  # The current content of the buffer does not have to be the current content of the display.
559
611
  # It is possible that the data was not drawn to the display yet and after a restart of