Module OLED1306 :: Class OLED1306
[hide private]
[frames] | no frames]

Class OLED1306

source code

Creates a display instances with given OLED display type (128x32 or 128x64, black & white). with standard font from font file /usr/share/fonts/truetype/freefont/FreeSans.ttf.

Instance Methods [hide private]
 
__init__(self, bkImagePath=None, type=64, inverse=False) source code
 
dim(self, enable)
Enables/disables dimming the display.
source code
 
setBkImage(self, bkImagePath)
Defines a background image to be displayed with next setText() or show().
source code
 
setFont(self, ttfFile, fontSize=10)
Sets a new font defined by the given TTF font file.
source code
 
setFontSize(self, fontSize)
Sets a new font size of current font.
source code
 
clear(self)
Erases the display and clears the text buffer.
source code
 
erase(self)
Erases the display without clearing the text buffer.
source code
 
setText(self, text, lineNum=0, fontSize=None, indent=0)
Displays text at given line left adjusted.
source code
 
_setLine(self, text, lineNum, fontSize, indent) source code
 
getFontSize(self)
Returns the current font size.
source code
 
getLineHeight(self)
Returns the height of one line.
source code
 
repaint(self)
Repaints the screen (background image and text buffer).
source code
 
showImage(self, imagePath)
Shows the image (1 pixel monochrome) with given filename (must have size 128x32 for display type 32 or 128x64 for display type 64).
source code
 
println(self, text)
Appends text at current cursor position and scrolls, if necessary.
source code
 
setNumberOfLines(self, nbLines)
Sets the current font size to a maximum to show the given number of lines.
source code
 
setInverse(self, inverse) source code
 
setBlinking(self, count=3, offTime=1, onTime=1, blocking=False)
Blicks the entire screen for given number of times (off-on periods).
source code
 
stopBlinker(self)
Stops a running blinker.
source code
 
isBlinkerAlive(self)
Returns: True, if the blinker is displaying; otherwise False
source code
Method Details [hide private]

__init__(self, bkImagePath=None, type=64, inverse=False)
(Constructor)

source code 
Parameters:
  • imagePath - the path to the PPM image file used as background (must have size 128x32 or 128x64 resp.)
  • type - 32 or 64 defining 128x32 or 128x64 bit resolution (default: 64)
  • inverse - if True, the background is white and the text is black; otherwise the background is black and the text is white (default)

dim(self, enable)

source code 

Enables/disables dimming the display.

Parameters:
  • enable - if True, the display is slightly dimmed; otherwise it is set to full contrast

setText(self, text, lineNum=0, fontSize=None, indent=0)

source code 

       Displays text at given line left adjusted.
       The old text of this line is erased, other text is not modified
       The line distance is defined by the font size (text height + 1).
       If no text is attributed to a line, the line is considered to consist of a single space
       character with the font size of the preceeding line.
       The position of the text cursor is not modified.
       Text separated by 
is considered as a  multiline text. In this case lineNum is the line number of the
       first line.
       @param text: the text to display. If emtpy, text with a single space character is assumed.
       @param lineNum: the line number where to display the text (default: 0)
       @param fontSize: the size of the font (default: None, set to current font size)
       @indent: the line indent in pixels (default: 0)
       

getFontSize(self)

source code 

Returns the current font size.

Returns:
the font size

getLineHeight(self)

source code 

Returns the height of one line.

Returns:
line spacing in pixels

showImage(self, imagePath)

source code 

Shows the image (1 pixel monochrome) with given filename (must have size 128x32 for display type 32 or 128x64 for display type 64).

Parameters:
  • imagePath - the path to the PPM image file

println(self, text)

source code 

Appends text at current cursor position and scrolls, if necessary. Sets the cursor at the beginning of next line.

Parameters:
  • text - the text to display

setInverse(self, inverse)

source code 
Parameters:
  • inverse - if True, the background is white and the text is black; otherwise the background is black and the text is white (default)

setBlinking(self, count=3, offTime=1, onTime=1, blocking=False)

source code 

Blicks the entire screen for given number of times (off-on periods).

Parameters:
  • count - the number of blinking (default: 3)
  • offTime - the time the display is erased (in s)
  • onTime - the time the display is shown (in s)
  • blocking - if True, the function blocks until the blinking is finished; otherwise it returns immediately

stopBlinker(self)

source code 

Stops a running blinker. The method blocks until the blinker thread is finished and isBlinkerAlive() returns False.

isBlinkerAlive(self)

source code 
Returns:
True, if the blinker is displaying; otherwise False