tinkerforge 2.1.28 → 2.1.29

Sign up to get free protection for your applications and to get access to all the features.
Files changed (148) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tinkerforge/brick_dc.rb +2 -2
  3. data/lib/tinkerforge/brick_hat.rb +2 -2
  4. data/lib/tinkerforge/brick_hat_zero.rb +2 -2
  5. data/lib/tinkerforge/brick_imu.rb +2 -2
  6. data/lib/tinkerforge/brick_imu_v2.rb +2 -2
  7. data/lib/tinkerforge/brick_master.rb +2 -2
  8. data/lib/tinkerforge/brick_red.rb +2 -2
  9. data/lib/tinkerforge/brick_servo.rb +2 -2
  10. data/lib/tinkerforge/brick_silent_stepper.rb +2 -2
  11. data/lib/tinkerforge/brick_stepper.rb +2 -2
  12. data/lib/tinkerforge/bricklet_accelerometer.rb +2 -2
  13. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +2 -2
  14. data/lib/tinkerforge/bricklet_air_quality.rb +2 -2
  15. data/lib/tinkerforge/bricklet_ambient_light.rb +2 -2
  16. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +7 -4
  17. data/lib/tinkerforge/bricklet_ambient_light_v3.rb +7 -4
  18. data/lib/tinkerforge/bricklet_analog_in.rb +2 -2
  19. data/lib/tinkerforge/bricklet_analog_in_v2.rb +2 -2
  20. data/lib/tinkerforge/bricklet_analog_in_v3.rb +2 -2
  21. data/lib/tinkerforge/bricklet_analog_out.rb +2 -2
  22. data/lib/tinkerforge/bricklet_analog_out_v2.rb +2 -2
  23. data/lib/tinkerforge/bricklet_analog_out_v3.rb +2 -2
  24. data/lib/tinkerforge/bricklet_barometer.rb +2 -2
  25. data/lib/tinkerforge/bricklet_barometer_v2.rb +2 -2
  26. data/lib/tinkerforge/bricklet_can.rb +2 -2
  27. data/lib/tinkerforge/bricklet_can_v2.rb +2 -2
  28. data/lib/tinkerforge/bricklet_co2.rb +2 -2
  29. data/lib/tinkerforge/bricklet_co2_v2.rb +2 -2
  30. data/lib/tinkerforge/bricklet_color.rb +2 -2
  31. data/lib/tinkerforge/bricklet_color_v2.rb +2 -2
  32. data/lib/tinkerforge/bricklet_compass.rb +2 -2
  33. data/lib/tinkerforge/bricklet_current12.rb +2 -2
  34. data/lib/tinkerforge/bricklet_current25.rb +2 -2
  35. data/lib/tinkerforge/bricklet_dc_v2.rb +521 -0
  36. data/lib/tinkerforge/bricklet_distance_ir.rb +2 -2
  37. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +2 -2
  38. data/lib/tinkerforge/bricklet_distance_us.rb +2 -2
  39. data/lib/tinkerforge/bricklet_distance_us_v2.rb +2 -2
  40. data/lib/tinkerforge/bricklet_dmx.rb +2 -2
  41. data/lib/tinkerforge/bricklet_dual_button.rb +2 -2
  42. data/lib/tinkerforge/bricklet_dual_button_v2.rb +2 -2
  43. data/lib/tinkerforge/bricklet_dual_relay.rb +2 -2
  44. data/lib/tinkerforge/bricklet_dust_detector.rb +2 -2
  45. data/lib/tinkerforge/bricklet_e_paper_296x128.rb +2 -2
  46. data/lib/tinkerforge/bricklet_energy_monitor.rb +2 -2
  47. data/lib/tinkerforge/bricklet_gps.rb +2 -2
  48. data/lib/tinkerforge/bricklet_gps_v2.rb +2 -2
  49. data/lib/tinkerforge/bricklet_hall_effect.rb +2 -2
  50. data/lib/tinkerforge/bricklet_hall_effect_v2.rb +2 -2
  51. data/lib/tinkerforge/bricklet_humidity.rb +2 -2
  52. data/lib/tinkerforge/bricklet_humidity_v2.rb +2 -2
  53. data/lib/tinkerforge/bricklet_imu_v3.rb +2 -2
  54. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +2 -2
  55. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +2 -2
  56. data/lib/tinkerforge/bricklet_industrial_counter.rb +2 -2
  57. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +2 -2
  58. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +2 -2
  59. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +2 -2
  60. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +2 -2
  61. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +2 -2
  62. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +2 -2
  63. data/lib/tinkerforge/bricklet_industrial_dual_ac_relay.rb +2 -2
  64. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +2 -2
  65. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +2 -2
  66. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +2 -2
  67. data/lib/tinkerforge/bricklet_industrial_ptc.rb +475 -0
  68. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +2 -2
  69. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +2 -2
  70. data/lib/tinkerforge/bricklet_io16.rb +2 -2
  71. data/lib/tinkerforge/bricklet_io16_v2.rb +2 -2
  72. data/lib/tinkerforge/bricklet_io4.rb +2 -2
  73. data/lib/tinkerforge/bricklet_io4_v2.rb +2 -2
  74. data/lib/tinkerforge/bricklet_isolator.rb +2 -2
  75. data/lib/tinkerforge/bricklet_joystick.rb +2 -2
  76. data/lib/tinkerforge/bricklet_joystick_v2.rb +2 -2
  77. data/lib/tinkerforge/bricklet_laser_range_finder.rb +2 -2
  78. data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +2 -2
  79. data/lib/tinkerforge/bricklet_lcd_128x64.rb +2 -2
  80. data/lib/tinkerforge/bricklet_lcd_16x2.rb +2 -2
  81. data/lib/tinkerforge/bricklet_lcd_20x4.rb +2 -2
  82. data/lib/tinkerforge/bricklet_led_strip.rb +2 -2
  83. data/lib/tinkerforge/bricklet_led_strip_v2.rb +2 -2
  84. data/lib/tinkerforge/bricklet_line.rb +2 -2
  85. data/lib/tinkerforge/bricklet_linear_poti.rb +2 -2
  86. data/lib/tinkerforge/bricklet_linear_poti_v2.rb +2 -2
  87. data/lib/tinkerforge/bricklet_load_cell.rb +2 -2
  88. data/lib/tinkerforge/bricklet_load_cell_v2.rb +2 -2
  89. data/lib/tinkerforge/bricklet_moisture.rb +2 -2
  90. data/lib/tinkerforge/bricklet_motion_detector.rb +2 -2
  91. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +2 -5
  92. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +2 -2
  93. data/lib/tinkerforge/bricklet_multi_touch.rb +2 -2
  94. data/lib/tinkerforge/bricklet_multi_touch_v2.rb +2 -2
  95. data/lib/tinkerforge/bricklet_nfc.rb +2 -2
  96. data/lib/tinkerforge/bricklet_nfc_rfid.rb +2 -2
  97. data/lib/tinkerforge/bricklet_oled_128x64.rb +2 -2
  98. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +2 -2
  99. data/lib/tinkerforge/bricklet_oled_64x48.rb +2 -2
  100. data/lib/tinkerforge/bricklet_one_wire.rb +2 -2
  101. data/lib/tinkerforge/bricklet_outdoor_weather.rb +2 -2
  102. data/lib/tinkerforge/bricklet_particulate_matter.rb +2 -2
  103. data/lib/tinkerforge/bricklet_performance_dc.rb +9 -3
  104. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +2 -2
  105. data/lib/tinkerforge/bricklet_piezo_speaker.rb +2 -2
  106. data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +2 -2
  107. data/lib/tinkerforge/bricklet_ptc.rb +2 -2
  108. data/lib/tinkerforge/bricklet_ptc_v2.rb +2 -2
  109. data/lib/tinkerforge/bricklet_real_time_clock.rb +2 -2
  110. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +2 -2
  111. data/lib/tinkerforge/bricklet_remote_switch.rb +2 -2
  112. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +2 -2
  113. data/lib/tinkerforge/bricklet_rgb_led.rb +2 -2
  114. data/lib/tinkerforge/bricklet_rgb_led_button.rb +2 -2
  115. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +2 -2
  116. data/lib/tinkerforge/bricklet_rgb_led_v2.rb +2 -2
  117. data/lib/tinkerforge/bricklet_rotary_encoder.rb +2 -2
  118. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +2 -2
  119. data/lib/tinkerforge/bricklet_rotary_poti.rb +2 -2
  120. data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +2 -2
  121. data/lib/tinkerforge/bricklet_rs232.rb +2 -2
  122. data/lib/tinkerforge/bricklet_rs232_v2.rb +2 -2
  123. data/lib/tinkerforge/bricklet_rs485.rb +2 -2
  124. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +2 -2
  125. data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +2 -2
  126. data/lib/tinkerforge/bricklet_servo_v2.rb +2 -2
  127. data/lib/tinkerforge/bricklet_silent_stepper_v2.rb +1024 -0
  128. data/lib/tinkerforge/bricklet_solid_state_relay.rb +2 -2
  129. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +2 -2
  130. data/lib/tinkerforge/bricklet_sound_intensity.rb +2 -2
  131. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +2 -2
  132. data/lib/tinkerforge/bricklet_temperature.rb +2 -2
  133. data/lib/tinkerforge/bricklet_temperature_ir.rb +2 -2
  134. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +2 -2
  135. data/lib/tinkerforge/bricklet_temperature_v2.rb +2 -2
  136. data/lib/tinkerforge/bricklet_thermal_imaging.rb +2 -2
  137. data/lib/tinkerforge/bricklet_thermocouple.rb +2 -2
  138. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +2 -2
  139. data/lib/tinkerforge/bricklet_tilt.rb +2 -2
  140. data/lib/tinkerforge/bricklet_uv_light.rb +2 -2
  141. data/lib/tinkerforge/bricklet_uv_light_v2.rb +2 -2
  142. data/lib/tinkerforge/bricklet_voltage.rb +2 -2
  143. data/lib/tinkerforge/bricklet_voltage_current.rb +2 -2
  144. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +2 -2
  145. data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +2 -2
  146. data/lib/tinkerforge/device_display_names.rb +6 -3
  147. data/lib/tinkerforge/version.rb +1 -1
  148. metadata +5 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: '0548365a445a9e4511452eddd98dd2950778bcda'
4
- data.tar.gz: 65dc9462a42d01ae937bbfba0f1d30b01393fc37
3
+ metadata.gz: 230f7a5c93853c69863d8547f48eebcf6a07a776
4
+ data.tar.gz: 2db97f5f906248e1216b0ddd10eb27e9ef9fcebc
5
5
  SHA512:
6
- metadata.gz: 1eab905679f3ac0ccd50f94b56d28c66dc01ccae996858bf82bca56c0ff47a14e4b885f13d3ffdd6d8eede5fcce0153f0ebc0a738701aa1b8dd6e83f1d7170af
7
- data.tar.gz: ed20b5b112b40159192ac47c3f678fc230dbdbc6632dbff7b01c8de0915f6a7613165edfb411ece8527bbcd0810071bad9aefc18497fa650ef70da75dd370d8d
6
+ metadata.gz: 3b441d9e549ea256d67ddf9424aa9f6edcfc14ca9a20c113a93fe5c4d69123d1a3f78226cd95cb41a62b7831c5f1d05ec4dd1540287e361d0cadceb78d479658
7
+ data.tar.gz: 8a395c5ce48fb09f26f437ec3ccbcc683d335d1d584c42f34f70c5f8845a92320a26184b7061d0aa201681d24b52aae9bc8c6fb5478a17f3ea1372d2943c4320
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2021-01-15. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.28 #
5
+ # Ruby Bindings Version 2.1.29 #
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 2021-01-15. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.28 #
5
+ # Ruby Bindings Version 2.1.29 #
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 2021-01-15. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.28 #
5
+ # Ruby Bindings Version 2.1.29 #
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 2021-01-15. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.28 #
5
+ # Ruby Bindings Version 2.1.29 #
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 2021-01-15. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.28 #
5
+ # Ruby Bindings Version 2.1.29 #
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 2021-01-15. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.28 #
5
+ # Ruby Bindings Version 2.1.29 #
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 2021-01-15. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.28 #
5
+ # Ruby Bindings Version 2.1.29 #
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 2021-01-15. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.28 #
5
+ # Ruby Bindings Version 2.1.29 #
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 2021-01-15. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.28 #
5
+ # Ruby Bindings Version 2.1.29 #
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 2021-01-15. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.28 #
5
+ # Ruby Bindings Version 2.1.29 #
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 2021-01-15. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.28 #
5
+ # Ruby Bindings Version 2.1.29 #
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 2021-01-15. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.28 #
5
+ # Ruby Bindings Version 2.1.29 #
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 2021-01-15. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.28 #
5
+ # Ruby Bindings Version 2.1.29 #
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 2021-01-15. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.28 #
5
+ # Ruby Bindings Version 2.1.29 #
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 2021-01-15. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.28 #
5
+ # Ruby Bindings Version 2.1.29 #
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 #
@@ -93,8 +93,11 @@ module Tinkerforge
93
93
  # up to about 100000lux, but above 64000lux the precision starts to drop.
94
94
  #
95
95
  # .. versionchanged:: 2.0.2$nbsp;(Plugin)
96
- # An illuminance of 0lux indicates that the sensor is saturated and the
97
- # configuration should be modified, see BrickletAmbientLightV2#set_configuration.
96
+ # An illuminance of 0lux indicates an error condition where the sensor cannot
97
+ # perform a reasonable measurement. This can happen with very dim or very bright
98
+ # light conditions. In bright light conditions this might indicate that the sensor
99
+ # is saturated and the configuration should be modified (BrickletAmbientLightV2#set_configuration)
100
+ # to better match the light conditions.
98
101
  #
99
102
  # If you want to get the illuminance periodically, it is recommended to use the
100
103
  # CALLBACK_ILLUMINANCE callback and set the period with
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2021-01-15. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.28 #
5
+ # Ruby Bindings Version 2.1.29 #
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 #
@@ -112,8 +112,11 @@ module Tinkerforge
112
112
  # The illuminance is given in lux/100, i.e. a value of 450000 means that an
113
113
  # illuminance of 4500lux is measured.
114
114
  #
115
- # An illuminance of 0lux indicates that the sensor is saturated and the
116
- # configuration should be modified, see BrickletAmbientLightV3#set_configuration.
115
+ # An illuminance of 0lux indicates an error condition where the sensor cannot
116
+ # perform a reasonable measurement. This can happen with very dim or very bright
117
+ # light conditions. In bright light conditions this might indicate that the sensor
118
+ # is saturated and the configuration should be modified (BrickletAmbientLightV3#set_configuration)
119
+ # to better match the conditions.
117
120
  #
118
121
  #
119
122
  # If you want to get the value periodically, it is recommended to use the
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2021-01-15. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.28 #
5
+ # Ruby Bindings Version 2.1.29 #
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 2021-01-15. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.28 #
5
+ # Ruby Bindings Version 2.1.29 #
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 2021-01-15. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.28 #
5
+ # Ruby Bindings Version 2.1.29 #
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 2021-01-15. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.28 #
5
+ # Ruby Bindings Version 2.1.29 #
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 2021-01-15. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.28 #
5
+ # Ruby Bindings Version 2.1.29 #
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 2021-01-15. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.28 #
5
+ # Ruby Bindings Version 2.1.29 #
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 2021-01-15. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.28 #
5
+ # Ruby Bindings Version 2.1.29 #
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 2021-01-15. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.28 #
5
+ # Ruby Bindings Version 2.1.29 #
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 2021-01-15. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.28 #
5
+ # Ruby Bindings Version 2.1.29 #
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 2021-01-15. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.28 #
5
+ # Ruby Bindings Version 2.1.29 #
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 2021-01-15. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.28 #
5
+ # Ruby Bindings Version 2.1.29 #
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 2021-01-15. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.28 #
5
+ # Ruby Bindings Version 2.1.29 #
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 2021-01-15. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.28 #
5
+ # Ruby Bindings Version 2.1.29 #
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 2021-01-15. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.28 #
5
+ # Ruby Bindings Version 2.1.29 #
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 2021-01-15. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.28 #
5
+ # Ruby Bindings Version 2.1.29 #
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 2021-01-15. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.28 #
5
+ # Ruby Bindings Version 2.1.29 #
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 2021-01-15. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.28 #
5
+ # Ruby Bindings Version 2.1.29 #
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,521 @@
1
+ # -*- ruby encoding: utf-8 -*-
2
+ #############################################################
3
+ # This file was automatically generated on 2021-05-06. #
4
+ # #
5
+ # Ruby Bindings Version 2.1.29 #
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
+ require_relative './ip_connection'
13
+
14
+ module Tinkerforge
15
+ # Drives one brushed DC motor with up to 28V and 5A (peak)
16
+ class BrickletDCV2 < Device
17
+ DEVICE_IDENTIFIER = 2165 # :nodoc:
18
+ DEVICE_DISPLAY_NAME = 'DC Bricklet 2.0' # :nodoc:
19
+
20
+ # This callback is triggered if either the current consumption
21
+ # is too high (above 5A) or the temperature of the driver chip is too high
22
+ # (above 175°C). These two possibilities are essentially the same, since the
23
+ # temperature will reach this threshold immediately if the motor consumes too
24
+ # much current. In case of a voltage below 3.3V (external or stack) this
25
+ # callback is triggered as well.
26
+ #
27
+ # If this callback is triggered, the driver chip gets disabled at the same time.
28
+ # That means, BrickletDCV2#set_enabled has to be called to drive the motor again.
29
+ #
30
+ # .. note::
31
+ # This callback only works in Drive/Brake mode (see BrickletDCV2#set_drive_mode). In
32
+ # Drive/Coast mode it is unfortunately impossible to reliably read the
33
+ # overcurrent/overtemperature signal from the driver chip.
34
+ CALLBACK_EMERGENCY_SHUTDOWN = 22
35
+
36
+ # This callback is triggered whenever a set velocity is reached. For example:
37
+ # If a velocity of 0 is present, acceleration is set to 5000 and velocity
38
+ # to 10000, the CALLBACK_VELOCITY_REACHED callback will be triggered after about
39
+ # 2 seconds, when the set velocity is actually reached.
40
+ #
41
+ # .. note::
42
+ # Since we can't get any feedback from the DC motor, this only works if the
43
+ # acceleration (see BrickletDCV2#set_motion) is set smaller or equal to the
44
+ # maximum acceleration of the motor. Otherwise the motor will lag behind the
45
+ # control value and the callback will be triggered too early.
46
+ CALLBACK_VELOCITY_REACHED = 23
47
+
48
+ # This callback is triggered with the period that is set by
49
+ # BrickletDCV2#set_current_velocity_callback_configuration. The parameter is the *current*
50
+ # velocity used by the motor.
51
+ #
52
+ # The CALLBACK_CURRENT_VELOCITY callback is only triggered after the set period
53
+ # if there is a change in the velocity.
54
+ CALLBACK_CURRENT_VELOCITY = 24
55
+
56
+ FUNCTION_SET_ENABLED = 1 # :nodoc:
57
+ FUNCTION_GET_ENABLED = 2 # :nodoc:
58
+ FUNCTION_SET_VELOCITY = 3 # :nodoc:
59
+ FUNCTION_GET_VELOCITY = 4 # :nodoc:
60
+ FUNCTION_GET_CURRENT_VELOCITY = 5 # :nodoc:
61
+ FUNCTION_SET_MOTION = 6 # :nodoc:
62
+ FUNCTION_GET_MOTION = 7 # :nodoc:
63
+ FUNCTION_FULL_BRAKE = 8 # :nodoc:
64
+ FUNCTION_SET_DRIVE_MODE = 9 # :nodoc:
65
+ FUNCTION_GET_DRIVE_MODE = 10 # :nodoc:
66
+ FUNCTION_SET_PWM_FREQUENCY = 11 # :nodoc:
67
+ FUNCTION_GET_PWM_FREQUENCY = 12 # :nodoc:
68
+ FUNCTION_GET_POWER_STATISTICS = 13 # :nodoc:
69
+ FUNCTION_SET_ERROR_LED_CONFIG = 14 # :nodoc:
70
+ FUNCTION_GET_ERROR_LED_CONFIG = 15 # :nodoc:
71
+ FUNCTION_SET_EMERGENCY_SHUTDOWN_CALLBACK_CONFIGURATION = 16 # :nodoc:
72
+ FUNCTION_GET_EMERGENCY_SHUTDOWN_CALLBACK_CONFIGURATION = 17 # :nodoc:
73
+ FUNCTION_SET_VELOCITY_REACHED_CALLBACK_CONFIGURATION = 18 # :nodoc:
74
+ FUNCTION_GET_VELOCITY_REACHED_CALLBACK_CONFIGURATION = 19 # :nodoc:
75
+ FUNCTION_SET_CURRENT_VELOCITY_CALLBACK_CONFIGURATION = 20 # :nodoc:
76
+ FUNCTION_GET_CURRENT_VELOCITY_CALLBACK_CONFIGURATION = 21 # :nodoc:
77
+ FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
78
+ FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
79
+ FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
80
+ FUNCTION_SET_WRITE_FIRMWARE_POINTER = 237 # :nodoc:
81
+ FUNCTION_WRITE_FIRMWARE = 238 # :nodoc:
82
+ FUNCTION_SET_STATUS_LED_CONFIG = 239 # :nodoc:
83
+ FUNCTION_GET_STATUS_LED_CONFIG = 240 # :nodoc:
84
+ FUNCTION_GET_CHIP_TEMPERATURE = 242 # :nodoc:
85
+ FUNCTION_RESET = 243 # :nodoc:
86
+ FUNCTION_WRITE_UID = 248 # :nodoc:
87
+ FUNCTION_READ_UID = 249 # :nodoc:
88
+ FUNCTION_GET_IDENTITY = 255 # :nodoc:
89
+
90
+ DRIVE_MODE_DRIVE_BRAKE = 0 # :nodoc:
91
+ DRIVE_MODE_DRIVE_COAST = 1 # :nodoc:
92
+ ERROR_LED_CONFIG_OFF = 0 # :nodoc:
93
+ ERROR_LED_CONFIG_ON = 1 # :nodoc:
94
+ ERROR_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
95
+ ERROR_LED_CONFIG_SHOW_ERROR = 3 # :nodoc:
96
+ BOOTLOADER_MODE_BOOTLOADER = 0 # :nodoc:
97
+ BOOTLOADER_MODE_FIRMWARE = 1 # :nodoc:
98
+ BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT = 2 # :nodoc:
99
+ BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT = 3 # :nodoc:
100
+ BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT = 4 # :nodoc:
101
+ BOOTLOADER_STATUS_OK = 0 # :nodoc:
102
+ BOOTLOADER_STATUS_INVALID_MODE = 1 # :nodoc:
103
+ BOOTLOADER_STATUS_NO_CHANGE = 2 # :nodoc:
104
+ BOOTLOADER_STATUS_ENTRY_FUNCTION_NOT_PRESENT = 3 # :nodoc:
105
+ BOOTLOADER_STATUS_DEVICE_IDENTIFIER_INCORRECT = 4 # :nodoc:
106
+ BOOTLOADER_STATUS_CRC_MISMATCH = 5 # :nodoc:
107
+ STATUS_LED_CONFIG_OFF = 0 # :nodoc:
108
+ STATUS_LED_CONFIG_ON = 1 # :nodoc:
109
+ STATUS_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
110
+ STATUS_LED_CONFIG_SHOW_STATUS = 3 # :nodoc:
111
+
112
+ # Creates an object with the unique device ID <tt>uid</tt> and adds it to
113
+ # the IP Connection <tt>ipcon</tt>.
114
+ def initialize(uid, ipcon)
115
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
116
+
117
+ @api_version = [2, 0, 0]
118
+
119
+ @response_expected[FUNCTION_SET_ENABLED] = RESPONSE_EXPECTED_FALSE
120
+ @response_expected[FUNCTION_GET_ENABLED] = RESPONSE_EXPECTED_ALWAYS_TRUE
121
+ @response_expected[FUNCTION_SET_VELOCITY] = RESPONSE_EXPECTED_FALSE
122
+ @response_expected[FUNCTION_GET_VELOCITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
123
+ @response_expected[FUNCTION_GET_CURRENT_VELOCITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
124
+ @response_expected[FUNCTION_SET_MOTION] = RESPONSE_EXPECTED_FALSE
125
+ @response_expected[FUNCTION_GET_MOTION] = RESPONSE_EXPECTED_ALWAYS_TRUE
126
+ @response_expected[FUNCTION_FULL_BRAKE] = RESPONSE_EXPECTED_FALSE
127
+ @response_expected[FUNCTION_SET_DRIVE_MODE] = RESPONSE_EXPECTED_FALSE
128
+ @response_expected[FUNCTION_GET_DRIVE_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
129
+ @response_expected[FUNCTION_SET_PWM_FREQUENCY] = RESPONSE_EXPECTED_FALSE
130
+ @response_expected[FUNCTION_GET_PWM_FREQUENCY] = RESPONSE_EXPECTED_ALWAYS_TRUE
131
+ @response_expected[FUNCTION_GET_POWER_STATISTICS] = RESPONSE_EXPECTED_ALWAYS_TRUE
132
+ @response_expected[FUNCTION_SET_ERROR_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
133
+ @response_expected[FUNCTION_GET_ERROR_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
134
+ @response_expected[FUNCTION_SET_EMERGENCY_SHUTDOWN_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
135
+ @response_expected[FUNCTION_GET_EMERGENCY_SHUTDOWN_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
136
+ @response_expected[FUNCTION_SET_VELOCITY_REACHED_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
137
+ @response_expected[FUNCTION_GET_VELOCITY_REACHED_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
138
+ @response_expected[FUNCTION_SET_CURRENT_VELOCITY_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
139
+ @response_expected[FUNCTION_GET_CURRENT_VELOCITY_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
140
+ @response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
141
+ @response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
142
+ @response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
143
+ @response_expected[FUNCTION_SET_WRITE_FIRMWARE_POINTER] = RESPONSE_EXPECTED_FALSE
144
+ @response_expected[FUNCTION_WRITE_FIRMWARE] = RESPONSE_EXPECTED_ALWAYS_TRUE
145
+ @response_expected[FUNCTION_SET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
146
+ @response_expected[FUNCTION_GET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
147
+ @response_expected[FUNCTION_GET_CHIP_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
148
+ @response_expected[FUNCTION_RESET] = RESPONSE_EXPECTED_FALSE
149
+ @response_expected[FUNCTION_WRITE_UID] = RESPONSE_EXPECTED_FALSE
150
+ @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
151
+ @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
152
+
153
+ @callback_formats[CALLBACK_EMERGENCY_SHUTDOWN] = [8, '']
154
+ @callback_formats[CALLBACK_VELOCITY_REACHED] = [10, 's']
155
+ @callback_formats[CALLBACK_CURRENT_VELOCITY] = [10, 's']
156
+
157
+ @ipcon.add_device self
158
+ end
159
+
160
+ # Enables/Disables the driver chip. The driver parameters can be configured
161
+ # (velocity, acceleration, etc) before it is enabled.
162
+ def set_enabled(enabled)
163
+ check_validity
164
+
165
+ send_request FUNCTION_SET_ENABLED, [enabled], '?', 8, ''
166
+ end
167
+
168
+ # Returns *true* if the driver chip is enabled, *false* otherwise.
169
+ def get_enabled
170
+ check_validity
171
+
172
+ send_request FUNCTION_GET_ENABLED, [], '', 9, '?'
173
+ end
174
+
175
+ # Sets the velocity of the motor. Whereas -32767 is full speed backward,
176
+ # 0 is stop and 32767 is full speed forward. Depending on the
177
+ # acceleration (see BrickletDCV2#set_motion), the motor is not immediately
178
+ # brought to the velocity but smoothly accelerated.
179
+ #
180
+ # The velocity describes the duty cycle of the PWM with which the motor is
181
+ # controlled, e.g. a velocity of 3277 sets a PWM with a 10% duty cycle.
182
+ # You can not only control the duty cycle of the PWM but also the frequency,
183
+ # see BrickletDCV2#set_pwm_frequency.
184
+ def set_velocity(velocity)
185
+ check_validity
186
+
187
+ send_request FUNCTION_SET_VELOCITY, [velocity], 's', 8, ''
188
+ end
189
+
190
+ # Returns the velocity as set by BrickletDCV2#set_velocity.
191
+ def get_velocity
192
+ check_validity
193
+
194
+ send_request FUNCTION_GET_VELOCITY, [], '', 10, 's'
195
+ end
196
+
197
+ # Returns the *current* velocity of the motor. This value is different
198
+ # from BrickletDCV2#get_velocity whenever the motor is currently accelerating
199
+ # to a goal set by BrickletDCV2#set_velocity.
200
+ def get_current_velocity
201
+ check_validity
202
+
203
+ send_request FUNCTION_GET_CURRENT_VELOCITY, [], '', 10, 's'
204
+ end
205
+
206
+ # Sets the acceleration and deceleration of the motor. It is given in *velocity/s*.
207
+ # An acceleration of 10000 means, that every second the velocity is increased
208
+ # by 10000 (or about 30% duty cycle).
209
+ #
210
+ # For example: If the current velocity is 0 and you want to accelerate to a
211
+ # velocity of 16000 (about 50% duty cycle) in 10 seconds, you should set
212
+ # an acceleration of 1600.
213
+ #
214
+ # If acceleration and deceleration is set to 0, there is no speed ramping, i.e. a
215
+ # new velocity is immediately given to the motor.
216
+ def set_motion(acceleration, deceleration)
217
+ check_validity
218
+
219
+ send_request FUNCTION_SET_MOTION, [acceleration, deceleration], 'S S', 8, ''
220
+ end
221
+
222
+ # Returns the acceleration/deceleration as set by BrickletDCV2#set_motion.
223
+ def get_motion
224
+ check_validity
225
+
226
+ send_request FUNCTION_GET_MOTION, [], '', 12, 'S S'
227
+ end
228
+
229
+ # Executes an active full brake.
230
+ #
231
+ # .. warning::
232
+ # This function is for emergency purposes,
233
+ # where an immediate brake is necessary. Depending on the current velocity and
234
+ # the strength of the motor, a full brake can be quite violent.
235
+ #
236
+ # Call BrickletDCV2#set_velocity with 0 if you just want to stop the motor.
237
+ def full_brake
238
+ check_validity
239
+
240
+ send_request FUNCTION_FULL_BRAKE, [], '', 8, ''
241
+ end
242
+
243
+ # Sets the drive mode. Possible modes are:
244
+ #
245
+ # * 0 = Drive/Brake
246
+ # * 1 = Drive/Coast
247
+ #
248
+ # These modes are different kinds of motor controls.
249
+ #
250
+ # In Drive/Brake mode, the motor is always either driving or braking. There
251
+ # is no freewheeling. Advantages are: A more linear correlation between
252
+ # PWM and velocity, more exact accelerations and the possibility to drive
253
+ # with slower velocities.
254
+ #
255
+ # In Drive/Coast mode, the motor is always either driving or freewheeling.
256
+ # Advantages are: Less current consumption and less demands on the motor and
257
+ # driver chip.
258
+ def set_drive_mode(mode)
259
+ check_validity
260
+
261
+ send_request FUNCTION_SET_DRIVE_MODE, [mode], 'C', 8, ''
262
+ end
263
+
264
+ # Returns the drive mode, as set by BrickletDCV2#set_drive_mode.
265
+ def get_drive_mode
266
+ check_validity
267
+
268
+ send_request FUNCTION_GET_DRIVE_MODE, [], '', 9, 'C'
269
+ end
270
+
271
+ # Sets the frequency of the PWM with which the motor is driven.
272
+ # Often a high frequency
273
+ # is less noisy and the motor runs smoother. However, with a low frequency
274
+ # there are less switches and therefore fewer switching losses. Also with
275
+ # most motors lower frequencies enable higher torque.
276
+ #
277
+ # If you have no idea what all this means, just ignore this function and use
278
+ # the default frequency, it will very likely work fine.
279
+ def set_pwm_frequency(frequency)
280
+ check_validity
281
+
282
+ send_request FUNCTION_SET_PWM_FREQUENCY, [frequency], 'S', 8, ''
283
+ end
284
+
285
+ # Returns the PWM frequency as set by BrickletDCV2#set_pwm_frequency.
286
+ def get_pwm_frequency
287
+ check_validity
288
+
289
+ send_request FUNCTION_GET_PWM_FREQUENCY, [], '', 10, 'S'
290
+ end
291
+
292
+ # Returns input voltage and current usage of the driver.
293
+ def get_power_statistics
294
+ check_validity
295
+
296
+ send_request FUNCTION_GET_POWER_STATISTICS, [], '', 12, 'S S'
297
+ end
298
+
299
+ # Configures the error LED to be either turned off, turned on, blink in
300
+ # heartbeat mode or show an error.
301
+ #
302
+ # If the LED is configured to show errors it has three different states:
303
+ #
304
+ # * Off: No error present.
305
+ # * 1s interval blinking: Input voltage too low (below 6V).
306
+ # * 250ms interval blinking: Overtemperature or overcurrent.
307
+ def set_error_led_config(config)
308
+ check_validity
309
+
310
+ send_request FUNCTION_SET_ERROR_LED_CONFIG, [config], 'C', 8, ''
311
+ end
312
+
313
+ # Returns the LED configuration as set by BrickletDCV2#set_error_led_config
314
+ def get_error_led_config
315
+ check_validity
316
+
317
+ send_request FUNCTION_GET_ERROR_LED_CONFIG, [], '', 9, 'C'
318
+ end
319
+
320
+ # Enable/Disable CALLBACK_EMERGENCY_SHUTDOWN callback.
321
+ def set_emergency_shutdown_callback_configuration(enabled)
322
+ check_validity
323
+
324
+ send_request FUNCTION_SET_EMERGENCY_SHUTDOWN_CALLBACK_CONFIGURATION, [enabled], '?', 8, ''
325
+ end
326
+
327
+ # Returns the callback configuration as set by
328
+ # BrickletDCV2#set_emergency_shutdown_callback_configuration.
329
+ def get_emergency_shutdown_callback_configuration
330
+ check_validity
331
+
332
+ send_request FUNCTION_GET_EMERGENCY_SHUTDOWN_CALLBACK_CONFIGURATION, [], '', 9, '?'
333
+ end
334
+
335
+ # Enable/Disable CALLBACK_VELOCITY_REACHED callback.
336
+ def set_velocity_reached_callback_configuration(enabled)
337
+ check_validity
338
+
339
+ send_request FUNCTION_SET_VELOCITY_REACHED_CALLBACK_CONFIGURATION, [enabled], '?', 8, ''
340
+ end
341
+
342
+ # Returns the callback configuration as set by
343
+ # BrickletDCV2#set_velocity_reached_callback_configuration.
344
+ def get_velocity_reached_callback_configuration
345
+ check_validity
346
+
347
+ send_request FUNCTION_GET_VELOCITY_REACHED_CALLBACK_CONFIGURATION, [], '', 9, '?'
348
+ end
349
+
350
+ # The period is the period with which the CALLBACK_CURRENT_VELOCITY
351
+ # callback is triggered periodically. A value of 0 turns the callback off.
352
+ #
353
+ # If the `value has to change`-parameter is set to true, the callback is only
354
+ # triggered after the value has changed. If the value didn't change within the
355
+ # period, the callback is triggered immediately on change.
356
+ #
357
+ # If it is set to false, the callback is continuously triggered with the period,
358
+ # independent of the value.
359
+ def set_current_velocity_callback_configuration(period, value_has_to_change)
360
+ check_validity
361
+
362
+ send_request FUNCTION_SET_CURRENT_VELOCITY_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
363
+ end
364
+
365
+ # Returns the callback configuration as set by
366
+ # BrickletDCV2#set_current_velocity_callback_configuration.
367
+ def get_current_velocity_callback_configuration
368
+ check_validity
369
+
370
+ send_request FUNCTION_GET_CURRENT_VELOCITY_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
371
+ end
372
+
373
+ # Returns the error count for the communication between Brick and Bricklet.
374
+ #
375
+ # The errors are divided into
376
+ #
377
+ # * ACK checksum errors,
378
+ # * message checksum errors,
379
+ # * framing errors and
380
+ # * overflow errors.
381
+ #
382
+ # The errors counts are for errors that occur on the Bricklet side. All
383
+ # Bricks have a similar function that returns the errors on the Brick side.
384
+ def get_spitfp_error_count
385
+ check_validity
386
+
387
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
388
+ end
389
+
390
+ # Sets the bootloader mode and returns the status after the requested
391
+ # mode change was instigated.
392
+ #
393
+ # You can change from bootloader mode to firmware mode and vice versa. A change
394
+ # from bootloader mode to firmware mode will only take place if the entry function,
395
+ # device identifier and CRC are present and correct.
396
+ #
397
+ # This function is used by Brick Viewer during flashing. It should not be
398
+ # necessary to call it in a normal user program.
399
+ def set_bootloader_mode(mode)
400
+ check_validity
401
+
402
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
403
+ end
404
+
405
+ # Returns the current bootloader mode, see BrickletDCV2#set_bootloader_mode.
406
+ def get_bootloader_mode
407
+ check_validity
408
+
409
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
410
+ end
411
+
412
+ # Sets the firmware pointer for BrickletDCV2#write_firmware. The pointer has
413
+ # to be increased by chunks of size 64. The data is written to flash
414
+ # every 4 chunks (which equals to one page of size 256).
415
+ #
416
+ # This function is used by Brick Viewer during flashing. It should not be
417
+ # necessary to call it in a normal user program.
418
+ def set_write_firmware_pointer(pointer)
419
+ check_validity
420
+
421
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
422
+ end
423
+
424
+ # Writes 64 Bytes of firmware at the position as written by
425
+ # BrickletDCV2#set_write_firmware_pointer before. The firmware is written
426
+ # to flash every 4 chunks.
427
+ #
428
+ # You can only write firmware in bootloader mode.
429
+ #
430
+ # This function is used by Brick Viewer during flashing. It should not be
431
+ # necessary to call it in a normal user program.
432
+ def write_firmware(data)
433
+ check_validity
434
+
435
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
436
+ end
437
+
438
+ # Sets the status LED configuration. By default the LED shows
439
+ # communication traffic between Brick and Bricklet, it flickers once
440
+ # for every 10 received data packets.
441
+ #
442
+ # You can also turn the LED permanently on/off or show a heartbeat.
443
+ #
444
+ # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
445
+ def set_status_led_config(config)
446
+ check_validity
447
+
448
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
449
+ end
450
+
451
+ # Returns the configuration as set by BrickletDCV2#set_status_led_config
452
+ def get_status_led_config
453
+ check_validity
454
+
455
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
456
+ end
457
+
458
+ # Returns the temperature as measured inside the microcontroller. The
459
+ # value returned is not the ambient temperature!
460
+ #
461
+ # The temperature is only proportional to the real temperature and it has bad
462
+ # accuracy. Practically it is only useful as an indicator for
463
+ # temperature changes.
464
+ def get_chip_temperature
465
+ check_validity
466
+
467
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
468
+ end
469
+
470
+ # Calling this function will reset the Bricklet. All configurations
471
+ # will be lost.
472
+ #
473
+ # After a reset you have to create new device objects,
474
+ # calling functions on the existing ones will result in
475
+ # undefined behavior!
476
+ def reset
477
+ check_validity
478
+
479
+ send_request FUNCTION_RESET, [], '', 8, ''
480
+ end
481
+
482
+ # Writes a new UID into flash. If you want to set a new UID
483
+ # you have to decode the Base58 encoded UID string into an
484
+ # integer first.
485
+ #
486
+ # We recommend that you use Brick Viewer to change the UID.
487
+ def write_uid(uid)
488
+ check_validity
489
+
490
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
491
+ end
492
+
493
+ # Returns the current UID as an integer. Encode as
494
+ # Base58 to get the usual string version.
495
+ def read_uid
496
+ check_validity
497
+
498
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
499
+ end
500
+
501
+ # Returns the UID, the UID where the Bricklet is connected to,
502
+ # the position, the hardware and firmware version as well as the
503
+ # device identifier.
504
+ #
505
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
506
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
507
+ # position 'z'.
508
+ #
509
+ # The device identifier numbers can be found :ref:`here <device_identifier>`.
510
+ # |device_identifier_constant|
511
+ def get_identity
512
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
513
+ end
514
+
515
+ # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
516
+ def register_callback(id, &block)
517
+ callback = block
518
+ @registered_callbacks[id] = callback
519
+ end
520
+ end
521
+ end