15#include "hardware/i2c.h"
22 SH110X(int16_t oledwidth, int16_t oledheight);
34 virtual void drawPixel(int16_t x, int16_t y, uint8_t color)
override;
43 void OLEDFillPage(uint8_t page_num, uint8_t pixels,uint8_t delay);
45 i2c_inst_t* i2c_type = i2c1, uint16_t CLKspeed = 100, uint8_t SDApin = 18, uint8_t SCLKpin = 19);
class to control OLED and define buffer
Definition sh110x.hpp:20
std::span< uint8_t > _OLEDbuffer
Definition sh110x.hpp:91
uint8_t _OLEDAddressI2C
Definition sh110x.hpp:77
static constexpr uint8_t SH110X_DISPLAYALLON_RESUME
Definition sh110x.hpp:106
static constexpr uint8_t SH110X_SETLOWCOLUMN
Definition sh110x.hpp:126
void OLEDBufferScreen(uint8_t w, uint8_t h, std::span< uint8_t > buffer)
Draw the buffer to screen directly to the screen.
Definition sh110x.cpp:404
bool GetDebugMode(void)
getter for debug status
Definition sh110x.cpp:508
uint8_t _SDataPin
Definition sh110x.hpp:78
static constexpr uint8_t SH110X_COMSCANDEC
Definition sh110x.hpp:118
bool _bIsConnected
Definition sh110x.hpp:84
static constexpr uint8_t SH110X_MEMORYMODE
Definition sh110x.hpp:99
static constexpr uint8_t SH110X_ADDR
Definition sh110x.hpp:25
void SetI2CTimeout(uint32_t)
Sets delay the I2C timeout in uS.
Definition sh110x.cpp:557
static constexpr uint8_t SH110X_COMSCANINC
Definition sh110x.hpp:117
static constexpr uint8_t SH110X_CHARGEPUMP
Definition sh110x.hpp:102
void SetIsConnected(bool)
setter for is connected status
Definition sh110x.cpp:501
uint8_t _OLED_HEIGHT
Definition sh110x.hpp:88
void SH1107_begin(void)
Init routine for SH1107 OLED.
Definition sh110x.cpp:215
int16_t CheckConnection(void)
Check Connection Function Check if device is on the bus asks for one byte.
Definition sh110x.cpp:466
static constexpr uint8_t SH110X_PAGEADDR
Definition sh110x.hpp:101
void OLEDFillPage(uint8_t page_num, uint8_t pixels, uint8_t delay)
Fill the chosen page with a data pattern.
Definition sh110x.cpp:313
uint8_t _SClkPin
Definition sh110x.hpp:79
static constexpr uint8_t SH110X_DCDC
Definition sh110x.hpp:112
void OLEDEnable(uint8_t on)
Turns On Display.
Definition sh110x.cpp:261
uint16_t _CLKSpeed
Definition sh110x.hpp:80
uint16_t _I2CRetryDelay
Definition sh110x.hpp:75
static constexpr uint8_t SH110X_SETCOMPINS
Definition sh110x.hpp:122
static constexpr uint8_t SH110X_SETPAGEADDR
Definition sh110x.hpp:115
static constexpr uint8_t SH110X_SETMULTIPLEX
Definition sh110x.hpp:111
static constexpr uint8_t SH110X_SETCONTRAST
Definition sh110x.hpp:103
void SetI2CRetryDelay(uint16_t)
Sets delay in mS between retry attempts in event of I2C error.
Definition sh110x.cpp:544
static constexpr uint8_t SH110X_SETVCOMDETECT
Definition sh110x.hpp:123
uint8_t _OLED_WIDTH
Definition sh110x.hpp:87
i2c_inst_t * _i2c
Definition sh110x.hpp:81
int8_t _Display_RST
Definition sh110x.hpp:96
static constexpr uint8_t SH110X_NORMALDISPLAY
Definition sh110x.hpp:109
static constexpr uint8_t SH110X_SEGREMAP
Definition sh110x.hpp:104
uint8_t _OLED_PAGE_NUM
Definition sh110x.hpp:89
static constexpr uint8_t SH110X_SETDISPSTARTLINE
Definition sh110x.hpp:124
uint32_t _TimeoutDelayI2C
Definition sh110x.hpp:76
void OLEDPowerDown(void)
Disables OLED Call when powering down before OLED_I2C_OFF.
Definition sh110x.cpp:122
uint32_t GetI2CTimeout(void)
Gets I2C timeout value used in I2C functions calls.
Definition sh110x.cpp:551
void OLEDContrast(uint8_t OLEDcontrast)
Adjusts contrast.
Definition sh110x.cpp:271
DisplayRet::Ret_Codes_e OLEDclearBuffer(void)
clears the buffer memory i.e. does NOT write to the screen
Definition sh110x.cpp:385
uint8_t _I2CRetryAttempts
Definition sh110x.hpp:74
static constexpr uint8_t SH110X_DISPLAYOFF
Definition sh110x.hpp:113
static constexpr uint8_t SH110X_INVERTDISPLAY
Definition sh110x.hpp:110
static constexpr uint8_t SH110X_COMMAND_BYTE
Definition sh110x.hpp:130
bool _bSerialDebugFlag
Definition sh110x.hpp:85
static constexpr uint8_t SH110X_SETDISPLAYCLOCKDIV
Definition sh110x.hpp:120
void OLEDReset(void)
Handles OLED reset, if reset pin present on device.
Definition sh110x.cpp:151
void OLEDinit(void)
Called from OLEDbegin carries out Power on sequence and register init.
Definition sh110x.cpp:131
DisplayRet::Ret_Codes_e OLEDupdate(void)
updates the buffer i.e. writes it to the screen
Definition sh110x.cpp:366
DisplayRet::Ret_Codes_e OLEDbegin(OLED_IC_type_e OLEDtype=SH1106_IC, int8_t resetPin=-1, uint8_t I2Caddress=0x3C, i2c_inst_t *i2c_type=i2c1, uint16_t CLKspeed=100, uint8_t SDApin=18, uint8_t SCLKpin=19)
begin Method initialise OLED I2C communication
Definition sh110x.cpp:62
virtual void drawPixel(int16_t x, int16_t y, uint8_t color) override
Draws a Pixel to the screen overrides the graphics lib.
Definition sh110x.cpp:428
static constexpr uint8_t SH110X_SETDISPLAYOFFSET
Definition sh110x.hpp:119
static constexpr uint8_t SH110X_COLUMNADDR
Definition sh110x.hpp:100
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
Definition sh110x.cpp:33
static constexpr uint8_t SH110X_DISPLAYON
Definition sh110x.hpp:114
OLED_IC_type_e
Definition sh110x.hpp:29
@ SH1107_IC
Definition sh110x.hpp:31
@ SH1106_IC
Definition sh110x.hpp:30
static constexpr uint8_t SH110X_SETHIGHCOLUMN
Definition sh110x.hpp:127
static constexpr uint8_t SH110X_DISPLAYALLON
Definition sh110x.hpp:108
void SetI2CRetryAttemptsNo(uint8_t)
Sets the Number of I2C retry Attempts in event of I2C bus error Set to zero for NO retry attempts.
Definition sh110x.cpp:531
static constexpr uint8_t SH110X_SETPRECHARGE
Definition sh110x.hpp:121
void OLED_I2C_OFF(void)
End I2C operations.
Definition sh110x.cpp:106
void SetDebugMode(bool)
setter for debug status
Definition sh110x.cpp:515
uint16_t GetI2CRetryDelay(void)
Gets delay in mS between retry attempts in event of I2C error.
Definition sh110x.cpp:538
void OLEDInvert(bool on)
invert the display
Definition sh110x.cpp:282
void OLEDFillScreen(uint8_t pixel, uint8_t mircodelay)
Fill the screen NOT the buffer with a datapattern.
Definition sh110x.cpp:292
OLED_IC_type_e _OLED_IC_type
Definition sh110x.hpp:93
static constexpr uint8_t SH110X_DATA_BYTE
Definition sh110x.hpp:131
bool GetIsConnected(void)
getter for is connected status
Definition sh110x.cpp:494
uint8_t pageStartOffset
Definition sh110x.hpp:90
void I2CWriteByte(uint8_t value=0x00, uint8_t DataOrCmd=SH110X_COMMAND_BYTE)
Writes a byte to I2C address,command or data, used internally.
Definition sh110x.cpp:333
uint8_t GetI2CRetryAttemptsNo(void)
Gets the Number of I2C retry Attempts in event of I2C bus error Set to zero for NO retry attempts....
Definition sh110x.cpp:524
static constexpr uint8_t SH110X_SETSTARTLINE
Definition sh110x.hpp:128
void SH1106_begin(void)
Init routine for SH1106 OLED.
Definition sh110x.cpp:165
Graphics class to hold graphic related functions.
Definition display_graphics.hpp:22
int16_t height(void) const
Gets the height of the display (per current _rotation)
Definition display_graphics.cpp:677
int16_t width(void) const
Gets the width of the display (per current _rotation)
Definition display_graphics.cpp:668
header file for the graphics based functions, 1-bit color displays.
Ret_Codes_e
Definition display_data.hpp:32