tinkerforge 2.1.17 → 2.1.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tinkerforge/brick_dc.rb +6 -6
  3. data/lib/tinkerforge/brick_imu.rb +6 -6
  4. data/lib/tinkerforge/brick_imu_v2.rb +13 -6
  5. data/lib/tinkerforge/brick_master.rb +6 -6
  6. data/lib/tinkerforge/brick_red.rb +2 -2
  7. data/lib/tinkerforge/brick_servo.rb +9 -7
  8. data/lib/tinkerforge/brick_silent_stepper.rb +13 -13
  9. data/lib/tinkerforge/brick_stepper.rb +6 -6
  10. data/lib/tinkerforge/bricklet_accelerometer.rb +2 -2
  11. data/lib/tinkerforge/bricklet_air_quality.rb +514 -0
  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 +5 -5
  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 +210 -0
  20. data/lib/tinkerforge/bricklet_barometer.rb +2 -2
  21. data/lib/tinkerforge/bricklet_barometer_v2.rb +497 -0
  22. data/lib/tinkerforge/bricklet_can.rb +2 -2
  23. data/lib/tinkerforge/bricklet_can_v2.rb +5 -5
  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 +398 -0
  30. data/lib/tinkerforge/bricklet_distance_us.rb +2 -2
  31. data/lib/tinkerforge/bricklet_dmx.rb +7 -5
  32. data/lib/tinkerforge/bricklet_dual_button.rb +2 -2
  33. data/lib/tinkerforge/bricklet_dual_button_v2.rb +283 -0
  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 +6 -6
  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 +5 -5
  41. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +2 -2
  42. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +336 -0
  43. data/lib/tinkerforge/bricklet_industrial_counter.rb +12 -12
  44. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +2 -2
  45. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +7 -7
  46. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +2 -2
  47. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +302 -0
  48. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +2 -2
  49. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +382 -0
  50. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +2 -2
  51. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +374 -0
  52. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +5 -5
  53. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +2 -2
  54. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +11 -11
  55. data/lib/tinkerforge/bricklet_io16.rb +2 -2
  56. data/lib/tinkerforge/bricklet_io16_v2.rb +418 -0
  57. data/lib/tinkerforge/bricklet_io4.rb +2 -2
  58. data/lib/tinkerforge/bricklet_io4_v2.rb +6 -6
  59. data/lib/tinkerforge/bricklet_isolator.rb +282 -0
  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 +486 -0
  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 +8 -8
  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 +5 -5
  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 +6 -6
  74. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +5 -5
  75. data/lib/tinkerforge/bricklet_multi_touch.rb +2 -2
  76. data/lib/tinkerforge/bricklet_nfc.rb +6 -6
  77. data/lib/tinkerforge/bricklet_nfc_rfid.rb +2 -2
  78. data/lib/tinkerforge/bricklet_oled_128x64.rb +2 -2
  79. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +387 -0
  80. data/lib/tinkerforge/bricklet_oled_64x48.rb +2 -2
  81. data/lib/tinkerforge/bricklet_one_wire.rb +305 -0
  82. data/lib/tinkerforge/bricklet_outdoor_weather.rb +5 -5
  83. data/lib/tinkerforge/bricklet_particulate_matter.rb +5 -5
  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 +5 -5
  88. data/lib/tinkerforge/bricklet_real_time_clock.rb +2 -2
  89. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +5 -5
  90. data/lib/tinkerforge/bricklet_remote_switch.rb +2 -2
  91. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +5 -5
  92. data/lib/tinkerforge/bricklet_rgb_led.rb +2 -2
  93. data/lib/tinkerforge/bricklet_rgb_led_button.rb +5 -5
  94. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +5 -5
  95. data/lib/tinkerforge/bricklet_rotary_encoder.rb +2 -2
  96. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +5 -5
  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 +5 -5
  100. data/lib/tinkerforge/bricklet_rs485.rb +5 -5
  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 +5 -5
  104. data/lib/tinkerforge/bricklet_sound_intensity.rb +2 -2
  105. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +9 -9
  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 +5 -5
  109. data/lib/tinkerforge/bricklet_temperature_v2.rb +278 -0
  110. data/lib/tinkerforge/bricklet_thermal_imaging.rb +5 -5
  111. data/lib/tinkerforge/bricklet_thermocouple.rb +2 -2
  112. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +5 -5
  113. data/lib/tinkerforge/bricklet_tilt.rb +2 -2
  114. data/lib/tinkerforge/bricklet_uv_light.rb +6 -5
  115. data/lib/tinkerforge/bricklet_uv_light_v2.rb +430 -0
  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 +5 -5
  119. data/lib/tinkerforge/version.rb +1 -1
  120. metadata +18 -2
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2018-06-08. #
3
+ # This file was automatically generated on 2018-09-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.17 #
5
+ # Ruby Bindings Version 2.1.18 #
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 #
@@ -100,7 +100,7 @@ module Tinkerforge
100
100
  send_request FUNCTION_GET_MOTION_DETECTED, [], '', 1, 'C'
