Display_Lib_RPI 2.3.0
A C++ Library to connect electronic displays to Linux single board computers.
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | Protected Attributes | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
SH110X_RDL Class Reference

class to control OLED and define buffer More...

#include <SH110X_OLED_RDL.hpp>

Inheritance diagram for SH110X_RDL:
Inheritance graph
[legend]

Public Types

enum  OLED_IC_type_e : uint8_t { SH1106_IC = 0 , SH1107_IC =1 }
 
- Public Types inherited from bicolor_graphics
enum  displayBC_rotate_e : uint8_t { BC_Degrees_0 = 0 , BC_Degrees_90 = 1 , BC_Degrees_180 = 2 , BC_Degrees_270 = 3 }
 
enum  pixel_color_e : uint8_t { WHITE = 0 , BLACK = 1 , INVERSE = 2 }
 
- Public Types inherited from Print
enum  BaseNum : uint8_t { RDL_DEC = 10 , RDL_HEX = 16 , RDL_OCT = 8 , RDL_BIN = 2 }
 

Public Member Functions

 SH110X_RDL (int16_t oledwidth, int16_t oledheight)
 init the screen object
 
virtual void drawPixel (int16_t x, int16_t y, uint8_t color) override
 Draws a Pixel to the screen overrides the graphics lib.
 
rdlib::Return_Codes_e OLEDSetBufferPtr (uint8_t width, uint8_t height, std::span< uint8_t > buffer)
 sets the buffer pointer to the users screen data buffer
 
rdlib::Return_Codes_e OLEDupdate (void)
 updates the buffer i.e. writes it to the screen
 
rdlib::Return_Codes_e OLEDclearBuffer (void)
 clears the buffer memory i.e. does NOT write to the screen
 
void OLEDBufferScreen (uint8_t w, uint8_t h, std::span< uint8_t > buffer)
 Draw the buffer to screen 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 with a data pattern.
 
rdlib::Return_Codes_e OLEDbegin (OLED_IC_type_e=SH1106_IC, int8_t ResetPin=-1, int gpioDev=0)
 begin Method initialise OLED
 
void OLEDinit (void)
 Called from OLEDbegin carries out Power on sequence and register init.
 
void OLEDPowerDown (void)
 Disables OLED Call when powering down.
 
void OLEDReset (void)
 Handles OLED reset, if reset pin present on device.
 
void OLEDEnable (uint8_t on)
 Turns On Display.
 
void OLEDContrast (uint8_t OLEDcontrast)
 Adjusts contrast.
 
void OLEDInvert (bool on)
 invert the display
 
rdlib::Return_Codes_e OLED_I2C_ON (int I2C_device, int I2C_addr, int I2C_flags)
 Start I2C operations.
 
rdlib::Return_Codes_e OLED_I2C_OFF (void)
 End I2C operations. This closes the I2C device.
 
int OLEDCheckConnection (void)
 checks if OLED on I2C bus
 
uint8_t OLEDI2CErrorGet (void)
 get I2C error Flag
 
uint16_t OLEDI2CErrorTimeoutGet (void)
 Gets the I2C timeout, used in the event of an I2C write error.
 
void OLEDI2CErrorTimeoutSet (uint16_t)
 Sets the I2C timeout, in the event of an I2C write error.
 
uint8_t OLEDI2CErrorRetryNumGet (void)
 Gets the I2C error retry attempts, used in the event of an I2C write error.
 
void OLEDI2CErrorRetryNumSet (uint8_t)
 Sets the I2C error retry attempts used in the event of an I2C write error.
 
- Public Member Functions inherited from bicolor_graphics
 bicolor_graphics (int16_t w, int16_t h)
 init the Display Graphics class object
 
rdlib::Return_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.
 
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).
 
rdlib::Return_Codes_e drawFastVLine (int16_t x, int16_t y, int16_t h, uint8_t color)
 Draws a vertical line starting at (x,y) with height h.
 
rdlib::Return_Codes_e 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 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 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 where (x0,y0) are center coordinates an r is circle 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 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.
 
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 of 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 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, bool useTriangleSplit=true)
 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.
 
rdlib::Return_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.
 
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.
 
void setCursor (int16_t x, int16_t y)
 set the cursor position
 
void setRotation (displayBC_rotate_e m)
 Sets the _rotation of the display.
 
displayBC_rotate_e getRotation ()
 Gets the _rotation of the display.
 
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)
 
virtual size_t write (uint8_t) override
 write method used in the print class when user calls print
 
rdlib::Return_Codes_e writeChar (int16_t x, int16_t y, char value)
 Write 1 character on display.
 
rdlib::Return_Codes_e writeCharString (int16_t x, int16_t y, char *text)
 Write Text character array on Display.
 
void setTextWrap (bool w)
 turn on or off screen wrap of the text
 
void setDrawBitmapAddr (bool mode)
 sets the data addressing mode in drawBitmap function.
 
rdlib::Return_Codes_e drawBitmap (int16_t x, int16_t y, const std::span< const uint8_t > bitmap, int16_t w, int16_t h, uint8_t color, uint8_t bg)
 Draw a 1-bit color bitmap.
 
- Public Member Functions inherited from display_Fonts
 display_Fonts ()
 init the OLED font class object constructor
 
rdlib::Return_Codes_e setFont (display_Font_name_e)
 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 error flag by setting it to zero
 
virtual size_t write (const uint8_t *buffer, size_t size)
 define in the sub class
 
size_t write (const char *str)
 Writes a string to the output.
 
size_t write (const char *buffer, size_t size)
 Writes a buffer of a specified size to the output.
 
virtual int availableForWrite ()
 define in the sub class
 
size_t print (const char[])
 print an array
 
size_t print (char)
 print an character
 
size_t print (int, int=RDL_DEC)
 print an integer of base number system
 
size_t print (unsigned int, int=RDL_DEC)
 print an unsigned integer of base number system
 
size_t print (long, int=RDL_DEC)
 print an long integer of base number system
 
size_t print (unsigned long, int=RDL_DEC)
 print an unsigned long integer of base number system
 
size_t print (double, int=2)
 print an double
 
size_t print (const std::string &)
 print an C++ string object
 
size_t println (const char[])
 Prints a character array followed by a newline.
 
size_t println (char)
 print an character followed by new line
 
size_t println (int, int=RDL_DEC)
 print an integer of base number system followed by new line
 
size_t println (unsigned int, int=RDL_DEC)
 print an unsigned integer of base number system followed by new line
 
size_t println (long, int=RDL_DEC)
 print an long integer of base number system followed by new line
 
size_t println (unsigned long, int=RDL_DEC)
 print an unsigned long integer of base number system followed by new line
 
size_t println (double, int=2)
 print an double
 
size_t println (void)
 Goto to new line.
 
size_t println (const std::string &s)
 print an C++ string object followed by new line
 
template<typename T >
size_t print (const std::vector< T > &v, int format=defaultFormat< T >())
 Print a vector of any type.
 
template<typename T >
size_t println (const std::vector< T > &vec, int format=defaultFormat< T >())
 Print a vector of elements followed by a newline.
 
template<typename T , size_t N>
size_t print (const std::array< T, N > &arr, int format=defaultFormat< T >())
 Print a std::array of any type.
 
template<typename T , size_t N>
size_t println (const std::array< T, N > &arr, int format=defaultFormat< T >())
 Print a std::array of elements followed by a newline.
 

Public Attributes

const uint8_t SH110X_RDL_ADDR = 0x3C
 

Protected Attributes

uint8_t pageStartOffset = 0
 
- Protected Attributes inherited from bicolor_graphics
displayBC_rotate_e _display_rotate = BC_Degrees_0
 
const int16_t WIDTH
 
const int16_t HEIGHT
 
int16_t _width
 
int16_t _height
 
int16_t _cursor_x
 
int16_t _cursor_y
 
float _arcAngleMax = 360.0f
 
int _arcAngleOffset = 0
 
bool _textwrap = true
 
- Protected Attributes inherited from display_Fonts
std::span< const uint8_t > _FontSelect = pFontDefault
 
uint8_t _Font_X_Size = 0x08
 
uint8_t _Font_Y_Size = 0x08
 
uint8_t _FontOffset = 0x20
 
uint8_t _FontNumChars = 0x5F
 

Private Member Functions

void I2CWriteByte (uint8_t value=0x00, uint8_t DataOrCmd=SH110X_COMMAND_BYTE)
 Writes a byte to I2C address,command or data, used internally.
 
void SH1106_begin (void)
 Init routine for SH1106 OLED.
 
void SH1107_begin (void)
 Init routine for SH1107 OLED.
 

Private Attributes

int _OLEDI2CAddress = SH110X_RDL_ADDR
 
int _OLEDI2CDevice = 1
 
int _OLEDI2CFlags = 0
 
int _OLEDI2CHandle = 0
 
