CardSight 0.1.0
C API reference for the CardSight firmware and application
Loading...
Searching...
No Matches
sunxi_display.h File Reference

The panel: its size and pixel format, and the rectangle writes the UI flushes through. More...

#include <stdbool.h>
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  sunxi_display_info
 Geometry and pixel format of the panel. More...

Functions

bool sunxi_display_ready (void)
 Whether the display subsystem probed its panel and can accept writes.
int sunxi_display_get_info (struct sunxi_display_info *info)
 Copy the published panel geometry out.
int sunxi_display_write (uint16_t x_pos, uint16_t y_pos, uint16_t width, uint16_t height, uint16_t pitch, const void *buffer)
 Copy a rectangle to the panel.
int sunxi_display_write_async (uint16_t x_pos, uint16_t y_pos, uint16_t width, uint16_t height, uint16_t pitch, const void *buffer)
 Start a rectangle write without waiting for the wire.
bool sunxi_display_write_done (int *result)
 Report whether the asynchronous write has finished.
void sunxi_display_wait (void)
 Block until the panel is quiet again (the next window command needs it).

Detailed Description

The panel: its size and pixel format, and the rectangle writes the UI flushes through.

Function Documentation

◆ sunxi_display_get_info()

int sunxi_display_get_info ( struct sunxi_display_info * info)

Copy the published panel geometry out.

Parameters
[out]infoReceives the geometry and pixel format.
Returns
0 on success, or -ENODEV when the panel is not ready.

◆ sunxi_display_ready()

bool sunxi_display_ready ( void )

Whether the display subsystem probed its panel and can accept writes.

Returns
true once the panel is up.

◆ sunxi_display_write()

int sunxi_display_write ( uint16_t x_pos,
uint16_t y_pos,
uint16_t width,
uint16_t height,
uint16_t pitch,
const void * buffer )

Copy a rectangle to the panel.

buffer holds RGB888 pixels in the panel byte order (B, G, R on this board; see bytes_per_pixel and pixels_swapped). The window command is sent first, then the pixels go out over SPI; when pitch equals width the whole rectangle is one transfer, otherwise each row is copied separately.

Parameters
[in]x_posLeft edge in panel pixels.
[in]y_posTop edge in panel pixels.
[in]widthRectangle width in pixels.
[in]heightRectangle height in pixels.
[in]pitchSource row width in pixels, including padding.
[in]bufferSource pixels, pitch pixels wide.
Returns
0 on success, or -EINVAL when the panel is not ready or the rectangle is out of bounds.

◆ sunxi_display_write_async()

int sunxi_display_write_async ( uint16_t x_pos,
uint16_t y_pos,
uint16_t width,
uint16_t height,
uint16_t pitch,
const void * buffer )

Start a rectangle write without waiting for the wire.

The window command goes out at once and the second hart pushes the pixels. Poll sunxi_display_write_done() before reusing buffer. Only packed rectangles (pitch == width) are supported.

Parameters
[in]x_posLeft edge in panel pixels.
[in]y_posTop edge in panel pixels.
[in]widthRectangle width in pixels.
[in]heightRectangle height in pixels.
[in]pitchSource row width in pixels; must equal width.
[in]bufferSource pixels.
Returns
0 on success, or -EINVAL for an unsupported or out-of-bounds rectangle.

◆ sunxi_display_write_done()

bool sunxi_display_write_done ( int * result)

Report whether the asynchronous write has finished.

Parameters
[out]resultReceives the write result when the transfer completed.
Returns
true once, when a completed transfer is reported; false while it runs.