tinkerforge 2.1.19 → 2.1.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) 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 +2 -2
  9. data/lib/tinkerforge/brick_stepper.rb +2 -2
  10. data/lib/tinkerforge/bricklet_accelerometer.rb +2 -2
  11. data/lib/tinkerforge/bricklet_air_quality.rb +2 -2
  12. data/lib/tinkerforge/bricklet_ambient_light.rb +2 -2
  13. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +2 -2
  14. data/lib/tinkerforge/bricklet_analog_in.rb +2 -2
  15. data/lib/tinkerforge/bricklet_analog_in_v2.rb +2 -2
  16. data/lib/tinkerforge/bricklet_analog_in_v3.rb +2 -2
  17. data/lib/tinkerforge/bricklet_analog_out.rb +2 -2
  18. data/lib/tinkerforge/bricklet_analog_out_v2.rb +2 -2
  19. data/lib/tinkerforge/bricklet_analog_out_v3.rb +2 -2
  20. data/lib/tinkerforge/bricklet_barometer.rb +2 -2
  21. data/lib/tinkerforge/bricklet_barometer_v2.rb +6 -2
  22. data/lib/tinkerforge/bricklet_can.rb +2 -2
  23. data/lib/tinkerforge/bricklet_can_v2.rb +2 -2
  24. data/lib/tinkerforge/bricklet_co2.rb +2 -2
  25. data/lib/tinkerforge/bricklet_color.rb +2 -2
  26. data/lib/tinkerforge/bricklet_current12.rb +2 -2
  27. data/lib/tinkerforge/bricklet_current25.rb +2 -2
  28. data/lib/tinkerforge/bricklet_distance_ir.rb +2 -2
  29. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +2 -2
  30. data/lib/tinkerforge/bricklet_distance_us.rb +2 -2
  31. data/lib/tinkerforge/bricklet_dmx.rb +2 -2
  32. data/lib/tinkerforge/bricklet_dual_button.rb +2 -2
  33. data/lib/tinkerforge/bricklet_dual_button_v2.rb +2 -2
  34. data/lib/tinkerforge/bricklet_dual_relay.rb +2 -2
  35. data/lib/tinkerforge/bricklet_dust_detector.rb +2 -2
  36. data/lib/tinkerforge/bricklet_gps.rb +2 -2
  37. data/lib/tinkerforge/bricklet_gps_v2.rb +2 -2
  38. data/lib/tinkerforge/bricklet_hall_effect.rb +2 -2
  39. data/lib/tinkerforge/bricklet_humidity.rb +2 -2
  40. data/lib/tinkerforge/bricklet_humidity_v2.rb +42 -5
  41. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +2 -2
  42. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +2 -2
  43. data/lib/tinkerforge/bricklet_industrial_counter.rb +2 -2
  44. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +2 -2
  45. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +2 -2
  46. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +2 -2
  47. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +2 -2
  48. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +2 -2
  49. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +2 -2
  50. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +2 -2
  51. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +2 -2
  52. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +2 -2
  53. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +2 -2
  54. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +2 -2
  55. data/lib/tinkerforge/bricklet_io16.rb +2 -2
  56. data/lib/tinkerforge/bricklet_io16_v2.rb +2 -2
  57. data/lib/tinkerforge/bricklet_io4.rb +2 -2
  58. data/lib/tinkerforge/bricklet_io4_v2.rb +2 -2
  59. data/lib/tinkerforge/bricklet_isolator.rb +2 -2
  60. data/lib/tinkerforge/bricklet_joystick.rb +2 -2
  61. data/lib/tinkerforge/bricklet_laser_range_finder.rb +2 -2
  62. data/lib/tinkerforge/bricklet_lcd_128x64.rb +603 -4
  63. data/lib/tinkerforge/bricklet_lcd_16x2.rb +2 -2
  64. data/lib/tinkerforge/bricklet_lcd_20x4.rb +2 -2
  65. data/lib/tinkerforge/bricklet_led_strip.rb +2 -2
  66. data/lib/tinkerforge/bricklet_led_strip_v2.rb +2 -2
  67. data/lib/tinkerforge/bricklet_line.rb +2 -2
  68. data/lib/tinkerforge/bricklet_linear_poti.rb +2 -2
  69. data/lib/tinkerforge/bricklet_load_cell.rb +2 -2
  70. data/lib/tinkerforge/bricklet_load_cell_v2.rb +2 -2
  71. data/lib/tinkerforge/bricklet_moisture.rb +2 -2
  72. data/lib/tinkerforge/bricklet_motion_detector.rb +2 -2
  73. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +2 -2
  74. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +2 -2
  75. data/lib/tinkerforge/bricklet_multi_touch.rb +2 -2
  76. data/lib/tinkerforge/bricklet_nfc.rb +2 -2
  77. data/lib/tinkerforge/bricklet_nfc_rfid.rb +2 -2
  78. data/lib/tinkerforge/bricklet_oled_128x64.rb +3 -3
  79. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +3 -3
  80. data/lib/tinkerforge/bricklet_oled_64x48.rb +3 -3
  81. data/lib/tinkerforge/bricklet_one_wire.rb +2 -2
  82. data/lib/tinkerforge/bricklet_outdoor_weather.rb +2 -2
  83. data/lib/tinkerforge/bricklet_particulate_matter.rb +7 -3
  84. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +2 -2
  85. data/lib/tinkerforge/bricklet_piezo_speaker.rb +2 -2
  86. data/lib/tinkerforge/bricklet_ptc.rb +2 -2
  87. data/lib/tinkerforge/bricklet_ptc_v2.rb +2 -2
  88. data/lib/tinkerforge/bricklet_real_time_clock.rb +2 -2
  89. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +2 -2
  90. data/lib/tinkerforge/bricklet_remote_switch.rb +2 -2
  91. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +2 -2
  92. data/lib/tinkerforge/bricklet_rgb_led.rb +2 -2
  93. data/lib/tinkerforge/bricklet_rgb_led_button.rb +2 -2
  94. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +2 -2
  95. data/lib/tinkerforge/bricklet_rotary_encoder.rb +2 -2
  96. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +2 -2
  97. data/lib/tinkerforge/bricklet_rotary_poti.rb +2 -2
  98. data/lib/tinkerforge/bricklet_rs232.rb +2 -2
  99. data/lib/tinkerforge/bricklet_rs232_v2.rb +4 -5
  100. data/lib/tinkerforge/bricklet_rs485.rb +2 -2
  101. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +2 -2
  102. data/lib/tinkerforge/bricklet_solid_state_relay.rb +2 -2
  103. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +2 -2
  104. data/lib/tinkerforge/bricklet_sound_intensity.rb +2 -2
  105. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +2 -2
  106. data/lib/tinkerforge/bricklet_temperature.rb +2 -2
  107. data/lib/tinkerforge/bricklet_temperature_ir.rb +2 -2
  108. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +2 -2
  109. data/lib/tinkerforge/bricklet_temperature_v2.rb +2 -2
  110. data/lib/tinkerforge/bricklet_thermal_imaging.rb +2 -2
  111. data/lib/tinkerforge/bricklet_thermocouple.rb +2 -2
  112. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +2 -2
  113. data/lib/tinkerforge/bricklet_tilt.rb +2 -2
  114. data/lib/tinkerforge/bricklet_uv_light.rb +2 -2
  115. data/lib/tinkerforge/bricklet_uv_light_v2.rb +3 -3
  116. data/lib/tinkerforge/bricklet_voltage.rb +2 -2
  117. data/lib/tinkerforge/bricklet_voltage_current.rb +2 -2
  118. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +2 -2
  119. data/lib/tinkerforge/version.rb +1 -1
  120. metadata +2 -2
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2018-10-05. #
3
+ # This file was automatically generated on 2018-11-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.19 #
5
+ # Ruby Bindings Version 2.1.20 #
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-10-05. #
3
+ # This file was automatically generated on 2018-11-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.19 #
5
+ # Ruby Bindings Version 2.1.20 #
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-10-05. #
3
+ # This file was automatically generated on 2018-11-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.19 #
5
+ # Ruby Bindings Version 2.1.20 #
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 #
@@ -37,6 +37,8 @@ module Tinkerforge
37
37
  FUNCTION_GET_HEATER_CONFIGURATION = 10 # :nodoc:
