tinkerforge 2.1.6 → 2.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. data/lib/tinkerforge/brick_dc.rb +2 -2
  2. data/lib/tinkerforge/brick_imu.rb +2 -2
  3. data/lib/tinkerforge/brick_imu_v2.rb +2 -2
  4. data/lib/tinkerforge/brick_master.rb +2 -2
  5. data/lib/tinkerforge/brick_red.rb +2 -2
  6. data/lib/tinkerforge/brick_servo.rb +2 -2
  7. data/lib/tinkerforge/brick_stepper.rb +2 -2
  8. data/lib/tinkerforge/bricklet_accelerometer.rb +2 -2
  9. data/lib/tinkerforge/bricklet_ambient_light.rb +2 -2
  10. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +2 -2
  11. data/lib/tinkerforge/bricklet_analog_in.rb +2 -2
  12. data/lib/tinkerforge/bricklet_analog_in_v2.rb +3 -3
  13. data/lib/tinkerforge/bricklet_analog_out.rb +2 -2
  14. data/lib/tinkerforge/bricklet_analog_out_v2.rb +2 -2
  15. data/lib/tinkerforge/bricklet_barometer.rb +2 -2
  16. data/lib/tinkerforge/bricklet_co2.rb +158 -0
  17. data/lib/tinkerforge/bricklet_color.rb +2 -2
  18. data/lib/tinkerforge/bricklet_current12.rb +2 -2
  19. data/lib/tinkerforge/bricklet_current25.rb +2 -2
  20. data/lib/tinkerforge/bricklet_distance_ir.rb +2 -2
  21. data/lib/tinkerforge/bricklet_distance_us.rb +2 -2
  22. data/lib/tinkerforge/bricklet_dual_button.rb +2 -2
  23. data/lib/tinkerforge/bricklet_dual_relay.rb +2 -2
  24. data/lib/tinkerforge/bricklet_dust_detector.rb +2 -2
  25. data/lib/tinkerforge/bricklet_gps.rb +2 -2
  26. data/lib/tinkerforge/bricklet_hall_effect.rb +2 -2
  27. data/lib/tinkerforge/bricklet_humidity.rb +2 -2
  28. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +2 -2
  29. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +2 -2
  30. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +2 -2
  31. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +2 -2
  32. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +2 -2
  33. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +2 -2
  34. data/lib/tinkerforge/bricklet_io16.rb +2 -2
  35. data/lib/tinkerforge/bricklet_io4.rb +2 -2
  36. data/lib/tinkerforge/bricklet_joystick.rb +2 -2
  37. data/lib/tinkerforge/bricklet_laser_range_finder.rb +2 -2
  38. data/lib/tinkerforge/bricklet_lcd_16x2.rb +5 -4
  39. data/lib/tinkerforge/bricklet_lcd_20x4.rb +6 -5
  40. data/lib/tinkerforge/bricklet_led_strip.rb +2 -2
  41. data/lib/tinkerforge/bricklet_line.rb +2 -2
  42. data/lib/tinkerforge/bricklet_linear_poti.rb +2 -2
  43. data/lib/tinkerforge/bricklet_load_cell.rb +2 -2
  44. data/lib/tinkerforge/bricklet_moisture.rb +2 -2
  45. data/lib/tinkerforge/bricklet_motion_detector.rb +2 -2
  46. data/lib/tinkerforge/bricklet_multi_touch.rb +2 -2
  47. data/lib/tinkerforge/bricklet_nfc_rfid.rb +2 -2
  48. data/lib/tinkerforge/bricklet_oled_128x64.rb +124 -0
  49. data/lib/tinkerforge/bricklet_oled_64x48.rb +123 -0
  50. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +2 -2
  51. data/lib/tinkerforge/bricklet_piezo_speaker.rb +2 -2
  52. data/lib/tinkerforge/bricklet_ptc.rb +2 -2
  53. data/lib/tinkerforge/bricklet_remote_switch.rb +2 -2
  54. data/lib/tinkerforge/bricklet_rotary_encoder.rb +2 -2
  55. data/lib/tinkerforge/bricklet_rotary_poti.rb +2 -2
  56. data/lib/tinkerforge/bricklet_rs232.rb +2 -2
  57. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +2 -2
  58. data/lib/tinkerforge/bricklet_solid_state_relay.rb +2 -2
  59. data/lib/tinkerforge/bricklet_sound_intensity.rb +2 -2
  60. data/lib/tinkerforge/bricklet_temperature.rb +2 -2
  61. data/lib/tinkerforge/bricklet_temperature_ir.rb +2 -2
  62. data/lib/tinkerforge/bricklet_thermocouple.rb +235 -0
  63. data/lib/tinkerforge/bricklet_tilt.rb +2 -2
  64. data/lib/tinkerforge/bricklet_uv_light.rb +160 -0
  65. data/lib/tinkerforge/bricklet_voltage.rb +2 -2
  66. data/lib/tinkerforge/bricklet_voltage_current.rb +2 -2
  67. data/lib/tinkerforge/version.rb +1 -1
  68. metadata +7 -2
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2015-11-17. #
3
+ # This file was automatically generated on 2016-01-06. #
4
4
  # #
