tinkerforge 2.1.20 → 2.1.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tinkerforge/brick_dc.rb +2 -2
- data/lib/tinkerforge/brick_imu.rb +2 -2
- data/lib/tinkerforge/brick_imu_v2.rb +2 -2
- data/lib/tinkerforge/brick_master.rb +2 -2
- data/lib/tinkerforge/brick_red.rb +2 -2
- data/lib/tinkerforge/brick_servo.rb +2 -2
- data/lib/tinkerforge/brick_silent_stepper.rb +5 -5
- data/lib/tinkerforge/brick_stepper.rb +2 -2
- data/lib/tinkerforge/bricklet_accelerometer.rb +2 -2
- data/lib/tinkerforge/bricklet_accelerometer_v2.rb +362 -0
- data/lib/tinkerforge/bricklet_air_quality.rb +4 -4
- 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 +314 -0
- 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_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 +2 -2
- 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 +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 +2 -2
- data/lib/tinkerforge/bricklet_hall_effect.rb +2 -2
- data/lib/tinkerforge/bricklet_humidity.rb +2 -2
- data/lib/tinkerforge/bricklet_humidity_v2.rb +3 -3
- 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_laser_range_finder.rb +2 -2
- data/lib/tinkerforge/bricklet_lcd_128x64.rb +14 -13
- 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_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_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 +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_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_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_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 +2 -2
- data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +2 -2
- 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 +2 -2
- data/lib/tinkerforge/version.rb +1 -1
- metadata +4 -2
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on
|
3
|
+
# This file was automatically generated on 2019-01-29. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.21 #
|
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 #
|
@@ -166,8 +166,8 @@ module Tinkerforge
|
|
166
166
|
send_request FUNCTION_GET_ALL_VALUES, [], '', 17, 'l C l l l'
|
167
167
|
end
|
168
168
|
|
169
|
-
# Sets a temperature offset
|
170
|
-
# temperature by 0.1°C.
|
169
|
+
# Sets a temperature offset with resolution 1/100°C. A offset of 10 will decrease
|
170
|
+
# the measured temperature by 0.1°C.
|
171
171
|
#
|
172
172
|
# If you install this Bricklet into an enclosure and you want to measure the ambient
|
173
173
|
# temperature, you may have to decrease the measured temperature by some value to
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on
|
3
|
+
# This file was automatically generated on 2019-01-29. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.21 #
|
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
|
3
|
+
# This file was automatically generated on 2019-01-29. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.21 #
|
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,314 @@
|
|
1
|
+
# -*- ruby encoding: utf-8 -*-
|
2
|
+
#############################################################
|
3
|
+
# This file was automatically generated on 2019-01-29. #
|
4
|
+
# #
|
5
|
+
# Ruby Bindings Version 2.1.21 #
|
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
|
+
#
|
14
|
+
class BrickletAmbientLightV3 < Device
|
15
|
+
DEVICE_IDENTIFIER = 2131 # :nodoc:
|
16
|
+
DEVICE_DISPLAY_NAME = 'Ambient Light Bricklet 3.0' # :nodoc:
|
17
|
+
|
18
|
+
# This callback is triggered periodically according to the configuration set by
|
19
|
+
# BrickletAmbientLightV3#set_illuminance_callback_configuration.
|
20
|
+
#
|
21
|
+
# The parameter is the same as BrickletAmbientLightV3#get_illuminance.
|
22
|
+
CALLBACK_ILLUMINANCE = 4
|
23
|
+
|
24
|
+
FUNCTION_GET_ILLUMINANCE = 1 # :nodoc:
|
25
|
+
FUNCTION_SET_ILLUMINANCE_CALLBACK_CONFIGURATION = 2 # :nodoc:
|
26
|
+
FUNCTION_GET_ILLUMINANCE_CALLBACK_CONFIGURATION = 3 # :nodoc:
|
27
|
+
FUNCTION_SET_CONFIGURATION = 5 # :nodoc:
|
28
|
+
FUNCTION_GET_CONFIGURATION = 6 # :nodoc:
|
29
|
+
FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
|
30
|
+
FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
|
31
|
+
FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
|
32
|
+
FUNCTION_SET_WRITE_FIRMWARE_POINTER = 237 # :nodoc:
|
33
|
+
FUNCTION_WRITE_FIRMWARE = 238 # :nodoc:
|
34
|
+
FUNCTION_SET_STATUS_LED_CONFIG = 239 # :nodoc:
|
35
|
+
FUNCTION_GET_STATUS_LED_CONFIG = 240 # :nodoc:
|
36
|
+
FUNCTION_GET_CHIP_TEMPERATURE = 242 # :nodoc:
|
37
|
+
FUNCTION_RESET = 243 # :nodoc:
|
38
|
+
FUNCTION_WRITE_UID = 248 # :nodoc:
|
39
|
+
FUNCTION_READ_UID = 249 # :nodoc:
|
40
|
+
FUNCTION_GET_IDENTITY = 255 # :nodoc:
|
41
|
+
|
42
|
+
THRESHOLD_OPTION_OFF = 'x' # :nodoc:
|
43
|
+
THRESHOLD_OPTION_OUTSIDE = 'o' # :nodoc:
|
44
|
+
THRESHOLD_OPTION_INSIDE = 'i' # :nodoc:
|
45
|
+
THRESHOLD_OPTION_SMALLER = '<' # :nodoc:
|
46
|
+
THRESHOLD_OPTION_GREATER = '>' # :nodoc:
|
47
|
+
ILLUMINANCE_RANGE_UNLIMITED = 6 # :nodoc:
|
48
|
+
ILLUMINANCE_RANGE_64000LUX = 0 # :nodoc:
|
49
|
+
ILLUMINANCE_RANGE_32000LUX = 1 # :nodoc:
|
50
|
+
ILLUMINANCE_RANGE_16000LUX = 2 # :nodoc:
|
51
|
+
ILLUMINANCE_RANGE_8000LUX = 3 # :nodoc:
|
52
|
+
ILLUMINANCE_RANGE_1300LUX = 4 # :nodoc:
|
53
|
+
ILLUMINANCE_RANGE_600LUX = 5 # :nodoc:
|
54
|
+
INTEGRATION_TIME_50MS = 0 # :nodoc:
|
55
|
+
INTEGRATION_TIME_100MS = 1 # :nodoc:
|
56
|
+
INTEGRATION_TIME_150MS = 2 # :nodoc:
|
57
|
+
INTEGRATION_TIME_200MS = 3 # :nodoc:
|
58
|
+
INTEGRATION_TIME_250MS = 4 # :nodoc:
|
59
|
+
INTEGRATION_TIME_300MS = 5 # :nodoc:
|
60
|
+
INTEGRATION_TIME_350MS = 6 # :nodoc:
|
61
|
+
INTEGRATION_TIME_400MS = 7 # :nodoc:
|
62
|
+
BOOTLOADER_MODE_BOOTLOADER = 0 # :nodoc:
|
63
|
+
BOOTLOADER_MODE_FIRMWARE = 1 # :nodoc:
|
64
|
+
BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT = 2 # :nodoc:
|
65
|
+
BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT = 3 # :nodoc:
|
66
|
+
BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT = 4 # :nodoc:
|
67
|
+
BOOTLOADER_STATUS_OK = 0 # :nodoc:
|
68
|
+
BOOTLOADER_STATUS_INVALID_MODE = 1 # :nodoc:
|
69
|
+
BOOTLOADER_STATUS_NO_CHANGE = 2 # :nodoc:
|
70
|
+
BOOTLOADER_STATUS_ENTRY_FUNCTION_NOT_PRESENT = 3 # :nodoc:
|
71
|
+
BOOTLOADER_STATUS_DEVICE_IDENTIFIER_INCORRECT = 4 # :nodoc:
|
72
|
+
BOOTLOADER_STATUS_CRC_MISMATCH = 5 # :nodoc:
|
73
|
+
STATUS_LED_CONFIG_OFF = 0 # :nodoc:
|
74
|
+
STATUS_LED_CONFIG_ON = 1 # :nodoc:
|
75
|
+
STATUS_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
|
76
|
+
STATUS_LED_CONFIG_SHOW_STATUS = 3 # :nodoc:
|
77
|
+
|
78
|
+
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
79
|
+
# the IP Connection <tt>ipcon</tt>.
|
80
|
+
def initialize(uid, ipcon)
|
81
|
+
super uid, ipcon
|
82
|
+
|
83
|
+
@api_version = [2, 0, 0]
|
84
|
+
|
85
|
+
@response_expected[FUNCTION_GET_ILLUMINANCE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
86
|
+
@response_expected[FUNCTION_SET_ILLUMINANCE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
|
87
|
+
@response_expected[FUNCTION_GET_ILLUMINANCE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
88
|
+
@response_expected[FUNCTION_SET_CONFIGURATION] = RESPONSE_EXPECTED_FALSE
|
89
|
+
@response_expected[FUNCTION_GET_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
90
|
+
@response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
91
|
+
@response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
92
|
+
@response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
93
|
+
@response_expected[FUNCTION_SET_WRITE_FIRMWARE_POINTER] = RESPONSE_EXPECTED_FALSE
|
94
|
+
@response_expected[FUNCTION_WRITE_FIRMWARE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
95
|
+
@response_expected[FUNCTION_SET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
|
96
|
+
@response_expected[FUNCTION_GET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
97
|
+
@response_expected[FUNCTION_GET_CHIP_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
98
|
+
@response_expected[FUNCTION_RESET] = RESPONSE_EXPECTED_FALSE
|
99
|
+
@response_expected[FUNCTION_WRITE_UID] = RESPONSE_EXPECTED_FALSE
|
100
|
+
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
101
|
+
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
102
|
+
|
103
|
+
@callback_formats[CALLBACK_ILLUMINANCE] = 'L'
|
104
|
+
|
105
|
+
end
|
106
|
+
|
107
|
+
# Returns the illuminance of the ambient light sensor. The measurement range goes
|
108
|
+
# up to about 100000lux, but above 64000lux the precision starts to drop.
|
109
|
+
# The illuminance is given in lux/100, i.e. a value of 450000 means that an
|
110
|
+
# illuminance of 4500lux is measured.
|
111
|
+
#
|
112
|
+
# An illuminance of 0lux indicates that the sensor is saturated and the
|
113
|
+
# configuration should be modified, see BrickletAmbientLightV3#set_configuration.
|
114
|
+
#
|
115
|
+
#
|
116
|
+
# If you want to get the value periodically, it is recommended to use the
|
117
|
+
# CALLBACK_ILLUMINANCE callback. You can set the callback configuration
|
118
|
+
# with BrickletAmbientLightV3#set_illuminance_callback_configuration.
|
119
|
+
def get_illuminance
|
120
|
+
send_request FUNCTION_GET_ILLUMINANCE, [], '', 4, 'L'
|
121
|
+
end
|
122
|
+
|
123
|
+
# The period in ms is the period with which the CALLBACK_ILLUMINANCE callback is triggered
|
124
|
+
# periodically. A value of 0 turns the callback off.
|
125
|
+
#
|
126
|
+
# If the `value has to change`-parameter is set to true, the callback is only
|
127
|
+
# triggered after the value has changed. If the value didn't change
|
128
|
+
# within the period, the callback is triggered immediately on change.
|
129
|
+
#
|
130
|
+
# If it is set to false, the callback is continuously triggered with the period,
|
131
|
+
# independent of the value.
|
132
|
+
#
|
133
|
+
# It is furthermore possible to constrain the callback with thresholds.
|
134
|
+
#
|
135
|
+
# The `option`-parameter together with min/max sets a threshold for the CALLBACK_ILLUMINANCE callback.
|
136
|
+
#
|
137
|
+
# The following options are possible:
|
138
|
+
#
|
139
|
+
# "Option", "Description"
|
140
|
+
#
|
141
|
+
# "'x'", "Threshold is turned off"
|
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* or equal to the min and max values"
|
144
|
+
# "'<'", "Threshold is triggered when the value is smaller than the min value (max is ignored)"
|
145
|
+
# "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
|
146
|
+
#
|
147
|
+
# If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
|
148
|
+
#
|
149
|
+
# The default value is (0, false, 'x', 0, 0).
|
150
|
+
def set_illuminance_callback_configuration(period, value_has_to_change, option, min, max)
|
151
|
+
send_request FUNCTION_SET_ILLUMINANCE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k L L', 0, ''
|
152
|
+
end
|
153
|
+
|
154
|
+
# Returns the callback configuration as set by BrickletAmbientLightV3#set_illuminance_callback_configuration.
|
155
|
+
def get_illuminance_callback_configuration
|
156
|
+
send_request FUNCTION_GET_ILLUMINANCE_CALLBACK_CONFIGURATION, [], '', 14, 'L ? k L L'
|
157
|
+
end
|
158
|
+
|
159
|
+
# Sets the configuration. It is possible to configure an illuminance range
|
160
|
+
# between 0-600lux and 0-64000lux and an integration time between 50ms and 400ms.
|
161
|
+
#
|
162
|
+
# The unlimited illuminance range allows to measure up to about 100000lux, but
|
163
|
+
# above 64000lux the precision starts to drop.
|
164
|
+
#
|
165
|
+
# A smaller illuminance range increases the resolution of the data. A longer
|
166
|
+
# integration time will result in less noise on the data.
|
167
|
+
#
|
168
|
+
# If the actual measure illuminance is out-of-range then the current illuminance
|
169
|
+
# range maximum +0.01lux is reported by BrickletAmbientLightV3#get_illuminance and the
|
170
|
+
# CALLBACK_ILLUMINANCE callback. For example, 800001 for the 0-8000lux range.
|
171
|
+
#
|
172
|
+
# With a long integration time the sensor might be saturated before the measured
|
173
|
+
# value reaches the maximum of the selected illuminance range. In this case 0lux
|
174
|
+
# is reported by BrickletAmbientLightV3#get_illuminance and the CALLBACK_ILLUMINANCE callback.
|
175
|
+
#
|
176
|
+
# If the measurement is out-of-range or the sensor is saturated then you should
|
177
|
+
# configure the next higher illuminance range. If the highest range is already
|
178
|
+
# in use, then start to reduce the integration time.
|
179
|
+
#
|
180
|
+
# The default values are 0-8000lux illuminance range and 150ms integration time.
|
181
|
+
def set_configuration(illuminance_range, integration_time)
|
182
|
+
send_request FUNCTION_SET_CONFIGURATION, [illuminance_range, integration_time], 'C C', 0, ''
|
183
|
+
end
|
184
|
+
|
185
|
+
# Returns the configuration as set by BrickletAmbientLightV3#set_configuration.
|
186
|
+
def get_configuration
|
187
|
+
send_request FUNCTION_GET_CONFIGURATION, [], '', 2, 'C C'
|
188
|
+
end
|
189
|
+
|
190
|
+
# Returns the error count for the communication between Brick and Bricklet.
|
191
|
+
#
|
192
|
+
# The errors are divided into
|
193
|
+
#
|
194
|
+
# * ACK checksum errors,
|
195
|
+
# * message checksum errors,
|
196
|
+
# * framing errors and
|
197
|
+
# * overflow errors.
|
198
|
+
#
|
199
|
+
# The errors counts are for errors that occur on the Bricklet side. All
|
200
|
+
# Bricks have a similar function that returns the errors on the Brick side.
|
201
|
+
def get_spitfp_error_count
|
202
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
|
203
|
+
end
|
204
|
+
|
205
|
+
# Sets the bootloader mode and returns the status after the requested
|
206
|
+
# mode change was instigated.
|
207
|
+
#
|
208
|
+
# You can change from bootloader mode to firmware mode and vice versa. A change
|
209
|
+
# from bootloader mode to firmware mode will only take place if the entry function,
|
210
|
+
# device identifier and CRC are present and correct.
|
211
|
+
#
|
212
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
213
|
+
# necessary to call it in a normal user program.
|
214
|
+
def set_bootloader_mode(mode)
|
215
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
|
216
|
+
end
|
217
|
+
|
218
|
+
# Returns the current bootloader mode, see BrickletAmbientLightV3#set_bootloader_mode.
|
219
|
+
def get_bootloader_mode
|
220
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
|
221
|
+
end
|
222
|
+
|
223
|
+
# Sets the firmware pointer for BrickletAmbientLightV3#write_firmware. The pointer has
|
224
|
+
# to be increased by chunks of size 64. The data is written to flash
|
225
|
+
# every 4 chunks (which equals to one page of size 256).
|
226
|
+
#
|
227
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
228
|
+
# necessary to call it in a normal user program.
|
229
|
+
def set_write_firmware_pointer(pointer)
|
230
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
|
231
|
+
end
|
232
|
+
|
233
|
+
# Writes 64 Bytes of firmware at the position as written by
|
234
|
+
# BrickletAmbientLightV3#set_write_firmware_pointer before. The firmware is written
|
235
|
+
# to flash every 4 chunks.
|
236
|
+
#
|
237
|
+
# You can only write firmware in bootloader mode.
|
238
|
+
#
|
239
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
240
|
+
# necessary to call it in a normal user program.
|
241
|
+
def write_firmware(data)
|
242
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
|
243
|
+
end
|
244
|
+
|
245
|
+
# Sets the status LED configuration. By default the LED shows
|
246
|
+
# communication traffic between Brick and Bricklet, it flickers once
|
247
|
+
# for every 10 received data packets.
|
248
|
+
#
|
249
|
+
# You can also turn the LED permanently on/off or show a heartbeat.
|
250
|
+
#
|
251
|
+
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
252
|
+
def set_status_led_config(config)
|
253
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
|
254
|
+
end
|
255
|
+
|
256
|
+
# Returns the configuration as set by BrickletAmbientLightV3#set_status_led_config
|
257
|
+
def get_status_led_config
|
258
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
|
259
|
+
end
|
260
|
+
|
261
|
+
# Returns the temperature in °C as measured inside the microcontroller. The
|
262
|
+
# value returned is not the ambient temperature!
|
263
|
+
#
|
264
|
+
# The temperature is only proportional to the real temperature and it has bad
|
265
|
+
# accuracy. Practically it is only useful as an indicator for
|
266
|
+
# temperature changes.
|
267
|
+
def get_chip_temperature
|
268
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
|
269
|
+
end
|
270
|
+
|
271
|
+
# Calling this function will reset the Bricklet. All configurations
|
272
|
+
# will be lost.
|
273
|
+
#
|
274
|
+
# After a reset you have to create new device objects,
|
275
|
+
# calling functions on the existing ones will result in
|
276
|
+
# undefined behavior!
|
277
|
+
def reset
|
278
|
+
send_request FUNCTION_RESET, [], '', 0, ''
|
279
|
+
end
|
280
|
+
|
281
|
+
# Writes a new UID into flash. If you want to set a new UID
|
282
|
+
# you have to decode the Base58 encoded UID string into an
|
283
|
+
# integer first.
|
284
|
+
#
|
285
|
+
# We recommend that you use Brick Viewer to change the UID.
|
286
|
+
def write_uid(uid)
|
287
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
|
288
|
+
end
|
289
|
+
|
290
|
+
# Returns the current UID as an integer. Encode as
|
291
|
+
# Base58 to get the usual string version.
|
292
|
+
def read_uid
|
293
|
+
send_request FUNCTION_READ_UID, [], '', 4, 'L'
|
294
|
+
end
|
295
|
+
|
296
|
+
# Returns the UID, the UID where the Bricklet is connected to,
|
297
|
+
# the position, the hardware and firmware version as well as the
|
298
|
+
# device identifier.
|
299
|
+
#
|
300
|
+
# The position can be 'a', 'b', 'c' or 'd'.
|
301
|
+
#
|
302
|
+
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
303
|
+
# |device_identifier_constant|
|
304
|
+
def get_identity
|
305
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
306
|
+
end
|
307
|
+
|
308
|
+
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|
309
|
+
def register_callback(id, &block)
|
310
|
+
callback = block
|
311
|
+
@registered_callbacks[id] = callback
|
312
|
+
end
|
313
|
+
end
|
314
|
+
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on
|
3
|
+
# This file was automatically generated on 2019-01-29. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.21 #
|
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
|
3
|
+
# This file was automatically generated on 2019-01-29. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.21 #
|
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
|
3
|
+
# This file was automatically generated on 2019-01-29. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.21 #
|
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
|
3
|
+
# This file was automatically generated on 2019-01-29. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.21 #
|
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
|
3
|
+
# This file was automatically generated on 2019-01-29. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.21 #
|
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
|
3
|
+
# This file was automatically generated on 2019-01-29. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.21 #
|
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
|
3
|
+
# This file was automatically generated on 2019-01-29. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.21 #
|
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
|
3
|
+
# This file was automatically generated on 2019-01-29. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.21 #
|
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 #
|