tinkerforge 2.1.16 → 2.1.17
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 +4 -4
- data/lib/tinkerforge/brick_dc.rb +3 -3
- data/lib/tinkerforge/brick_imu.rb +3 -3
- data/lib/tinkerforge/brick_imu_v2.rb +3 -3
- data/lib/tinkerforge/brick_master.rb +3 -3
- data/lib/tinkerforge/brick_red.rb +2 -2
- data/lib/tinkerforge/brick_servo.rb +3 -3
- data/lib/tinkerforge/brick_silent_stepper.rb +3 -3
- data/lib/tinkerforge/brick_stepper.rb +3 -3
- 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_in_v3.rb +5 -6
- 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 +3 -3
- data/lib/tinkerforge/bricklet_can_v2.rb +770 -0
- 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_dmx.rb +3 -3
- 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 +3 -3
- data/lib/tinkerforge/bricklet_hall_effect.rb +2 -2
- data/lib/tinkerforge/bricklet_humidity.rb +2 -2
- data/lib/tinkerforge/bricklet_humidity_v2.rb +11 -13
- data/lib/tinkerforge/bricklet_industrial_analog_out.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_counter.rb +445 -0
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +342 -0
- 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_dual_relay.rb +263 -0
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +281 -0
- data/lib/tinkerforge/bricklet_io16.rb +2 -2
- data/lib/tinkerforge/bricklet_io4.rb +2 -2
- data/lib/tinkerforge/bricklet_io4_v2.rb +437 -0
- 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 +3 -3
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +3 -3
- data/lib/tinkerforge/bricklet_led_strip.rb +2 -2
- data/lib/tinkerforge/bricklet_led_strip_v2.rb +493 -0
- 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_load_cell_v2.rb +354 -0
- data/lib/tinkerforge/bricklet_moisture.rb +2 -2
- data/lib/tinkerforge/bricklet_motion_detector.rb +3 -3
- data/lib/tinkerforge/bricklet_motion_detector_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +5 -6
- data/lib/tinkerforge/bricklet_multi_touch.rb +2 -2
- data/lib/tinkerforge/bricklet_nfc.rb +39 -3
- data/lib/tinkerforge/bricklet_nfc_rfid.rb +2 -2
- data/lib/tinkerforge/bricklet_oled_128x64.rb +2 -2
- data/lib/tinkerforge/bricklet_oled_64x48.rb +2 -2
- data/lib/tinkerforge/bricklet_outdoor_weather.rb +2 -2
- data/lib/tinkerforge/bricklet_particulate_matter.rb +320 -0
- data/lib/tinkerforge/bricklet_piezo_buzzer.rb +2 -2
- data/lib/tinkerforge/bricklet_piezo_speaker.rb +2 -2
- data/lib/tinkerforge/bricklet_ptc.rb +33 -3
- data/lib/tinkerforge/bricklet_ptc_v2.rb +433 -0
- data/lib/tinkerforge/bricklet_real_time_clock.rb +2 -2
- data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +353 -0
- data/lib/tinkerforge/bricklet_remote_switch.rb +2 -2
- data/lib/tinkerforge/bricklet_remote_switch_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_rgb_led.rb +2 -2
- data/lib/tinkerforge/bricklet_rgb_led_button.rb +2 -2
- data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +2 -2
- data/lib/tinkerforge/bricklet_rotary_encoder.rb +2 -2
- data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +8 -9
- data/lib/tinkerforge/bricklet_rotary_poti.rb +2 -2
- data/lib/tinkerforge/bricklet_rs232.rb +3 -3
- data/lib/tinkerforge/bricklet_rs232_v2.rb +421 -0
- data/lib/tinkerforge/bricklet_rs485.rb +6 -6
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +2 -2
- data/lib/tinkerforge/bricklet_solid_state_relay.rb +2 -2
- data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +3 -3
- data/lib/tinkerforge/bricklet_sound_intensity.rb +2 -2
- data/lib/tinkerforge/bricklet_sound_pressure_level.rb +420 -0
- data/lib/tinkerforge/bricklet_temperature.rb +3 -3
- data/lib/tinkerforge/bricklet_temperature_ir.rb +2 -2
- data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +13 -15
- data/lib/tinkerforge/bricklet_thermal_imaging.rb +2 -2
- data/lib/tinkerforge/bricklet_thermocouple.rb +4 -4
- data/lib/tinkerforge/bricklet_thermocouple_v2.rb +340 -0
- 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/bricklet_voltage_current_v2.rb +453 -0
- data/lib/tinkerforge/ip_connection.rb +4 -4
- data/lib/tinkerforge/version.rb +1 -1
- metadata +17 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2018-
|
|
3
|
+
# This file was automatically generated on 2018-06-08. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.17 #
|
|
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 2018-
|
|
3
|
+
# This file was automatically generated on 2018-06-08. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.17 #
|
|
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 2018-
|
|
3
|
+
# This file was automatically generated on 2018-06-08. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.17 #
|
|
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 2018-
|
|
3
|
+
# This file was automatically generated on 2018-06-08. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.17 #
|
|
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 2018-
|
|
3
|
+
# This file was automatically generated on 2018-06-08. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.17 #
|
|
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 2018-
|
|
3
|
+
# This file was automatically generated on 2018-06-08. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.17 #
|
|
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 2018-
|
|
3
|
+
# This file was automatically generated on 2018-06-08. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.17 #
|
|
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 #
|
|
@@ -163,7 +163,7 @@ module Tinkerforge
|
|
|
163
163
|
send_request FUNCTION_SET_DMX_MODE, [dmx_mode], 'C', 0, ''
|
|
164
164
|
end
|
|
165
165
|
|
|
166
|
-
# Returns the DMX mode, as set by
|
|
166
|
+
# Returns the DMX mode, as set by BrickletDMX#set_dmx_mode.
|
|
167
167
|
def get_dmx_mode
|
|
168
168
|
send_request FUNCTION_GET_DMX_MODE, [], '', 1, 'C'
|
|
169
169
|
end
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2018-
|
|
3
|
+
# This file was automatically generated on 2018-06-08. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.17 #
|
|
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 2018-
|
|
3
|
+
# This file was automatically generated on 2018-06-08. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.17 #
|
|
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 2018-
|
|
3
|
+
# This file was automatically generated on 2018-06-08. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.17 #
|
|
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 2018-
|
|
3
|
+
# This file was automatically generated on 2018-06-08. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.17 #
|
|
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 2018-
|
|
3
|
+
# This file was automatically generated on 2018-06-08. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.17 #
|
|
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 #
|
|
@@ -140,7 +140,7 @@ module Tinkerforge
|
|
|
140
140
|
def initialize(uid, ipcon)
|
|
141
141
|
super uid, ipcon
|
|
142
142
|
|
|
143
|
-
@api_version = [2, 0,
|
|
143
|
+
@api_version = [2, 0, 1]
|
|
144
144
|
|
|
145
145
|
@response_expected[FUNCTION_GET_COORDINATES] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
146
146
|
@response_expected[FUNCTION_GET_STATUS] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2018-
|
|
3
|
+
# This file was automatically generated on 2018-06-08. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.17 #
|
|
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 2018-
|
|
3
|
+
# This file was automatically generated on 2018-06-08. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.17 #
|
|
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 2018-
|
|
3
|
+
# This file was automatically generated on 2018-06-08. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.17 #
|
|
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 #
|
|
@@ -16,15 +16,15 @@ module Tinkerforge
|
|
|
16
16
|
DEVICE_DISPLAY_NAME = 'Humidity Bricklet 2.0' # :nodoc:
|
|
17
17
|
|
|
18
18
|
# This callback is triggered periodically according to the configuration set by
|
|
19
|
-
# BrickletHumidityV2#set_humidity_callback_configuration.
|
|
19
|
+
# BrickletHumidityV2#set_humidity_callback_configuration.
|
|
20
20
|
#
|
|
21
|
-
# The
|
|
21
|
+
# The parameter is the same as BrickletHumidityV2#get_humidity.
|
|
22
22
|
CALLBACK_HUMIDITY = 4
|
|
23
23
|
|
|
24
24
|
# This callback is triggered periodically according to the configuration set by
|
|
25
|
-
# BrickletHumidityV2#set_temperature_callback_configuration.
|
|
25
|
+
# BrickletHumidityV2#set_temperature_callback_configuration.
|
|
26
26
|
#
|
|
27
|
-
# The
|
|
27
|
+
# The parameter is the same as BrickletHumidityV2#get_temperature.
|
|
28
28
|
CALLBACK_TEMPERATURE = 8
|
|
29
29
|
|
|
30
30
|
FUNCTION_GET_HUMIDITY = 1 # :nodoc:
|
|
@@ -78,7 +78,7 @@ module Tinkerforge
|
|
|
78
78
|
def initialize(uid, ipcon)
|
|
79
79
|
super uid, ipcon
|
|
80
80
|
|
|
81
|
-
@api_version = [2, 0,
|
|
81
|
+
@api_version = [2, 0, 1]
|
|
82
82
|
|
|
83
83
|
@response_expected[FUNCTION_GET_HUMIDITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
84
84
|
@response_expected[FUNCTION_SET_HUMIDITY_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
|
|
@@ -140,11 +140,10 @@ module Tinkerforge
|
|
|
140
140
|
#
|
|
141
141
|
# "'x'", "Threshold is turned off"
|
|
142
142
|
# "'o'", "Threshold is triggered when the value is *outside* the min and max values"
|
|
143
|
-
# "'i'", "Threshold is triggered when the value is *inside* the min and max values"
|
|
143
|
+
# "'i'", "Threshold is triggered when the value is *inside* or equal to the min and max values"
|
|
144
144
|
# "'<'", "Threshold is triggered when the value is smaller than the min value (max is ignored)"
|
|
145
145
|
# "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
|
|
146
146
|
#
|
|
147
|
-
#
|
|
148
147
|
# If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
|
|
149
148
|
#
|
|
150
149
|
# The default value is (0, false, 'x', 0, 0).
|
|
@@ -189,21 +188,20 @@ module Tinkerforge
|
|
|
189
188
|
#
|
|
190
189
|
# "'x'", "Threshold is turned off"
|
|
191
190
|
# "'o'", "Threshold is triggered when the value is *outside* the min and max values"
|
|
192
|
-
# "'i'", "Threshold is triggered when the value is *inside* the min and max values"
|
|
191
|
+
# "'i'", "Threshold is triggered when the value is *inside* or equal to the min and max values"
|
|
193
192
|
# "'<'", "Threshold is triggered when the value is smaller than the min value (max is ignored)"
|
|
194
193
|
# "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
|
|
195
194
|
#
|
|
196
|
-
#
|
|
197
195
|
# If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
|
|
198
196
|
#
|
|
199
197
|
# The default value is (0, false, 'x', 0, 0).
|
|
200
198
|
def set_temperature_callback_configuration(period, value_has_to_change, option, min, max)
|
|
201
|
-
send_request FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k
|
|
199
|
+
send_request FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k s s', 0, ''
|
|
202
200
|
end
|
|
203
201
|
|
|
204
202
|
# Returns the callback configuration as set by BrickletHumidityV2#set_temperature_callback_configuration.
|
|
205
203
|
def get_temperature_callback_configuration
|
|
206
|
-
send_request FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 10, 'L ? k
|
|
204
|
+
send_request FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 10, 'L ? k s s'
|
|
207
205
|
end
|
|
208
206
|
|
|
209
207
|
# Enables/disables the heater. The heater can be used to dry the sensor in
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2018-
|
|
3
|
+
# This file was automatically generated on 2018-06-08. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.17 #
|
|
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,445 @@
|
|
|
1
|
+
# -*- ruby encoding: utf-8 -*-
|
|
2
|
+
#############################################################
|
|
3
|
+
# This file was automatically generated on 2018-06-08. #
|
|
4
|
+
# #
|
|
5
|
+
# Ruby Bindings Version 2.1.17 #
|
|
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
|
+
# 4 channel counter up to 4MHz
|
|
14
|
+
class BrickletIndustrialCounter < Device
|
|
15
|
+
DEVICE_IDENTIFIER = 293 # :nodoc:
|
|
16
|
+
DEVICE_DISPLAY_NAME = 'Industrial Counter Bricklet' # :nodoc:
|
|
17
|
+
|
|
18
|
+
# This callback is triggered periodically according to the configuration set by
|
|
19
|
+
# BrickletIndustrialCounter#set_all_counter_callback_configuration.
|
|
20
|
+
#
|
|
21
|
+
# The parameters are the same as BrickletIndustrialCounter#get_all_counter.
|
|
22
|
+
CALLBACK_ALL_COUNTER = 19
|
|
23
|
+
|
|
24
|
+
# This callback is triggered periodically according to the configuration set by
|
|
25
|
+
# BrickletIndustrialCounter#set_all_signal_data_callback_configuration.
|
|
26
|
+
#
|
|
27
|
+
# The parameters are the same as BrickletIndustrialCounter#get_all_signal_data.
|
|
28
|
+
CALLBACK_ALL_SIGNAL_DATA = 20
|
|
29
|
+
|
|
30
|
+
FUNCTION_GET_COUNTER = 1 # :nodoc:
|
|
31
|
+
FUNCTION_GET_ALL_COUNTER = 2 # :nodoc:
|
|
32
|
+
FUNCTION_SET_COUNTER = 3 # :nodoc:
|
|
33
|
+
FUNCTION_SET_ALL_COUNTER = 4 # :nodoc:
|
|
34
|
+
FUNCTION_GET_SIGNAL_DATA = 5 # :nodoc:
|
|
35
|
+
FUNCTION_GET_ALL_SIGNAL_DATA = 6 # :nodoc:
|
|
36
|
+
FUNCTION_SET_COUNTER_ACTIVE = 7 # :nodoc:
|
|
37
|
+
FUNCTION_SET_ALL_COUNTER_ACTIVE = 8 # :nodoc:
|
|
38
|
+
FUNCTION_GET_COUNTER_ACTIVE = 9 # :nodoc:
|
|
39
|
+
FUNCTION_GET_ALL_COUNTER_ACTIVE = 10 # :nodoc:
|
|
40
|
+
FUNCTION_SET_COUNTER_CONFIGURATION = 11 # :nodoc:
|
|
41
|
+
FUNCTION_GET_COUNTER_CONFIGURATION = 12 # :nodoc:
|
|
42
|
+
FUNCTION_SET_ALL_COUNTER_CALLBACK_CONFIGURATION = 13 # :nodoc:
|
|
43
|
+
FUNCTION_GET_ALL_COUNTER_CALLBACK_CONFIGURATION = 14 # :nodoc:
|
|
44
|
+
FUNCTION_SET_ALL_SIGNAL_DATA_CALLBACK_CONFIGURATION = 15 # :nodoc:
|
|
45
|
+
FUNCTION_GET_ALL_SIGNAL_DATA_CALLBACK_CONFIGURATION = 16 # :nodoc:
|
|
46
|
+
FUNCTION_SET_CHANNEL_LED_CONFIG = 17 # :nodoc:
|
|
47
|
+
FUNCTION_GET_CHANNEL_LED_CONFIG = 18 # :nodoc:
|
|
48
|
+
FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
|
|
49
|
+
FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
|
|
50
|
+
FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
|
|
51
|
+
FUNCTION_SET_WRITE_FIRMWARE_POINTER = 237 # :nodoc:
|
|
52
|
+
FUNCTION_WRITE_FIRMWARE = 238 # :nodoc:
|
|
53
|
+
FUNCTION_SET_STATUS_LED_CONFIG = 239 # :nodoc:
|
|
54
|
+
FUNCTION_GET_STATUS_LED_CONFIG = 240 # :nodoc:
|
|
55
|
+
FUNCTION_GET_CHIP_TEMPERATURE = 242 # :nodoc:
|
|
56
|
+
FUNCTION_RESET = 243 # :nodoc:
|
|
57
|
+
FUNCTION_WRITE_UID = 248 # :nodoc:
|
|
58
|
+
FUNCTION_READ_UID = 249 # :nodoc:
|
|
59
|
+
FUNCTION_GET_IDENTITY = 255 # :nodoc:
|
|
60
|
+
|
|
61
|
+
CHANNEL_0 = 0 # :nodoc:
|
|
62
|
+
CHANNEL_1 = 1 # :nodoc:
|
|
63
|
+
CHANNEL_2 = 2 # :nodoc:
|
|
64
|
+
CHANNEL_3 = 3 # :nodoc:
|
|
65
|
+
COUNT_EDGE_RISING = 0 # :nodoc:
|
|
66
|
+
COUNT_EDGE_FALLING = 1 # :nodoc:
|
|
67
|
+
COUNT_EDGE_BOTH = 2 # :nodoc:
|
|
68
|
+
COUNT_DIRECTION_UP = 0 # :nodoc:
|
|
69
|
+
COUNT_DIRECTION_DOWN = 1 # :nodoc:
|
|
70
|
+
COUNT_DIRECTION_EXTERNAL_UP = 2 # :nodoc:
|
|
71
|
+
COUNT_DIRECTION_EXTERNAL_DOWN = 3 # :nodoc:
|
|
72
|
+
DUTY_CYCLE_PRESCALER_1 = 0 # :nodoc:
|
|
73
|
+
DUTY_CYCLE_PRESCALER_2 = 1 # :nodoc:
|
|
74
|
+
DUTY_CYCLE_PRESCALER_4 = 2 # :nodoc:
|
|
75
|
+
DUTY_CYCLE_PRESCALER_8 = 3 # :nodoc:
|
|
76
|
+
DUTY_CYCLE_PRESCALER_16 = 4 # :nodoc:
|
|
77
|
+
DUTY_CYCLE_PRESCALER_32 = 5 # :nodoc:
|
|
78
|
+
DUTY_CYCLE_PRESCALER_64 = 6 # :nodoc:
|
|
79
|
+
DUTY_CYCLE_PRESCALER_128 = 7 # :nodoc:
|
|
80
|
+
DUTY_CYCLE_PRESCALER_256 = 8 # :nodoc:
|
|
81
|
+
DUTY_CYCLE_PRESCALER_512 = 9 # :nodoc:
|
|
82
|
+
DUTY_CYCLE_PRESCALER_1024 = 10 # :nodoc:
|
|
83
|
+
DUTY_CYCLE_PRESCALER_2048 = 11 # :nodoc:
|
|
84
|
+
DUTY_CYCLE_PRESCALER_4096 = 12 # :nodoc:
|
|
85
|
+
DUTY_CYCLE_PRESCALER_8192 = 13 # :nodoc:
|
|
86
|
+
DUTY_CYCLE_PRESCALER_16384 = 14 # :nodoc:
|
|
87
|
+
DUTY_CYCLE_PRESCALER_32768 = 15 # :nodoc:
|
|
88
|
+
FREQUENCY_INTEGRATION_TIME_128_MS = 0 # :nodoc:
|
|
89
|
+
FREQUENCY_INTEGRATION_TIME_256_MS = 1 # :nodoc:
|
|
90
|
+
FREQUENCY_INTEGRATION_TIME_512_MS = 2 # :nodoc:
|
|
91
|
+
FREQUENCY_INTEGRATION_TIME_1024_MS = 3 # :nodoc:
|
|
92
|
+
FREQUENCY_INTEGRATION_TIME_2048_MS = 4 # :nodoc:
|
|
93
|
+
FREQUENCY_INTEGRATION_TIME_4096_MS = 5 # :nodoc:
|
|
94
|
+
FREQUENCY_INTEGRATION_TIME_8192_MS = 6 # :nodoc:
|
|
95
|
+
FREQUENCY_INTEGRATION_TIME_16384_MS = 7 # :nodoc:
|
|
96
|
+
FREQUENCY_INTEGRATION_TIME_32768_MS = 8 # :nodoc:
|
|
97
|
+
CHANNEL_LED_CONFIG_OFF = 0 # :nodoc:
|
|
98
|
+
CHANNEL_LED_CONFIG_ON = 1 # :nodoc:
|
|
99
|
+
CHANNEL_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
|
|
100
|
+
CHANNEL_LED_CONFIG_SHOW_CHANNEL_STATUS = 3 # :nodoc:
|
|
101
|
+
BOOTLOADER_MODE_BOOTLOADER = 0 # :nodoc:
|
|
102
|
+
BOOTLOADER_MODE_FIRMWARE = 1 # :nodoc:
|
|
103
|
+
BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT = 2 # :nodoc:
|
|
104
|
+
BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT = 3 # :nodoc:
|
|
105
|
+
BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT = 4 # :nodoc:
|
|
106
|
+
BOOTLOADER_STATUS_OK = 0 # :nodoc:
|
|
107
|
+
BOOTLOADER_STATUS_INVALID_MODE = 1 # :nodoc:
|
|
108
|
+
BOOTLOADER_STATUS_NO_CHANGE = 2 # :nodoc:
|
|
109
|
+
BOOTLOADER_STATUS_ENTRY_FUNCTION_NOT_PRESENT = 3 # :nodoc:
|
|
110
|
+
BOOTLOADER_STATUS_DEVICE_IDENTIFIER_INCORRECT = 4 # :nodoc:
|
|
111
|
+
BOOTLOADER_STATUS_CRC_MISMATCH = 5 # :nodoc:
|
|
112
|
+
STATUS_LED_CONFIG_OFF = 0 # :nodoc:
|
|
113
|
+
STATUS_LED_CONFIG_ON = 1 # :nodoc:
|
|
114
|
+
STATUS_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
|
|
115
|
+
STATUS_LED_CONFIG_SHOW_STATUS = 3 # :nodoc:
|
|
116
|
+
|
|
117
|
+
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
118
|
+
# the IP Connection <tt>ipcon</tt>.
|
|
119
|
+
def initialize(uid, ipcon)
|
|
120
|
+
super uid, ipcon
|
|
121
|
+
|
|
122
|
+
@api_version = [2, 0, 0]
|
|
123
|
+
|
|
124
|
+
@response_expected[FUNCTION_GET_COUNTER] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
125
|
+
@response_expected[FUNCTION_GET_ALL_COUNTER] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
126
|
+
@response_expected[FUNCTION_SET_COUNTER] = RESPONSE_EXPECTED_FALSE
|
|
127
|
+
@response_expected[FUNCTION_SET_ALL_COUNTER] = RESPONSE_EXPECTED_FALSE
|
|
128
|
+
@response_expected[FUNCTION_GET_SIGNAL_DATA] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
129
|
+
@response_expected[FUNCTION_GET_ALL_SIGNAL_DATA] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
130
|
+
@response_expected[FUNCTION_SET_COUNTER_ACTIVE] = RESPONSE_EXPECTED_FALSE
|
|
131
|
+
@response_expected[FUNCTION_SET_ALL_COUNTER_ACTIVE] = RESPONSE_EXPECTED_FALSE
|
|
132
|
+
@response_expected[FUNCTION_GET_COUNTER_ACTIVE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
133
|
+
@response_expected[FUNCTION_GET_ALL_COUNTER_ACTIVE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
134
|
+
@response_expected[FUNCTION_SET_COUNTER_CONFIGURATION] = RESPONSE_EXPECTED_FALSE
|
|
135
|
+
@response_expected[FUNCTION_GET_COUNTER_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
136
|
+
@response_expected[FUNCTION_SET_ALL_COUNTER_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
|
|
137
|
+
@response_expected[FUNCTION_GET_ALL_COUNTER_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
138
|
+
@response_expected[FUNCTION_SET_ALL_SIGNAL_DATA_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
|
|
139
|
+
@response_expected[FUNCTION_GET_ALL_SIGNAL_DATA_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
140
|
+
@response_expected[FUNCTION_SET_CHANNEL_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
|
|
141
|
+
@response_expected[FUNCTION_GET_CHANNEL_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
142
|
+
@response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
143
|
+
@response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
144
|
+
@response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
145
|
+
@response_expected[FUNCTION_SET_WRITE_FIRMWARE_POINTER] = RESPONSE_EXPECTED_FALSE
|
|
146
|
+
@response_expected[FUNCTION_WRITE_FIRMWARE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
147
|
+
@response_expected[FUNCTION_SET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
|
|
148
|
+
@response_expected[FUNCTION_GET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
149
|
+
@response_expected[FUNCTION_GET_CHIP_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
150
|
+
@response_expected[FUNCTION_RESET] = RESPONSE_EXPECTED_FALSE
|
|
151
|
+
@response_expected[FUNCTION_WRITE_UID] = RESPONSE_EXPECTED_FALSE
|
|
152
|
+
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
153
|
+
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
154
|
+
|
|
155
|
+
@callback_formats[CALLBACK_ALL_COUNTER] = 'q4'
|
|
156
|
+
@callback_formats[CALLBACK_ALL_SIGNAL_DATA] = 'S4 Q4 L4 ?4'
|
|
157
|
+
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
# Returns the current counter value for the given channel.
|
|
161
|
+
def get_counter(channel)
|
|
162
|
+
send_request FUNCTION_GET_COUNTER, [channel], 'C', 8, 'q'
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
# Returns the current counter values for all four channels.
|
|
166
|
+
def get_all_counter
|
|
167
|
+
send_request FUNCTION_GET_ALL_COUNTER, [], '', 32, 'q4'
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
# Sets the counter value for the given channel.
|
|
171
|
+
#
|
|
172
|
+
# The default value for the counters on startup is 0.
|
|
173
|
+
def set_counter(channel, counter)
|
|
174
|
+
send_request FUNCTION_SET_COUNTER, [channel, counter], 'C q', 0, ''
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
# Sets the counter values for all four channels.
|
|
178
|
+
#
|
|
179
|
+
# The default value for the counters on startup is 0.
|
|
180
|
+
def set_all_counter(counter)
|
|
181
|
+
send_request FUNCTION_SET_ALL_COUNTER, [counter], 'q4', 0, ''
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
# Returns the signal data (duty cycle, period, frequency and value) for the
|
|
185
|
+
# given channel.
|
|
186
|
+
#
|
|
187
|
+
# The units are:
|
|
188
|
+
#
|
|
189
|
+
# * Duty Cycle: 1/100 %
|
|
190
|
+
# * Period: ns
|
|
191
|
+
# * Frequency: mHz (1/1000 Hz)
|
|
192
|
+
# * Value: true = high, false = low
|
|
193
|
+
def get_signal_data(channel)
|
|
194
|
+
send_request FUNCTION_GET_SIGNAL_DATA, [channel], 'C', 15, 'S Q L ?'
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
# Returns the signal data (duty cycle, period, frequency and value) for all four
|
|
198
|
+
# channels.
|
|
199
|
+
#
|
|
200
|
+
# The units are:
|
|
201
|
+
#
|
|
202
|
+
# * Duty Cycle: 1/100 %
|
|
203
|
+
# * Period: ns
|
|
204
|
+
# * Frequency: mHz (1/1000 Hz)
|
|
205
|
+
# * Value: true = high, false = low
|
|
206
|
+
def get_all_signal_data
|
|
207
|
+
send_request FUNCTION_GET_ALL_SIGNAL_DATA, [], '', 60, 'S4 Q4 L4 ?4'
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
# Activates/deactivates the counter of the given channel.
|
|
211
|
+
#
|
|
212
|
+
# true = activate, false = deactivate.
|
|
213
|
+
#
|
|
214
|
+
# By default all channels are activated.
|
|
215
|
+
def set_counter_active(channel, active)
|
|
216
|
+
send_request FUNCTION_SET_COUNTER_ACTIVE, [channel, active], 'C ?', 0, ''
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
# Activates/deactivates the counter of all four channels.
|
|
220
|
+
#
|
|
221
|
+
# true = activate, false = deactivate.
|
|
222
|
+
#
|
|
223
|
+
# By default all channels are activated.
|
|
224
|
+
def set_all_counter_active(active)
|
|
225
|
+
send_request FUNCTION_SET_ALL_COUNTER_ACTIVE, [active], '?4', 0, ''
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
# Returns the activation state of the given channel.
|
|
229
|
+
#
|
|
230
|
+
# true = activated, false = deactivated.
|
|
231
|
+
def get_counter_active(channel)
|
|
232
|
+
send_request FUNCTION_GET_COUNTER_ACTIVE, [channel], 'C', 1, '?'
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
# Returns the activation state of all four channels.
|
|
236
|
+
#
|
|
237
|
+
# true = activated, false = deactivated.
|
|
238
|
+
def get_all_counter_active
|
|
239
|
+
send_request FUNCTION_GET_ALL_COUNTER_ACTIVE, [], '', 4, '?4'
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
# Sets the counter configuration for the given channel.
|
|
243
|
+
#
|
|
244
|
+
# * Count Edge: Counter can count on rising, falling or both edges.
|
|
245
|
+
# * Count Direction: Counter can count up or down. You can also use
|
|
246
|
+
# another channel as direction input, see
|
|
247
|
+
# `here <https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Industrial_Counter.html#external-count-direction>`__
|
|
248
|
+
# for details.
|
|
249
|
+
# * Duty Cycle Prescaler: Sets a divider for the internal clock. See
|
|
250
|
+
# `here <https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Industrial_Counter.html#duty-cycle-prescaler-and-frequency-integration-time>`__
|
|
251
|
+
# for details.
|
|
252
|
+
# * Frequency Integration Time: Sets the integration time for the
|
|
253
|
+
# frequency measurement. See
|
|
254
|
+
# `here <https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Industrial_Counter.html#duty-cycle-prescaler-and-frequency-integration-time>`__
|
|
255
|
+
# for details.
|
|
256
|
+
def set_counter_configuration(channel, count_edge, count_direction, duty_cycle_prescaler, frequency_integration_time)
|
|
257
|
+
send_request FUNCTION_SET_COUNTER_CONFIGURATION, [channel, count_edge, count_direction, duty_cycle_prescaler, frequency_integration_time], 'C C C C C', 0, ''
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
# Returns the counter configuration as set by BrickletIndustrialCounter#set_counter_configuration.
|
|
261
|
+
def get_counter_configuration(channel)
|
|
262
|
+
send_request FUNCTION_GET_COUNTER_CONFIGURATION, [channel], 'C', 4, 'C C C C'
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
# The period in ms is the period with which the CALLBACK_ALL_COUNTER
|
|
266
|
+
# callback is triggered periodically. A value of 0 turns the callback off.
|
|
267
|
+
#
|
|
268
|
+
# If the `value has to change`-parameter is set to true, the callback is only
|
|
269
|
+
# triggered after the value has changed. If the value didn't change within the
|
|
270
|
+
# period, the callback is triggered immediately on change.
|
|
271
|
+
#
|
|
272
|
+
# If it is set to false, the callback is continuously triggered with the period,
|
|
273
|
+
# independent of the value.
|
|
274
|
+
#
|
|
275
|
+
# The default value is (0, false).
|
|
276
|
+
def set_all_counter_callback_configuration(period, value_has_to_change)
|
|
277
|
+
send_request FUNCTION_SET_ALL_COUNTER_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 0, ''
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
# Returns the callback configuration as set by
|
|
281
|
+
# BrickletIndustrialCounter#set_all_counter_callback_configuration.
|
|
282
|
+
def get_all_counter_callback_configuration
|
|
283
|
+
send_request FUNCTION_GET_ALL_COUNTER_CALLBACK_CONFIGURATION, [], '', 5, 'L ?'
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
# The period in ms is the period with which the CALLBACK_ALL_SIGNAL_DATA
|
|
287
|
+
# callback is triggered periodically. A value of 0 turns the callback off.
|
|
288
|
+
#
|
|
289
|
+
# If the `value has to change`-parameter is set to true, the callback is only
|
|
290
|
+
# triggered after the value has changed. If the value didn't change within the
|
|
291
|
+
# period, the callback is triggered immediately on change.
|
|
292
|
+
#
|
|
293
|
+
# If it is set to false, the callback is continuously triggered with the period,
|
|
294
|
+
# independent of the value.
|
|
295
|
+
#
|
|
296
|
+
# The default value is (0, false).
|
|
297
|
+
def set_all_signal_data_callback_configuration(period, value_has_to_change)
|
|
298
|
+
send_request FUNCTION_SET_ALL_SIGNAL_DATA_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 0, ''
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
# Returns the callback configuration as set by
|
|
302
|
+
# BrickletIndustrialCounter#set_all_signal_data_callback_configuration.
|
|
303
|
+
def get_all_signal_data_callback_configuration
|
|
304
|
+
send_request FUNCTION_GET_ALL_SIGNAL_DATA_CALLBACK_CONFIGURATION, [], '', 5, 'L ?'
|
|
305
|
+
end
|
|
306
|
+
|
|
307
|
+
# Each channel has a corresponding LED. You can turn the LED Off, On or show a
|
|
308
|
+
# heartbeat. You can also set the LED to "Channel Status". In this mode the
|
|
309
|
+
# LED is on if the channel is high and off otherwise.
|
|
310
|
+
#
|
|
311
|
+
# By default all channel LEDs are configured as "Channel Status".
|
|
312
|
+
def set_channel_led_config(channel, config)
|
|
313
|
+
send_request FUNCTION_SET_CHANNEL_LED_CONFIG, [channel, config], 'C C', 0, ''
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
# Returns the Channel LED configuration as set by BrickletIndustrialCounter#set_channel_led_config
|
|
317
|
+
def get_channel_led_config(channel)
|
|
318
|
+
send_request FUNCTION_GET_CHANNEL_LED_CONFIG, [channel], 'C', 1, 'C'
|
|
319
|
+
end
|
|
320
|
+
|
|
321
|
+
# Returns the error count for the communication between Brick and Bricklet.
|
|
322
|
+
#
|
|
323
|
+
# The errors are divided into
|
|
324
|
+
#
|
|
325
|
+
# * ack checksum errors,
|
|
326
|
+
# * message checksum errors,
|
|
327
|
+
# * frameing errors and
|
|
328
|
+
# * overflow errors.
|
|
329
|
+
#
|
|
330
|
+
# The errors counts are for errors that occur on the Bricklet side. All
|
|
331
|
+
# Bricks have a similar function that returns the errors on the Brick side.
|
|
332
|
+
def get_spitfp_error_count
|
|
333
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
|
|
334
|
+
end
|
|
335
|
+
|
|
336
|
+
# Sets the bootloader mode and returns the status after the requested
|
|
337
|
+
# mode change was instigated.
|
|
338
|
+
#
|
|
339
|
+
# You can change from bootloader mode to firmware mode and vice versa. A change
|
|
340
|
+
# from bootloader mode to firmware mode will only take place if the entry function,
|
|
341
|
+
# device identifier und crc are present and correct.
|
|
342
|
+
#
|
|
343
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
|
344
|
+
# necessary to call it in a normal user program.
|
|
345
|
+
def set_bootloader_mode(mode)
|
|
346
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
|
|
347
|
+
end
|
|
348
|
+
|
|
349
|
+
# Returns the current bootloader mode, see BrickletIndustrialCounter#set_bootloader_mode.
|
|
350
|
+
def get_bootloader_mode
|
|
351
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
|
|
352
|
+
end
|
|
353
|
+
|
|
354
|
+
# Sets the firmware pointer for BrickletIndustrialCounter#write_firmware. The pointer has
|
|
355
|
+
# to be increased by chunks of size 64. The data is written to flash
|
|
356
|
+
# every 4 chunks (which equals to one page of size 256).
|
|
357
|
+
#
|
|
358
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
|
359
|
+
# necessary to call it in a normal user program.
|
|
360
|
+
def set_write_firmware_pointer(pointer)
|
|
361
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
|
|
362
|
+
end
|
|
363
|
+
|
|
364
|
+
# Writes 64 Bytes of firmware at the position as written by
|
|
365
|
+
# BrickletIndustrialCounter#set_write_firmware_pointer before. The firmware is written
|
|
366
|
+
# to flash every 4 chunks.
|
|
367
|
+
#
|
|
368
|
+
# You can only write firmware in bootloader mode.
|
|
369
|
+
#
|
|
370
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
|
371
|
+
# necessary to call it in a normal user program.
|
|
372
|
+
def write_firmware(data)
|
|
373
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
|
|
374
|
+
end
|
|
375
|
+
|
|
376
|
+
# Sets the status LED configuration. By default the LED shows
|
|
377
|
+
# communication traffic between Brick and Bricklet, it flickers once
|
|
378
|
+
# for every 10 received data packets.
|
|
379
|
+
#
|
|
380
|
+
# You can also turn the LED permanently on/off or show a heartbeat.
|
|
381
|
+
#
|
|
382
|
+
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
|
383
|
+
def set_status_led_config(config)
|
|
384
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
|
|
385
|
+
end
|
|
386
|
+
|
|
387
|
+
# Returns the configuration as set by BrickletIndustrialCounter#set_status_led_config
|
|
388
|
+
def get_status_led_config
|
|
389
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
|
|
390
|
+
end
|
|
391
|
+
|
|
392
|
+
# Returns the temperature in °C as measured inside the microcontroller. The
|
|
393
|
+
# value returned is not the ambient temperature!
|
|
394
|
+
#
|
|
395
|
+
# The temperature is only proportional to the real temperature and it has bad
|
|
396
|
+
# accuracy. Practically it is only useful as an indicator for
|
|
397
|
+
# temperature changes.
|
|
398
|
+
def get_chip_temperature
|
|
399
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
|
|
400
|
+
end
|
|
401
|
+
|
|
402
|
+
# Calling this function will reset the Bricklet. All configurations
|
|
403
|
+
# will be lost.
|
|
404
|
+
#
|
|
405
|
+
# After a reset you have to create new device objects,
|
|
406
|
+
# calling functions on the existing ones will result in
|
|
407
|
+
# undefined behavior!
|
|
408
|
+
def reset
|
|
409
|
+
send_request FUNCTION_RESET, [], '', 0, ''
|
|
410
|
+
end
|
|
411
|
+
|
|
412
|
+
# Writes a new UID into flash. If you want to set a new UID
|
|
413
|
+
# you have to decode the Base58 encoded UID string into an
|
|
414
|
+
# integer first.
|
|
415
|
+
#
|
|
416
|
+
# We recommend that you use Brick Viewer to change the UID.
|
|
417
|
+
def write_uid(uid)
|
|
418
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
|
|
419
|
+
end
|
|
420
|
+
|
|
421
|
+
# Returns the current UID as an integer. Encode as
|
|
422
|
+
# Base58 to get the usual string version.
|
|
423
|
+
def read_uid
|
|
424
|
+
send_request FUNCTION_READ_UID, [], '', 4, 'L'
|
|
425
|
+
end
|
|
426
|
+
|
|
427
|
+
# Returns the UID, the UID where the Bricklet is connected to,
|
|
428
|
+
# the position, the hardware and firmware version as well as the
|
|
429
|
+
# device identifier.
|
|
430
|
+
#
|
|
431
|
+
# The position can be 'a', 'b', 'c' or 'd'.
|
|
432
|
+
#
|
|
433
|
+
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
434
|
+
# |device_identifier_constant|
|
|
435
|
+
def get_identity
|
|
436
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
|
437
|
+
end
|
|
438
|
+
|
|
439
|
+
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|
|
440
|
+
def register_callback(id, &block)
|
|
441
|
+
callback = block
|
|
442
|
+
@registered_callbacks[id] = callback
|
|
443
|
+
end
|
|
444
|
+
end
|
|
445
|
+
end
|