eglib

Contents

#include <eglib.h>

Functions

These functions initialize eglib_t and control sleep status of the hardware.

void eglib_Init(eglib_t * eglib, const hal_t * hal_driver, void * hal_driver_config_ptr, const display_t * display_driver, void * display_config_ptr)

Initializer for eglib_t. The given HAL driver must be of a bus that the display driver supports.

Parameters
  • eglib – Pointer to eglib_t to be initialized.

  • hal_driver – Pointer to the HAL driver (hal_t) to use.

  • hal_driver_config_ptr – Pointer to the HAL driver configuration. Please refer each HAL driver documentation for details.

  • display_driver – Pointer to the display driver (display_t) to use.

  • display_config_ptr – Pointer to the display driver configuration. Please refer each display driver documentation for details.

See also

eglib_Init_FrameBuffer().

void eglib_SleepIn(eglib_t * eglib)

Puts both HAL and display to sleep. See eglib_SleepOut().

void eglib_SleepOut(eglib_t * eglib)

Takes both HAL and display out of sleep. See eglib_SleepIn()

Types

#include <eglib/types.h>

These types are used by various eglib functions.

enum pixel_format_t

Pixel format used in-memory by displays.

Note

some formats have a difference between the color depth and the bit depth in memory!

PIXEL_FORMAT_1BIT_BW_PAGED

1bit per pixel where each number of bytes equal to the display width is a page, and each page has 8 rows: MSB bits are the upper line, LSB bits are the lower line.

PIXEL_FORMAT_2BIT_EPD

2bits per pixel common across EPD / e-ink displays. The format in memory are 2 independent 1bit per pixel buffers: the first one for 0=black / 1=white, the second one for 0=BW / 1=color (eg: red, yellow).

PIXEL_FORMAT_8BIT_RGB

Each pixel is encoded in 1 byte:

RRRBBBAA

PIXEL_FORMAT_12BIT_RGB

Each pair of pixels are packed in 3 bytes:

RRRRGGGG BBBBRRRR GGGGBBBB

PIXEL_FORMAT_16BIT_RGB

Each pixel is encoded in 2 bytes:

RRRRRGGG GGGBBBBB

PIXEL_FORMAT_18BIT_RGB_24BIT

Each pixel is encoded in 3 bytes. Note that the 2 least significant bits of each byte are always 0: the color depth is 18bit, but the in-memory bit depth is 24bit.

RRRRRR00 GGGGGG00 BBBBBB00

PIXEL_FORMAT_24BIT_RGB

Each pixel is encoded in 3 bytes:

RRRRRRRR GGGGGGGG BBBBBBBB

color_channel_t

Data type for each color channel: red, green, blue.

All drawing functions use this fixed 8-bit color depth and display drivers do color quantization when they only support a lower color depth.

color_t

Color used by drawing functions.

color_channel_t r

Red

color_channel_t g

Green

color_channel_t b

Blue

coordinate_t

Data type for display coordinates used by drawing functions.

eglib_t

Handle used by all eglib functions. It wraps the HAL driver, Display driver and internal library state.

hal_t

Alias for hal_struct.

display_t

Alias for display_struct.