uint16_t _I2C_ErrorDelay = 100
 
uint8_t _I2C_ErrorRetryNum = 3
 
int _I2C_ErrorFlag = 0
 
uint8_t _OLED_WIDTH =128
 
uint8_t _OLED_HEIGHT =64
 
uint8_t _OLED_PAGE_NUM =(_OLED_HEIGHT/8)
 
std::span< uint8_t_OLEDbuffer
 
OLED_IC_type_e _OLED_IC_type = SH1106_IC
 
int8_t _Display_RST = -1
 
int _DeviceNumGpioChip = 0
 
int _GpioHandle = 0
 

Static Private Attributes

static constexpr uint8_t SH110X_MEMORYMODE = 0x20
 
static constexpr uint8_t SH110X_COLUMNADDR = 0x21
 
static constexpr uint8_t SH110X_PAGEADDR = 0x22
 
static constexpr uint8_t SH110X_CHARGEPUMP = 0x8D
 
static constexpr uint8_t SH110X_SETCONTRAST = 0x81
 
static constexpr uint8_t SH110X_SEGREMAP = 0xA0
 
static constexpr uint8_t SH110X_DISPLAYALLON_RESUME = 0xA4
 
static constexpr uint8_t SH110X_DISPLAYALLON = 0xA5
 
static constexpr uint8_t SH110X_NORMALDISPLAY = 0xA6
 
static constexpr uint8_t SH110X_INVERTDISPLAY = 0xA7
 
static constexpr uint8_t SH110X_SETMULTIPLEX = 0xA8
 
static constexpr uint8_t SH110X_DCDC = 0xAD
 
static constexpr uint8_t SH110X_DISPLAYOFF = 0xAE
 
static constexpr uint8_t SH110X_DISPLAYON = 0xAF
 
static constexpr uint8_t SH110X_SETPAGEADDR = 0xB0
 
static constexpr uint8_t SH110X_COMSCANINC = 0xC0
 
static constexpr uint8_t SH110X_COMSCANDEC = 0xC8
 
static constexpr uint8_t SH110X_SETDISPLAYOFFSET = 0xD3
 
static constexpr uint8_t SH110X_SETDISPLAYCLOCKDIV = 0xD5
 
static constexpr uint8_t SH110X_SETPRECHARGE = 0xD9
 
static constexpr uint8_t SH110X_SETCOMPINS = 0xDA
 
static constexpr uint8_t SH110X_SETVCOMDETECT = 0xDB
 
static constexpr uint8_t SH110X_SETDISPSTARTLINE = 0xDC
 
static constexpr uint8_t SH110X_SETLOWCOLUMN = 0x00
 
static constexpr uint8_t SH110X_SETHIGHCOLUMN = 0x10
 
static constexpr uint8_t SH110X_SETSTARTLINE = 0x40
 
static constexpr uint8_t SH110X_COMMAND_BYTE = 0x00
 
static constexpr uint8_t SH110X_DATA_BYTE = 0x40
 

Additional Inherited Members

- Protected Member Functions inherited from Print
void setWriteError (int err=0)
 

Detailed Description

class to control OLED and define buffer

Member Enumeration Documentation

◆ OLED_IC_type_e

type of OLED controller

Enumerator
SH1106_IC 

Sh1106 controller

SH1107_IC 

Sh1107 controller

Constructor & Destructor Documentation

◆ SH110X_RDL()

SH110X_RDL::SH110X_RDL ( int16_t  oledwidth,
int16_t  oledheight 
)

init the screen object

Parameters
oledwidthwidth of OLED in pixels
oledheightheight of OLED in pixels

Member Function Documentation

◆ drawPixel()

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

Draws a Pixel to the screen overrides the graphics lib.

Parameters
xx axis position
yy axis position
colorcolor of pixel.

Implements bicolor_graphics.

◆ I2CWriteByte()

void SH110X_RDL::I2CWriteByte ( uint8_t  value = 0x00,
uint8_t  cmd = SH110X_COMMAND_BYTE 
)
private

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

Parameters
valuewrite the value to be written
cmdcommand or data
Note
isDebugEnabled() ,will output data on I2C failures.

◆ OLED_I2C_OFF()

rdlib::Return_Codes_e SH110X_RDL::OLED_I2C_OFF ( void  )

End I2C operations. This closes the I2C device.

Returns
in event of any error
  1. rdlib::Success everything worked
  2. rdlib::GpioPinClaim Cannot free the reset pin (if used)
  3. rdlib::GpioChipDevice Cannot close the gpio handle for reset pin (if used)
  4. rdlib::I2CcloseFail cannot close I2c bus device

