B4J Programming Press on the image to return to the main documentation page.

rESP8266FastSSD1331

Written by Massimo Meli

List of types:

Color565
ESP8266FastSSD1331
ImageClip
MeterBar

Color565


Events:

None

Members:


  BLACK As UInt

  BLUE As UInt

  BLUEVIOLET As UInt

  BROWN As UInt

  CYAN As UInt

  DARKBLUE As UInt

  DARKCYAN As UInt

  DARKGRAY As UInt

  DARKGREEN As UInt

  DARKRED As UInt

  DARKYELLOW As UInt

  DODGERBLUE As UInt

  GRAY As UInt

  GREEN As UInt

  LIGHTGRAY As UInt

  LIGHTORANGE As UInt

  MAGENTA As UInt

  NAVY As UInt

  ORANGE As UInt

  PINK As UInt

  PURPLE As UInt

  RED As UInt

  RGB (R As Byte, G As Byte, B As Byte) As UInt

  ROYALBLUE As UInt

  SALMON As UInt

  SKYBLUE As UInt

  TEAL As UInt

  TOMATO As UInt

  VIOLET As UInt

  WHITE As UInt

  YELLOW As UInt

Members description:

BLACK As UInt
BLUE As UInt
BLUEVIOLET As UInt
BROWN As UInt
CYAN As UInt
DARKBLUE As UInt
DARKCYAN As UInt
DARKGRAY As UInt
DARKGREEN As UInt
DARKRED As UInt
DARKYELLOW As UInt
DODGERBLUE As UInt
GRAY As UInt
GREEN As UInt
LIGHTGRAY As UInt
LIGHTORANGE As UInt
MAGENTA As UInt
NAVY As UInt
ORANGE As UInt
PINK As UInt
PURPLE As UInt
RED As UInt
RGB (R As Byte, G As Byte, B As Byte) As UInt
Returns 16bit 5:6:5 color from 24bit 8:8:8 color.
ROYALBLUE As UInt
SALMON As UInt
SKYBLUE As UInt
TEAL As UInt
TOMATO As UInt
VIOLET As UInt
WHITE As UInt
YELLOW As UInt

ESP8266FastSSD1331


Events:

None

