![]() |
Qwiic_OLED_Base_Py
2.0.0-4-gbc1cda2
Python for SFE Qwiic OLED
|
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) | |
address | The I2C address to use for the device. If not provided, the default address is used. |
i2c_driver | An existing i2c driver object. If not provided a driver object is created. |
def qwiic_oled.qwiic_oled_base.QwiicOledBase.__init__ | ( | self, | |
address = None , |
|||
pixel_width = _LCDWIDTH , |
|||
pixel_height = _LCDHEIGHT , |
|||
i2c_driver = None |
|||
) |
def qwiic_oled.qwiic_oled_base.QwiicOledBase.begin | ( | self | ) |
Initialize the operation of the SSD1306 display driver for the OLED module.
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
x0 | The X center position for the circle |
y0 | The Y center position for the circle. |
radius | The radius of the circle |
color | The color to draw. If not set, the default foreground color is used. |
mode | The mode to draw the pixl to the screen bufffer. Value can be either XOR or NORM. Default is NORM |
def qwiic_oled.qwiic_oled_base.QwiicOledBase.clear | ( | self, | |
mode, | |||
value = 0 |
|||
) |
Clear the display on the OLED Device.
mode | To clear GDRAM inside the LCD controller, pass in the variable mode = ALL, and to clear screen page buffer pass in the variable mode = PAGE. |
value | The value to clear the screen to. Default value is 0 |
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.
contrast | Contrast Value between 0-255 |
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.
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.
bitArray | The bitmap to draw |
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
x | The X position on the display |
y | The Y position on the display |
c | The character to draw |
color | The color to draw. If not set, the default foreground color is used. |
mode | The mode to draw the pixl to the screen bufffer. Value can be either XOR or NORM. Default is NORM |
def qwiic_oled.qwiic_oled_base.QwiicOledBase.flip_horizontal | ( | self, | |
flip | |||
) |
Flip the graphics on the OLED horizontally.
def qwiic_oled.qwiic_oled_base.QwiicOledBase.flip_vertical | ( | self, | |
flip | |||
) |
Flip the graphics on the OLED vertically.
def qwiic_oled.qwiic_oled_base.QwiicOledBase.get_font_height | ( | self | ) |
The height of the current font.
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.
def qwiic_oled.qwiic_oled_base.QwiicOledBase.get_font_total_char | ( | self | ) |
The total number of characters in the current font.
def qwiic_oled.qwiic_oled_base.QwiicOledBase.get_font_type | ( | self | ) |
Return the font type number of the current font.
def qwiic_oled.qwiic_oled_base.QwiicOledBase.get_font_width | ( | self | ) |
The width of the current font.
def qwiic_oled.qwiic_oled_base.QwiicOledBase.get_lcd_height | ( | self | ) |
The height of the display in pixels.
def qwiic_oled.qwiic_oled_base.QwiicOledBase.get_lcd_width | ( | self | ) |
The width of the display in pixels.
def qwiic_oled.qwiic_oled_base.QwiicOledBase.get_screenbuffer | ( | self | ) |
Return a pointer to the start of the RAM screen buffer for direct access.
def qwiic_oled.qwiic_oled_base.QwiicOledBase.get_total_fonts | ( | self | ) |
Return the total number of fonts loaded into the OLED's flash memory.
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.
inv | If True, the screen is inverted. If False the screen is set to Normal mode. |
def qwiic_oled.qwiic_oled_base.QwiicOledBase.is_connected | ( | self | ) |
Determine if a SSD1306 OLED device is conntected to the system.
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
x0 | The X starting position for the line |
y0 | The Y starting position for the line. |
x1 | The X ending position for the line |
y1 | The Y ending position for the line. |
color | The color to draw. If not set, the default foreground color is used. |
mode | The mode to draw the pixl to the screen bufffer. Value can be either XOR or NORM. Default is NORM |
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
x | The X starting position for the line |
y | The Y starting position for the line. |
width | The width (length) of the line |
color | The color to draw. If not set, the default foreground color is used. |
mode | The mode to draw the pixl to the screen bufffer. Value can be either XOR or NORM. Default is NORM |
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
x | The X starting position for the line |
y | The Y starting position for the line. |
height | The height (length) of the line |
color | The color to draw. If not set, the default foreground color is used. |
mode | The mode to draw the pixl to the screen bufffer. Value can be either XOR or NORM. Default is NORM |
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
x | The X position on the display |
y | The Y position on the display |
color | The color to draw. If not set, the default foreground color is used. |
mode | The mode to draw the pixl to the screen bufffer. Value can be either XOR or NORM. Default is NORM |
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.
text | The line of text to write. |
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
x | The X starting position for the rectangle |
y | The Y starting position for the rectangle. |
width | The width of the rectangle |
height | The height of the rectangle |
color | The color to draw. If not set, the default foreground color is used. |
mode | The mode to draw the pixl to the screen bufffer. Value can be either XOR or NORM. Default is NORM |
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
x | The X starting position for the rectangle |
y | The Y starting position for the rectangle. |
width | The width of the rectangle |
height | The height of the rectangle |
color | The color to draw. If not set, the default foreground color is used. |
mode | The mode to draw the pixl to the screen bufffer. Value can be either XOR or NORM. Default is NORM |
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.
start | The staring position on the display |
stop | The stopping position on the display |
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.
start | The staring position on the display |
stop | The stopping position on the display |
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.
start | The staring position on the display |
stop | The stopping position on the display |
def qwiic_oled.qwiic_oled_base.QwiicOledBase.scroll_stop | ( | self | ) |
Stop scrolling operation.
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.
start | The staring position on the display |
stop | The stopping position on the display |
vert_offset | The vertical offset |
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.
start | The staring position on the display |
stop | The stopping position on the display |
vert_offset | The vertical offset |
def qwiic_oled.qwiic_oled_base.QwiicOledBase.set_color | ( | self, | |
color | |||
) |
Set the current draw's color.
Only WHITE and BLACK available.
color | Color Value |
def qwiic_oled.qwiic_oled_base.QwiicOledBase.set_column_address | ( | self, | |
colAddress | |||
) |
Set SSD1306 column address.
colAddress | The column address command and address |
def qwiic_oled.qwiic_oled_base.QwiicOledBase.set_cursor | ( | self, | |
x, | |||
y | |||
) |
Set the current cusor position for writing text.
x | The X position on the display |
y | The Y position on the display |
def qwiic_oled.qwiic_oled_base.QwiicOledBase.set_draw_modee | ( | self, | |
mode | |||
) |
Set current draw mode with NORM or XOR.
mode | Draw Mode |
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.
type | The type to set the font to. |
def qwiic_oled.qwiic_oled_base.QwiicOledBase.set_page_address | ( | self, | |
pageAddress | |||
) |
Set SSD1306 page address.
pageAddress | The page address command and address |
def qwiic_oled.qwiic_oled_base.QwiicOledBase.write | ( | self, | |
c | |||
) |
Write a character on the display using the current font, at the current position.
c | Character to write. A value of '\\n' starts a new line. |
qwiic_oled.qwiic_oled_base.QwiicOledBase.address |
|
static |
|
static |
|
static |
qwiic_oled.qwiic_oled_base.QwiicOledBase.cursorX |
qwiic_oled.qwiic_oled_base.QwiicOledBase.cursorY |
|
static |
qwiic_oled.qwiic_oled_base.QwiicOledBase.drawMode |
qwiic_oled.qwiic_oled_base.QwiicOledBase.fontType |
qwiic_oled.qwiic_oled_base.QwiicOledBase.foreColor |
qwiic_oled.qwiic_oled_base.QwiicOledBase.LCDHEIGHT |
qwiic_oled.qwiic_oled_base.QwiicOledBase.LCDWIDTH |
qwiic_oled.qwiic_oled_base.QwiicOledBase.nFonts |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |