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