5
- # Bindings Version 2.1.6 #
5
+ # Ruby Bindings Version 2.1.7 #
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 2015-11-17. #
3
+ # This file was automatically generated on 2016-01-06. #
4
4
  # #
5
- # Bindings Version 2.1.6 #
5
+ # Ruby Bindings Version 2.1.7 #
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 2015-11-17. #
3
+ # This file was automatically generated on 2016-01-06. #
4
4
  # #
5
- # Bindings Version 2.1.6 #
5
+ # Ruby Bindings Version 2.1.7 #
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 2015-11-17. #
3
+ # This file was automatically generated on 2016-01-06. #
4
4
  # #
5
- # Bindings Version 2.1.6 #
5
+ # Ruby Bindings Version 2.1.7 #
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 2015-11-17. #
3
+ # This file was automatically generated on 2016-01-06. #
4
4
  # #
5
- # Bindings Version 2.1.6 #
5
+ # Ruby Bindings Version 2.1.7 #
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 2015-11-17. #
3
+ # This file was automatically generated on 2016-01-06. #
4
4
  # #
5
- # Bindings Version 2.1.6 #
5
+ # Ruby Bindings Version 2.1.7 #
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 2015-11-17. #
3
+ # This file was automatically generated on 2016-01-06. #
4
4
  # #
5
- # Bindings Version 2.1.6 #
5
+ # Ruby Bindings Version 2.1.7 #
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 2015-11-17. #
3
+ # This file was automatically generated on 2016-01-06. #
4
4
  # #
5
- # Bindings Version 2.1.6 #
5
+ # Ruby Bindings Version 2.1.7 #
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 2015-11-17. #
3
+ # This file was automatically generated on 2016-01-06. #
4
4
  # #
5
- # Bindings Version 2.1.6 #
5
+ # Ruby Bindings Version 2.1.7 #
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 2015-11-17. #
3
+ # This file was automatically generated on 2016-01-06. #
4
4
  # #
5
- # Bindings Version 2.1.6 #
5
+ # Ruby Bindings Version 2.1.7 #
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 2015-11-17. #
3
+ # This file was automatically generated on 2016-01-06. #
4
4
  # #
5
- # Bindings Version 2.1.6 #
5
+ # Ruby Bindings Version 2.1.7 #
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 2015-11-17. #
3
+ # This file was automatically generated on 2016-01-06. #
4
4
  # #
5
- # Bindings Version 2.1.6 #
5
+ # Ruby Bindings Version 2.1.7 #
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 2015-11-17. #
3
+ # This file was automatically generated on 2016-01-06. #
4
4
  # #
5
- # Bindings Version 2.1.6 #
5
+ # Ruby Bindings Version 2.1.7 #
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 2015-11-17. #
3
+ # This file was automatically generated on 2016-01-06. #
4
4
  # #
5
- # Bindings Version 2.1.6 #
5
+ # Ruby Bindings Version 2.1.7 #
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 #
@@ -111,8 +111,9 @@ module Tinkerforge
111
111
  send_request(FUNCTION_GET_CONFIG, [], '', 2, '? ?')
112
112
  end
113
113
 
114
- # Returns *true* if the button (0 to 2) is pressed. If you want to react
115
- # on button presses and releases it is recommended to use the
114
+ # Returns *true* if the button (0 to 2) is pressed.
115
+ #
116
+ # If you want to react on button presses and releases it is recommended to use the
116
117
  # CALLBACK_BUTTON_PRESSED and CALLBACK_BUTTON_RELEASED callbacks.
117
118
  def is_button_pressed(button)
118
119
  send_request(FUNCTION_IS_BUTTON_PRESSED, [button], 'C', 1, '?')
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2015-11-17. #
3
+ # This file was automatically generated on 2016-01-06. #
4
4
  # #
5
- # Bindings Version 2.1.6 #
5
+ # Ruby Bindings Version 2.1.7 #
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 #
@@ -120,9 +120,10 @@ module Tinkerforge
120
120
  end
