Qwiic_OLED_Base_Py  2.0.0-4-gbc1cda2
Python for SFE Qwiic OLED
Loading...
Searching...
No Matches
qwiic_oled.qwiic_oled_base.QwiicOledBase Class Reference

QwiicOledBase. More...

Inheritance diagram for qwiic_oled.qwiic_oled_base.QwiicOledBase:

Public Member Functions

def __init__ (self, address=None, pixel_width=_LCDWIDTH, pixel_height=_LCDHEIGHT, i2c_driver=None)
 
def is_connected (self)
 Determine if a SSD1306 OLED device is conntected to the system. More...
 
def begin (self)
 Initialize the operation of the SSD1306 display driver for the OLED module. More...
 
def set_page_address (self, pageAddress)
 Set SSD1306 page address. More...
 
def set_column_address (self, colAddress)
 Set SSD1306 column address. More...
 
def clear (self, mode, value=0)
 Clear the display on the OLED Device. More...
 
def invert (self, inv)
 Invert the display of the display. More...
 
def contrast (self, contrast)
 Set the OLED contract value from 0 to 255. More...
 
def display (self)
 Display the current screen buffer on the Display device. More...
 
def write (self, c)
 Write a character on the display using the current font, at the current position. More...
 
def print (self, text)
 Print a line of text on the display using the current font, starting at the current position. More...
 
def set_cursor (self, x, y)
 Set the current cusor position for writing text. More...
 
def pixel (self, x, y, color=None, mode=None)
 Draw a pixel at a given position, with a given color. More...
 
def line (self, x0, y0, x1, y1, color=None, mode=None)
 Draw a line starting at and ending at specified coordinates, with a given color. More...
 
def line_h (self, x, y, width, color=None, mode=None)
 Draw a horizontal line defined by a starting position and width. More...
 
def line_v (self, x, y, height, color=None, mode=None)
 Draw a vertical line defined by a starting position and width. More...
 
def rect (self, x, y, width, height, color=None, mode=None)
 Draw a rectangle on the diplay. More...
 
def rect_fill (self, x, y, width, height, color=None, mode=None)
 Draw a filled rectangle on the diplay. More...
 
def circle (self, x0, y0, radius, color=None, mode=None)
 Draw a circle on the diplay. More...
 
def get_lcd_height (self)
 The height of the display in pixels. More...
 
def get_lcd_width (self)
 The width of the display in pixels. More...
 
def get_font_width (self)
 The width of the current font. More...
 
def get_font_height (self)
 The height of the current font. More...
 
def get_font_start_char (self)
 Return the starting ASCII character of the currnet font, not all fonts start with ASCII character 0. More...
 
def get_font_total_char (self)
 The total number of characters in the current font. More...
 
def get_total_fonts (self)
 Return the total number of fonts loaded into the OLED's flash memory. More...
 
def get_font_type (self)
 Return the font type number of the current font. More...
 
def set_font_type (self, font_type)
 Set the current font type number, ie changing to different fonts base on the type provided. More...
 
def set_color (self, color)
 Set the current draw's color. More...
 
def set_draw_modee (self, mode)
 Set current draw mode with NORM or XOR. More...
 
def draw_char (self, x, y, c, color=None, mode=None)
 Draw character c using color and draw mode at x,y. More...
 
def scroll_stop (self)
 Stop scrolling operation. More...
 
def scroll (self, start, stop, scrollCommand=RIGHTHORIZONTALSCROLL, vertOffset=0)
 Set row start to row stop on the OLED to scroll. More...
 
def scroll_right (self, start, stop)
 Set row start to row stop on the OLED to scroll right. More...
 
def scroll_left (self, start, stop)
 Set row start to row stop on the OLED to scroll right. More...
 
def scroll_vert_left (self, start, stop, vertOffset=1)
 Set row start to row stop on the OLED to scroll vertical right (Diagonally). More...
 