101
101
  end
102
102
 
103
- # Sets the sensitivity of the PIR sensor. The range is 0-100. At full
103
+ # Sets the sensitivity of the PIR sensor. The range is 0-100. At full
104
104
  # sensitivity (100), the Bricklet can detect motion in a range of approximately 12m.
105
105
  #
106
106
  # The actual range depends on many things in the environment (e.g. reflections) and the
@@ -138,9 +138,9 @@ module Tinkerforge
138
138
  #
139
139
  # The errors are divided into
140
140
  #
141
- # * ack checksum errors,
141
+ # * ACK checksum errors,
142
142
  # * message checksum errors,
143
- # * frameing errors and
143
+ # * framing errors and
144
144
  # * overflow errors.
145
145
  #
146
146
  # The errors counts are for errors that occur on the Bricklet side. All
@@ -154,7 +154,7 @@ module Tinkerforge
154
154
  #
155
155
  # You can change from bootloader mode to firmware mode and vice versa. A change
156
156
  # from bootloader mode to firmware mode will only take place if the entry function,
157
- # device identifier und crc are present and correct.
157
+ # device identifier and CRC are present and correct.
158
158
  #
159
159
  # This function is used by Brick Viewer during flashing. It should not be
160
160
  # necessary to call it in a normal user program.
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2018-06-08. #
3
+ # This file was automatically generated on 2018-09-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.17 #
5
+ # Ruby Bindings Version 2.1.18 #
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 #
@@ -206,9 +206,9 @@ module Tinkerforge
206
206
  #
207
207
  # The errors are divided into
208
208
  #
209
- # * ack checksum errors,
209
+ # * ACK checksum errors,
210
210
  # * message checksum errors,
211
- # * frameing errors and
211
+ # * framing errors and
212
212
  # * overflow errors.
213
213
  #
214
214
  # The errors counts are for errors that occur on the Bricklet side. All
@@ -222,7 +222,7 @@ module Tinkerforge
222
222
  #
223
223
  # You can change from bootloader mode to firmware mode and vice versa. A change
224
224
  # from bootloader mode to firmware mode will only take place if the entry function,
225
- # device identifier und crc are present and correct.
225
+ # device identifier and CRC are present and correct.
226
226
  #
227
227
  # This function is used by Brick Viewer during flashing. It should not be
228
228
  # necessary to call it in a normal user program.
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2018-06-08. #
3
+ # This file was automatically generated on 2018-09-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.17 #
5
+ # Ruby Bindings Version 2.1.18 #
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-06-08. #
3
+ # This file was automatically generated on 2018-09-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.17 #
5
+ # Ruby Bindings Version 2.1.18 #
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 #
@@ -391,7 +391,7 @@ module Tinkerforge
391
391
  #
392
392
  # * Mifare Classic page size: 16 byte
393
393
  # * NFC Forum Type 1 page size: 8 byte
394
- # * NFC Forum Type 2 page size: 4 byte
394
+ # * NFC Forum Type 2 page size: 4 byte
395
395
  # * NFC Forum Type 3 page size: 16 byte
396
396
  # * NFC Forum Type 4: No pages, page = file selection (CC or NDEF, see below)
397
397
  #
