1 /* ----------------------------------------------------------------------------
\r
2 * SAM Software Package License
\r
3 * ----------------------------------------------------------------------------
\r
4 * Copyright (c) 2011, Atmel Corporation
\r
6 * All rights reserved.
\r
8 * Redistribution and use in source and binary forms, with or without
\r
9 * modification, are permitted provided that the following conditions are met:
\r
11 * - Redistributions of source code must retain the above copyright notice,
\r
12 * this list of conditions and the disclaimer below.
\r
14 * Atmel's name may not be used to endorse or promote products derived from
\r
15 * this software without specific prior written permission.
\r
17 * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
\r
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
\r
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
\r
20 * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
\r
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
\r
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
\r
23 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
\r
24 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
\r
25 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
\r
26 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\r
27 * ----------------------------------------------------------------------------
\r
32 * Implementation of draw font on LCD.
\r
36 /*----------------------------------------------------------------------------
\r
38 *----------------------------------------------------------------------------*/
\r
45 /*----------------------------------------------------------------------------
\r
47 *----------------------------------------------------------------------------*/
\r
49 /** Global variable describing the font being instancied. */
\r
50 const Font gFont = {10, 14};
\r
52 /*----------------------------------------------------------------------------
\r
53 * Exported functions
\r
54 *----------------------------------------------------------------------------*/
\r
57 * \brief Draws an ASCII character on LCD.
\r
59 * \param x X-coordinate of character upper-left corner.
\r
60 * \param y Y-coordinate of character upper-left corner.
\r
61 * \param c Character to output.
\r
62 * \param color Character color.
\r
64 extern void LCDD_DrawChar( uint32_t x, uint32_t y, uint8_t c, uint32_t color )
\r
68 assert( (c >= 0x20) && (c <= 0x7F) ) ;
\r
70 for ( col = 0 ; col < 10 ; col++ )
\r
72 for ( row = 0 ; row < 8 ; row++ )
\r
74 if ( (pCharset10x14[((c - 0x20) * 20) + col * 2] >> (7 - row)) & 0x1 )
\r
76 LCDD_DrawPixel( x+col, y+row, color ) ;
\r
80 for (row = 0; row < 6; row++ )
\r
82 if ((pCharset10x14[((c - 0x20) * 20) + col * 2 + 1] >> (7 - row)) & 0x1)
\r
84 LCDD_DrawPixel( x+col, y+row+8, color ) ;
\r
91 * \brief Draws an ASCII character on LCD with given background color.
\r
93 * \param x X-coordinate of character upper-left corner.
\r
94 * \param y Y-coordinate of character upper-left corner.
\r
95 * \param c Character to output.
\r
96 * \param fontColor Character color.
\r
97 * \param bgColor Background color.
\r
99 extern void LCDD_DrawCharWithBGColor( uint32_t x, uint32_t y, uint8_t c, uint32_t fontColor, uint32_t bgColor )
\r
101 uint32_t row, col ;
\r
103 assert( (c >= 0x20) && (c <= 0x7F) ) ;
\r
105 for (col = 0; col < 10; col++)
\r
107 for (row = 0 ; row < 8 ; row++)
\r
109 if ( (pCharset10x14[((c - 0x20) * 20) + col * 2] >> (7 - row)) & 0x1 )
\r
111 LCDD_DrawPixel( x+col, y+row, fontColor ) ;
\r
115 LCDD_DrawPixel( x+col, y+row, bgColor ) ;
\r
119 for ( row = 0 ; row < 6 ; row++ )
\r
121 if ( (pCharset10x14[((c - 0x20) * 20) + col * 2 + 1] >> (7 - row)) & 0x1 )
\r
123 LCDD_DrawPixel( x+col, y+row+8, fontColor ) ;
\r
127 LCDD_DrawPixel( x+col, y+row+8, bgColor ) ;
\r