Members:


  BMP_ALARM_8x8() As Byte

  BMP_BATTERY_8x16() As Byte

  BMP_BLUETOOTH_8x8() As Byte

  BMP_GPRS_8x8() As Byte

  BMP_MESSAGE_8x16() As Byte

  BMP_SIGNAL_8x16() As Byte

  BMP_SUN_40x16() As Byte

  BufferSize As UInt [write only]

  ClearWindow (X0 As Byte, Y0 As Byte, X1 As Byte, Y1 As Byte) As void

  Cls As void

  ClsColor (Color As UInt) As void

  CopyWindow (X0 As Byte, Y0 As Byte, X1 As Byte, Y1 As Byte, X2 As Byte, Y2 As Byte) As void

  DEFAULT_BUFFER_SIZE As ULong

  DEFAULT_DELAY_FILL As ULong

  DEFAULT_DELAY_LINE As ULong

  DimWindow (X0 As Byte, Y0 As Byte, X1 As Byte, Y1 As Byte) As void

  DrawAnimationBitmap (FileName As String, StartFrame As ULong, EndFrame As ULong, X As Byte, Y As Byte, Delay As ULong) As void

  DrawBitmap (FileName As String, X As Byte, Y As Byte) As void

  DrawChar (X As Byte, Y As Byte, Chr As Byte, Size As Byte, Color As UInt) As void

  DrawChar1616 (X As Byte, Y As Byte, Char As Byte, Color As UInt) As void

  DrawChar3216 (X As Byte, Y As Byte, Char As Byte, Color As UInt) As void

  DrawCircle (X As Byte, Y As Byte, Radius As Byte, Color As UInt) As void

  DrawDigitalNumber3250 (X As Byte, Y As Byte, Char As Byte, Color As UInt) As void

  DrawLine (X0 As Byte, Y0 As Byte, X1 As Byte, Y1 As Byte, Color As UInt) As void

  DrawLineTo (X As Byte, Y As Byte, Color As UInt) As void

  DrawNumber (X As Byte, Y As Byte, Num As uint32_t, Len As Byte, FontSize As Byte, Color As UInt) As void

  DrawPixel (X As Byte, Y As Byte, Color As UInt) As void

  DrawRect (X As Byte, Y As Byte, Width As Byte, Height As Byte, Color As UInt) As void

  DrawRoundRect (X As Byte, Y As Byte, Width As Byte, Height As Byte, Radius As Byte, Color As UInt) As void

  DrawText (X As Byte, Y As Byte, Text As String, Size As Byte, Color As UInt) As void

  DrawTriangle (X0 As Byte, Y0 As Byte, X1 As Byte, Y1 As Byte, X2 As Byte, Y2 As Byte, Color As UInt) As void

  FillCircle (X As Byte, Y As Byte, Radius As Byte, Color As UInt) As void

  FillDelay As UInt [write only]

  FillRect (X As Byte, Y As Byte, Width As Byte, Height As Byte, FillColor As UInt, BorderColor As UInt) As void

  FillRoundRect (X As Byte, Y As Byte, Width As Byte, Height As Byte, Radius As Byte, Color As UInt) As void

  FillTriangle (X0 As Byte, Y0 As Byte, X1 As Byte, Y1 As Byte, X2 As Byte, Y2 As Byte, Color As UInt) As void

  FONT_1206 As Byte

  FONT_1608 As Byte

  Height As Byte [read only]

  Initialize (CS As Byte, DC As Byte, Freq As ULong) As void

  Initialize1 (CS As Byte, DC As Byte, RST As Byte, Freq As ULong) As void

  Initialize2 (CS As Byte, DC As Byte, MOSI As Byte, CLK As Byte, RST As Byte) As void

  int (percent As Float) As unsigned

  LineDelay As UInt [write only]

  MapFloat (X As Float, inMin As Float, inMax As Float, outMin As Float, outMax As Float) As Float

  Off As void

  Offset (Offset As Byte) As void

  On As void

  ORIENT_LANDSCAPE As Byte

  ORIENT_PORTRAIT As Byte

  ORIENT_REVERSE_LANDSCAPE As Byte

  ORIENT_REVERSE_PORTRAIT As Byte

  Orientation As Byte

  PercentXfloat (percent As Float) As Float

  PercentYfloat (percent As Float) As Float

  PushColor (Color As UInt) As void

  SetContrast (A As Byte, B As Byte, C As Byte) As void

  SetMasterCurrent (Current As Byte) As void

  SetupScroll (fromRow As Byte, numRows As Byte, hStep As Byte, vStep As Byte, invertX As Boolean, invertY As Boolean, time As Byte) As Boolean

  SLIDE_HORIZONTAL As Byte

  SLIDE_VERTICAL As Byte

  SlideBitmap (FileName As String, Mode As Byte, Step As Byte, Delay As UInt) As void

  SlidePageLeft (Step As Byte, FillColor As UInt, BorderColor As UInt, Delay As UInt) As void

  SlidePageRight (Step As Byte, FillColor As UInt, BorderColor As UInt, Delay As UInt) As void

  SPI_FULL_SPEED As ULong

  SPI_QUARTER_SPEED As ULong

  SPI_SPI_HALF_SPEED As ULong

  StartScroll As void

  StopScroll As void

  TextWrap As Boolean [write only]

  Width As Byte [read only]

Members description:

BMP_ALARM_8x8() As Byte
BMP_BATTERY_8x16() As Byte
BMP_BLUETOOTH_8x8() As Byte
BMP_GPRS_8x8() As Byte
BMP_MESSAGE_8x16() As Byte
BMP_SIGNAL_8x16() As Byte
BMP_SUN_40x16() As Byte
BufferSize As UInt [write only]
Sets internal library read image buffer size for Flash or SD.
The library use default buffer size of 86 bytes, but you can experiment this on your hardware.