38
38
  FUNCTION_SET_MOVING_AVERAGE_CONFIGURATION = 11 # :nodoc:
39
39
  FUNCTION_GET_MOVING_AVERAGE_CONFIGURATION = 12 # :nodoc:
40
+ FUNCTION_SET_SAMPLES_PER_SECOND = 13 # :nodoc:
41
+ FUNCTION_GET_SAMPLES_PER_SECOND = 14 # :nodoc:
40
42
  FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
41
43
  FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
42
44
  FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
@@ -57,6 +59,12 @@ module Tinkerforge
57
59
  THRESHOLD_OPTION_GREATER = '>' # :nodoc:
58
60
  HEATER_CONFIG_DISABLED = 0 # :nodoc:
59
61
  HEATER_CONFIG_ENABLED = 1 # :nodoc:
62
+ SPS_20 = 0 # :nodoc:
63
+ SPS_10 = 1 # :nodoc:
64
+ SPS_5 = 2 # :nodoc:
65
+ SPS_1 = 3 # :nodoc:
66
+ SPS_02 = 4 # :nodoc:
67
+ SPS_01 = 5 # :nodoc:
60
68
  BOOTLOADER_MODE_BOOTLOADER = 0 # :nodoc:
61
69
  BOOTLOADER_MODE_FIRMWARE = 1 # :nodoc:
62
70
  BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT = 2 # :nodoc:
@@ -78,7 +86,7 @@ module Tinkerforge
78
86
  def initialize(uid, ipcon)
79
87
  super uid, ipcon
80
88
 
81
- @api_version = [2, 0, 1]
89
+ @api_version = [2, 0, 2]
82
90
 