121
121
 
122
122
  # Returns *true* if the button (0 to 2 or 0 to 3 since hardware version 1.2)
123
- # is pressed. If you want to react
124
- # on button presses and releases it is recommended to use the
125
- # CALLBACK_BUTTON_PRESSED and CALLBACK_BUTTON_RELEASED callbacks.
123
+ # is pressed.
124
+ #
125
+ # If you want to react on button presses and releases it is recommended to use
126
+ # the CALLBACK_BUTTON_PRESSED and CALLBACK_BUTTON_RELEASED callbacks.
126
127
  def is_button_pressed(button)
127
128
  send_request(FUNCTION_IS_BUTTON_PRESSED, [button], 'C', 1, '?')
128
129
  end
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2015-11-17. #
3
+ # This file was automatically generated on 2016-01-06. #
4
4
  # #
5
- # Bindings Version 2.1.6 #
5
+ # Ruby Bindings Version 2.1.7 #
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 2015-11-17. #
3
+ # This file was automatically generated on 2016-01-06. #
4
4
  # #
5
- # Bindings Version 2.1.6 #
5
+ # Ruby Bindings Version 2.1.7 #
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 2015-11-17. #
3
+ # This file was automatically generated on 2016-01-06. #
4
4
  # #
5
- # Bindings Version 2.1.6 #
5
+ # Ruby Bindings Version 2.1.7 #
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 2015-11-17. #
3
+ # This file was automatically generated on 2016-01-06. #
4
4
  # #
5
- # Bindings Version 2.1.6 #
5
+ # Ruby Bindings Version 2.1.7 #
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 2015-11-17. #
3
+ # This file was automatically generated on 2016-01-06. #
4
4
  # #
5
- # Bindings Version 2.1.6 #
5
+ # Ruby Bindings Version 2.1.7 #
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 2015-11-17. #
3
+ # This file was automatically generated on 2016-01-06. #
4
4
  # #
5
- # Bindings Version 2.1.6 #
5
+ # Ruby Bindings Version 2.1.7 #
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 2015-11-17. #
3
+ # This file was automatically generated on 2016-01-06. #
4
4
  # #
5
- # Bindings Version 2.1.6 #
5
+ # Ruby Bindings Version 2.1.7 #
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 2015-11-17. #
3
+ # This file was automatically generated on 2016-01-06. #
4
4
  # #
5
- # Bindings Version 2.1.6 #
5
+ # Ruby Bindings Version 2.1.7 #
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,124 @@
1
+ # -*- ruby encoding: utf-8 -*-
2
+ #############################################################
3
+ # This file was automatically generated on 2016-01-06. #
4
+ # #
5
+ # Ruby Bindings Version 2.1.7 #
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
+ # 1.3" OLED with 128x64 pixels
14
+ class BrickletOLED128x64 < Device
15
+ DEVICE_IDENTIFIER = 263 # :nodoc:
16
+ DEVICE_DISPLAY_NAME = 'OLED 128x64 Bricklet' # :nodoc:
17
+
18
+ FUNCTION_WRITE = 1 # :nodoc:
19
+ FUNCTION_NEW_WINDOW = 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_GET_IDENTITY = 255 # :nodoc:
25
+
26
+
27
+ # Creates an object with the unique device ID <tt>uid</tt> and adds it to
28
+ # the IP Connection <tt>ipcon</tt>.
29
+ def initialize(uid, ipcon)
30
+ super uid, ipcon
31
+
32
+ @api_version = [2, 0, 0]
33
+
34
+ @response_expected[FUNCTION_WRITE] = RESPONSE_EXPECTED_FALSE
35
+ @response_expected[FUNCTION_NEW_WINDOW] = RESPONSE_EXPECTED_FALSE
36
+ @response_expected[FUNCTION_CLEAR_DISPLAY] = RESPONSE_EXPECTED_FALSE
37
+ @response_expected[FUNCTION_SET_DISPLAY_CONFIGURATION] = RESPONSE_EXPECTED_FALSE
38
+ @response_expected[FUNCTION_GET_DISPLAY_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
39
+ @response_expected[FUNCTION_WRITE_LINE] = RESPONSE_EXPECTED_FALSE
40
+ @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
41
+
42
+ end
43
+
44
+ # Appends 64 byte of data to the window as set by BrickletOLED128x64#new_window.
45
+ #
46
+ # Each row has a height of 8 pixels which corresponds to one byte of data.
47
+ #
48
+ # Example: if you call BrickletOLED128x64#new_window with column from 0 to 127 and row
49
+ # from 0 to 7 (the whole display) each call of BrickletOLED128x64#write (red arrow) will
50
+ # write half of a row.
51
+ #
52
+ # .. image:: /Images/Bricklets/bricklet_oled_128x64_display.png
53
+ # :scale: 100 %
54
+ # :alt: Display pixel order
55
+ # :align: center
56
+ # :target: ../../_images/Bricklets/bricklet_oled_128x64_display.png
57
+ #
58
+ # The LSB (D0) of each data byte is at the top and the MSB (D7) is at the
59
+ # bottom of the row.
60
+ #
61
+ # The next call of BrickletOLED128x64#write will write the second half of the row
62
+ # and the next two the second row and so on. To fill the whole display
63
+ # you need to call BrickletOLED128x64#write 16 times.
64
+ def write(data)
65
+ send_request(FUNCTION_WRITE, [data], 'C64', 0, '')
66
+ end
67
+
68
+ # Sets the window in which you can write with BrickletOLED128x64#write. One row
69
+ # has a height of 8 pixels.
70
+ #
71
+ # The columns have a range of 0 to 127 and the rows have a range of 0 to 7.
72
+ def new_window(column_from, column_to, row_from, row_to)
73
+ send_request(FUNCTION_NEW_WINDOW, [column_from, column_to, row_from, row_to], 'C C C C', 0, '')
74
+ end
75
+
76
+ # Clears the current content of the display.
77
+ def clear_display
78
+ send_request(FUNCTION_CLEAR_DISPLAY, [], '', 0, '')
79
+ end
80
+
81
+ # Sets the configuration of the display.
82
+ #
83
+ # You can set a contrast value from 0 to 255 and you can invert the color
84
+ # (black/white) of the display.
85
+ #
86
+ # The default values are contrast 143 and inverting off.
87
+ def set_display_configuration(contrast, invert)
88
+ send_request(FUNCTION_SET_DISPLAY_CONFIGURATION, [contrast, invert], 'C ?', 0, '')
89
+ end
90
+
91
+ # Returns the configuration as set by BrickletOLED128x64#set_display_configuration.
92
+ def get_display_configuration
93
+ send_request(FUNCTION_GET_DISPLAY_CONFIGURATION, [], '', 2, 'C ?')
94
+ end
95
+
96
+ # Writes text to a specific line (0 to 7) with a specific position
97
+ # (0 to 25). The text can have a maximum of 26 characters.
98
+ #
99
+ # For example: (1, 10, "Hello") will write *Hello* in the middle of the
100
+ # second line of the display.
101
+ #
102
+ # You can draw to the display with BrickletOLED128x64#write and then add text to it
103
+ # afterwards.
104
+ #
105
+ # The display uses a special 5x7 pixel charset. You can view the characters
106
+ # of the charset in Brick Viewer.
107
+ def write_line(line, position, text)
108
+ send_request(FUNCTION_WRITE_LINE, [line, position, text], 'C C Z26', 0, '')
109
+ end
110
+
111
+ # Returns the UID, the UID where the Bricklet is connected to,
112
+ # the position, the hardware and firmware version as well as the
113
+ # device identifier.
114
+ #
115
+ # The position can be 'a', 'b', 'c' or 'd'.
116
+ #
117
+ # The device identifier numbers can be found :ref:`here <device_identifier>`.
118
+ # |device_identifier_constant|
119
+ def get_identity
120
+ send_request(FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S')
121
+ end
122
+
123
+ end
124
+ end
@@ -0,0 +1,123 @@
1
+ # -*- ruby encoding: utf-8 -*-
2
+ #############################################################
3
+ # This file was automatically generated on 2016-01-06. #
4
+ # #
5
+ # Ruby Bindings Version 2.1.7 #
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
+ # 0.66" OLED with 64x48 pixels
14
+ class BrickletOLED64x48 < Device
15
+ DEVICE_IDENTIFIER = 264 # :nodoc:
16
+ DEVICE_DISPLAY_NAME = 'OLED 64x48 Bricklet' # :nodoc:
17
+
18
+ FUNCTION_WRITE = 1 # :nodoc:
19
+ FUNCTION_NEW_WINDOW = 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_GET_IDENTITY = 255 # :nodoc:
25
+
26
+
27
+ # Creates an object with the unique device ID <tt>uid</tt> and adds it to
28
+ # the IP Connection <tt>ipcon</tt>.
29
+ def initialize(uid, ipcon)
30
+ super uid, ipcon
31
+
32
+ @api_version = [2, 0, 0]
33
+
34
+ @response_expected[FUNCTION_WRITE] = RESPONSE_EXPECTED_FALSE
35
+ @response_expected[FUNCTION_NEW_WINDOW] = RESPONSE_EXPECTED_FALSE
36
+ @response_expected[FUNCTION_CLEAR_DISPLAY] = RESPONSE_EXPECTED_FALSE
37
+ @response_expected[FUNCTION_SET_DISPLAY_CONFIGURATION] = RESPONSE_EXPECTED_FALSE
38
+ @response_expected[FUNCTION_GET_DISPLAY_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
39
+ @response_expected[FUNCTION_WRITE_LINE] = RESPONSE_EXPECTED_FALSE
40
+ @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
41
+
42
+ end
43
+
44
+ # Appends 64 byte of data to the window as set by BrickletOLED64x48#new_window.
45
+ #
46
+ # Each row has a height of 8 pixels which corresponds to one byte of data.
47
+ #
48
+ # Example: if you call BrickletOLED64x48#new_window with column from 0 to 63 and row
49
+ # from 0 to 5 (the whole display) each call of BrickletOLED64x48#write (red arrow) will
50
+ # write one row.
51
+ #
52
+ # .. image:: /Images/Bricklets/bricklet_oled_64x48_display.png
53
+ # :scale: 100 %
54
+ # :alt: Display pixel order
55
+ # :align: center
56
+ # :target: ../../_images/Bricklets/bricklet_oled_64x48_display.png
57
+ #
58
+ # The LSB (D0) of each data byte is at the top and the MSB (D7) is at the
59
+ # bottom of the row.
60
+ #
61
+ # The next call of BrickletOLED64x48#write will write the second row and so on. To
62
+ # fill the whole display you need to call BrickletOLED64x48#write 6 times.
63
+ def write(data)
64
+ send_request(FUNCTION_WRITE, [data], 'C64', 0, '')
65
+ end
66
+
67
+ # Sets the window in which you can write with BrickletOLED64x48#write. One row
68
+ # has a height of 8 pixels.
69
+ #
70
+ # The columns have a range of 0 to 63 and the rows have a range of 0 to 5.
71
+ def new_window(column_from, column_to, row_from, row_to)
72
+ send_request(FUNCTION_NEW_WINDOW, [column_from, column_to, row_from, row_to], 'C C C C', 0, '')
73
+ end
74
+
75
+ # Clears the current content of the display.
76
+ def clear_display
77
+ send_request(FUNCTION_CLEAR_DISPLAY, [], '', 0, '')
78
+ end
79
+
80
+ # Sets the configuration of the display.
81
+ #
82
+ # You can set a contrast value from 0 to 255 and you can invert the color
83
+ # (black/white) of the display.
84
+ #
85
+ # The default values are contrast 143 and inverting off.
86
+ def set_display_configuration(contrast, invert)
87
+ send_request(FUNCTION_SET_DISPLAY_CONFIGURATION, [contrast, invert], 'C ?', 0, '')
88
+ end
89
+
90
+ # Returns the configuration as set by BrickletOLED64x48#set_display_configuration.
91
+ def get_display_configuration
92
+ send_request(FUNCTION_GET_DISPLAY_CONFIGURATION, [], '', 2, 'C ?')
93
+ end
94
+
95
+ # Writes text to a specific line (0 to 5) with a specific position
96
+ # (0 to 13). The text can have a maximum of 14 characters.
97
+ #
98
+ # For example: (1, 4, "Hello") will write *Hello* in the middle of the
99
+ # second line of the display.
100
+ #
101
+ # You can draw to the display with BrickletOLED64x48#write and then add text to it
102
+ # afterwards.
103
+ #
104
+ # The display uses a special 5x7 pixel charset. You can view the characters
105
+ # of the charset in Brick Viewer.
106
+ def write_line(line, position, text)
107
+ send_request(FUNCTION_WRITE_LINE, [line, position, text], 'C C Z13', 0, '')
108
+ end
109
+
110
+ # Returns the UID, the UID where the Bricklet is connected to,
111
+ # the position, the hardware and firmware version as well as the
112
+ # device identifier.
113
+ #
114
+ # The position can be 'a', 'b', 'c' or 'd'.
115
+ #
116
+ # The device identifier numbers can be found :ref:`here <device_identifier>`.
117
+ # |device_identifier_constant|
118
+ def get_identity
119
+ send_request(FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S')
120
+ end
121
+
122
+ end
123
+ end