tinkerforge 2.1.12 → 2.1.13
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/tinkerforge/brick_dc.rb +2 -2
- data/lib/tinkerforge/brick_imu.rb +2 -2
- data/lib/tinkerforge/brick_imu_v2.rb +2 -2
- data/lib/tinkerforge/brick_master.rb +16 -2
- data/lib/tinkerforge/brick_red.rb +2 -2
- data/lib/tinkerforge/brick_servo.rb +2 -2
- data/lib/tinkerforge/brick_silent_stepper.rb +2 -2
- data/lib/tinkerforge/brick_stepper.rb +2 -2
- data/lib/tinkerforge/bricklet_accelerometer.rb +2 -2
- data/lib/tinkerforge/bricklet_ambient_light.rb +2 -2
- data/lib/tinkerforge/bricklet_ambient_light_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_analog_in.rb +2 -2
- data/lib/tinkerforge/bricklet_analog_in_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_analog_out.rb +2 -2
- data/lib/tinkerforge/bricklet_analog_out_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_barometer.rb +2 -2
- data/lib/tinkerforge/bricklet_can.rb +2 -2
- data/lib/tinkerforge/bricklet_co2.rb +2 -2
- data/lib/tinkerforge/bricklet_color.rb +2 -2
- data/lib/tinkerforge/bricklet_current12.rb +2 -2
- data/lib/tinkerforge/bricklet_current25.rb +2 -2
- data/lib/tinkerforge/bricklet_distance_ir.rb +2 -2
- data/lib/tinkerforge/bricklet_distance_us.rb +2 -2
- data/lib/tinkerforge/bricklet_dual_button.rb +2 -2
- data/lib/tinkerforge/bricklet_dual_relay.rb +2 -2
- data/lib/tinkerforge/bricklet_dust_detector.rb +2 -2
- data/lib/tinkerforge/bricklet_gps.rb +2 -2
- data/lib/tinkerforge/bricklet_gps_v2.rb +507 -0
- data/lib/tinkerforge/bricklet_hall_effect.rb +2 -2
- data/lib/tinkerforge/bricklet_humidity.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_analog_out.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +2 -2
- data/lib/tinkerforge/bricklet_io16.rb +2 -2
- data/lib/tinkerforge/bricklet_io4.rb +2 -2
- data/lib/tinkerforge/bricklet_joystick.rb +2 -2
- data/lib/tinkerforge/bricklet_laser_range_finder.rb +2 -2
- data/lib/tinkerforge/bricklet_lcd_16x2.rb +2 -2
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +2 -2
- data/lib/tinkerforge/bricklet_led_strip.rb +2 -2
- data/lib/tinkerforge/bricklet_line.rb +2 -2
- data/lib/tinkerforge/bricklet_linear_poti.rb +2 -2
- data/lib/tinkerforge/bricklet_load_cell.rb +2 -2
- data/lib/tinkerforge/bricklet_moisture.rb +2 -2
- data/lib/tinkerforge/bricklet_motion_detector.rb +2 -2
- data/lib/tinkerforge/bricklet_multi_touch.rb +2 -2
- data/lib/tinkerforge/bricklet_nfc_rfid.rb +4 -4
- data/lib/tinkerforge/bricklet_oled_128x64.rb +2 -2
- data/lib/tinkerforge/bricklet_oled_64x48.rb +2 -2
- data/lib/tinkerforge/bricklet_piezo_buzzer.rb +2 -2
- data/lib/tinkerforge/bricklet_piezo_speaker.rb +2 -2
- data/lib/tinkerforge/bricklet_ptc.rb +2 -2
- data/lib/tinkerforge/bricklet_real_time_clock.rb +2 -2
- data/lib/tinkerforge/bricklet_remote_switch.rb +2 -2
- data/lib/tinkerforge/bricklet_rgb_led.rb +2 -2
- data/lib/tinkerforge/bricklet_rotary_encoder.rb +2 -2
- data/lib/tinkerforge/bricklet_rotary_poti.rb +2 -2
- data/lib/tinkerforge/bricklet_rs232.rb +2 -2
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +2 -2
- data/lib/tinkerforge/bricklet_solid_state_relay.rb +2 -2
- data/lib/tinkerforge/bricklet_sound_intensity.rb +2 -2
- data/lib/tinkerforge/bricklet_temperature.rb +2 -2
- data/lib/tinkerforge/bricklet_temperature_ir.rb +2 -2
- data/lib/tinkerforge/bricklet_thermocouple.rb +2 -2
- data/lib/tinkerforge/bricklet_tilt.rb +2 -2
- data/lib/tinkerforge/bricklet_uv_light.rb +2 -2
- data/lib/tinkerforge/bricklet_voltage.rb +2 -2
- data/lib/tinkerforge/bricklet_voltage_current.rb +2 -2
- data/lib/tinkerforge/ip_connection.rb +15 -4
- data/lib/tinkerforge/version.rb +1 -1
- metadata +3 -2
data/lib/tinkerforge/brick_dc.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-05-11. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.13 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-05-11. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.13 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-05-11. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.13 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-05-11. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.13 #
|
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 #
|
@@ -726,6 +726,9 @@ module Tinkerforge
|
|
726
726
|
end
|
727
727
|
|
728
728
|
# Returns the encryption as set by BrickMaster#set_wifi_encryption.
|
729
|
+
#
|
730
|
+
# .. note::
|
731
|
+
# Since Master Brick Firmware version 2.4.4 the key is not returned anymore.
|
729
732
|
def get_wifi_encryption
|
730
733
|
send_request(FUNCTION_GET_WIFI_ENCRYPTION, [], '', 59, 'C Z50 C C S S S')
|
731
734
|
end
|
@@ -857,6 +860,9 @@ module Tinkerforge
|
|
857
860
|
|
858
861
|
# Returns the encryption key as set by BrickMaster#set_long_wifi_key.
|
859
862
|
#
|
863
|
+
# .. note::
|
864
|
+
# Since Master Brick firmware version 2.4.4 the key is not returned anymore.
|
865
|
+
#
|
860
866
|
# .. versionadded:: 2.0.2$nbsp;(Firmware)
|
861
867
|
def get_long_wifi_key
|
862
868
|
send_request(FUNCTION_GET_LONG_WIFI_KEY, [], '', 64, 'Z64')
|
@@ -1419,6 +1425,10 @@ module Tinkerforge
|
|
1419
1425
|
|
1420
1426
|
# Returns the client password as set by BrickMaster#set_wifi2_client_password.
|
1421
1427
|
#
|
1428
|
+
# .. note::
|
1429
|
+
# Since WIFI Extension 2.0 firmware version 2.1.3 the password is not
|
1430
|
+
# returned anymore.
|
1431
|
+
#
|
1422
1432
|
# .. versionadded:: 2.4.0$nbsp;(Firmware)
|
1423
1433
|
def get_wifi2_client_password
|
1424
1434
|
send_request(FUNCTION_GET_WIFI2_CLIENT_PASSWORD, [], '', 64, 'Z64')
|
@@ -1485,6 +1495,10 @@ module Tinkerforge
|
|
1485
1495
|
|
1486
1496
|
# Returns the access point password as set by BrickMaster#set_wifi2_ap_password.
|
1487
1497
|
#
|
1498
|
+
# .. note::
|
1499
|
+
# Since WIFI Extension 2.0 firmware version 2.1.3 the password is not
|
1500
|
+
# returned anymore.
|
1501
|
+
#
|
1488
1502
|
# .. versionadded:: 2.4.0$nbsp;(Firmware)
|
1489
1503
|
def get_wifi2_ap_password
|
1490
1504
|
send_request(FUNCTION_GET_WIFI2_AP_PASSWORD, [], '', 64, 'Z64')
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-05-11. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.13 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-05-11. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.13 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-05-11. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.13 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-05-11. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.13 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-05-11. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.13 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-05-11. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.13 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-05-11. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.13 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-05-11. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.13 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-05-11. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.13 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-05-11. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.13 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-05-11. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.13 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-05-11. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.13 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-05-11. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.13 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-05-11. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.13 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-05-11. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.13 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-05-11. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.13 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-05-11. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.13 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-05-11. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.13 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-05-11. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.13 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-05-11. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.13 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-05-11. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.13 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-05-11. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.13 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-05-11. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.13 #
|
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 #
|
@@ -0,0 +1,507 @@
|
|
1
|
+
# -*- ruby encoding: utf-8 -*-
|
2
|
+
#############################################################
|
3
|
+
# This file was automatically generated on 2017-05-11. #
|
4
|
+
# #
|
5
|
+
# Ruby Bindings Version 2.1.13 #
|
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
|
+
module Tinkerforge
|
13
|
+
# Determine position, velocity and altitude using GPS
|
14
|
+
class BrickletGPSV2 < Device
|
15
|
+
DEVICE_IDENTIFIER = 276 # :nodoc:
|
16
|
+
DEVICE_DISPLAY_NAME = 'GPS Bricklet 2.0' # :nodoc:
|
17
|
+
|
18
|
+
# This callback is triggered precisely once per second,
|
19
|
+
# see `PPS <https://en.wikipedia.org/wiki/Pulse-per-second_signal>`__.
|
20
|
+
#
|
21
|
+
# The precision of two subsequent pulses will be skewed because
|
22
|
+
# of the latency in the USB/RS485/Ethernet connection. But in the
|
23
|
+
# long run this will be very precise. For example a count of
|
24
|
+
# 3600 pulses will take exactly 1 hour.
|
25
|
+
CALLBACK_PULSE_PER_SECOND = 21
|
26
|
+
|
27
|
+
# This callback is triggered periodically with the period that is set by
|
28
|
+
# BrickletGPSV2#set_coordinates_callback_period. The parameters are the same
|
29
|
+
# as for BrickletGPSV2#get_coordinates.
|
30
|
+
#
|
31
|
+
# The CALLBACK_COORDINATES callback is only triggered if the coordinates changed
|
32
|
+
# since the last triggering and if there is currently a fix as indicated by
|
33
|
+
# BrickletGPSV2#get_status.
|
34
|
+
CALLBACK_COORDINATES = 22
|
35
|
+
|
36
|
+
# This callback is triggered periodically with the period that is set by
|
37
|
+
# BrickletGPSV2#set_status_callback_period. The parameters are the same
|
38
|
+
# as for BrickletGPSV2#get_status.
|
39
|
+
#
|
40
|
+
# The CALLBACK_STATUS callback is only triggered if the status changed since the
|
41
|
+
# last triggering.
|
42
|
+
CALLBACK_STATUS = 23
|
43
|
+
|
44
|
+
# This callback is triggered periodically with the period that is set by
|
45
|
+
# BrickletGPSV2#set_altitude_callback_period. The parameters are the same
|
46
|
+
# as for BrickletGPSV2#get_altitude.
|
47
|
+
#
|
48
|
+
# The CALLBACK_ALTITUDE callback is only triggered if the altitude changed since the
|
49
|
+
# last triggering and if there is currently a fix as indicated by
|
50
|
+
# BrickletGPSV2#get_status.
|
51
|
+
CALLBACK_ALTITUDE = 24
|
52
|
+
|
53
|
+
# This callback is triggered periodically with the period that is set by
|
54
|
+
# BrickletGPSV2#set_motion_callback_period. The parameters are the same
|
55
|
+
# as for BrickletGPSV2#get_motion.
|
56
|
+
#
|
57
|
+
# The CALLBACK_MOTION callback is only triggered if the motion changed since the
|
58
|
+
# last triggering and if there is currently a fix as indicated by
|
59
|
+
# BrickletGPSV2#get_status.
|
60
|
+
CALLBACK_MOTION = 25
|
61
|
+
|
62
|
+
# This callback is triggered periodically with the period that is set by
|
63
|
+
# BrickletGPSV2#set_date_time_callback_period. The parameters are the same
|
64
|
+
# as for BrickletGPSV2#get_date_time.
|
65
|
+
#
|
66
|
+
# The CALLBACK_DATE_TIME callback is only triggered if the date or time changed
|
67
|
+
# since the last triggering.
|
68
|
+
CALLBACK_DATE_TIME = 26
|
69
|
+
|
70
|
+
FUNCTION_GET_COORDINATES = 1 # :nodoc:
|
71
|
+
FUNCTION_GET_STATUS = 2 # :nodoc:
|
72
|
+
FUNCTION_GET_ALTITUDE = 3 # :nodoc:
|
73
|
+
FUNCTION_GET_MOTION = 4 # :nodoc:
|
74
|
+
FUNCTION_GET_DATE_TIME = 5 # :nodoc:
|
75
|
+
FUNCTION_RESTART = 6 # :nodoc:
|
76
|
+
FUNCTION_GET_SATELLITE_SYSTEM_STATUS_LOW_LEVEL = 7 # :nodoc:
|
77
|
+
FUNCTION_GET_SATELLITE_STATUS = 8 # :nodoc:
|
78
|
+
FUNCTION_SET_FIX_LED_CONFIG = 9 # :nodoc:
|
79
|
+
FUNCTION_GET_FIX_LED_CONFIG = 10 # :nodoc:
|
80
|
+
FUNCTION_SET_COORDINATES_CALLBACK_PERIOD = 11 # :nodoc:
|
81
|
+
FUNCTION_GET_COORDINATES_CALLBACK_PERIOD = 12 # :nodoc:
|
82
|
+
FUNCTION_SET_STATUS_CALLBACK_PERIOD = 13 # :nodoc:
|
83
|
+
FUNCTION_GET_STATUS_CALLBACK_PERIOD = 14 # :nodoc:
|
84
|
+
FUNCTION_SET_ALTITUDE_CALLBACK_PERIOD = 15 # :nodoc:
|
85
|
+
FUNCTION_GET_ALTITUDE_CALLBACK_PERIOD = 16 # :nodoc:
|
86
|
+
FUNCTION_SET_MOTION_CALLBACK_PERIOD = 17 # :nodoc:
|
87
|
+
FUNCTION_GET_MOTION_CALLBACK_PERIOD = 18 # :nodoc:
|
88
|
+
FUNCTION_SET_DATE_TIME_CALLBACK_PERIOD = 19 # :nodoc:
|
89
|
+
FUNCTION_GET_DATE_TIME_CALLBACK_PERIOD = 20 # :nodoc:
|
90
|
+
FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
|
91
|
+
FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
|
92
|
+
FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
|
93
|
+
FUNCTION_SET_WRITE_FIRMWARE_POINTER = 237 # :nodoc:
|
94
|
+
FUNCTION_WRITE_FIRMWARE = 238 # :nodoc:
|
95
|
+
FUNCTION_SET_STATUS_LED_CONFIG = 239 # :nodoc:
|
96
|
+
FUNCTION_GET_STATUS_LED_CONFIG = 240 # :nodoc:
|
97
|
+
FUNCTION_GET_CHIP_TEMPERATURE = 242 # :nodoc:
|
98
|
+
FUNCTION_RESET = 243 # :nodoc:
|
99
|
+
FUNCTION_WRITE_UID = 248 # :nodoc:
|
100
|
+
FUNCTION_READ_UID = 249 # :nodoc:
|
101
|
+
FUNCTION_GET_IDENTITY = 255 # :nodoc:
|
102
|
+
|
103
|
+
RESTART_TYPE_HOT_START = 0 # :nodoc:
|
104
|
+
RESTART_TYPE_WARM_START = 1 # :nodoc:
|
105
|
+
RESTART_TYPE_COLD_START = 2 # :nodoc:
|
106
|
+
RESTART_TYPE_FACTORY_RESET = 3 # :nodoc:
|
107
|
+
SATELLITE_SYSTEM_GPS = 0 # :nodoc:
|
108
|
+
SATELLITE_SYSTEM_GLONASS = 1 # :nodoc:
|
109
|
+
SATELLITE_SYSTEM_GALILEO = 2 # :nodoc:
|
110
|
+
FIX_NO_FIX = 1 # :nodoc:
|
111
|
+
FIX_2D_FIX = 2 # :nodoc:
|
112
|
+
FIX_3D_FIX = 3 # :nodoc:
|
113
|
+
FIX_LED_CONFIG_OFF = 0 # :nodoc:
|
114
|
+
FIX_LED_CONFIG_ON = 1 # :nodoc:
|
115
|
+
FIX_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
|
116
|
+
FIX_LED_CONFIG_SHOW_FIX = 3 # :nodoc:
|
117
|
+
FIX_LED_CONFIG_SHOW_PPS = 4 # :nodoc:
|
118
|
+
BOOTLOADER_MODE_BOOTLOADER = 0 # :nodoc:
|
119
|
+
BOOTLOADER_MODE_FIRMWARE = 1 # :nodoc:
|
120
|
+
BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT = 2 # :nodoc:
|
121
|
+
BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT = 3 # :nodoc:
|
122
|
+
BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT = 4 # :nodoc:
|
123
|
+
BOOTLOADER_STATUS_OK = 0 # :nodoc:
|
124
|
+
BOOTLOADER_STATUS_INVALID_MODE = 1 # :nodoc:
|
125
|
+
BOOTLOADER_STATUS_NO_CHANGE = 2 # :nodoc:
|
126
|
+
BOOTLOADER_STATUS_ENTRY_FUNCTION_NOT_PRESENT = 3 # :nodoc:
|
127
|
+
BOOTLOADER_STATUS_DEVICE_IDENTIFIER_INCORRECT = 4 # :nodoc:
|
128
|
+
BOOTLOADER_STATUS_CRC_MISMATCH = 5 # :nodoc:
|
129
|
+
STATUS_LED_CONFIG_OFF = 0 # :nodoc:
|
130
|
+
STATUS_LED_CONFIG_ON = 1 # :nodoc:
|
131
|
+
STATUS_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
|
132
|
+
STATUS_LED_CONFIG_SHOW_STATUS = 3 # :nodoc:
|
133
|
+
|
134
|
+
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
135
|
+
# the IP Connection <tt>ipcon</tt>.
|
136
|
+
def initialize(uid, ipcon)
|
137
|
+
super uid, ipcon
|
138
|
+
|
139
|
+
@api_version = [2, 0, 0]
|
140
|
+
|
141
|
+
@response_expected[FUNCTION_GET_COORDINATES] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
142
|
+
@response_expected[FUNCTION_GET_STATUS] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
143
|
+
@response_expected[FUNCTION_GET_ALTITUDE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
144
|
+
@response_expected[FUNCTION_GET_MOTION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
145
|
+
@response_expected[FUNCTION_GET_DATE_TIME] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
146
|
+
@response_expected[FUNCTION_RESTART] = RESPONSE_EXPECTED_FALSE
|
147
|
+
@response_expected[FUNCTION_GET_SATELLITE_SYSTEM_STATUS_LOW_LEVEL] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
148
|
+
@response_expected[FUNCTION_GET_SATELLITE_STATUS] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
149
|
+
@response_expected[FUNCTION_SET_FIX_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
|
150
|
+
@response_expected[FUNCTION_GET_FIX_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
151
|
+
@response_expected[FUNCTION_SET_COORDINATES_CALLBACK_PERIOD] = RESPONSE_EXPECTED_TRUE
|
152
|
+
@response_expected[FUNCTION_GET_COORDINATES_CALLBACK_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
153
|
+
@response_expected[FUNCTION_SET_STATUS_CALLBACK_PERIOD] = RESPONSE_EXPECTED_TRUE
|
154
|
+
@response_expected[FUNCTION_GET_STATUS_CALLBACK_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
155
|
+
@response_expected[FUNCTION_SET_ALTITUDE_CALLBACK_PERIOD] = RESPONSE_EXPECTED_TRUE
|
156
|
+
@response_expected[FUNCTION_GET_ALTITUDE_CALLBACK_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
157
|
+
@response_expected[FUNCTION_SET_MOTION_CALLBACK_PERIOD] = RESPONSE_EXPECTED_TRUE
|
158
|
+
@response_expected[FUNCTION_GET_MOTION_CALLBACK_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
159
|
+
@response_expected[FUNCTION_SET_DATE_TIME_CALLBACK_PERIOD] = RESPONSE_EXPECTED_TRUE
|
160
|
+
@response_expected[FUNCTION_GET_DATE_TIME_CALLBACK_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
161
|
+
@response_expected[CALLBACK_PULSE_PER_SECOND] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
162
|
+
@response_expected[CALLBACK_COORDINATES] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
163
|
+
@response_expected[CALLBACK_STATUS] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
164
|
+
@response_expected[CALLBACK_ALTITUDE] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
165
|
+
@response_expected[CALLBACK_MOTION] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
166
|
+
@response_expected[CALLBACK_DATE_TIME] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
167
|
+
@response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
168
|
+
@response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
169
|
+
@response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
170
|
+
@response_expected[FUNCTION_SET_WRITE_FIRMWARE_POINTER] = RESPONSE_EXPECTED_FALSE
|
171
|
+
@response_expected[FUNCTION_WRITE_FIRMWARE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
172
|
+
@response_expected[FUNCTION_SET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
|
173
|
+
@response_expected[FUNCTION_GET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
174
|
+
@response_expected[FUNCTION_GET_CHIP_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
175
|
+
@response_expected[FUNCTION_RESET] = RESPONSE_EXPECTED_FALSE
|
176
|
+
@response_expected[FUNCTION_WRITE_UID] = RESPONSE_EXPECTED_FALSE
|
177
|
+
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
178
|
+
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
179
|
+
|
180
|
+
@callback_formats[CALLBACK_PULSE_PER_SECOND] = ''
|
181
|
+
@callback_formats[CALLBACK_COORDINATES] = 'L k L k'
|
182
|
+
@callback_formats[CALLBACK_STATUS] = '? C'
|
183
|
+
@callback_formats[CALLBACK_ALTITUDE] = 'l l'
|
184
|
+
@callback_formats[CALLBACK_MOTION] = 'L L'
|
185
|
+
@callback_formats[CALLBACK_DATE_TIME] = 'L L'
|
186
|
+
end
|
187
|
+
|
188
|
+
# Returns the GPS coordinates. Latitude and longitude are given in the
|
189
|
+
# ``DD.dddddd°`` format, the value 57123468 means 57.123468°.
|
190
|
+
# The parameter ``ns`` and ``ew`` are the cardinal directions for
|
191
|
+
# latitude and longitude. Possible values for ``ns`` and ``ew`` are 'N', 'S', 'E'
|
192
|
+
# and 'W' (north, south, east and west).
|
193
|
+
#
|
194
|
+
# This data is only valid if there is currently a fix as indicated by
|
195
|
+
# BrickletGPSV2#get_status.
|
196
|
+
def get_coordinates
|
197
|
+
send_request(FUNCTION_GET_COORDINATES, [], '', 10, 'L k L k')
|
198
|
+
end
|
199
|
+
|
200
|
+
# Returns if a fix is currently available as well as the, the number of
|
201
|
+
# satellites that are in view.
|
202
|
+
#
|
203
|
+
# There is also a :ref:`green LED <gps_v2_bricklet_fix_led>` on the Bricklet that
|
204
|
+
# indicates the fix status.
|
205
|
+
def get_status
|
206
|
+
send_request(FUNCTION_GET_STATUS, [], '', 2, '? C')
|
207
|
+
end
|
208
|
+
|
209
|
+
# Returns the current altitude and corresponding geoidal separation.
|
210
|
+
#
|
211
|
+
# Both values are given in cm.
|
212
|
+
#
|
213
|
+
# This data is only valid if there is currently a fix as indicated by
|
214
|
+
# BrickletGPSV2#get_status.
|
215
|
+
def get_altitude
|
216
|
+
send_request(FUNCTION_GET_ALTITUDE, [], '', 8, 'l l')
|
217
|
+
end
|
218
|
+
|
219
|
+
# Returns the current course and speed. Course is given in hundredths degree
|
220
|
+
# and speed is given in hundredths km/h. A course of 0° means the Bricklet is
|
221
|
+
# traveling north bound and 90° means it is traveling east bound.
|
222
|
+
#
|
223
|
+
# Please note that this only returns useful values if an actual movement
|
224
|
+
# is present.
|
225
|
+
#
|
226
|
+
# This data is only valid if there is currently a fix as indicated by
|
227
|
+
# BrickletGPSV2#get_status.
|
228
|
+
def get_motion
|
229
|
+
send_request(FUNCTION_GET_MOTION, [], '', 8, 'L L')
|
230
|
+
end
|
231
|
+
|
232
|
+
# Returns the current date and time. The date is
|
233
|
+
# given in the format ``ddmmyy`` and the time is given
|
234
|
+
# in the format ``hhmmss.sss``. For example, 140713 means
|
235
|
+
# 14.05.13 as date and 195923568 means 19:59:23.568 as time.
|
236
|
+
def get_date_time
|
237
|
+
send_request(FUNCTION_GET_DATE_TIME, [], '', 8, 'L L')
|
238
|
+
end
|
239
|
+
|
240
|
+
# Restarts the GPS Bricklet, the following restart types are available:
|
241
|
+
#
|
242
|
+
# "Value", "Description"
|
243
|
+
#
|
244
|
+
# "0", "Hot start (use all available data in the NV store)"
|
245
|
+
# "1", "Warm start (don't use ephemeris at restart)"
|
246
|
+
# "2", "Cold start (don't use time, position, almanacs and ephemeris at restart)"
|
247
|
+
# "3", "Factory reset (clear all system/user configurations at restart)"
|
248
|
+
def restart(restart_type)
|
249
|
+
send_request(FUNCTION_RESTART, [restart_type], 'C', 0, '')
|
250
|
+
end
|
251
|
+
|
252
|
+
# Returns the
|
253
|
+
#
|
254
|
+
# * satellite numbers list
|
255
|
+
# * fix value,
|
256
|
+
# * PDOP value,
|
257
|
+
# * HDOP value and
|
258
|
+
# * VDOP value
|
259
|
+
#
|
260
|
+
# for a given satellite system. Currently GPS and GLONASS are supported, Galileo
|
261
|
+
# is not yet supported.
|
262
|
+
#
|
263
|
+
# The GPS and GLONASS satellites have unique numbers and the satellite list gives
|
264
|
+
# the numbers of the satellites that are currently utilized. The number 0 is not
|
265
|
+
# a valid satellite number and can be ignored in the list.
|
266
|
+
def get_satellite_system_status_low_level(satellite_system)
|
267
|
+
send_request(FUNCTION_GET_SATELLITE_SYSTEM_STATUS_LOW_LEVEL, [satellite_system], 'C', 20, 'C C12 C S S S')
|
268
|
+
end
|
269
|
+
|
270
|
+
# Returns the current
|
271
|
+
#
|
272
|
+
# * elevation (0° - 90°),
|
273
|
+
# * azimuth (0° - 359°) and
|
274
|
+
# * SNR (0dB - 99dB)
|
275
|
+
#
|
276
|
+
# for a given satellite and satellite system.
|
277
|
+
#
|
278
|
+
# The satellite number here always goes from 1 to 32. For GLONASS it corresponds to
|
279
|
+
# the satellites 65-96.
|
280
|
+
#
|
281
|
+
# Galileo is not yet supported.
|
282
|
+
def get_satellite_status(satellite_system, satellite_number)
|
283
|
+
send_request(FUNCTION_GET_SATELLITE_STATUS, [satellite_system, satellite_number], 'C C', 6, 's s s')
|
284
|
+
end
|
285
|
+
|
286
|
+
# Sets the fix LED configuration. By default the LED shows if
|
287
|
+
# the Bricklet got a GPS fix yet. If a fix is established the LED turns on.
|
288
|
+
# If there is no fix then the LED is turned off.
|
289
|
+
#
|
290
|
+
# You can also turn the LED permanently on/off, show a heartbeat or let it blink
|
291
|
+
# in sync with the PPS (pulse per second) output of the GPS module.
|
292
|
+
#
|
293
|
+
# If the Bricklet is in bootloader mode, the LED is off.
|
294
|
+
def set_fix_led_config(config)
|
295
|
+
send_request(FUNCTION_SET_FIX_LED_CONFIG, [config], 'C', 0, '')
|
296
|
+
end
|
297
|
+
|
298
|
+
# Returns the configuration as set by BrickletGPSV2#set_fix_led_config
|
299
|
+
def get_fix_led_config
|
300
|
+
send_request(FUNCTION_GET_FIX_LED_CONFIG, [], '', 1, 'C')
|
301
|
+
end
|
302
|
+
|
303
|
+
# Sets the period in ms with which the CALLBACK_COORDINATES callback is triggered
|
304
|
+
# periodically. A value of 0 turns the callback off.
|
305
|
+
#
|
306
|
+
# The CALLBACK_COORDINATES callback is only triggered if the coordinates changed
|
307
|
+
# since the last triggering.
|
308
|
+
#
|
309
|
+
# The default value is 0.
|
310
|
+
def set_coordinates_callback_period(period)
|
311
|
+
send_request(FUNCTION_SET_COORDINATES_CALLBACK_PERIOD, [period], 'L', 0, '')
|
312
|
+
end
|
313
|
+
|
314
|
+
# Returns the period as set by BrickletGPSV2#set_coordinates_callback_period.
|
315
|
+
def get_coordinates_callback_period
|
316
|
+
send_request(FUNCTION_GET_COORDINATES_CALLBACK_PERIOD, [], '', 4, 'L')
|
317
|
+
end
|
318
|
+
|
319
|
+
# Sets the period in ms with which the CALLBACK_STATUS callback is triggered
|
320
|
+
# periodically. A value of 0 turns the callback off.
|
321
|
+
#
|
322
|
+
# The CALLBACK_STATUS callback is only triggered if the status changed since the
|
323
|
+
# last triggering.
|
324
|
+
#
|
325
|
+
# The default value is 0.
|
326
|
+
def set_status_callback_period(period)
|
327
|
+
send_request(FUNCTION_SET_STATUS_CALLBACK_PERIOD, [period], 'L', 0, '')
|
328
|
+
end
|
329
|
+
|
330
|
+
# Returns the period as set by BrickletGPSV2#set_status_callback_period.
|
331
|
+
def get_status_callback_period
|
332
|
+
send_request(FUNCTION_GET_STATUS_CALLBACK_PERIOD, [], '', 4, 'L')
|
333
|
+
end
|
334
|
+
|
335
|
+
# Sets the period in ms with which the CALLBACK_ALTITUDE callback is triggered
|
336
|
+
# periodically. A value of 0 turns the callback off.
|
337
|
+
#
|
338
|
+
# The CALLBACK_ALTITUDE callback is only triggered if the altitude changed since the
|
339
|
+
# last triggering.
|
340
|
+
#
|
341
|
+
# The default value is 0.
|
342
|
+
def set_altitude_callback_period(period)
|
343
|
+
send_request(FUNCTION_SET_ALTITUDE_CALLBACK_PERIOD, [period], 'L', 0, '')
|
344
|
+
end
|
345
|
+
|
346
|
+
# Returns the period as set by BrickletGPSV2#set_altitude_callback_period.
|
347
|
+
def get_altitude_callback_period
|
348
|
+
send_request(FUNCTION_GET_ALTITUDE_CALLBACK_PERIOD, [], '', 4, 'L')
|
349
|
+
end
|
350
|
+
|
351
|
+
# Sets the period in ms with which the CALLBACK_MOTION callback is triggered
|
352
|
+
# periodically. A value of 0 turns the callback off.
|
353
|
+
#
|
354
|
+
# The CALLBACK_MOTION callback is only triggered if the motion changed since the
|
355
|
+
# last triggering.
|
356
|
+
#
|
357
|
+
# The default value is 0.
|
358
|
+
def set_motion_callback_period(period)
|
359
|
+
send_request(FUNCTION_SET_MOTION_CALLBACK_PERIOD, [period], 'L', 0, '')
|
360
|
+
end
|
361
|
+
|
362
|
+
# Returns the period as set by BrickletGPSV2#set_motion_callback_period.
|
363
|
+
def get_motion_callback_period
|
364
|
+
send_request(FUNCTION_GET_MOTION_CALLBACK_PERIOD, [], '', 4, 'L')
|
365
|
+
end
|
366
|
+
|
367
|
+
# Sets the period in ms with which the CALLBACK_DATE_TIME callback is triggered
|
368
|
+
# periodically. A value of 0 turns the callback off.
|
369
|
+
#
|
370
|
+
# The CALLBACK_DATE_TIME callback is only triggered if the date or time changed
|
371
|
+
# since the last triggering.
|
372
|
+
#
|
373
|
+
# The default value is 0.
|
374
|
+
def set_date_time_callback_period(period)
|
375
|
+
send_request(FUNCTION_SET_DATE_TIME_CALLBACK_PERIOD, [period], 'L', 0, '')
|
376
|
+
end
|
377
|
+
|
378
|
+
# Returns the period as set by BrickletGPSV2#set_date_time_callback_period.
|
379
|
+
def get_date_time_callback_period
|
380
|
+
send_request(FUNCTION_GET_DATE_TIME_CALLBACK_PERIOD, [], '', 4, 'L')
|
381
|
+
end
|
382
|
+
|
383
|
+
# Returns the error count for the communication between Brick and Bricklet.
|
384
|
+
#
|
385
|
+
# The errors are divided into
|
386
|
+
#
|
387
|
+
# * ack checksum errors,
|
388
|
+
# * message checksum errors,
|
389
|
+
# * frameing errors and
|
390
|
+
# * overflow errors.
|
391
|
+
#
|
392
|
+
# The errors counts are for errors that occur on the Bricklet side. All
|
393
|
+
# Bricks have a similar function that returns the errors on the Brick side.
|
394
|
+
def get_spitfp_error_count
|
395
|
+
send_request(FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L')
|
396
|
+
end
|
397
|
+
|
398
|
+
# Sets the bootloader mode and returns the status after the requested
|
399
|
+
# mode change was instigated.
|
400
|
+
#
|
401
|
+
# You can change from bootloader mode to firmware mode and vice versa. A change
|
402
|
+
# from bootloader mode to firmware mode will only take place if the entry function,
|
403
|
+
# device identifier und crc are present and correct.
|
404
|
+
#
|
405
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
406
|
+
# necessary to call it in a normal user program.
|
407
|
+
def set_bootloader_mode(mode)
|
408
|
+
send_request(FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C')
|
409
|
+
end
|
410
|
+
|
411
|
+
# Returns the current bootloader mode, see BrickletGPSV2#set_bootloader_mode.
|
412
|
+
def get_bootloader_mode
|
413
|
+
send_request(FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C')
|
414
|
+
end
|
415
|
+
|
416
|
+
# Sets the firmware pointer for func:`WriteFirmware`. The pointer has
|
417
|
+
# to be increased by chunks of size 64. The data is written to flash
|
418
|
+
# every 4 chunks (which equals to one page of size 256).
|
419
|
+
#
|
420
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
421
|
+
# necessary to call it in a normal user program.
|
422
|
+
def set_write_firmware_pointer(pointer)
|
423
|
+
send_request(FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, '')
|
424
|
+
end
|
425
|
+
|
426
|
+
# Writes 64 Bytes of firmware at the position as written by
|
427
|
+
# BrickletGPSV2#set_write_firmware_pointer before. The firmware is written
|
428
|
+
# to flash every 4 chunks.
|
429
|
+
#
|
430
|
+
# You can only write firmware in bootloader mode.
|
431
|
+
#
|
432
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
433
|
+
# necessary to call it in a normal user program.
|
434
|
+
def write_firmware(data)
|
435
|
+
send_request(FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C')
|
436
|
+
end
|
437
|
+
|
438
|
+
# Sets the status LED configuration. By default the LED shows
|
439
|
+
# communication traffic between Brick and Bricklet, it flickers once
|
440
|
+
# for every 10 received data packets.
|
441
|
+
#
|
442
|
+
# You can also turn the LED permanently on/off or show a heartbeat.
|
443
|
+
#
|
444
|
+
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
445
|
+
def set_status_led_config(config)
|
446
|
+
send_request(FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, '')
|
447
|
+
end
|
448
|
+
|
449
|
+
# Returns the configuration as set by BrickletGPSV2#set_status_led_config
|
450
|
+
def get_status_led_config
|
451
|
+
send_request(FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C')
|
452
|
+
end
|
453
|
+
|
454
|
+
# Returns the temperature in °C as measured inside the microcontroller. The
|
455
|
+
# value returned is not the ambient temperature!
|
456
|
+
#
|
457
|
+
# The temperature is only proportional to the real temperature and it has bad
|
458
|
+
# accuracy. Practically it is only useful as an indicator for
|
459
|
+
# temperature changes.
|
460
|
+
def get_chip_temperature
|
461
|
+
send_request(FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's')
|
462
|
+
end
|
463
|
+
|
464
|
+
# Calling this function will reset the Bricklet. All configurations
|
465
|
+
# will be lost.
|
466
|
+
#
|
467
|
+
# After a reset you have to create new device objects,
|
468
|
+
# calling functions on the existing ones will result in
|
469
|
+
# undefined behavior!
|
470
|
+
def reset
|
471
|
+
send_request(FUNCTION_RESET, [], '', 0, '')
|
472
|
+
end
|
473
|
+
|
474
|
+
# Writes a new UID into flash. If you want to set a new UID
|
475
|
+
# you have to decode the Base58 encoded UID string into an
|
476
|
+
# integer first.
|
477
|
+
#
|
478
|
+
# We recommend that you use Brick Viewer to change the UID.
|
479
|
+
def write_uid(uid)
|
480
|
+
send_request(FUNCTION_WRITE_UID, [uid], 'L', 0, '')
|
481
|
+
end
|
482
|
+
|
483
|
+
# Returns the current UID as an integer. Encode as
|
484
|
+
# Base58 to get the usual string version.
|
485
|
+
def read_uid
|
486
|
+
send_request(FUNCTION_READ_UID, [], '', 4, 'L')
|
487
|
+
end
|
488
|
+
|
489
|
+
# Returns the UID, the UID where the Bricklet is connected to,
|
490
|
+
# the position, the hardware and firmware version as well as the
|
491
|
+
# device identifier.
|
492
|
+
#
|
493
|
+
# The position can be 'a', 'b', 'c' or 'd'.
|
494
|
+
#
|
495
|
+
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
496
|
+
# |device_identifier_constant|
|
497
|
+
def get_identity
|
498
|
+
send_request(FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S')
|
499
|
+
end
|
500
|
+
|
501
|
+
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|
502
|
+
def register_callback(id, &block)
|
503
|
+
callback = block
|
504
|
+
@registered_callbacks[id] = callback
|
505
|
+
end
|
506
|
+
end
|
507
|
+
end
|