linux-st7735/st7735.h

101 lines
2.8 KiB
C
Raw Normal View History

2020-08-01 19:49:42 +00:00
#ifndef uint8
#define uint8 unsigned char
#endif
typedef struct
{
int cs, a0, rs;
uint8 width, height;
} lcd_t;
/*
* Initialize the display and create a data structure for it.
* The last initialized display is active.
*
* Parameters:
* spiSpeed - Speed of the SPI interface.
* cs - Chip selection pin.
* a0 - Data/Command pin.
* rs - Optional reset pin. If you do not use it, enter -1.
*
* Return: Pointer to the structure with display data.
*
*/
lcd_t *lcd_init(int spiSpeed, int cs, int a0, int rs);
/*
* Reset the specified display and clear the previously assigned memory.
*
* Parameters:
* display - Pointer to the structure with display data.
*
* Return: void
*/
void lcd_deinit(lcd_t *display);
/*
* Set the drawing area on the currently active display.
*
* Parameters:
* x1 - The X parameter of the first point.
* y1 - The Y parameter of the first point.
* x2 - The X parameter of the second point.
* y2 - The Y parameter of the second point.
*
* Return: Confirmation of the occurrence or non-occurrence of an error.
* 0 - The error did not occur; 1 - The error occurred.
*
*/
uint8 lcd_setWindow(uint8 x1, uint8 y1, uint8 x2, uint8 y2);
/*
* Draw one pixel on the currently active display.
* The color intensity scale for a normal pixel is from 0 to 255.
* The color intensity scale for the reduced pixel is from 0 to 15.
*
* Parameters:
* x - The X parameter of the pixel.
* y - The Y parameter of the pixel.
* r - The intensity of the red color.
* g - The intensity of the green color.
* b - The intensity of the blue color.
*
* Return: void
*/
void lcd_drawPx(uint8 x, uint8 y, uint8 r, uint8 g, uint8 b);
/*
* Draw a filled rectangle on the currently active display.
* The color intensity scale for a normal pixel is from 0 to 255.
* The color intensity scale for the reduced pixel is from 0 to 15.
*
* Parameters:
* x - Parameter X of the upper left corner of the rectangle.
* y - Parameter Y of the upper left corner of the rectangle.
* w - The width of the rectangle.
* h - The height of the rectangle.
* r - The intensity of the red color.
* g - The intensity of the green color.
* b - The intensity of the blue color.
*
* Return: void
*/
void lcd_fillRect(uint8 x, uint8 y, uint8 w, uint8 h, uint8 r, uint8 g, uint8 b);
/*
* Fill the entire screen with one color of the currently active display.
* The color intensity scale for a normal pixel is from 0 to 255.
* The color intensity scale for the reduced pixel is from 0 to 15.
*
* Parameters:
* r - The intensity of the red color.
* g - The intensity of the green color.
* b - The intensity of the blue color.
*
* Return: void
*/
void lcd_fillScreen(uint8 r, uint8 g, uint8 b);
void lcd_printChar(uint8 x, uint8 y, char c);
void lcd_printText(uint8 x, uint8 y, char* text);