◆ OLED_I2C_ON()

rdlib::Return_Codes_e SH110X_RDL::OLED_I2C_ON ( int  I2C_device,
int  I2C_addr,
int  I2C_flags 
)

Start I2C operations.

Parameters
I2C_deviceAn I2C device number.
I2C_addrThe address of a device on the I2C bus. Default is 0x3C
I2C_flagsFlags which modify an I2C open command. None are currently defined.
Returns
  1. rdlib::Success everything worked
  2. rdlib::I2CbeginFail Cannot open I2C device

◆ OLEDbegin()

rdlib::Return_Codes_e SH110X_RDL::OLEDbegin ( OLED_IC_type_e  OLEDtype = SH1106_IC,
int8_t  resetPin = -1,
int  gpioDev = 0 
)

begin Method initialise OLED

Parameters
OLEDtypeenum type of display sh1106 or sh1107
resetPinUsed only if reset pin present on device, iF not = set to -1
gpioDevdevice num gpiochip Used only rst pin on device
Returns
  1. rdlib::Success everything worked
  2. rdlib::GpioPinClaim Cannot claim the reset pin (if used)
  3. rdlib::GpioChipDevice Cannot open the gpio handle for reset pin (if used)

◆ OLEDBufferScreen()

void SH110X_RDL::OLEDBufferScreen ( uint8_t  w,
uint8_t  h,
std::span< uint8_t data 
)

Draw the buffer to screen directly to the screen.

Parameters
wwidth
hheight
datathe buffer data
Note
Called by OLEDupdate internally

◆ OLEDCheckConnection()

int SH110X_RDL::OLEDCheckConnection ( void  )

checks if OLED on I2C bus

Returns
lg Error codes, LG_OKAY 0x00 = Success
Note
Error codes are here https://abyz.me.uk/lg/lgpio.html

◆ OLEDclearBuffer()

rdlib::Return_Codes_e SH110X_RDL::OLEDclearBuffer ( void  )

clears the buffer memory i.e. does NOT write to the screen

Returns
  1. Success
  2. BufferEmpty is buffer empty object

◆ OLEDContrast()

void SH110X_RDL::OLEDContrast ( uint8_t  contrast)

Adjusts contrast.

Parameters
contrast0x00 to 0xFF , default 0x80

◆ OLEDEnable()

void SH110X_RDL::OLEDEnable ( uint8_t  bits)

Turns On Display.

Parameters
bits1 on , 0 off

◆ OLEDFillPage()

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

Fill the chosen page with a data pattern.

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

◆ OLEDFillScreen()

void SH110X_RDL::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.

◆ OLEDI2CErrorGet()

uint8_t SH110X_RDL::OLEDI2CErrorGet ( void  )

get I2C error Flag

See Error Codes at bottom of https://abyz.me.uk/lg/lgpio.html

Returns
error code stored in _I2C_ErrorFlag

◆ OLEDI2CErrorRetryNumGet()

uint8_t SH110X_RDL::OLEDI2CErrorRetryNumGet ( void  )

Gets the I2C error retry attempts, used in the event of an I2C write error.

Number of times to retry in event of an error

Returns
_I2C_ErrorRetryNum

◆ OLEDI2CErrorRetryNumSet()

void SH110X_RDL::OLEDI2CErrorRetryNumSet ( uint8_t  AttemptCount)

Sets the I2C error retry attempts used in the event of an I2C write error.

Number of times to retry in event of an error

Parameters
AttemptCountI2C retry attempts

◆ OLEDI2CErrorTimeoutGet()

uint16_t SH110X_RDL::OLEDI2CErrorTimeoutGet ( void  )

Gets the I2C timeout, used in the event of an I2C write error.

Delay between retry attempts in event of an error , mS

Returns
I2C timeout delay in mS, _I2C_ErrorDelay

◆ OLEDI2CErrorTimeoutSet()

void SH110X_RDL::OLEDI2CErrorTimeoutSet ( uint16_t  newTimeout)

Sets the I2C timeout, in the event of an I2C write error.

Parameters
newTimeoutI2C timeout delay in mS

Delay between retry attempts in event of an error , mS

◆ OLEDInvert()

void SH110X_RDL::OLEDInvert ( bool  value)

invert the display

Parameters
valuetrue invert , false normal

◆ OLEDReset()

void SH110X_RDL::OLEDReset ( void  )

Handles OLED reset, if reset pin present on device.

< reset delay in miliseconds

◆ OLEDSetBufferPtr()

rdlib::Return_Codes_e SH110X_RDL::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
bufferthe buffer span
Returns
Will return rdlib::Return_Codes_e enum
  1. Success rdlib::Success
  2. Error 1 rdlib::BufferSize
  3. Error 2 rdlib::BufferEmpty

◆ OLEDupdate()

rdlib::Return_Codes_e SH110X_RDL::OLEDupdate ( void  )

updates the buffer i.e. writes it to the screen

Returns
  1. Success
  2. BufferEmpty if buffer is empty object

◆ SH1106_begin()

void SH110X_RDL::SH1106_begin ( void  )
private

Init routine for SH1106 OLED.

< Initialisation delay in mS

◆ SH1107_begin()

void SH110X_RDL::SH1107_begin ( void  )
private

Init routine for SH1107 OLED.

< Initialisation delay in mS

Member Data Documentation

◆ _DeviceNumGpioChip

int SH110X_RDL::_DeviceNumGpioChip = 0
private

The device number of a gpiochip ls /dev/gpio

◆ _Display_RST

int8_t SH110X_RDL::_Display_RST = -1
private

Reset pin only needed of reset pin is present on display

◆ _GpioHandle

int SH110X_RDL::_GpioHandle = 0
private

This returns a handle to a device.

◆ _I2C_ErrorDelay

uint16_t SH110X_RDL::_I2C_ErrorDelay = 100
private

I2C delay(in between retry attempts) in event of error in mS

◆ _I2C_ErrorFlag

int SH110X_RDL::_I2C_ErrorFlag = 0
private

In event of I2C error holds lgpio error code

◆ _I2C_ErrorRetryNum

uint8_t SH110X_RDL::_I2C_ErrorRetryNum = 3
private

In event of I2C error number of retry attempts

◆ _OLED_HEIGHT

uint8_t SH110X_RDL::_OLED_HEIGHT =64
private

Height of OLED Screen in pixels

◆ _OLED_IC_type

OLED_IC_type_e SH110X_RDL::_OLED_IC_type = SH1106_IC
private

Enum to hold TFT type

◆ _OLED_PAGE_NUM

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

Number of byte size pages OLED screen is divided into

◆ _OLED_WIDTH

uint8_t SH110X_RDL::_OLED_WIDTH =128
private

Width of OLED Screen in pixels

◆ _OLEDbuffer

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

buffer which holds screen data

◆ _OLEDI2CAddress

int SH110X_RDL::_OLEDI2CAddress = SH110X_RDL_ADDR
private

I2C address for I2C module PCF8574 backpack on OLED

◆ _OLEDI2CDevice

int SH110X_RDL::_OLEDI2CDevice = 1
private

An I2C device number.

◆ _OLEDI2CFlags

int SH110X_RDL::_OLEDI2CFlags = 0
private

Flags which modify an I2C open command. None are currently defined.

◆ _OLEDI2CHandle

int SH110X_RDL::_OLEDI2CHandle = 0
private

A number referencing an object opened by one of lgI2cOpen

◆ pageStartOffset

uint8_t SH110X_RDL::pageStartOffset = 0
protected

the SH1106 display requires a small offset

◆ SH110X_CHARGEPUMP

constexpr uint8_t SH110X_RDL::SH110X_CHARGEPUMP = 0x8D
staticconstexprprivate

Charge pump control register

◆ SH110X_COLUMNADDR

constexpr uint8_t SH110X_RDL::SH110X_COLUMNADDR = 0x21
staticconstexprprivate

Column address control register

◆ SH110X_COMMAND_BYTE

constexpr uint8_t SH110X_RDL::SH110X_COMMAND_BYTE = 0x00
staticconstexprprivate

Command byte command

◆ SH110X_COMSCANDEC

constexpr uint8_t SH110X_RDL::SH110X_COMSCANDEC = 0xC8
staticconstexprprivate

Scan from COMN to COM0

◆ SH110X_COMSCANINC

constexpr uint8_t SH110X_RDL::SH110X_COMSCANINC = 0xC0
staticconstexprprivate

Sets the scan direction of common output

◆ SH110X_DATA_BYTE

constexpr uint8_t SH110X_RDL::SH110X_DATA_BYTE = 0x40
staticconstexprprivate

Data byte command

◆ SH110X_DCDC