@@ -604,9 +604,9 @@ module Tinkerforge
604
604
  #
605
605
  # The errors are divided into
606
606
  #
607
- # * ack checksum errors,
607
+ # * ACK checksum errors,
608
608
  # * message checksum errors,
609
- # * frameing errors and
609
+ # * framing errors and
610
610
  # * overflow errors.
611
611
  #
612
612
  # The errors counts are for errors that occur on the Bricklet side. All
@@ -620,7 +620,7 @@ module Tinkerforge
620
620
  #
621
621
  # You can change from bootloader mode to firmware mode and vice versa. A change
622
622
  # from bootloader mode to firmware mode will only take place if the entry function,
623
- # device identifier und crc are present and correct.
623
+ # device identifier and CRC are present and correct.
624
624
  #
625
625
  # This function is used by Brick Viewer during flashing. It should not be
626
626
  # necessary to call it in a normal user program.
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2018-06-08. #
3
+ # This file was automatically generated on 2018-09-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.17 #
5
+ # Ruby Bindings Version 2.1.18 #
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-06-08. #
3
+ # This file was automatically generated on 2018-09-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.17 #
5
+ # Ruby Bindings Version 2.1.18 #
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,387 @@
1
+ # -*- ruby encoding: utf-8 -*-
2
+ #############################################################
3
+ # This file was automatically generated on 2018-09-28. #
4
+ # #
5
+ # Ruby Bindings Version 2.1.18 #
6
+ # #
7
+ # If you have a bugfix for this file and want to commit it, #
8
+ # please fix the bug in the generator. You can find a link #
9
+ # to the generators git repository on tinkerforge.com #
10
+ #############################################################
11
+
12
+ module Tinkerforge
13
+ # 3.3cm (1.3") OLED with 128x64 pixels
14
+ class BrickletOLED128x64V2 < Device
15
+ DEVICE_IDENTIFIER = 2112 # :nodoc:
16
+ DEVICE_DISPLAY_NAME = 'OLED 128x64 Bricklet 2.0' # :nodoc:
17
+
18
+ FUNCTION_WRITE_PIXELS_LOW_LEVEL = 1 # :nodoc:
19
+ FUNCTION_READ_PIXELS_LOW_LEVEL = 2 # :nodoc:
20
+ FUNCTION_CLEAR_DISPLAY = 3 # :nodoc:
21
+ FUNCTION_SET_DISPLAY_CONFIGURATION = 4 # :nodoc:
22
+ FUNCTION_GET_DISPLAY_CONFIGURATION = 5 # :nodoc:
23
+ FUNCTION_WRITE_LINE = 6 # :nodoc:
24
+ FUNCTION_DRAW_BUFFERED_FRAME = 7 # :nodoc:
25
+ FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
26
+ FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
27
+ FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
28
+ FUNCTION_SET_WRITE_FIRMWARE_POINTER = 237 # :nodoc:
29
+ FUNCTION_WRITE_FIRMWARE = 238 # :nodoc:
30
+ FUNCTION_SET_STATUS_LED_CONFIG = 239 # :nodoc:
31
+ FUNCTION_GET_STATUS_LED_CONFIG = 240 # :nodoc:
32
+ FUNCTION_GET_CHIP_TEMPERATURE = 242 # :nodoc:
33
+ FUNCTION_RESET = 243 # :nodoc:
34
+ FUNCTION_WRITE_UID = 248 # :nodoc:
35
+ FUNCTION_READ_UID = 249 # :nodoc:
36
+ FUNCTION_GET_IDENTITY = 255 # :nodoc:
37
+
38
+ BOOTLOADER_MODE_BOOTLOADER = 0 # :nodoc:
39
+ BOOTLOADER_MODE_FIRMWARE = 1 # :nodoc:
40
+ BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT = 2 # :nodoc:
41
+ BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT = 3 # :nodoc:
42
+ BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT = 4 # :nodoc:
43
+ BOOTLOADER_STATUS_OK = 0 # :nodoc:
44
+ BOOTLOADER_STATUS_INVALID_MODE = 1 # :nodoc:
45
+ BOOTLOADER_STATUS_NO_CHANGE = 2 # :nodoc:
46
+ BOOTLOADER_STATUS_ENTRY_FUNCTION_NOT_PRESENT = 3 # :nodoc:
47
+ BOOTLOADER_STATUS_DEVICE_IDENTIFIER_INCORRECT = 4 # :nodoc:
48
+ BOOTLOADER_STATUS_CRC_MISMATCH = 5 # :nodoc:
49
+ STATUS_LED_CONFIG_OFF = 0 # :nodoc:
50
+ STATUS_LED_CONFIG_ON = 1 # :nodoc:
51
+ STATUS_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
52
+ STATUS_LED_CONFIG_SHOW_STATUS = 3 # :nodoc:
53
+
54
+ # Creates an object with the unique device ID <tt>uid</tt> and adds it to
55
+ # the IP Connection <tt>ipcon</tt>.
56
+ def initialize(uid, ipcon)
57
+ super uid, ipcon
58
+
59
+ @api_version = [2, 0, 0]
60
+
61
+ @response_expected[FUNCTION_WRITE_PIXELS_LOW_LEVEL] = RESPONSE_EXPECTED_TRUE
62
+ @response_expected[FUNCTION_READ_PIXELS_LOW_LEVEL] = RESPONSE_EXPECTED_ALWAYS_TRUE
63
+ @response_expected[FUNCTION_CLEAR_DISPLAY] = RESPONSE_EXPECTED_FALSE
64
+ @response_expected[FUNCTION_SET_DISPLAY_CONFIGURATION] = RESPONSE_EXPECTED_FALSE
65
+ @response_expected[FUNCTION_GET_DISPLAY_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
66
+ @response_expected[FUNCTION_WRITE_LINE] = RESPONSE_EXPECTED_FALSE
67
+ @response_expected[FUNCTION_DRAW_BUFFERED_FRAME] = RESPONSE_EXPECTED_FALSE
68
+ @response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
69
+ @response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
70
+ @response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
71
+ @response_expected[FUNCTION_SET_WRITE_FIRMWARE_POINTER] = RESPONSE_EXPECTED_FALSE
72
+ @response_expected[FUNCTION_WRITE_FIRMWARE] = RESPONSE_EXPECTED_ALWAYS_TRUE
73
+ @response_expected[FUNCTION_SET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
74
+ @response_expected[FUNCTION_GET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
75
+ @response_expected[FUNCTION_GET_CHIP_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
76
+ @response_expected[FUNCTION_RESET] = RESPONSE_EXPECTED_FALSE
77
+ @response_expected[FUNCTION_WRITE_UID] = RESPONSE_EXPECTED_FALSE
78
+ @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
79
+ @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
80
+
81
+
82
+ end
83
+
84
+ # Writes pixels to the specified window.
85
+ #
86
+ # The x-axis goes from 0 to 127 and the y-axis from 0 to 63. The pixels are written
87
+ # into the window line by line top to bottom and each line is written from left to
88
+ # right.
89
+ #
90
+ # If automatic draw is enabled (default) the pixels are directly written to
91
+ # the screen. Only pixels that have actually changed are updated on the screen,
92
+ # the rest stays the same.
93
+ #
94
+ # If automatic draw is disabled the pixels are written to an internal buffer and
95
+ # the buffer is transferred to the display only after BrickletOLED128x64V2#draw_buffered_frame
96
+ # is called. This can be used to avoid flicker when drawing a complex frame in
97
+ # multiple steps.
98
+ #
99
+ # Automatic draw can be configured with the BrickletOLED128x64V2#set_display_configuration
100
+ # function.
101
+ def write_pixels_low_level(x_start, y_start, x_end, y_end, pixels_length, pixels_chunk_offset, pixels_chunk_data)
102
+ send_request FUNCTION_WRITE_PIXELS_LOW_LEVEL, [x_start, y_start, x_end, y_end, pixels_length, pixels_chunk_offset, pixels_chunk_data], 'C C C C S S ?448', 0, ''
103
+ end
104
+
105
+ # Reads pixels from the specified window.
106
+ #
107
+ # The x-axis goes from 0 to 127 and the y-axis from 0 to 63. The pixels are read
108
+ # from the window line by line top to bottom and each line is read from left to
109
+ # right.
110
+ #
111
+ # If automatic draw is enabled (default) the pixels that are read are always the
112
+ # same that are shown on the display.
113
+ #
114
+ # If automatic draw is disabled the pixels are read from the internal buffer
115
+ # (see BrickletOLED128x64V2#draw_buffered_frame).
116
+ #
117
+ # Automatic draw can be configured with the BrickletOLED128x64V2#set_display_configuration
118
+ # function.
119
+ def read_pixels_low_level(x_start, y_start, x_end, y_end)
120
+ send_request FUNCTION_READ_PIXELS_LOW_LEVEL, [x_start, y_start, x_end, y_end], 'C C C C', 484, 'S S ?480'
121
+ end
122
+
123
+ # Clears the complete content of the display.
124
+ def clear_display
125
+ send_request FUNCTION_CLEAR_DISPLAY, [], '', 0, ''
126
+ end
127
+
128
+ # Sets the configuration of the display.
129
+ #
130
+ # You can set a contrast value from 0 to 255 and you can invert the color
131
+ # (white/black) of the display.
132
+ #
133
+ # If automatic draw is set to *true*, the display is automatically updated with every
134
+ # call of BrickletOLED128x64V2#write_pixels or BrickletOLED128x64V2#write_line. If it is set to false, the
135
+ # changes are written into an internal buffer and only shown on the display after
136
+ # a call of BrickletOLED128x64V2#draw_buffered_frame.
137
+ #
138
+ # The default values are contrast 143, inverting off and automatic draw on.
139
+ def set_display_configuration(contrast, invert, automatic_draw)
140
+ send_request FUNCTION_SET_DISPLAY_CONFIGURATION, [contrast, invert, automatic_draw], 'C ? ?', 0, ''
141
+ end
142
+
143
+ # Returns the configuration as set by BrickletOLED128x64V2#set_display_configuration.
144
+ def get_display_configuration
145
+ send_request FUNCTION_GET_DISPLAY_CONFIGURATION, [], '', 3, 'C ? ?'
146
+ end
147
+
148
+ # Writes text to a specific line (0 to 7) with a specific position
149
+ # (0 to 21). The text can have a maximum of 22 characters.
150
+ #
151
+ # For example: (1, 10, "Hello") will write *Hello* in the middle of the
152
+ # second line of the display.
153
+ #
154
+ # The display uses a special 5x7 pixel charset. You can view the characters
155
+ # of the charset in Brick Viewer.
156
+ def write_line(line, position, text)
157
+ send_request FUNCTION_WRITE_LINE, [line, position, text], 'C C Z22', 0, ''
158
+ end
159
+
160
+ # Draws the currently buffered frame. Normally each call of BrickletOLED128x64V2#write_pixels and
161
+ # BrickletOLED128x64V2#write_line draws directly onto the display. If you turn automatic draw off
162
+ # (BrickletOLED128x64V2#set_display_configuration), the data is written in an internal buffer and
163
+ # only transferred to the display by calling this function. This can be used to
164
+ # avoid flicker when drawing a complex frame in multiple steps.
165
+ #
166
+ # Set the `force complete redraw` to *true* to redraw the whole display
167
+ # instead of only the changed parts. Normally it should not be necessary to set this to
168
+ # *true*. It may only become necessary in case of stuck pixels because of errors.
169
+ def draw_buffered_frame(force_complete_redraw)
170
+ send_request FUNCTION_DRAW_BUFFERED_FRAME, [force_complete_redraw], '?', 0, ''
171
+ end
172
+
173
+ # Returns the error count for the communication between Brick and Bricklet.
174
+ #
175
+ # The errors are divided into
176
+ #
177
+ # * ACK checksum errors,
178
+ # * message checksum errors,
179
+ # * framing errors and
180
+ # * overflow errors.
181
+ #
182
+ # The errors counts are for errors that occur on the Bricklet side. All
183
+ # Bricks have a similar function that returns the errors on the Brick side.
184
+ def get_spitfp_error_count
185
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
186
+ end
187
+
188
+ # Sets the bootloader mode and returns the status after the requested
189
+ # mode change was instigated.
190
+ #
191
+ # You can change from bootloader mode to firmware mode and vice versa. A change
192
+ # from bootloader mode to firmware mode will only take place if the entry function,
193
+ # device identifier and CRC are present and correct.
194
+ #
195
+ # This function is used by Brick Viewer during flashing. It should not be
196
+ # necessary to call it in a normal user program.
197
+ def set_bootloader_mode(mode)
198
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
199
+ end
200
+
201
+ # Returns the current bootloader mode, see BrickletOLED128x64V2#set_bootloader_mode.
202
+ def get_bootloader_mode
203
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
204
+ end
205
+
206
+ # Sets the firmware pointer for BrickletOLED128x64V2#write_firmware. The pointer has
207
+ # to be increased by chunks of size 64. The data is written to flash
208
+ # every 4 chunks (which equals to one page of size 256).
209
+ #
210
+ # This function is used by Brick Viewer during flashing. It should not be
211
+ # necessary to call it in a normal user program.
212
+ def set_write_firmware_pointer(pointer)
213
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
214
+ end
215
+
216
+ # Writes 64 Bytes of firmware at the position as written by
217
+ # BrickletOLED128x64V2#set_write_firmware_pointer before. The firmware is written
218
+ # to flash every 4 chunks.
219
+ #
220
+ # You can only write firmware in bootloader mode.
221
+ #
222
+ # This function is used by Brick Viewer during flashing. It should not be
223
+ # necessary to call it in a normal user program.
224
+ def write_firmware(data)
225
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
226
+ end
227
+
228
+ # Sets the status LED configuration. By default the LED shows
229
+ # communication traffic between Brick and Bricklet, it flickers once
230
+ # for every 10 received data packets.
231
+ #
232
+ # You can also turn the LED permanently on/off or show a heartbeat.
233
+ #
234
+ # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
235
+ def set_status_led_config(config)
236
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
237
+ end
238
+
239
+ # Returns the configuration as set by BrickletOLED128x64V2#set_status_led_config
240
+ def get_status_led_config
241
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
242
+ end
243
+
244
+ # Returns the temperature in °C as measured inside the microcontroller. The
245
+ # value returned is not the ambient temperature!
246
+ #
247
+ # The temperature is only proportional to the real temperature and it has bad
248
+ # accuracy. Practically it is only useful as an indicator for
249
+ # temperature changes.
250
+ def get_chip_temperature
251
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
252
+ end
253
+
254
+ # Calling this function will reset the Bricklet. All configurations
255
+ # will be lost.
256
+ #
257
+ # After a reset you have to create new device objects,
258
+ # calling functions on the existing ones will result in
259
+ # undefined behavior!
260
+ def reset
261
+ send_request FUNCTION_RESET, [], '', 0, ''
262
+ end
263
+
264
+ # Writes a new UID into flash. If you want to set a new UID
265
+ # you have to decode the Base58 encoded UID string into an
266
+ # integer first.
267
+ #
268
+ # We recommend that you use Brick Viewer to change the UID.
269
+ def write_uid(uid)
270
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
271
+ end
272
+
273
+ # Returns the current UID as an integer. Encode as
274
+ # Base58 to get the usual string version.
275
+ def read_uid
276
+ send_request FUNCTION_READ_UID, [], '', 4, 'L'
277
+ end
278
+
279
+ # Returns the UID, the UID where the Bricklet is connected to,
280
+ # the position, the hardware and firmware version as well as the
281
+ # device identifier.
282
+ #
283
+ # The position can be 'a', 'b', 'c' or 'd'.
284
+ #
285
+ # The device identifier numbers can be found :ref:`here <device_identifier>`.
286
+ # |device_identifier_constant|
287
+ def get_identity
288
+ send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
289
+ end
290
+
291
+ # Writes pixels to the specified window.
292
+ #
293
+ # The x-axis goes from 0 to 127 and the y-axis from 0 to 63. The pixels are written
294
+ # into the window line by line top to bottom and each line is written from left to
295
+ # right.
296
+ #
297
+ # If automatic draw is enabled (default) the pixels are directly written to
298
+ # the screen. Only pixels that have actually changed are updated on the screen,
299
+ # the rest stays the same.
300
+ #
301
+ # If automatic draw is disabled the pixels are written to an internal buffer and
302
+ # the buffer is transferred to the display only after BrickletOLED128x64V2#draw_buffered_frame
303
+ # is called. This can be used to avoid flicker when drawing a complex frame in
304
+ # multiple steps.
305
+ #
306
+ # Automatic draw can be configured with the BrickletOLED128x64V2#set_display_configuration
307
+ # function.
308
+ def write_pixels(x_start, y_start, x_end, y_end, pixels)
309
+ if pixels.length > 65535
310
+ raise ArgumentError, 'Pixels can be at most 65535 items long'
311
+ end
312
+
313
+ pixels_length = pixels.length
314
+ pixels_chunk_offset = 0
315
+
316
+ if pixels_length == 0
317
+ pixels_chunk_data = [false] * 448
318
+ ret = write_pixels_low_level x_start, y_start, x_end, y_end, pixels_length, pixels_chunk_offset, pixels_chunk_data
319
+ else
320
+ ret = nil # assigned in block
321
+
322
+ @stream_mutex.synchronize {
323
+ while pixels_chunk_offset < pixels_length
324
+ pixels_chunk_data = pixels[pixels_chunk_offset, 448]
325
+
326
+ if pixels_chunk_data.length < 448
327
+ pixels_chunk_data += [false] * (448 - pixels_chunk_data.length)
328
+ end
329
+
330
+ ret = write_pixels_low_level x_start, y_start, x_end, y_end, pixels_length, pixels_chunk_offset, pixels_chunk_data
331
+ pixels_chunk_offset += 448
332
+ end
333
+ }
334
+ end
335
+
336
+ ret
337
+ end
338
+
339
+ # Reads pixels from the specified window.
340
+ #
341
+ # The x-axis goes from 0 to 127 and the y-axis from 0 to 63. The pixels are read
342
+ # from the window line by line top to bottom and each line is read from left to
343
+ # right.
344
+ #
345
+ # If automatic draw is enabled (default) the pixels that are read are always the
346
+ # same that are shown on the display.
347
+ #
348
+ # If automatic draw is disabled the pixels are read from the internal buffer
349
+ # (see BrickletOLED128x64V2#draw_buffered_frame).
350
+ #
351
+ # Automatic draw can be configured with the BrickletOLED128x64V2#set_display_configuration
352
+ # function.
353
+ def read_pixels(x_start, y_start, x_end, y_end)
354
+ pixels_length = nil # assigned in block
355
+ pixels_data = nil # assigned in block
356
+
357
+ @stream_mutex.synchronize {
358
+ ret = read_pixels_low_level x_start, y_start, x_end, y_end
359
+ pixels_length = ret[0]
360
+ pixels_chunk_offset = ret[1]
361
+ pixels_out_of_sync = pixels_chunk_offset != 0
362
+ pixels_data = ret[2]
363
+
364
+ while not pixels_out_of_sync and pixels_data.length < pixels_length
365
+ ret = read_pixels_low_level x_start, y_start, x_end, y_end
366
+ pixels_length = ret[0]
367
+ pixels_chunk_offset = ret[1]
368
+ pixels_out_of_sync = pixels_chunk_offset != pixels_data.length
369
+ pixels_data += ret[2]
370
+ end
371
+
372
+ if pixels_out_of_sync # discard remaining stream to bring it back in-sync
373
+ while pixels_chunk_offset + 480 < pixels_length
374
+ ret = read_pixels_low_level x_start, y_start, x_end, y_end
375
+ pixels_length = ret[0]
376
+ pixels_chunk_offset = ret[1]
377
+ end
378
+
379
+ raise StreamOutOfSyncException, 'Pixels stream is out-of-sync'
380
+ end
381
+ }
382
+
383
+ pixels_data[0, pixels_length]
384
+ end
385
+
386
+ end
387
+ end
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2018-06-08. #
3
+ # This file was automatically generated on 2018-09-28. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.17 #
5
+ # Ruby Bindings Version 2.1.18 #
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 #