tinkerforge 2.1.14 → 2.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. checksums.yaml +7 -0
  2. data/lib/tinkerforge/brick_dc.rb +2 -2
  3. data/lib/tinkerforge/brick_imu.rb +2 -2
  4. data/lib/tinkerforge/brick_imu_v2.rb +2 -2
  5. data/lib/tinkerforge/brick_master.rb +2 -2
  6. data/lib/tinkerforge/brick_red.rb +2 -2
  7. data/lib/tinkerforge/brick_servo.rb +2 -2
  8. data/lib/tinkerforge/brick_silent_stepper.rb +2 -2
  9. data/lib/tinkerforge/brick_stepper.rb +2 -2
  10. data/lib/tinkerforge/bricklet_accelerometer.rb +2 -2
  11. data/lib/tinkerforge/bricklet_ambient_light.rb +2 -2
  12. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +2 -2
  13. data/lib/tinkerforge/bricklet_analog_in.rb +2 -2
  14. data/lib/tinkerforge/bricklet_analog_in_v2.rb +2 -2
  15. data/lib/tinkerforge/bricklet_analog_out.rb +2 -2
  16. data/lib/tinkerforge/bricklet_analog_out_v2.rb +2 -2
  17. data/lib/tinkerforge/bricklet_barometer.rb +2 -2
  18. data/lib/tinkerforge/bricklet_can.rb +2 -2
  19. data/lib/tinkerforge/bricklet_co2.rb +2 -2
  20. data/lib/tinkerforge/bricklet_color.rb +2 -2
  21. data/lib/tinkerforge/bricklet_current12.rb +2 -2
  22. data/lib/tinkerforge/bricklet_current25.rb +2 -2
  23. data/lib/tinkerforge/bricklet_distance_ir.rb +2 -2
  24. data/lib/tinkerforge/bricklet_distance_us.rb +2 -2
  25. data/lib/tinkerforge/bricklet_dmx.rb +520 -0
  26. data/lib/tinkerforge/bricklet_dual_button.rb +2 -2
  27. data/lib/tinkerforge/bricklet_dual_relay.rb +2 -2
  28. data/lib/tinkerforge/bricklet_dust_detector.rb +2 -2
  29. data/lib/tinkerforge/bricklet_gps.rb +2 -2
  30. data/lib/tinkerforge/bricklet_gps_v2.rb +27 -3
  31. data/lib/tinkerforge/bricklet_hall_effect.rb +2 -2
  32. data/lib/tinkerforge/bricklet_humidity.rb +2 -2
  33. data/lib/tinkerforge/bricklet_humidity_v2.rb +368 -0
  34. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +2 -2
  35. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +2 -2
  36. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +2 -2
  37. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +2 -2
  38. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +2 -2
  39. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +2 -2
  40. data/lib/tinkerforge/bricklet_io16.rb +2 -2
  41. data/lib/tinkerforge/bricklet_io4.rb +2 -2
  42. data/lib/tinkerforge/bricklet_joystick.rb +2 -2
  43. data/lib/tinkerforge/bricklet_laser_range_finder.rb +2 -2
  44. data/lib/tinkerforge/bricklet_lcd_16x2.rb +2 -2
  45. data/lib/tinkerforge/bricklet_lcd_20x4.rb +2 -2
  46. data/lib/tinkerforge/bricklet_led_strip.rb +2 -2
  47. data/lib/tinkerforge/bricklet_line.rb +2 -2
  48. data/lib/tinkerforge/bricklet_linear_poti.rb +2 -2
  49. data/lib/tinkerforge/bricklet_load_cell.rb +2 -2
  50. data/lib/tinkerforge/bricklet_moisture.rb +2 -2
  51. data/lib/tinkerforge/bricklet_motion_detector.rb +2 -2
  52. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +330 -0
  53. data/lib/tinkerforge/bricklet_multi_touch.rb +2 -2
  54. data/lib/tinkerforge/bricklet_nfc_rfid.rb +2 -2
  55. data/lib/tinkerforge/bricklet_oled_128x64.rb +2 -2
  56. data/lib/tinkerforge/bricklet_oled_64x48.rb +2 -2
  57. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +2 -2
  58. data/lib/tinkerforge/bricklet_piezo_speaker.rb +2 -2
  59. data/lib/tinkerforge/bricklet_ptc.rb +2 -2
  60. data/lib/tinkerforge/bricklet_real_time_clock.rb +2 -2
  61. data/lib/tinkerforge/bricklet_remote_switch.rb +2 -2
  62. data/lib/tinkerforge/bricklet_rgb_led.rb +3 -3
  63. data/lib/tinkerforge/bricklet_rgb_led_button.rb +248 -0
  64. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +300 -0
  65. data/lib/tinkerforge/bricklet_rotary_encoder.rb +2 -2
  66. data/lib/tinkerforge/bricklet_rotary_poti.rb +2 -2
  67. data/lib/tinkerforge/bricklet_rs232.rb +2 -2
  68. data/lib/tinkerforge/bricklet_rs485.rb +3 -3
  69. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +2 -2
  70. data/lib/tinkerforge/bricklet_solid_state_relay.rb +2 -2
  71. data/lib/tinkerforge/bricklet_sound_intensity.rb +2 -2
  72. data/lib/tinkerforge/bricklet_temperature.rb +2 -2
  73. data/lib/tinkerforge/bricklet_temperature_ir.rb +2 -2
  74. data/lib/tinkerforge/bricklet_thermal_imaging.rb +555 -0
  75. data/lib/tinkerforge/bricklet_thermocouple.rb +2 -2
  76. data/lib/tinkerforge/bricklet_tilt.rb +2 -2
  77. data/lib/tinkerforge/bricklet_uv_light.rb +2 -2
  78. data/lib/tinkerforge/bricklet_voltage.rb +2 -2
  79. data/lib/tinkerforge/bricklet_voltage_current.rb +2 -2
  80. data/lib/tinkerforge/version.rb +1 -1
  81. metadata +74 -70
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2017-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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-07-27. #
3
+ # This file was automatically generated on 2017-11-20. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.14 #
5
+ # Ruby Bindings Version 2.1.15 #
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,330 @@
1
+ # -*- ruby encoding: utf-8 -*-
2
+ #############################################################
3
+ # This file was automatically generated on 2017-11-20. #
4
+ # #
5
+ # Ruby Bindings Version 2.1.15 #
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
+ # Motorized Linear Potentiometer
14
+ class BrickletMotorizedLinearPoti < Device
15
+ DEVICE_IDENTIFIER = 267 # :nodoc:
16
+ DEVICE_DISPLAY_NAME = 'Motorized Linear Poti Bricklet' # :nodoc:
17
+
18
+ # This callback is triggered periodically according to the configuration set by
19
+ # BrickletMotorizedLinearPoti#set_position_callback_configuration.
20
+ #
21
+ # The `parameter` is the same as BrickletMotorizedLinearPoti#get_position.
22
+ CALLBACK_POSITION = 4
23
+
24
+ # This callback is triggered if a new position as set by
25
+ # BrickletMotorizedLinearPoti#set_motor_position is reached.
26
+ #
27
+ # The parameter is the current position.
28
+ CALLBACK_POSITION_REACHED = 10
29
+
30
+ FUNCTION_GET_POSITION = 1 # :nodoc:
31
+ FUNCTION_SET_POSITION_CALLBACK_CONFIGURATION = 2 # :nodoc:
32
+ FUNCTION_GET_POSITION_CALLBACK_CONFIGURATION = 3 # :nodoc:
33
+ FUNCTION_SET_MOTOR_POSITION = 5 # :nodoc:
34
+ FUNCTION_GET_MOTOR_POSITION = 6 # :nodoc:
35
+ FUNCTION_CALIBRATE = 7 # :nodoc:
36
+ FUNCTION_SET_POSITION_REACHED_CALLBACK_CONFIGURATION = 8 # :nodoc:
37
+ FUNCTION_GET_POSITION_REACHED_CALLBACK_CONFIGURATION = 9 # :nodoc:
38
+ FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
39
+ FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
40
+ FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
41
+ FUNCTION_SET_WRITE_FIRMWARE_POINTER = 237 # :nodoc:
42
+ FUNCTION_WRITE_FIRMWARE = 238 # :nodoc:
43
+ FUNCTION_SET_STATUS_LED_CONFIG = 239 # :nodoc:
44
+ FUNCTION_GET_STATUS_LED_CONFIG = 240 # :nodoc:
45
+ FUNCTION_GET_CHIP_TEMPERATURE = 242 # :nodoc:
46
+ FUNCTION_RESET = 243 # :nodoc:
47
+ FUNCTION_WRITE_UID = 248 # :nodoc:
48
+ FUNCTION_READ_UID = 249 # :nodoc:
49
+ FUNCTION_GET_IDENTITY = 255 # :nodoc:
50
+
51
+ THRESHOLD_OPTION_OFF = 'x' # :nodoc:
52
+ THRESHOLD_OPTION_OUTSIDE = 'o' # :nodoc:
53
+ THRESHOLD_OPTION_INSIDE = 'i' # :nodoc:
54
+ THRESHOLD_OPTION_SMALLER = '<' # :nodoc:
55
+ THRESHOLD_OPTION_GREATER = '>' # :nodoc:
56
+ DRIVE_MODE_FAST = 0 # :nodoc:
57
+ DRIVE_MODE_SMOOTH = 1 # :nodoc:
58
+ BOOTLOADER_MODE_BOOTLOADER = 0 # :nodoc:
59
+ BOOTLOADER_MODE_FIRMWARE = 1 # :nodoc:
60
+ BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT = 2 # :nodoc:
61
+ BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT = 3 # :nodoc:
62
+ BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT = 4 # :nodoc:
63
+ BOOTLOADER_STATUS_OK = 0 # :nodoc:
64
+ BOOTLOADER_STATUS_INVALID_MODE = 1 # :nodoc:
65
+ BOOTLOADER_STATUS_NO_CHANGE = 2 # :nodoc:
66
+ BOOTLOADER_STATUS_ENTRY_FUNCTION_NOT_PRESENT = 3 # :nodoc:
67
+ BOOTLOADER_STATUS_DEVICE_IDENTIFIER_INCORRECT = 4 # :nodoc:
68
+ BOOTLOADER_STATUS_CRC_MISMATCH = 5 # :nodoc:
69
+ STATUS_LED_CONFIG_OFF = 0 # :nodoc:
70
+ STATUS_LED_CONFIG_ON = 1 # :nodoc:
71
+ STATUS_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
72
+ STATUS_LED_CONFIG_SHOW_STATUS = 3 # :nodoc:
73
+
74
+ # Creates an object with the unique device ID <tt>uid</tt> and adds it to
75
+ # the IP Connection <tt>ipcon</tt>.
76
+ def initialize(uid, ipcon)
77
+ super uid, ipcon
78
+
79
+ @api_version = [2, 0, 0]
80
+
81
+ @response_expected[FUNCTION_GET_POSITION] = RESPONSE_EXPECTED_ALWAYS_TRUE
82
+ @response_expected[FUNCTION_SET_POSITION_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
83
+ @response_expected[FUNCTION_GET_POSITION_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
84
+ @response_expected[FUNCTION_SET_MOTOR_POSITION] = RESPONSE_EXPECTED_FALSE
85
+ @response_expected[FUNCTION_GET_MOTOR_POSITION] = RESPONSE_EXPECTED_ALWAYS_TRUE
86
+ @response_expected[FUNCTION_CALIBRATE] = RESPONSE_EXPECTED_FALSE
87
+ @response_expected[FUNCTION_SET_POSITION_REACHED_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
88
+ @response_expected[FUNCTION_GET_POSITION_REACHED_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
89
+ @response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
90
+ @response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
91
+ @response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
92
+ @response_expected[FUNCTION_SET_WRITE_FIRMWARE_POINTER] = RESPONSE_EXPECTED_FALSE
93
+ @response_expected[FUNCTION_WRITE_FIRMWARE] = RESPONSE_EXPECTED_ALWAYS_TRUE
94
+ @response_expected[FUNCTION_SET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
95
+ @response_expected[FUNCTION_GET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
96
+ @response_expected[FUNCTION_GET_CHIP_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
97
+ @response_expected[FUNCTION_RESET] = RESPONSE_EXPECTED_FALSE
98
+ @response_expected[FUNCTION_WRITE_UID] = RESPONSE_EXPECTED_FALSE
99
+ @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
100
+ @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
101
+
102
+ @callback_formats[CALLBACK_POSITION] = 'S'
103
+ @callback_formats[CALLBACK_POSITION_REACHED] = 'S'
104
+
105
+ end
106
+
107
+ # Returns the position of the linear potentiometer. The value is
108
+ # between 0 (slider down) and 100 (slider up).
109
+ #
110
+ #
111
+ # If you want to get the value periodically, it is recommended to use the
112
+ # CALLBACK_POSITION callback. You can set the callback configuration
113
+ # with BrickletMotorizedLinearPoti#set_position_callback_configuration.
114
+ def get_position
115
+ send_request FUNCTION_GET_POSITION, [], '', 2, 'S'
116
+ end
117
+
118
+ # The period in ms is the period with which the CALLBACK_POSITION callback is triggered
119
+ # periodically. A value of 0 turns the callback off.
120
+ #
121
+ # If the `value has to change`-parameter is set to true, the callback is only
122
+ # triggered after the value has changed. If the value didn't change
123
+ # within the period, the callback is triggered immediately on change.
124
+ #
125
+ # If it is set to false, the callback is continuously triggered with the period,
126
+ # independent of the value.
127
+ #
128
+ # It is furthermore possible to constrain the callback with thresholds.
129
+ #
130
+ # The `option`-parameter together with min/max sets a threshold for the CALLBACK_POSITION callback.
131
+ #
132
+ # The following options are possible:
133
+ #
134
+ # "Option", "Description"
135
+ #
136
+ # "'x'", "Threshold is turned off"
137
+ # "'o'", "Threshold is triggered when the value is *outside* the min and max values"
138
+ # "'i'", "Threshold is triggered when the value is *inside* the min and max values"
139
+ # "'<'", "Threshold is triggered when the value is smaller than the min value (max is ignored)"
140
+ # "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
141
+ #
142
+ #
143
+ # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
144
+ #
145
+ # The default value is (0, false, 'x', 0, 0).
146
+ def set_position_callback_configuration(period, value_has_to_change, option, min, max)
147
+ send_request FUNCTION_SET_POSITION_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k S S', 0, ''
148
+ end
149
+
150
+ # Returns the callback configuration as set by BrickletMotorizedLinearPoti#set_position_callback_configuration.
151
+ def get_position_callback_configuration
152
+ send_request FUNCTION_GET_POSITION_CALLBACK_CONFIGURATION, [], '', 10, 'L ? k S S'
153
+ end
154
+
155
+ # Sets the position of the potentiometer. The motorized potentiometer will
156
+ # immediately start to approach the position. Depending on the chosen drive mode,
157
+ # the position will either be reached as fast as possible or in a slow but smooth
158
+ # motion.
159
+ #
160
+ # The position has to be between 0 (slider down) and 100 (slider up).
161
+ #
162
+ # If you set the hold position parameter to true, the position will automatically
163
+ # be retained. If a user changes the position of the potentiometer, it will
164
+ # automatically drive back to the original set point.
165
+ #
166
+ # If the hold position parameter is set to false, the potentiometer can be changed
167
+ # again by the user as soon as the set point was reached once.
168
+ def set_motor_position(position, drive_mode, hold_position)
169
+ send_request FUNCTION_SET_MOTOR_POSITION, [position, drive_mode, hold_position], 'S C ?', 0, ''
170
+ end
171
+
172
+ # Returns the last motor position as set by BrickletMotorizedLinearPoti#set_motor_position. This is not
173
+ # the current position (use BrickletMotorizedLinearPoti#get_position to get the current position). This
174
+ # is the last used set point and configuration.
175
+ #
176
+ # The position reached parameter is true if the position has been reached at one point.
177
+ # The position may have been changed again in the meantime by the user.
178
+ def get_motor_position
179
+ send_request FUNCTION_GET_MOTOR_POSITION, [], '', 5, 'S C ? ?'
180
+ end
181
+
182
+ # Starts a calibration procedure. The potentiometer will be driven to the extreme
183
+ # points to calibrate the potentiometer.
184
+ #
185
+ # The calibration is saved in flash, it does not have to be called on every start up.
186
+ #
187
+ # The Motorized Linear Poti Bricklet is already factory-calibrated during
188
+ # testing at Tinkerforge.
189
+ def calibrate
190
+ send_request FUNCTION_CALIBRATE, [], '', 0, ''
191
+ end
192
+
193
+ # Enables/Disables CALLBACK_POSITION_REACHED callback.
194
+ #
195
+ # By default the callback is enabled.
196
+ def set_position_reached_callback_configuration(enabled)
197
+ send_request FUNCTION_SET_POSITION_REACHED_CALLBACK_CONFIGURATION, [enabled], '?', 0, ''
198
+ end
199
+
200
+ # Returns the CALLBACK_POSITION_REACHED callback configuration
201
+ # as set by BrickletMotorizedLinearPoti#set_position_reached_callback_configuration.
202
+ def get_position_reached_callback_configuration
203
+ send_request FUNCTION_GET_POSITION_REACHED_CALLBACK_CONFIGURATION, [], '', 1, '?'
204
+ end
205
+
206
+ # Returns the error count for the communication between Brick and Bricklet.
207
+ #
208
+ # The errors are divided into
209
+ #
210
+ # * ack checksum errors,
211
+ # * message checksum errors,
212
+ # * frameing errors and
213
+ # * overflow errors.
214
+ #
215
+ # The errors counts are for errors that occur on the Bricklet side. All
216
+ # Bricks have a similar function that returns the errors on the Brick side.
217
+ def get_spitfp_error_count
218
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
219
+ end
220
+
221
+ # Sets the bootloader mode and returns the status after the requested
222
+ # mode change was instigated.
223
+ #
224
+ # You can change from bootloader mode to firmware mode and vice versa. A change
225
+ # from bootloader mode to firmware mode will only take place if the entry function,
226
+ # device identifier und crc are present and correct.
227
+ #
228
+ # This function is used by Brick Viewer during flashing. It should not be
229
+ # necessary to call it in a normal user program.
230
+ def set_bootloader_mode(mode)
231
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
232
+ end
233
+
234
+ # Returns the current bootloader mode, see BrickletMotorizedLinearPoti#set_bootloader_mode.
235
+ def get_bootloader_mode
236
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
237
+ end
238
+
239
+ # Sets the firmware pointer for BrickletMotorizedLinearPoti#write_firmware. The pointer has
240
+ # to be increased by chunks of size 64. The data is written to flash
241
+ # every 4 chunks (which equals to one page of size 256).
242
+ #
243
+ # This function is used by Brick Viewer during flashing. It should not be
244
+ # necessary to call it in a normal user program.
245
+ def set_write_firmware_pointer(pointer)
246
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
247
+ end
248
+
249
+ # Writes 64 Bytes of firmware at the position as written by
250
+ # BrickletMotorizedLinearPoti#set_write_firmware_pointer before. The firmware is written
251
+ # to flash every 4 chunks.
252
+ #
253
+ # You can only write firmware in bootloader mode.
254
+ #
255
+ # This function is used by Brick Viewer during flashing. It should not be
256
+ # necessary to call it in a normal user program.
257
+ def write_firmware(data)
258
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
259
+ end
260
+
261
+ # Sets the status LED configuration. By default the LED shows
262
+ # communication traffic between Brick and Bricklet, it flickers once
263
+ # for every 10 received data packets.
264
+ #
265
+ # You can also turn the LED permanently on/off or show a heartbeat.
266
+ #
267
+ # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
268
+ def set_status_led_config(config)
269
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
270
+ end
271
+
272
+ # Returns the configuration as set by BrickletMotorizedLinearPoti#set_status_led_config
273
+ def get_status_led_config
274
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
275
+ end
276
+
277
+ # Returns the temperature in °C as measured inside the microcontroller. The
278
+ # value returned is not the ambient temperature!
279
+ #
280
+ # The temperature is only proportional to the real temperature and it has bad
281
+ # accuracy. Practically it is only useful as an indicator for
282
+ # temperature changes.
283
+ def get_chip_temperature
284
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
285
+ end
286
+
287
+ # Calling this function will reset the Bricklet. All configurations
288
+ # will be lost.
289
+ #
290
+ # After a reset you have to create new device objects,
291
+ # calling functions on the existing ones will result in
292
+ # undefined behavior!
293
+ def reset
294
+ send_request FUNCTION_RESET, [], '', 0, ''
295
+ end
296
+
297
+ # Writes a new UID into flash. If you want to set a new UID
298
+ # you have to decode the Base58 encoded UID string into an
299
+ # integer first.
300
+ #
301
+ # We recommend that you use Brick Viewer to change the UID.
302
+ def write_uid(uid)
303
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
304
+ end
305
+
306
+ # Returns the current UID as an integer. Encode as
307
+ # Base58 to get the usual string version.
308
+ def read_uid
309
+ send_request FUNCTION_READ_UID, [], '', 4, 'L'
310
+ end
311
+
312
+ # Returns the UID, the UID where the Bricklet is connected to,
313
+ # the position, the hardware and firmware version as well as the
314
+ # device identifier.
315
+ #
316
+ # The position can be 'a', 'b', 'c' or 'd'.
317
+ #
318
+ # The device identifier numbers can be found :ref:`here <device_identifier>`.
319
+ # |device_identifier_constant|
320
+ def get_identity
321
+ send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
322
+ end
323
+
324
+ # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
325
+ def register_callback(id, &block)
326
+ callback = block
327
+ @registered_callbacks[id] = callback
328
+ end
329
+ end
330
+ end