83
91
  @response_expected[FUNCTION_GET_HUMIDITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
84
92
  @response_expected[FUNCTION_SET_HUMIDITY_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
@@ -90,6 +98,8 @@ module Tinkerforge
90
98
  @response_expected[FUNCTION_GET_HEATER_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
91
99
  @response_expected[FUNCTION_SET_MOVING_AVERAGE_CONFIGURATION] = RESPONSE_EXPECTED_FALSE
92
100
  @response_expected[FUNCTION_GET_MOVING_AVERAGE_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
101
+ @response_expected[FUNCTION_SET_SAMPLES_PER_SECOND] = RESPONSE_EXPECTED_FALSE
102
+ @response_expected[FUNCTION_GET_SAMPLES_PER_SECOND] = RESPONSE_EXPECTED_ALWAYS_TRUE
93
103
  @response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
94
104
  @response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
95
105
  @response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
@@ -225,11 +235,16 @@ module Tinkerforge
225
235
  #
226
236
  # The range for the averaging is 1-1000.
227
237
  #
228
- # New data is gathered every 50ms. With a moving average of length 1000 the resulting
238
+ # New data is gathered every 50ms*. With a moving average of length 1000 the resulting
229
239
  # averaging window has a length of 50s. If you want to do long term measurements the longest
230
240
  # moving average will give the cleanest results.
231
241
  #
232
- # The default value is 100.
242
+ # The default value is 5.
243
+ #
244
+ # \* In firmware version 2.0.3 we added the BrickletHumidityV2#set_samples_per_second function. It
245
+ # configures the measurement frequency. Since high frequencies can result in self-heating
246
+ # of th IC, changed the default value from 20 samples per second to 1. With 1 sample per second
247
+ # a moving average length of 1000 would result in an averaging window of 1000 seconds!
233
248
  def set_moving_average_configuration(moving_average_length_humidity, moving_average_length_temperature)
234
249
  send_request FUNCTION_SET_MOVING_AVERAGE_CONFIGURATION, [moving_average_length_humidity, moving_average_length_temperature], 'S S', 0, ''
235
250
  end
@@ -239,6 +254,28 @@ module Tinkerforge
239
254
  send_request FUNCTION_GET_MOVING_AVERAGE_CONFIGURATION, [], '', 4, 'S S'
240
255
  end
241
256
 
257
+ # Sets the samples per second that are gathered by the humidity/temperature sensor HDC1080.
258
+ #
259
+ # We added this function since we found out that a high measurement frequency can lead to
260
+ # self-heating of the sensor. Which can distort the temperature measurement.
261
+ #
262
+ # If you don't need a lot of measurements, you can use the lowest available measurement
263
+ # frequency of 0.1 samples per second for the least amount of self-heating.
264
+ #
265
+ # Before version 2.0.3 the default was 20 samples per second. The new default is 1 sample per second.
266
+ #
267
+ # .. versionadded:: 2.0.3$nbsp;(Plugin)
268
+ def set_samples_per_second(sps)
269
+ send_request FUNCTION_SET_SAMPLES_PER_SECOND, [sps], 'C', 0, ''
270
+ end
271
+
272
+ # Returnes the samples per second, as set by BrickletHumidityV2#set_samples_per_second.
273
+ #
274
+ # .. versionadded:: 2.0.3$nbsp;(Plugin)
275
+ def get_samples_per_second
276
+ send_request FUNCTION_GET_SAMPLES_PER_SECOND, [], '', 1, 'C'
277
+ end
278
+
242
279
  # Returns the error count for the communication between Brick and Bricklet.
243
280
  #
244
281
  # The errors are divided into
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2018-10-05. #
3
+ # This file was automatically generated on 2018-11-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.19 #
5
+ # Ruby Bindings Version 2.1.20 #
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-10-05. #
3
+ # This file was automatically generated on 2018-11-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.19 #
5
+ # Ruby Bindings Version 2.1.20 #
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-10-05. #
3
+ # This file was automatically generated on 2018-11-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.19 #
5
+ # Ruby Bindings Version 2.1.20 #
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-10-05. #
3
+ # This file was automatically generated on 2018-11-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.19 #
5
+ # Ruby Bindings Version 2.1.20 #
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-10-05. #
3
+ # This file was automatically generated on 2018-11-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.19 #
5
+ # Ruby Bindings Version 2.1.20 #
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-10-05. #
3
+ # This file was automatically generated on 2018-11-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.19 #
5
+ # Ruby Bindings Version 2.1.20 #
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-10-05. #
3
+ # This file was automatically generated on 2018-11-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.19 #
5
+ # Ruby Bindings Version 2.1.20 #
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-10-05. #
3
+ # This file was automatically generated on 2018-11-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.19 #
5
+ # Ruby Bindings Version 2.1.20 #
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-10-05. #
3
+ # This file was automatically generated on 2018-11-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.19 #
5
+ # Ruby Bindings Version 2.1.20 #
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-10-05. #
3
+ # This file was automatically generated on 2018-11-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.19 #
5
+ # Ruby Bindings Version 2.1.20 #
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-10-05. #
3
+ # This file was automatically generated on 2018-11-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.19 #
5
+ # Ruby Bindings Version 2.1.20 #
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-10-05. #
3
+ # This file was automatically generated on 2018-11-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.19 #
5
+ # Ruby Bindings Version 2.1.20 #
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-10-05. #
3
+ # This file was automatically generated on 2018-11-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.19 #
5
+ # Ruby Bindings Version 2.1.20 #
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-10-05. #
3
+ # This file was automatically generated on 2018-11-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.19 #
5
+ # Ruby Bindings Version 2.1.20 #
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-10-05. #
3
+ # This file was automatically generated on 2018-11-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.19 #
5
+ # Ruby Bindings Version 2.1.20 #
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-10-05. #
3
+ # This file was automatically generated on 2018-11-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.19 #
5
+ # Ruby Bindings Version 2.1.20 #
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-10-05. #
3
+ # This file was automatically generated on 2018-11-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.19 #
5
+ # Ruby Bindings Version 2.1.20 #
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-10-05. #
3
+ # This file was automatically generated on 2018-11-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.19 #
5
+ # Ruby Bindings Version 2.1.20 #
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-10-05. #
3
+ # This file was automatically generated on 2018-11-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.19 #
5
+ # Ruby Bindings Version 2.1.20 #
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-10-05. #
3
+ # This file was automatically generated on 2018-11-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.19 #
5
+ # Ruby Bindings Version 2.1.20 #
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-10-05. #
3
+ # This file was automatically generated on 2018-11-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.19 #
5
+ # Ruby Bindings Version 2.1.20 #
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-10-05. #
3
+ # This file was automatically generated on 2018-11-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.19 #
5
+ # Ruby Bindings Version 2.1.20 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
@@ -10,7 +10,7 @@
10
10
  #############################################################
11
11
 
12
12
  module Tinkerforge
13
- # LCD with 128x64 pixel
13
+ # 7.1cm (2.8") display with 128x64 pixel and touch screen
14
14
  class BrickletLCD128x64 < Device
15
15
  DEVICE_IDENTIFIER = 298 # :nodoc:
16
16
  DEVICE_DISPLAY_NAME = 'LCD 128x64 Bricklet' # :nodoc:
@@ -25,6 +25,27 @@ module Tinkerforge
25
25
  # same as for BrickletLCD128x64#get_touch_gesture.
26
26
  CALLBACK_TOUCH_GESTURE = 15
27
27
 
28
+ # This callback is triggered periodically with the period that is set by
29
+ # BrickletLCD128x64#set_gui_button_pressed_callback_configuration. The parameters are the
30
+ # same as for BrickletLCD128x64#get_gui_button_pressed.
31
+ #
32
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
33
+ CALLBACK_GUI_BUTTON_PRESSED = 25
34
+
35
+ # This callback is triggered periodically with the period that is set by
36
+ # BrickletLCD128x64#set_gui_slider_value_callback_configuration. The parameters are the
37
+ # same as for BrickletLCD128x64#get_gui_slider_value.
38
+ #
39
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
40
+ CALLBACK_GUI_SLIDER_VALUE = 32
41
+
42
+ # This callback is triggered periodically with the period that is set by
43
+ # BrickletLCD128x64#set_gui_tab_selected_callback_configuration. The parameters are the
44
+ # same as for BrickletLCD128x64#get_gui_tab_selected.
45
+ #
46
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
47
+ CALLBACK_GUI_TAB_SELECTED = 44
48
+
28
49
  FUNCTION_WRITE_PIXELS_LOW_LEVEL = 1 # :nodoc:
29
50
  FUNCTION_READ_PIXELS_LOW_LEVEL = 2 # :nodoc:
30
51
  FUNCTION_CLEAR_DISPLAY = 3 # :nodoc:
@@ -38,6 +59,40 @@ module Tinkerforge
38
59
  FUNCTION_GET_TOUCH_GESTURE = 12 # :nodoc:
39
60
  FUNCTION_SET_TOUCH_GESTURE_CALLBACK_CONFIGURATION = 13 # :nodoc:
40
61
  FUNCTION_GET_TOUCH_GESTURE_CALLBACK_CONFIGURATION = 14 # :nodoc:
62
+ FUNCTION_DRAW_LINE = 16 # :nodoc:
63
+ FUNCTION_DRAW_BOX = 17 # :nodoc:
64
+ FUNCTION_DRAW_TEXT = 18 # :nodoc:
65
+ FUNCTION_SET_GUI_BUTTON = 19 # :nodoc:
66
+ FUNCTION_GET_GUI_BUTTON = 20 # :nodoc:
67
+ FUNCTION_REMOVE_GUI_BUTTON = 21 # :nodoc:
68
+ FUNCTION_SET_GUI_BUTTON_PRESSED_CALLBACK_CONFIGURATION = 22 # :nodoc:
69
+ FUNCTION_GET_GUI_BUTTON_PRESSED_CALLBACK_CONFIGURATION = 23 # :nodoc:
70
+ FUNCTION_GET_GUI_BUTTON_PRESSED = 24 # :nodoc:
71
+ FUNCTION_SET_GUI_SLIDER = 26 # :nodoc:
72
+ FUNCTION_GET_GUI_SLIDER = 27 # :nodoc:
73
+ FUNCTION_REMOVE_GUI_SLIDER = 28 # :nodoc:
74
+ FUNCTION_SET_GUI_SLIDER_VALUE_CALLBACK_CONFIGURATION = 29 # :nodoc:
75
+ FUNCTION_GET_GUI_SLIDER_VALUE_CALLBACK_CONFIGURATION = 30 # :nodoc:
76
+ FUNCTION_GET_GUI_SLIDER_VALUE = 31 # :nodoc:
77
+ FUNCTION_SET_GUI_TAB_CONFIGURATION = 33 # :nodoc:
78
+ FUNCTION_GET_GUI_TAB_CONFIGURATION = 34 # :nodoc:
79
+ FUNCTION_SET_GUI_TAB_TEXT = 35 # :nodoc:
80
+ FUNCTION_GET_GUI_TAB_TEXT = 36 # :nodoc:
81
+ FUNCTION_SET_GUI_TAB_ICON = 37 # :nodoc:
82
+ FUNCTION_GET_GUI_TAB_ICON = 38 # :nodoc:
83
+ FUNCTION_REMOVE_GUI_TAB = 39 # :nodoc:
84
+ FUNCTION_SET_GUI_TAB_SELECTED = 40 # :nodoc:
85
+ FUNCTION_SET_GUI_TAB_SELECTED_CALLBACK_CONFIGURATION = 41 # :nodoc:
86
+ FUNCTION_GET_GUI_TAB_SELECTED_CALLBACK_CONFIGURATION = 42 # :nodoc:
87
+ FUNCTION_GET_GUI_TAB_SELECTED = 43 # :nodoc:
88
+ FUNCTION_SET_GUI_GRAPH_CONFIGURATION = 45 # :nodoc:
89
+ FUNCTION_GET_GUI_GRAPH_CONFIGURATION = 46 # :nodoc:
90
+ FUNCTION_SET_GUI_GRAPH_DATA_LOW_LEVEL = 47 # :nodoc:
91
+ FUNCTION_GET_GUI_GRAPH_DATA_LOW_LEVEL = 48 # :nodoc:
92
+ FUNCTION_REMOVE_GUI_GRAPH = 49 # :nodoc:
93
+ FUNCTION_REMOVE_ALL_GUI = 50 # :nodoc:
94
+ FUNCTION_SET_TOUCH_LED_CONFIG = 51 # :nodoc:
95
+ FUNCTION_GET_TOUCH_LED_CONFIG = 52 # :nodoc:
41
96
  FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
42
97
  FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
43
98
  FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
@@ -55,6 +110,30 @@ module Tinkerforge
55
110
  GESTURE_RIGHT_TO_LEFT = 1 # :nodoc:
56
111
  GESTURE_TOP_TO_BOTTOM = 2 # :nodoc:
57
112
  GESTURE_BOTTOM_TO_TOP = 3 # :nodoc:
113
+ COLOR_WHITE = false # :nodoc:
114
+ COLOR_BLACK = true # :nodoc:
115
+ FONT_6X8 = 0 # :nodoc:
116
+ FONT_6X16 = 1 # :nodoc:
117
+ FONT_6X24 = 2 # :nodoc:
118
+ FONT_6X32 = 3 # :nodoc:
119
+ FONT_12X16 = 4 # :nodoc:
120
+ FONT_12X24 = 5 # :nodoc:
121
+ FONT_12X32 = 6 # :nodoc:
122
+ FONT_18X24 = 7 # :nodoc:
123
+ FONT_18X32 = 8 # :nodoc:
124
+ FONT_24X32 = 9 # :nodoc:
125
+ DIRECTION_HORIZONTAL = 0 # :nodoc:
126
+ DIRECTION_VERTICAL = 1 # :nodoc:
127
+ CHANGE_TAB_ON_CLICK = 1 # :nodoc:
128
+ CHANGE_TAB_ON_SWIPE = 2 # :nodoc:
129
+ CHANGE_TAB_ON_CLICK_AND_SWIPE = 3 # :nodoc:
130
+ GRAPH_TYPE_DOT = 0 # :nodoc:
131
+ GRAPH_TYPE_LINE = 1 # :nodoc:
132
+ GRAPH_TYPE_BAR = 2 # :nodoc:
133
+ TOUCH_LED_CONFIG_OFF = 0 # :nodoc:
134
+ TOUCH_LED_CONFIG_ON = 1 # :nodoc:
135
+ TOUCH_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
136
+ TOUCH_LED_CONFIG_SHOW_TOUCH = 3 # :nodoc:
58
137
  BOOTLOADER_MODE_BOOTLOADER = 0 # :nodoc:
59
138
  BOOTLOADER_MODE_FIRMWARE = 1 # :nodoc:
60
139
  BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT = 2 # :nodoc:
@@ -76,7 +155,7 @@ module Tinkerforge
76
155
  def initialize(uid, ipcon)
77
156
  super uid, ipcon
78
157
 
79
- @api_version = [2, 0, 0]
158
+ @api_version = [2, 0, 1]
80
159
 
81
160
  @response_expected[FUNCTION_WRITE_PIXELS_LOW_LEVEL] = RESPONSE_EXPECTED_TRUE
82
161
  @response_expected[FUNCTION_READ_PIXELS_LOW_LEVEL] = RESPONSE_EXPECTED_ALWAYS_TRUE
@@ -91,6 +170,40 @@ module Tinkerforge
91
170
  @response_expected[FUNCTION_GET_TOUCH_GESTURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
92
171
  @response_expected[FUNCTION_SET_TOUCH_GESTURE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
93
172
  @response_expected[FUNCTION_GET_TOUCH_GESTURE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
173
+ @response_expected[FUNCTION_DRAW_LINE] = RESPONSE_EXPECTED_FALSE
174
+ @response_expected[FUNCTION_DRAW_BOX] = RESPONSE_EXPECTED_FALSE
175
+ @response_expected[FUNCTION_DRAW_TEXT] = RESPONSE_EXPECTED_FALSE
176
+ @response_expected[FUNCTION_SET_GUI_BUTTON] = RESPONSE_EXPECTED_FALSE
177
+ @response_expected[FUNCTION_GET_GUI_BUTTON] = RESPONSE_EXPECTED_ALWAYS_TRUE
178
+ @response_expected[FUNCTION_REMOVE_GUI_BUTTON] = RESPONSE_EXPECTED_FALSE
179
+ @response_expected[FUNCTION_SET_GUI_BUTTON_PRESSED_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
180
+ @response_expected[FUNCTION_GET_GUI_BUTTON_PRESSED_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
181
+ @response_expected[FUNCTION_GET_GUI_BUTTON_PRESSED] = RESPONSE_EXPECTED_ALWAYS_TRUE
182
+ @response_expected[FUNCTION_SET_GUI_SLIDER] = RESPONSE_EXPECTED_FALSE
183
+ @response_expected[FUNCTION_GET_GUI_SLIDER] = RESPONSE_EXPECTED_ALWAYS_TRUE
184
+ @response_expected[FUNCTION_REMOVE_GUI_SLIDER] = RESPONSE_EXPECTED_FALSE
185
+ @response_expected[FUNCTION_SET_GUI_SLIDER_VALUE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
186
+ @response_expected[FUNCTION_GET_GUI_SLIDER_VALUE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
187
+ @response_expected[FUNCTION_GET_GUI_SLIDER_VALUE] = RESPONSE_EXPECTED_ALWAYS_TRUE
188
+ @response_expected[FUNCTION_SET_GUI_TAB_CONFIGURATION] = RESPONSE_EXPECTED_FALSE
189
+ @response_expected[FUNCTION_GET_GUI_TAB_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
190
+ @response_expected[FUNCTION_SET_GUI_TAB_TEXT] = RESPONSE_EXPECTED_FALSE
191
+ @response_expected[FUNCTION_GET_GUI_TAB_TEXT] = RESPONSE_EXPECTED_ALWAYS_TRUE
192
+ @response_expected[FUNCTION_SET_GUI_TAB_ICON] = RESPONSE_EXPECTED_FALSE
193
+ @response_expected[FUNCTION_GET_GUI_TAB_ICON] = RESPONSE_EXPECTED_ALWAYS_TRUE
194
+ @response_expected[FUNCTION_REMOVE_GUI_TAB] = RESPONSE_EXPECTED_FALSE
195
+ @response_expected[FUNCTION_SET_GUI_TAB_SELECTED] = RESPONSE_EXPECTED_FALSE
196
+ @response_expected[FUNCTION_SET_GUI_TAB_SELECTED_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
197
+ @response_expected[FUNCTION_GET_GUI_TAB_SELECTED_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
198
+ @response_expected[FUNCTION_GET_GUI_TAB_SELECTED] = RESPONSE_EXPECTED_ALWAYS_TRUE
199
+ @response_expected[FUNCTION_SET_GUI_GRAPH_CONFIGURATION] = RESPONSE_EXPECTED_FALSE
200
+ @response_expected[FUNCTION_GET_GUI_GRAPH_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
201
+ @response_expected[FUNCTION_SET_GUI_GRAPH_DATA_LOW_LEVEL] = RESPONSE_EXPECTED_TRUE
202
+ @response_expected[FUNCTION_GET_GUI_GRAPH_DATA_LOW_LEVEL] = RESPONSE_EXPECTED_ALWAYS_TRUE
203
+ @response_expected[FUNCTION_REMOVE_GUI_GRAPH] = RESPONSE_EXPECTED_FALSE
204
+ @response_expected[FUNCTION_REMOVE_ALL_GUI] = RESPONSE_EXPECTED_FALSE
205
+ @response_expected[FUNCTION_SET_TOUCH_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
206
+ @response_expected[FUNCTION_GET_TOUCH_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
94
207
  @response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
95
208
  @response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
96
209
  @response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
@@ -106,6 +219,9 @@ module Tinkerforge
106
219
 
107
220
  @callback_formats[CALLBACK_TOUCH_POSITION] = 'S S S L'
108
221
  @callback_formats[CALLBACK_TOUCH_GESTURE] = 'C L S S S S S L'
222
+ @callback_formats[CALLBACK_GUI_BUTTON_PRESSED] = 'C ?'
223
+ @callback_formats[CALLBACK_GUI_SLIDER_VALUE] = 'C C'
224
+ @callback_formats[CALLBACK_GUI_TAB_SELECTED] = 'c'
109
225
 
110
226
  end
111
227
 
@@ -182,6 +298,10 @@ module Tinkerforge
182
298
  #
183
299
  # The display uses a special 5x7 pixel charset. You can view the characters
184
300
  # of the charset in Brick Viewer.
301
+ #
302
+ # This function is a 1:1 replacement for the function with the same name
303
+ # in the LCD 20x4 Bricklet. You can draw text at a specific pixel position
304
+ # and with different font sizes with the BrickletLCD128x64#draw_text function.
185
305
  def write_line(line, position, text)
186
306
  send_request FUNCTION_WRITE_LINE, [line, position, text], 'C C Z22', 0, ''
187
307
  end
@@ -264,6 +384,404 @@ module Tinkerforge
264
384
  send_request FUNCTION_GET_TOUCH_GESTURE_CALLBACK_CONFIGURATION, [], '', 5, 'L ?'
265
385
  end
266
386
 
387
+ # Draws a white or black line from (x, y)-start to (x, y)-end.
388
+ # The x values have to be within the range of 0 to 127 and the y
389
+ # values have t be within the range of 0 to 63.
390
+ #
391
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
392
+ def draw_line(position_x_start, position_y_start, position_x_end, position_y_end, color)
393
+ send_request FUNCTION_DRAW_LINE, [position_x_start, position_y_start, position_x_end, position_y_end, color], 'C C C C ?', 0, ''
394
+ end
395
+
396
+ # Draws a white or black box from (x, y)-start to (x, y)-end.
397
+ # The x values have to be within the range of 0 to 127 and the y
398
+ # values have to be within the range of 0 to 63.
399
+ #
400
+ # If you set fill to true, the box will be filled with the
401
+ # color. Otherwise only the outline will be drawn.
402
+ #
403
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
404
+ def draw_box(position_x_start, position_y_start, position_x_end, position_y_end, fill, color)
405
+ send_request FUNCTION_DRAW_BOX, [position_x_start, position_y_start, position_x_end, position_y_end, fill, color], 'C C C C ? ?', 0, ''
406
+ end
407
+
408
+ # Draws a text with up to 22 characters at the pixel position (x, y).
409
+ #
410
+ # The x values have to be within the range of 0 to 127 and the y
411
+ # values have to be within the range of 0 to 63.
412
+ #
413
+ # You can use one of 9 different font sizes and draw the text in white or black.
414
+ #
415
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
416
+ def draw_text(position_x, position_y, font, color, text)
417
+ send_request FUNCTION_DRAW_TEXT, [position_x, position_y, font, color, text], 'C C C ? Z22', 0, ''
418
+ end
419
+
420
+ # Draws a clickable button at position (x, y) with the given text
421
+ # of up to 16 characters.
422
+ #
423
+ # You can use up to 12 buttons (index 0-11).
424
+ #
425
+ # The x position + width has to be within the range of 1 to 128 and the y
426
+ # position + height has to be within the range of 1 to 64.
427
+ #
428
+ # The minimum useful width/height of a button is 3.
429
+ #
430
+ # You can enable a callback for a button press with
431
+ # BrickletLCD128x64#set_gui_button_pressed_callback_configuration. The callback will
432
+ # be triggered for press and release-events.
433
+ #
434
+ # The button is drawn in a separate GUI buffer and the button-frame will
435
+ # always stay on top of the graphics drawn with BrickletLCD128x64#write_pixels. To
436
+ # remove the button use BrickletLCD128x64#remove_gui_button.
437
+ #
438
+ # If you want an icon instead of text, you can draw the icon inside of the
439
+ # button with BrickletLCD128x64#write_pixels.
440
+ #
441
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
442
+ def set_gui_button(index, position_x, position_y, width, height, text)
443
+ send_request FUNCTION_SET_GUI_BUTTON, [index, position_x, position_y, width, height, text], 'C C C C C Z16', 0, ''
444
+ end
445
+
446
+ # Returns the button properties for a given `Index` as set by BrickletLCD128x64#set_gui_button.
447
+ #
448
+ # Additionally the `Active` parameter shows if a button is currently active/visible
449
+ # or not.
450
+ #
451
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
452
+ def get_gui_button(index)
453
+ send_request FUNCTION_GET_GUI_BUTTON, [index], 'C', 21, '? C C C C Z16'
454
+ end
455
+
456
+ # Removes the button with the given index.
457
+ #
458
+ # You can use index 255 to remove all buttons.
459
+ #
460
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
461
+ def remove_gui_button(index)
462
+ send_request FUNCTION_REMOVE_GUI_BUTTON, [index], 'C', 0, ''
463
+ end
464
+
465
+ # The period in ms is the period with which the CALLBACK_GUI_BUTTON_PRESSED callback
466
+ # is triggered periodically. A value of 0 turns the callback off.
467
+ #
468
+ # If the `value has to change`-parameter is set to true, the callback is only
469
+ # triggered after the value has changed. If the value didn't change within the
470
+ # period, the callback is triggered immediately on change.
471
+ #
472
+ # If it is set to false, the callback is continuously triggered with the period,
473
+ # independent of the value.
474
+ #
475
+ # The default value is (0, false).
476
+ #
477
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
478
+ def set_gui_button_pressed_callback_configuration(period, value_has_to_change)
479
+ send_request FUNCTION_SET_GUI_BUTTON_PRESSED_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 0, ''
480
+ end
481
+
482
+ # Returns the callback configuration as set by
483
+ # BrickletLCD128x64#set_gui_button_pressed_callback_configuration.
484
+ #
485
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
486
+ def get_gui_button_pressed_callback_configuration
487
+ send_request FUNCTION_GET_GUI_BUTTON_PRESSED_CALLBACK_CONFIGURATION, [], '', 5, 'L ?'
488
+ end
489
+
490
+ # Returns the state of the button for the given index.
491
+ #
492
+ # The state can either be pressed (true) or released (false).
493
+ #
494
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
495
+ def get_gui_button_pressed(index)
496
+ send_request FUNCTION_GET_GUI_BUTTON_PRESSED, [index], 'C', 1, '?'
497
+ end
498
+
499
+ # Draws a slider at position (x, y) with the given length.
500
+ #
501
+ # You can use up to 6 sliders (index 0-5).
502
+ #
503
+ # If you use the horizontal direction, the x position + length has to be
504
+ # within the range of 1 to 128 and the y position has to be within
505
+ # the range of 0 to 46.
506
+ #
507
+ # If you use the vertical direction, the y position + length has to be
508
+ # within the range of 1 to 64 and the x position has to be within
509
+ # the range of 0 to 110.
510
+ #
511
+ # The minimum length of a slider is 8.
512
+ #
513
+ # The parameter value is the start-position of the slider, it can
514
+ # be between 0 and length-8.
515
+ #
516
+ # You can enable a callback for the slider value with
517
+ # BrickletLCD128x64#set_gui_slider_value_callback_configuration.
518
+ #
519
+ # The slider is drawn in a separate GUI buffer and it will
520
+ # always stay on top of the graphics drawn with BrickletLCD128x64#write_pixels. To
521
+ # remove the button use BrickletLCD128x64#remove_gui_slider.
522
+ #
523
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
524
+ def set_gui_slider(index, position_x, position_y, length, direction, value)
525
+ send_request FUNCTION_SET_GUI_SLIDER, [index, position_x, position_y, length, direction, value], 'C C C C C C', 0, ''
526
+ end
527
+
528
+ # Returns the slider properties for a given `Index` as set by BrickletLCD128x64#set_gui_slider.
529
+ #
530
+ # Additionally the `Active` parameter shows if a button is currently active/visible
531
+ # or not.
532
+ #
533
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
534
+ def get_gui_slider(index)
535
+ send_request FUNCTION_GET_GUI_SLIDER, [index], 'C', 6, '? C C C C C'
536
+ end
537
+
538
+ # Removes the slider with the given index.
539
+ #
540
+ # You can use index 255 to remove all slider.
541
+ #
542
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
543
+ def remove_gui_slider(index)
544
+ send_request FUNCTION_REMOVE_GUI_SLIDER, [index], 'C', 0, ''
545
+ end
546
+
547
+ # The period in ms is the period with which the CALLBACK_GUI_SLIDER_VALUE callback
548
+ # is triggered periodically. A value of 0 turns the callback off.
549
+ #
550
+ # If the `value has to change`-parameter is set to true, the callback is only
551
+ # triggered after the value has changed. If the value didn't change within the
552
+ # period, the callback is triggered immediately on change.
553
+ #
554
+ # If it is set to false, the callback is continuously triggered with the period,
555
+ # independent of the value.
556
+ #
557
+ # The default value is (0, false).
558
+ #
559
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
560
+ def set_gui_slider_value_callback_configuration(period, value_has_to_change)
561
+ send_request FUNCTION_SET_GUI_SLIDER_VALUE_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 0, ''
562
+ end
563
+
564
+ # Returns the callback configuration as set by
565
+ # BrickletLCD128x64#set_gui_slider_value_callback_configuration.
566
+ #
567
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
568
+ def get_gui_slider_value_callback_configuration
569
+ send_request FUNCTION_GET_GUI_SLIDER_VALUE_CALLBACK_CONFIGURATION, [], '', 5, 'L ?'
570
+ end
571
+
572
+ # Returns the current slider value for the given index.
573
+ #
574
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
575
+ def get_gui_slider_value(index)
576
+ send_request FUNCTION_GET_GUI_SLIDER_VALUE, [index], 'C', 1, 'C'
577
+ end
578
+
579
+ # Sets the general configuration for tabs. You can configure the tabs to only
580
+ # accept clicks or only swipes (gesture left/right and right/left) or both.
581
+ #
582
+ # Additionally, if you set `Clear GUI` to true, all of the GUI elements (buttons,
583
+ # slider, graphs) will automatically be removed on every tab change.
584
+ #
585
+ # By default click and swipe as well as automatic GUI clear is enabled.
586
+ #
587
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
588
+ def set_gui_tab_configuration(change_tab_config, clear_gui)
589
+ send_request FUNCTION_SET_GUI_TAB_CONFIGURATION, [change_tab_config, clear_gui], 'C ?', 0, ''
590
+ end
591
+
592
+ # Returns the tab configuration as set by BrickletLCD128x64#set_gui_tab_configuration.
593
+ #
594
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
595
+ def get_gui_tab_configuration
596
+ send_request FUNCTION_GET_GUI_TAB_CONFIGURATION, [], '', 2, 'C ?'
597
+ end
598
+
599
+ # Adds a text-tab with the given index. The text can have a length of up to 5 characters.
600
+ #
601
+ # You can use up to 10 tabs (index 0-9).
602
+ #
603
+ # A text-tab with the same index as a icon-tab will overwrite the icon-tab.
604
+ #
605
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
606
+ def set_gui_tab_text(index, text)
607
+ send_request FUNCTION_SET_GUI_TAB_TEXT, [index, text], 'C Z5', 0, ''
608
+ end
609
+
610
+ # Returns the text for a given index as set by BrickletLCD128x64#set_gui_tab_text.
611
+ #
612
+ # Additionally the `Active` parameter shows if the tab is currently active/visible
613
+ # or not.
614
+ #
615
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
616
+ def get_gui_tab_text(index)
617
+ send_request FUNCTION_GET_GUI_TAB_TEXT, [index], 'C', 6, '? Z5'
618
+ end
619
+
620
+ # Adds a icon-tab with the given index. The icon can have a width of 28 pixels
621
+ # with a height of 6 pixels. It is drawn line-by-line from left to right.
622
+ #
623
+ # You can use up to 10 tabs (index 0-9).
624
+ #
625
+ # A icon-tab with the same index as a text-tab will overwrite the text-tab.
626
+ #
627
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
628
+ def set_gui_tab_icon(index, icon)
629
+ send_request FUNCTION_SET_GUI_TAB_ICON, [index, icon], 'C ?168', 0, ''
630
+ end
631
+
632
+ # Returns the icon for a given index as set by BrickletLCD128x64#set_gui_tab_icon.
633
+ #
634
+ # Additionally the `Active` parameter shows if the tab is currently active/visible
635
+ # or not.
636
+ #
637
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
638
+ def get_gui_tab_icon(index)
639
+ send_request FUNCTION_GET_GUI_TAB_ICON, [index], 'C', 169, '? ?168'
640
+ end
641
+
642
+ # Removes the tab with the given index.
643
+ #
644
+ # You can use index 255 to remove all tabs.
645
+ #
646
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
647
+ def remove_gui_tab(index)
648
+ send_request FUNCTION_REMOVE_GUI_TAB, [index], 'C', 0, ''
649
+ end
650
+
651
+ # Sets the tab with the given index as selected (drawn as selected on the display).
652
+ #
653
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
654
+ def set_gui_tab_selected(index)
655
+ send_request FUNCTION_SET_GUI_TAB_SELECTED, [index], 'C', 0, ''
656
+ end
657
+
658
+ # The period in ms is the period with which the CALLBACK_GUI_TAB_SELECTED callback
659
+ # is triggered periodically. A value of 0 turns the callback off.
660
+ #
661
+ # If the `value has to change`-parameter is set to true, the callback is only
662
+ # triggered after the value has changed. If the value didn't change within the
663
+ # period, the callback is triggered immediately on change.
664
+ #
665
+ # If it is set to false, the callback is continuously triggered with the period,
666
+ # independent of the value.
667
+ #
668
+ # The default value is (0, false).
669
+ #
670
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
671
+ def set_gui_tab_selected_callback_configuration(period, value_has_to_change)
672
+ send_request FUNCTION_SET_GUI_TAB_SELECTED_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 0, ''
673
+ end
674
+
675
+ # Returns the callback configuration as set by
676
+ # BrickletLCD128x64#set_gui_tab_selected_callback_configuration.
677
+ #
678
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
679
+ def get_gui_tab_selected_callback_configuration
680
+ send_request FUNCTION_GET_GUI_TAB_SELECTED_CALLBACK_CONFIGURATION, [], '', 5, 'L ?'
681
+ end
682
+
683
+ # Returns the index of the currently selected tab.
684
+ #
685
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
686
+ def get_gui_tab_selected
687
+ send_request FUNCTION_GET_GUI_TAB_SELECTED, [], '', 1, 'c'
688
+ end
689
+
690
+ # Sets the configuration for up to four graphs (index 0-3).
691
+ #
692
+ # The graph type can be dot-, line- or bar-graph.
693
+ #
694
+ # The x and y position are pixel positions. They have to be within
695
+ # the range of (0, 0) to (127, 63). The maximum width is 118 and the
696
+ # maximum height is 63.
697
+ #
698
+ # You can add a text for the x and y axis with at most 4 characters each.
699
+ # The text is drawn at the inside of the graph and it can overwrite some
700
+ # of the graph data. If you need the text outside of the graph you can
701
+ # leave this text here empty and use BrickletLCD128x64#draw_text to draw the caption
702
+ # outside of the graph.
703
+ #
704
+ # The data of the graph can be set and updated with BrickletLCD128x64#set_gui_graph_data.
705
+ #
706
+ # The graph is drawn in a separate GUI buffer and the graph-frame and data will
707
+ # always stay on top of the graphics drawn with BrickletLCD128x64#write_pixels. To
708
+ # remove the graph use BrickletLCD128x64#remove_gui_graph.
709
+ #
710
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
711
+ def set_gui_graph_configuration(index, graph_type, position_x, position_y, width, height, text_x, text_y)
712
+ send_request FUNCTION_SET_GUI_GRAPH_CONFIGURATION, [index, graph_type, position_x, position_y, width, height, text_x, text_y], 'C C C C C C Z4 Z4', 0, ''
713
+ end
714
+
715
+ # Returns the graph properties for a given `Index` as set by BrickletLCD128x64#set_gui_graph_configuration.
716
+ #
717
+ # Additionally the `Active` parameter shows if a graph is currently active/visible
718
+ # or not.
719
+ #
720
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
721
+ def get_gui_graph_configuration(index)
722
+ send_request FUNCTION_GET_GUI_GRAPH_CONFIGURATION, [index], 'C', 14, '? C C C C C Z4 Z4'
723
+ end
724
+
725
+ # Sets the data for a graph with the given index. You have to configure the graph with
726
+ # BrickletLCD128x64#set_gui_graph_configuration before you can set the first data.
727
+ #
728
+ # The graph will show the first n values of the data that you set, where
729
+ # n is the width set with BrickletLCD128x64#set_gui_graph_configuration. If you set
730
+ # less then n values it will show the rest of the values as zero.
731
+ #
732
+ # The maximum number of data-points you can set is 118 (which also corresponds to the
733
+ # maximum width of the graph).
734
+ #
735
+ # You have to scale your values to be between 0 and 255. 0 will be shown
736
+ # at the bottom of the graph and 255 at the top.
737
+ #
738
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
739
+ def set_gui_graph_data_low_level(index, data_length, data_chunk_offset, data_chunk_data)
740
+ send_request FUNCTION_SET_GUI_GRAPH_DATA_LOW_LEVEL, [index, data_length, data_chunk_offset, data_chunk_data], 'C S S C59', 0, ''
741
+ end
742
+
743
+ # Returns the graph data for a given index as set by BrickletLCD128x64#set_gui_graph_data.
744
+ #
745
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
746
+ def get_gui_graph_data_low_level(index)
747
+ send_request FUNCTION_GET_GUI_GRAPH_DATA_LOW_LEVEL, [index], 'C', 63, 'S S C59'
748
+ end
749
+
750
+ # Removes the graph with the given index.
751
+ #
752
+ # You can use index 255 to remove all graphs.
753
+ #
754
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
755
+ def remove_gui_graph(index)
756
+ send_request FUNCTION_REMOVE_GUI_GRAPH, [index], 'C', 0, ''
757
+ end
758
+
759
+ # Removes all GUI elements (buttons, slider, graphs, tabs).
760
+ #
761
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
762
+ def remove_all_gui
763
+ send_request FUNCTION_REMOVE_ALL_GUI, [], '', 0, ''
764
+ end
765
+
766
+ # Sets the touch LED configuration. By default the LED is on if the
767
+ # LCD is touched.
768
+ #
769
+ # You can also turn the LED permanently on/off or show a heartbeat.
770
+ #
771
+ # If the Bricklet is in bootloader mode, the LED is off.
772
+ #
773
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
774
+ def set_touch_led_config(config)
775
+ send_request FUNCTION_SET_TOUCH_LED_CONFIG, [config], 'C', 0, ''
776
+ end
777
+
778
+ # Returns the configuration as set by BrickletLCD128x64#set_touch_led_config
779
+ #
780
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
781
+ def get_touch_led_config
782
+ send_request FUNCTION_GET_TOUCH_LED_CONFIG, [], '', 1, 'C'
783
+ end
784
+
267
785
  # Returns the error count for the communication between Brick and Bricklet.
268
786
  #
269
787
  # The errors are divided into
@@ -477,6 +995,87 @@ module Tinkerforge
477
995
  pixels_data[0, pixels_length]
478
996
  end
479
997
 
998
+ # Sets the data for a graph with the given index. You have to configure the graph with
999
+ # BrickletLCD128x64#set_gui_graph_configuration before you can set the first data.
1000
+ #
1001
+ # The graph will show the first n values of the data that you set, where
1002
+ # n is the width set with BrickletLCD128x64#set_gui_graph_configuration. If you set
1003
+ # less then n values it will show the rest of the values as zero.
1004
+ #
1005
+ # The maximum number of data-points you can set is 118 (which also corresponds to the
1006
+ # maximum width of the graph).
1007
+ #
1008
+ # You have to scale your values to be between 0 and 255. 0 will be shown
1009
+ # at the bottom of the graph and 255 at the top.
1010
+ #
1011
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
1012
+ def set_gui_graph_data(index, data)
1013
+ if data.length > 65535
1014
+ raise ArgumentError, 'Data can be at most 65535 items long'
1015
+ end
1016
+
1017
+ data_length = data.length
1018
+ data_chunk_offset = 0
1019
+
1020
+ if data_length == 0
1021
+ data_chunk_data = [0] * 59
1022
+ ret = set_gui_graph_data_low_level index, data_length, data_chunk_offset, data_chunk_data
1023
+ else
1024
+ ret = nil # assigned in block
1025
+
1026
+ @stream_mutex.synchronize {
1027
+ while data_chunk_offset < data_length
1028
+ data_chunk_data = data[data_chunk_offset, 59]
1029
+
1030
+ if data_chunk_data.length < 59
1031
+ data_chunk_data += [0] * (59 - data_chunk_data.length)
1032
+ end
1033
+
1034
+ ret = set_gui_graph_data_low_level index, data_length, data_chunk_offset, data_chunk_data
1035
+ data_chunk_offset += 59
1036
+ end
1037
+ }
1038
+ end
1039
+
1040
+ ret
1041
+ end
1042
+
1043
+ # Returns the graph data for a given index as set by BrickletLCD128x64#set_gui_graph_data.
1044
+ #
1045
+ # .. versionadded:: 2.0.2$nbsp;(Plugin)
1046
+ def get_gui_graph_data(index)
1047
+ data_length = nil # assigned in block
1048
+ data_data = nil # assigned in block
1049
+
1050
+ @stream_mutex.synchronize {
1051
+ ret = get_gui_graph_data_low_level index
1052
+ data_length = ret[0]
1053
+ data_chunk_offset = ret[1]
1054
+ data_out_of_sync = data_chunk_offset != 0
1055
+ data_data = ret[2]
1056
+
1057
+ while not data_out_of_sync and data_data.length < data_length
1058
+ ret = get_gui_graph_data_low_level index
1059
+ data_length = ret[0]
1060
+ data_chunk_offset = ret[1]
1061
+ data_out_of_sync = data_chunk_offset != data_data.length
1062
+ data_data += ret[2]
1063
+ end
1064
+
1065
+ if data_out_of_sync # discard remaining stream to bring it back in-sync
1066
+ while data_chunk_offset + 59 < data_length
1067
+ ret = get_gui_graph_data_low_level index
1068
+ data_length = ret[0]
1069
+ data_chunk_offset = ret[1]
1070
+ end
1071
+
1072
+ raise StreamOutOfSyncException, 'Data stream is out-of-sync'
1073
+ end
1074
+ }
1075
+
1076
+ data_data[0, data_length]
1077
+ end
1078
+
480
1079
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
481
1080
  def register_callback(id, &block)
482
1081
  callback = block