def scroll_vert_right (self, start, stop, vertOffset=1)
 Set row start to row stop on the OLED to scroll vertical right (Diagonally). More...
 
def flip_vertical (self, flip)
 Flip the graphics on the OLED vertically. More...
 
def flip_horizontal (self, flip)
 Flip the graphics on the OLED horizontally. More...
 
def get_screenbuffer (self)
 Return a pointer to the start of the RAM screen buffer for direct access. More...
 
def draw_bitmap (self, bitArray)
 Draw Bitmap image on screen. More...
 

Public Attributes

 address
 
 LCDHEIGHT
 
 LCDWIDTH
 
 cursorX
 
 cursorY
 
 foreColor
 
 drawMode
 
 fontType
 
 nFonts
 

Static Public Attributes

 device_name = _DEFAULT_NAME
 
 available_addresses = _AVAILABLE_I2C_ADDRESS
 
int BLACK = 0
 
int WHITE = 1
 
int NORM = 0
 
int XOR = 1
 
int PAGE = 0
 
int ALL = 1
 

Properties

 connected = property(is_connected)
 
 height = property(get_lcd_height)
 
 width = property(get_lcd_width)
 
 font_width = property(get_font_width)
 
 font_height = property(get_font_height)
 
 font_type = property(get_font_type, set_font_type)
 

Detailed Description

QwiicOledBase.

Parameters
addressThe I2C address to use for the device. If not provided, the default address is used.
i2c_driverAn existing i2c driver object. If not provided a driver object is created.
Returns
Object The SSD1306 OLED device object.

Constructor & Destructor Documentation

◆ __init__()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.__init__ (   self,
  address = None,
  pixel_width = _LCDWIDTH,
  pixel_height = _LCDHEIGHT,
  i2c_driver = None 
)

Member Function Documentation

◆ begin()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.begin (   self)

Initialize the operation of the SSD1306 display driver for the OLED module.

Returns
bool Returns true of the initializtion was successful, otherwise False.

◆ circle()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.circle (   self,
  x0,
  y0,
  radius,
  color = None,
  mode = None 
)

Draw a circle on the diplay.

A color can be specified. Pixel copy mode is either Normal (source copy) or XOR

Parameters
x0The X center position for the circle
y0The Y center position for the circle.
radiusThe radius of the circle
colorThe color to draw. If not set, the default foreground color is used.
modeThe mode to draw the pixl to the screen bufffer. Value can be either XOR or NORM. Default is NORM
Returns
No return value

◆ clear()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.clear (   self,
  mode,
  value = 0 
)

Clear the display on the OLED Device.

Parameters
modeTo clear GDRAM inside the LCD controller, pass in the variable mode = ALL, and to clear screen page buffer pass in the variable mode = PAGE.
valueThe value to clear the screen to. Default value is 0
Returns
No return value

◆ contrast()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.contrast (   self,
  contrast 
)

Set the OLED contract value from 0 to 255.

Note: Contrast level is not very obvious on the display.

Parameters
contrastContrast Value between 0-255
Returns
No return value

◆ display()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.display (   self)

Display the current screen buffer on the Display device.

Bulk move the screen buffer to the SSD1306 controller's memory so that images/graphics drawn on the screen buffer will be displayed on the OLED.

Returns
No return value

◆ draw_bitmap()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.draw_bitmap (   self,
  bitArray 
)

Draw Bitmap image on screen.

To use, create int array that is 64x48 pixels (384 bytes). Then call .draw_bitmap and pass it the array.

Parameters
bitArrayThe bitmap to draw
Returns
No return value

◆ draw_char()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.draw_char (   self,
  x,
  y,
  c,
  color = None,
  mode = None 
)

Draw character c using color and draw mode at x,y.

Pixel copy mode is either Normal (source copy) or XOR