Use this with caution! Can increase or decrease framerate!

Use this command to set back default library buffer size:
Oled.BufferSize = DEFAULT_BUFFER_SIZE
ClearWindow (X0 As Byte, Y0 As Byte, X1 As Byte, Y1 As Byte) As void
This command sets the window area specify by starting point (X1,Y1) and the ending point (X2,Y2) to clear the window display.
The graphic display data RAM content of the specified window area will be set to zero.
This command can be combined with CopyWindow command to make as a "move" result.

The following example illustrates the copy plus clear procedure and results in moving the window object:

Oled.CopyWindow(0, 0, 5, 5, 6, 6)
Oled.ClearWindow(0, 0, 5, 5)
Cls As void
Clears the display with BLACK color.
ClsColor (Color As UInt) As void
Clears the display with the given color.
CopyWindow (X0 As Byte, Y0 As Byte, X1 As Byte, Y1 As Byte, X2 As Byte, Y2 As Byte) As void
Copy the rectangular region defined by the starting point (X0,Y0) and the ending point (X1,Y1) to location (X2,Y2).

If the new coordinates are smaller than the ending points, the new image will overlap the original one.
DEFAULT_BUFFER_SIZE As ULong
DEFAULT_DELAY_FILL As ULong
DEFAULT_DELAY_LINE As ULong
DimWindow (X0 As Byte, Y0 As Byte, X1 As Byte, Y1 As Byte) As void
This command will dim the window area specify by starting point (X1,Y1) and the ending point (X2,Y2).

After the execution of this command, the selected window area will become darker.
Additional execution of this command over the same window area will not change the data content.
DrawAnimationBitmap (FileName As String, StartFrame As ULong, EndFrame As ULong, X As Byte, Y As Byte, Delay As ULong) As void
Plays a videoclip animation based on sequential Bitmaps images, to use this you need to put images on Flash or SD.

The images name must be max 31 characters (use short names if possible), all sequential images must start as same
name and finish with a sequential number.

Some examples:

frame1.bmp, frame2.bmp, frame3.bmp, frame4.bmp etc...
MotorAnimation1.bmp, MotorAnimation2.bmp, MotorAnimation3.bmp, MotorAnimation4.bmp etc...
Pacman1.bmp, Pacman2.bmp, Pacman3.bmp, Pacman4.bmp etc...

NOTE: This command only show sequential frames from low to high index number, if you need more control on videoclip
please use ImageClip Class, with this class you can set any order of frame, eg. you can play frame 1, frame 10,
frame 20 or in any order you want, even play a videoclip from end to start.

FileName: bitmap file name without .bmp extension
StartFrame: initial frame
EndFrame: final frame
X: the X position of image (upperleft corner)
Y: the Y position of image (upperleft corner)
Delay: delay between consecutive animation frames
DrawBitmap (FileName As String, X As Byte, Y As Byte) As void
Draw a bitmap at the given position.
DrawChar (X As Byte, Y As Byte, Chr As Byte, Size As Byte, Color As UInt) As void
Displays one character at specified position.

