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.
- checksums.yaml +5 -5
- data/lib/tinkerforge/brick_dc.rb +157 -76
- data/lib/tinkerforge/brick_hat.rb +115 -32
- data/lib/tinkerforge/brick_hat_zero.rb +119 -21
- data/lib/tinkerforge/brick_imu.rb +192 -87
- data/lib/tinkerforge/brick_imu_v2.rb +220 -119
- data/lib/tinkerforge/brick_master.rb +498 -198
- data/lib/tinkerforge/brick_red.rb +197 -74
- data/lib/tinkerforge/brick_servo.rb +187 -103
- data/lib/tinkerforge/brick_silent_stepper.rb +249 -169
- data/lib/tinkerforge/brick_stepper.rb +214 -102
- data/lib/tinkerforge/bricklet_accelerometer.rb +61 -36
- data/lib/tinkerforge/bricklet_accelerometer_v2.rb +167 -48
- data/lib/tinkerforge/bricklet_air_quality.rb +123 -76
- data/lib/tinkerforge/bricklet_ambient_light.rb +62 -46
- data/lib/tinkerforge/bricklet_ambient_light_v2.rb +41 -28
- data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -28
- data/lib/tinkerforge/bricklet_analog_in.rb +66 -45
- data/lib/tinkerforge/bricklet_analog_in_v2.rb +60 -43
- data/lib/tinkerforge/bricklet_analog_in_v3.rb +68 -32
- data/lib/tinkerforge/bricklet_analog_out.rb +25 -16
- data/lib/tinkerforge/bricklet_analog_out_v2.rb +21 -10
- data/lib/tinkerforge/bricklet_analog_out_v3.rb +55 -22
- data/lib/tinkerforge/bricklet_barometer.rb +108 -58
- data/lib/tinkerforge/bricklet_barometer_v2.rb +109 -67
- data/lib/tinkerforge/bricklet_can.rb +84 -24
- data/lib/tinkerforge/bricklet_can_v2.rb +173 -72
- data/lib/tinkerforge/bricklet_co2.rb +36 -25
- data/lib/tinkerforge/bricklet_co2_v2.rb +119 -60
- data/lib/tinkerforge/bricklet_color.rb +77 -49
- data/lib/tinkerforge/bricklet_color_v2.rb +493 -0
- data/lib/tinkerforge/bricklet_compass.rb +397 -0
- data/lib/tinkerforge/bricklet_current12.rb +61 -40
- data/lib/tinkerforge/bricklet_current25.rb +61 -40
- data/lib/tinkerforge/bricklet_distance_ir.rb +60 -38
- data/lib/tinkerforge/bricklet_distance_ir_v2.rb +85 -45
- data/lib/tinkerforge/bricklet_distance_us.rb +43 -30
- data/lib/tinkerforge/bricklet_distance_us_v2.rb +335 -0
- data/lib/tinkerforge/bricklet_dmx.rb +92 -48
- data/lib/tinkerforge/bricklet_dual_button.rb +23 -12
- data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -29
- data/lib/tinkerforge/bricklet_dual_relay.rb +27 -14
- data/lib/tinkerforge/bricklet_dust_detector.rb +43 -30
- data/lib/tinkerforge/bricklet_e_paper_296x128.rb +115 -63
- data/lib/tinkerforge/bricklet_energy_monitor.rb +416 -0
- data/lib/tinkerforge/bricklet_gps.rb +72 -48
- data/lib/tinkerforge/bricklet_gps_v2.rb +124 -73
- data/lib/tinkerforge/bricklet_hall_effect.rb +43 -28
- data/lib/tinkerforge/bricklet_hall_effect_v2.rb +76 -44
- data/lib/tinkerforge/bricklet_humidity.rb +54 -38
- data/lib/tinkerforge/bricklet_humidity_v2.rb +86 -49
- data/lib/tinkerforge/bricklet_imu_v3.rb +784 -0
- data/lib/tinkerforge/bricklet_industrial_analog_out.rb +41 -18
- data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +84 -40
- data/lib/tinkerforge/bricklet_industrial_counter.rb +102 -59
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +51 -24
- data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +79 -40
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -15
- data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +75 -33
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +43 -29
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +81 -44
- data/lib/tinkerforge/bricklet_industrial_dual_ac_relay.rb +325 -0
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +51 -30
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +139 -40
- data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +63 -28
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -15
- data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -28
- data/lib/tinkerforge/bricklet_io16.rb +57 -32
- data/lib/tinkerforge/bricklet_io16_v2.rb +93 -48
- data/lib/tinkerforge/bricklet_io4.rb +56 -31
- data/lib/tinkerforge/bricklet_io4_v2.rb +109 -57
- data/lib/tinkerforge/bricklet_isolator.rb +111 -35
- data/lib/tinkerforge/bricklet_joystick.rb +63 -42
- data/lib/tinkerforge/bricklet_joystick_v2.rb +71 -35
- data/lib/tinkerforge/bricklet_laser_range_finder.rb +87 -59
- data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +101 -53
- data/lib/tinkerforge/bricklet_lcd_128x64.rb +241 -131
- data/lib/tinkerforge/bricklet_lcd_16x2.rb +49 -25
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +59 -29
- data/lib/tinkerforge/bricklet_led_strip.rb +69 -47
- data/lib/tinkerforge/bricklet_led_strip_v2.rb +105 -48
- data/lib/tinkerforge/bricklet_line.rb +35 -22
- data/lib/tinkerforge/bricklet_linear_poti.rb +53 -35
- data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -24
- data/lib/tinkerforge/bricklet_load_cell.rb +64 -40
- data/lib/tinkerforge/bricklet_load_cell_v2.rb +81 -41
- data/lib/tinkerforge/bricklet_moisture.rb +43 -30
- data/lib/tinkerforge/bricklet_motion_detector.rb +21 -10
- data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -29
- data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -32
- data/lib/tinkerforge/bricklet_multi_touch.rb +30 -17
- data/lib/tinkerforge/bricklet_multi_touch_v2.rb +371 -0
- data/lib/tinkerforge/bricklet_nfc.rb +130 -80
- data/lib/tinkerforge/bricklet_nfc_rfid.rb +32 -13
- data/lib/tinkerforge/bricklet_oled_128x64.rb +30 -17
- data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +97 -40
- data/lib/tinkerforge/bricklet_oled_64x48.rb +30 -17
- data/lib/tinkerforge/bricklet_one_wire.rb +65 -24
- data/lib/tinkerforge/bricklet_outdoor_weather.rb +84 -41
- data/lib/tinkerforge/bricklet_particulate_matter.rb +85 -37
- data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -13
- data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -19
- data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +84 -57
- data/lib/tinkerforge/bricklet_ptc.rb +76 -51
- data/lib/tinkerforge/bricklet_ptc_v2.rb +96 -54
- data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -36
- data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -47
- data/lib/tinkerforge/bricklet_remote_switch.rb +38 -29
- data/lib/tinkerforge/bricklet_remote_switch_v2.rb +86 -49
- data/lib/tinkerforge/bricklet_rgb_led.rb +17 -8
- data/lib/tinkerforge/bricklet_rgb_led_button.rb +61 -30
- data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +78 -33
- data/lib/tinkerforge/bricklet_rgb_led_v2.rb +51 -20
- data/lib/tinkerforge/bricklet_rotary_encoder.rb +40 -25
- data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -27
- data/lib/tinkerforge/bricklet_rotary_poti.rb +55 -37
- data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +290 -0
- data/lib/tinkerforge/bricklet_rs232.rb +89 -28
- data/lib/tinkerforge/bricklet_rs232_v2.rb +121 -47
- data/lib/tinkerforge/bricklet_rs485.rb +303 -207
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
- data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -36
- data/lib/tinkerforge/bricklet_solid_state_relay.rb +24 -13
- data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +58 -25
- data/lib/tinkerforge/bricklet_sound_intensity.rb +36 -24
- data/lib/tinkerforge/bricklet_sound_pressure_level.rb +77 -41
- data/lib/tinkerforge/bricklet_temperature.rb +43 -28
- data/lib/tinkerforge/bricklet_temperature_ir.rb +63 -47
- data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +75 -53
- data/lib/tinkerforge/bricklet_temperature_v2.rb +62 -31
- data/lib/tinkerforge/bricklet_thermal_imaging.rb +118 -68
- data/lib/tinkerforge/bricklet_thermocouple.rb +46 -30
- data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -30
- data/lib/tinkerforge/bricklet_tilt.rb +23 -10
- data/lib/tinkerforge/bricklet_uv_light.rb +37 -24
- data/lib/tinkerforge/bricklet_uv_light_v2.rb +87 -46
- data/lib/tinkerforge/bricklet_voltage.rb +54 -37
- data/lib/tinkerforge/bricklet_voltage_current.rb +94 -85
- data/lib/tinkerforge/bricklet_voltage_current_v2.rb +103 -77
- data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +410 -0
- data/lib/tinkerforge/device_display_names.rb +165 -0
- data/lib/tinkerforge/ip_connection.rb +155 -33
- data/lib/tinkerforge/version.rb +1 -1
- metadata +14 -4
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
# -*- ruby encoding: utf-8 -*-
|
|
2
|
+
#############################################################
|
|
3
|
+
# This file was automatically generated on 2020-11-02. #
|
|
4
|
+
# #
|
|
5
|
+
# Ruby Bindings Version 2.1.27 #
|
|
6
|
+
# #
|
|
7
|
+
# If you have a bugfix for this file and want to commit it, #
|
|
8
|
+
# please fix the bug in the generator. You can find a link #
|
|
9
|
+
# to the generators git repository on tinkerforge.com #
|
|
10
|
+
#############################################################
|
|
11
|
+
|
|
12
|
+
require_relative './ip_connection'
|
|
13
|
+
|
|
14
|
+
module Tinkerforge
|
|
15
|
+
# Measures Voltage, Current, Energy, Real/Apparent/Reactive Power, Power Factor and Frequency
|
|
16
|
+
class BrickletEnergyMonitor < Device
|
|
17
|
+
DEVICE_IDENTIFIER = 2152 # :nodoc:
|
|
18
|
+
DEVICE_DISPLAY_NAME = 'Energy Monitor Bricklet' # :nodoc:
|
|
19
|
+
|
|
20
|
+
# This callback is triggered periodically according to the configuration set by
|
|
21
|
+
# BrickletEnergyMonitor#set_energy_data_callback_configuration.
|
|
22
|
+
#
|
|
23
|
+
# The parameters are the same as BrickletEnergyMonitor#get_energy_data.
|
|
24
|
+
CALLBACK_ENERGY_DATA = 10
|
|
25
|
+
|
|
26
|
+
FUNCTION_GET_ENERGY_DATA = 1 # :nodoc:
|
|
27
|
+
FUNCTION_RESET_ENERGY = 2 # :nodoc:
|
|
28
|
+
FUNCTION_GET_WAVEFORM_LOW_LEVEL = 3 # :nodoc:
|
|
29
|
+
FUNCTION_GET_TRANSFORMER_STATUS = 4 # :nodoc:
|
|
30
|
+
FUNCTION_SET_TRANSFORMER_CALIBRATION = 5 # :nodoc:
|
|
31
|
+
FUNCTION_GET_TRANSFORMER_CALIBRATION = 6 # :nodoc:
|
|
32
|
+
FUNCTION_CALIBRATE_OFFSET = 7 # :nodoc:
|
|
33
|
+
FUNCTION_SET_ENERGY_DATA_CALLBACK_CONFIGURATION = 8 # :nodoc:
|
|
34
|
+
FUNCTION_GET_ENERGY_DATA_CALLBACK_CONFIGURATION = 9 # :nodoc:
|
|
35
|
+
FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
|
|
36
|
+
FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
|
|
37
|
+
FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
|
|
38
|
+
FUNCTION_SET_WRITE_FIRMWARE_POINTER = 237 # :nodoc:
|
|
39
|
+
FUNCTION_WRITE_FIRMWARE = 238 # :nodoc:
|
|
40
|
+
FUNCTION_SET_STATUS_LED_CONFIG = 239 # :nodoc:
|
|
41
|
+
FUNCTION_GET_STATUS_LED_CONFIG = 240 # :nodoc:
|
|
42
|
+
FUNCTION_GET_CHIP_TEMPERATURE = 242 # :nodoc:
|
|
43
|
+
FUNCTION_RESET = 243 # :nodoc:
|
|
44
|
+
FUNCTION_WRITE_UID = 248 # :nodoc:
|
|
45
|
+
FUNCTION_READ_UID = 249 # :nodoc:
|
|
46
|
+
FUNCTION_GET_IDENTITY = 255 # :nodoc:
|
|
47
|
+
|
|
48
|
+
BOOTLOADER_MODE_BOOTLOADER = 0 # :nodoc:
|
|
49
|
+
BOOTLOADER_MODE_FIRMWARE = 1 # :nodoc:
|
|
50
|
+
BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT = 2 # :nodoc:
|
|
51
|
+
BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT = 3 # :nodoc:
|
|
52
|
+
BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT = 4 # :nodoc:
|
|
53
|
+
BOOTLOADER_STATUS_OK = 0 # :nodoc:
|
|
54
|
+
BOOTLOADER_STATUS_INVALID_MODE = 1 # :nodoc:
|
|
55
|
+
BOOTLOADER_STATUS_NO_CHANGE = 2 # :nodoc:
|
|
56
|
+
BOOTLOADER_STATUS_ENTRY_FUNCTION_NOT_PRESENT = 3 # :nodoc:
|
|
57
|
+
BOOTLOADER_STATUS_DEVICE_IDENTIFIER_INCORRECT = 4 # :nodoc:
|
|
58
|
+
BOOTLOADER_STATUS_CRC_MISMATCH = 5 # :nodoc:
|
|
59
|
+
STATUS_LED_CONFIG_OFF = 0 # :nodoc:
|
|
60
|
+
STATUS_LED_CONFIG_ON = 1 # :nodoc:
|
|
61
|
+
STATUS_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
|
|
62
|
+
STATUS_LED_CONFIG_SHOW_STATUS = 3 # :nodoc:
|
|
63
|
+
|
|
64
|
+
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
65
|
+
# the IP Connection <tt>ipcon</tt>.
|
|
66
|
+
def initialize(uid, ipcon)
|
|
67
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
68
|
+
|
|
69
|
+
@api_version = [2, 0, 0]
|
|
70
|
+
|
|
71
|
+
@response_expected[FUNCTION_GET_ENERGY_DATA] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
72
|
+
@response_expected[FUNCTION_RESET_ENERGY] = RESPONSE_EXPECTED_FALSE
|
|
73
|
+
@response_expected[FUNCTION_GET_WAVEFORM_LOW_LEVEL] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
74
|
+
@response_expected[FUNCTION_GET_TRANSFORMER_STATUS] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
75
|
+
@response_expected[FUNCTION_SET_TRANSFORMER_CALIBRATION] = RESPONSE_EXPECTED_FALSE
|
|
76
|
+
@response_expected[FUNCTION_GET_TRANSFORMER_CALIBRATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
77
|
+
@response_expected[FUNCTION_CALIBRATE_OFFSET] = RESPONSE_EXPECTED_FALSE
|
|
78
|
+
@response_expected[FUNCTION_SET_ENERGY_DATA_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
|
|
79
|
+
@response_expected[FUNCTION_GET_ENERGY_DATA_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
80
|
+
@response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
81
|
+
@response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
82
|
+
@response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
83
|
+
@response_expected[FUNCTION_SET_WRITE_FIRMWARE_POINTER] = RESPONSE_EXPECTED_FALSE
|
|
84
|
+
@response_expected[FUNCTION_WRITE_FIRMWARE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
85
|
+
@response_expected[FUNCTION_SET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
|
|
86
|
+
@response_expected[FUNCTION_GET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
87
|
+
@response_expected[FUNCTION_GET_CHIP_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
88
|
+
@response_expected[FUNCTION_RESET] = RESPONSE_EXPECTED_FALSE
|
|
89
|
+
@response_expected[FUNCTION_WRITE_UID] = RESPONSE_EXPECTED_FALSE
|
|
90
|
+
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
91
|
+
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
92
|
+
|
|
93
|
+
@callback_formats[CALLBACK_ENERGY_DATA] = [36, 'l l l l l l S S']
|
|
94
|
+
|
|
95
|
+
@ipcon.add_device self
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Returns all of the measurements that are done by the Energy Monitor Bricklet.
|
|
99
|
+
#
|
|
100
|
+
# * Voltage RMS
|
|
101
|
+
# * Current RMS
|
|
102
|
+
# * Energy (integrated over time)
|
|
103
|
+
# * Real Power
|
|
104
|
+
# * Apparent Power
|
|
105
|
+
# * Reactive Power
|
|
106
|
+
# * Power Factor
|
|
107
|
+
# * Frequency (AC Frequency of the mains voltage)
|
|
108
|
+
#
|
|
109
|
+
# The frequency is recalculated every 6 seconds.
|
|
110
|
+
#
|
|
111
|
+
# All other values are integrated over 10 zero-crossings of the voltage sine wave.
|
|
112
|
+
# With a standard AC mains voltage frequency of 50Hz this results in a 5 measurements
|
|
113
|
+
# per second (or an integration time of 200ms per measurement).
|
|
114
|
+
#
|
|
115
|
+
# If no voltage transformer is connected, the Bricklet will use the current waveform
|
|
116
|
+
# to calculate the frequency and it will use an integration time of
|
|
117
|
+
# 10 zero-crossings of the current waveform.
|
|
118
|
+
def get_energy_data
|
|
119
|
+
check_validity
|
|
120
|
+
|
|
121
|
+
send_request FUNCTION_GET_ENERGY_DATA, [], '', 36, 'l l l l l l S S'
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
# Sets the energy value (see BrickletEnergyMonitor#get_energy_data) back to 0Wh.
|
|
125
|
+
def reset_energy
|
|
126
|
+
check_validity
|
|
127
|
+
|
|
128
|
+
send_request FUNCTION_RESET_ENERGY, [], '', 8, ''
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# Returns a snapshot of the voltage and current waveform. The values
|
|
132
|
+
# in the returned array alternate between voltage and current. The data from
|
|
133
|
+
# one getter call contains 768 data points for voltage and current, which
|
|
134
|
+
# correspond to about 3 full sine waves.
|
|
135
|
+
#
|
|
136
|
+
# The voltage is given with a resolution of 100mV and the current is given
|
|
137
|
+
# with a resolution of 10mA.
|
|
138
|
+
#
|
|
139
|
+
# This data is meant to be used for a non-realtime graphical representation of
|
|
140
|
+
# the voltage and current waveforms.
|
|
141
|
+
def get_waveform_low_level
|
|
142
|
+
check_validity
|
|
143
|
+
|
|
144
|
+
send_request FUNCTION_GET_WAVEFORM_LOW_LEVEL, [], '', 70, 'S s30'
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
# Returns *true* if a voltage/current transformer is connected to the Bricklet.
|
|
148
|
+
def get_transformer_status
|
|
149
|
+
check_validity
|
|
150
|
+
|
|
151
|
+
send_request FUNCTION_GET_TRANSFORMER_STATUS, [], '', 10, '? ?'
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
# Sets the transformer ratio for the voltage and current transformer in 1/100 form.
|
|
155
|
+
#
|
|
156
|
+
# Example: If your mains voltage is 230V, you use 9V voltage transformer and a
|
|
157
|
+
# 1V:30A current clamp your voltage ratio is 230/9 = 25.56 and your current ratio
|
|
158
|
+
# is 30/1 = 30.
|
|
159
|
+
#
|
|
160
|
+
# In this case you have to set the values 2556 and 3000 for voltage ratio and current
|
|
161
|
+
# ratio.
|
|
162
|
+
#
|
|
163
|
+
# The calibration is saved in non-volatile memory, you only have to set it once.
|
|
164
|
+
#
|
|
165
|
+
# Set the phase shift to 0. It is for future use and currently not supported by the Bricklet.
|
|
166
|
+
def set_transformer_calibration(voltage_ratio, current_ratio, phase_shift)
|
|
167
|
+
check_validity
|
|
168
|
+
|
|
169
|
+
send_request FUNCTION_SET_TRANSFORMER_CALIBRATION, [voltage_ratio, current_ratio, phase_shift], 'S S s', 8, ''
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# Returns the transformer calibration as set by BrickletEnergyMonitor#set_transformer_calibration.
|
|
173
|
+
def get_transformer_calibration
|
|
174
|
+
check_validity
|
|
175
|
+
|
|
176
|
+
send_request FUNCTION_GET_TRANSFORMER_CALIBRATION, [], '', 14, 'S S s'
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
# Calling this function will start an offset calibration. The offset calibration will
|
|
180
|
+
# integrate the voltage and current waveform over a longer time period to find the 0
|
|
181
|
+
# transition point in the sine wave.
|
|
182
|
+
#
|
|
183
|
+
# The Bricklet comes with a factory-calibrated offset value, you should not have to
|
|
184
|
+
# call this function.
|
|
185
|
+
#
|
|
186
|
+
# If you want to re-calibrate the offset we recommend that you connect a load that
|
|
187
|
+
# has a smooth sinusoidal voltage and current waveform. Alternatively you can also
|
|
188
|
+
# short both inputs.
|
|
189
|
+
#
|
|
190
|
+
# The calibration is saved in non-volatile memory, you only have to set it once.
|
|
191
|
+
def calibrate_offset
|
|
192
|
+
check_validity
|
|
193
|
+
|
|
194
|
+
send_request FUNCTION_CALIBRATE_OFFSET, [], '', 8, ''
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
# The period is the period with which the CALLBACK_ENERGY_DATA
|
|
198
|
+
# callback is triggered periodically. A value of 0 turns the callback off.
|
|
199
|
+
#
|
|
200
|
+
# If the `value has to change`-parameter is set to true, the callback is only
|
|
201
|
+
# triggered after the value has changed. If the value didn't change within the
|
|
202
|
+
# period, the callback is triggered immediately on change.
|
|
203
|
+
#
|
|
204
|
+
# If it is set to false, the callback is continuously triggered with the period,
|
|
205
|
+
# independent of the value.
|
|
206
|
+
def set_energy_data_callback_configuration(period, value_has_to_change)
|
|
207
|
+
check_validity
|
|
208
|
+
|
|
209
|
+
send_request FUNCTION_SET_ENERGY_DATA_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
# Returns the callback configuration as set by
|
|
213
|
+
# BrickletEnergyMonitor#set_energy_data_callback_configuration.
|
|
214
|
+
def get_energy_data_callback_configuration
|
|
215
|
+
check_validity
|
|
216
|
+
|
|
217
|
+
send_request FUNCTION_GET_ENERGY_DATA_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
# Returns the error count for the communication between Brick and Bricklet.
|
|
221
|
+
#
|
|
222
|
+
# The errors are divided into
|
|
223
|
+
#
|
|
224
|
+
# * ACK checksum errors,
|
|
225
|
+
# * message checksum errors,
|
|
226
|
+
# * framing errors and
|
|
227
|
+
# * overflow errors.
|
|
228
|
+
#
|
|
229
|
+
# The errors counts are for errors that occur on the Bricklet side. All
|
|
230
|
+
# Bricks have a similar function that returns the errors on the Brick side.
|
|
231
|
+
def get_spitfp_error_count
|
|
232
|
+
check_validity
|
|
233
|
+
|
|
234
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
# Sets the bootloader mode and returns the status after the requested
|
|
238
|
+
# mode change was instigated.
|
|
239
|
+
#
|
|
240
|
+
# You can change from bootloader mode to firmware mode and vice versa. A change
|
|
241
|
+
# from bootloader mode to firmware mode will only take place if the entry function,
|
|
242
|
+
# device identifier and CRC are present and correct.
|
|
243
|
+
#
|
|
244
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
|
245
|
+
# necessary to call it in a normal user program.
|
|
246
|
+
def set_bootloader_mode(mode)
|
|
247
|
+
check_validity
|
|
248
|
+
|
|
249
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
# Returns the current bootloader mode, see BrickletEnergyMonitor#set_bootloader_mode.
|
|
253
|
+
def get_bootloader_mode
|
|
254
|
+
check_validity
|
|
255
|
+
|
|
256
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
# Sets the firmware pointer for BrickletEnergyMonitor#write_firmware. The pointer has
|
|
260
|
+
# to be increased by chunks of size 64. The data is written to flash
|
|
261
|
+
# every 4 chunks (which equals to one page of size 256).
|
|
262
|
+
#
|
|
263
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
|
264
|
+
# necessary to call it in a normal user program.
|
|
265
|
+
def set_write_firmware_pointer(pointer)
|
|
266
|
+
check_validity
|
|
267
|
+
|
|
268
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
# Writes 64 Bytes of firmware at the position as written by
|
|
272
|
+
# BrickletEnergyMonitor#set_write_firmware_pointer before. The firmware is written
|
|
273
|
+
# to flash every 4 chunks.
|
|
274
|
+
#
|
|
275
|
+
# You can only write firmware in bootloader mode.
|
|
276
|
+
#
|
|
277
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
|
278
|
+
# necessary to call it in a normal user program.
|
|
279
|
+
def write_firmware(data)
|
|
280
|
+
check_validity
|
|
281
|
+
|
|
282
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
# Sets the status LED configuration. By default the LED shows
|
|
286
|
+
# communication traffic between Brick and Bricklet, it flickers once
|
|
287
|
+
# for every 10 received data packets.
|
|
288
|
+
#
|
|
289
|
+
# You can also turn the LED permanently on/off or show a heartbeat.
|
|
290
|
+
#
|
|
291
|
+
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
|
292
|
+
def set_status_led_config(config)
|
|
293
|
+
check_validity
|
|
294
|
+
|
|
295
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
|
296
|
+
end
|
|
297
|
+
|
|
298
|
+
# Returns the configuration as set by BrickletEnergyMonitor#set_status_led_config
|
|
299
|
+
def get_status_led_config
|
|
300
|
+
check_validity
|
|
301
|
+
|
|
302
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
# Returns the temperature as measured inside the microcontroller. The
|
|
306
|
+
# value returned is not the ambient temperature!
|
|
307
|
+
#
|
|
308
|
+
# The temperature is only proportional to the real temperature and it has bad
|
|
309
|
+
# accuracy. Practically it is only useful as an indicator for
|
|
310
|
+
# temperature changes.
|
|
311
|
+
def get_chip_temperature
|
|
312
|
+
check_validity
|
|
313
|
+
|
|
314
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
# Calling this function will reset the Bricklet. All configurations
|
|
318
|
+
# will be lost.
|
|
319
|
+
#
|
|
320
|
+
# After a reset you have to create new device objects,
|
|
321
|
+
# calling functions on the existing ones will result in
|
|
322
|
+
# undefined behavior!
|
|
323
|
+
def reset
|
|
324
|
+
check_validity
|
|
325
|
+
|
|
326
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
|
327
|
+
end
|
|
328
|
+
|
|
329
|
+
# Writes a new UID into flash. If you want to set a new UID
|
|
330
|
+
# you have to decode the Base58 encoded UID string into an
|
|
331
|
+
# integer first.
|
|
332
|
+
#
|
|
333
|
+
# We recommend that you use Brick Viewer to change the UID.
|
|
334
|
+
def write_uid(uid)
|
|
335
|
+
check_validity
|
|
336
|
+
|
|
337
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
|
338
|
+
end
|
|
339
|
+
|
|
340
|
+
# Returns the current UID as an integer. Encode as
|
|
341
|
+
# Base58 to get the usual string version.
|
|
342
|
+
def read_uid
|
|
343
|
+
check_validity
|
|
344
|
+
|
|
345
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
|
346
|
+
end
|
|
347
|
+
|
|
348
|
+
# Returns the UID, the UID where the Bricklet is connected to,
|
|
349
|
+
# the position, the hardware and firmware version as well as the
|
|
350
|
+
# device identifier.
|
|
351
|
+
#
|
|
352
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
353
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
354
|
+
# position 'z'.
|
|
355
|
+
#
|
|
356
|
+
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
357
|
+
# |device_identifier_constant|
|
|
358
|
+
def get_identity
|
|
359
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
360
|
+
end
|
|
361
|
+
|
|
362
|
+
# Returns a snapshot of the voltage and current waveform. The values
|
|
363
|
+
# in the returned array alternate between voltage and current. The data from
|
|
364
|
+
# one getter call contains 768 data points for voltage and current, which
|
|
365
|
+
# correspond to about 3 full sine waves.
|
|
366
|
+
#
|
|
367
|
+
# The voltage is given with a resolution of 100mV and the current is given
|
|
368
|
+
# with a resolution of 10mA.
|
|
369
|
+
#
|
|
370
|
+
# This data is meant to be used for a non-realtime graphical representation of
|
|
371
|
+
# the voltage and current waveforms.
|
|
372
|
+
def get_waveform
|
|
373
|
+
waveform_length = 1536
|
|
374
|
+
waveform_data = nil # assigned in block
|
|
375
|
+
|
|
376
|
+
@stream_mutex.synchronize {
|
|
377
|
+
ret = get_waveform_low_level
|
|
378
|
+
waveform_chunk_offset = ret[0]
|
|
379
|
+
|
|
380
|
+
if waveform_chunk_offset == (1 << 16) - 1 # maximum chunk offset -> stream has no data
|
|
381
|
+
waveform_length = 0
|
|
382
|
+
waveform_chunk_offset = 0
|
|
383
|
+
waveform_out_of_sync = false
|
|
384
|
+
waveform_data = []
|
|
385
|
+
else
|
|
386
|
+
waveform_out_of_sync = waveform_chunk_offset != 0
|
|
387
|
+
waveform_data = ret[1]
|
|
388
|
+
end
|
|
389
|
+
|
|
390
|
+
while not waveform_out_of_sync and waveform_data.length < waveform_length
|
|
391
|
+
ret = get_waveform_low_level
|
|
392
|
+
waveform_chunk_offset = ret[0]
|
|
393
|
+
waveform_out_of_sync = waveform_chunk_offset != waveform_data.length
|
|
394
|
+
waveform_data += ret[1]
|
|
395
|
+
end
|
|
396
|
+
|
|
397
|
+
if waveform_out_of_sync # discard remaining stream to bring it back in-sync
|
|
398
|
+
while waveform_chunk_offset + 30 < waveform_length
|
|
399
|
+
ret = get_waveform_low_level
|
|
400
|
+
waveform_chunk_offset = ret[0]
|
|
401
|
+
end
|
|
402
|
+
|
|
403
|
+
raise StreamOutOfSyncException, 'Waveform stream is out-of-sync'
|
|
404
|
+
end
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
waveform_data[0, waveform_length]
|
|
408
|
+
end
|
|
409
|
+
|
|
410
|
+
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|
|
411
|
+
def register_callback(id, &block)
|
|
412
|
+
callback = block
|
|
413
|
+
@registered_callbacks[id] = callback
|
|
414
|
+
end
|
|
415
|
+
end
|
|
416
|
+
end
|
|
@@ -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-11-02. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
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
|
# Determine position, velocity and altitude using GPS
|
|
14
16
|
class BrickletGPS < Device
|
|
@@ -87,7 +89,7 @@ module Tinkerforge
|
|
|
87
89
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
88
90
|
# the IP Connection <tt>ipcon</tt>.
|
|
89
91
|
def initialize(uid, ipcon)
|
|
90
|
-
super uid, ipcon
|
|
92
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
91
93
|
|
|
92
94
|
@api_version = [2, 0, 1]
|
|
93
95
|
|
|
@@ -109,12 +111,13 @@ module Tinkerforge
|
|
|
109
111
|
@response_expected[FUNCTION_GET_DATE_TIME_CALLBACK_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
110
112
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
111
113
|
|
|
112
|
-
@callback_formats[CALLBACK_COORDINATES] = 'L k L k S S S S'
|
|
113
|
-
@callback_formats[CALLBACK_STATUS] = 'C C C'
|
|
114
|
-
@callback_formats[CALLBACK_ALTITUDE] = 'l l'
|
|
115
|
-
@callback_formats[CALLBACK_MOTION] = 'L L'
|
|
116
|
-
@callback_formats[CALLBACK_DATE_TIME] = 'L L'
|
|
114
|
+
@callback_formats[CALLBACK_COORDINATES] = [26, 'L k L k S S S S']
|
|
115
|
+
@callback_formats[CALLBACK_STATUS] = [11, 'C C C']
|
|
116
|
+
@callback_formats[CALLBACK_ALTITUDE] = [16, 'l l']
|
|
117
|
+
@callback_formats[CALLBACK_MOTION] = [16, 'L L']
|
|
118
|
+
@callback_formats[CALLBACK_DATE_TIME] = [16, 'L L']
|
|
117
119
|
|
|
120
|
+
@ipcon.add_device self
|
|
118
121
|
end
|
|
119
122
|
|
|
120
123
|
# Returns the GPS coordinates. Latitude and longitude are given in the
|
|
@@ -127,16 +130,18 @@ module Tinkerforge
|
|
|
127
130
|
# the additional multiplicative effect of GPS satellite geometry on GPS
|
|
128
131
|
# precision. See
|
|
129
132
|
# `here <https://en.wikipedia.org/wiki/Dilution_of_precision_(GPS)>`__
|
|
130
|
-
# for more information.
|
|
133
|
+
# for more information.
|
|
131
134
|
#
|
|
132
|
-
# EPE is the "Estimated Position Error".
|
|
135
|
+
# EPE is the "Estimated Position Error". This is not the
|
|
133
136
|
# absolute maximum error, it is the error with a specific confidence. See
|
|
134
137
|
# `here <https://www.nps.gov/gis/gps/WhatisEPE.html>`__ for more information.
|
|
135
138
|
#
|
|
136
139
|
# This data is only valid if there is currently a fix as indicated by
|
|
137
140
|
# BrickletGPS#get_status.
|
|
138
141
|
def get_coordinates
|
|
139
|
-
|
|
142
|
+
check_validity
|
|
143
|
+
|
|
144
|
+
send_request FUNCTION_GET_COORDINATES, [], '', 26, 'L k L k S S S S'
|
|
140
145
|
end
|
|
141
146
|
|
|
142
147
|
# Returns the current fix status, the number of satellites that are in view and
|
|
@@ -153,21 +158,22 @@ module Tinkerforge
|
|
|
153
158
|
# There is also a :ref:`blue LED <gps_bricklet_fix_led>` on the Bricklet that
|
|
154
159
|
# indicates the fix status.
|
|
155
160
|
def get_status
|
|
156
|
-
|
|
161
|
+
check_validity
|
|
162
|
+
|
|
163
|
+
send_request FUNCTION_GET_STATUS, [], '', 11, 'C C C'
|
|
157
164
|
end
|
|
158
165
|
|
|
159
166
|
# Returns the current altitude and corresponding geoidal separation.
|
|
160
167
|
#
|
|
161
|
-
# Both values are given in cm.
|
|
162
|
-
#
|
|
163
168
|
# This data is only valid if there is currently a fix as indicated by
|
|
164
169
|
# BrickletGPS#get_status.
|
|
165
170
|
def get_altitude
|
|
166
|
-
|
|
171
|
+
check_validity
|
|
172
|
+
|
|
173
|
+
send_request FUNCTION_GET_ALTITUDE, [], '', 16, 'l l'
|
|
167
174
|
end
|
|
168
175
|
|
|
169
|
-
# Returns the current course and speed.
|
|
170
|
-
# and speed is given in hundredths km/h. A course of 0° means the Bricklet is
|
|
176
|
+
# Returns the current course and speed. A course of 0° means the Bricklet is
|
|
171
177
|
# traveling north bound and 90° means it is traveling east bound.
|
|
172
178
|
#
|
|
173
179
|
# Please note that this only returns useful values if an actual movement
|
|
@@ -176,15 +182,19 @@ module Tinkerforge
|
|
|
176
182
|
# This data is only valid if there is currently a fix as indicated by
|
|
177
183
|
# BrickletGPS#get_status.
|
|
178
184
|
def get_motion
|
|
179
|
-
|
|
185
|
+
check_validity
|
|
186
|
+
|
|
187
|
+
send_request FUNCTION_GET_MOTION, [], '', 16, 'L L'
|
|
180
188
|
end
|
|
181
189
|
|
|
182
190
|
# Returns the current date and time. The date is
|
|
183
191
|
# given in the format ``ddmmyy`` and the time is given
|
|
184
192
|
# in the format ``hhmmss.sss``. For example, 140713 means
|
|
185
|
-
# 14.
|
|
193
|
+
# 14.07.13 as date and 195923568 means 19:59:23.568 as time.
|
|
186
194
|
def get_date_time
|
|
187
|
-
|
|
195
|
+
check_validity
|
|
196
|
+
|
|
197
|
+
send_request FUNCTION_GET_DATE_TIME, [], '', 16, 'L L'
|
|
188
198
|
end
|
|
189
199
|
|
|
190
200
|
# Restarts the GPS Bricklet, the following restart types are available:
|
|
@@ -196,99 +206,113 @@ module Tinkerforge
|
|
|
196
206
|
# "2", "Cold start (don't use time, position, almanacs and ephemeris at restart)"
|
|
197
207
|
# "3", "Factory reset (clear all system/user configurations at restart)"
|
|
198
208
|
def restart(restart_type)
|
|
199
|
-
|
|
209
|
+
check_validity
|
|
210
|
+
|
|
211
|
+
send_request FUNCTION_RESTART, [restart_type], 'C', 8, ''
|
|
200
212
|
end
|
|
201
213
|
|
|
202
|
-
# Sets the period
|
|
214
|
+
# Sets the period with which the CALLBACK_COORDINATES callback is triggered
|
|
203
215
|
# periodically. A value of 0 turns the callback off.
|
|
204
216
|
#
|
|
205
217
|
# The CALLBACK_COORDINATES callback is only triggered if the coordinates changed
|
|
206
218
|
# since the last triggering.
|
|
207
|
-
#
|
|
208
|
-
# The default value is 0.
|
|
209
219
|
def set_coordinates_callback_period(period)
|
|
210
|
-
|
|
220
|
+
check_validity
|
|
221
|
+
|
|
222
|
+
send_request FUNCTION_SET_COORDINATES_CALLBACK_PERIOD, [period], 'L', 8, ''
|
|
211
223
|
end
|
|
212
224
|
|
|
213
225
|
# Returns the period as set by BrickletGPS#set_coordinates_callback_period.
|
|
214
226
|
def get_coordinates_callback_period
|
|
215
|
-
|
|
227
|
+
check_validity
|
|
228
|
+
|
|
229
|
+
send_request FUNCTION_GET_COORDINATES_CALLBACK_PERIOD, [], '', 12, 'L'
|
|
216
230
|
end
|
|
217
231
|
|
|
218
|
-
# Sets the period
|
|
232
|
+
# Sets the period with which the CALLBACK_STATUS callback is triggered
|
|
219
233
|
# periodically. A value of 0 turns the callback off.
|
|
220
234
|
#
|
|
221
235
|
# The CALLBACK_STATUS callback is only triggered if the status changed since the
|
|
222
236
|
# last triggering.
|
|
223
|
-
#
|
|
224
|
-
# The default value is 0.
|
|
225
237
|
def set_status_callback_period(period)
|
|
226
|
-
|
|
238
|
+
check_validity
|
|
239
|
+
|
|
240
|
+
send_request FUNCTION_SET_STATUS_CALLBACK_PERIOD, [period], 'L', 8, ''
|
|
227
241
|
end
|
|
228
242
|
|
|
229
243
|
# Returns the period as set by BrickletGPS#set_status_callback_period.
|
|
230
244
|
def get_status_callback_period
|
|
231
|
-
|
|
245
|
+
check_validity
|
|
246
|
+
|
|
247
|
+
send_request FUNCTION_GET_STATUS_CALLBACK_PERIOD, [], '', 12, 'L'
|
|
232
248
|
end
|
|
233
249
|
|
|
234
|
-
# Sets the period
|
|
250
|
+
# Sets the period with which the CALLBACK_ALTITUDE callback is triggered
|
|
235
251
|
# periodically. A value of 0 turns the callback off.
|
|
236
252
|
#
|
|
237
253
|
# The CALLBACK_ALTITUDE callback is only triggered if the altitude changed since
|
|
238
254
|
# the last triggering.
|
|
239
|
-
#
|
|
240
|
-
# The default value is 0.
|
|
241
255
|
def set_altitude_callback_period(period)
|
|
242
|
-
|
|
256
|
+
check_validity
|
|
257
|
+
|
|
258
|
+
send_request FUNCTION_SET_ALTITUDE_CALLBACK_PERIOD, [period], 'L', 8, ''
|
|
243
259
|
end
|
|
244
260
|
|
|
245
261
|
# Returns the period as set by BrickletGPS#set_altitude_callback_period.
|
|
246
262
|
def get_altitude_callback_period
|
|
247
|
-
|
|
263
|
+
check_validity
|
|
264
|
+
|
|
265
|
+
send_request FUNCTION_GET_ALTITUDE_CALLBACK_PERIOD, [], '', 12, 'L'
|
|
248
266
|
end
|
|
249
267
|
|
|
250
|
-
# Sets the period
|
|
268
|
+
# Sets the period with which the CALLBACK_MOTION callback is triggered
|
|
251
269
|
# periodically. A value of 0 turns the callback off.
|
|
252
270
|
#
|
|
253
271
|
# The CALLBACK_MOTION callback is only triggered if the motion changed since the
|
|
254
272
|
# last triggering.
|
|
255
|
-
#
|
|
256
|
-
# The default value is 0.
|
|
257
273
|
def set_motion_callback_period(period)
|
|
258
|
-
|
|
274
|
+
check_validity
|
|
275
|
+
|
|
276
|
+
send_request FUNCTION_SET_MOTION_CALLBACK_PERIOD, [period], 'L', 8, ''
|
|
259
277
|
end
|
|
260
278
|
|
|
261
279
|
# Returns the period as set by BrickletGPS#set_motion_callback_period.
|
|
262
280
|
def get_motion_callback_period
|
|
263
|
-
|
|
281
|
+
check_validity
|
|
282
|
+
|
|
283
|
+
send_request FUNCTION_GET_MOTION_CALLBACK_PERIOD, [], '', 12, 'L'
|
|
264
284
|
end
|
|
265
285
|
|
|
266
|
-
# Sets the period
|
|
286
|
+
# Sets the period with which the CALLBACK_DATE_TIME callback is triggered
|
|
267
287
|
# periodically. A value of 0 turns the callback off.
|
|
268
288
|
#
|
|
269
289
|
# The CALLBACK_DATE_TIME callback is only triggered if the date or time changed
|
|
270
290
|
# since the last triggering.
|
|
271
|
-
#
|
|
272
|
-
# The default value is 0.
|
|
273
291
|
def set_date_time_callback_period(period)
|
|
274
|
-
|
|
292
|
+
check_validity
|
|
293
|
+
|
|
294
|
+
send_request FUNCTION_SET_DATE_TIME_CALLBACK_PERIOD, [period], 'L', 8, ''
|
|
275
295
|
end
|
|
276
296
|
|
|
277
297
|
# Returns the period as set by BrickletGPS#set_date_time_callback_period.
|
|
278
298
|
def get_date_time_callback_period
|
|
279
|
-
|
|
299
|
+
check_validity
|
|
300
|
+
|
|
301
|
+
send_request FUNCTION_GET_DATE_TIME_CALLBACK_PERIOD, [], '', 12, 'L'
|
|
280
302
|
end
|
|
281
303
|
|
|
282
304
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
283
305
|
# the position, the hardware and firmware version as well as the
|
|
284
306
|
# device identifier.
|
|
285
307
|
#
|
|
286
|
-
# The position can be 'a', 'b', 'c' or '
|
|
308
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
309
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
310
|
+
# position 'z'.
|
|
287
311
|
#
|
|
288
312
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
289
313
|
# |device_identifier_constant|
|
|
290
314
|
def get_identity
|
|
291
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
315
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
292
316
|
end
|
|
293
317
|
|
|
294
318
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|