DISPLAY

This is the interface for accessing displays. The driver allows an application to load the video memory pointer as well as the width and height of the device.

When an application accesses the LCD, it must issue a HOLD before modifying the memory and a RELEASE when modification is complete.

int fd;
display_info_t attr;

fd = open("/dev/lcd0", O_RDWR);
ioctl(fd, I_DISPLAY_GETINFO, &attr);
ioctl(fd, I_DISPLAY_REFRESH, &attr);
 //the display will refresh based on the value of attr.freq (usually in the tens of hertz range)

Details

define DISPLAY_VERSION

define DISPLAY_IOC_CHAR

define I_DISPLAY_GETVERSION

define I_DISPLAY_GETINFO

This request gets the attributes of the device.

Example:

display_info_t info;
ioctl(fildes, I_DISPLAY_GETINFO, &info);

define I_DISPLAY_SETATTR

define I_DISPLAY_SETACTION

define I_DISPLAY_CLEAR

This request clears the LCD. This does not affect the video memory. This is only supported on devices that include a way to clear the memory using a hardware command.

Example:

ioctl(fildes, I_DISPLAY_CLEAR);

define I_DISPLAY_REFRESH

This request tells the driver to update the display as soon as possible.

Example:

ioctl(fildes, I_DISPLAY_REFRESH);

define I_DISPLAY_ISBUSY

Returns a positive value if the display is busy.

Example:

if( ioctl(fildes, I_DISPLAY_ISBUSY) > 0 ){
     //display is busy refreshing -- don't modify the display memory while display is busy
}

define I_DISPLAY_GETPALETTE

Gets the palette attributes of the display.

Example:

display_palette_t palette;
ioctl(fildes, I_DISPLAY_GETPALETTE, &palette);

define I_DISPLAY_TOTAL

enum @8
  • DISPLAY_PALETTE_PIXEL_FORMAT_1BPP
  • DISPLAY_PALETTE_PIXEL_FORMAT_RGB444
  • DISPLAY_PALETTE_PIXEL_FORMAT_RGB565
  • DISPLAY_PALETTE_PIXEL_FORMAT_RGB666
  • DISPLAY_PALETTE_PIXEL_FORMAT_RGB888

enum display_flags
  • DISPLAY_FLAG_INIT Initializes the display
  • DISPLAY_FLAG_SET_WINDOW Sets the window used when writing to the display
  • DISPLAY_FLAG_CLEAR Clears the display
  • DISPLAY_FLAG_ENABLE Enables the display
  • DISPLAY_FLAG_DISABLE Disables the display
  • DISPLAY_FLAG_SET_MODE Sets the write mode to either raw or palette
  • DISPLAY_FLAG_IS_MODE_RAW Data is written directly to the display
  • DISPLAY_FLAG_IS_MODE_PALETTE Data is interpreted as a bitmap and is mapped using the palette

struct::display_palette_pixel_format_rgb444_t

u8 r4g4

u8 b4r4

u8 g4b4

struct::display_palette_pixel_format_rgb888_t

u8 r8

u8 b8

u8 g8

struct::display_palette_pixel_format_rgb666_t

u8 r6x2

u8 b6x2

u8 g6x2

struct::display_palette_pixel_format_rgb565_t

u8 r5g3

u8 g3b5

struct::display_palette_t

The display palette converts the bits_per_pixel to a native color. For example, if there are two bits per pixel, the display driver can handle 4 colors. The palette defines how those four colors are mapped to the display.

u8 pixel_format

Pixel format of the display (e.g. DISPLAY_PALETTE_PIXEL_FORMAT_RGB565)

u8 count

The number of pixel entries in the palette

void * colors

A pointer to the colors in the palette (should point to shareable memory)


struct::display_attr_t

u32 o_flags

Flags used for performing various actions like DISPLAY_FLAG_INIT

s16 window_x

x position for the window (used with DISPLAY_FLAG_SET_WINDOW)

s16 window_y

y position for the window (used with DISPLAY_FLAG_SET_WINDOW)

s16 window_width

window width (used with DISPLAY_FLAG_SET_WINDOW)

s16 window_height

window height (used with DISPLAY_FLAG_SET_WINDOW)

u32 resd

struct::display_info_t

This contains the attributes of a display.

u32 o_flags

u32 freq

u16 width

u16 height

u16 cols

u16 rows

u16 bits_per_pixel

The number of bits in each pixel: 1, 2, 4, 8, 16, 24, or 32

u16 margin_left

u16 margin_right

u16 margin_top

u16 margin_bottom

u32 resd

X

Thanks for Coming!

Subscribe to news and updates