X: the X position
Y: the Y position
Chr: the character to display
Size: the size, can be one of font size costant FONT_1206, FONT_1608
Color: the color
DrawChar1616 (X As Byte, Y As Byte, Char As Byte, Color As UInt) As void
Draw a big single char 16x16 pixels at the specified position.
DrawChar3216 (X As Byte, Y As Byte, Char As Byte, Color As UInt) As void
Draw a big single char 32x16 pixels at the specified position.
DrawCircle (X As Byte, Y As Byte, Radius As Byte, Color As UInt) As void
Draw a circle.
DrawDigitalNumber3250 (X As Byte, Y As Byte, Char As Byte, Color As UInt) As void
Draw a big single Seven Segment digital number 32x50 pixels at the specified position.
DrawLine (X0 As Byte, Y0 As Byte, X1 As Byte, Y1 As Byte, Color As UInt) As void
Draw a line with the given color from X0,Y0 to X1,Y1.
DrawLineTo (X As Byte, Y As Byte, Color As UInt) As void
Draw a line with the given color from current position to X,Y position.
DrawNumber (X As Byte, Y As Byte, Num As uint32_t, Len As Byte, FontSize As Byte, Color As UInt) As void
Displays one number at the specified position.
DrawPixel (X As Byte, Y As Byte, Color As UInt) As void
Draw a single pixel with the given color at X,Y position.
DrawRect (X As Byte, Y As Byte, Width As Byte, Height As Byte, Color As UInt) As void
Draw a rectangle.
DrawRoundRect (X As Byte, Y As Byte, Width As Byte, Height As Byte, Radius As Byte, Color As UInt) As void
Draw a round rectangle.
DrawText (X As Byte, Y As Byte, Text As String, Size As Byte, Color As UInt) As void
Displays text string at the specified position.
DrawTriangle (X0 As Byte, Y0 As Byte, X1 As Byte, Y1 As Byte, X2 As Byte, Y2 As Byte, Color As UInt) As void
Draw a triangle.
FillCircle (X As Byte, Y As Byte, Radius As Byte, Color As UInt) As void
Draw a filled circle.
FillDelay As UInt [write only]
Sets the delay (microseconds) that library add after every fill operation.

This command affects future FillRect and Cls commands and allow time to oled draw the filled area.
By default the library uses default value. Use it with caution!
FillRect (X As Byte, Y As Byte, Width As Byte, Height As Byte, FillColor As UInt, BorderColor As UInt) As void
Draw a filled rectangle with the given Fill and Border colors.
FillRoundRect (X As Byte, Y As Byte, Width As Byte, Height As Byte, Radius As Byte, Color As UInt) As void
Draw a filled round rectangle.
FillTriangle (X0 As Byte, Y0 As Byte, X1 As Byte, Y1 As Byte, X2 As Byte, Y2 As Byte, Color As UInt) As void
Draw a filled triangle.
FONT_1206 As Byte
FONT_1608 As Byte
Height As Byte [read only]
Gets the display Height, this can be 96 or 64 pixels based on display orientation.
Initialize (CS As Byte, DC As Byte, Freq As ULong) As void
Initializes the display, sets CS and DC pins, use hardware HSPI for MOSI (GPIO13) and CLK (GPIO14),
don't use RST pin.

IMPORTANT: Oled RST Pin must be connected to VCC.

Parameters:

CS Hardware SPI ChipSelect Can be (HCS-GPIO15) or any free Pin
DC: Data-Command Can be any free Pin
Freq: Hardware SPI Bus Clock Frequency, by default 1Mhz = 1 000 000 = One million Herts.
You can increase up 80 000 000 (80Mhz) but short wires must be used for HSPI bus,
then it is best to use Hardware CS Pin. Pay attention High frequency clocks do not works
on breadboards, tested on NodeMCU up 60 000 000 (60Mhz) and works with short wires on
breadboard, but probably is not real clock frequency because the Oled do not support it.
Values up 80 000 000 will be truncated from ESP8266 Arduino Core.

Others HSPI Connections:

HMOSI - GPIO13 Hardware SPI MasterOutSerialIn
HSCLK - GPIO14 Hardware SPI Clock
Initialize1 (CS As Byte, DC As Byte, RST As Byte, Freq As ULong) As void
Initializes the display, sets CS, DC and RST pins, use hardware HSPI for MOSI (GPIO13), CLK (GPIO14).

Parameters:

