RPi::OLED::SSD1306::128_64 - Interface to the SSD1306-esque 128x64 OLED displays
Provides the ability to use the 128x64 SSD1306 type OLED displays.
This distribution requires wiringPi version 2.36+ to be installed.
Instantiates and returns a new RPi::OLED::SSD1306::128x64 object.
Note that this module is a singleton; if you've already instantiated a new OLED device object, it will be returned if new() is called again.
new()
Parameters:
$i2c_addr
Optional, Integer. The I2C address of your OLED screen. Defaults to 0x3C, which is extremely common.
0x3C
Wipes the display clean, and sets the cursor to the top-left position on the screen.
Returns 1 on success.
1
By default, we use the smallest text size (1) when displaying characters to the OLED. You can increase or decrease the text size with this call.
$size
Mandatory, Integer: A number to increase or decrease the font size to. Any number is valid, but be realistic... this screen is only 128x64 pixels.
Draws whatever you've put into the buffer to the screen. All calls that add to the buffer (eg: rect(), string(), pixel(), char() etc) require a call to this method after you've filled the buffer.
rect()
string()
pixel()
char()
Send a string to the display for printing.
$str
Mandatory, String: The string you want put into the buffer for display.
$display
Optional, Bool: All calls for displaying something to the screen require an additional call to display(). Send in a positive value (1) as the second parameter to this call and we'll call display automatically for you.
display()
Prepares a rectangle for display on the screen. To actually display the rectangle, a subsequent call to display() is required.
$x
Mandatory, Integer: The X-axis (horizontal) position from the left of the screen to begin drawing the rectangle.
$y
Mandatory, Integer: The Y-axis (vertical) position from the top of the screen to begin drawing the rectangle.
$w
Mandatory, Integer: How many pixels wide to draw the rect.
$h
Mandatory, Integer: How many pixels tall (from the top) to draw the rect.
$colour
Optional, Bool: By default, we use 1 which is standard colour (white). Send in 0 and we'll use black, which will effectively wipe out whatever was on the display in the area of the rectangle.
0
Creates a buffer with a single ASCII char. As with other buffer calls, a call to display() is required once you're ready to display the buffer.
Mandatory, Integer: The X-axis (horizontal) position from the left of the screen to begin drawing the char.
Mandatory, Integer: The Y-axis (vertical) position from the top of the screen to begin drawing the char.
$char
Mandatory, Integer: The integer representation of the ASCII char to draw. Valid values are 0-255.
0-255
Optional, Integer: The size of the char on the screen. Defaults to 2.
2
Optional, Bool: By default, we use 1 which is standard colour (white). Send in 0 and we'll use black, which will effectively wipe out whatever was on the display in the area of the char.
Draw a single pixel to the screen.
Mandatory, Integer: The X-axis (horizontal) position from the left of the screen to place the pixel.
Mandatory, Integer: The Y-axis (vertical) position from the top of the screen to place the pixel.
Optional, Bool: By default, we use 1 which is standard colour (white). Send in 0 and we'll use black, which will effectively wipe out whatever was on the display in the area of the pixel.
Draw a single pixel wide horizontal line.
Mandatory, Integer: The X-axis (horizontal) position from the left of the screen to begin drawing the horizontal line.
Mandatory, Integer: The Y-axis (vertical) position from the top of the screen to begin drawing the horizontal line.
Mandatory, Integer: How many pixels wide to draw the horizontal line.
Draw a single-pixel wide vertical line.
Mandatory, Integer: The X-axis (horizontal) position from the left of the screen to begin drawing the vertical line.
Mandatory, Integer: The Y-axis (vertical) position from the top of the screen to begin drawing the vertical line.
Mandatory, Integer: How many pixels tall to draw the vertical line.
The screen has two brightness levels, dim and full.
$bool
Optional, Bool: Send in 1 to dim the display, and 0 to turn it to its maximum brightness. Defaults to 0 if not sent in.
By default, the screen background is black, and anything you draw will be white. Inverting the screen will reverse those two colours.
Optional, Bool: 1 will invert the screen (black on white background), and 0 will set it back to normal (white on black background). Defaults to 0 if not sent in.
Steve Bertrand, <steveb at cpan.org>
<steveb at cpan.org>
Copyright 2018 Steve Bertrand.
BSD License
To install RPi::OLED::SSD1306::128_64, copy and paste the appropriate command in to your terminal.
cpanm
cpanm RPi::OLED::SSD1306::128_64
CPAN shell
perl -MCPAN -e shell install RPi::OLED::SSD1306::128_64
For more information on module installation, please visit the detailed CPAN module installation guide.