libpynq (release 5EWC0-2023 version 0.2.2 of 2023-09-24 22:22)
|
Data Structures | |
struct | display_t |
Macros | |
#define | DISPLAY_HEIGHT 240 |
#define | DISPLAY_WIDTH 240 |
Enumerations | |
enum | colors { RGB_RED = 0xf800 , RGB_GREEN = 0x07e0 , RGB_BLUE = 0x001f , RGB_BLACK = 0x0000 , RGB_WHITE = 0xffff , RGB_GRAY = 0x8c51 , RGB_YELLOW = 0xFFE0 , RGB_CYAN = 0x07FF , RGB_PURPLE = 0xF81F } |
enum | directions { TEXT_DIRECTION0 = 0 , TEXT_DIRECTION90 = 1 , TEXT_DIRECTION180 = 2 , TEXT_DIRECTION270 = 3 , NUM_TEXT_DIRECTIONS } |
Functions | |
void | display_init (display_t *display) |
void | display_destroy (display_t *display) |
void | displayDrawPixel (display_t *display, uint16_t x, uint16_t y, uint16_t color) |
void | displayDrawFillRect (display_t *display, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color) |
void | displayFillScreen (display_t *display, uint16_t color) |
void | displayDrawLine (display_t *display, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color) |
void | displayDrawRect (display_t *display, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color) |
void | displayDrawRectAngle (display_t *display, uint16_t xc, uint16_t yc, uint16_t w, uint16_t h, uint16_t angle, uint16_t color) |
void | displayDrawTriangleCenter (display_t *display, uint16_t xc, uint16_t yc, uint16_t w, uint16_t h, uint16_t angle, uint16_t color) |
void | displayDrawCircle (display_t *display, uint16_t x_center, uint16_t y_center, uint16_t r, uint16_t color) |
void | displayDrawFillCircle (display_t *display, uint16_t x_center, uint16_t y_center, uint16_t r, uint16_t color) |
void | displayDrawRoundRect (display_t *display, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t r, uint16_t color) |
uint16_t | rgb_conv (uint16_t r, uint16_t g, uint16_t b) |
int | displayDrawChar (display_t *display, FontxFile *fx, uint16_t x, uint16_t y, uint8_t ascii, uint16_t color) |
int | displayDrawString (display_t *display, FontxFile *fx, uint16_t x, uint16_t y, uint8_t *ascii, uint16_t color) |
void | displaySetFontDirection (display_t *display, uint16_t dir) |
void | displaySetFontFill (display_t *display, uint16_t color) |
void | displayUnsetFontFill (display_t *display) |
void | displaySetFontUnderLine (display_t *display, uint16_t color) |
void | displayUnsetFontUnderLine (display_t *display) |
void | displayDisplayOff (display_t *display) |
void | displayDisplayOn (display_t *display) |
void | displayBacklightOff (display_t *display) |
void | displayBacklightOn (display_t *display) |
void | displayInversionOff (display_t *display) |
void | displayInversionOn (display_t *display) |
void | displayDrawTriangle (display_t *display, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t x3, uint16_t y3, uint16_t color) |
void | display_set_flip (display_t *display, bool xflip, bool yflip) |
Wrappers to simplify the use of the TFT LCD display.
Define a display_t display (called the display "handle"), initialise it, and pass this as the first parameter to all functions.
An example of how to use this library.
enum colors |
enum directions |
void display_destroy | ( | display_t * | display | ) |
Stop using the display.
display | Handle to display. |
void display_init | ( | display_t * | display | ) |
void display_set_flip | ( | display_t * | display, |
bool | xflip, | ||
bool | yflip | ||
) |
void displayBacklightOff | ( | display_t * | display | ) |
void displayBacklightOn | ( | display_t * | display | ) |
void displayDisplayOff | ( | display_t * | display | ) |
void displayDisplayOn | ( | display_t * | display | ) |
int displayDrawChar | ( | display_t * | display, |
FontxFile * | fx, | ||
uint16_t | x, | ||
uint16_t | y, | ||
uint8_t | ascii, | ||
uint16_t | color | ||
) |
Draws a character on the given coordinates of the display.
display | Handle to display. |
fx | Pointer to font-file that is used for drawing the text. |
x | The x-coordinate of the text on the display. |
y | The y-coordinate of the text on the display. |
ascii | The ascii character to draw. |
color | The 16-bit color value to write. |
Definition at line 778 of file display.c.
void displayDrawCircle | ( | display_t * | display, |
uint16_t | x_center, | ||
uint16_t | y_center, | ||
uint16_t | r, | ||
uint16_t | color | ||
) |
Draw a circle without infill on the display.
display | Handle to display. |
x_center | X-coordinate of the center of the circle. |
y_center | Y-coordinate of the center of the circle. |
r | The radius of the circle in pixels. |
color | The 16-bit color value to write. |
Definition at line 617 of file display.c.
void displayDrawFillCircle | ( | display_t * | display, |
uint16_t | x_center, | ||
uint16_t | y_center, | ||
uint16_t | r, | ||
uint16_t | color | ||
) |
Draw a circle with infill on the display.
display | Handle to display. |
x_center | X-coordinate of the center of the circle. |
y_center | Y-coordinate of the center of the circle. |
r | The radius of the circle in pixels. |
color | The 16-bit color value to write. |
Definition at line 658 of file display.c.
void displayDrawFillRect | ( | display_t * | display, |
uint16_t | x1, | ||
uint16_t | y1, | ||
uint16_t | x2, | ||
uint16_t | y2, | ||
uint16_t | color | ||
) |
Draw a filled rectangle to the display.
display | Handle to display. |
x1 | The X coordinate of the top-left corner of the rectangle. |
y1 | The Y coordinate of the top-left corner of the rectangle. |
x2 | The X coordinate of the bottom-right corner of the rectangle. |
y2 | The Y coordinate of the bottom-right corner of the rectangle. |
color | The 16-bit color value to write. |
Definition at line 357 of file display.c.
void displayDrawLine | ( | display_t * | display, |
uint16_t | x1, | ||
uint16_t | y1, | ||
uint16_t | x2, | ||
uint16_t | y2, | ||
uint16_t | color | ||
) |
Draw a line from two coordinates.
display | Handle to display. |
x1 | Starting x-coordinate of line. |
y1 | Starting y-coordinate of line. |
x2 | Ending x-coordinate of line. |
y2 | Ending y-coordinate of line. |
color | The 16-bit color value to write. |
Definition at line 421 of file display.c.
void displayDrawPixel | ( | display_t * | display, |
uint16_t | x, | ||
uint16_t | y, | ||
uint16_t | color | ||
) |
Draw a single pixel to the display.
display | Handle to display. |
x | The X coordinate of the pixel. |
y | The Y coordinate of the pixel. |
color | The 16-bit color value to write. |
Definition at line 313 of file display.c.
void displayDrawRect | ( | display_t * | display, |
uint16_t | x1, | ||
uint16_t | y1, | ||
uint16_t | x2, | ||
uint16_t | y2, | ||
uint16_t | color | ||
) |
Draw a filled rectangle.
display | Handle to display. |
x1 | Top-left x-coordinate of rectangle. |
y1 | Top-left y-coordinate of rectangle. |
x2 | Bottom-right x-coordinate of rectangle. |
y2 | Bottom-right y-coordinate of rectangle. |
color | The 16-bit color value to write. |
Definition at line 474 of file display.c.
void displayDrawRectAngle | ( | display_t * | display, |
uint16_t | xc, | ||
uint16_t | yc, | ||
uint16_t | w, | ||
uint16_t | h, | ||
uint16_t | angle, | ||
uint16_t | color | ||
) |
Draws a rectangle with rounded corners at a specified angle on the display.
display | Handle to display. |
xc | X-coordinate of the center of the rectangle. |
yc | Y-coordinate of the center of the rectangle. |
w | Width of the rectangle. |
h | Height of the rectangle. |
angle | Angle of rotation in degrees. |
color | The 16-bit color value to write. |
Definition at line 492 of file display.c.
void displayDrawRoundRect | ( | display_t * | display, |
uint16_t | x1, | ||
uint16_t | y1, | ||
uint16_t | x2, | ||
uint16_t | y2, | ||
uint16_t | r, | ||
uint16_t | color | ||
) |
Draw a rectangle with rounded angles.
display | Handle to display. |
x1 | Top-left x-coordinate of rectangle. |
y1 | Top-left y-coordinate of rectangle. |
x2 | Bottom-right x-coordinate of rectangle. |
y2 | Bottom-right y-coordinate of rectangle. |
r | The radius of the circle that is used for the edges. |
color | The 16-bit color value to write. |
Definition at line 704 of file display.c.
int displayDrawString | ( | display_t * | display, |
FontxFile * | fx, | ||
uint16_t | x, | ||
uint16_t | y, | ||
uint8_t * | ascii, | ||
uint16_t | color | ||
) |
Function to draw a string on the display.
display | Handle to display. |
fx | Pointer to font-file that is used for drawing the text. |
x | The x-coordinate of the text on the display. |
y | The y-coordinate of the text on the display. |
ascii | The ascii characters to draw. |
color | The 16-bit color value to write. |
Definition at line 947 of file display.c.
void displayDrawTriangle | ( | display_t * | display, |
uint16_t | x1, | ||
uint16_t | y1, | ||
uint16_t | x2, | ||
uint16_t | y2, | ||
uint16_t | x3, | ||
uint16_t | y3, | ||
uint16_t | color | ||
) |
Draw a triangle without infill between the three given points in the given color.
display | Handle to display. |
x1 | The first X-coordinate of the triangle. |
y1 | The first Y-coordinate of the triangle. |
x2 | The second X-coordinate of the triangle. |
y2 | The second Y-coordinate of the triangle. |
x3 | The third X-coordinate of the triangle. |
y3 | The third Y-coordinate of the triangle. |
color | The 16-bit color value to write. |
Definition at line 549 of file display.c.
void displayDrawTriangleCenter | ( | display_t * | display, |
uint16_t | xc, | ||
uint16_t | yc, | ||
uint16_t | w, | ||
uint16_t | h, | ||
uint16_t | angle, | ||
uint16_t | color | ||
) |
Draws a triangle at a specified angle on the display.
display | Handle to display. |
xc | X-coordinate of the center of the rectangle. |
yc | Y-coordinate of the center of the rectangle. |
w | Width of the rectangle. |
h | Height of the rectangle. |
angle | Angle of rotation in degrees. |
color | The 16-bit color value to write. |
Definition at line 576 of file display.c.
void displayFillScreen | ( | display_t * | display, |
uint16_t | color | ||
) |
void displayInversionOff | ( | display_t * | display | ) |
void displayInversionOn | ( | display_t * | display | ) |
void displaySetFontDirection | ( | display_t * | display, |
uint16_t | dir | ||
) |
void displaySetFontFill | ( | display_t * | display, |
uint16_t | color | ||
) |
void displaySetFontUnderLine | ( | display_t * | display, |
uint16_t | color | ||
) |
void displayUnsetFontFill | ( | display_t * | display | ) |
void displayUnsetFontUnderLine | ( | display_t * | display | ) |