Files
MSE-SoftwEng/pico-sensor/McuLib/src/McuFontDisplay.h
2025-05-06 13:07:01 +00:00

282 lines
13 KiB
C

/* ###################################################################
** This component module is generated by Processor Expert. Do not modify it.
** Filename : McuFontDisplay.h
** Project : FRDM-K64F_Generator
** Processor : MK64FN1M0VLL12
** Component : FontDisplay
** Version : Component 01.201, Driver 01.00, CPU db: 3.00.000
** Compiler : GNU C Compiler
** Date/Time : 2023-12-20, 18:09, # CodeGen: 825
** Abstract :
** Driver to write fonts using GFont component
** Settings :
** Bean name : McuFontDisplay
** System :
** InhGDisplay : McuGDisplaySSD1306
** Contents :
** GetFontHeight - void McuFontDisplay_GetFontHeight(McuFontDisplay_Font *font,...
** GetStringHeight - McuFontDisplay_PixelDim McuFontDisplay_GetStringHeight(uint8_t *str,...
** GetCharWidth - void McuFontDisplay_GetCharWidth(uint8_t ch, McuFontDisplay_PixelDim...
** GetStringWidth - McuFontDisplay_PixelDim McuFontDisplay_GetStringWidth(uint8_t *str,...
** WriteString - void McuFontDisplay_WriteString(uint8_t *str, McuFontDisplay_PixelColor...
** WriteStringWidth - void McuFontDisplay_WriteStringWidth(uint8_t *str, McuFontDisplay_PixelColor...
** WriteChar - void McuFontDisplay_WriteChar(uint8_t ch, McuFontDisplay_PixelColor color,...
** Deinit - void McuFontDisplay_Deinit(void);
** Init - void McuFontDisplay_Init(void);
**
** * Copyright (c) 2011-2020, Erich Styger
** * Web: https://mcuoneclipse.com
** * SourceForge: https://sourceforge.net/projects/mcuoneclipse
** * Git: https://github.com/ErichStyger/McuOnEclipse_PEx
** * All rights reserved.
** *
** * Redistribution and use in source and binary forms, with or without modification,
** * are permitted provided that the following conditions are met:
** *
** * - Redistributions of source code must retain the above copyright notice, this list
** * of conditions and the following disclaimer.
** *
** * - Redistributions in binary form must reproduce the above copyright notice, this
** * list of conditions and the following disclaimer in the documentation and/or
** * other materials provided with the distribution.
** *
** * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
** * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
** * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
** * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
** * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
** * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
** * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
** * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
** * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
** ###################################################################*/
/*!
** @file McuFontDisplay.h
** @version 01.00
** @brief
** Driver to write fonts using GFont component
*/
/*!
** @addtogroup McuFontDisplay_module McuFontDisplay module documentation
** @{
*/
#ifndef __McuFontDisplay_H
#define __McuFontDisplay_H
/* MODULE McuFontDisplay. */
#include "McuLib.h" /* SDK and API used */
#include "McuFontDisplayconfig.h" /* configuration */
#include "McuGDisplaySSD1306.h" /* Graphic display interface */
#include "McuGFont.h" /* Font interface */
#ifdef __cplusplus
extern "C" {
#endif
typedef McuGDisplaySSD1306_PixelDim McuFontDisplay_PixelDim; /* Type which can hold a integral type for the x/y pixel dimension. This is depending on the display used. */
typedef McuGDisplaySSD1306_PixelColor McuFontDisplay_PixelColor; /* Type defining the color type (depends on display used). */
typedef GFONT_Callbacks McuFontDisplay_Font; /* Pointer to GFONT_Callbacks */
void McuFontDisplay_WriteString(uint8_t *str, McuFontDisplay_PixelColor color, McuFontDisplay_PixelDim *xCursor, McuFontDisplay_PixelDim *yCursor, McuFontDisplay_Font *font);
/*
** ===================================================================
** Method : WriteString (component FontDisplay)
**
** Description :
** Function to write a string or character at the startpoint.
** Set the startpoint with the function setCursor.
** Parameters :
** NAME - DESCRIPTION
** * str - Pointer to the character string
** color - Foreground color to be used (for the
** character pixels)
** * xCursor - Pointer to x position of first
** character (upper left corner). On return
** this will contain the next y position.
** * yCursor - Pointer to y position of character
** (upper left corner). On return this will
** contain the next y position.
** * font - Pointer to font information
** Returns : Nothing
** ===================================================================
*/
void McuFontDisplay_WriteChar(uint8_t ch, McuFontDisplay_PixelColor color, McuFontDisplay_PixelDim *xCursor, McuFontDisplay_PixelDim *yCursor, McuFontDisplay_Font *font);
/*
** ===================================================================
** Method : WriteChar (component FontDisplay)
**
** Description :
** Function to write a character at the start point. Set the
** start point with the function setCursor.
** Parameters :
** NAME - DESCRIPTION
** ch - the character to print
** color - Foreground color to be used (for the
** character pixels)
** * xCursor - Pointer to x position of character
** (upper left corner). On return this will
** contain the next x position.
** * yCursor - Pointer to y position of character
** (upper left corner). On return this will
** contain the next y position.
** * font - Pointer to font information
** Returns : Nothing
** ===================================================================
*/
void McuFontDisplay_GetCharWidth(uint8_t ch, McuFontDisplay_PixelDim *charWidth, McuFontDisplay_PixelDim *totalWidth, McuFontDisplay_Font *font);
/*
** ===================================================================
** Method : GetCharWidth (component FontDisplay)
**
** Description :
** returns the width (in pixels) of a font character.
** Parameters :
** NAME - DESCRIPTION
** ch - character for which to calculate the width
** * charWidth - Pointer to width of the
** character in pixels (this is only for the
** character, without the space after the
** character)
** * totalWidth - Pointer to the total width
** of the character, including to the space
** after the character.
** * font - Pointer to font information
** Returns : Nothing
** ===================================================================
*/
McuFontDisplay_PixelDim McuFontDisplay_GetStringWidth(uint8_t *str, McuFontDisplay_Font *font, McuFontDisplay_PixelDim *lastCharSpace);
/*
** ===================================================================
** Method : GetStringWidth (component FontDisplay)
**
** Description :
** returns the width (in pixels) of a font string. For multiple
** line strings (separated by \
** ) or for strings with \r it returns the longest string
** length.
** Parameters :
** NAME - DESCRIPTION
** * str - Pointer to the string.
** * font - Pointer to font information
** * lastCharSpace - Pointer to the width
** of the last character space, useful if you
** combine multiple strings. The pointer may
** be NULL.
** Returns :
** --- - Error code
** ===================================================================
*/
void McuFontDisplay_GetFontHeight(McuFontDisplay_Font *font, McuFontDisplay_PixelDim *charHeight, McuFontDisplay_PixelDim *totalHeight);
/*
** ===================================================================
** Method : GetFontHeight (component FontDisplay)
**
** Description :
** returns the height (in pixels) of a font.
** Parameters :
** NAME - DESCRIPTION
** * font - Pointer to font information
** * charHeight - Pointer to height of the
** character in pixels.
** * totalHeight - Pointer to the total
** height of the character, including to the
** space below the character.
** Returns : Nothing
** ===================================================================
*/
McuFontDisplay_PixelDim McuFontDisplay_GetStringHeight(uint8_t *str, McuFontDisplay_Font *font, McuFontDisplay_PixelDim *lastLineSpace);
/*
** ===================================================================
** Method : GetStringHeight (component FontDisplay)
**
** Description :
** returns the height (in pixels) of a font string. For
** multiple line strings (separated by newline) or for strings
** with \r it returns the longest list.
** Parameters :
** NAME - DESCRIPTION
** * str - Pointer to the string.
** * font - Pointer to font information
** * lastLineSpace - Pointer to the height
** of the last line space, useful if you
** combine multiple strings. The pointer may
** be NULL.
** Returns :
** --- - Error code
** ===================================================================
*/
void McuFontDisplay_Deinit(void);
/*
** ===================================================================
** Method : Deinit (component FontDisplay)
**
** Description :
** Driver de-initialization
** Parameters : None
** Returns : Nothing
** ===================================================================
*/
void McuFontDisplay_Init(void);
/*
** ===================================================================
** Method : Init (component FontDisplay)
**
** Description :
** Driver initialization
** Parameters : None
** Returns : Nothing
** ===================================================================
*/
void McuFontDisplay_WriteStringWidth(uint8_t *str, McuFontDisplay_PixelColor color, McuFontDisplay_PixelDim *xCursor, McuFontDisplay_PixelDim *yCursor, McuFontDisplay_Font *font, McuFontDisplay_PixelDim width);
/*
** ===================================================================
** Method : WriteStringWidth (component FontDisplay)
**
** Description :
** Function to write a string or character at the startpoint.
** Set the startpoint with the function setCursor. If the
** string reaches the given width, the text gets wrapped to a
** new line.
** Parameters :
** NAME - DESCRIPTION
** * str - Pointer to the character string
** color - Foreground color to be used (for the
** character pixels)
** * xCursor - Pointer to x position of first
** character (upper left corner). On return
** this will contain the next y position.
** * yCursor - Pointer to y position of character
** (upper left corner). On return this will
** contain the next y position.
** * font - Pointer to font information
** width - Maximum of width of the text box. If
** text reaches the end of the box, the text
** gets wrapped to a new line.
** Returns : Nothing
** ===================================================================
*/
/* END McuFontDisplay. */
#ifdef __cplusplus
}
#endif
#endif
/* ifndef __McuFontDisplay_H */
/*!
** @}
*/