CS Hardware SPI ChipSelect Can be (HCS-GPIO15) or any free Pin
DC: Data-Command Can be any free Pin
RST: Reset Can be any free Pin Resets oled on start by going to GND an then back to VCC,
you can connect to ESP8266 RST Pin and Reset both at same time)
Freq: Hardware SPI Bus Clock Frequency, by default 1Mhz = 1 000 000 = One million Herts.
You can increase up 80 000 000 (80Mhz) but short wires must be used for HSPI bus,
then it is best to use hardware CS Pin. Pay attention High frequency clocks do not works
on breadboards, tested on NodeMCU up 60 000 000 (60Mhz) and works with short wires on
breadboard, but probably is not real clock frequency because the Oled do not support it.
Values up 80 000 000 will be truncated from ESP8266 Arduino Core.

HSPI Connections:

HMOSI - GPIO13 Hardware SPI MasterOutSerialIn
HSCLK - GPIO14 Hardware SPI Clock
Initialize2 (CS As Byte, DC As Byte, MOSI As Byte, CLK As Byte, RST As Byte) As void
Initializes the display, sets CS, DC, MOSI, CLK and RST pins (pass 0 to RST will ignore RST pin).

NOTE: This method initializes Software SPI, you can decide any frre Pin, but can be slower than Hardware SPI.

IMPORTANT: If you pass 0 to RST, Oled RST Pin MUST be connected to VCC.

Parameters:

CS Hardware SPI ChipSelect Can be (HCS-GPIO15) or any free Pin
DC: Data-Command Can be any free Pin
MOSI: MasterOutSerialIn Can be any free Pin
CLK: MasterClock Can be any free Pin
RST: Reset Can be any free Pin Resets oled on start by going to GND an then back to VCC,
you can connect to ESP8266 RST Pin and Reset both at same time)

HSPI Connections:

No Hardware SPI connections.
int (percent As Float) As unsigned
Returns a percentage of screen height.
LineDelay As UInt [write only]
Sets the delay (microseconds) that library add after every single line paint.

This command affects future drawLine, drawLineTo and drawTriangle commands and allow time to oled draw the lines.
By default the library uses default value. Use it with caution!
MapFloat (X As Float, inMin As Float, inMax As Float, outMin As Float, outMax As Float) As Float
Map one number to a range, this returns a real Float value, not like Arduino map command.
Off As void
Switch Off the display.
Offset (Offset As Byte) As void
Sets the display offset.
On As void
Switch On the display. (by default display is On from initialization)
ORIENT_LANDSCAPE As Byte
ORIENT_PORTRAIT As Byte
ORIENT_REVERSE_LANDSCAPE As Byte
ORIENT_REVERSE_PORTRAIT As Byte
Orientation As Byte
Sets or gets the display orientation.

Sets or returns a costant Byte value as one of screen orientation costants:

0 == ORIENT_LANDSCAPE
1 == ORIENT_PORTRAIT
2 == ORIENT_REVERSE_LANDSCAPE
3 == ORIENT_REVERSE_PORTRAIT
PercentXfloat (percent As Float) As Float
Returns a percentage of screen width as Float value.
PercentYfloat (percent As Float) As Float
Returns a percentage of screen height as Float value.
PushColor (Color As UInt) As void
Push a pixel with the given color inside display controller ram (this is fast and hardware optimized).
SetContrast (A As Byte, B As Byte, C As Byte) As void
Sets the display contrast for A,B and C channels, respectively R, G and B.

A, B and C: can be 8bit values from 0 to 255.
SetMasterCurrent (Current As Byte) As void
Sets the display master current.

Current: can be 4bit value from 0 to 15.
SetupScroll (fromRow As Byte, numRows As Byte, hStep As Byte, vStep As Byte, invertX As Boolean, invertY As Boolean, time As Byte) As Boolean
Setup a screen scroll.

You need to setup scroll before use it.
NOTE: for now only Landscape screen rotations works
SLIDE_HORIZONTAL As Byte
SLIDE_VERTICAL As Byte
SlideBitmap (FileName As String, Mode As Byte, Step As Byte, Delay As UInt) As void
Slide a bitmap image.

