displaylib_1bit_PICO 2.0.0
1-bit colour graphic display library, Rpi PICO RP2040 library
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
SSD1306 Class Reference

class to control OLED and define buffer More...

#include <ssd1306.hpp>

Inheritance diagram for SSD1306:
Inheritance graph
[legend]
Collaboration diagram for SSD1306:
Collaboration graph
[legend]

Public Member Functions

 SSD1306 (int16_t, int16_t)
 init the screen object
 
DisplayRet::Ret_Codes_e OLEDSetBufferPtr (uint8_t width, uint8_t height, std::span< uint8_t > buffer)
 sets the buffer pointer to the users screen data buffer
 
virtual void drawPixel (int16_t x, int16_t y, uint8_t color) override
 Draws a Pixel to the screen overides the gfx lib if defined.
 
DisplayRet::Ret_Codes_e OLEDupdate (void)
 updates the buffer i.e. writes it to the screen
 
DisplayRet::Ret_Codes_e OLEDclearBuffer (void)
 clears the buffer memory i.e. does NOT write to the screen
 
void OLEDBuffer (int16_t x, int16_t y, uint8_t w, uint8_t h, std::span< uint8_t > data)
 Draw a bitmap directly to the screen.
 
void OLEDFillScreen (uint8_t pixel, uint8_t mircodelay)
 Fill the screen NOT the buffer with a datapattern.
 
void OLEDFillPage (uint8_t page_num, uint8_t pixels, uint8_t delay)
 Fill the chosen page(1-8) with a datapattern.
 
DisplayRet::Ret_Codes_e OLEDBitmap (int16_t x, int16_t y, int16_t w, int16_t h, std::span< const uint8_t > bitmap, bool invert)
 Draw a bitmap to the buffer.
 
DisplayRet::Ret_Codes_e OLEDbegin (uint8_t I2c_address=SSD1306_ADDR, i2c_inst_t *i2c_type=i2c1, uint16_t CLKspeed=100, uint8_t SDApin=18, uint8_t SCLKpin=19)
 begin Method initialise OLED I2C communication
 
void OLEDinit ()
 Called from OLEDbegin carries out Power on sequence and register init.
 
void OLEDdeI2CInit (void)
 End I2C operations. I2C pins P1-03 (SDA) and P1-05 (SCL)
are returned to their default INPUT behaviour.
 
void OLEDPowerDown (void)
 Disables OLED Call when powering down.
 
void OLEDEnable (uint8_t on)
 Turns On Display.
 
void OLEDContrast (uint8_t OLEDcontrast)
 Adjusts contrast.
 
void OLEDInvert (bool on)
 invert the display
 
void OLEDStartScrollRight (uint8_t start, uint8_t stop)
 Scroll OLED data to the right.
 
void OLEDStartScrollLeft (uint8_t start, uint8_t stop)
 Scroll OLED data to the left.
 
void OLEDStartScrollDiagRight (uint8_t start, uint8_t stop)
 Scroll OLED data diagonally to the right.
 
void OLEDStartScrollDiagLeft (uint8_t start, uint8_t stop)
 Scroll OLED data diagonally to the left.
 
void OLEDStopScroll (void)
 Stop scroll mode.
 
int16_t CheckConnection (void)
 Check Connection Function Check if device is on the bus asks for one byte.
 
bool GetIsConnected (void)
 getter for is connected status
 
void SetIsConnected (bool)
 setter for is connected status
 
bool GetDebugMode (void)
 getter for debug status
 
void SetDebugMode (bool)
 setter for debug status
 
uint8_t GetI2CRetryAttemptsNo (void)
 Gets the Number of I2C retry Attempts in event of I2C bus error Set to zero for NO retry attempts. default 3.
 
void SetI2CRetryAttemptsNo (uint8_t)
 Sets the Number of I2C retry Attempts in event of I2C bus error Set to zero for NO retry attempts.
 
uint16_t GetI2CRetryDelay (void)
 Gets delay in mS between retry attempts in event of I2C error.
 
void SetI2CRetryDelay (uint16_t)
 Sets delay in mS between retry attempts in event of I2C error.
 
uint32_t GetI2CTimeout (void)
 Gets I2C timeout value used in I2C functions calls.
 
void SetI2CTimeout (uint32_t)
 Sets delay the I2C timeout in uS.
 
- Public Member Functions inherited from displaylib_graphics
 displaylib_graphics (int16_t w, int16_t h)
 init the OLED Graphics class object constructor
 
void drawLine (int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint8_t color)
 draws a line from (x0,y0) to (x1,y1).
 
void drawFastVLine (int16_t x, int16_t y, int16_t h, uint8_t color)
 Draws a vertical line starting at (x,y) with height h.
 
void drawFastHLine (int16_t x, int16_t y, int16_t w, uint8_t color)
 Draws a horizontal line starting at (x,y) with width w.
 
void drawRect (int16_t x, int16_t y, int16_t w, int16_t h, uint8_t color)
 draws rectangle at (x,y) where h is height and w is width of the rectangle.
 
void fillRect (int16_t x, int16_t y, int16_t w, int16_t h, uint8_t color)
 fills a rectangle starting from coordinates (x,y) with width of w and height of h.
 
void fillScreen (uint8_t color)
 Fills the whole screen with a given color.
 
void drawCircle (int16_t x0, int16_t y0, int16_t r, uint8_t color)
 Draws a circle with center coordinates (centerX, centerY) and a given radius.
 
void fillCircle (int16_t x0, int16_t y0, int16_t r, uint8_t color)
 fills a circle where (x0,y0) are center coordinates an r is circle radius.
 
void drawTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t color)
 draws a triangle of coordinates (x0,y0), (x1,y1) and (x2,y2).
 
void fillTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t color)
 Fills a triangle defined by the coordinates (x0, y0), (x1, y1), and (x2, y2).
 
void drawRoundRect (int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint8_t color)
 draws a rectangle with rounded edges
 
void fillRoundRect (int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint8_t color)
 Fills a rectangle with rounded edges.
 
void setCursor (int16_t x, int16_t y)
 set the cursor position
 
virtual size_t write (uint8_t)
 write method used in the print class when user calls print
 
DisplayRet::Ret_Codes_e writeChar (int16_t x, int16_t y, char value)
 Write 1 character on OLED.
 
DisplayRet::Ret_Codes_e writeCharString (int16_t x, int16_t y, char *text)
 Write Text character array on OLED.
 
void setTextWrap (bool w)
 turn on or off screen _textwrap of the text (fonts 1-6)
 
void setDrawBitmapAddr (bool mode)
 sets the data addressing mode in drawBitmap function.
 
DisplayRet::Ret_Codes_e drawBitmap (int16_t x, int16_t y, std::span< const uint8_t > bitmap, int16_t w, int16_t h, uint8_t color, uint8_t bg)
 Draw a 1-bit color bitmap.
 
int16_t height (void) const
 Gets the height of the display (per current _rotation)
 
int16_t width (void) const
 Gets the width of the display (per current _rotation)
 
display_rotate_e getRotation (void)
 Gets the _rotation of the display.
 
void setRotation (display_rotate_e r)
 Sets the _rotation of the display.
 
void drawLineAngle (int16_t x, int16_t y, int angle, uint8_t start, uint8_t length, int offset, uint8_t color)
 Draws a line using an angle and length as parameters. This function draws a line starting from (x, y), extending in the direction specified by angle, with a given length. The function also allows applying an offset to the angle before computing the line’s end coordinates.
 
void drawQuadrilateral (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, int16_t x3, int16_t y3, uint8_t color)
 Draws a quadrilateral (four-sided polygon) by connecting four points with lines. This function draws a quadrilateral by drawing four lines between the given vertices. The lines are drawn in the order: (x0, y0) to (x1, y1), (x1, y1) to (x2, y2), (x2, y2) to (x3, y3), and finally (x3, y3) back to (x0, y0).
 
void fillQuadrilateral (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, int16_t x3, int16_t y3, uint8_t color)
 Fills a quadrilateral with the specified color using triangles. This function fills a quadrilateral by dividing it into triangles and filling them individually. The quadrilateral is filled by calling the fillTriangle function three times with appropriate vertex coordinates. The useTriangleSplit parameter determines whether the quadrilateral is divided into two triangles or if only one triangle is used.
 
