Class SelOLED

Graphical framework for small displays like SSD1306 I2C driven OLED display.

Methods

SelOLED:ColorsConst (name) Color transcodification
SelOLED:oled_type () "list" all known screens
SelOLED:Init (screen, i2c) Initialize a display
SelOLED:Close () Free all resources used for OLED
SelOLED:Display () refresh the screen
SelOLED:Refresh () refresh the screen
SelOLED:Clear () Clear the screen
SelOLED:SaveToPBM (file) Save the screen as a PBM
SelOLED:SetTextSize (size) Set the text size
SelOLED:SetTextColor (front, background) Set the text color
SelOLED:SetCursor (x, y) Set the text cursor position
SelOLED:Invert (inverted) Invert the screen
SelOLED:Flip (flipped) Flip the screen upside-down
SelOLED:OnOff (power) Turn the screen On or Off
SelOLED:DrawPixel (x, y, color) Draw a pixel
SelOLED:Pset (x, y, color) Draw a pixel
SelOLED:GetPixel (x, y) Get a pixel value
SelOLED:Point (x, y) Get a pixel value
SelOLED:DrawLine (top_x, top_y, bot_x, bot_y, color, pattern) Draw a line
SelOLED:Line (top_x, top_y, bot_x, bot_y, color, pattern) Draw a line
SelOLED:DrawRect (top_x, top_y, width, height, color, pattern) Draw a rectangle
SelOLED:Box (top_x, top_y, width, height, color, pattern) Draw a rectangle
SelOLED:FillRect (top_x, top_y, width, height, color, pattern) Draw a filled rectangle
SelOLED:BoxF (top_x, top_y, width, height, color, pattern) Draw a filled rectangle
SelOLED:DrawRoundRect (top_x, top_y, width, height, radius, color, pattern) Draw a rounded rectangle
SelOLED:BoxR (top_x, top_y, width, height, radius, color, pattern) Draw a rounded rectangle
SelOLED:FillRoundRect (top_x, top_y, width, height, radius, color, pattern) Draw a rounded filled rectangle
SelOLED:BoxRF (top_x, top_y, width, height, radius, color, pattern) Draw a rounded filled rectangle
SelOLED:DrawCircle (x, y, radius, color, pattern) Draw a circle
SelOLED:Circle (x, y, radius, color, pattern) Draw a circle
SelOLED:FillCircle (x, y, radius, color, pattern) Draw a filled circle
SelOLED:CircleF (x, y, radius, color, pattern) Draw a filled circle
SelOLED:DrawTriangle (x0, y0, x1, y1, x2, y2, color, pattern) Draw a triangle
SelOLED:Triangle (x0, y0, x1, y1, x2, y2, color, pattern) Draw a triangle
SelOLED:FillCircle (x0, y0, x1, y1, x2, y2, color, pattern) Draw a filled triangle
SelOLED:TriangleF (x0, y0, x1, y1, x2, y2, color, pattern) Draw a filled triangle
SelOLED:DrawVerticalBargraph (top_x, top_y, width, hight, percent, color) Draw a vertical bar
SelOLED:VerticalGauge (top_x, top_y, width, hight, percent, color) Draw a vertical bar
SelOLED:DrawHorizontalBargraph (top_x, top_y, width, hight, percent, color) Draw a horizontal bar
SelOLED:HorizontalGauge (top_x, top_y, width, hight, percent, color) Draw a horizontal bar
SelOLED:Print (message) Print a message to the screen
SelOLED:Width () Return the width of the screen
SelOLED:Height () Return the height of the screen


Methods

SelOLED:ColorsConst (name)
Color transcodification

Parameters:

  • name string color name in CAPITAL

Returns:

    number numeric value
SelOLED:oled_type ()
"list" all known screens

Returns:

  1. string Type
  2. string ...
SelOLED:Init (screen, i2c)
Initialize a display

Parameters:

  • screen integer ID
  • i2c string device

