sGUI  V1.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Modules Pages
LCD
+ Collaboration diagram for LCD:

Files

file  lcd.h
 Simple graphic library main functionality.
 
file  lcd_lld.h
 Simple graphic library controller communication interface.
 

Data Structures

struct  _BMP_Header
 Bitmap header. More...
 
struct  _BMP
 Bitmap image. More...
 

Typedefs

typedef struct _BMP_Header BMP_Header
 Bitmap header.
 
typedef struct _BMP BMP
 Bitmap image.
 
typedef enum _BMP_STATUS BMP_STATUS
 Error codes.
 

Enumerations

enum  _BMP_STATUS {
  BMP_OK = 0, BMP_ERROR, BMP_OUT_OF_MEMORY, BMP_IO_ERROR,
  BMP_FILE_NOT_FOUND, BMP_FILE_NOT_SUPPORTED, BMP_FILE_INVALID, BMP_INVALID_ARGUMENT,
  BMP_TYPE_MISMATCH, BMP_ERROR_NUM
}
 Error codes. More...
 

Functions

void LCD_SetTextColor (LCDCOLOR Color)
 Sets the Text color. More...
 
void LCD_SetBackColor (LCDCOLOR Color)
 Sets the Background color. More...
 
void LCD_SetFont (FONT_T *pFont)
 Sets the current font. More...
 
FONT_TLCD_GetFont (void)
 Gets the current font. More...
 
uint8_t LCD_GetLineCount (void)
 Gets the current count of possible lines. More...
 
void LCD_ClearLine (uint8_t Line)
 Clears the selected line. More...
 
void LCD_DisplayCharXY (uint16_t x, uint16_t y, char Ascii)
 Displays one character (16dots width, 24dots height) on the LCD. Position is set with a x- and a y-coordinate. More...
 
void LCD_DisplayCharLine (uint8_t Line, uint8_t Column, char Ascii)
 Displays one character (16dots width, 24dots height) on the LCD. Position is set with a line and a column. More...
 
void LCD_DisplayStringXY (uint16_t x, uint16_t y, const char *ptr)
 Displays a string on the LCD. Position is set with the x- and y-coordinate. More...
 
void LCD_DisplayStringLine (uint8_t Line, const char *ptr)
 Displays a string on a line on the LCD. Position is set with a line number. More...
 
void LCD_DisplayStringCenterLine (uint8_t Line, const char *ptr)
 Displays a string on the LCD. Position is set at the y-coordinate on center of the display. More...
 
void LCD_Log_AddMsg (char *ptr)
 Add a log message to the screen. More...
 
void LCD_Log_Update (void)
 Update the log messages on the display. This is used, if the screen is overwritten by user.
 
void LCD_DrawLine (uint16_t Xstart, uint16_t Ystart, uint16_t Xstop, uint16_t Ystop, LCDCOLOR Color)
 Draw a line on the display starting at (Xstart/Ystart) and ending at (Xstop/Ystop). This function draws the line with the Bresenham's line algorithm. More...
 
void LCD_DrawRect (uint16_t Xpos, uint16_t Ypos, uint16_t width, uint16_t height, LCDCOLOR Color)
 Displays a rectangle. More...
 
void LCD_DrawRectF (uint16_t Xpos, uint16_t Ypos, uint16_t width, uint16_t height, LCDCOLOR Color)
 Displays a filled rectangle. More...
 
void LCD_DrawCircle (uint16_t Xpos, uint16_t Ypos, uint16_t Radius, LCDCOLOR Color)
 Displays a circle. More...
 
void LCD_DrawCircleF (uint8_t Xpos, uint16_t Ypos, uint16_t Radius, LCDCOLOR Color)
 Displays a filled circle. More...
 
BMP_STATUS LCD_BMP_DrawBitmap (const char *filename, uint16_t Xpos, uint16_t Ypos)
 Reads the specified BMP image file and print it to the LCD.
It does only read bitmaps with 16, 24 or 32 bits per pixel and uncompressed.
To use this, the fatfs must be mounted. More...
 
BMP_STATUS LCD_BMP_ReadFile (BMP *bmp, const char *filename)
 Reads the specified BMP image file.
It does only read bitmaps with 16, 24 or 32 bits per pixel and uncompressed. To use this, the fatfs must be mounted. More...
 
uint32_t LCD_BMP_GetWidth (BMP *bmp)
 Returns the image's width. More...
 
uint32_t LCD_BMP_GetHeight (BMP *bmp)
 Returns the image's height. More...
 
uint16_t LCD_BMP_GetDepth (BMP *bmp)
 Returns the image's color depth (bits per pixel). More...
 
BMP_STATUS LCD_BMP_GetPixelRGB (BMP *bmp, uint32_t x, uint32_t y, uint8_t *r, uint8_t *g, uint8_t *b)
 Populates the arguments with the specified pixel's RGB values. More...
 
const char * LCD_BMP_GetErrorDescription (uint8_t errorcode)
 Returns a description of the last error code. More...
 
static void LCD_Clear (LCDCOLOR Color)
 Clears the whole LCD. More...
 
static void LCD_Init (void)
 Initialize the interface, controller and the display.
 
static void LCD_FillArea (uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color)
 Fill a specified area on the display with the same color. More...
 
static void LCD_WriteArea (uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t *pData)
 Write an array of data to a specified area on the display. More...
 
static void LCD_WritePixel (uint16_t x, uint16_t y, uint16_t pixel)
 Write one pixel to the display. More...
 

Detailed Description

Enumeration Type Documentation

Error codes.

Enumerator
BMP_OK 

No error

BMP_ERROR 

General error

BMP_OUT_OF_MEMORY 

Could not allocate enough memory to complete the operation

BMP_IO_ERROR 

General input/output error

BMP_FILE_NOT_FOUND 

File not found

BMP_FILE_NOT_SUPPORTED 

File is not a supported BMP variant

BMP_FILE_INVALID 

File is not a BMP image or is invalid

BMP_INVALID_ARGUMENT 

An argument is invalid or out of range

BMP_TYPE_MISMATCH 

The requested action is not compatible with the BMP's type

BMP_ERROR_NUM 

Other error

Definition at line 124 of file lcd.h.

Function Documentation

BMP_STATUS LCD_BMP_DrawBitmap ( const char *  filename,
uint16_t  Xpos,
uint16_t  Ypos 
)

Reads the specified BMP image file and print it to the LCD.
It does only read bitmaps with 16, 24 or 32 bits per pixel and uncompressed.
To use this, the fatfs must be mounted.

Parameters
[in]filenameName of the file (incl. ending and directory) on the sdcard.
[in]XposStart X position of the bitmap.
[in]YposStart Y position of the bitmap.
Returns
BMP_STATUS

Definition at line 127 of file bmp.c.

+ Here is the call graph for this function:

uint16_t LCD_BMP_GetDepth ( BMP bmp)

Returns the image's color depth (bits per pixel).

Parameters
[in]bmpPointer to the bitmap data buffer.
Returns
Bits per pixel.

Definition at line 285 of file bmp.c.

const char* LCD_BMP_GetErrorDescription ( uint8_t  errorcode)

Returns a description of the last error code.

Parameters
[in]errorcodeError Code number.
Returns
Pointer to a const string with the description.

Definition at line 346 of file bmp.c.

uint32_t LCD_BMP_GetHeight ( BMP bmp)

Returns the image's height.

Parameters
[in]bmpPointer to the bitmap data buffer.
Returns
The bitmap height.

Definition at line 271 of file bmp.c.

BMP_STATUS LCD_BMP_GetPixelRGB ( BMP bmp,
uint32_t  x,
uint32_t  y,
uint8_t *  r,
uint8_t *  g,
uint8_t *  b 
)

Populates the arguments with the specified pixel's RGB values.

Parameters
[in]bmpPointer to the bitmap data buffer.
[in]xX-Position of the pixel.
[in]yY-Position of the pixel.
[out]rRed
[out]gGreen
[out]bBlue
Returns
BMP_OK if no error.