DisplayRet::Ret_Codes_e drawPolygon (int16_t x, int16_t y, uint8_t sides, int16_t diameter, float rotation, bool fill, uint8_t color)
 Draws a polygon with a specified number of sides, diameter, rotation, and color. This function draws a regular polygon by connecting points equally spaced around a circle, with each point having a distance defined by the diameter. The polygon is rotated by the given angle (in degrees) before being drawn. The number of sides is enforced to be at least 3.
 
void drawArc (uint16_t cx, uint16_t cy, uint16_t radius, uint16_t thickness, float startAngle, float endAngle, uint8_t color)
 Draw an arc on the TFT display. This function draws an arc between two angles (start and end) on a circle with a given radius.
 
void drawSimpleArc (int16_t cx, int16_t cy, int16_t radius, float startAngle, float endAngle, uint8_t color)
 Draw a simple arc of one pixel on the display( no offsets , thickness or maximum arc calculations) This function draws an arc between two angles (start and end) on a circle with a given radius.
 
void drawEllipse (int16_t cx, int16_t cy, int16_t semiMajorAxis, int16_t semiMinorAxis, bool fill, uint8_t color)
 Draw an ellipse on the display. This function uses the midpoint ellipse algorithm to efficiently draw an ellipse centered at (cx, cy) with the given semi-major (horizontal) and semi-minor (vertical) axes.
 
DisplayRet::Ret_Codes_e drawDotGrid (int16_t x, int16_t y, int16_t w, int16_t h, uint8_t DotGridGap, uint8_t color)
 Draws a grid of dots on the screen starting from the given coordinates. This function draws a grid of pixels with a specified gap between them. It checks that the provided coordinates and dimensions are within the screen bounds and adjusts them if necessary. It also validates The grid of dots gap value and defaults it to 2 if invalid.
 
float getArcAngleMax () const
 Get the current maximum angle of the arc.
 
void setArcAngleMax (float arcAngleMax)
 Set a new maximum angle for the arc.
 
int getArcAngleOffset () const
 Get the current angle offset.
 
void setArcAngleOffset (int arcAngleOffset)
 Set a new angle offset.
 
- Public Member Functions inherited from displaylib_fonts
 displaylib_fonts ()
 init the OLED font class object constructor
 
DisplayRet::Ret_Codes_e setFont (std::span< const uint8_t > font)
 SSD1306_SetFont.
 
void setInvertFont (bool invertStatus)
 setInvertFont
 
bool getInvertFont (void)
 getInvertFont
 
- Public Member Functions inherited from Print
int getWriteError ()
 gets the error flag status, zero no error
 
void clearWriteError ()
 clears the errof flag by setting it to zero
 
size_t write (const char *str)
 
virtual size_t write (const uint8_t *buffer, size_t size)
 
size_t write (const char *buffer, size_t size)
 
virtual int availableForWrite ()
 
size_t print (const char[])
 
size_t print (char)
 
size_t print (int, int=DEC)
 
size_t print (unsigned int, int=DEC)
 
size_t print (long, int=DEC)
 
size_t print (unsigned long, int=DEC)
 
size_t print (double, int=2)
 
size_t print (const std::string &)
 
size_t println (const char[])
 
size_t println (char)
 
size_t println (int, int=DEC)
 
size_t println (unsigned int, int=DEC)
 
size_t println (long, int=DEC)
 
size_t println (unsigned long, int=DEC)
 
size_t println (double, int=2)
 
size_t println (void)
 
size_t println (const std::string &s)
 

Static Public Attributes

static constexpr uint8_t SSD1306_ADDR = 0x3C
 

Private Member Functions

void I2CWriteByte (uint8_t value=0x00, uint8_t DataOrCmd=SSD1306_COMMAND)
 Writes a byte to I2C address,command or data, used internally.
 

Private Attributes

uint8_t _I2CRetryAttempts = 3
 
uint16_t _I2CRetryDelay = 100
 
uint32_t _TimeoutDelayI2C = 50000
 
uint8_t _OLEDAddressI2C = SSD1306_ADDR
 
uint8_t _SDataPin = 18
 
uint8_t _SClkPin = 19
 
uint16_t _CLKSpeed = 100
 
i2c_inst_t * _i2c
 
bool _bIsConnected = false
 
bool _bSerialDebugFlag = false
 
uint8_t _OLED_WIDTH =128
 
uint8_t _OLED_HEIGHT =64
 
uint8_t _OLED_PAGE_NUM =(_OLED_HEIGHT/8)
 
std::span< uint8_t > _OLEDbuffer
 

Static Private Attributes

static constexpr uint8_t SSD1306_SET_CONTRAST_CONTROL = 0x81
 
static constexpr uint8_t SSD1306_DISPLAY_ALL_ON_RESUME = 0xA4
 
static constexpr uint8_t SSD1306_DISPLAY_ALL_ON = 0xA5
 
static constexpr uint8_t SSD1306_NORMAL_DISPLAY = 0xA6
 
static constexpr uint8_t SSD1306_INVERT_DISPLAY = 0xA7
 
static constexpr uint8_t SSD1306_DISPLAY_OFF = 0xAE
 
static constexpr uint8_t SSD1306_DISPLAY_ON = 0xAF
 
static constexpr uint8_t SSD1306_NOP = 0xE3
 
static constexpr uint8_t SSD1306_RIGHT_HORIZONTAL_SCROLL = 0x26
 
static constexpr uint8_t SSD1306_LEFT_HORIZONTAL_SCROLL = 0x27
 
static constexpr uint8_t SSD1306_VERTICAL_AND_RIGHT_HORIZONTAL_SCROLL = 0x29
 
static constexpr uint8_t SSD1306_VERTICAL_AND_LEFT_HORIZONTAL_SCROLL = 0x2A
 
static constexpr uint8_t SSD1306_DEACTIVATE_SCROLL = 0x2E
 
static constexpr uint8_t SSD1306_ACTIVATE_SCROLL = 0x2F
 
static constexpr uint8_t SSD1306_SET_VERTICAL_SCROLL_AREA = 0xA3
 
static constexpr uint8_t SSD1306_SET_LOWER_COLUMN = 0x00
 
static constexpr uint8_t SSD1306_SET_HIGHER_COLUMN = 0x10
 
static constexpr uint8_t SSD1306_MEMORY_ADDR_MODE = 0x20
 
static constexpr uint8_t SSD1306_SET_COLUMN_ADDR = 0x21
 
static constexpr uint8_t SSD1306_SET_PAGE_ADDR = 0x22
 
static constexpr uint8_t SSD1306_SET_START_LINE = 0x40
 
static constexpr uint8_t SSD1306_SET_SEGMENT_REMAP = 0xA0
 
static constexpr uint8_t SSD1306_SET_MULTIPLEX_RATIO = 0xA8
 
static constexpr uint8_t SSD1306_COM_SCAN_DIR_INC = 0xC0
 
static constexpr uint8_t SSD1306_COM_SCAN_DIR_DEC = 0xC8
 
static constexpr uint8_t SSD1306_SET_DISPLAY_OFFSET = 0xD3
 
static constexpr uint8_t SSD1306_SET_COM_PINS = 0xDA
 
static constexpr uint8_t SSD1306_CHARGE_PUMP = 0x8D
 
static constexpr uint8_t SSD1306_SET_DISPLAY_CLOCK_DIV_RATIO = 0xD5
 
static constexpr uint8_t SSD1306_SET_PRECHARGE_PERIOD = 0xD9
 
static constexpr uint8_t SSD1306_SET_VCOM_DESELECT = 0xDB
 
static constexpr uint8_t SSD1306_COMMAND = 0x00
 
static constexpr uint8_t SSD1306_DATA = 0xC0
 
static constexpr uint8_t SSD1306_DATA_CONTINUE = 0x40
 

Additional Inherited Members

- Public Types inherited from displaylib_graphics
enum  PixelColor : uint8_t { BG_COLOR = 0 , FG_COLOR = 1 , INVERSE = 2 }
 Display Pixel colours definition. More...
 
enum  display_rotate_e : uint8_t { rDegrees_0 = 0 , rDegrees_90 = 1 , rDegrees_180 = 2 , rDegrees_270 = 3 }
 
- Public Types inherited from Print
enum  BaseNum : uint8_t { DEC = 10 , HEX = 16 , OCT = 8 , BIN = 2 }
 
- Protected Member Functions inherited from displaylib_graphics
float sineFromDegrees (float angle)
 Computes the sine of an angle given in degrees. This function converts the input angle from degrees to radians and then calculates the sine of that angle using the standard C++ sin function.
 
float cosineFromDegrees (float angle)
 Computes the cosine of an angle given in degrees. This function converts the input angle from degrees to radians and then calculates the cosine of that angle using the standard C++ cos function.
 
void ellipseHelper (uint16_t cx, uint16_t cy, uint16_t x, uint16_t y, uint8_t color)
 
void drawArcHelper (uint16_t cx, uint16_t cy, uint16_t radius, uint16_t thickness, float start, float end, uint8_t color)
 
void drawCircleHelper (int16_t x0, int16_t y0, int16_t r, uint8_t cornername, uint8_t color)
 
void fillCircleHelper (int16_t x0, int16_t y0, int16_t r, uint8_t cornername, int16_t delta, uint8_t color)
 
- Protected Member Functions inherited from Print
void setWriteError (int err=1)
 
- Protected Attributes inherited from displaylib_graphics
const int16_t WIDTH
 
const int16_t HEIGHT
 
display_rotate_e _display_rotate = rDegrees_0
 
int16_t _width
 
int16_t _height
 
int16_t _cursor_x = 0
 
int16_t _cursor_y = 0
 
bool _drawBitmapAddr
 
bool _textwrap = true
 
float _arcAngleMax = 360.0f
 
int _arcAngleOffset = 0
 
- Protected Attributes inherited from displaylib_fonts
std::span< const uint8_t > _FontSelect = pFontDefault
 
uint8_t _Font_X_Size = 0x06
 
uint8_t _Font_Y_Size = 0x08
 
uint8_t _FontOffset = 0x00
 
uint8_t _FontNumChars = 0xFE
 

Detailed Description

class to control OLED and define buffer

Constructor & Destructor Documentation

◆ SSD1306()

SSD1306::SSD1306 ( int16_t  oledwidth,
int16_t  oledheight 
)

init the screen object

Parameters
oledwidthwidth of OLED in pixels
oledheightheight of OLED in pixels

Member Function Documentation

◆ CheckConnection()

int16_t SSD1306::CheckConnection ( void  )

Check Connection Function Check if device is on the bus asks for one byte.

Returns
int16_t if less than 1 = error

◆ drawPixel()

void SSD1306::drawPixel ( int16_t  x,
int16_t  y,
uint8_t  color 
)
overridevirtual

Draws a Pixel to the screen overides the gfx lib if defined.

Parameters
xx axis position
yy axis position
colorcolor of pixel.

Implements displaylib_graphics.

◆ GetDebugMode()

bool SSD1306::GetDebugMode ( void  )

getter for debug status

Returns
true debug is on

◆ GetI2CRetryAttemptsNo()

uint8_t SSD1306::GetI2CRetryAttemptsNo ( void  )

Gets the Number of I2C retry Attempts in event of I2C bus error Set to zero for NO retry attempts. default 3.

Returns
uint8_t Max number of I2C retry attempts

◆ GetI2CRetryDelay()

uint16_t SSD1306::GetI2CRetryDelay ( void  )

Gets delay in mS between retry attempts in event of I2C error.

Returns
Delay mS

◆ GetI2CTimeout()

uint32_t SSD1306::GetI2CTimeout ( void  )

Gets I2C timeout value used in I2C functions calls.

Returns
Delay uS, default 50000

◆ GetIsConnected()

bool SSD1306::GetIsConnected ( void  )

getter for is connected status

Returns
is connected or disconnected

◆ I2CWriteByte()

void SSD1306::I2CWriteByte ( uint8_t  value = 0x00,
uint8_t  cmd = SSD1306_COMMAND 
)
private

Writes a byte to I2C address,command or data, used internally.

Parameters
valuewrite the value to be written
cmdcommand or data
Note
In the event of an error will loop 3 times each time.

◆ OLEDbegin()

DisplayRet::Ret_Codes_e SSD1306::OLEDbegin ( uint8_t  I2Caddress = SSD1306_ADDR,
i2c_inst_t *  i2c_type = i2c1,
uint16_t  CLKspeed = 100,
uint8_t  SDApin = 18,
uint8_t  SCLKpin = 19 
)

begin Method initialise OLED I2C communication

Parameters
I2CaddressI2C Bus address by default 0x3C
i2c_typeThe I2C interface i2c0 or ic21 interface
CLKspeedI2C Bus Clock speed in KHz.
SDApinI2C data GPIO pin
SCLKpinI2C clock GPIO pin
Returns
  1. Success if successful , init I2C communication
  2. I2CbeginFail

◆ OLEDBitmap()

DisplayRet::Ret_Codes_e SSD1306::OLEDBitmap ( int16_t  x,
int16_t  y,
int16_t  w,
int16_t  h,
std::span< const uint8_t >  pBitmap,
bool  invert 
)

Draw a bitmap to the buffer.

Parameters
xx axis offset
yy axis offset
wwidth
hheight
pBitmapspan object to bitmap data
invertcolor
Returns
Will return
  1. success
  2. BitmapScreenBounds Bitmap co-ord out of bounds, check x and y
  3. BitmapLargerThanScreen Bitmap is larger than screen, check w and h
  4. BitmapEmpty Bitmap is an invalid object
  5. BitmapHorizontalSize Check Horizontal bitmap size
Note
bitmap data must be horizontally addressed and width divisible by 8

◆ OLEDBuffer()

void SSD1306::OLEDBuffer ( int16_t  x,
int16_t  y,
uint8_t  w,
uint8_t  h,
std::span< uint8_t >  data 
)

Draw a bitmap directly to the screen.

Parameters
xx axis offset
yy axis offset
wwidth
hheight
datathe buffer data
Note
Called by OLEDupdate internally

◆ OLEDContrast()

void SSD1306::OLEDContrast ( uint8_t  contrast)

Adjusts contrast.

Parameters
contrast0x00 to 0xFF , default 0x80

◆ OLEDEnable()

void SSD1306::OLEDEnable ( uint8_t  bits)

Turns On Display.

Parameters
bits1 on , 0 off

◆ OLEDFillPage()

void SSD1306::OLEDFillPage ( uint8_t  page_num,
uint8_t  dataPattern,
uint8_t  mydelay 
)

Fill the chosen page(1-8) with a datapattern.

Parameters
page_numchosen page (1-8)
dataPatterncan be set to 0 to FF (not buffer)
mydelayoptional delay in milliseconds can be set to zero normally.

◆ OLEDFillScreen()

void SSD1306::OLEDFillScreen ( uint8_t  dataPattern,
uint8_t  delay 
)

Fill the screen NOT the buffer with a datapattern.

Parameters
dataPatterncan be set to zero to clear screen (not buffer) range 0x00 to 0ff
delayin milliseconds can be set to zero normally.

◆ OLEDinit()

void SSD1306::OLEDinit ( )

Called from OLEDbegin carries out Power on sequence and register init.

< Initialisation delay in mS

◆ OLEDInvert()

void SSD1306::OLEDInvert ( bool  value)

invert the display

Parameters
valuetrue invert , false normal

◆ OLEDSetBufferPtr()

DisplayRet::Ret_Codes_e SSD1306::OLEDSetBufferPtr ( uint8_t  width,
uint8_t  height,
std::span< uint8_t >  buffer 
)

sets the buffer pointer to the users screen data buffer

Parameters
widthwidth of buffer in pixels
heightheight of buffer in pixels
bufferspan object of the buffer
Returns
Will return:
  1. Success
  2. BufferSize Buffer size calculations are incorrect BufferSize = w * (h/8),
  3. BufferEmpty Not a valid span object.

◆ OLEDStartScrollDiagLeft()

void SSD1306::OLEDStartScrollDiagLeft ( uint8_t  start,
uint8_t  stop 
)

Scroll OLED data diagonally to the left.

Parameters
startstart position
stopstop position

◆ OLEDStartScrollDiagRight()

void SSD1306::OLEDStartScrollDiagRight ( uint8_t  start,
uint8_t  stop 
)

Scroll OLED data diagonally to the right.

Parameters
startstart position
stopstop position

◆ OLEDStartScrollLeft()

void SSD1306::OLEDStartScrollLeft ( uint8_t  start,
uint8_t  stop 
)

Scroll OLED data to the left.

Parameters
startstart position
stopstop position

◆ OLEDStartScrollRight()

void SSD1306::OLEDStartScrollRight ( uint8_t  start,
uint8_t  stop 
)

Scroll OLED data to the right.

Parameters
startstart position
stopstop position

◆ SetDebugMode()

void SSD1306::SetDebugMode ( bool  debugMode)

setter for debug status

Parameters
debugModetrue yes on , false off

◆ SetI2CRetryAttemptsNo()

void SSD1306::SetI2CRetryAttemptsNo ( uint8_t  Attempts)

Sets the Number of I2C retry Attempts in event of I2C bus error Set to zero for NO retry attempts.

Parameters
AttemptsMax number of I2C retry attempts

◆ SetI2CRetryDelay()

void SSD1306::SetI2CRetryDelay ( uint16_t  Delay)

Sets delay in mS between retry attempts in event of I2C error.

Parameters
Delaydelay in mS between retry attempts in event of I2C error

◆ SetI2CTimeout()

void SSD1306::SetI2CTimeout ( uint32_t  timeout)

Sets delay the I2C timeout in uS.

Parameters
timeoutdelay in uS

◆ SetIsConnected()

void SSD1306::SetIsConnected ( bool  connected)

setter for is connected status

Parameters
connectedSet device connected , true yes, false no

Member Data Documentation

◆ _bIsConnected

bool SSD1306::_bIsConnected = false
private

is device connected/correct flag

◆ _bSerialDebugFlag

bool SSD1306::_bSerialDebugFlag = false
private

for serial debug I2C errors to console flag

◆ _CLKSpeed

uint16_t SSD1306::_CLKSpeed = 100
private

I2C bus speed in khz datasheet

◆ _i2c

i2c_inst_t* SSD1306::_i2c
private

i2C port number

◆ _I2CRetryAttempts

uint8_t SSD1306::_I2CRetryAttempts = 3
private

Maximum number of Retry attempts in event of I2C write error

◆ _I2CRetryDelay

uint16_t SSD1306::_I2CRetryDelay = 100
private

mS Delay, in between Retry attempts in event of I2C error

◆ _OLED_HEIGHT

uint8_t SSD1306::_OLED_HEIGHT =64
private

Height of OLED Screen in pixels

◆ _OLED_PAGE_NUM

uint8_t SSD1306::_OLED_PAGE_NUM =(_OLED_HEIGHT/8)
private

Number of byte size pages OLED screen is divided into

◆ _OLED_WIDTH

uint8_t SSD1306::_OLED_WIDTH =128
private

Width of OLED Screen in pixels

◆ _OLEDAddressI2C

uint8_t SSD1306::_OLEDAddressI2C = SSD1306_ADDR
private

I2C address

◆ _OLEDbuffer

std::span<uint8_t> SSD1306::_OLEDbuffer
private

Buffer to hold screen data

◆ _SClkPin

uint8_t SSD1306::_SClkPin = 19
private

I2C clock GPIO pin

◆ _SDataPin

uint8_t SSD1306::_SDataPin = 18
private

I2C data GPIO pin

◆ _TimeoutDelayI2C

uint32_t SSD1306::_TimeoutDelayI2C = 50000
private

uS delay , I2C timeout

◆ SSD1306_ADDR

constexpr uint8_t SSD1306::SSD1306_ADDR = 0x3C
staticconstexpr

I2C address, alt 0x3D


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