tinkerforge 2.1.20 → 2.1.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tinkerforge/brick_dc.rb +2 -2
  3. data/lib/tinkerforge/brick_imu.rb +2 -2
  4. data/lib/tinkerforge/brick_imu_v2.rb +2 -2
  5. data/lib/tinkerforge/brick_master.rb +2 -2
  6. data/lib/tinkerforge/brick_red.rb +2 -2
  7. data/lib/tinkerforge/brick_servo.rb +2 -2
  8. data/lib/tinkerforge/brick_silent_stepper.rb +5 -5
  9. data/lib/tinkerforge/brick_stepper.rb +2 -2
  10. data/lib/tinkerforge/bricklet_accelerometer.rb +2 -2
  11. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +362 -0
  12. data/lib/tinkerforge/bricklet_air_quality.rb +4 -4
  13. data/lib/tinkerforge/bricklet_ambient_light.rb +2 -2
  14. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +2 -2
  15. data/lib/tinkerforge/bricklet_ambient_light_v3.rb +314 -0
  16. data/lib/tinkerforge/bricklet_analog_in.rb +2 -2
  17. data/lib/tinkerforge/bricklet_analog_in_v2.rb +2 -2
  18. data/lib/tinkerforge/bricklet_analog_in_v3.rb +2 -2
  19. data/lib/tinkerforge/bricklet_analog_out.rb +2 -2
  20. data/lib/tinkerforge/bricklet_analog_out_v2.rb +2 -2
  21. data/lib/tinkerforge/bricklet_analog_out_v3.rb +2 -2
  22. data/lib/tinkerforge/bricklet_barometer.rb +2 -2
  23. data/lib/tinkerforge/bricklet_barometer_v2.rb +2 -2
  24. data/lib/tinkerforge/bricklet_can.rb +2 -2
  25. data/lib/tinkerforge/bricklet_can_v2.rb +2 -2
  26. data/lib/tinkerforge/bricklet_co2.rb +2 -2
  27. data/lib/tinkerforge/bricklet_color.rb +2 -2
  28. data/lib/tinkerforge/bricklet_current12.rb +2 -2
  29. data/lib/tinkerforge/bricklet_current25.rb +2 -2
  30. data/lib/tinkerforge/bricklet_distance_ir.rb +2 -2
  31. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +2 -2
  32. data/lib/tinkerforge/bricklet_distance_us.rb +2 -2
  33. data/lib/tinkerforge/bricklet_dmx.rb +2 -2
  34. data/lib/tinkerforge/bricklet_dual_button.rb +2 -2
  35. data/lib/tinkerforge/bricklet_dual_button_v2.rb +2 -2
  36. data/lib/tinkerforge/bricklet_dual_relay.rb +2 -2
  37. data/lib/tinkerforge/bricklet_dust_detector.rb +2 -2
  38. data/lib/tinkerforge/bricklet_gps.rb +2 -2
  39. data/lib/tinkerforge/bricklet_gps_v2.rb +2 -2
  40. data/lib/tinkerforge/bricklet_hall_effect.rb +2 -2
  41. data/lib/tinkerforge/bricklet_humidity.rb +2 -2
  42. data/lib/tinkerforge/bricklet_humidity_v2.rb +3 -3
  43. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +2 -2
  44. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +2 -2
  45. data/lib/tinkerforge/bricklet_industrial_counter.rb +2 -2
  46. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +2 -2
  47. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +2 -2
  48. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +2 -2
  49. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +2 -2
  50. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +2 -2
  51. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +2 -2
  52. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +2 -2
  53. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +2 -2
  54. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +2 -2
  55. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +2 -2
  56. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +2 -2
  57. data/lib/tinkerforge/bricklet_io16.rb +2 -2
  58. data/lib/tinkerforge/bricklet_io16_v2.rb +2 -2
  59. data/lib/tinkerforge/bricklet_io4.rb +2 -2
  60. data/lib/tinkerforge/bricklet_io4_v2.rb +2 -2
  61. data/lib/tinkerforge/bricklet_isolator.rb +2 -2
  62. data/lib/tinkerforge/bricklet_joystick.rb +2 -2
  63. data/lib/tinkerforge/bricklet_laser_range_finder.rb +2 -2
  64. data/lib/tinkerforge/bricklet_lcd_128x64.rb +14 -13
  65. data/lib/tinkerforge/bricklet_lcd_16x2.rb +2 -2
  66. data/lib/tinkerforge/bricklet_lcd_20x4.rb +2 -2
  67. data/lib/tinkerforge/bricklet_led_strip.rb +2 -2
  68. data/lib/tinkerforge/bricklet_led_strip_v2.rb +2 -2
  69. data/lib/tinkerforge/bricklet_line.rb +2 -2
  70. data/lib/tinkerforge/bricklet_linear_poti.rb +2 -2
  71. data/lib/tinkerforge/bricklet_load_cell.rb +2 -2
  72. data/lib/tinkerforge/bricklet_load_cell_v2.rb +2 -2
  73. data/lib/tinkerforge/bricklet_moisture.rb +2 -2
  74. data/lib/tinkerforge/bricklet_motion_detector.rb +2 -2
  75. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +2 -2
  76. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +2 -2
  77. data/lib/tinkerforge/bricklet_multi_touch.rb +2 -2
  78. data/lib/tinkerforge/bricklet_nfc.rb +2 -2
  79. data/lib/tinkerforge/bricklet_nfc_rfid.rb +2 -2
  80. data/lib/tinkerforge/bricklet_oled_128x64.rb +2 -2
  81. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +2 -2
  82. data/lib/tinkerforge/bricklet_oled_64x48.rb +2 -2
  83. data/lib/tinkerforge/bricklet_one_wire.rb +2 -2
  84. data/lib/tinkerforge/bricklet_outdoor_weather.rb +2 -2
  85. data/lib/tinkerforge/bricklet_particulate_matter.rb +2 -2
  86. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +2 -2
  87. data/lib/tinkerforge/bricklet_piezo_speaker.rb +2 -2
  88. data/lib/tinkerforge/bricklet_ptc.rb +2 -2
  89. data/lib/tinkerforge/bricklet_ptc_v2.rb +2 -2
  90. data/lib/tinkerforge/bricklet_real_time_clock.rb +2 -2
  91. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +2 -2
  92. data/lib/tinkerforge/bricklet_remote_switch.rb +2 -2
  93. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +2 -2
  94. data/lib/tinkerforge/bricklet_rgb_led.rb +2 -2
  95. data/lib/tinkerforge/bricklet_rgb_led_button.rb +2 -2
  96. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +2 -2
  97. data/lib/tinkerforge/bricklet_rotary_encoder.rb +2 -2
  98. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +2 -2
  99. data/lib/tinkerforge/bricklet_rotary_poti.rb +2 -2
  100. data/lib/tinkerforge/bricklet_rs232.rb +2 -2
  101. data/lib/tinkerforge/bricklet_rs232_v2.rb +2 -2
  102. data/lib/tinkerforge/bricklet_rs485.rb +2 -2
  103. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +2 -2
  104. data/lib/tinkerforge/bricklet_solid_state_relay.rb +2 -2
  105. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +2 -2
  106. data/lib/tinkerforge/bricklet_sound_intensity.rb +2 -2
  107. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +2 -2
  108. data/lib/tinkerforge/bricklet_temperature.rb +2 -2
  109. data/lib/tinkerforge/bricklet_temperature_ir.rb +2 -2
  110. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +2 -2
  111. data/lib/tinkerforge/bricklet_temperature_v2.rb +2 -2
  112. data/lib/tinkerforge/bricklet_thermal_imaging.rb +2 -2
  113. data/lib/tinkerforge/bricklet_thermocouple.rb +2 -2
  114. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +2 -2
  115. data/lib/tinkerforge/bricklet_tilt.rb +2 -2
  116. data/lib/tinkerforge/bricklet_uv_light.rb +2 -2
  117. data/lib/tinkerforge/bricklet_uv_light_v2.rb +2 -2
  118. data/lib/tinkerforge/bricklet_voltage.rb +2 -2
  119. data/lib/tinkerforge/bricklet_voltage_current.rb +2 -2
  120. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +2 -2
  121. data/lib/tinkerforge/version.rb +1 -1
  122. metadata +4 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ba816717f619f78a65654def0ad9ec66b9661104
4
- data.tar.gz: 7ec363aa164e33a265d6b89af3e27b9802f5a591
3
+ metadata.gz: c0e13316b2134f70d2cd899ca3c825e7ee81bd03
4
+ data.tar.gz: 0207a2159de4aa40766a038774226c4095a672a4
5
5
  SHA512:
6
- metadata.gz: a3980e9585a3b2f7453d5263de9e49ba41cfe27126efcaed85ee18e2eac83f4477d5d38e6c428a089d9089c02a22f985fd33f4fc956e618370e5df0ad982f5d6
7
- data.tar.gz: 410466a637c7ff6787c6e156e8971edfea00fd6b2a4233ad2c3523d10841cefce2a6ca6b98b846578a8e9aa1a3988302fbee4de7658d3166072441bf1630c9f7
6
+ metadata.gz: a9b2b102d33c025abcf407e6527607748ad94f4e219ed61265c6696bc6a81d0fd84c3f872eecd4b8d09c8382945909fcf512ff83677a2bf19f3d54709176ae15
7
+ data.tar.gz: 04e9411dc4e9a0d937c0988e788844edc4fce1a316665800013ad950230262c5a1bace1f7d6aa1ce53453f5af069029d0cd397a3d42177da23827e5381d50886
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2018-11-28. #
3
+ # This file was automatically generated on 2019-01-29. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.20 #
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 2018-11-28. #
3
+ # This file was automatically generated on 2019-01-29. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.20 #
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 2018-11-28. #
3
+ # This file was automatically generated on 2019-01-29. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.20 #
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 2018-11-28. #
3
+ # This file was automatically generated on 2019-01-29. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.20 #
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 2018-11-28. #
3
+ # This file was automatically generated on 2019-01-29. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.20 #
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 2018-11-28. #
3
+ # This file was automatically generated on 2019-01-29. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.20 #
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 2018-11-28. #
3
+ # This file was automatically generated on 2019-01-29. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.20 #
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 #
@@ -36,7 +36,7 @@ module Tinkerforge
36
36
  # voltage and the current consumption of the stepper motor.
37
37
  CALLBACK_ALL_DATA = 47
38
38
 
39
- # This callback is triggered whenever the Slient Stepper Brick enters a new state.
39
+ # This callback is triggered whenever the Silent Stepper Brick enters a new state.
40
40
  # It returns the new state as well as the previous state.
41
41
  CALLBACK_NEW_STATE = 48
42
42
 
@@ -379,7 +379,7 @@ module Tinkerforge
379
379
  end
380
380
 
381
381
  # Returns the external input voltage in mV. The external input voltage is
382
- # given via the black power input connector on the Slient Stepper Brick.
382
+ # given via the black power input connector on the Silent Stepper Brick.
383
383
  #
384
384
  # If there is an external input voltage and a stack input voltage, the motor
385
385
  # will be driven by the external input voltage. If there is only a stack
@@ -694,7 +694,7 @@ module Tinkerforge
694
694
  end
695
695
 
696
696
  # Sets the minimum voltage in mV, below which the CALLBACK_UNDER_VOLTAGE callback
697
- # is triggered. The minimum possible value that works with the Slient Stepper
697
+ # is triggered. The minimum possible value that works with the Silent Stepper
698
698
  # Brick is 8V.
699
699
  # You can use this function to detect the discharge of a battery that is used
700
700
  # to drive the stepper motor. If you have a fixed power supply, you likely do
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2018-11-28. #
3
+ # This file was automatically generated on 2019-01-29. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.20 #
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 2018-11-28. #
3
+ # This file was automatically generated on 2019-01-29. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.20 #
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,362 @@
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 BrickletAccelerometerV2 < Device
15
+ DEVICE_IDENTIFIER = 2130 # :nodoc:
16
+ DEVICE_DISPLAY_NAME = 'Accelerometer Bricklet 2.0' # :nodoc:
17
+
18
+ # This callback is triggered periodically according to the configuration set by
19
+ # BrickletAccelerometerV2#set_acceleration_callback_configuration.
20
+ #
21
+ # The parameters are the same as BrickletAccelerometerV2#get_acceleration.
22
+ CALLBACK_ACCELERATION = 8
23
+
24
+ # Returns 30 acceleration values with 16 bit resolution. The data rate can
25
+ # be configured with BrickletAccelerometerV2#set_configuration and this callback can be
26
+ # enabled with BrickletAccelerometerV2#set_continuous_acceleration_configuration.
27
+ #
28
+ # The data is formated in the sequence "x, y, z, x, y, z, ..." depending on
29
+ # the enabled axis. Examples:
30
+ #
31
+ # * x, y, z enabled: "x, y, z, ... 10x ..., x, y, z"
32
+ # * x, z enabled: "x, z, ... 15x ..., x, z"
33
+ # * y enabled: "y, ... 30x ..., y"
34
+ CALLBACK_CONTINUOUS_ACCELERATION_16_BIT = 11
35
+
36
+ # Returns 30 acceleration values with 8 bit resolution. The data rate can
37
+ # be configured with BrickletAccelerometerV2#set_configuration and this callback can be
38
+ # enabled with BrickletAccelerometerV2#set_continuous_acceleration_configuration.
39
+ #
40
+ # The data is formated in the sequence "x, y, z, x, y, z, ..." depending on
41
+ # the enabled axis. Examples:
42
+ #
43
+ # * x, y, z enabled: "x, y, z, ... 20x ..., x, y, z"
44
+ # * x, z enabled: "x, z, ... 30x ..., x, z"
45
+ # * y enabled: "y, ... 60x ..., y"
46
+ CALLBACK_CONTINUOUS_ACCELERATION_8_BIT = 12
47
+
48
+ FUNCTION_GET_ACCELERATION = 1 # :nodoc:
49
+ FUNCTION_SET_CONFIGURATION = 2 # :nodoc:
50
+ FUNCTION_GET_CONFIGURATION = 3 # :nodoc:
51
+ FUNCTION_SET_ACCELERATION_CALLBACK_CONFIGURATION = 4 # :nodoc:
52
+ FUNCTION_GET_ACCELERATION_CALLBACK_CONFIGURATION = 5 # :nodoc:
53
+ FUNCTION_SET_INFO_LED_CONFIG = 6 # :nodoc:
54
+ FUNCTION_GET_INFO_LED_CONFIG = 7 # :nodoc:
55
+ FUNCTION_SET_CONTINUOUS_ACCELERATION_CONFIGURATION = 9 # :nodoc:
56
+ FUNCTION_GET_CONTINUOUS_ACCELERATION_CONFIGURATION = 10 # :nodoc:
57
+ FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
58
+ FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
59
+ FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
60
+ FUNCTION_SET_WRITE_FIRMWARE_POINTER = 237 # :nodoc:
61
+ FUNCTION_WRITE_FIRMWARE = 238 # :nodoc:
62
+ FUNCTION_SET_STATUS_LED_CONFIG = 239 # :nodoc:
63
+ FUNCTION_GET_STATUS_LED_CONFIG = 240 # :nodoc:
64
+ FUNCTION_GET_CHIP_TEMPERATURE = 242 # :nodoc:
65
+ FUNCTION_RESET = 243 # :nodoc:
66
+ FUNCTION_WRITE_UID = 248 # :nodoc:
67
+ FUNCTION_READ_UID = 249 # :nodoc:
68
+ FUNCTION_GET_IDENTITY = 255 # :nodoc:
69
+
70
+ DATA_RATE_0_781HZ = 0 # :nodoc:
71
+ DATA_RATE_1_563HZ = 1 # :nodoc:
72
+ DATA_RATE_3_125HZ = 2 # :nodoc:
73
+ DATA_RATE_6_2512HZ = 3 # :nodoc:
74
+ DATA_RATE_12_5HZ = 4 # :nodoc:
75
+ DATA_RATE_25HZ = 5 # :nodoc:
76
+ DATA_RATE_50HZ = 6 # :nodoc:
77
+ DATA_RATE_100HZ = 7 # :nodoc:
78
+ DATA_RATE_200HZ = 8 # :nodoc:
79
+ DATA_RATE_400HZ = 9 # :nodoc:
80
+ DATA_RATE_800HZ = 10 # :nodoc:
81
+ DATA_RATE_1600HZ = 11 # :nodoc:
82
+ DATA_RATE_3200HZ = 12 # :nodoc:
83
+ DATA_RATE_6400HZ = 13 # :nodoc:
84
+ DATA_RATE_12800HZ = 14 # :nodoc:
85
+ DATA_RATE_25600HZ = 15 # :nodoc:
86
+ FULL_SCALE_2G = 0 # :nodoc:
87
+ FULL_SCALE_4G = 1 # :nodoc:
88
+ FULL_SCALE_8G = 2 # :nodoc:
89
+ INFO_LED_CONFIG_OFF = 0 # :nodoc:
90
+ INFO_LED_CONFIG_ON = 1 # :nodoc:
91
+ INFO_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
92
+ RESOLUTION_8BIT = 0 # :nodoc:
93
+ RESOLUTION_16BIT = 1 # :nodoc:
94
+ BOOTLOADER_MODE_BOOTLOADER = 0 # :nodoc:
95
+ BOOTLOADER_MODE_FIRMWARE = 1 # :nodoc:
96
+ BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT = 2 # :nodoc:
97
+ BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT = 3 # :nodoc:
98
+ BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT = 4 # :nodoc:
99
+ BOOTLOADER_STATUS_OK = 0 # :nodoc:
100
+ BOOTLOADER_STATUS_INVALID_MODE = 1 # :nodoc:
101
+ BOOTLOADER_STATUS_NO_CHANGE = 2 # :nodoc:
102
+ BOOTLOADER_STATUS_ENTRY_FUNCTION_NOT_PRESENT = 3 # :nodoc:
103
+ BOOTLOADER_STATUS_DEVICE_IDENTIFIER_INCORRECT = 4 # :nodoc:
104
+ BOOTLOADER_STATUS_CRC_MISMATCH = 5 # :nodoc:
105
+ STATUS_LED_CONFIG_OFF = 0 # :nodoc:
106
+ STATUS_LED_CONFIG_ON = 1 # :nodoc:
107
+ STATUS_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
108
+ STATUS_LED_CONFIG_SHOW_STATUS = 3 # :nodoc:
109
+
110
+ # Creates an object with the unique device ID <tt>uid</tt> and adds it to
111
+ # the IP Connection <tt>ipcon</tt>.
112
+ def initialize(uid, ipcon)
113
+ super uid, ipcon
114
+
115
+ @api_version = [2, 0, 0]
116
+
117
+ @response_expected[FUNCTION_GET_ACCELERATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
118
+ @response_expected[FUNCTION_SET_CONFIGURATION] = RESPONSE_EXPECTED_FALSE
119
+ @response_expected[FUNCTION_GET_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
120
+ @response_expected[FUNCTION_SET_ACCELERATION_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
121
+ @response_expected[FUNCTION_GET_ACCELERATION_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
122
+ @response_expected[FUNCTION_SET_INFO_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
123
+ @response_expected[FUNCTION_GET_INFO_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
124
+ @response_expected[FUNCTION_SET_CONTINUOUS_ACCELERATION_CONFIGURATION] = RESPONSE_EXPECTED_FALSE
125
+ @response_expected[FUNCTION_GET_CONTINUOUS_ACCELERATION_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
126
+ @response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
127
+ @response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
128
+ @response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
129
+ @response_expected[FUNCTION_SET_WRITE_FIRMWARE_POINTER] = RESPONSE_EXPECTED_FALSE
130
+ @response_expected[FUNCTION_WRITE_FIRMWARE] = RESPONSE_EXPECTED_ALWAYS_TRUE
131
+ @response_expected[FUNCTION_SET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
132
+ @response_expected[FUNCTION_GET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
133
+ @response_expected[FUNCTION_GET_CHIP_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
134
+ @response_expected[FUNCTION_RESET] = RESPONSE_EXPECTED_FALSE
135
+ @response_expected[FUNCTION_WRITE_UID] = RESPONSE_EXPECTED_FALSE
136
+ @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
137
+ @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
138
+
139
+ @callback_formats[CALLBACK_ACCELERATION] = 'l l l'
140
+ @callback_formats[CALLBACK_CONTINUOUS_ACCELERATION_16_BIT] = 's30'
141
+ @callback_formats[CALLBACK_CONTINUOUS_ACCELERATION_8_BIT] = 'c60'
142
+
143
+ end
144
+
145
+ # Returns the acceleration in x, y and z direction. The values
146
+ # are given in g/10000 (1g = 9.80665m/s²), not to be confused with grams.
147
+ #
148
+ # If you want to get the acceleration periodically, it is recommended
149
+ # to use the CALLBACK_ACCELERATION callback and set the period with
150
+ # BrickletAccelerometerV2#set_acceleration_callback_configuration.
151
+ def get_acceleration
152
+ send_request FUNCTION_GET_ACCELERATION, [], '', 12, 'l l l'
153
+ end
154
+
155
+ # Configures the data rate, full scale range and filter bandwidth.
156
+ # Possible values are:
157
+ #
158
+ # * Data rate of 0.781Hz to 25600Hz.
159
+ # * Full scale range of -2G to +2G up to -8G to +8G.
160
+ #
161
+ # Decreasing data rate or full scale range will also decrease the noise on
162
+ # the data.
163
+ #
164
+ # The default values are 100Hz data rate and -2G to +2G range.
165
+ def set_configuration(data_rate, full_scale)
166
+ send_request FUNCTION_SET_CONFIGURATION, [data_rate, full_scale], 'C C', 0, ''
167
+ end
168
+
169
+ # Returns the configuration as set by BrickletAccelerometerV2#set_configuration.
170
+ def get_configuration
171
+ send_request FUNCTION_GET_CONFIGURATION, [], '', 2, 'C C'
172
+ end
173
+
174
+ # The period in ms is the period with which the CALLBACK_ACCELERATION
175
+ # callback is triggered periodically. A value of 0 turns the callback off.
176
+ #
177
+ # If the `value has to change`-parameter is set to true, the callback is only
178
+ # triggered after the value has changed. If the value didn't change within the
179
+ # period, the callback is triggered immediately on change.
180
+ #
181
+ # If it is set to false, the callback is continuously triggered with the period,
182
+ # independent of the value.
183
+ #
184
+ # The default value is (0, false).
185
+ def set_acceleration_callback_configuration(period, value_has_to_change)
186
+ send_request FUNCTION_SET_ACCELERATION_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 0, ''
187
+ end
188
+
189
+ # Returns the callback configuration as set by
190
+ # BrickletAccelerometerV2#set_acceleration_callback_configuration.
191
+ def get_acceleration_callback_configuration
192
+ send_request FUNCTION_GET_ACCELERATION_CALLBACK_CONFIGURATION, [], '', 5, 'L ?'
193
+ end
194
+
195
+ # Configures the info LED (marked as "Force" on the Bricklet) to be either turned off,
196
+ # turned on, or blink in heartbeat mode.
197
+ def set_info_led_config(config)
198
+ send_request FUNCTION_SET_INFO_LED_CONFIG, [config], 'C', 0, ''
199
+ end
200
+
201
+ # Returns the LED configuration as set by BrickletAccelerometerV2#set_info_led_config
202
+ def get_info_led_config
203
+ send_request FUNCTION_GET_INFO_LED_CONFIG, [], '', 1, 'C'
204
+ end
205
+
206
+ # For high throughput of acceleration data (> 1000Hz) you have to use the
207
+ # CALLBACK_CONTINUOUS_ACCELERATION_16_BIT or CALLBACK_CONTINUOUS_ACCELERATION_8_BIT
208
+ # callbacks.
209
+ #
210
+ # You can enable the callback for each axis (x, y, z) individually and choose a
211
+ # resolution of 8 bit or 16 bit.
212
+ #
213
+ # If at least one of the axis is enabled and the resolution is set to 8 bit,
214
+ # the CALLBACK_CONTINUOUS_ACCELERATION_8_BIT callback is activated. If at least
215
+ # one of the axis is enabled and the resolution is set to 16 bit,
216
+ # the CALLBACK_CONTINUOUS_ACCELERATION_16_BIT callback is activated.
217
+ #
218
+ # If no axis is enabled, both callbacks are disabled. If one of the continuous
219
+ # callbacks is enabled, the CALLBACK_ACCELERATION callback is disabled.
220
+ #
221
+ # The maximum throughput depends on the exact configuration:
222
+ #
223
+ # "Number of axis enabled", "Throughput 8 bit", "Throughout 16 bit"
224
+ #
225
+ # "1", "25600Hz", "25600Hz"
226
+ # "2", "25600Hz", "15000Hz"
227
+ # "3", "20000Hz", "10000Hz"
228
+ def set_continuous_acceleration_configuration(enable_x, enable_y, enable_z, resolution)
229
+ send_request FUNCTION_SET_CONTINUOUS_ACCELERATION_CONFIGURATION, [enable_x, enable_y, enable_z, resolution], '? ? ? C', 0, ''
230
+ end
231
+
232
+ # Returns the continuous acceleration configuration as set by
233
+ # BrickletAccelerometerV2#set_continuous_acceleration_configuration.
234
+ def get_continuous_acceleration_configuration
235
+ send_request FUNCTION_GET_CONTINUOUS_ACCELERATION_CONFIGURATION, [], '', 4, '? ? ? C'
236
+ end
237
+
238
+ # Returns the error count for the communication between Brick and Bricklet.
239
+ #
240
+ # The errors are divided into
241
+ #
242
+ # * ACK checksum errors,
243
+ # * message checksum errors,
244
+ # * framing errors and
245
+ # * overflow errors.
246
+ #
247
+ # The errors counts are for errors that occur on the Bricklet side. All
248
+ # Bricks have a similar function that returns the errors on the Brick side.
249
+ def get_spitfp_error_count
250
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
251
+ end
252
+
253
+ # Sets the bootloader mode and returns the status after the requested
254
+ # mode change was instigated.
255
+ #
256
+ # You can change from bootloader mode to firmware mode and vice versa. A change
257
+ # from bootloader mode to firmware mode will only take place if the entry function,
258
+ # device identifier and CRC are present and correct.
259
+ #
260
+ # This function is used by Brick Viewer during flashing. It should not be
261
+ # necessary to call it in a normal user program.
262
+ def set_bootloader_mode(mode)
263
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
264
+ end
265
+
266
+ # Returns the current bootloader mode, see BrickletAccelerometerV2#set_bootloader_mode.
267
+ def get_bootloader_mode
268
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
269
+ end
270
+
271
+ # Sets the firmware pointer for BrickletAccelerometerV2#write_firmware. The pointer has
272
+ # to be increased by chunks of size 64. The data is written to flash
273
+ # every 4 chunks (which equals to one page of size 256).
274
+ #
275
+ # This function is used by Brick Viewer during flashing. It should not be
276
+ # necessary to call it in a normal user program.
277
+ def set_write_firmware_pointer(pointer)
278
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
279
+ end
280
+
281
+ # Writes 64 Bytes of firmware at the position as written by
282
+ # BrickletAccelerometerV2#set_write_firmware_pointer before. The firmware is written
283
+ # to flash every 4 chunks.
284
+ #
285
+ # You can only write firmware in bootloader mode.
286
+ #
287
+ # This function is used by Brick Viewer during flashing. It should not be
288
+ # necessary to call it in a normal user program.
289
+ def write_firmware(data)
290
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
291
+ end
292
+
293
+ # Sets the status LED configuration. By default the LED shows
294
+ # communication traffic between Brick and Bricklet, it flickers once
295
+ # for every 10 received data packets.
296
+ #
297
+ # You can also turn the LED permanently on/off or show a heartbeat.
298
+ #
299
+ # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
300
+ def set_status_led_config(config)
301
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
302
+ end
303
+
304
+ # Returns the configuration as set by BrickletAccelerometerV2#set_status_led_config
305
+ def get_status_led_config
306
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
307
+ end
308
+
309
+ # Returns the temperature in °C as measured inside the microcontroller. The
310
+ # value returned is not the ambient temperature!
311
+ #
312
+ # The temperature is only proportional to the real temperature and it has bad
313
+ # accuracy. Practically it is only useful as an indicator for
314
+ # temperature changes.
315
+ def get_chip_temperature
316
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
317
+ end
318
+
319
+ # Calling this function will reset the Bricklet. All configurations
320
+ # will be lost.
321
+ #
322
+ # After a reset you have to create new device objects,
323
+ # calling functions on the existing ones will result in
324
+ # undefined behavior!
325
+ def reset
326
+ send_request FUNCTION_RESET, [], '', 0, ''
327
+ end
328
+
329
+ # Writes a new UID into flash. If you want to set a new UID
330
+ # you have to decode the Base58 encoded UID string into an
331
+ # integer first.
332
+ #
333
+ # We recommend that you use Brick Viewer to change the UID.
334
+ def write_uid(uid)
335
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
336
+ end
337
+
338
+ # Returns the current UID as an integer. Encode as
339
+ # Base58 to get the usual string version.
340
+ def read_uid
341
+ send_request FUNCTION_READ_UID, [], '', 4, 'L'
342
+ end
343
+
344
+ # Returns the UID, the UID where the Bricklet is connected to,
345
+ # the position, the hardware and firmware version as well as the
346
+ # device identifier.
347
+ #
348
+ # The position can be 'a', 'b', 'c' or 'd'.
349
+ #
350
+ # The device identifier numbers can be found :ref:`here <device_identifier>`.
351
+ # |device_identifier_constant|
352
+ def get_identity
353
+ send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
354
+ end
355
+
356
+ # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
357
+ def register_callback(id, &block)
358
+ callback = block
359
+ @registered_callbacks[id] = callback
360
+ end
361
+ end
362
+ end