Returns:

    boolean does the initialisation succeeded ?
SelOLED:Close ()
Free all resources used for OLED
SelOLED:Display ()
refresh the screen
SelOLED:Refresh ()
refresh the screen
SelOLED:Clear ()
Clear the screen
SelOLED:SaveToPBM (file)
Save the screen as a PBM

Parameters:

Returns:

    boolean does it succeeded ?

Usage:

    SelOLED.SaveToPBM("/tmp/tst.pbm")
SelOLED:SetTextSize (size)
Set the text size

Parameters:

  • size integer size of letters
SelOLED:SetTextColor (front, background)
Set the text color

Parameters:

  • front
  • background (optional)
SelOLED:SetCursor (x, y)
Set the text cursor position

Parameters:

  • x integer
  • y integer
SelOLED:Invert (inverted)
Invert the screen

Parameters:

  • inverted boolean is screen inverted ?
SelOLED:Flip (flipped)
Flip the screen upside-down

Parameters:

  • flipped boolean is screen flipped ?
SelOLED:OnOff (power)
Turn the screen On or Off

Parameters:

  • power boolean
SelOLED:DrawPixel (x, y, color)
Draw a pixel

Parameters:

  • x integer
  • y integer
  • color integer or nil
SelOLED:Pset (x, y, color)
Draw a pixel

Parameters:

  • x integer
  • y integer
  • color integer or nil
SelOLED:GetPixel (x, y)
Get a pixel value

Parameters:

  • x integer
  • y integer

Returns:

    integer the pixel value
SelOLED:Point (x, y)
Get a pixel value

Parameters:

  • x integer
  • y integer

Returns:

    integer the pixel value
SelOLED:DrawLine (top_x, top_y, bot_x, bot_y, color, pattern)
Draw a line

Parameters:

  • top_x integer left upper x
  • top_y integer left upper y
  • bot_x integer bottom right x
  • bot_y integer bottom right y
  • color integer or nil
  • pattern integer or nil
SelOLED:Line (top_x, top_y, bot_x, bot_y, color, pattern)
Draw a line

Parameters:

  • top_x integer left upper x
  • top_y integer left upper y
  • bot_x integer bottom right x
  • bot_y integer bottom right y
  • color integer or nil
  • pattern integer or nil
SelOLED:DrawRect (top_x, top_y, width, height, color, pattern)
Draw a rectangle

Parameters:

  • top_x integer left upper x
  • top_y integer left upper y
  • width integer
  • height integer
  • color integer or nil
  • pattern integer or nil
SelOLED:Box (top_x, top_y, width, height, color, pattern)
Draw a rectangle

Parameters:

  • top_x integer left upper x
  • top_y integer left upper y
  • width integer
  • height integer
  • color integer or nil
  • pattern integer or nil
SelOLED:FillRect (top_x, top_y, width, height, color, pattern)
Draw a filled rectangle

Parameters:

  • top_x integer left upper x
  • top_y integer left upper y
  • width integer
  • height integer
  • color integer or nil
  • pattern integer or nil
SelOLED:BoxF (top_x, top_y, width, height, color, pattern)
Draw a filled rectangle

Parameters:

  • top_x integer left upper x
  • top_y integer left upper y
  • width integer
  • height integer
  • color integer or nil
  • pattern integer or nil
SelOLED:DrawRoundRect (top_x, top_y, width, height, radius, color, pattern)
Draw a rounded rectangle

Parameters:

  • top_x integer left upper x
  • top_y integer left upper y
  • width integer
  • height integer
  • radius integer
  • color integer or nil
  • pattern integer or nil
SelOLED:BoxR (top_x, top_y, width, height, radius, color, pattern)
Draw a rounded rectangle

Parameters:

  • top_x integer left upper x
  • top_y integer left upper y
  • width integer
  • height integer
  • radius integer
  • color integer or nil
  • pattern integer or nil
SelOLED:FillRoundRect (top_x, top_y, width, height, radius, color, pattern)
Draw a rounded filled rectangle

