tinkerforge 2.1.22 → 2.1.23
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_hat.rb +11 -7
- data/lib/tinkerforge/brick_hat_zero.rb +2 -2
- data/lib/tinkerforge/brick_imu.rb +3 -3
- data/lib/tinkerforge/brick_imu_v2.rb +3 -3
- data/lib/tinkerforge/brick_master.rb +5 -5
- 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 +4 -4
- data/lib/tinkerforge/bricklet_accelerometer.rb +2 -2
- data/lib/tinkerforge/bricklet_accelerometer_v2.rb +81 -6
- data/lib/tinkerforge/bricklet_air_quality.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_ambient_light_v3.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 +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 +2 -2
- data/lib/tinkerforge/bricklet_color.rb +4 -4
- data/lib/tinkerforge/bricklet_color_v2.rb +449 -0
- data/lib/tinkerforge/bricklet_compass.rb +356 -0
- 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 +2 -2
- data/lib/tinkerforge/bricklet_distance_us.rb +2 -2
- data/lib/tinkerforge/bricklet_distance_us_v2.rb +300 -0
- 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 +2 -2
- data/lib/tinkerforge/bricklet_dust_detector.rb +2 -2
- data/lib/tinkerforge/bricklet_e_paper_296x128.rb +2 -2
- data/lib/tinkerforge/bricklet_energy_monitor.rb +375 -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 +2 -2
- 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 +2 -2
- data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +2 -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 +2 -2
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_io16.rb +2 -2
- data/lib/tinkerforge/bricklet_io16_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_io4.rb +2 -2
- data/lib/tinkerforge/bricklet_io4_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_isolator.rb +2 -2
- data/lib/tinkerforge/bricklet_joystick.rb +2 -2
- data/lib/tinkerforge/bricklet_joystick_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_laser_range_finder.rb +2 -2
- data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +5 -5
- data/lib/tinkerforge/bricklet_lcd_128x64.rb +24 -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 +2 -2
- 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 +2 -2
- data/lib/tinkerforge/bricklet_motion_detector_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +2 -2
- data/lib/tinkerforge/bricklet_multi_touch.rb +2 -2
- data/lib/tinkerforge/bricklet_multi_touch_v2.rb +334 -0
- 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 +24 -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 +2 -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 +2 -2
- 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 +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_rgb_led_v2.rb +2 -2
- 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_rotary_poti_v2.rb +259 -0
- data/lib/tinkerforge/bricklet_rs232.rb +2 -2
- data/lib/tinkerforge/bricklet_rs232_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_rs485.rb +70 -60
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +2 -2
- data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_solid_state_relay.rb +2 -2
- data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +2 -2
- 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 +5 -3
- data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +3 -11
- data/lib/tinkerforge/bricklet_temperature_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_thermal_imaging.rb +2 -2
- 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 +13 -2
- data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +365 -0
- data/lib/tinkerforge/ip_connection.rb +1 -1
- data/lib/tinkerforge/version.rb +1 -1
- metadata +10 -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-08-23. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.23 #
|
|
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-08-23. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.23 #
|
|
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-08-23. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.23 #
|
|
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-08-23. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.23 #
|
|
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-08-23. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.23 #
|
|
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-08-23. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.23 #
|
|
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-08-23. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.23 #
|
|
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-08-23. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.23 #
|
|
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-08-23. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.23 #
|
|
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-08-23. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.23 #
|
|
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-08-23. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.23 #
|
|
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-08-23. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.23 #
|
|
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-08-23. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.23 #
|
|
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 #
|
|
@@ -257,7 +257,7 @@ module Tinkerforge
|
|
|
257
257
|
# lux = illuminance * 700 / gain / integration_time
|
|
258
258
|
#
|
|
259
259
|
# To get a correct illuminance measurement make sure that the color
|
|
260
|
-
# values
|
|
260
|
+
# values themselves are not saturated. The color value (R, G or B)
|
|
261
261
|
# is saturated if it is equal to the maximum value of 65535.
|
|
262
262
|
# In that case you have to reduce the gain, see BrickletColor#set_config.
|
|
263
263
|
def get_illuminance
|
|
@@ -267,7 +267,7 @@ module Tinkerforge
|
|
|
267
267
|
# Returns the color temperature in Kelvin.
|
|
268
268
|
#
|
|
269
269
|
# To get a correct color temperature measurement make sure that the color
|
|
270
|
-
# values
|
|
270
|
+
# values themselves are not saturated. The color value (R, G or B)
|
|
271
271
|
# is saturated if it is equal to the maximum value of 65535.
|
|
272
272
|
# In that case you have to reduce the gain, see BrickletColor#set_config.
|
|
273
273
|
def get_color_temperature
|
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
# -*- ruby encoding: utf-8 -*-
|
|
2
|
+
#############################################################
|
|
3
|
+
# This file was automatically generated on 2019-08-23. #
|
|
4
|
+
# #
|
|
5
|
+
# Ruby Bindings Version 2.1.23 #
|
|
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
|
+
# Measures color (RGB value), illuminance and color temperature
|
|
14
|
+
class BrickletColorV2 < Device
|
|
15
|
+
DEVICE_IDENTIFIER = 2128 # :nodoc:
|
|
16
|
+
DEVICE_DISPLAY_NAME = 'Color Bricklet 2.0' # :nodoc:
|
|
17
|
+
|
|
18
|
+
# This callback is triggered periodically with the period that is set by
|
|
19
|
+
# BrickletColorV2#set_color_callback_configuration. The parameter is the color
|
|
20
|
+
# of the sensor as RGBC.
|
|
21
|
+
#
|
|
22
|
+
# The CALLBACK_COLOR callback is only triggered if the color has changed since the
|
|
23
|
+
# last triggering.
|
|
24
|
+
CALLBACK_COLOR = 4
|
|
25
|
+
|
|
26
|
+
# This callback is triggered periodically according to the configuration set by
|
|
27
|
+
# BrickletColorV2#set_illuminance_callback_configuration.
|
|
28
|
+
#
|
|
29
|
+
# The parameter is the same as BrickletColorV2#get_illuminance.
|
|
30
|
+
CALLBACK_ILLUMINANCE = 8
|
|
31
|
+
|
|
32
|
+
# This callback is triggered periodically according to the configuration set by
|
|
33
|
+
# BrickletColorV2#set_color_temperature_callback_configuration.
|
|
34
|
+
#
|
|
35
|
+
# The parameter is the same as BrickletColorV2#get_color_temperature.
|
|
36
|
+
CALLBACK_COLOR_TEMPERATURE = 12
|
|
37
|
+
|
|
38
|
+
FUNCTION_GET_COLOR = 1 # :nodoc:
|
|
39
|
+
FUNCTION_SET_COLOR_CALLBACK_CONFIGURATION = 2 # :nodoc:
|
|
40
|
+
FUNCTION_GET_COLOR_CALLBACK_CONFIGURATION = 3 # :nodoc:
|
|
41
|
+
FUNCTION_GET_ILLUMINANCE = 5 # :nodoc:
|
|
42
|
+
FUNCTION_SET_ILLUMINANCE_CALLBACK_CONFIGURATION = 6 # :nodoc:
|
|
43
|
+
FUNCTION_GET_ILLUMINANCE_CALLBACK_CONFIGURATION = 7 # :nodoc:
|
|
44
|
+
FUNCTION_GET_COLOR_TEMPERATURE = 9 # :nodoc:
|
|
45
|
+
FUNCTION_SET_COLOR_TEMPERATURE_CALLBACK_CONFIGURATION = 10 # :nodoc:
|
|
46
|
+
FUNCTION_GET_COLOR_TEMPERATURE_CALLBACK_CONFIGURATION = 11 # :nodoc:
|
|
47
|
+
FUNCTION_SET_LIGHT = 13 # :nodoc:
|
|
48
|
+
FUNCTION_GET_LIGHT = 14 # :nodoc:
|
|
49
|
+
FUNCTION_SET_CONFIGURATION = 15 # :nodoc:
|
|
50
|
+
FUNCTION_GET_CONFIGURATION = 16 # :nodoc:
|
|
51
|
+
FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
|
|
52
|
+
FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
|
|
53
|
+
FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
|
|
54
|
+
FUNCTION_SET_WRITE_FIRMWARE_POINTER = 237 # :nodoc:
|
|
55
|
+
FUNCTION_WRITE_FIRMWARE = 238 # :nodoc:
|
|
56
|
+
FUNCTION_SET_STATUS_LED_CONFIG = 239 # :nodoc:
|
|
57
|
+
FUNCTION_GET_STATUS_LED_CONFIG = 240 # :nodoc:
|
|
58
|
+
FUNCTION_GET_CHIP_TEMPERATURE = 242 # :nodoc:
|
|
59
|
+
FUNCTION_RESET = 243 # :nodoc:
|
|
60
|
+
FUNCTION_WRITE_UID = 248 # :nodoc:
|
|
61
|
+
FUNCTION_READ_UID = 249 # :nodoc:
|
|
62
|
+
FUNCTION_GET_IDENTITY = 255 # :nodoc:
|
|
63
|
+
|
|
64
|
+
THRESHOLD_OPTION_OFF = 'x' # :nodoc:
|
|
65
|
+
THRESHOLD_OPTION_OUTSIDE = 'o' # :nodoc:
|
|
66
|
+
THRESHOLD_OPTION_INSIDE = 'i' # :nodoc:
|
|
67
|
+
THRESHOLD_OPTION_SMALLER = '<' # :nodoc:
|
|
68
|
+
THRESHOLD_OPTION_GREATER = '>' # :nodoc:
|
|
69
|
+
GAIN_1X = 0 # :nodoc:
|
|
70
|
+
GAIN_4X = 1 # :nodoc:
|
|
71
|
+
GAIN_16X = 2 # :nodoc:
|
|
72
|
+
GAIN_60X = 3 # :nodoc:
|
|
73
|
+
INTEGRATION_TIME_2MS = 0 # :nodoc:
|
|
74
|
+
INTEGRATION_TIME_24MS = 1 # :nodoc:
|
|
75
|
+
INTEGRATION_TIME_101MS = 2 # :nodoc:
|
|
76
|
+
INTEGRATION_TIME_154MS = 3 # :nodoc:
|
|
77
|
+
INTEGRATION_TIME_700MS = 4 # :nodoc:
|
|
78
|
+
BOOTLOADER_MODE_BOOTLOADER = 0 # :nodoc:
|
|
79
|
+
BOOTLOADER_MODE_FIRMWARE = 1 # :nodoc:
|
|
80
|
+
BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT = 2 # :nodoc:
|
|
81
|
+
BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT = 3 # :nodoc:
|
|
82
|
+
BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT = 4 # :nodoc:
|
|
83
|
+
BOOTLOADER_STATUS_OK = 0 # :nodoc:
|
|
84
|
+
BOOTLOADER_STATUS_INVALID_MODE = 1 # :nodoc:
|
|
85
|
+
BOOTLOADER_STATUS_NO_CHANGE = 2 # :nodoc:
|
|
86
|
+
BOOTLOADER_STATUS_ENTRY_FUNCTION_NOT_PRESENT = 3 # :nodoc:
|
|
87
|
+
BOOTLOADER_STATUS_DEVICE_IDENTIFIER_INCORRECT = 4 # :nodoc:
|
|
88
|
+
BOOTLOADER_STATUS_CRC_MISMATCH = 5 # :nodoc:
|
|
89
|
+
STATUS_LED_CONFIG_OFF = 0 # :nodoc:
|
|
90
|
+
STATUS_LED_CONFIG_ON = 1 # :nodoc:
|
|
91
|
+
STATUS_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
|
|
92
|
+
STATUS_LED_CONFIG_SHOW_STATUS = 3 # :nodoc:
|
|
93
|
+
|
|
94
|
+
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
95
|
+
# the IP Connection <tt>ipcon</tt>.
|
|
96
|
+
def initialize(uid, ipcon)
|
|
97
|
+
super uid, ipcon
|
|
98
|
+
|
|
99
|
+
@api_version = [2, 0, 0]
|
|
100
|
+
|
|
101
|
+
@response_expected[FUNCTION_GET_COLOR] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
102
|
+
@response_expected[FUNCTION_SET_COLOR_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
|
|
103
|
+
@response_expected[FUNCTION_GET_COLOR_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
104
|
+
@response_expected[FUNCTION_GET_ILLUMINANCE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
105
|
+
@response_expected[FUNCTION_SET_ILLUMINANCE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
|
|
106
|
+
@response_expected[FUNCTION_GET_ILLUMINANCE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
107
|
+
@response_expected[FUNCTION_GET_COLOR_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
108
|
+
@response_expected[FUNCTION_SET_COLOR_TEMPERATURE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
|
|
109
|
+
@response_expected[FUNCTION_GET_COLOR_TEMPERATURE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
110
|
+
@response_expected[FUNCTION_SET_LIGHT] = RESPONSE_EXPECTED_FALSE
|
|
111
|
+
@response_expected[FUNCTION_GET_LIGHT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
112
|
+
@response_expected[FUNCTION_SET_CONFIGURATION] = RESPONSE_EXPECTED_FALSE
|
|
113
|
+
@response_expected[FUNCTION_GET_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
114
|
+
@response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
115
|
+
@response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
116
|
+
@response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
117
|
+
@response_expected[FUNCTION_SET_WRITE_FIRMWARE_POINTER] = RESPONSE_EXPECTED_FALSE
|
|
118
|
+
@response_expected[FUNCTION_WRITE_FIRMWARE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
119
|
+
@response_expected[FUNCTION_SET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
|
|
120
|
+
@response_expected[FUNCTION_GET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
121
|
+
@response_expected[FUNCTION_GET_CHIP_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
122
|
+
@response_expected[FUNCTION_RESET] = RESPONSE_EXPECTED_FALSE
|
|
123
|
+
@response_expected[FUNCTION_WRITE_UID] = RESPONSE_EXPECTED_FALSE
|
|
124
|
+
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
125
|
+
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
126
|
+
|
|
127
|
+
@callback_formats[CALLBACK_COLOR] = 'S S S S'
|
|
128
|
+
@callback_formats[CALLBACK_ILLUMINANCE] = 'L'
|
|
129
|
+
@callback_formats[CALLBACK_COLOR_TEMPERATURE] = 'S'
|
|
130
|
+
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
# Returns the measured color of the sensor. The values
|
|
134
|
+
# have a range of 0 to 65535.
|
|
135
|
+
#
|
|
136
|
+
# The red (r), green (g), blue (b) and clear (c) colors are measured
|
|
137
|
+
# with four different photodiodes that are responsive at different
|
|
138
|
+
# wavelengths:
|
|
139
|
+
#
|
|
140
|
+
# .. image:: /Images/Bricklets/bricklet_color_wavelength_chart_600.jpg
|
|
141
|
+
# :scale: 100 %
|
|
142
|
+
# :alt: Chart Responsivity / Wavelength
|
|
143
|
+
# :align: center
|
|
144
|
+
# :target: ../../_images/Bricklets/bricklet_color_wavelength_chart_600.jpg
|
|
145
|
+
#
|
|
146
|
+
# If you want to get the color periodically, it is recommended
|
|
147
|
+
# to use the CALLBACK_COLOR callback and set the period with
|
|
148
|
+
# BrickletColorV2#set_color_callback_configuration.
|
|
149
|
+
def get_color
|
|
150
|
+
send_request FUNCTION_GET_COLOR, [], '', 8, 'S S S S'
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
# The period in ms is the period with which the CALLBACK_COLOR
|
|
154
|
+
# callback is triggered periodically. A value of 0 turns the callback off.
|
|
155
|
+
#
|
|
156
|
+
# If the `value has to change`-parameter is set to true, the callback is only
|
|
157
|
+
# triggered after the value has changed. If the value didn't change within the
|
|
158
|
+
# period, the callback is triggered immediately on change.
|
|
159
|
+
#
|
|
160
|
+
# If it is set to false, the callback is continuously triggered with the period,
|
|
161
|
+
# independent of the value.
|
|
162
|
+
#
|
|
163
|
+
# The default value is (0, false).
|
|
164
|
+
def set_color_callback_configuration(period, value_has_to_change)
|
|
165
|
+
send_request FUNCTION_SET_COLOR_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 0, ''
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
# Returns the callback configuration as set by
|
|
169
|
+
# BrickletColorV2#set_color_callback_configuration.
|
|
170
|
+
def get_color_callback_configuration
|
|
171
|
+
send_request FUNCTION_GET_COLOR_CALLBACK_CONFIGURATION, [], '', 5, 'L ?'
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
# Returns the illuminance affected by the gain and integration time as
|
|
175
|
+
# set by BrickletColorV2#set_configuration. To get the illuminance in Lux apply this formula::
|
|
176
|
+
#
|
|
177
|
+
# lux = illuminance * 700 / gain / integration_time
|
|
178
|
+
#
|
|
179
|
+
# To get a correct illuminance measurement make sure that the color
|
|
180
|
+
# values themselves are not saturated. The color value (R, G or B)
|
|
181
|
+
# is saturated if it is equal to the maximum value of 65535.
|
|
182
|
+
# In that case you have to reduce the gain, see BrickletColorV2#set_configuration.
|
|
183
|
+
#
|
|
184
|
+
#
|
|
185
|
+
# If you want to get the value periodically, it is recommended to use the
|
|
186
|
+
# CALLBACK_ILLUMINANCE callback. You can set the callback configuration
|
|
187
|
+
# with BrickletColorV2#set_illuminance_callback_configuration.
|
|
188
|
+
def get_illuminance
|
|
189
|
+
send_request FUNCTION_GET_ILLUMINANCE, [], '', 4, 'L'
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
# The period in ms is the period with which the CALLBACK_ILLUMINANCE callback is triggered
|
|
193
|
+
# periodically. A value of 0 turns the callback off.
|
|
194
|
+
#
|
|
195
|
+
# If the `value has to change`-parameter is set to true, the callback is only
|
|
196
|
+
# triggered after the value has changed. If the value didn't change
|
|
197
|
+
# within the period, the callback is triggered immediately on change.
|
|
198
|
+
#
|
|
199
|
+
# If it is set to false, the callback is continuously triggered with the period,
|
|
200
|
+
# independent of the value.
|
|
201
|
+
#
|
|
202
|
+
# It is furthermore possible to constrain the callback with thresholds.
|
|
203
|
+
#
|
|
204
|
+
# The `option`-parameter together with min/max sets a threshold for the CALLBACK_ILLUMINANCE callback.
|
|
205
|
+
#
|
|
206
|
+
# The following options are possible:
|
|
207
|
+
#
|
|
208
|
+
# "Option", "Description"
|
|
209
|
+
#
|
|
210
|
+
# "'x'", "Threshold is turned off"
|
|
211
|
+
# "'o'", "Threshold is triggered when the value is *outside* the min and max values"
|
|
212
|
+
# "'i'", "Threshold is triggered when the value is *inside* or equal to the min and max values"
|
|
213
|
+
# "'<'", "Threshold is triggered when the value is smaller than the min value (max is ignored)"
|
|
214
|
+
# "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
|
|
215
|
+
#
|
|
216
|
+
# If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
|
|
217
|
+
#
|
|
218
|
+
# The default value is (0, false, 'x', 0, 0).
|
|
219
|
+
def set_illuminance_callback_configuration(period, value_has_to_change, option, min, max)
|
|
220
|
+
send_request FUNCTION_SET_ILLUMINANCE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k L L', 0, ''
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
# Returns the callback configuration as set by BrickletColorV2#set_illuminance_callback_configuration.
|
|
224
|
+
def get_illuminance_callback_configuration
|
|
225
|
+
send_request FUNCTION_GET_ILLUMINANCE_CALLBACK_CONFIGURATION, [], '', 14, 'L ? k L L'
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
# Returns the color temperature in Kelvin.
|
|
229
|
+
#
|
|
230
|
+
# To get a correct color temperature measurement make sure that the color
|
|
231
|
+
# values themselves are not saturated. The color value (R, G or B)
|
|
232
|
+
# is saturated if it is equal to the maximum value of 65535.
|
|
233
|
+
# In that case you have to reduce the gain, see BrickletColorV2#set_configuration.
|
|
234
|
+
#
|
|
235
|
+
#
|
|
236
|
+
# If you want to get the value periodically, it is recommended to use the
|
|
237
|
+
# CALLBACK_COLOR_TEMPERATURE callback. You can set the callback configuration
|
|
238
|
+
# with BrickletColorV2#set_color_temperature_callback_configuration.
|
|
239
|
+
def get_color_temperature
|
|
240
|
+
send_request FUNCTION_GET_COLOR_TEMPERATURE, [], '', 2, 'S'
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
# The period in ms is the period with which the CALLBACK_COLOR_TEMPERATURE callback is triggered
|
|
244
|
+
# periodically. A value of 0 turns the callback off.
|
|
245
|
+
#
|
|
246
|
+
# If the `value has to change`-parameter is set to true, the callback is only
|
|
247
|
+
# triggered after the value has changed. If the value didn't change
|
|
248
|
+
# within the period, the callback is triggered immediately on change.
|
|
249
|
+
#
|
|
250
|
+
# If it is set to false, the callback is continuously triggered with the period,
|
|
251
|
+
# independent of the value.
|
|
252
|
+
#
|
|
253
|
+
# It is furthermore possible to constrain the callback with thresholds.
|
|
254
|
+
#
|
|
255
|
+
# The `option`-parameter together with min/max sets a threshold for the CALLBACK_COLOR_TEMPERATURE callback.
|
|
256
|
+
#
|
|
257
|
+
# The following options are possible:
|
|
258
|
+
#
|
|
259
|
+
# "Option", "Description"
|
|
260
|
+
#
|
|
261
|
+
# "'x'", "Threshold is turned off"
|
|
262
|
+
# "'o'", "Threshold is triggered when the value is *outside* the min and max values"
|
|
263
|
+
# "'i'", "Threshold is triggered when the value is *inside* or equal to the min and max values"
|
|
264
|
+
# "'<'", "Threshold is triggered when the value is smaller than the min value (max is ignored)"
|
|
265
|
+
# "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
|
|
266
|
+
#
|
|
267
|
+
# If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
|
|
268
|
+
#
|
|
269
|
+
# The default value is (0, false, 'x', 0, 0).
|
|
270
|
+
def set_color_temperature_callback_configuration(period, value_has_to_change, option, min, max)
|
|
271
|
+
send_request FUNCTION_SET_COLOR_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k S S', 0, ''
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
# Returns the callback configuration as set by BrickletColorV2#set_color_temperature_callback_configuration.
|
|
275
|
+
def get_color_temperature_callback_configuration
|
|
276
|
+
send_request FUNCTION_GET_COLOR_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 10, 'L ? k S S'
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
# Turns the white LED on the Bricklet on/off.
|
|
280
|
+
def set_light(enable)
|
|
281
|
+
send_request FUNCTION_SET_LIGHT, [enable], '?', 0, ''
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
# Returns the value as set by BrickletColorV2#set_light.
|
|
285
|
+
def get_light
|
|
286
|
+
send_request FUNCTION_GET_LIGHT, [], '', 1, '?'
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
# Sets the configuration of the sensor. Gain and integration time
|
|
290
|
+
# can be configured this way.
|
|
291
|
+
#
|
|
292
|
+
# For configuring the gain:
|
|
293
|
+
#
|
|
294
|
+
# * 0: 1x Gain
|
|
295
|
+
# * 1: 4x Gain
|
|
296
|
+
# * 2: 16x Gain
|
|
297
|
+
# * 3: 60x Gain
|
|
298
|
+
#
|
|
299
|
+
# For configuring the integration time:
|
|
300
|
+
#
|
|
301
|
+
# * 0: 2.4ms
|
|
302
|
+
# * 1: 24ms
|
|
303
|
+
# * 2: 101ms
|
|
304
|
+
# * 3: 154ms
|
|
305
|
+
# * 4: 700ms
|
|
306
|
+
#
|
|
307
|
+
# Increasing the gain enables the sensor to detect a
|
|
308
|
+
# color from a higher distance.
|
|
309
|
+
#
|
|
310
|
+
# The integration time provides a trade-off between conversion time
|
|
311
|
+
# and accuracy. With a longer integration time the values read will
|
|
312
|
+
# be more accurate but it will take longer to get the conversion
|
|
313
|
+
# results.
|
|
314
|
+
#
|
|
315
|
+
# The default values are 60x gain and 154ms integration time.
|
|
316
|
+
def set_configuration(gain, integration_time)
|
|
317
|
+
send_request FUNCTION_SET_CONFIGURATION, [gain, integration_time], 'C C', 0, ''
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
# Returns the configuration as set by BrickletColorV2#set_configuration.
|
|
321
|
+
def get_configuration
|
|
322
|
+
send_request FUNCTION_GET_CONFIGURATION, [], '', 2, 'C C'
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
# Returns the error count for the communication between Brick and Bricklet.
|
|
326
|
+
#
|
|
327
|
+
# The errors are divided into
|
|
328
|
+
#
|
|
329
|
+
# * ACK checksum errors,
|
|
330
|
+
# * message checksum errors,
|
|
331
|
+
# * framing errors and
|
|
332
|
+
# * overflow errors.
|
|
333
|
+
#
|
|
334
|
+
# The errors counts are for errors that occur on the Bricklet side. All
|
|
335
|
+
# Bricks have a similar function that returns the errors on the Brick side.
|
|
336
|
+
def get_spitfp_error_count
|
|
337
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
|
|
338
|
+
end
|
|
339
|
+
|
|
340
|
+
# Sets the bootloader mode and returns the status after the requested
|
|
341
|
+
# mode change was instigated.
|
|
342
|
+
#
|
|
343
|
+
# You can change from bootloader mode to firmware mode and vice versa. A change
|
|
344
|
+
# from bootloader mode to firmware mode will only take place if the entry function,
|
|
345
|
+
# device identifier and CRC are present and correct.
|
|
346
|
+
#
|
|
347
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
|
348
|
+
# necessary to call it in a normal user program.
|
|
349
|
+
def set_bootloader_mode(mode)
|
|
350
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
|
|
351
|
+
end
|
|
352
|
+
|
|
353
|
+
# Returns the current bootloader mode, see BrickletColorV2#set_bootloader_mode.
|
|
354
|
+
def get_bootloader_mode
|
|
355
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
|
|
356
|
+
end
|
|
357
|
+
|
|
358
|
+
# Sets the firmware pointer for BrickletColorV2#write_firmware. The pointer has
|
|
359
|
+
# to be increased by chunks of size 64. The data is written to flash
|
|
360
|
+
# every 4 chunks (which equals to one page of size 256).
|
|
361
|
+
#
|
|
362
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
|
363
|
+
# necessary to call it in a normal user program.
|
|
364
|
+
def set_write_firmware_pointer(pointer)
|
|
365
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
|
|
366
|
+
end
|
|
367
|
+
|
|
368
|
+
# Writes 64 Bytes of firmware at the position as written by
|
|
369
|
+
# BrickletColorV2#set_write_firmware_pointer before. The firmware is written
|
|
370
|
+
# to flash every 4 chunks.
|
|
371
|
+
#
|
|
372
|
+
# You can only write firmware in bootloader mode.
|
|
373
|
+
#
|
|
374
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
|
375
|
+
# necessary to call it in a normal user program.
|
|
376
|
+
def write_firmware(data)
|
|
377
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
|
|
378
|
+
end
|
|
379
|
+
|
|
380
|
+
# Sets the status LED configuration. By default the LED shows
|
|
381
|
+
# communication traffic between Brick and Bricklet, it flickers once
|
|
382
|
+
# for every 10 received data packets.
|
|
383
|
+
#
|
|
384
|
+
# You can also turn the LED permanently on/off or show a heartbeat.
|
|
385
|
+
#
|
|
386
|
+
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
|
387
|
+
def set_status_led_config(config)
|
|
388
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
|
|
389
|
+
end
|
|
390
|
+
|
|
391
|
+
# Returns the configuration as set by BrickletColorV2#set_status_led_config
|
|
392
|
+
def get_status_led_config
|
|
393
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
|
|
394
|
+
end
|
|
395
|
+
|
|
396
|
+
# Returns the temperature in °C as measured inside the microcontroller. The
|
|
397
|
+
# value returned is not the ambient temperature!
|
|
398
|
+
#
|
|
399
|
+
# The temperature is only proportional to the real temperature and it has bad
|
|
400
|
+
# accuracy. Practically it is only useful as an indicator for
|
|
401
|
+
# temperature changes.
|
|
402
|
+
def get_chip_temperature
|
|
403
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
|
|
404
|
+
end
|
|
405
|
+
|
|
406
|
+
# Calling this function will reset the Bricklet. All configurations
|
|
407
|
+
# will be lost.
|
|
408
|
+
#
|
|
409
|
+
# After a reset you have to create new device objects,
|
|
410
|
+
# calling functions on the existing ones will result in
|
|
411
|
+
# undefined behavior!
|
|
412
|
+
def reset
|
|
413
|
+
send_request FUNCTION_RESET, [], '', 0, ''
|
|
414
|
+
end
|
|
415
|
+
|
|
416
|
+
# Writes a new UID into flash. If you want to set a new UID
|
|
417
|
+
# you have to decode the Base58 encoded UID string into an
|
|
418
|
+
# integer first.
|
|
419
|
+
#
|
|
420
|
+
# We recommend that you use Brick Viewer to change the UID.
|
|
421
|
+
def write_uid(uid)
|
|
422
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
|
|
423
|
+
end
|
|
424
|
+
|
|
425
|
+
# Returns the current UID as an integer. Encode as
|
|
426
|
+
# Base58 to get the usual string version.
|
|
427
|
+
def read_uid
|
|
428
|
+
send_request FUNCTION_READ_UID, [], '', 4, 'L'
|
|
429
|
+
end
|
|
430
|
+
|
|
431
|
+
# Returns the UID, the UID where the Bricklet is connected to,
|
|
432
|
+
# the position, the hardware and firmware version as well as the
|
|
433
|
+
# device identifier.
|
|
434
|
+
#
|
|
435
|
+
# The position can be 'a', 'b', 'c' or 'd'.
|
|
436
|
+
#
|
|
437
|
+
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
438
|
+
# |device_identifier_constant|
|
|
439
|
+
def get_identity
|
|
440
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
|
441
|
+
end
|
|
442
|
+
|
|
443
|
+
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|
|
444
|
+
def register_callback(id, &block)
|
|
445
|
+
callback = block
|
|
446
|
+
@registered_callbacks[id] = callback
|
|
447
|
+
end
|
|
448
|
+
end
|
|
449
|
+
end
|