Initial commit, project files and example
This commit is contained in:
120
libs/sGUI/color.h
Normal file
120
libs/sGUI/color.h
Normal file
@@ -0,0 +1,120 @@
|
||||
#ifndef __COLOR_H__
|
||||
#define __COLOR_H__
|
||||
/**
|
||||
*****************************************************************************
|
||||
* @addtogroup sGUI
|
||||
* @{
|
||||
* @addtogroup Color
|
||||
* @{
|
||||
*
|
||||
* @file color.h
|
||||
* @version 1.0
|
||||
* @date 2013-10-03
|
||||
* @author rct1
|
||||
*
|
||||
* @brief Simple graphic library color definitions.
|
||||
*
|
||||
*****************************************************************************
|
||||
* @copyright
|
||||
* @{
|
||||
*
|
||||
* This software can be used by students and other personal of the Bern
|
||||
* University of Applied Sciences under the terms of the MIT license.
|
||||
* For other persons this software is under the terms of the GNU General
|
||||
* Public License version 2.
|
||||
*
|
||||
* Copyright © 2013, Bern University of Applied Sciences.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* ##### MIT License
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*
|
||||
* ##### GNU GENERAL PUBLIC LICENSE
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
*
|
||||
* @}
|
||||
*****************************************************************************
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*----- Header-Files -------------------------------------------------------*/
|
||||
#include <stdint.h> /* Standard integer formats */
|
||||
|
||||
/*----- Macros -------------------------------------------------------------*/
|
||||
#define GUI_COLOR_BLACK 0x0000 /**< Black screen color */
|
||||
#define GUI_COLOR_WHITE 0xFFFF /**< White screen color */
|
||||
#define GUI_COLOR_LIGHT_GRAY 0xBDF7 /**< Light Gray screen color */
|
||||
#define GUI_COLOR_DARK_GREY 0x7BEF /**< Dark Gray screen color */
|
||||
#define GUI_COLOR_RED 0xF800 /**< Red screen color */
|
||||
#define GUI_COLOR_YELLOW 0xFFE0 /**< Yellow screen color */
|
||||
#define GUI_COLOR_ORANGE 0xFBE0 /**< Orange screen color */
|
||||
#define GUI_COLOR_BROWN 0x79E0 /**< Brown screen color */
|
||||
#define GUI_COLOR_GREEN 0x07E0 /**< Green screen color */
|
||||
#define GUI_COLOR_CYAN 0x07FF /**< Cyan screen color */
|
||||
#define GUI_COLOR_BLUE 0x001F /**< Blue screen color */
|
||||
#define GUI_COLOR_PINK 0xF81F /**< Pink screen color */
|
||||
#define GUI_COLOR_MAGENTA 0xF81F /**< Magenta screen color */
|
||||
|
||||
/*----- Data types ---------------------------------------------------------*/
|
||||
/**
|
||||
* @brief Data type for a color definition.
|
||||
*/
|
||||
typedef uint16_t LCDCOLOR;
|
||||
|
||||
/*----- Function prototypes ------------------------------------------------*/
|
||||
|
||||
/*----- Data ---------------------------------------------------------------*/
|
||||
|
||||
/*----- Implementation -----------------------------------------------------*/
|
||||
|
||||
/*----- EOF ----------------------------------------------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* __COLOR_H__ */
|
||||
251
libs/sGUI/font.h
Normal file
251
libs/sGUI/font.h
Normal file
@@ -0,0 +1,251 @@
|
||||
#ifndef __FONT_H__
|
||||
#define __FONT_H__
|
||||
/**
|
||||
*****************************************************************************
|
||||
* @addtogroup sGUI
|
||||
* @{
|
||||
* @addtogroup Font
|
||||
* @{
|
||||
*
|
||||
* @file font.h
|
||||
* @version 1.0
|
||||
* @date 2013-06-07
|
||||
* @author rct1
|
||||
*
|
||||
* @brief Simple graphic library font data.
|
||||
*
|
||||
*****************************************************************************
|
||||
* @copyright
|
||||
* @{
|
||||
*
|
||||
* This software can be used by students and other personal of the Bern
|
||||
* University of Applied Sciences under the terms of the MIT license.
|
||||
* For other persons this software is under the terms of the GNU General
|
||||
* Public License version 2.
|
||||
*
|
||||
* Copyright © 2013, Bern University of Applied Sciences.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* ##### MIT License
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*
|
||||
* ##### GNU GENERAL PUBLIC LICENSE
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
*
|
||||
* @}
|
||||
*****************************************************************************
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*----- Header-Files -------------------------------------------------------*/
|
||||
#include <stdint.h> /* Standard integer formats */
|
||||
|
||||
/*----- Macros -------------------------------------------------------------*/
|
||||
#define FONT_4x6 /**< Use font 4x6 */
|
||||
#define FONT_5x7 /**< Use font 5x7 */
|
||||
#define FONT_5x7W /**< Use font 5x7 Wide */
|
||||
#define FONT_5x8 /**< Use font 5x8 */
|
||||
#define FONT_6x9 /**< Use font 6x9 */
|
||||
#define FONT_6x10 /**< Use font 6x10 */
|
||||
#define FONT_6x12 /**< Use font 6x12 */
|
||||
#define FONT_6x13 /**< Use font 6x13 */
|
||||
#define FONT_6x13B /**< Use font 6x13 Bold */
|
||||
#define FONT_6x13O /**< Use font 6x13 Oblique */
|
||||
#define FONT_7x13 /**< Use font 7x13 */
|
||||
#define FONT_7x13B /**< Use font 7x13 Bold */
|
||||
#define FONT_7x13O /**< Use font 7x13 Oblique */
|
||||
#define FONT_7x14 /**< Use font 7x14 */
|
||||
#define FONT_7x14B /**< Use font 7x14 Bold */
|
||||
#define FONT_8x8 /**< Use font 8x8 */
|
||||
#define FONT_8x13 /**< Use font 8x13 */
|
||||
#define FONT_8x13B /**< Use font 8x13 Bold */
|
||||
#define FONT_8x13O /**< Use font 8x13 Oblique */
|
||||
#define FONT_8x16 /**< Use font 8x16 */
|
||||
#define FONT_8x16B /**< Use font 8x16 Bold */
|
||||
#define FONT_9x15 /**< Use font 9x15 */
|
||||
#define FONT_9x15B /**< Use font 9x15 Bold */
|
||||
|
||||
#define FONT_MIN_HEIGHT 6 /**< Minimal font width over all fonts */
|
||||
#define FONT_MIN_WIDTH 4 /**< Minimal font height over all fonts */
|
||||
#define FONT_MAX_HEIGHT 16 /**< Maximal font width over all fonts */
|
||||
#define FONT_MAX_WIDTH 9 /**< Maximal font height over all fonts */
|
||||
|
||||
/*----- Data types ---------------------------------------------------------*/
|
||||
/**
|
||||
* @brief This struct encapsulates the parameters of a font.
|
||||
*/
|
||||
typedef struct _FONT_T {
|
||||
uint8_t width; /**< Font width in pixel */
|
||||
uint8_t height; /**< Font height in pixel */
|
||||
uint8_t datasize; /**< Font datasize in bytes */
|
||||
void *data; /**< Pointer to the data buffer */
|
||||
} FONT_T;
|
||||
|
||||
/*----- Function prototypes ------------------------------------------------*/
|
||||
|
||||
/*----- Data ---------------------------------------------------------------*/
|
||||
#ifdef FONT_4x6
|
||||
/* -Misc-Fixed-Medium-R-Normal--6-60-75-75-C-40-ISO10646-1 */
|
||||
extern FONT_T font_4x6;
|
||||
#endif /* FONT_4x6 */
|
||||
|
||||
#ifdef FONT_5x7
|
||||
/* -Misc-Fixed-Medium-R-Normal--7-70-75-75-C-50-ISO10646-1 */
|
||||
extern FONT_T font_5x7;
|
||||
#endif /* FONT_5x7 */
|
||||
|
||||
#ifdef FONT_5x7W
|
||||
extern FONT_T font_5x7W;
|
||||
#endif /* FONT_5x7W */
|
||||
|
||||
#ifdef FONT_5x8
|
||||
/* -Misc-Fixed-Medium-R-Normal--8-80-75-75-C-50-ISO10646-1 */
|
||||
extern FONT_T font_5x8;
|
||||
#endif /* FONT_5x8 */
|
||||
|
||||
#ifdef FONT_6x9
|
||||
/* -Misc-Fixed-Medium-R-Normal--9-90-75-75-C-60-ISO10646-1 */
|
||||
extern FONT_T font_6x9;
|
||||
#endif /* FONT_6x9 */
|
||||
|
||||
#ifdef FONT_6x10
|
||||
/* -Misc-Fixed-Medium-R-Normal--10-100-75-75-C-60-ISO10646-1 */
|
||||
extern FONT_T font_6x10;
|
||||
#endif /* FONT_6x10 */
|
||||
|
||||
#ifdef FONT_6x12
|
||||
/* -Misc-Fixed-Medium-R-SemiCondensed--12-110-75-75-C-60-ISO10646-1 */
|
||||
extern FONT_T font_6x12;
|
||||
#endif /* FONT_6x12 */
|
||||
|
||||
#ifdef FONT_6x13
|
||||
/* -Misc-Fixed-Medium-R-SemiCondensed--13-120-75-75-C-60-ISO10646-1 */
|
||||
extern FONT_T font_6x13;
|
||||
#endif /* FONT_6x13 */
|
||||
|
||||
#ifdef FONT_6x13B
|
||||
/* -Misc-Fixed-Bold-R-SemiCondensed--13-120-75-75-C-60-ISO10646-1 */
|
||||
extern FONT_T font_6x13B;
|
||||
#endif /* FONT_6x13B */
|
||||
|
||||
#ifdef FONT_6x13O
|
||||
/* -Misc-Fixed-Medium-O-SemiCondensed--13-120-75-75-C-60-ISO10646-1 */
|
||||
extern FONT_T font_6x13O;
|
||||
#endif /* FONT_6x13O */
|
||||
|
||||
#ifdef FONT_7x13
|
||||
/* -Misc-Fixed-Medium-R-Normal--13-120-75-75-C-70-ISO10646-1 */
|
||||
extern FONT_T font_7x13;
|
||||
#endif /* FONT_7x13 */
|
||||
|
||||
#ifdef FONT_7x13B
|
||||
/* -Misc-Fixed-Bold-R-Normal--13-120-75-75-C-70-ISO10646-1 */
|
||||
extern FONT_T font_7x13B;
|
||||
#endif /* FONT_7x13B */
|
||||
|
||||
#ifdef FONT_7x13O
|
||||
/* -Misc-Fixed-Medium-O-Normal--13-120-75-75-C-70-ISO10646-1 */
|
||||
extern FONT_T font_7x13O;
|
||||
#endif /* FONT_7x13O */
|
||||
|
||||
#ifdef FONT_7x14
|
||||
/* -Misc-Fixed-Medium-R-Normal--14-130-75-75-C-70-ISO10646-1 */
|
||||
extern FONT_T font_7x14;
|
||||
#endif /* FONT_7x14 */
|
||||
|
||||
#ifdef FONT_7x14B
|
||||
/* -Misc-Fixed-Bold-R-Normal--14-130-75-75-C-70-ISO10646-1 */
|
||||
extern FONT_T font_7x14B;
|
||||
#endif /* FONT_7x14B */
|
||||
|
||||
#ifdef FONT_8x8
|
||||
extern FONT_T font_8x8;
|
||||
#endif /* FONT_8x8 */
|
||||
|
||||
#ifdef FONT_8x13
|
||||
/* -Misc-Fixed-Medium-R-Normal--13-120-75-75-C-80-ISO10646-1 */
|
||||
extern FONT_T font_8x13;
|
||||
#endif /* FONT_8x13 */
|
||||
|
||||
#ifdef FONT_8x13B
|
||||
/* -Misc-Fixed-Bold-R-Normal--13-120-75-75-C-80-ISO10646-1 */
|
||||
extern FONT_T font_8x13B;
|
||||
#endif /* FONT_8x13B */
|
||||
|
||||
#ifdef FONT_8x13O
|
||||
/* -Misc-Fixed-Medium-O-Normal--13-120-75-75-C-80-ISO10646-1 */
|
||||
extern FONT_T font_8x13O;
|
||||
#endif /* FONT_8x13O */
|
||||
|
||||
#ifdef FONT_8x16
|
||||
/* -Sony-Fixed-Medium-R-Normal--16-120-100-100-C-80-ISO8859-1 */
|
||||
extern FONT_T font_8x16;
|
||||
#endif /* FONT_8x16 */
|
||||
|
||||
#ifdef FONT_8x16B
|
||||
extern FONT_T font_8x16B;
|
||||
#endif /* FONT_8x16B */
|
||||
|
||||
#ifdef FONT_9x15
|
||||
/* -Misc-Fixed-Medium-R-Normal--15-140-75-75-C-90-ISO10646-1 */
|
||||
extern FONT_T font_9x15;
|
||||
#endif /* FONT_9x15 */
|
||||
|
||||
#ifdef FONT_9x15B
|
||||
/* -Misc-Fixed-Bold-R-Normal--15-140-75-75-C-90-ISO10646-1 */
|
||||
extern FONT_T font_9x15B;
|
||||
#endif /* FONT_9x15B */
|
||||
|
||||
/*----- Implementation -----------------------------------------------------*/
|
||||
|
||||
/*----- EOF ----------------------------------------------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* __FONT_H__ */
|
||||
206
libs/sGUI/lcd.h
Normal file
206
libs/sGUI/lcd.h
Normal file
@@ -0,0 +1,206 @@
|
||||
#ifndef __LCD_H__
|
||||
#define __LCD_H__
|
||||
/**
|
||||
*****************************************************************************
|
||||
* @addtogroup sGUI
|
||||
* @{
|
||||
* @addtogroup LCD
|
||||
* @{
|
||||
*
|
||||
* @file lcd.h
|
||||
* @version 1.0
|
||||
* @date 2013-06-07
|
||||
* @author rct1
|
||||
*
|
||||
* @brief Simple graphic library main functionality.
|
||||
*
|
||||
*****************************************************************************
|
||||
* @copyright
|
||||
* @{
|
||||
*
|
||||
* This software can be used by students and other personal of the Bern
|
||||
* University of Applied Sciences under the terms of the MIT license.
|
||||
* For other persons this software is under the terms of the GNU General
|
||||
* Public License version 2.
|
||||
*
|
||||
* Copyright © 2013, Bern University of Applied Sciences.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* ##### MIT License
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*
|
||||
* ##### GNU GENERAL PUBLIC LICENSE
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
*
|
||||
* @}
|
||||
*****************************************************************************
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*----- Header-Files -------------------------------------------------------*/
|
||||
#include <stdint.h> /* Standard integer formats */
|
||||
#include "lcd_conf.h" /* LCD configuration */
|
||||
#include "color.h" /* Color definitions */
|
||||
#include "font.h" /* Fonts definitions */
|
||||
#include "lcd_lld.h" /* Graphic controller communication */
|
||||
|
||||
/*----- Macros -------------------------------------------------------------*/
|
||||
|
||||
/*----- Data types ---------------------------------------------------------*/
|
||||
/**
|
||||
* @brief Bitmap header
|
||||
*/
|
||||
typedef struct _BMP_Header {
|
||||
uint16_t Magic; /**< Magic identifier: "BM" */
|
||||
uint32_t FileSize; /**< Size of the BMP file in bytes */
|
||||
uint16_t Reserved1; /**< Reserved */
|
||||
uint16_t Reserved2; /**< Reserved */
|
||||
uint32_t DataOffset; /**< Offset of image data relative to the
|
||||
* file's start */
|
||||
uint32_t HeaderSize; /**< Size of the header in bytes */
|
||||
uint32_t Width; /**< Bitmap's width */
|
||||
uint32_t Height; /**< Bitmap's height */
|
||||
uint16_t Planes; /**< Number of color planes in the bitmap */
|
||||
uint16_t BitsPerPixel; /**< Number of bits per pixel */
|
||||
uint32_t CompressionType; /**< Compression type */
|
||||
uint32_t ImageDataSize; /**< Size of uncompressed image's data */
|
||||
uint32_t HPixelsPerMeter; /**< Horizontal resolution (pixels per
|
||||
* meter) */
|
||||
uint32_t VPixelsPerMeter; /**< Vertical resolution (pixels per meter) */
|
||||
uint32_t ColorsUsed; /**< Number of color indexes in the color
|
||||
* table that are actually used by the
|
||||
* bitmap */
|
||||
uint32_t ColorsRequired; /**< Number of color indexes that are required
|
||||
* for displaying the bitmap */
|
||||
} BMP_Header;
|
||||
|
||||
/**
|
||||
* @brief Bitmap image
|
||||
*/
|
||||
typedef struct _BMP {
|
||||
BMP_Header Header; /**< Bitmap header */
|
||||
uint8_t *Data; /**< Pointer to bitmap data */
|
||||
} BMP;
|
||||
|
||||
/**
|
||||
* @brief Error codes
|
||||
*/
|
||||
typedef enum _BMP_STATUS
|
||||
{
|
||||
BMP_OK = 0, /**< 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 */
|
||||
} BMP_STATUS;
|
||||
|
||||
/*----- Function prototypes ------------------------------------------------*/
|
||||
/* Text functionality */
|
||||
void LCD_SetTextColor(LCDCOLOR Color);
|
||||
void LCD_SetBackColor(LCDCOLOR Color);
|
||||
void LCD_SetFont(FONT_T *pFont);
|
||||
FONT_T* LCD_GetFont(void);
|
||||
uint8_t LCD_GetLineCount(void);
|
||||
void LCD_ClearLine(uint8_t Line);
|
||||
void LCD_DisplayCharXY(uint16_t x, uint16_t y, char Ascii);
|
||||
void LCD_DisplayCharLine(uint8_t Line, uint8_t Column, char Ascii);
|
||||
void LCD_DisplayStringXY(uint16_t x, uint16_t y, const char *ptr);
|
||||
void LCD_DisplayStringLine(uint8_t Line, const char *ptr);
|
||||
void LCD_DisplayStringCenterLine(uint8_t Line, const char *ptr);
|
||||
|
||||
/* Log console functionality */
|
||||
void LCD_Log_AddMsg(char *ptr);
|
||||
void LCD_Log_Update(void);
|
||||
|
||||
/* Simple geometric functionality */
|
||||
void LCD_DrawLine(uint16_t Xstart, uint16_t Ystart, uint16_t Xstop,
|
||||
uint16_t Ystop, LCDCOLOR Color);
|
||||
void LCD_DrawRect(uint16_t Xpos, uint16_t Ypos, uint16_t width,
|
||||
uint16_t height, LCDCOLOR Color);
|
||||
void LCD_DrawRectF(uint16_t Xpos, uint16_t Ypos, uint16_t width,
|
||||
uint16_t height, LCDCOLOR Color);
|
||||
void LCD_DrawCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius,
|
||||
LCDCOLOR Color);
|
||||
void LCD_DrawCircleF(uint8_t Xpos, uint16_t Ypos, uint16_t Radius,
|
||||
LCDCOLOR Color);
|
||||
|
||||
/* Bitmap functionality */
|
||||
BMP_STATUS LCD_BMP_DrawBitmap(const char *filename, uint16_t Xpos,
|
||||
uint16_t Ypos);
|
||||
BMP_STATUS LCD_BMP_ReadFile(BMP *bmp, const char *filename);
|
||||
uint32_t LCD_BMP_GetWidth(BMP *bmp);
|
||||
uint32_t LCD_BMP_GetHeight(BMP *bmp);
|
||||
uint16_t LCD_BMP_GetDepth(BMP *bmp);
|
||||
BMP_STATUS LCD_BMP_GetPixelRGB(BMP *bmp, uint32_t x, uint32_t y, uint8_t *r,
|
||||
uint8_t *g, uint8_t *b);
|
||||
const char* LCD_BMP_GetErrorDescription(uint8_t errorcode);
|
||||
|
||||
/*----- Data ---------------------------------------------------------------*/
|
||||
|
||||
/*----- Implementation -----------------------------------------------------*/
|
||||
/**
|
||||
* @brief Clears the whole LCD.
|
||||
* @param[in] Color The background color.
|
||||
*/
|
||||
static inline void LCD_Clear(LCDCOLOR Color) {
|
||||
LCD_FillArea(SCRN_LEFT, SCRN_TOP, SCRN_RIGHT, SCRN_BOTTOM, Color);
|
||||
}
|
||||
|
||||
/*----- EOF ----------------------------------------------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* __LCD_H__ */
|
||||
225
libs/sGUI/lcd_conf_template.h
Normal file
225
libs/sGUI/lcd_conf_template.h
Normal file
@@ -0,0 +1,225 @@
|
||||
#ifndef __LCD_CONF_H__
|
||||
#define __LCD_CONF_H__
|
||||
/**
|
||||
*****************************************************************************
|
||||
* @addtogroup sGUI
|
||||
* @{
|
||||
* @addtogroup Configuration
|
||||
* @{
|
||||
*
|
||||
* @file lcd_conf_template.h
|
||||
* @version 1.0
|
||||
* @date 2013-10-03
|
||||
* @author rct1
|
||||
*
|
||||
* @brief Simple graphic library configuration.
|
||||
*
|
||||
*****************************************************************************
|
||||
* @copyright
|
||||
* @{
|
||||
*
|
||||
* This software can be used by students and other personal of the Bern
|
||||
* University of Applied Sciences under the terms of the MIT license.
|
||||
* For other persons this software is under the terms of the GNU General
|
||||
* Public License version 2.
|
||||
*
|
||||
* Copyright © 2013, Bern University of Applied Sciences.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* ##### MIT License
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*
|
||||
* ##### GNU GENERAL PUBLIC LICENSE
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
*
|
||||
* @}
|
||||
*****************************************************************************
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define TFT320x240
|
||||
/* #define TFT800x480 */
|
||||
/* #define TFT640x480 */
|
||||
/* #define TFTCUSTOM */
|
||||
|
||||
#define TFT_FPS 50ULL
|
||||
|
||||
#ifdef TFTCUSTOM
|
||||
#define TFT_WIDTH 0ULL
|
||||
#define TFT_HSYNC_BACK_PORCH 0ULL
|
||||
#define TFT_HSYNC_FRONT_PORCH 0ULL
|
||||
#define TFT_HSYNC_PULSE 0ULL
|
||||
|
||||
#define TFT_HEIGHT 0ULL
|
||||
#define TFT_VSYNC_BACK_PORCH 0ULL
|
||||
#define TFT_VSYNC_FRONT_PORCH 0ULL
|
||||
#define TFT_VSYNC_PULSE 0ULL
|
||||
#endif
|
||||
|
||||
#ifdef TFT320x240
|
||||
#define TFT_WIDTH 320ULL
|
||||
#define TFT_HSYNC_BACK_PORCH 40ULL
|
||||
#define TFT_HSYNC_FRONT_PORCH 20ULL
|
||||
#define TFT_HSYNC_PULSE 28ULL
|
||||
|
||||
#define TFT_HEIGHT 240ULL
|
||||
#define TFT_VSYNC_BACK_PORCH 17ULL
|
||||
#define TFT_VSYNC_FRONT_PORCH 4ULL
|
||||
#define TFT_VSYNC_PULSE 3ULL
|
||||
#endif
|
||||
|
||||
#ifdef TFT800x480
|
||||
#define TFT_WIDTH 800ULL
|
||||
#define TFT_HSYNC_BACK_PORCH 30LL
|
||||
#define TFT_HSYNC_FRONT_PORCH 0ULL
|
||||
#define TFT_HSYNC_PULSE 0ULL
|
||||
|
||||
#define TFT_HEIGHT 480ULL
|
||||
#define TFT_VSYNC_BACK_PORCH 10ULL
|
||||
#define TFT_VSYNC_FRONT_PORCH 0ULL
|
||||
#define TFT_VSYNC_PULSE 0ULL
|
||||
#endif
|
||||
|
||||
#ifdef TFT640x480
|
||||
|
||||
#define TFT_WIDTH 640ULL
|
||||
#define TFT_HSYNC_BACK_PORCH 56ULL
|
||||
#define TFT_HSYNC_FRONT_PORCH 8ULL
|
||||
#define TFT_HSYNC_PULSE 96ULL
|
||||
|
||||
#define TFT_HEIGHT 480ULL
|
||||
#define TFT_VSYNC_BACK_PORCH 41ULL
|
||||
#define TFT_VSYNC_FRONT_PORCH 2ULL
|
||||
#define TFT_VSYNC_PULSE 2ULL
|
||||
#endif
|
||||
|
||||
#define TFT_HSYNC_PERIOD (TFT_HSYNC_PULSE + TFT_HSYNC_BACK_PORCH + \
|
||||
TFT_WIDTH + TFT_HSYNC_FRONT_PORCH)
|
||||
#define TFT_VSYNC_PERIOD (TFT_VSYNC_PULSE + TFT_VSYNC_BACK_PORCH + \
|
||||
TFT_HEIGHT + TFT_VSYNC_FRONT_PORCH)
|
||||
#define TFT_PCLK (TFT_HSYNC_PERIOD * TFT_VSYNC_PERIOD * \
|
||||
TFT_FPS)
|
||||
#define LCD_FPR ((TFT_PCLK * 1048576)/100000000)
|
||||
|
||||
#define WR_HIGH_BYTE(x) (x >> 8)
|
||||
#define WR_LOW_BYTE(x) (x & 0xFF)
|
||||
|
||||
#define USE_16BIT_PMP
|
||||
|
||||
/**
|
||||
* Overview: Horizontal and vertical display resolution
|
||||
* (from the glass datasheet).
|
||||
*/
|
||||
#define LCD_HOR_RESOLUTION 320ULL
|
||||
#define LCD_VER_RESOLUTION 240ULL
|
||||
|
||||
/**
|
||||
* Overview: Horizontal synchronization timing in pixels
|
||||
* (from the glass datasheet).
|
||||
*/
|
||||
#define LCD_HOR_PULSE_WIDTH 64ULL /* 64 */
|
||||
#define LCD_HOR_BACK_PORCH 96ULL /* 96 */
|
||||
#define LCD_HOR_FRONT_PORCH 48ULL /* 48 */
|
||||
|
||||
/**
|
||||
* Overview: Vertical synchronization timing in lines
|
||||
* (from the glass datasheet).
|
||||
*/
|
||||
#define LCD_VER_PULSE_WIDTH 2ULL /* 2 */
|
||||
#define LCD_VER_BACK_PORCH 34ULL /* 34 */
|
||||
#define LCD_VER_FRONT_PORCH 11ULL /* 11 */
|
||||
|
||||
/**
|
||||
* Define horizontal timing
|
||||
* HT - horizontal period
|
||||
* HPS - hsync width + front porch
|
||||
* HPW - horizontal sync pulse width
|
||||
* LPS - horizontal sync pulse location
|
||||
*/
|
||||
#define HT (LCD_HOR_RESOLUTION + LCD_HOR_PULSE_WIDTH + LCD_HOR_BACK_PORCH + LCD_HOR_FRONT_PORCH)
|
||||
#define HPS (LCD_HOR_PULSE_WIDTH + LCD_HOR_BACK_PORCH)
|
||||
|
||||
/**
|
||||
* Define vertical timing
|
||||
* VT - vertical period
|
||||
* VPS - vsync width + front porch
|
||||
* VPW - vertical sync pulse width
|
||||
* FPS - vertical sync pulse location
|
||||
*/
|
||||
#define VT (LCD_VER_PULSE_WIDTH + LCD_VER_BACK_PORCH + LCD_VER_FRONT_PORCH + LCD_VER_RESOLUTION)
|
||||
#define VSP (LCD_VER_PULSE_WIDTH + LCD_VER_BACK_PORCH)
|
||||
|
||||
/* LCD screen and bitmap image array constants */
|
||||
#define X_BYTES 40
|
||||
#define Y_BYTES 30
|
||||
#define SCRN_LEFT 0
|
||||
#define SCRN_TOP 0
|
||||
#define SCRN_RIGHT LCD_HOR_RESOLUTION-1
|
||||
#define SCRN_BOTTOM LCD_VER_RESOLUTION-1
|
||||
|
||||
#define CCW -1
|
||||
#define CW 1
|
||||
|
||||
#define DOTS_PER_CM_X 64
|
||||
#define DOTS_PER_CM_Y 60
|
||||
|
||||
#define INCR 1
|
||||
#define DECR -1
|
||||
#define PREDX 1
|
||||
#define PREDY 0
|
||||
|
||||
/**
|
||||
* 1.5 pixels for 1 mm
|
||||
* when width[mm] = 2.0mm then width[pixels] = 2*1.5 = 3 pixels
|
||||
*/
|
||||
#define COEFF_PIXELS_MM 1.5
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* __LCD_CONF_H__ */
|
||||
147
libs/sGUI/lcd_lld.h
Normal file
147
libs/sGUI/lcd_lld.h
Normal file
@@ -0,0 +1,147 @@
|
||||
#ifndef __LCD_LLD_H__
|
||||
#define __LCD_LLD_H__
|
||||
/**
|
||||
*****************************************************************************
|
||||
* @addtogroup sGUI
|
||||
* @{
|
||||
* @addtogroup LCD
|
||||
* @{
|
||||
*
|
||||
* @file lcd_lld.h
|
||||
* @version 1.0
|
||||
* @date 2013-10-04
|
||||
* @author rct1
|
||||
*
|
||||
* @brief Simple graphic library controller communication interface.
|
||||
*
|
||||
*****************************************************************************
|
||||
* @copyright
|
||||
* @{
|
||||
*
|
||||
* This software can be used by students and other personal of the Bern
|
||||
* University of Applied Sciences under the terms of the MIT license.
|
||||
* For other persons this software is under the terms of the GNU General
|
||||
* Public License version 2.
|
||||
*
|
||||
* Copyright © 2013, Bern University of Applied Sciences.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* ##### MIT License
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*
|
||||
* ##### GNU GENERAL PUBLIC LICENSE
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
*
|
||||
* @}
|
||||
*****************************************************************************
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*----- Header-Files -------------------------------------------------------*/
|
||||
#include <stdint.h> /* Standard integer formats */
|
||||
#include "ssd1963.h" /* SSD1963 Graphic-Controller */
|
||||
|
||||
/*----- Macros -------------------------------------------------------------*/
|
||||
|
||||
/*----- Data types ---------------------------------------------------------*/
|
||||
|
||||
/*----- Function prototypes ------------------------------------------------*/
|
||||
|
||||
/*----- Data ---------------------------------------------------------------*/
|
||||
|
||||
/*----- Implementation -----------------------------------------------------*/
|
||||
/**
|
||||
* @brief Initialize the interface, controller and the display.
|
||||
*/
|
||||
static inline void LCD_Init(void) {
|
||||
SSD1963_Init();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Fill a specified area on the display with the same color.
|
||||
* @param[in] x1 start column from the left.
|
||||
* @param[in] y1 start row from the top.
|
||||
* @param[in] x2 end column from the left.
|
||||
* @param[in] y2 end row from the top.
|
||||
* @param[in] color Color in format of 16-Bit in the RGB 5-6-5 format.
|
||||
*/
|
||||
static inline void LCD_FillArea(uint16_t x1, uint16_t y1, uint16_t x2,
|
||||
uint16_t y2, uint16_t color) {
|
||||
SSD1963_FillArea(x1, y1, x2, y2, color);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Write an array of data to a specified area on the display.
|
||||
* @param[in] x1 start column from the left.
|
||||
* @param[in] y1 start row from the top.
|
||||
* @param[in] x2 end column from the left.
|
||||
* @param[in] y2 end row from the top.
|
||||
* @param[in] pData Pointer to the array of pixels in format of 16-Bit
|
||||
* color value in the RGB 5-6-5 format.
|
||||
*/
|
||||
static inline void LCD_WriteArea(uint16_t x1, uint16_t y1, uint16_t x2,
|
||||
uint16_t y2, uint16_t *pData) {
|
||||
SSD1963_WriteArea(x1, y1, x2, y2, pData);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Write one pixel to the display.
|
||||
* @param[in] x start column from the left.
|
||||
* @param[in] y start row from the top.
|
||||
* @param[in] pixel Color in format of 16-Bit in the RGB 5-6-5 format.
|
||||
*/
|
||||
static inline void LCD_WritePixel(uint16_t x, uint16_t y, uint16_t pixel) {
|
||||
SSD1963_WritePixel(x, y, pixel);
|
||||
}
|
||||
|
||||
/*----- EOF ----------------------------------------------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* __LCD_LLD_H__ */
|
||||
Reference in New Issue
Block a user