Parameters:

  • top_x integer left upper x
  • top_y integer left upper y
  • width integer
  • height integer
  • radius integer
  • color integer or nil
  • pattern integer or nil
SelOLED:BoxRF (top_x, top_y, width, height, radius, color, pattern)
Draw a rounded filled rectangle

Parameters:

  • top_x integer left upper x
  • top_y integer left upper y
  • width integer
  • height integer
  • radius integer
  • color integer or nil
  • pattern integer or nil
SelOLED:DrawCircle (x, y, radius, color, pattern)
Draw a circle

Parameters:

  • x integer center x
  • y integer center y
  • radius integer
  • color integer or nil
  • pattern integer or nil
SelOLED:Circle (x, y, radius, color, pattern)
Draw a circle

Parameters:

  • x integer center x
  • y integer center y
  • radius integer
  • color integer or nil
  • pattern integer or nil
SelOLED:FillCircle (x, y, radius, color, pattern)
Draw a filled circle

Parameters:

  • x integer center x
  • y integer center y
  • radius integer
  • color integer or nil
  • pattern integer or nil
SelOLED:CircleF (x, y, radius, color, pattern)
Draw a filled circle

Parameters:

  • x integer center x
  • y integer center y
  • radius integer
  • color integer or nil
  • pattern integer or nil
SelOLED:DrawTriangle (x0, y0, x1, y1, x2, y2, color, pattern)
Draw a triangle

Parameters:

  • x0 integer
  • y0 integer
  • x1 integer
  • y1 integer
  • x2 integer
  • y2 integer
  • color integer or nil
  • pattern integer or nil
SelOLED:Triangle (x0, y0, x1, y1, x2, y2, color, pattern)
Draw a triangle

Parameters:

  • x0 integer
  • y0 integer
  • x1 integer
  • y1 integer
  • x2 integer
  • y2 integer
  • color integer or nil
  • pattern integer or nil
SelOLED:FillCircle (x0, y0, x1, y1, x2, y2, color, pattern)
Draw a filled triangle

Parameters:

  • x0 integer
  • y0 integer
  • x1 integer
  • y1 integer
  • x2 integer
  • y2 integer
  • color integer or nil
  • pattern integer or nil
SelOLED:TriangleF (x0, y0, x1, y1, x2, y2, color, pattern)
Draw a filled triangle

Parameters:

  • x0 integer
  • y0 integer
  • x1 integer
  • y1 integer
  • x2 integer
  • y2 integer
  • color integer or nil
  • pattern integer or nil
SelOLED:DrawVerticalBargraph (top_x, top_y, width, hight, percent, color)
Draw a vertical bar

Parameters:

  • top_x integer top left
  • top_y integer top left
  • width integer
  • hight integer
  • percent integer fuel value
  • color integer or nil
SelOLED:VerticalGauge (top_x, top_y, width, hight, percent, color)
Draw a vertical bar

Parameters:

  • top_x integer top left
  • top_y integer top left
  • width integer
  • hight integer
  • percent integer fuel value
  • color integer or nil
SelOLED:DrawHorizontalBargraph (top_x, top_y, width, hight, percent, color)
Draw a horizontal bar

Parameters:

  • top_x integer top left
  • top_y integer top left
  • width integer
  • hight integer
  • percent integer fuel value
  • color integer or nil
SelOLED:HorizontalGauge (top_x, top_y, width, hight, percent, color)
Draw a horizontal bar

Parameters:

  • top_x integer top left
  • top_y integer top left
  • width integer
  • hight integer
  • percent integer fuel value
  • color integer or nil
SelOLED:Print (message)
Print a message to the screen

Parameters:

SelOLED:Width ()
Return the width of the screen

Returns:

    integer width
SelOLED:Height ()
Return the height of the screen

Returns:

    integer height
generated by LDoc 1.4.6 Last updated 2022-09-05 22:24:51