Parameters
xThe X position on the display
yThe Y position on the display
cThe character to draw
colorThe color to draw. If not set, the default foreground color is used.
modeThe mode to draw the pixl to the screen bufffer. Value can be either XOR or NORM. Default is NORM
Returns
No return value

◆ flip_horizontal()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.flip_horizontal (   self,
  flip 
)

Flip the graphics on the OLED horizontally.

Returns
No return value

◆ flip_vertical()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.flip_vertical (   self,
  flip 
)

Flip the graphics on the OLED vertically.

Returns
No return value

◆ get_font_height()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.get_font_height (   self)

The height of the current font.

Returns
height of the font :rvalue: integer

◆ get_font_start_char()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.get_font_start_char (   self)

Return the starting ASCII character of the currnet font, not all fonts start with ASCII character 0.

Custom fonts can start from any ASCII character.

Returns
Starting character of the current font. :rvalue: integer

◆ get_font_total_char()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.get_font_total_char (   self)

The total number of characters in the current font.

Returns
Total number of characters :rvalue: integer

◆ get_font_type()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.get_font_type (   self)

Return the font type number of the current font.

Returns
Font type number. :rvalue: integer

◆ get_font_width()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.get_font_width (   self)

The width of the current font.

Returns
width of the font :rvalue: integer

◆ get_lcd_height()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.get_lcd_height (   self)

The height of the display in pixels.

Returns
height of the display :rvalue: integer

◆ get_lcd_width()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.get_lcd_width (   self)

The width of the display in pixels.

Returns
width of the display :rvalue: integer

◆ get_screenbuffer()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.get_screenbuffer (   self)

Return a pointer to the start of the RAM screen buffer for direct access.

Returns
integer array The internal screen buffer

◆ get_total_fonts()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.get_total_fonts (   self)

Return the total number of fonts loaded into the OLED's flash memory.

Returns
Total number of fonts available :rvalue: integer

◆ invert()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.invert (   self,
  inv 
)

Invert the display of the display.

The WHITE color of the display will turn to BLACK and the BLACK will turn to WHITE.

Parameters
invIf True, the screen is inverted. If False the screen is set to Normal mode.
Returns
No return value

◆ is_connected()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.is_connected (   self)

Determine if a SSD1306 OLED device is conntected to the system.

Returns
bool True if the device is connected, otherwise False.

◆ line()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.line (   self,
  x0,
  y0,
  x1,
  y1,
  color = None,
  mode = None 
)

Draw a line starting at and ending at specified coordinates, with a given color.

Pixel copy mode is either Normal (source copy) or XOR

Parameters
x0The X starting position for the line
y0The Y starting position for the line.
x1The X ending position for the line
y1The Y ending position for the line.
colorThe color to draw. If not set, the default foreground color is used.
modeThe mode to draw the pixl to the screen bufffer. Value can be either XOR or NORM. Default is NORM
Returns
No return value

◆ line_h()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.line_h (   self,
  x,
  y,
  width,
  color = None,
  mode = None 
)

Draw a horizontal line defined by a starting position and width.

A color can be specified. Pixel copy mode is either Normal (source copy) or XOR

Parameters
xThe X starting position for the line
yThe Y starting position for the line.
widthThe width (length) of the line
colorThe color to draw. If not set, the default foreground color is used.
modeThe mode to draw the pixl to the screen bufffer. Value can be either XOR or NORM. Default is NORM
Returns
No return value

◆ line_v()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.line_v (   self,
  x,
  y,
  height,
  color = None,
  mode = None 
)

Draw a vertical line defined by a starting position and width.

A color can be specified. Pixel copy mode is either Normal (source copy) or XOR

Parameters
xThe X starting position for the line
yThe Y starting position for the line.
heightThe height (length) of the line
colorThe color to draw. If not set, the default foreground color is used.
modeThe mode to draw the pixl to the screen bufffer. Value can be either XOR or NORM. Default is NORM
Returns
No return value