constexpr uint8_t SH110X_RDL::SH110X_DCDC = 0xAD
staticconstexprprivate

Controls DC-DC voltage convertor

◆ SH110X_DISPLAYALLON

constexpr uint8_t SH110X_RDL::SH110X_DISPLAYALLON = 0xA5
staticconstexprprivate

Set entire Display ON

◆ SH110X_DISPLAYALLON_RESUME

constexpr uint8_t SH110X_RDL::SH110X_DISPLAYALLON_RESUME = 0xA4
staticconstexprprivate

Set entire Display OFF

◆ SH110X_DISPLAYOFF

constexpr uint8_t SH110X_RDL::SH110X_DISPLAYOFF = 0xAE
staticconstexprprivate

Turns off OLED panel

◆ SH110X_DISPLAYON

constexpr uint8_t SH110X_RDL::SH110X_DISPLAYON = 0xAF
staticconstexprprivate

Turns on OLED panel

◆ SH110X_INVERTDISPLAY

constexpr uint8_t SH110X_RDL::SH110X_INVERTDISPLAY = 0xA7
staticconstexprprivate

Inverts Display, no rma rewrite

◆ SH110X_MEMORYMODE

constexpr uint8_t SH110X_RDL::SH110X_MEMORYMODE = 0x20
staticconstexprprivate

Memory mode control register

◆ SH110X_NORMALDISPLAY

constexpr uint8_t SH110X_RDL::SH110X_NORMALDISPLAY = 0xA6
staticconstexprprivate

Normal Display, no ram rewrite

◆ SH110X_PAGEADDR

constexpr uint8_t SH110X_RDL::SH110X_PAGEADDR = 0x22
staticconstexprprivate

Page address control register

◆ SH110X_RDL_ADDR

const uint8_t SH110X_RDL::SH110X_RDL_ADDR = 0x3C

I2C address

◆ SH110X_SEGREMAP

constexpr uint8_t SH110X_RDL::SH110X_SEGREMAP = 0xA0
staticconstexprprivate

Set segment remap, left or right

◆ SH110X_SETCOMPINS

constexpr uint8_t SH110X_RDL::SH110X_SETCOMPINS = 0xDA
staticconstexprprivate

Common signals pad configuration

◆ SH110X_SETCONTRAST

constexpr uint8_t SH110X_RDL::SH110X_SETCONTRAST = 0x81
staticconstexprprivate

Command to set contrast, 256 contrast steps

◆ SH110X_SETDISPLAYCLOCKDIV

constexpr uint8_t SH110X_RDL::SH110X_SETDISPLAYCLOCKDIV = 0xD5
staticconstexprprivate

Set freq of internal clock

◆ SH110X_SETDISPLAYOFFSET

constexpr uint8_t SH110X_RDL::SH110X_SETDISPLAYOFFSET = 0xD3
staticconstexprprivate

Mapping of start line to COM lines

◆ SH110X_SETDISPSTARTLINE

constexpr uint8_t SH110X_RDL::SH110X_SETDISPSTARTLINE = 0xDC
staticconstexprprivate

Specify Column address to determine the initial display line or COM0.

◆ SH110X_SETHIGHCOLUMN

constexpr uint8_t SH110X_RDL::SH110X_SETHIGHCOLUMN = 0x10
staticconstexprprivate

Set higher column address

◆ SH110X_SETLOWCOLUMN

constexpr uint8_t SH110X_RDL::SH110X_SETLOWCOLUMN = 0x00
staticconstexprprivate

Set lower column address

◆ SH110X_SETMULTIPLEX

constexpr uint8_t SH110X_RDL::SH110X_SETMULTIPLEX = 0xA8
staticconstexprprivate

Set multiplex ration

◆ SH110X_SETPAGEADDR

constexpr uint8_t SH110X_RDL::SH110X_SETPAGEADDR = 0xB0
staticconstexprprivate

Specify page address to load display RAM data to page address

◆ SH110X_SETPRECHARGE

constexpr uint8_t SH110X_RDL::SH110X_SETPRECHARGE = 0xD9
staticconstexprprivate

Duration of precharge period

◆ SH110X_SETSTARTLINE

constexpr uint8_t SH110X_RDL::SH110X_SETSTARTLINE = 0x40
staticconstexprprivate

Specifies line address to determine the initial display

◆ SH110X_SETVCOMDETECT

constexpr uint8_t SH110X_RDL::SH110X_SETVCOMDETECT = 0xDB
staticconstexprprivate

Common pad output voltage level deselect stage


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