LCDGFX LCD display driver  2.0.1
This library is developed to control SSD1306/SSD1325/SSD1327/SSD1331/SSD1351/IL9163/PCD8554 RGB i2c/spi LED displays
Classes | Macros | Typedefs | Functions
HAL: ssd1306 library hardware abstraction layer

i2c/spi ssd1306 library hardware abstraction layer More...

Classes

class  PlatformI2c
 
class  PlatformSpi
 
struct  ssd1306_platform_i2cConfig_t
 

Macros

#define LCDINT_TYPES_DEFINED
 
#define ssd1306_swap_data(a, b, type)   { type t = a; a = b; b = t; }
 
#define LCD_LOW   0
 
#define LCD_HIGH   1
 
#define LCD_GPIO_INPUT   0
 
#define LCD_GPIO_OUTPUT   1
 
#define LCD_PROGMEM   PROGMEM
 

Typedefs

typedef int lcdint_t
 
typedef unsigned int lcduint_t
 

Functions

void lcd_gpioMode (int pin, int mode)
 
int lcd_gpioRead (int pin)
 
void lcd_gpioWrite (int pin, int level)
 
int lcd_adcRead (int pin)
 
uint32_t lcd_millis (void)
 
uint32_t lcd_micros (void)
 
void lcd_randomSeed (int seed)
 
void attachInterrupt (int pin, void(*interrupt)(), int level)
 
void lcd_delay (unsigned long ms)
 
void lcd_delayUs (unsigned long us)
 
uint8_t lcd_pgmReadByte (const void *ptr)
 
uint16_t lcd_eepromReadWord (const void *ptr)
 
void lcd_eepromWriteWord (const void *ptr, uint16_t val)
 
int lcd_random (int max)
 
int lcd_random (int min, int max)
 
void ssd1306_platform_i2cInit (int8_t busId, uint8_t addr, ssd1306_platform_i2cConfig_t *cfg)
 Initializes i2c interface for platform being used. More...
 
void ssd1306_platform_spiInit (int8_t busId, int8_t cesPin, int8_t dcPin)
 Initializes spi interface for platform being used. More...
 

Detailed Description

i2c/spi ssd1306 library hardware abstraction layer

ssd1306 library hardware abstraction layer

Macro Definition Documentation

◆ LCD_GPIO_INPUT

#define LCD_GPIO_INPUT   0

Constant corresponds to input mode of gpio

Definition at line 144 of file io.h.

◆ LCD_GPIO_OUTPUT

#define LCD_GPIO_OUTPUT   1

Consrant corresponds to output mode of gpio

Definition at line 146 of file io.h.

◆ LCD_HIGH

#define LCD_HIGH   1

Constant corresponds to high level of gpio pin

Definition at line 142 of file io.h.

◆ LCD_LOW

#define LCD_LOW   0

Constant corresponds to low level of gpio pin

Definition at line 140 of file io.h.

◆ LCD_PROGMEM

#define LCD_PROGMEM   PROGMEM

LCD_PROGMEM constant is used to specify data stored in flash, platform specific

Definition at line 150 of file io.h.

◆ LCDINT_TYPES_DEFINED

#define LCDINT_TYPES_DEFINED

Macro informs if lcdint_t type is defined

Definition at line 94 of file io.h.

◆ ssd1306_swap_data

#define ssd1306_swap_data (   a,
  b,
  type 
)    { type t = a; a = b; b = t; }

swaps content of a and b variables of type type

Definition at line 102 of file io.h.

Typedef Documentation

◆ lcdint_t

typedef int lcdint_t

internal int type, used by ssd1306 library. Important for uC with low SRAM

Definition at line 96 of file io.h.

◆ lcduint_t

typedef unsigned int lcduint_t

internal int type, used by ssd1306 library. Important for uC with low SRAM

Definition at line 98 of file io.h.

Function Documentation

◆ attachInterrupt()

void attachInterrupt ( int  pin,
void(*)()  interrupt,
int  level 
)

Attaches interrupt handler to pin. Not implemented on many platforms

Parameters
pingpio pin number to attach interrupt handler to
interruptinterrupt handler
levelgpio state to aim interrupt

◆ lcd_adcRead()

int lcd_adcRead ( int  pin)

Read ADC data

Parameters
pinadc pin to read (platform-specific)
Returns
integer value corresponding to provided gpio pin. actual value range depends on platform and ADC mode.

◆ lcd_delay()

void lcd_delay ( unsigned long  ms)

Forces current thread to sleeps for specified number of milliseconds

Parameters
mstime in milliseconds

◆ lcd_delayUs()

void lcd_delayUs ( unsigned long  us)

Forces current thread to sleeps for specified number of microseconds

Parameters
ustime in microseconds

◆ lcd_eepromReadWord()

uint16_t lcd_eepromReadWord ( const void *  ptr)

Reads 16-bit from eeprom

Parameters
ptrpointer to eeprom memory to read
Returns
16-bit number from eeprom

◆ lcd_eepromWriteWord()

void lcd_eepromWriteWord ( const void *  ptr,
uint16_t  val 
)

Writes 16-bit to eeprom

Parameters
ptrpointer to eeprom memory to write data to
val16-bit value to write

◆ lcd_gpioMode()

void lcd_gpioMode ( int  pin,
int  mode 
)

Sets gpio pin mode

Parameters
pinpin number to change mode of
modenew gpio mode: LCD_GPIO_INPUT or LCD_GPIO_OUTPUT

◆ lcd_gpioRead()

int lcd_gpioRead ( int  pin)

Reads gpio pin value

Parameters
pingpio pin number to read
Returns
LCD_HIGH or LCD_LOW

◆ lcd_gpioWrite()

void lcd_gpioWrite ( int  pin,
int  level 
)

Writes value to gpio

Parameters
pingpio pin number to change
levelLCD_HIGH or LCD_LOW

◆ lcd_micros()

uint32_t lcd_micros ( void  )

returns 32-bit timestamp from system power-up in microseconds

◆ lcd_millis()

uint32_t lcd_millis ( void  )

returns 32-bit timestamp from system power-up in milliseconds

◆ lcd_pgmReadByte()

uint8_t lcd_pgmReadByte ( const void *  ptr)

Read single data byte directly from flash. This function is valid only for AVR platform. For other platforms, it reads byte, pointed by ptr.

Parameters
ptrpointer to data in flash
Returns
returns single byte read.

◆ lcd_random() [1/2]

int lcd_random ( int  max)

Returns random number in range [0;max]

Parameters
maxupper limit for number being generated

◆ lcd_random() [2/2]

int lcd_random ( int  min,
int  max 
)

Returns random number in range [min;max]

Parameters
minlower limit for number being generated
maxupper limit for number being generated

◆ lcd_randomSeed()

void lcd_randomSeed ( int  seed)

Initializes RND device

Parameters
seedunique number to use for initialization

◆ ssd1306_platform_i2cInit()

void ssd1306_platform_i2cInit ( int8_t  busId,
uint8_t  addr,
ssd1306_platform_i2cConfig_t cfg 
)

Initializes i2c interface for platform being used.

Initializes i2c interface for platform being used. i2c implementation depends on platform.

Parameters
busIdi2c bus number. Some platforms have several i2c buses. so, this argument identifies bus to use. For several platforms busId is not used. If you want to use default i2c bus for specific platform, please pass -1.
addri2c address of oled driver, connected to i2c bus. If you want to use default i2c display address, please, pass 0.
cfgSpecify scl and sda for the platform. If you want to use default pin numbers, please pass -1 for both members.

◆ ssd1306_platform_spiInit()

void ssd1306_platform_spiInit ( int8_t  busId,
int8_t  cesPin,
int8_t  dcPin 
)

Initializes spi interface for platform being used.

Initializes spi interface for platform being used. spi implementation depends on platform.

Parameters
busIdspi bus number if device has several spi buses. For most AVR platforms busId is not used. If you want to use default spi bus for specific platform, please pass -1.
cesPinchip select (chip enable) pin number. If you want to use default pin, hard coded by ssd1306 library, please, pass -1. For Linux platform cesPin means second number in spidev device.
dcPindata/command pin number. For most oled displays this pin number is used to select data or command mode for the bus. If you want to use default pin number, please pass -1.