OpenSourceSimWheelESP32
Open-source wireless steering wheel/button box for ESP32 boards
Loading...
Searching...
No Matches
OLEDBase Struct Reference

Base class for all displays compatible with SSD1306 (I2C interface) More...

#include <OutputHardware.hpp>

Public Types

enum class  Controller : uint8_t { SSD1306 , SH1107 , SH1106 , UNKNOWN }
 OLED controllers that can be automatically detected. More...
 

Public Member Functions

Controller guess_controller () const noexcept
 Guess the OLED controller.
 
bool available () const noexcept
 Check if the OLED was found in the I2C bus.
 

Protected Member Functions

constexpr OLEDBase () noexcept
 Create an uninitialized OLED base object.
 
 OLEDBase (::std::initializer_list< uint8_t > &&try_addresses, I2CBus bus) noexcept
 Create an OLED base object.
 
virtual ~OLEDBase () noexcept
 Destructor.
 
 OLEDBase (const OLEDBase &other) noexcept=delete
 Copy-constructor (deleted)
 
 OLEDBase (OLEDBase &&other) noexcept
 Move-constructor.
 
OLEDBaseoperator= (const OLEDBase &other) noexcept=delete
 Copy-Assignment (deleted)
 
OLEDBaseoperator= (OLEDBase &&other) noexcept
 Move-Assignment.
 
bool write (const uint8_t *buffer, ::std::size_t size) const noexcept
 Raw write.
 
bool write_cmd (uint8_t command) const noexcept
 Write a command with no arguments.
 
bool write_cmd (uint8_t command, uint8_t arg) const noexcept
 Write a command with one argument.
 
bool write_cmd (uint8_t command, uint8_t arg1, uint8_t arg2) const noexcept
 Write a command with two argument.
 
bool write_gdd_ram (const uint8_t *buffer, ::std::size_t size) const noexcept
 Write to GDD RAM.
 
bool read_status (uint8_t &status) const noexcept
 Read the status register.
 

Detailed Description

Base class for all displays compatible with SSD1306 (I2C interface)

Note
Protected methods return false if the device is not responding in the i2C bus

Definition at line 479 of file OutputHardware.hpp.

Member Enumeration Documentation

◆ Controller

enum class OLEDBase::Controller : uint8_t
strong

OLED controllers that can be automatically detected.

Enumerator
SSD1306 

SSD1306 OLED controller.

SH1107 

SH1107 OLED controller.

SH1106 

SH1106 OLED controller.

UNKNOWN 

Unknown OLED controller.

Definition at line 482 of file OutputHardware.hpp.

Constructor & Destructor Documentation

◆ OLEDBase() [1/4]

OLEDBase::OLEDBase ( )
inlineconstexprprotectednoexcept

Create an uninitialized OLED base object.

Definition at line 511 of file OutputHardware.hpp.

◆ OLEDBase() [2/4]

OLEDBase::OLEDBase ( ::std::initializer_list< uint8_t > && try_addresses,
I2CBus bus )
protectednoexcept

Create an OLED base object.

This constructor will probe each I2C address in try_address and use the first available in the I2C bus .

Parameters
try_addressesList of ordered I2C full addresses to try (7 bit format).
busI2C bus

◆ OLEDBase() [3/4]

OLEDBase::OLEDBase ( const OLEDBase & other)
protecteddeletenoexcept

Copy-constructor (deleted)

Parameters
otherInstance to be copied

◆ OLEDBase() [4/4]

OLEDBase::OLEDBase ( OLEDBase && other)
protectednoexcept

Move-constructor.

Parameters
otherInstance to be moved

Member Function Documentation

◆ available()

bool OLEDBase::available ( ) const
inlinenoexcept

Check if the OLED was found in the I2C bus.

Returns
true If the device was responding
false If not

Definition at line 507 of file OutputHardware.hpp.

◆ guess_controller()

Controller OLEDBase::guess_controller ( ) const
noexcept

Guess the OLED controller.

Returns
Controller Automatically-detected controller

◆ operator=() [1/2]

OLEDBase & OLEDBase::operator= ( const OLEDBase & other)
protecteddeletenoexcept

Copy-Assignment (deleted)

Parameters
otherInstance to be copied

◆ operator=() [2/2]

OLEDBase & OLEDBase::operator= ( OLEDBase && other)
protectednoexcept

Move-Assignment.

Parameters
otherInstance to be moved

◆ read_status()

bool OLEDBase::read_status ( uint8_t & status) const
protectednoexcept

Read the status register.

Parameters
[out]statusStatus register if the return value is true
Returns
true On success
false On failure

◆ write()

bool OLEDBase::write ( const uint8_t * buffer,
::std::size_t size ) const
protectednoexcept

Raw write.

Parameters
bufferPointer to commands or data
sizeSize of buffer
Returns
true On success
false On failure

◆ write_cmd() [1/3]

bool OLEDBase::write_cmd ( uint8_t command) const
protectednoexcept

Write a command with no arguments.

Parameters
commandCommand
Returns
true On success
false On failure

◆ write_cmd() [2/3]

bool OLEDBase::write_cmd ( uint8_t command,
uint8_t arg ) const
protectednoexcept

Write a command with one argument.

Parameters
commandCommand
argFirst argument
Returns
true On success
false On failure

◆ write_cmd() [3/3]

bool OLEDBase::write_cmd ( uint8_t command,
uint8_t arg1,
uint8_t arg2 ) const
protectednoexcept

Write a command with two argument.

Parameters
commandCommand
arg1First argument
arg2Second argument
Returns
true On success
false On failure

◆ write_gdd_ram()

bool OLEDBase::write_gdd_ram ( const uint8_t * buffer,
::std::size_t size ) const
protectednoexcept

Write to GDD RAM.

Parameters
bufferPointer to graphics display data
sizeSize of the graphics display data
Returns
true On success
false On failure

The documentation for this struct was generated from the following file: