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

Monochrome OLED. More...

#include <OutputHardware.hpp>

Public Member Functions

constexpr OLED ()
 Create an uninitialized OLED.
 
 OLED (const OLEDParameters &params, I2CBus bus)
 Create an OLED using any of the default I2C addresses.
 
 OLED (const OLEDParameters &params, uint8_t address7bits, I2CBus bus)
 Create an OLED using a specific I2C address.
 
 OLED (const OLED &other) noexcept=delete
 Copy-constructor (deleted)
 
 OLED (OLED &&other) noexcept=default
 Move-constructor (default)
 
OLEDoperator= (const OLED &other) noexcept=delete
 Copy-Assignment (deleted)
 
OLEDoperator= (OLED &&other) noexcept=default
 Move-Assignment (default)
 
OLEDParameters parameters () const noexcept
 Get the OLED parameters passed in the constructor.
 
::std::size_t frame_size () const noexcept
 Get the frame size in bytes.
 
void contrast (uint8_t value)
 Set the display contrast.
 
void enable_display (bool yesOrNo)
 Enable/Disable GDD RAM display.
 
void turn (bool onOrOff)
 Turn display on/off.
 
void inverse_display (bool yesOrNo)
 Switch pixel colors.
 
void clear (bool inverted=false)
 Clear the display.
 
void show (const uint8_t *frame)
 Display a frame at once.
 
- Public Member Functions inherited from OLEDBase
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

void init ()
 Initialize the display (called from the constructor)
 
void locate (uint8_t x, uint8_t page)
 Set the start page and start column before display.
 
uint8_t row2col (uint8_t bit_index, const uint8_t *from, uint8_t row_count)
 Utility function to translate a row-major vector graphic to the column-major format used by OLED screens.
 
- Protected Member Functions inherited from OLEDBase
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.
 

Protected Attributes

OLEDParameters _params
 OLED parameters given in the constructor.
 
uint8_t width_b
 Screen width in bytes.
 
uint8_t height_b
 Screen height in bytes.
 

Additional Inherited Members

- Public Types inherited from OLEDBase
enum class  Controller : uint8_t { SSD1306 , SH1107 , SH1106 , UNKNOWN }
 OLED controllers that can be automatically detected. More...
 

Detailed Description

Monochrome OLED.

Definition at line 616 of file OutputHardware.hpp.

Constructor & Destructor Documentation

◆ OLED() [1/5]

OLED::OLED ( )
inlineconstexpr

Create an uninitialized OLED.

Definition at line 620 of file OutputHardware.hpp.

◆ OLED() [2/5]

OLED::OLED ( const OLEDParameters & params,
I2CBus bus )

Create an OLED using any of the default I2C addresses.

Parameters
paramsOLED parameters
busI2C Bus

◆ OLED() [3/5]

OLED::OLED ( const OLEDParameters & params,
uint8_t address7bits,
I2CBus bus )

Create an OLED using a specific I2C address.

Parameters
paramsOLED parameters
address7bitsFull 7-bit I2C address
busI2C Bus

◆ OLED() [4/5]

OLED::OLED ( const OLED & other)
deletenoexcept

Copy-constructor (deleted)

Parameters
otherInstance to be copied

◆ OLED() [5/5]

OLED::OLED ( OLED && other)
defaultnoexcept

Move-constructor (default)

Parameters
otherInstance to be moved

Member Function Documentation

◆ clear()

void OLED::clear ( bool inverted = false)

Clear the display.

Parameters
invertedTrue for white, false for black.

◆ contrast()

void OLED::contrast ( uint8_t value)

Set the display contrast.

Parameters
valueContrast. Higher means more contrast.

◆ enable_display()

void OLED::enable_display ( bool yesOrNo)

Enable/Disable GDD RAM display.

Parameters
yesOrNoTrue to enable, false to Disable

◆ frame_size()

::std::size_t OLED::frame_size ( ) const
inlinenoexcept

Get the frame size in bytes.

Definition at line 669 of file OutputHardware.hpp.

◆ locate()

void OLED::locate ( uint8_t x,
uint8_t page )
protected

Set the start page and start column before display.

Note
The controller is configured in "page" mode
Parameters
xColumn (or segment) index
pagePage index

◆ operator=() [1/2]

OLED & OLED::operator= ( const OLED & other)
deletenoexcept

Copy-Assignment (deleted)

Parameters
otherInstance to be copied

◆ operator=() [2/2]

OLED & OLED::operator= ( OLED && other)
defaultnoexcept

Move-Assignment (default)

Parameters
otherInstance to be moved

◆ parameters()

OLEDParameters OLED::parameters ( ) const
inlinenoexcept

Get the OLED parameters passed in the constructor.

Returns
OLED parameters

Definition at line 666 of file OutputHardware.hpp.

◆ row2col()

uint8_t OLED::row2col ( uint8_t bit_index,
const uint8_t * from,
uint8_t row_count )
inlineprotected

Utility function to translate a row-major vector graphic to the column-major format used by OLED screens.

Parameters
bit_indexColumn index in a single byte, range [0,7]
fromPointer to the frame buffer's first row and column
row_countNumber of rows to translate, range [0,8]
Returns
uint8_t byte representing an 1x8 chunk (one segment in one page)

◆ show()

void OLED::show ( const uint8_t * frame)

Display a frame at once.

Parameters
framePointer to a frame buffer.

◆ turn()

void OLED::turn ( bool onOrOff)

Turn display on/off.

Parameters
onOrOffTrue to turn on, false to turn off.

Member Data Documentation

◆ _params

OLEDParameters OLED::_params
protected

OLED parameters given in the constructor.

Definition at line 699 of file OutputHardware.hpp.

◆ height_b

uint8_t OLED::height_b
protected

Screen height in bytes.

Definition at line 703 of file OutputHardware.hpp.

◆ width_b

uint8_t OLED::width_b
protected

Screen width in bytes.

Definition at line 701 of file OutputHardware.hpp.


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