Definition at line 304 of file bmp.c.

uint32_t LCD_BMP_GetWidth ( BMP bmp)

Returns the image's width.

Parameters
[in]bmpPointer to the bitmap data buffer.
Returns
The bitmap width.

Definition at line 257 of file bmp.c.

BMP_STATUS LCD_BMP_ReadFile ( BMP bmp,
const char *  filename 
)

Reads the specified BMP image file.
It does only read bitmaps with 16, 24 or 32 bits per pixel and uncompressed. To use this, the fatfs must be mounted.

Parameters
[out]bmpPointer to the bitmap data buffer.
[in]filenameFile to read into the buffer.

Definition at line 200 of file bmp.c.

+ Here is the call graph for this function:

static void LCD_Clear ( LCDCOLOR  Color)
inlinestatic

Clears the whole LCD.

Parameters
[in]ColorThe background color.

Definition at line 188 of file lcd.h.

+ Here is the call graph for this function:

void LCD_ClearLine ( uint8_t  Line)

Clears the selected line.

Parameters
[in]LineThe Line to be cleared. This parameter can be one of the following values:
  • Linex: where x can be 0..9

Definition at line 186 of file text.c.

+ Here is the call graph for this function:

void LCD_DisplayCharLine ( uint8_t  Line,
uint8_t  Column,
char  Ascii 
)

Displays one character (16dots width, 24dots height) on the LCD. Position is set with a line and a column.

Parameters
[in]LineThe Line where to display the character shape. This parameter can be one of the following values:
  • Linex: where x can be 0..9
[in]ColumnStart column address.
[in]AsciiCharacter ascii code, must be between 0x20 and 0x7E.

Definition at line 223 of file text.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void LCD_DisplayCharXY ( uint16_t  x,
uint16_t  y,
char  Ascii 
)

Displays one character (16dots width, 24dots height) on the LCD. Position is set with a x- and a y-coordinate.

Parameters
[in]xX-Position in pixel
[in]yY-Position in pixel
[in]AsciiCharacter ascii code, must be between 0x20 and 0x7E.

Definition at line 199 of file text.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void LCD_DisplayStringCenterLine ( uint8_t  Line,
const char *  ptr 
)

Displays a string on the LCD. Position is set at the y-coordinate on center of the display.

Parameters
[in]LineThe Line where to display the character shape.
[in]*ptrPointer to string to display on LCD.

Definition at line 288 of file text.c.

+ Here is the call graph for this function:

void LCD_DisplayStringLine ( uint8_t  Line,
const char *  ptr 
)

Displays a string on a line on the LCD. Position is set with a line number.

Parameters
[in]LineThe Line where to display the character shape.
[in]*ptrPointer to string to display on LCD.

Definition at line 250 of file text.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void LCD_DisplayStringXY ( uint16_t  x,
uint16_t  y,
const char *  ptr 
)

Displays a string on the LCD. Position is set with the x- and y-coordinate.

Parameters
[in]xX-Position in pixel
[in]yY-Position in pixel
[in]*ptrPointer to string to display on LCD.

Definition at line 236 of file text.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void LCD_DrawCircle ( uint16_t  Xpos,
uint16_t  Ypos,
uint16_t  Radius,
LCDCOLOR  Color 
)

Displays a circle.

Parameters
[in]Xposspecifies the X position of the center.
[in]Yposspecifies the Y position of the center.
[in]Radiusradius of the circle.
[in]Colorspecifies the color of the line.

Definition at line 191 of file geometry.c.

+ Here is the call graph for this function:

void LCD_DrawCircleF ( uint8_t  Xpos,
uint16_t  Ypos,
uint16_t  Radius,
LCDCOLOR  Color 
)

Displays a filled circle.

Parameters
[in]Xposspecifies the X position of the center.
[in]Yposspecifies the Y position of the center.
[in]Radiusradius of the circle.
[in]Colorspecifies the color of the line.

Definition at line 212 of file geometry.c.

+ Here is the call graph for this function:

void LCD_DrawLine ( uint16_t  Xstart,
uint16_t  Ystart,
uint16_t  Xstop,
uint16_t  Ystop,
LCDCOLOR  Color 
)

Draw a line on the display starting at (Xstart/Ystart) and ending at (Xstop/Ystop). This function draws the line with the Bresenham's line algorithm.

Parameters
[in]Xstartspecifies the X start position.
[in]Ystartspecifies the Y start position.
[in]Xstopspecifies the X stop position.
[in]Ystopspecifies the Y stop position.
[in]Colorspecifies the color of the line.

Definition at line 103 of file geometry.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void LCD_DrawRect ( uint16_t  Xpos,
uint16_t  Ypos,
uint16_t  width,
uint16_t  height,
LCDCOLOR  Color 
)

Displays a rectangle.

Parameters
[in]Xposspecifies the X position.
[in]Yposspecifies the Y position.
[in]widthdisplay rectangle width.
[in]heightdisplay rectangle height.
[in]Colorspecifies the color of the line.

Definition at line 161 of file geometry.c.

+ Here is the call graph for this function:

void LCD_DrawRectF ( uint16_t  Xpos,
uint16_t  Ypos,
uint16_t  width,
uint16_t  height,
LCDCOLOR  Color 
)

Displays a filled rectangle.

Parameters
[in]Xposspecifies the X position.
[in]Yposspecifies the Y position.
[in]widthdisplay rectangle width.
[in]heightdisplay rectangle height.
[in]Colorspecifies the color of the line.

Definition at line 178 of file geometry.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void LCD_FillArea ( uint16_t  x1,
uint16_t  y1,
uint16_t  x2,
uint16_t  y2,
uint16_t  color 
)
inlinestatic

Fill a specified area on the display with the same color.

Parameters
[in]x1start column from the left.
[in]y1start row from the top.
[in]x2end column from the left.
[in]y2end row from the top.
[in]colorColor in format of 16-Bit in the RGB 5-6-5 format.

Definition at line 104 of file lcd_lld.h.

+ Here is the caller graph for this function:

FONT_T* LCD_GetFont ( void  )

Gets the current font.

Returns
Pointer to the current font.

Definition at line 168 of file text.c.

uint8_t LCD_GetLineCount ( void  )

Gets the current count of possible lines.

Returns
Number of possible lines.

Definition at line 176 of file text.c.

+ Here is the caller graph for this function:

void LCD_Log_AddMsg ( char *  ptr)

Add a log message to the screen.

Parameters
[in]*ptrPointer to string to display on LCD.

Definition at line 122 of file log.c.

+ Here is the call graph for this function:

void LCD_SetBackColor ( LCDCOLOR  Color)

Sets the Background color.

Parameters
[in]Colorspecifies the Background color code RGB(5-6-5).

Definition at line 152 of file text.c.

void LCD_SetFont ( FONT_T Font)

Sets the current font.

Parameters
[in]Fontspecifies the font array.

Definition at line 160 of file text.c.

void LCD_SetTextColor ( LCDCOLOR  Color)

Sets the Text color.

Parameters
[in]Colorspecifies the Text color code RGB(5-6-5).

Definition at line 144 of file text.c.

static void LCD_WriteArea ( uint16_t  x1,
uint16_t  y1,
uint16_t  x2,
uint16_t  y2,
uint16_t *  pData 
)
inlinestatic

Write an array of data to a specified area on the display.

Parameters
[in]x1start column from the left.
[in]y1start row from the top.
[in]x2end column from the left.
[in]y2end row from the top.
[in]pDataPointer to the array of pixels in format of 16-Bit color value in the RGB 5-6-5 format.

Definition at line 118 of file lcd_lld.h.

+ Here is the caller graph for this function:

static void LCD_WritePixel ( uint16_t  x,
uint16_t  y,
uint16_t  pixel 
)
inlinestatic

Write one pixel to the display.

Parameters
[in]xstart column from the left.
[in]ystart row from the top.
[in]pixelColor in format of 16-Bit in the RGB 5-6-5 format.

Definition at line 129 of file lcd_lld.h.

+ Here is the caller graph for this function: