tinkerforge 2.1.21 → 2.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/lib/tinkerforge/brick_dc.rb +2 -2
- data/lib/tinkerforge/brick_hat.rb +256 -0
- data/lib/tinkerforge/brick_hat_zero.rb +196 -0
- data/lib/tinkerforge/brick_imu.rb +2 -2
- data/lib/tinkerforge/brick_imu_v2.rb +2 -2
- data/lib/tinkerforge/brick_master.rb +12 -9
- 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_accelerometer_v2.rb +16 -6
- data/lib/tinkerforge/bricklet_air_quality.rb +59 -3
- data/lib/tinkerforge/bricklet_ambient_light.rb +2 -2
- data/lib/tinkerforge/bricklet_ambient_light_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_ambient_light_v3.rb +3 -3
- 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 +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_analog_out_v3.rb +2 -2
- data/lib/tinkerforge/bricklet_barometer.rb +2 -2
- data/lib/tinkerforge/bricklet_barometer_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_can.rb +2 -2
- data/lib/tinkerforge/bricklet_can_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_co2.rb +2 -2
- data/lib/tinkerforge/bricklet_co2_v2.rb +479 -0
- 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_ir_v2.rb +3 -3
- data/lib/tinkerforge/bricklet_distance_us.rb +2 -2
- data/lib/tinkerforge/bricklet_dmx.rb +2 -2
- data/lib/tinkerforge/bricklet_dual_button.rb +2 -2
- data/lib/tinkerforge/bricklet_dual_button_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_dual_relay.rb +5 -3
- data/lib/tinkerforge/bricklet_dust_detector.rb +2 -2
- data/lib/tinkerforge/bricklet_e_paper_296x128.rb +600 -0
- data/lib/tinkerforge/bricklet_gps.rb +2 -2
- data/lib/tinkerforge/bricklet_gps_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_hall_effect.rb +2 -2
- data/lib/tinkerforge/bricklet_hall_effect_v2.rb +333 -0
- data/lib/tinkerforge/bricklet_humidity.rb +2 -2
- data/lib/tinkerforge/bricklet_humidity_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_analog_out.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_counter.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +3 -3
- data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +9 -4
- data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +12 -2
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +6 -3
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +9 -4
- data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +7 -2
- data/lib/tinkerforge/bricklet_io16.rb +11 -2
- data/lib/tinkerforge/bricklet_io16_v2.rb +10 -2
- data/lib/tinkerforge/bricklet_io4.rb +10 -2
- data/lib/tinkerforge/bricklet_io4_v2.rb +15 -2
- data/lib/tinkerforge/bricklet_isolator.rb +2 -2
- data/lib/tinkerforge/bricklet_joystick.rb +9 -9
- data/lib/tinkerforge/bricklet_joystick_v2.rb +294 -0
- data/lib/tinkerforge/bricklet_laser_range_finder.rb +3 -3
- data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +447 -0
- data/lib/tinkerforge/bricklet_lcd_128x64.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_led_strip_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_line.rb +2 -2
- data/lib/tinkerforge/bricklet_linear_poti.rb +2 -2
- data/lib/tinkerforge/bricklet_linear_poti_v2.rb +259 -0
- data/lib/tinkerforge/bricklet_load_cell.rb +2 -2
- data/lib/tinkerforge/bricklet_load_cell_v2.rb +2 -2
- 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 +5 -7
- data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +2 -2
- data/lib/tinkerforge/bricklet_multi_touch.rb +2 -2
- data/lib/tinkerforge/bricklet_nfc.rb +2 -2
- data/lib/tinkerforge/bricklet_nfc_rfid.rb +2 -2
- data/lib/tinkerforge/bricklet_oled_128x64.rb +2 -2
- data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_oled_64x48.rb +2 -2
- data/lib/tinkerforge/bricklet_one_wire.rb +2 -2
- data/lib/tinkerforge/bricklet_outdoor_weather.rb +14 -2
- data/lib/tinkerforge/bricklet_particulate_matter.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_piezo_speaker_v2.rb +311 -0
- data/lib/tinkerforge/bricklet_ptc.rb +2 -2
- data/lib/tinkerforge/bricklet_ptc_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_real_time_clock.rb +2 -2
- data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_remote_switch.rb +2 -2
- data/lib/tinkerforge/bricklet_remote_switch_v2.rb +3 -3
- data/lib/tinkerforge/bricklet_rgb_led.rb +4 -4
- data/lib/tinkerforge/bricklet_rgb_led_button.rb +2 -2
- data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +2 -2
- data/lib/tinkerforge/bricklet_rgb_led_v2.rb +203 -0
- data/lib/tinkerforge/bricklet_rotary_encoder.rb +2 -2
- data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_rotary_poti.rb +2 -2
- data/lib/tinkerforge/bricklet_rs232.rb +2 -2
- data/lib/tinkerforge/bricklet_rs232_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_rs485.rb +2 -2
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +2 -2
- data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +309 -0
- data/lib/tinkerforge/bricklet_solid_state_relay.rb +3 -3
- 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 +2 -2
- data/lib/tinkerforge/bricklet_temperature.rb +2 -2
- data/lib/tinkerforge/bricklet_temperature_ir.rb +2 -2
- data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +5 -2
- data/lib/tinkerforge/bricklet_temperature_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_thermal_imaging.rb +4 -4
- data/lib/tinkerforge/bricklet_thermocouple.rb +2 -2
- data/lib/tinkerforge/bricklet_thermocouple_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_tilt.rb +2 -2
- data/lib/tinkerforge/bricklet_uv_light.rb +2 -2
- data/lib/tinkerforge/bricklet_uv_light_v2.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 +2 -2
- data/lib/tinkerforge/ip_connection.rb +21 -4
- data/lib/tinkerforge/version.rb +1 -1
- metadata +14 -3
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2019-
|
|
3
|
+
# This file was automatically generated on 2019-05-21. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.22 #
|
|
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 2019-
|
|
3
|
+
# This file was automatically generated on 2019-05-21. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.22 #
|
|
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 2019-
|
|
3
|
+
# This file was automatically generated on 2019-05-21. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.22 #
|
|
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 2019-
|
|
3
|
+
# This file was automatically generated on 2019-05-21. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.22 #
|
|
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 2019-
|
|
3
|
+
# This file was automatically generated on 2019-05-21. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.22 #
|
|
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 2019-
|
|
3
|
+
# This file was automatically generated on 2019-05-21. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.22 #
|
|
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 #
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
#############################################################
|
|
11
11
|
|
|
12
12
|
module Tinkerforge
|
|
13
|
-
# Controls remote mains switches
|
|
13
|
+
# Controls remote mains switches and receives signals from remotes
|
|
14
14
|
class BrickletRemoteSwitchV2 < Device
|
|
15
15
|
DEVICE_IDENTIFIER = 289 # :nodoc:
|
|
16
16
|
DEVICE_DISPLAY_NAME = 'Remote Switch Bricklet 2.0' # :nodoc:
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2019-
|
|
3
|
+
# This file was automatically generated on 2019-05-21. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.22 #
|
|
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 #
|
|
@@ -34,12 +34,12 @@ module Tinkerforge
|
|
|
34
34
|
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
-
# Sets the *
|
|
37
|
+
# Sets the *r*, *g* and *b* values for the LED. Each value can be between 0 and 255.
|
|
38
38
|
def set_rgb_value(r, g, b)
|
|
39
39
|
send_request FUNCTION_SET_RGB_VALUE, [r, g, b], 'C C C', 0, ''
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
-
# Returns the *
|
|
42
|
+
# Returns the *r*, *g* and *b* values of the LED as set by BrickletRGBLED#set_rgb_value.
|
|
43
43
|
def get_rgb_value
|
|
44
44
|
send_request FUNCTION_GET_RGB_VALUE, [], '', 3, 'C C C'
|
|
45
45
|
end
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2019-
|
|
3
|
+
# This file was automatically generated on 2019-05-21. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.22 #
|
|
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 2019-
|
|
3
|
+
# This file was automatically generated on 2019-05-21. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.22 #
|
|
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,203 @@
|
|
|
1
|
+
# -*- ruby encoding: utf-8 -*-
|
|
2
|
+
#############################################################
|
|
3
|
+
# This file was automatically generated on 2019-05-21. #
|
|
4
|
+
# #
|
|
5
|
+
# Ruby Bindings Version 2.1.22 #
|
|
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
|
+
# Controls one RGB LED
|
|
14
|
+
class BrickletRGBLEDV2 < Device
|
|
15
|
+
DEVICE_IDENTIFIER = 2127 # :nodoc:
|
|
16
|
+
DEVICE_DISPLAY_NAME = 'RGB LED Bricklet 2.0' # :nodoc:
|
|
17
|
+
|
|
18
|
+
FUNCTION_SET_RGB_VALUE = 1 # :nodoc:
|
|
19
|
+
FUNCTION_GET_RGB_VALUE = 2 # :nodoc:
|
|
20
|
+
FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
|
|
21
|
+
FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
|
|
22
|
+
FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
|
|
23
|
+
FUNCTION_SET_WRITE_FIRMWARE_POINTER = 237 # :nodoc:
|
|
24
|
+
FUNCTION_WRITE_FIRMWARE = 238 # :nodoc:
|
|
25
|
+
FUNCTION_SET_STATUS_LED_CONFIG = 239 # :nodoc:
|
|
26
|
+
FUNCTION_GET_STATUS_LED_CONFIG = 240 # :nodoc:
|
|
27
|
+
FUNCTION_GET_CHIP_TEMPERATURE = 242 # :nodoc:
|
|
28
|
+
FUNCTION_RESET = 243 # :nodoc:
|
|
29
|
+
FUNCTION_WRITE_UID = 248 # :nodoc:
|
|
30
|
+
FUNCTION_READ_UID = 249 # :nodoc:
|
|
31
|
+
FUNCTION_GET_IDENTITY = 255 # :nodoc:
|
|
32
|
+
|
|
33
|
+
BOOTLOADER_MODE_BOOTLOADER = 0 # :nodoc:
|
|
34
|
+
BOOTLOADER_MODE_FIRMWARE = 1 # :nodoc:
|
|
35
|
+
BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT = 2 # :nodoc:
|
|
36
|
+
BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT = 3 # :nodoc:
|
|
37
|
+
BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT = 4 # :nodoc:
|
|
38
|
+
BOOTLOADER_STATUS_OK = 0 # :nodoc:
|
|
39
|
+
BOOTLOADER_STATUS_INVALID_MODE = 1 # :nodoc:
|
|
40
|
+
BOOTLOADER_STATUS_NO_CHANGE = 2 # :nodoc:
|
|
41
|
+
BOOTLOADER_STATUS_ENTRY_FUNCTION_NOT_PRESENT = 3 # :nodoc:
|
|
42
|
+
BOOTLOADER_STATUS_DEVICE_IDENTIFIER_INCORRECT = 4 # :nodoc:
|
|
43
|
+
BOOTLOADER_STATUS_CRC_MISMATCH = 5 # :nodoc:
|
|
44
|
+
STATUS_LED_CONFIG_OFF = 0 # :nodoc:
|
|
45
|
+
STATUS_LED_CONFIG_ON = 1 # :nodoc:
|
|
46
|
+
STATUS_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
|
|
47
|
+
STATUS_LED_CONFIG_SHOW_STATUS = 3 # :nodoc:
|
|
48
|
+
|
|
49
|
+
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
50
|
+
# the IP Connection <tt>ipcon</tt>.
|
|
51
|
+
def initialize(uid, ipcon)
|
|
52
|
+
super uid, ipcon
|
|
53
|
+
|
|
54
|
+
@api_version = [2, 0, 0]
|
|
55
|
+
|
|
56
|
+
@response_expected[FUNCTION_SET_RGB_VALUE] = RESPONSE_EXPECTED_FALSE
|
|
57
|
+
@response_expected[FUNCTION_GET_RGB_VALUE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
58
|
+
@response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
59
|
+
@response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
60
|
+
@response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
61
|
+
@response_expected[FUNCTION_SET_WRITE_FIRMWARE_POINTER] = RESPONSE_EXPECTED_FALSE
|
|
62
|
+
@response_expected[FUNCTION_WRITE_FIRMWARE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
63
|
+
@response_expected[FUNCTION_SET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
|
|
64
|
+
@response_expected[FUNCTION_GET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
65
|
+
@response_expected[FUNCTION_GET_CHIP_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
66
|
+
@response_expected[FUNCTION_RESET] = RESPONSE_EXPECTED_FALSE
|
|
67
|
+
@response_expected[FUNCTION_WRITE_UID] = RESPONSE_EXPECTED_FALSE
|
|
68
|
+
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
69
|
+
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Sets the *r*, *g* and *b* values for the LED. Each value can be between 0 and 255.
|
|
75
|
+
def set_rgb_value(r, g, b)
|
|
76
|
+
send_request FUNCTION_SET_RGB_VALUE, [r, g, b], 'C C C', 0, ''
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Returns the *r*, *g* and *b* values of the LED as set by BrickletRGBLEDV2#set_rgb_value.
|
|
80
|
+
def get_rgb_value
|
|
81
|
+
send_request FUNCTION_GET_RGB_VALUE, [], '', 3, 'C C C'
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# Returns the error count for the communication between Brick and Bricklet.
|
|
85
|
+
#
|
|
86
|
+
# The errors are divided into
|
|
87
|
+
#
|
|
88
|
+
# * ACK checksum errors,
|
|
89
|
+
# * message checksum errors,
|
|
90
|
+
# * framing errors and
|
|
91
|
+
# * overflow errors.
|
|
92
|
+
#
|
|
93
|
+
# The errors counts are for errors that occur on the Bricklet side. All
|
|
94
|
+
# Bricks have a similar function that returns the errors on the Brick side.
|
|
95
|
+
def get_spitfp_error_count
|
|
96
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# Sets the bootloader mode and returns the status after the requested
|
|
100
|
+
# mode change was instigated.
|
|
101
|
+
#
|
|
102
|
+
# You can change from bootloader mode to firmware mode and vice versa. A change
|
|
103
|
+
# from bootloader mode to firmware mode will only take place if the entry function,
|
|
104
|
+
# device identifier and CRC are present and correct.
|
|
105
|
+
#
|
|
106
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
|
107
|
+
# necessary to call it in a normal user program.
|
|
108
|
+
def set_bootloader_mode(mode)
|
|
109
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# Returns the current bootloader mode, see BrickletRGBLEDV2#set_bootloader_mode.
|
|
113
|
+
def get_bootloader_mode
|
|
114
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# Sets the firmware pointer for BrickletRGBLEDV2#write_firmware. The pointer has
|
|
118
|
+
# to be increased by chunks of size 64. The data is written to flash
|
|
119
|
+
# every 4 chunks (which equals to one page of size 256).
|
|
120
|
+
#
|
|
121
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
|
122
|
+
# necessary to call it in a normal user program.
|
|
123
|
+
def set_write_firmware_pointer(pointer)
|
|
124
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
# Writes 64 Bytes of firmware at the position as written by
|
|
128
|
+
# BrickletRGBLEDV2#set_write_firmware_pointer before. The firmware is written
|
|
129
|
+
# to flash every 4 chunks.
|
|
130
|
+
#
|
|
131
|
+
# You can only write firmware in bootloader mode.
|
|
132
|
+
#
|
|
133
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
|
134
|
+
# necessary to call it in a normal user program.
|
|
135
|
+
def write_firmware(data)
|
|
136
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
# Sets the status LED configuration. By default the LED shows
|
|
140
|
+
# communication traffic between Brick and Bricklet, it flickers once
|
|
141
|
+
# for every 10 received data packets.
|
|
142
|
+
#
|
|
143
|
+
# You can also turn the LED permanently on/off or show a heartbeat.
|
|
144
|
+
#
|
|
145
|
+
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
|
146
|
+
def set_status_led_config(config)
|
|
147
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
# Returns the configuration as set by BrickletRGBLEDV2#set_status_led_config
|
|
151
|
+
def get_status_led_config
|
|
152
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
# Returns the temperature in °C as measured inside the microcontroller. The
|
|
156
|
+
# value returned is not the ambient temperature!
|
|
157
|
+
#
|
|
158
|
+
# The temperature is only proportional to the real temperature and it has bad
|
|
159
|
+
# accuracy. Practically it is only useful as an indicator for
|
|
160
|
+
# temperature changes.
|
|
161
|
+
def get_chip_temperature
|
|
162
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
# Calling this function will reset the Bricklet. All configurations
|
|
166
|
+
# will be lost.
|
|
167
|
+
#
|
|
168
|
+
# After a reset you have to create new device objects,
|
|
169
|
+
# calling functions on the existing ones will result in
|
|
170
|
+
# undefined behavior!
|
|
171
|
+
def reset
|
|
172
|
+
send_request FUNCTION_RESET, [], '', 0, ''
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
# Writes a new UID into flash. If you want to set a new UID
|
|
176
|
+
# you have to decode the Base58 encoded UID string into an
|
|
177
|
+
# integer first.
|
|
178
|
+
#
|
|
179
|
+
# We recommend that you use Brick Viewer to change the UID.
|
|
180
|
+
def write_uid(uid)
|
|
181
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
# Returns the current UID as an integer. Encode as
|
|
185
|
+
# Base58 to get the usual string version.
|
|
186
|
+
def read_uid
|
|
187
|
+
send_request FUNCTION_READ_UID, [], '', 4, 'L'
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
# Returns the UID, the UID where the Bricklet is connected to,
|
|
191
|
+
# the position, the hardware and firmware version as well as the
|
|
192
|
+
# device identifier.
|
|
193
|
+
#
|
|
194
|
+
# The position can be 'a', 'b', 'c' or 'd'.
|
|
195
|
+
#
|
|
196
|
+
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
197
|
+
# |device_identifier_constant|
|
|
198
|
+
def get_identity
|
|
199
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
end
|
|
203
|
+
end
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2019-
|
|
3
|
+
# This file was automatically generated on 2019-05-21. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.22 #
|
|
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 2019-
|
|
3
|
+
# This file was automatically generated on 2019-05-21. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.22 #
|
|
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 2019-
|
|
3
|
+
# This file was automatically generated on 2019-05-21. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.22 #
|
|
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 2019-
|
|
3
|
+
# This file was automatically generated on 2019-05-21. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.22 #
|
|
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 2019-
|
|
3
|
+
# This file was automatically generated on 2019-05-21. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.22 #
|
|
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 2019-
|
|
3
|
+
# This file was automatically generated on 2019-05-21. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.22 #
|
|
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 2019-
|
|
3
|
+
# This file was automatically generated on 2019-05-21. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.22 #
|
|
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,309 @@
|
|
|
1
|
+
# -*- ruby encoding: utf-8 -*-
|
|
2
|
+
#############################################################
|
|
3
|
+
# This file was automatically generated on 2019-05-21. #
|
|
4
|
+
# #
|
|
5
|
+
# Ruby Bindings Version 2.1.22 #
|
|
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
|
+
# Four 7-segment displays with switchable dots
|
|
14
|
+
class BrickletSegmentDisplay4x7V2 < Device
|
|
15
|
+
DEVICE_IDENTIFIER = 2137 # :nodoc:
|
|
16
|
+
DEVICE_DISPLAY_NAME = 'Segment Display 4x7 Bricklet 2.0' # :nodoc:
|
|
17
|
+
|
|
18
|
+
# This callback is triggered when the counter (see BrickletSegmentDisplay4x7V2#start_counter) is
|
|
19
|
+
# finished.
|
|
20
|
+
CALLBACK_COUNTER_FINISHED = 10
|
|
21
|
+
|
|
22
|
+
FUNCTION_SET_SEGMENTS = 1 # :nodoc:
|
|
23
|
+
FUNCTION_GET_SEGMENTS = 2 # :nodoc:
|
|
24
|
+
FUNCTION_SET_BRIGHTNESS = 3 # :nodoc:
|
|
25
|
+
FUNCTION_GET_BRIGHTNESS = 4 # :nodoc:
|
|
26
|
+
FUNCTION_SET_NUMERIC_VALUE = 5 # :nodoc:
|
|
27
|
+
FUNCTION_SET_SELECTED_SEGMENT = 6 # :nodoc:
|
|
28
|
+
FUNCTION_GET_SELECTED_SEGMENT = 7 # :nodoc:
|
|
29
|
+
FUNCTION_START_COUNTER = 8 # :nodoc:
|
|
30
|
+
FUNCTION_GET_COUNTER_VALUE = 9 # :nodoc:
|
|
31
|
+
FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
|
|
32
|
+
FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
|
|
33
|
+
FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
|
|
34
|
+
FUNCTION_SET_WRITE_FIRMWARE_POINTER = 237 # :nodoc:
|
|
35
|
+
FUNCTION_WRITE_FIRMWARE = 238 # :nodoc:
|
|
36
|
+
FUNCTION_SET_STATUS_LED_CONFIG = 239 # :nodoc:
|
|
37
|
+
FUNCTION_GET_STATUS_LED_CONFIG = 240 # :nodoc:
|
|
38
|
+
FUNCTION_GET_CHIP_TEMPERATURE = 242 # :nodoc:
|
|
39
|
+
FUNCTION_RESET = 243 # :nodoc:
|
|
40
|
+
FUNCTION_WRITE_UID = 248 # :nodoc:
|
|
41
|
+
FUNCTION_READ_UID = 249 # :nodoc:
|
|
42
|
+
FUNCTION_GET_IDENTITY = 255 # :nodoc:
|
|
43
|
+
|
|
44
|
+
BOOTLOADER_MODE_BOOTLOADER = 0 # :nodoc:
|
|
45
|
+
BOOTLOADER_MODE_FIRMWARE = 1 # :nodoc:
|
|
46
|
+
BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT = 2 # :nodoc:
|
|
47
|
+
BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT = 3 # :nodoc:
|
|
48
|
+
BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT = 4 # :nodoc:
|
|
49
|
+
BOOTLOADER_STATUS_OK = 0 # :nodoc:
|
|
50
|
+
BOOTLOADER_STATUS_INVALID_MODE = 1 # :nodoc:
|
|
51
|
+
BOOTLOADER_STATUS_NO_CHANGE = 2 # :nodoc:
|
|
52
|
+
BOOTLOADER_STATUS_ENTRY_FUNCTION_NOT_PRESENT = 3 # :nodoc:
|
|
53
|
+
BOOTLOADER_STATUS_DEVICE_IDENTIFIER_INCORRECT = 4 # :nodoc:
|
|
54
|
+
BOOTLOADER_STATUS_CRC_MISMATCH = 5 # :nodoc:
|
|
55
|
+
STATUS_LED_CONFIG_OFF = 0 # :nodoc:
|
|
56
|
+
STATUS_LED_CONFIG_ON = 1 # :nodoc:
|
|
57
|
+
STATUS_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
|
|
58
|
+
STATUS_LED_CONFIG_SHOW_STATUS = 3 # :nodoc:
|
|
59
|
+
|
|
60
|
+
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
61
|
+
# the IP Connection <tt>ipcon</tt>.
|
|
62
|
+
def initialize(uid, ipcon)
|
|
63
|
+
super uid, ipcon
|
|
64
|
+
|
|
65
|
+
@api_version = [2, 0, 0]
|
|
66
|
+
|
|
67
|
+
@response_expected[FUNCTION_SET_SEGMENTS] = RESPONSE_EXPECTED_FALSE
|
|
68
|
+
@response_expected[FUNCTION_GET_SEGMENTS] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
69
|
+
@response_expected[FUNCTION_SET_BRIGHTNESS] = RESPONSE_EXPECTED_FALSE
|
|
70
|
+
@response_expected[FUNCTION_GET_BRIGHTNESS] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
71
|
+
@response_expected[FUNCTION_SET_NUMERIC_VALUE] = RESPONSE_EXPECTED_FALSE
|
|
72
|
+
@response_expected[FUNCTION_SET_SELECTED_SEGMENT] = RESPONSE_EXPECTED_FALSE
|
|
73
|
+
@response_expected[FUNCTION_GET_SELECTED_SEGMENT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
74
|
+
@response_expected[FUNCTION_START_COUNTER] = RESPONSE_EXPECTED_FALSE
|
|
75
|
+
@response_expected[FUNCTION_GET_COUNTER_VALUE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
76
|
+
@response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
77
|
+
@response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
78
|
+
@response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
79
|
+
@response_expected[FUNCTION_SET_WRITE_FIRMWARE_POINTER] = RESPONSE_EXPECTED_FALSE
|
|
80
|
+
@response_expected[FUNCTION_WRITE_FIRMWARE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
81
|
+
@response_expected[FUNCTION_SET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
|
|
82
|
+
@response_expected[FUNCTION_GET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
83
|
+
@response_expected[FUNCTION_GET_CHIP_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
84
|
+
@response_expected[FUNCTION_RESET] = RESPONSE_EXPECTED_FALSE
|
|
85
|
+
@response_expected[FUNCTION_WRITE_UID] = RESPONSE_EXPECTED_FALSE
|
|
86
|
+
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
87
|
+
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
88
|
+
|
|
89
|
+
@callback_formats[CALLBACK_COUNTER_FINISHED] = ''
|
|
90
|
+
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Sets the segments of the Segment Display 4x7 Bricklet 2.0 segment-by-segment.
|
|
94
|
+
#
|
|
95
|
+
# The data is split into the four digits, two colon dots and the tick mark.
|
|
96
|
+
#
|
|
97
|
+
# The indices of the segments in the digit and colon parameters are as follows:
|
|
98
|
+
#
|
|
99
|
+
# .. image:: /Images/Bricklets/bricklet_segment_display_4x7_v2_segment_index.png
|
|
100
|
+
# :scale: 100 %
|
|
101
|
+
# :alt: Indices of segments
|
|
102
|
+
# :align: center
|
|
103
|
+
def set_segments(digit0, digit1, digit2, digit3, colon, tick)
|
|
104
|
+
send_request FUNCTION_SET_SEGMENTS, [digit0, digit1, digit2, digit3, colon, tick], '?8 ?8 ?8 ?8 ?2 ?', 0, ''
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# Returns the segment data as set by BrickletSegmentDisplay4x7V2#set_segments.
|
|
108
|
+
def get_segments
|
|
109
|
+
send_request FUNCTION_GET_SEGMENTS, [], '', 35, '?8 ?8 ?8 ?8 ?2 ?'
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# The brightness can be set between 0 (dark) and 7 (bright).
|
|
113
|
+
#
|
|
114
|
+
# The default value is 7.
|
|
115
|
+
def set_brightness(brightness)
|
|
116
|
+
send_request FUNCTION_SET_BRIGHTNESS, [brightness], 'C', 0, ''
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# Returns the brightness as set by BrickletSegmentDisplay4x7V2#set_brightness.
|
|
120
|
+
def get_brightness
|
|
121
|
+
send_request FUNCTION_GET_BRIGHTNESS, [], '', 1, 'C'
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
# Sets a numeric value for each of the digits. The values can be between
|
|
125
|
+
# -2 and 15. They represent:
|
|
126
|
+
#
|
|
127
|
+
# * -2: minus sign
|
|
128
|
+
# * -1: blank
|
|
129
|
+
# * 0-9: 0-9
|
|
130
|
+
# * 10: A
|
|
131
|
+
# * 11: b
|
|
132
|
+
# * 12: C
|
|
133
|
+
# * 13: d
|
|
134
|
+
# * 14: E
|
|
135
|
+
# * 15: F
|
|
136
|
+
#
|
|
137
|
+
# Example: A call with [-2, -1, 4, 2] will result in a display of "- 42".
|
|
138
|
+
def set_numeric_value(value)
|
|
139
|
+
send_request FUNCTION_SET_NUMERIC_VALUE, [value], 'c4', 0, ''
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
# Turns one specified segment on or off.
|
|
143
|
+
#
|
|
144
|
+
# The indices of the segments are as follows:
|
|
145
|
+
#
|
|
146
|
+
# .. image:: /Images/Bricklets/bricklet_segment_display_4x7_v2_selected_segment_index.png
|
|
147
|
+
# :scale: 100 %
|
|
148
|
+
# :alt: Indices of selected segments
|
|
149
|
+
# :align: center
|
|
150
|
+
def set_selected_segment(segment, value)
|
|
151
|
+
send_request FUNCTION_SET_SELECTED_SEGMENT, [segment, value], 'C ?', 0, ''
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
# Returns the value of a single segment.
|
|
155
|
+
def get_selected_segment(segment)
|
|
156
|
+
send_request FUNCTION_GET_SELECTED_SEGMENT, [segment], 'C', 1, '?'
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# Starts a counter with the *from* value that counts to the *to*
|
|
160
|
+
# value with the each step incremented by *increment*.
|
|
161
|
+
# The *length* of the increment is given in ms.
|
|
162
|
+
#
|
|
163
|
+
# Example: If you set *from* to 0, *to* to 100, *increment* to 1 and
|
|
164
|
+
# *length* to 1000, a counter that goes from 0 to 100 with one second
|
|
165
|
+
# pause between each increment will be started.
|
|
166
|
+
#
|
|
167
|
+
# The maximum values for *from*, *to* and *increment* is 9999,
|
|
168
|
+
# the minimum value is -999.
|
|
169
|
+
#
|
|
170
|
+
# Using a negative *increment* allows to count backwards.
|
|
171
|
+
#
|
|
172
|
+
# You can stop the counter at every time by calling BrickletSegmentDisplay4x7V2#set_segments
|
|
173
|
+
# or BrickletSegmentDisplay4x7V2#set_numeric_value.
|
|
174
|
+
def start_counter(value_from, value_to, increment, length)
|
|
175
|
+
send_request FUNCTION_START_COUNTER, [value_from, value_to, increment, length], 's s s L', 0, ''
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
# Returns the counter value that is currently shown on the display.
|
|
179
|
+
#
|
|
180
|
+
# If there is no counter running a 0 will be returned.
|
|
181
|
+
def get_counter_value
|
|
182
|
+
send_request FUNCTION_GET_COUNTER_VALUE, [], '', 2, 'S'
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
# Returns the error count for the communication between Brick and Bricklet.
|
|
186
|
+
#
|
|
187
|
+
# The errors are divided into
|
|
188
|
+
#
|
|
189
|
+
# * ACK checksum errors,
|
|
190
|
+
# * message checksum errors,
|
|
191
|
+
# * framing errors and
|
|
192
|
+
# * overflow errors.
|
|
193
|
+
#
|
|
194
|
+
# The errors counts are for errors that occur on the Bricklet side. All
|
|
195
|
+
# Bricks have a similar function that returns the errors on the Brick side.
|
|
196
|
+
def get_spitfp_error_count
|
|
197
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
# Sets the bootloader mode and returns the status after the requested
|
|
201
|
+
# mode change was instigated.
|
|
202
|
+
#
|
|
203
|
+
# You can change from bootloader mode to firmware mode and vice versa. A change
|
|
204
|
+
# from bootloader mode to firmware mode will only take place if the entry function,
|
|
205
|
+
# device identifier and CRC are present and correct.
|
|
206
|
+
#
|
|
207
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
|
208
|
+
# necessary to call it in a normal user program.
|
|
209
|
+
def set_bootloader_mode(mode)
|
|
210
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
# Returns the current bootloader mode, see BrickletSegmentDisplay4x7V2#set_bootloader_mode.
|
|
214
|
+
def get_bootloader_mode
|
|
215
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
# Sets the firmware pointer for BrickletSegmentDisplay4x7V2#write_firmware. The pointer has
|
|
219
|
+
# to be increased by chunks of size 64. The data is written to flash
|
|
220
|
+
# every 4 chunks (which equals to one page of size 256).
|
|
221
|
+
#
|
|
222
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
|
223
|
+
# necessary to call it in a normal user program.
|
|
224
|
+
def set_write_firmware_pointer(pointer)
|
|
225
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
# Writes 64 Bytes of firmware at the position as written by
|
|
229
|
+
# BrickletSegmentDisplay4x7V2#set_write_firmware_pointer before. The firmware is written
|
|
230
|
+
# to flash every 4 chunks.
|
|
231
|
+
#
|
|
232
|
+
# You can only write firmware in bootloader mode.
|
|
233
|
+
#
|
|
234
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
|
235
|
+
# necessary to call it in a normal user program.
|
|
236
|
+
def write_firmware(data)
|
|
237
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
# Sets the status LED configuration. By default the LED shows
|
|
241
|
+
# communication traffic between Brick and Bricklet, it flickers once
|
|
242
|
+
# for every 10 received data packets.
|
|
243
|
+
#
|
|
244
|
+
# You can also turn the LED permanently on/off or show a heartbeat.
|
|
245
|
+
#
|
|
246
|
+
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
|
247
|
+
def set_status_led_config(config)
|
|
248
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
# Returns the configuration as set by BrickletSegmentDisplay4x7V2#set_status_led_config
|
|
252
|
+
def get_status_led_config
|
|
253
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
# Returns the temperature in °C as measured inside the microcontroller. The
|
|
257
|
+
# value returned is not the ambient temperature!
|
|
258
|
+
#
|
|
259
|
+
# The temperature is only proportional to the real temperature and it has bad
|
|
260
|
+
# accuracy. Practically it is only useful as an indicator for
|
|
261
|
+
# temperature changes.
|
|
262
|
+
def get_chip_temperature
|
|
263
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
# Calling this function will reset the Bricklet. All configurations
|
|
267
|
+
# will be lost.
|
|
268
|
+
#
|
|
269
|
+
# After a reset you have to create new device objects,
|
|
270
|
+
# calling functions on the existing ones will result in
|
|
271
|
+
# undefined behavior!
|
|
272
|
+
def reset
|
|
273
|
+
send_request FUNCTION_RESET, [], '', 0, ''
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
# Writes a new UID into flash. If you want to set a new UID
|
|
277
|
+
# you have to decode the Base58 encoded UID string into an
|
|
278
|
+
# integer first.
|
|
279
|
+
#
|
|
280
|
+
# We recommend that you use Brick Viewer to change the UID.
|
|
281
|
+
def write_uid(uid)
|
|
282
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
# Returns the current UID as an integer. Encode as
|
|
286
|
+
# Base58 to get the usual string version.
|
|
287
|
+
def read_uid
|
|
288
|
+
send_request FUNCTION_READ_UID, [], '', 4, 'L'
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
# Returns the UID, the UID where the Bricklet is connected to,
|
|
292
|
+
# the position, the hardware and firmware version as well as the
|
|
293
|
+
# device identifier.
|
|
294
|
+
#
|
|
295
|
+
# The position can be 'a', 'b', 'c' or 'd'.
|
|
296
|
+
#
|
|
297
|
+
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
298
|
+
# |device_identifier_constant|
|
|
299
|
+
def get_identity
|
|
300
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
|
301
|
+
end
|
|
302
|
+
|
|
303
|
+
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|
|
304
|
+
def register_callback(id, &block)
|
|
305
|
+
callback = block
|
|
306
|
+
@registered_callbacks[id] = callback
|
|
307
|
+
end
|
|
308
|
+
end
|
|
309
|
+
end
|