From 044ad7c3987460ede48ff27afd6bdb0ca05a0432 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 4 Jul 2011 20:52:54 +0200 Subject: import at91lib from at91lib_20100901_softpack_1_9_v_1_0_svn_v15011 it's sad to see that atmel doesn't publish their svn repo or has a centralized location or even puts proper version/release info into the library itself --- components/slcd/s7lstklcd/font.h | 71 ++++++++ components/slcd/s7lstklcd/font1.c | 306 ++++++++++++++++++++++++++++++++ components/slcd/s7lstklcd/s7lstklcd.c | 187 +++++++++++++++++++ components/slcd/s7lstklcd/s7lstklcd.dir | 40 +++++ components/slcd/s7lstklcd/s7lstklcd.h | 83 +++++++++ 5 files changed, 687 insertions(+) create mode 100644 components/slcd/s7lstklcd/font.h create mode 100644 components/slcd/s7lstklcd/font1.c create mode 100644 components/slcd/s7lstklcd/s7lstklcd.c create mode 100644 components/slcd/s7lstklcd/s7lstklcd.dir create mode 100644 components/slcd/s7lstklcd/s7lstklcd.h (limited to 'components/slcd/s7lstklcd') diff --git a/components/slcd/s7lstklcd/font.h b/components/slcd/s7lstklcd/font.h new file mode 100644 index 0000000..ae5b27f --- /dev/null +++ b/components/slcd/s7lstklcd/font.h @@ -0,0 +1,71 @@ +/* ---------------------------------------------------------------------------- + * ATMEL Microcontroller Software Support + * ---------------------------------------------------------------------------- + * Copyright (c) 2008, Atmel Corporation + * + * 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 disclaimer below. + * + * Atmel's name may not be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE + * DISCLAIMED. IN NO EVENT SHALL ATMEL 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. + * ---------------------------------------------------------------------------- + */ + +#ifndef FONT_H +#define FONT_H + +//----------------------------------------------------------------------------- +// Definitions +//----------------------------------------------------------------------------- + +/// Maximum character width in pixels. +#define FONT_CHAR_MAX_WIDTH 8 + +//----------------------------------------------------------------------------- +// Types +//----------------------------------------------------------------------------- + +/// Font information structure. +typedef struct _Font { + + // Font width in pixels. + unsigned char width; + // Font height in pixels. + unsigned char height; + // First character in font data. + unsigned char firstCharacter; + // Last character in font data. + unsigned char lastCharacter; + // Font data, containing (lastCharacter - firstCharacter) characters, + // (height) bytes per character, each byte corresponding + // to one line of the character. Bits are ordered as follow: + // MSB ------------------------------------ LSB + // Leftmost bit - ... - Rightmost bit - Padding + const unsigned char *pData; + +} Font; + +//----------------------------------------------------------------------------- +// Global variables +//----------------------------------------------------------------------------- + +extern const Font gFont; + +#endif //#ifndef FONT_H + diff --git a/components/slcd/s7lstklcd/font1.c b/components/slcd/s7lstklcd/font1.c new file mode 100644 index 0000000..d1c60f2 --- /dev/null +++ b/components/slcd/s7lstklcd/font1.c @@ -0,0 +1,306 @@ +/* ---------------------------------------------------------------------------- + * ATMEL Microcontroller Software Support + * ---------------------------------------------------------------------------- + * Copyright (c) 2008, Atmel Corporation + * + * 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 disclaimer below. + * + * Atmel's name may not be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE + * DISCLAIMED. IN NO EVENT SHALL ATMEL 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. + * ---------------------------------------------------------------------------- + */ + +//----------------------------------------------------------------------------- +// Headers +//----------------------------------------------------------------------------- + +#include "font.h" + +//----------------------------------------------------------------------------- +// Local variables +//----------------------------------------------------------------------------- + +/// Font data. +static const unsigned char pData[] = { + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x70, 0x88, 0xD8, 0x88, 0xF8, 0xA8, 0x88, 0x70, + 0x70, 0xF8, 0xA8, 0xF8, 0x88, 0xD8, 0x88, 0x70, + 0x00, 0x50, 0xF8, 0xF8, 0xF8, 0x70, 0x20, 0x00, + 0x00, 0x20, 0x70, 0xF8, 0x70, 0x20, 0x00, 0x00, + 0x20, 0x70, 0x70, 0xD8, 0x70, 0x20, 0x20, 0x70, + 0x20, 0x70, 0xF8, 0xF8, 0x70, 0x20, 0x20, 0x70, + 0x00, 0x00, 0x20, 0x70, 0x70, 0x20, 0x00, 0x00, + 0xF8, 0xF8, 0xD8, 0x88, 0x88, 0xD8, 0xF8, 0xF8, + 0x00, 0x00, 0x20, 0x50, 0x50, 0x20, 0x00, 0x00, + 0xF8, 0xF8, 0xD8, 0xA8, 0xA8, 0xD8, 0xF8, 0xF8, + 0x38, 0x18, 0x28, 0x60, 0x90, 0x90, 0x60, 0x00, + 0x70, 0x88, 0x88, 0x70, 0x20, 0xF8, 0x20, 0x20, + 0x38, 0x28, 0x20, 0x20, 0x20, 0x60, 0xE0, 0x40, + 0x78, 0x48, 0x78, 0x48, 0x48, 0x58, 0xD8, 0xC0, + 0x20, 0xA8, 0x70, 0xD8, 0x70, 0xA8, 0x20, 0x00, + 0x40, 0x60, 0x70, 0x78, 0x70, 0x60, 0x40, 0x00, + 0x10, 0x30, 0x70, 0xF0, 0x70, 0x30, 0x10, 0x00, + 0x20, 0x70, 0xF8, 0x20, 0x20, 0xF8, 0x70, 0x20, + 0x50, 0x50, 0x50, 0x50, 0x50, 0x00, 0x50, 0x50, + 0x78, 0xA8, 0xA8, 0xA8, 0x68, 0x28, 0x28, 0x28, + 0x30, 0x48, 0x20, 0x50, 0x20, 0x90, 0x60, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0x00, + 0x20, 0x70, 0xF8, 0x20, 0xF8, 0x70, 0x20, 0xF8, + 0x20, 0x70, 0xF8, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0xF8, 0x70, 0x20, + 0x00, 0x20, 0x30, 0xF8, 0x30, 0x20, 0x00, 0x00, + 0x00, 0x20, 0x60, 0xF8, 0x60, 0x20, 0x00, 0x00, + 0x00, 0x00, 0x60, 0x60, 0x78, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x50, 0xF8, 0x50, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x20, 0x70, 0xF8, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xF8, 0x70, 0x20, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x40, + 0x50, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x50, 0xF8, 0x50, 0xF8, 0x50, 0x00, 0x00, + 0x20, 0x78, 0x80, 0x60, 0x30, 0x08, 0xF0, 0x20, + 0x00, 0xC0, 0xC8, 0x10, 0x20, 0x40, 0x98, 0x18, + 0x60, 0x90, 0x90, 0x60, 0x68, 0x90, 0x90, 0x68, + 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x10, 0x20, 0x40, 0x40, 0x40, 0x40, 0x20, 0x10, + 0x40, 0x20, 0x10, 0x10, 0x10, 0x10, 0x20, 0x40, + 0x20, 0xA8, 0x70, 0xF8, 0x70, 0xA8, 0x20, 0x00, + 0x00, 0x20, 0x20, 0xF8, 0x20, 0x20, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xC0, + 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, + 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, + 0x70, 0x88, 0x98, 0xA8, 0xA8, 0xC8, 0x88, 0x70, + 0x20, 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, + 0x70, 0x88, 0x08, 0x08, 0x10, 0x20, 0x40, 0xF8, + 0x70, 0x88, 0x08, 0x30, 0x08, 0x08, 0x88, 0x70, + 0x10, 0x30, 0x50, 0x90, 0xF8, 0x10, 0x10, 0x10, + 0xF8, 0x80, 0x80, 0xF0, 0x08, 0x08, 0x88, 0x70, + 0x70, 0x88, 0x80, 0xF0, 0x88, 0x88, 0x88, 0x70, + 0xF8, 0x08, 0x08, 0x10, 0x20, 0x20, 0x20, 0x20, + 0x70, 0x88, 0x88, 0x70, 0x88, 0x88, 0x88, 0x70, + 0x70, 0x88, 0x88, 0x78, 0x08, 0x08, 0x88, 0x70, + 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, + 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0xC0, + 0x10, 0x20, 0x40, 0x80, 0x40, 0x20, 0x10, 0x00, + 0x00, 0x00, 0xF0, 0x00, 0xF0, 0x00, 0x00, 0x00, + 0x40, 0x20, 0x10, 0x08, 0x10, 0x20, 0x40, 0x00, + 0x70, 0x88, 0x08, 0x10, 0x20, 0x20, 0x00, 0x20, + 0x70, 0x88, 0xB8, 0xA8, 0xA8, 0xB8, 0x80, 0x78, + 0x70, 0x88, 0x88, 0xF8, 0x88, 0x88, 0x88, 0x88, + 0xF0, 0x88, 0x88, 0xF0, 0x88, 0x88, 0x88, 0xF0, + 0x70, 0x88, 0x80, 0x80, 0x80, 0x80, 0x88, 0x70, + 0xF0, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0xF0, + 0xF8, 0x80, 0x80, 0xF0, 0x80, 0x80, 0x80, 0xF8, + 0xF8, 0x80, 0x80, 0xF0, 0x80, 0x80, 0x80, 0x80, + 0x70, 0x88, 0x80, 0xB8, 0x88, 0x88, 0x88, 0x70, + 0x88, 0x88, 0x88, 0xF8, 0x88, 0x88, 0x88, 0x88, + 0x70, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x90, 0x90, 0x60, + 0x88, 0x90, 0xA0, 0xC0, 0xC0, 0xA0, 0x90, 0x88, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xF8, + 0x88, 0xD8, 0xA8, 0xA8, 0xA8, 0x88, 0x88, 0x88, + 0x88, 0xC8, 0xC8, 0xA8, 0xA8, 0x98, 0x98, 0x88, + 0x70, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70, + 0xF0, 0x88, 0x88, 0xF0, 0x80, 0x80, 0x80, 0x80, + 0x70, 0x88, 0x88, 0x88, 0x88, 0xA8, 0x90, 0x68, + 0xF0, 0x88, 0x88, 0xF0, 0xC0, 0xA0, 0x90, 0x88, + 0x70, 0x88, 0x80, 0x70, 0x08, 0x08, 0x88, 0x70, + 0xF8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70, + 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x50, 0x20, + 0x88, 0x88, 0x88, 0xA8, 0xA8, 0xA8, 0xD8, 0x88, + 0x88, 0x88, 0x50, 0x20, 0x20, 0x50, 0x88, 0x88, + 0x88, 0x88, 0x50, 0x20, 0x20, 0x20, 0x20, 0x20, + 0xF8, 0x08, 0x10, 0x20, 0x20, 0x40, 0x80, 0xF8, + 0x60, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x60, + 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x08, + 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x60, + 0x20, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, + 0x40, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x70, 0x08, 0x78, 0x88, 0x78, 0x00, + 0x80, 0x80, 0xF0, 0x88, 0x88, 0x88, 0xF0, 0x00, + 0x00, 0x00, 0x70, 0x88, 0x80, 0x88, 0x70, 0x00, + 0x08, 0x08, 0x78, 0x88, 0x88, 0x88, 0x78, 0x00, + 0x00, 0x00, 0x70, 0x88, 0xF8, 0x80, 0x78, 0x00, + 0x30, 0x40, 0xE0, 0x40, 0x40, 0x40, 0x40, 0x00, + 0x00, 0x00, 0x78, 0x88, 0x88, 0x78, 0x08, 0xF0, + 0x80, 0x80, 0xF0, 0x88, 0x88, 0x88, 0x88, 0x00, + 0x20, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, + 0x20, 0x00, 0x20, 0x20, 0x20, 0x20, 0xA0, 0x40, + 0x80, 0x80, 0x90, 0xA0, 0xC0, 0xA0, 0x90, 0x00, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, + 0x00, 0x00, 0x50, 0xA8, 0xA8, 0x88, 0x88, 0x00, + 0x00, 0x00, 0xB0, 0xC8, 0x88, 0x88, 0x88, 0x00, + 0x00, 0x00, 0x70, 0x88, 0x88, 0x88, 0x70, 0x00, + 0x00, 0x00, 0xE0, 0x90, 0x90, 0xE0, 0x80, 0x80, + 0x00, 0x00, 0x70, 0x90, 0x90, 0x70, 0x10, 0x10, + 0x00, 0x00, 0xB0, 0xC0, 0x80, 0x80, 0x80, 0x00, + 0x00, 0x00, 0x78, 0x80, 0x70, 0x08, 0xF0, 0x00, + 0x40, 0x40, 0xE0, 0x40, 0x40, 0x40, 0x60, 0x00, + 0x00, 0x00, 0x88, 0x88, 0x88, 0x88, 0x70, 0x00, + 0x00, 0x00, 0x88, 0x88, 0x50, 0x50, 0x20, 0x00, + 0x00, 0x00, 0x88, 0x88, 0xA8, 0xA8, 0x50, 0x00, + 0x00, 0x00, 0x88, 0x50, 0x20, 0x50, 0x88, 0x00, + 0x00, 0x00, 0x88, 0x88, 0x88, 0x78, 0x08, 0xF0, + 0x00, 0x00, 0xF8, 0x10, 0x20, 0x40, 0xF8, 0x00, + 0x10, 0x20, 0x20, 0x40, 0x40, 0x20, 0x20, 0x10, + 0x20, 0x20, 0x20, 0x00, 0x00, 0x20, 0x20, 0x20, + 0x40, 0x20, 0x20, 0x10, 0x10, 0x20, 0x20, 0x40, + 0x50, 0xA0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x60, 0x60, 0x90, 0x90, 0xF0, + 0x70, 0x88, 0x80, 0x80, 0x88, 0x70, 0x20, 0x60, + 0x50, 0x00, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70, + 0x10, 0x20, 0x70, 0x88, 0xF8, 0x80, 0x88, 0x70, + 0x30, 0x48, 0x70, 0x08, 0x78, 0x88, 0x88, 0x78, + 0x50, 0x00, 0x70, 0x08, 0x78, 0x88, 0x88, 0x78, + 0x40, 0x20, 0x70, 0x08, 0x78, 0x88, 0x88, 0x78, + 0x20, 0x00, 0x70, 0x08, 0x78, 0x88, 0x88, 0x78, + 0x70, 0x88, 0x80, 0x80, 0x88, 0x70, 0x20, 0x60, + 0x20, 0x50, 0x70, 0x88, 0xF8, 0x80, 0x88, 0x70, + 0x50, 0x00, 0x70, 0x88, 0xF8, 0x80, 0x88, 0x70, + 0x40, 0x20, 0x70, 0x88, 0xF8, 0x80, 0x88, 0x70, + 0x50, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x50, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x40, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x50, 0x00, 0x70, 0x88, 0x88, 0xF8, 0x88, 0x88, + 0x20, 0x00, 0x70, 0x88, 0x88, 0xF8, 0x88, 0x88, + 0x20, 0x40, 0xF8, 0x80, 0xE0, 0x80, 0x80, 0xF8, + 0x00, 0x00, 0x50, 0xA8, 0x38, 0x60, 0xA8, 0x70, + 0x78, 0xA0, 0xA0, 0xF0, 0xA0, 0xA0, 0xA0, 0xB8, + 0x20, 0x50, 0x70, 0x88, 0x88, 0x88, 0x88, 0x70, + 0x88, 0x00, 0x70, 0x88, 0x88, 0x88, 0x88, 0x70, + 0x40, 0x20, 0x70, 0x88, 0x88, 0x88, 0x88, 0x70, + 0x20, 0x50, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70, + 0x40, 0x20, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70, + 0x50, 0x00, 0x88, 0x50, 0x20, 0x20, 0x20, 0x20, + 0x88, 0x00, 0x70, 0x88, 0x88, 0x88, 0x88, 0x70, + 0x50, 0x00, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70, + 0x20, 0x70, 0xA8, 0xA0, 0xA0, 0xA8, 0x70, 0x20, + 0x70, 0x88, 0x80, 0x40, 0x70, 0x40, 0x88, 0xF0, + 0x88, 0x50, 0x20, 0x70, 0x20, 0x70, 0x20, 0x20, + 0xF0, 0x88, 0x88, 0xF0, 0xA0, 0xF0, 0xA8, 0xB0, + 0x30, 0x28, 0x20, 0x70, 0x20, 0xA0, 0xA0, 0x40, + 0x10, 0x20, 0x70, 0x88, 0x78, 0x88, 0x88, 0x78, + 0x10, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x10, 0x20, 0x70, 0x88, 0x88, 0x88, 0x88, 0x70, + 0x10, 0x20, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70, + 0x50, 0xA8, 0xB0, 0xC8, 0x88, 0x88, 0x88, 0x88, + 0x50, 0xA8, 0x88, 0xC8, 0xA8, 0xA8, 0x98, 0x88, + 0x00, 0x70, 0x88, 0x78, 0x88, 0x78, 0x00, 0xF8, + 0x00, 0x70, 0x88, 0x88, 0x88, 0x70, 0x00, 0xF8, + 0x20, 0x00, 0x20, 0x20, 0x40, 0x88, 0x88, 0x70, + 0x00, 0x00, 0x00, 0x78, 0x40, 0x40, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xF0, 0x10, 0x10, 0x00, 0x00, + 0x40, 0xC8, 0x50, 0xE0, 0x50, 0xA8, 0x10, 0x38, + 0x40, 0xC8, 0x50, 0xE0, 0x50, 0xD0, 0x78, 0x10, + 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, + 0x00, 0x10, 0x28, 0x50, 0xA0, 0x50, 0x28, 0x10, + 0x00, 0x40, 0xA0, 0x50, 0x28, 0x50, 0xA0, 0x40, + 0x20, 0x90, 0x48, 0x20, 0x90, 0x48, 0x20, 0x90, + 0x56, 0xAE, 0x51, 0xAC, 0x55, 0xA8, 0x50, 0xA8, + 0x68, 0xD8, 0xB0, 0x68, 0xD8, 0xB6, 0x6F, 0xD8, + 0x20, 0x20, 0x27, 0x22, 0x23, 0x22, 0x24, 0x20, + 0x20, 0x22, 0x27, 0xE2, 0x25, 0x23, 0x24, 0x20, + 0x23, 0x24, 0xE5, 0x23, 0xE4, 0x27, 0x23, 0x20, + 0x21, 0x25, 0x24, 0xE5, 0x23, 0x24, 0x23, 0x20, + 0x01, 0x05, 0x04, 0xFE, 0x2D, 0x28, 0x2F, 0x28, + 0x06, 0x03, 0xE0, 0x20, 0xE0, 0x20, 0x23, 0x20, + 0x2F, 0x2D, 0xE8, 0x0E, 0xE9, 0x2C, 0x28, 0x28, + 0x2F, 0x2B, 0x28, 0x2F, 0x2F, 0x28, 0x28, 0x28, + 0x03, 0x00, 0x06, 0xFC, 0x0A, 0xED, 0x2B, 0x28, + 0x2C, 0x2E, 0x2D, 0xE8, 0x08, 0xF8, 0x00, 0x00, + 0x29, 0x28, 0x28, 0xF8, 0x03, 0x01, 0x00, 0x00, + 0x22, 0xE0, 0x20, 0xE0, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x05, 0xE3, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x3E, 0x04, 0x01, 0x04, 0x00, + 0x21, 0x20, 0x20, 0xF8, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x02, 0x00, 0xF8, 0x20, 0x23, 0x21, 0x20, + 0x27, 0x24, 0x20, 0x38, 0x20, 0x20, 0x20, 0x20, + 0x00, 0x00, 0x00, 0xF8, 0x00, 0x00, 0x00, 0x00, + 0x20, 0x20, 0x20, 0xF8, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x24, 0x38, 0x20, 0x38, 0x20, 0x20, 0x20, + 0xA0, 0xA0, 0xA2, 0xB8, 0xA0, 0xA0, 0xA2, 0xA0, + 0xA0, 0xA4, 0xA0, 0xB8, 0x80, 0xFF, 0x06, 0x00, + 0x07, 0x06, 0x04, 0xFD, 0x80, 0xBF, 0xA0, 0xA0, + 0x50, 0x53, 0x50, 0xD9, 0x05, 0xF9, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xF8, 0x00, 0xD8, 0x50, 0x50, + 0x50, 0x50, 0x50, 0x58, 0x40, 0x58, 0x50, 0x50, + 0x00, 0x00, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0x00, + 0x50, 0x50, 0x50, 0xD8, 0x00, 0xD8, 0x50, 0x50, + 0x20, 0x20, 0x20, 0xF8, 0x00, 0xF8, 0x00, 0x00, + 0x50, 0x50, 0x50, 0x50, 0xF8, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xF8, 0x00, 0xF8, 0x20, 0x20, + 0x00, 0x00, 0x00, 0xF8, 0x50, 0x50, 0x50, 0x50, + 0x50, 0x50, 0x50, 0x78, 0x00, 0x00, 0x00, 0x00, + 0x20, 0x38, 0x20, 0x38, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x38, 0x20, 0x38, 0x20, 0x20, + 0x00, 0x00, 0x00, 0x78, 0x50, 0x50, 0x50, 0x50, + 0x50, 0x50, 0x50, 0xD8, 0x50, 0x50, 0x50, 0x50, + 0x20, 0x20, 0xF8, 0x00, 0xF8, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0xE0, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x38, 0x20, 0x20, 0x20, 0x20, + 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, + 0x00, 0x00, 0x00, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, + 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, + 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, + 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x68, 0x90, 0x68, 0x00, 0x00, + 0x60, 0x90, 0x90, 0xE0, 0x90, 0x88, 0xC8, 0xB0, + 0xF8, 0x88, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0xF8, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x58, + 0xF8, 0x88, 0x80, 0x40, 0x20, 0x40, 0x88, 0xF8, + 0x00, 0x00, 0x00, 0x00, 0x78, 0x90, 0x90, 0x60, + 0x00, 0x00, 0x00, 0x88, 0x88, 0x98, 0xE8, 0x80, + 0x00, 0x00, 0x00, 0x58, 0xA0, 0x20, 0x20, 0x20, + 0xF8, 0x70, 0xA8, 0xA8, 0xA8, 0xA8, 0x70, 0xF8, + 0x70, 0x88, 0x88, 0xF8, 0x88, 0x88, 0x88, 0x70, + 0x70, 0x88, 0x88, 0x88, 0x50, 0x50, 0x50, 0xD8, + 0x70, 0x88, 0x80, 0x40, 0x70, 0x88, 0x88, 0x70, + 0x00, 0x00, 0x00, 0x88, 0xD8, 0xA8, 0xD8, 0x88, + 0x00, 0x00, 0x00, 0x70, 0x98, 0xA8, 0xC8, 0x70, + 0x38, 0x40, 0x80, 0xE0, 0x80, 0x80, 0x40, 0x38, + 0x70, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, + 0x00, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, + 0x00, 0x20, 0x70, 0x20, 0x20, 0x00, 0xF8, 0x00, + 0x40, 0x20, 0x10, 0x08, 0x10, 0x20, 0x40, 0xF8, + 0x10, 0x20, 0x40, 0x80, 0x40, 0x20, 0x10, 0xF8, + 0x10, 0x28, 0x28, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0xA0, 0xA0, 0x40, + 0x00, 0x20, 0x00, 0x70, 0x00, 0x20, 0x00, 0x00, + 0x00, 0x50, 0xA8, 0x00, 0x50, 0xA8, 0x00, 0x00, + 0x20, 0x50, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x70, 0x70, 0x70, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, + 0x38, 0x20, 0x20, 0x20, 0x20, 0xA0, 0x60, 0x20, + 0x40, 0xA0, 0xA0, 0xA0, 0x00, 0x00, 0x00, 0x00, + 0x40, 0xA0, 0x40, 0xE0, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +//----------------------------------------------------------------------------- +// Global variables +//----------------------------------------------------------------------------- + +const Font gFont = {5, 8, 0, 255, pData}; + diff --git a/components/slcd/s7lstklcd/s7lstklcd.c b/components/slcd/s7lstklcd/s7lstklcd.c new file mode 100644 index 0000000..7ab1671 --- /dev/null +++ b/components/slcd/s7lstklcd/s7lstklcd.c @@ -0,0 +1,187 @@ +/* --------------------------------------------------------------------------- + * ATMEL Microcontroller Software Support + * ---------------------------------------------------------------------------- + * Copyright (c) 2008, Atmel Corporation + + * 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 disclaimer below. + * + * Atmel's name may not be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE + * DISCLAIMED. IN NO EVENT SHALL ATMEL 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. + * ---------------------------------------------------------------------------- + */ + +//----------------------------------------------------------------------------- +// Headers +//----------------------------------------------------------------------------- + +#include "s7lstklcd.h" +#include "font.h" +#include +#include +#include + +//----------------------------------------------------------------------------- +// Global functions +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +/// Switches a pixel on the SLCD on or off. +/// \param x X-coordinate of pixel. +/// \param y Y-coordinate of pixel. +/// \param set If 1, pixel is displayed; otherwise it is hidden. +//----------------------------------------------------------------------------- +void S7LSTKLCD_Pixel(unsigned char x, unsigned char y, unsigned char set) +{ + unsigned int symbol = y * S7LSTKLCD_WIDTH + x; + unsigned int common = symbol / S7LSTKLCD_NUM_SEGMENTS; + unsigned int segment = symbol % S7LSTKLCD_NUM_SEGMENTS; + unsigned int reg = segment / 32; + unsigned int bit = segment % 32; + + SANITY_CHECK(x < S7LSTKLCD_WIDTH); + SANITY_CHECK(y < S7LSTKLCD_HEIGHT); + + if (set) { + + AT91C_BASE_SLCDC->SLCDC_MEM[common * 2 + reg] |= (1 << bit); + } + else { + + AT91C_BASE_SLCDC->SLCDC_MEM[common * 2 + reg] &= ~(1 << bit); + } +} + +//----------------------------------------------------------------------------- +/// Displays a character at the given position on the SLCD. The character is +/// clipped according to the SLCD dimensions. +/// Note that x and y can be negative (upper-left part of character will be +/// clipped). +/// \param x X-coordinate of upper-left corner of character. +/// \param y Y-coordinate of upper-left corner of character. +/// \param c Character to display. +//----------------------------------------------------------------------------- +void S7LSTKLCD_Char(signed int x, signed int y, unsigned char c) +{ + const unsigned char *pChar; + signed int i, j; + + SANITY_CHECK(c >= gFont.firstCharacter); + SANITY_CHECK(c <= gFont.lastCharacter); + + // Optimization: return if coordinates are out of bounds + if ((x > S7LSTKLCD_WIDTH) || ((x+gFont.width) < 0) + || (y > S7LSTKLCD_HEIGHT) || ((y+gFont.height) < 0)) { + + return; + } + + // Get pointer to character in font data + pChar = &(gFont.pData[(c - gFont.firstCharacter) * gFont.height]); + + // Display character at requested location + for (j=0; j < gFont.height; j++) { + for (i=0; i < gFont.width; i++) { + + if (((x+i) >= 0) && ((x+i) < S7LSTKLCD_WIDTH) + && ((y+i >= 0)) && ((y+i) < S7LSTKLCD_HEIGHT)) { + + S7LSTKLCD_Pixel(x+i, y+j, (pChar[j] & (1 << (FONT_CHAR_MAX_WIDTH-i-1)))); + } + } + } +} + +//----------------------------------------------------------------------------- +/// Displays a string on the SLCD given the top-left corner coordinates. String +/// is clipped according to the SLCD dimensions. +/// X and Y can be negative (top-left clipping). +/// \param x X-coordinate of top-left corner. +/// \param y Y-coordinate of top-left corner. +/// \param pString String to display. +//----------------------------------------------------------------------------- +void S7LSTKLCD_String(signed int x, signed int y, const char *pString) +{ + signed int j; + while (*pString != 0) { + + // Display character + S7LSTKLCD_Char(x, y, *pString); + x += gFont.width + 1; + pString++; + + // Vertical blank line + if ((*pString != 0) && ((x-1) < S7LSTKLCD_WIDTH) && ((x-1) > 0)) { + + for (j=0; j < gFont.height; j++) { + + if (((j+y) >= 0) && ((j+y) < S7LSTKLCD_HEIGHT)) { + + S7LSTKLCD_Pixel(x-1, y+j, 0); + } + } + } + } +} + +//----------------------------------------------------------------------------- +/// Returns the height and width in pixels of the given string. +/// \param pString String to examinate. +/// \param pWidth Width of string in pixels. +/// \param pHeight Height of string in pixels. +//----------------------------------------------------------------------------- +void S7LSTKLCD_GetStringSize( + const char *pString, + signed int *pWidth, + signed int *pHeight) +{ + unsigned int size = 0; + + // Get string size + while (*pString != 0) { + + size++; + pString++; + } + + // Return size in pixel + if (pWidth) { + + *pWidth = size * (gFont.width + 1) - 1; + } + if (pHeight) { + + *pHeight = gFont.height; + } +} + +//----------------------------------------------------------------------------- +/// Displays the given string on the SLCD, centered along the X and Y axis +/// (this may result in the string being clipped). +/// \param pString String to display. +//----------------------------------------------------------------------------- +void S7LSTKLCD_PutString(const char *pString) +{ + signed int width, height; + SANITY_CHECK(pString); + + S7LSTKLCD_GetStringSize(pString, &width, &height); + S7LSTKLCD_String((S7LSTKLCD_WIDTH - width) / 2, (S7LSTKLCD_HEIGHT - height) / 2, pString); +} + diff --git a/components/slcd/s7lstklcd/s7lstklcd.dir b/components/slcd/s7lstklcd/s7lstklcd.dir new file mode 100644 index 0000000..145e4d3 --- /dev/null +++ b/components/slcd/s7lstklcd/s7lstklcd.dir @@ -0,0 +1,40 @@ +/* ---------------------------------------------------------------------------- + * ATMEL Microcontroller Software Support + * ---------------------------------------------------------------------------- + * Copyright (c) 2008, Atmel Corporation + * + * 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 disclaimer below. + * + * Atmel's name may not be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE + * DISCLAIMED. IN NO EVENT SHALL ATMEL 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. + * ---------------------------------------------------------------------------- + */ + +//------------------------------------------------------------------------------ +/// \dir +/// +/// !!!Purpose +/// +/// This directory contains APIs for segment LCD display of AT91SAM7L-STK board. +/// +/// !!!Contents +/// +/// Contains code for display pixel, char and string. +//------------------------------------------------------------------------------ \ No newline at end of file diff --git a/components/slcd/s7lstklcd/s7lstklcd.h b/components/slcd/s7lstklcd/s7lstklcd.h new file mode 100644 index 0000000..e5614df --- /dev/null +++ b/components/slcd/s7lstklcd/s7lstklcd.h @@ -0,0 +1,83 @@ +/* ---------------------------------------------------------------------------- + * ATMEL Microcontroller Software Support + * ---------------------------------------------------------------------------- + * Copyright (c) 2008, Atmel Corporation + * + * 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 disclaimer below. + * + * Atmel's name may not be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE + * DISCLAIMED. IN NO EVENT SHALL ATMEL 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. + * ---------------------------------------------------------------------------- + */ + + //------------------------------------------------------------------------------ +/// \unit +/// +/// !!!Purpose +/// +/// Interface for displaying on segment LCD of AT91SAM7L-STK board. +/// +/// !!!Usage +/// +/// -# call corresponding function to display pixel, char and string. +//------------------------------------------------------------------------------ + +#ifndef S7LSTKLCD_H +#define S7LSTKLCD_H + +//----------------------------------------------------------------------------- +// Defines +//----------------------------------------------------------------------------- + +/// Number of segments in SLCD +#define S7LSTKLCD_NUM_SEGMENTS 40 +/// Number of commons in SLCD +#define S7LSTKLCD_NUM_COMMONS 10 + +/// SLCD width in pixels. +#define S7LSTKLCD_WIDTH 40 +/// SLCD height in pixels. +#define S7LSTKLCD_HEIGHT 10 + +//----------------------------------------------------------------------------- +// Global Functions +//----------------------------------------------------------------------------- + +extern void S7LSTKLCD_Pixel( + unsigned char x, + unsigned char y, + unsigned char set); + +extern void S7LSTKLCD_Char( + signed int x, + signed int y, + unsigned char c); + +extern void S7LSTKLCD_String(signed int x, signed int y, const char *pString); + +extern void S7LSTKLCD_GetStringSize( + const char *pString, + signed int *pWidth, + signed int *pHeight); + +extern void S7LSTKLCD_PutString(const char *pString); + +#endif + -- cgit v1.2.3