◆ pixel()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.pixel (   self,
  x,
  y,
  color = None,
  mode = None 
)

Draw a pixel at a given position, with a given color.

Pixel copy mode is either Normal (source copy) or XOR

Parameters
xThe X position on the display
yThe Y position on the display
colorThe color to draw. If not set, the default foreground color is used.
modeThe mode to draw the pixl to the screen bufffer. Value can be either XOR or NORM. Default is NORM
Returns
No return value

◆ print()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.print (   self,
  text 
)

Print a line of text on the display using the current font, starting at the current position.

Parameters
textThe line of text to write.
Returns
No return value

◆ rect()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.rect (   self,
  x,
  y,
  width,
  height,
  color = None,
  mode = None 
)

Draw a rectangle on the diplay.

A color can be specified. Pixel copy mode is either Normal (source copy) or XOR

Parameters
xThe X starting position for the rectangle
yThe Y starting position for the rectangle.
widthThe width of the rectangle
heightThe height of the rectangle
colorThe color to draw. If not set, the default foreground color is used.
modeThe mode to draw the pixl to the screen bufffer. Value can be either XOR or NORM. Default is NORM
Returns
No return value

◆ rect_fill()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.rect_fill (   self,
  x,
  y,
  width,
  height,
  color = None,
  mode = None 
)

Draw a filled rectangle on the diplay.

A color can be specified. Pixel copy mode is either Normal (source copy) or XOR

Parameters
xThe X starting position for the rectangle
yThe Y starting position for the rectangle.
widthThe width of the rectangle
heightThe height of the rectangle
colorThe color to draw. If not set, the default foreground color is used.
modeThe mode to draw the pixl to the screen bufffer. Value can be either XOR or NORM. Default is NORM
Returns
No return value

◆ scroll()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.scroll (   self,
  start,
  stop,
  scrollCommand = RIGHTHORIZONTALSCROLL,
  vertOffset = 0 
)

Set row start to row stop on the OLED to scroll.

Refer to http://learn.microview.io/intro/general-overview-of-microview.html for explanation of the rows.

Parameters
startThe staring position on the display
stopThe stopping position on the display
Returns
No return value

◆ scroll_left()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.scroll_left (   self,
  start,
  stop 
)

Set row start to row stop on the OLED to scroll right.

Refer to http://learn.microview.io/intro/general-overview-of-microview.html for explanation of the rows.

Parameters
startThe staring position on the display
stopThe stopping position on the display
Returns
No return value

◆ scroll_right()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.scroll_right (   self,
  start,
  stop 
)

Set row start to row stop on the OLED to scroll right.

Refer to http://learn.microview.io/intro/general-overview-of-microview.html for explanation of the rows.

Parameters
startThe staring position on the display
stopThe stopping position on the display
Returns
No return value

◆ scroll_stop()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.scroll_stop (   self)

Stop scrolling operation.

Returns
No return value

◆ scroll_vert_left()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.scroll_vert_left (   self,
  start,
  stop,
  vertOffset = 1 
)

Set row start to row stop on the OLED to scroll vertical right (Diagonally).

Refer to http://learn.microview.io/intro/general-overview-of-microview.html for explanation of the rows.

Parameters
startThe staring position on the display
stopThe stopping position on the display
vert_offsetThe vertical offset
Returns
No return value

◆ scroll_vert_right()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.scroll_vert_right (   self,
  start,
  stop,
  vertOffset = 1 
)

Set row start to row stop on the OLED to scroll vertical right (Diagonally).

Refer to http://learn.microview.io/intro/general-overview-of-microview.html for explanation of the rows.

Parameters
startThe staring position on the display
stopThe stopping position on the display
vert_offsetThe vertical offset
Returns
No return value

◆ set_color()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.set_color (   self,
  color 
)

Set the current draw's color.

Only WHITE and BLACK available.

Parameters
colorColor Value
Returns
No return value