FileName: bitmap file name without .bmp extension
Mode: one of slide costant, can be SLIDE_HORIZONTAL or SLIDE_VERTICAL
Step: step on witch the bitmap move it's position during a slide animation
Delay: delay on witch the bitmap move it's position during a slide animation
SlidePageLeft (Step As Byte, FillColor As UInt, BorderColor As UInt, Delay As UInt) As void
Slide a page Left. (NOTE: this is an animation only and do not slise display content)

Step: step to witch the animation increases
FillColor: display background color during the slide animation
BorderColor: border color of the slide animation
Delay: a delay between Step increased, big values slow down animation
SlidePageRight (Step As Byte, FillColor As UInt, BorderColor As UInt, Delay As UInt) As void
Slide a page Right. (NOTE: this is an animation only and do not slise display content)

Step: step to witch the animation increases
FillColor: display background color during the slide animation
BorderColor: border color of the slide animation
Delay: a delay between Step increased, big values slow down animation
SPI_FULL_SPEED As ULong
SPI_QUARTER_SPEED As ULong
SPI_SPI_HALF_SPEED As ULong
StartScroll As void
Start screen scroll.
StopScroll As void
Stop screen scroll.
TextWrap As Boolean [write only]
Sets the text wrapper property, if True on long string, oled display it on more than one line.
Width As Byte [read only]
Gets the display Width, this can be 96 or 64 pixels based on display orientation.

ImageClip


Events:

None

Members:


  Bottom As Byte [read only]

  Frame As ULong

  FrameCount As ULong [read only]

  Height As Byte [read only]

  imageclip As ImageClip

  Initialize (Oled As ESP8266FastSSD1331, SupportType As String, FileName As String, StartFrame As ULong, EndFrame As ULong, X As Byte, Y As Byte, Width As Byte, Height As Byte) As void

  Left As Byte [read only]

  Right As Byte [read only]

  Top As Byte [read only]

  Width As Byte [read only]

Members description:

Bottom As Byte [read only]
Gets image clip bottom.
Frame As ULong
Sets or gets image clip frame.
FrameCount As ULong [read only]
Gets a frame count for this image clip.
Height As Byte [read only]
Gets image clip height.
imageclip As ImageClip
Initialize (Oled As ESP8266FastSSD1331, SupportType As String, FileName As String, StartFrame As ULong, EndFrame As ULong, X As Byte, Y As Byte, Width As Byte, Height As Byte) As void
Initializes an ImageClip.
Left As Byte [read only]
Gets image clip left.
Right As Byte [read only]
Gets image clip right.
Top As Byte [read only]
Gets image clip top.
Width As Byte [read only]
Gets image clip width.

MeterBar


Events:

None

Members:


  BorderWidth As Byte [read only]

  Bottom As Byte [read only]

  Height As Byte [read only]

  Initialize (Oled As ESP8266FastSSD1331, X As Byte, Y As Byte, Width As Byte, Height As Byte, ClearColor As UInt, FillColor As UInt, BorderColor As UInt, BorderWidth As Byte) As void

  Left As Byte [read only]

  MaxValue As UInt

  meterbar As MeterBar

  Right As Byte [read only]

  Top As Byte [read only]

  Value As UInt

  Width As Byte [read only]

Members description:

BorderWidth As Byte [read only]
Gets meter bar stroke width.
Bottom As Byte [read only]
Gets meter bar bottom.
Height As Byte [read only]
Gets meter bar height.
Initialize (Oled As ESP8266FastSSD1331, X As Byte, Y As Byte, Width As Byte, Height As Byte, ClearColor As UInt, FillColor As UInt, BorderColor As UInt, BorderWidth As Byte) As void
Initializes a meter bar.
Left As Byte [read only]
Gets meter bar left.
MaxValue As UInt
Sets or gets the meter bar max value.
meterbar As MeterBar
Right As Byte [read only]
Gets meter bar right.
Top As Byte [read only]
Gets meter bar top.
Value As UInt
Sets or gets the meter bar value.
Width As Byte [read only]
Gets meter bar width.
Top