◆ set_column_address()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.set_column_address (   self,
  colAddress 
)

Set SSD1306 column address.

Parameters
colAddressThe column address command and address
Returns
No return value

◆ set_cursor()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.set_cursor (   self,
  x,
  y 
)

Set the current cusor position for writing text.

Parameters
xThe X position on the display
yThe Y position on the display
Returns
No return value

◆ set_draw_modee()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.set_draw_modee (   self,
  mode 
)

Set current draw mode with NORM or XOR.

Parameters
modeDraw Mode
Returns
No return value

◆ set_font_type()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.set_font_type (   self,
  font_type 
)

Set the current font type number, ie changing to different fonts base on the type provided.

Parameters
typeThe type to set the font to.
Returns
No return value

◆ set_page_address()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.set_page_address (   self,
  pageAddress 
)

Set SSD1306 page address.

Parameters
pageAddressThe page address command and address
Returns
No return value

◆ write()

def qwiic_oled.qwiic_oled_base.QwiicOledBase.write (   self,
  c 
)

Write a character on the display using the current font, at the current position.

Parameters
cCharacter to write. A value of '\\n' starts a new line.
Returns
1 on success

Member Data Documentation

◆ address

qwiic_oled.qwiic_oled_base.QwiicOledBase.address

◆ ALL

int qwiic_oled.qwiic_oled_base.QwiicOledBase.ALL = 1
static

◆ available_addresses

qwiic_oled.qwiic_oled_base.QwiicOledBase.available_addresses = _AVAILABLE_I2C_ADDRESS
static

◆ BLACK

int qwiic_oled.qwiic_oled_base.QwiicOledBase.BLACK = 0
static

◆ cursorX

qwiic_oled.qwiic_oled_base.QwiicOledBase.cursorX

◆ cursorY

qwiic_oled.qwiic_oled_base.QwiicOledBase.cursorY

◆ device_name

qwiic_oled.qwiic_oled_base.QwiicOledBase.device_name = _DEFAULT_NAME
static

◆ drawMode

qwiic_oled.qwiic_oled_base.QwiicOledBase.drawMode

◆ fontType

qwiic_oled.qwiic_oled_base.QwiicOledBase.fontType

◆ foreColor

qwiic_oled.qwiic_oled_base.QwiicOledBase.foreColor

◆ LCDHEIGHT

qwiic_oled.qwiic_oled_base.QwiicOledBase.LCDHEIGHT

◆ LCDWIDTH

qwiic_oled.qwiic_oled_base.QwiicOledBase.LCDWIDTH

◆ nFonts

qwiic_oled.qwiic_oled_base.QwiicOledBase.nFonts

◆ NORM

int qwiic_oled.qwiic_oled_base.QwiicOledBase.NORM = 0
static

◆ PAGE

int qwiic_oled.qwiic_oled_base.QwiicOledBase.PAGE = 0
static

◆ WHITE

int qwiic_oled.qwiic_oled_base.QwiicOledBase.WHITE = 1
static

◆ XOR

int qwiic_oled.qwiic_oled_base.QwiicOledBase.XOR = 1
static

Property Documentation

◆ connected

qwiic_oled.qwiic_oled_base.QwiicOledBase.connected = property(is_connected)
static

◆ font_height

qwiic_oled.qwiic_oled_base.QwiicOledBase.font_height = property(get_font_height)
static

◆ font_type

qwiic_oled.qwiic_oled_base.QwiicOledBase.font_type = property(get_font_type, set_font_type)
static

◆ font_width

qwiic_oled.qwiic_oled_base.QwiicOledBase.font_width = property(get_font_width)
static

◆ height

qwiic_oled.qwiic_oled_base.QwiicOledBase.height = property(get_lcd_height)
static

◆ width

qwiic_oled.qwiic_oled_base.QwiicOledBase.width = property(get_lcd_width)
static

The documentation for this class was generated from the following file: