From fc289af0552cbe8f05a107907ead2619da7c2751 Mon Sep 17 00:00:00 2001 From: sebastian Date: Sun, 17 May 2009 18:02:52 +0200 Subject: [PATCH] GLPv3 added --- doc/html/button_8h-source.html | 2 +- doc/html/button_8h.html | 2 +- doc/html/files.html | 2 +- doc/html/globals.html | 2 +- doc/html/globals_defs.html | 2 +- doc/html/globals_func.html | 2 +- doc/html/globals_vars.html | 2 +- doc/html/index.html | 2 +- doc/html/lc7981_8c.html | 13 +++- doc/html/lc7981_8h-source.html | 128 ++++++++++++++++++--------------- doc/html/lc7981_8h.html | 17 +++-- doc/html/main_8c.html | 2 +- doc/latex/doxygen.sty | 4 +- doc/latex/lc7981_8c.tex | 12 +++- doc/latex/lc7981_8h.tex | 14 +++- doc/latex/refman.tex | 2 +- include/lc7981.c | 40 +++++++++-- include/lc7981.h | 16 +++++ 18 files changed, 181 insertions(+), 83 deletions(-) diff --git a/doc/html/button_8h-source.html b/doc/html/button_8h-source.html index d921486..c37fb0c 100644 --- a/doc/html/button_8h-source.html +++ b/doc/html/button_8h-source.html @@ -50,7 +50,7 @@ 00035 0x00,0x00,0x00,0x00}; 00036 -
Generated on Sat May 16 17:13:00 2009 for glcd by  +
Generated on Sun May 17 17:59:55 2009 for glcd by  doxygen 1.5.5
diff --git a/doc/html/button_8h.html b/doc/html/button_8h.html index d4fc267..cf5f266 100644 --- a/doc/html/button_8h.html +++ b/doc/html/button_8h.html @@ -41,7 +41,7 @@

-


Generated on Sat May 16 17:13:00 2009 for glcd by  +
Generated on Sun May 17 17:59:55 2009 for glcd by  doxygen 1.5.5
diff --git a/doc/html/files.html b/doc/html/files.html index 1224001..d355754 100644 --- a/doc/html/files.html +++ b/doc/html/files.html @@ -29,7 +29,7 @@ include/lc7981.h [code] -
Generated on Sat May 16 17:13:00 2009 for glcd by  +
Generated on Sun May 17 17:59:55 2009 for glcd by  doxygen 1.5.5
diff --git a/doc/html/globals.html b/doc/html/globals.html index 27e2df6..58f9c79 100644 --- a/doc/html/globals.html +++ b/doc/html/globals.html @@ -126,7 +126,7 @@ Here is a list of all functions, variables, defines, enums, and typedefs with li : button.h -
Generated on Sat May 16 17:13:00 2009 for glcd by  +
Generated on Sun May 17 17:59:55 2009 for glcd by  doxygen 1.5.5
diff --git a/doc/html/globals_defs.html b/doc/html/globals_defs.html index 0483974..30defd1 100644 --- a/doc/html/globals_defs.html +++ b/doc/html/globals_defs.html @@ -78,7 +78,7 @@ : lc7981.h -
Generated on Sat May 16 17:13:00 2009 for glcd by  +
Generated on Sun May 17 17:59:55 2009 for glcd by  doxygen 1.5.5
diff --git a/doc/html/globals_func.html b/doc/html/globals_func.html index 448d3e3..378a5ae 100644 --- a/doc/html/globals_func.html +++ b/doc/html/globals_func.html @@ -63,7 +63,7 @@ : main.c -
Generated on Sat May 16 17:13:00 2009 for glcd by  +
Generated on Sun May 17 17:59:55 2009 for glcd by  doxygen 1.5.5
diff --git a/doc/html/globals_vars.html b/doc/html/globals_vars.html index c996078..3db2f58 100644 --- a/doc/html/globals_vars.html +++ b/doc/html/globals_vars.html @@ -40,7 +40,7 @@ : button.h -
Generated on Sat May 16 17:13:00 2009 for glcd by  +
Generated on Sun May 17 17:59:55 2009 for glcd by  doxygen 1.5.5
diff --git a/doc/html/index.html b/doc/html/index.html index 7310fe0..79022c9 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -18,7 +18,7 @@

glcd Documentation

0.1beta

-
Generated on Sat May 16 17:13:00 2009 for glcd by  +
Generated on Sun May 17 17:59:55 2009 for glcd by  doxygen 1.5.5
diff --git a/doc/html/lc7981_8c.html b/doc/html/lc7981_8c.html index a9f68fe..f2645dd 100644 --- a/doc/html/lc7981_8c.html +++ b/doc/html/lc7981_8c.html @@ -187,7 +187,16 @@ lcd_init set the to default values.

This function will plot a bitmap with the upper left corner to the given coordinates.

- +
+ If the bitmap doesn't fit on the display at this location, nothing is drawn at all.
+ Unset pixels are treated as transparent
+ This function is by far the most tricky piece of code in this project,
+ don't worry if you don't understand it at first sight.
+ And if you know a better way to do this, tell me.
+

+This function is dedicated to Greta, one of the most important persons in my life so far.
+ Even though I can't remember her actual name.
+

@@ -372,7 +381,7 @@ Currently used mode, can be text or graphic.

-


Generated on Sat May 16 17:13:00 2009 for glcd by  +
Generated on Sun May 17 17:59:55 2009 for glcd by  doxygen 1.5.5
diff --git a/doc/html/lc7981_8h-source.html b/doc/html/lc7981_8h-source.html index 0972e41..d7f9b21 100644 --- a/doc/html/lc7981_8h-source.html +++ b/doc/html/lc7981_8h-source.html @@ -18,64 +18,80 @@ 00003 * 00004 * Created on: 01.05.2009 00005 * Author: sebastian -00006 */ -00007 -00008 #ifndef LC7981_H_ -00009 #define LC7981_H_ LC7981_H_ -00010 -00011 #include <avr/io.h> -00012 #include <util/delay.h> -00013 #include <avr/pgmspace.h> -00014 -00015 #define LCD_CTRL PORTC -00016 #define LCD_CRTL_DDR DDRC -00017 #define LCD_RS PC4 -00018 #define LCD_RW PC2 -00019 #define LCD_EN PC0 -00020 -00021 -00022 -00023 #define LCD_DATA PORTD -00024 #define LCD_DATA_DDR DDRD -00025 -00026 // Macros for (un)setting the control pins -00027 #define lcd_rs_high() (LCD_CTRL |= (1 << LCD_RS)) -00028 #define lcd_rs_low() (LCD_CTRL &= ~(1 << LCD_RS)) -00029 -00030 #define lcd_rw_high() (LCD_CTRL |= (1 << LCD_RW)) -00031 #define lcd_rw_low() (LCD_CTRL &= ~(1 << LCD_RW)) -00032 -00033 #define lcd_en_high() (LCD_CTRL |= (1 << LCD_EN)) -00034 #define lcd_en_low() (LCD_CTRL &= ~(1 << LCD_EN)) -00035 -00036 -00037 #define LCD_TEXT 0 -00038 #define LCD_TEXT_LINES 10 -00039 #define LCD_TEXT_COLUMNS 26 -00040 -00041 #define LCD_GRAPHIC 1 -00042 #define LCD_GRAPHIC_WIDTH 160 -00043 #define LCD_GRAPHIC_HEIGHT 80 -00044 #define PIXEL_ON 1 -00045 #define PIXEL_OFF 0 -00046 -00047 void lcd_init(uint8_t mode); -00048 inline void lcd_clear(); -00049 -00050 void lcd_write_text(char *txt); -00051 inline void lcd_gotoxy(uint8_t x, uint8_t y); +00006 * +00007 * This file is part of Sebastians AVR Library for lc7981. +00008 * +00009 * Sebastians AVR Library is free software: you can redistribute it and/or modify +00010 * it under the terms of the GNU General Public License as published by +00011 * the Free Software Foundation, either version 3 of the License, or +00012 * (at your option) any later version. +00013 * +00014 * Sebastians AVR Library is distributed in the hope that it will be useful, +00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of +00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +00017 * GNU General Public License for more details. +00018 * +00019 * You should have received a copy of the GNU General Public License +00020 * along with Sebastians AVR Library. If not, see <http://www.gnu.org/licenses/>. +00021 * +00022 */ +00023 +00024 #ifndef LC7981_H_ +00025 #define LC7981_H_ LC7981_H_ +00026 +00027 #include <avr/io.h> +00028 #include <util/delay.h> +00029 #include <avr/pgmspace.h> +00030 +00031 #define LCD_CTRL PORTC +00032 #define LCD_CRTL_DDR DDRC +00033 #define LCD_RS PC4 +00034 #define LCD_RW PC2 +00035 #define LCD_EN PC0 +00036 +00037 +00038 +00039 #define LCD_DATA PORTD +00040 #define LCD_DATA_DDR DDRD +00041 +00042 // Macros for (un)setting the control pins +00043 #define lcd_rs_high() (LCD_CTRL |= (1 << LCD_RS)) +00044 #define lcd_rs_low() (LCD_CTRL &= ~(1 << LCD_RS)) +00045 +00046 #define lcd_rw_high() (LCD_CTRL |= (1 << LCD_RW)) +00047 #define lcd_rw_low() (LCD_CTRL &= ~(1 << LCD_RW)) +00048 +00049 #define lcd_en_high() (LCD_CTRL |= (1 << LCD_EN)) +00050 #define lcd_en_low() (LCD_CTRL &= ~(1 << LCD_EN)) +00051 00052 -00053 void lcd_plot_pixel(uint8_t x, uint8_t y, uint8_t set); -00054 void lcd_plot_bitmap(uint8_t x, uint8_t y, const uint8_t *bitmap, uint8_t w, uint8_t h); -00055 -00056 -00057 inline void lcd_strobe(); -00058 inline void lcd_write_command(uint8_t cmd, uint8_t data); -00059 inline uint8_t lcd_read_byte(); -00060 -00061 #endif /* LC7981_H_ */ +00053 #define LCD_TEXT 0 +00054 #define LCD_TEXT_LINES 10 +00055 #define LCD_TEXT_COLUMNS 26 +00056 +00057 #define LCD_GRAPHIC 1 +00058 #define LCD_GRAPHIC_WIDTH 160 +00059 #define LCD_GRAPHIC_HEIGHT 80 +00060 #define PIXEL_ON 1 +00061 #define PIXEL_OFF 0 +00062 +00063 void lcd_init(uint8_t mode); +00064 inline void lcd_clear(); +00065 +00066 void lcd_write_text(char *txt); +00067 inline void lcd_gotoxy(uint8_t x, uint8_t y); +00068 +00069 void lcd_plot_pixel(uint8_t x, uint8_t y, uint8_t set); +00070 void lcd_plot_bitmap(uint8_t x, uint8_t y, const uint8_t *bitmap, uint8_t w, uint8_t h); +00071 +00072 +00073 inline void lcd_strobe(); +00074 inline void lcd_write_command(uint8_t cmd, uint8_t data); +00075 inline uint8_t lcd_read_byte(); +00076 +00077 #endif /* LC7981_H_ */ -
Generated on Sat May 16 17:13:00 2009 for glcd by  +
Generated on Sun May 17 17:59:55 2009 for glcd by  doxygen 1.5.5
diff --git a/doc/html/lc7981_8h.html b/doc/html/lc7981_8h.html index b57907b..96e499c 100644 --- a/doc/html/lc7981_8h.html +++ b/doc/html/lc7981_8h.html @@ -552,13 +552,13 @@ lcd_init set the to default values. void lcd_plot_bitmap ( uint8_t  - x, + x_off, uint8_t  - y, + y_off, @@ -590,7 +590,16 @@ lcd_init set the to default values.

This function will plot a bitmap with the upper left corner to the given coordinates.

- +
+ If the bitmap doesn't fit on the display at this location, nothing is drawn at all.
+ Unset pixels are treated as transparent
+ This function is by far the most tricky piece of code in this project,
+ don't worry if you don't understand it at first sight.
+ And if you know a better way to do this, tell me.
+

+This function is dedicated to Greta, one of the most important persons in my life so far.
+ Even though I can't remember her actual name.
+

@@ -740,7 +749,7 @@ Writes a command and a data byte to the lcd.

-


Generated on Sat May 16 17:13:00 2009 for glcd by  +
Generated on Sun May 17 17:59:55 2009 for glcd by  doxygen 1.5.5
diff --git a/doc/html/main_8c.html b/doc/html/main_8c.html index 4ca6dad..a3f4341 100644 --- a/doc/html/main_8c.html +++ b/doc/html/main_8c.html @@ -46,7 +46,7 @@

-


Generated on Sat May 16 17:13:00 2009 for glcd by  +
Generated on Sun May 17 17:59:55 2009 for glcd by  doxygen 1.5.5
diff --git a/doc/latex/doxygen.sty b/doc/latex/doxygen.sty index 22a36c4..5d8752b 100644 --- a/doc/latex/doxygen.sty +++ b/doc/latex/doxygen.sty @@ -10,8 +10,8 @@ {\fancyplain{}{\bfseries\rightmark}} \rhead[\fancyplain{}{\bfseries\leftmark}] {\fancyplain{}{\bfseries\thepage}} -\rfoot[\fancyplain{}{\bfseries\scriptsize Generated on Sat May 16 17:13:00 2009 for glcd by Doxygen }]{} -\lfoot[]{\fancyplain{}{\bfseries\scriptsize Generated on Sat May 16 17:13:00 2009 for glcd by Doxygen }} +\rfoot[\fancyplain{}{\bfseries\scriptsize Generated on Sun May 17 17:59:55 2009 for glcd by Doxygen }]{} +\lfoot[]{\fancyplain{}{\bfseries\scriptsize Generated on Sun May 17 17:59:55 2009 for glcd by Doxygen }} \cfoot{} \newenvironment{Code} {\footnotesize} diff --git a/doc/latex/lc7981_8c.tex b/doc/latex/lc7981_8c.tex index b78677a..3ad7a1c 100644 --- a/doc/latex/lc7981_8c.tex +++ b/doc/latex/lc7981_8c.tex @@ -73,7 +73,17 @@ lcd\_\-init set the to default values. This function will plot a bitmap with the upper left corner to the given coordinates. -\index{lc7981.c@{lc7981.c}!lcd\_\-plot\_\-pixel@{lcd\_\-plot\_\-pixel}} +\par + If the bitmap doesn't fit on the display at this location, nothing is drawn at all.\par + Unset pixels are treated as transparent \par + This function is by far the most tricky piece of code in this project,\par + don't worry if you don't understand it at first sight. \par + And if you know a better way to do this, tell me.\par + + +This function is dedicated to Greta, one of the most important persons in my life so far.\par + Even though I can't remember her actual name.\par + \index{lc7981.c@{lc7981.c}!lcd\_\-plot\_\-pixel@{lcd\_\-plot\_\-pixel}} \index{lcd\_\-plot\_\-pixel@{lcd\_\-plot\_\-pixel}!lc7981.c@{lc7981.c}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void lcd\_\-plot\_\-pixel (uint8\_\-t {\em x}, \/ uint8\_\-t {\em y}, \/ uint8\_\-t {\em set})}\label{lc7981_8c_735111507ed83172f58d5af2953e31c6} diff --git a/doc/latex/lc7981_8h.tex b/doc/latex/lc7981_8h.tex index 059ace4..fd1ae9f 100644 --- a/doc/latex/lc7981_8h.tex +++ b/doc/latex/lc7981_8h.tex @@ -223,12 +223,22 @@ lcd\_\-init set the to default values. \end{Desc} \index{lc7981.h@{lc7981.h}!lcd\_\-plot\_\-bitmap@{lcd\_\-plot\_\-bitmap}} \index{lcd\_\-plot\_\-bitmap@{lcd\_\-plot\_\-bitmap}!lc7981.h@{lc7981.h}} -\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void lcd\_\-plot\_\-bitmap (uint8\_\-t {\em x}, \/ uint8\_\-t {\em y}, \/ const uint8\_\-t $\ast$ {\em bitmap}, \/ uint8\_\-t {\em w}, \/ uint8\_\-t {\em h})}\label{lc7981_8h_175d691feb304584c8c18e6456e07401} +\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void lcd\_\-plot\_\-bitmap (uint8\_\-t {\em x\_\-off}, \/ uint8\_\-t {\em y\_\-off}, \/ const uint8\_\-t $\ast$ {\em bitmap}, \/ uint8\_\-t {\em w}, \/ uint8\_\-t {\em h})}\label{lc7981_8h_175d691feb304584c8c18e6456e07401} This function will plot a bitmap with the upper left corner to the given coordinates. -\index{lc7981.h@{lc7981.h}!lcd\_\-plot\_\-pixel@{lcd\_\-plot\_\-pixel}} +\par + If the bitmap doesn't fit on the display at this location, nothing is drawn at all.\par + Unset pixels are treated as transparent \par + This function is by far the most tricky piece of code in this project,\par + don't worry if you don't understand it at first sight. \par + And if you know a better way to do this, tell me.\par + + +This function is dedicated to Greta, one of the most important persons in my life so far.\par + Even though I can't remember her actual name.\par + \index{lc7981.h@{lc7981.h}!lcd\_\-plot\_\-pixel@{lcd\_\-plot\_\-pixel}} \index{lcd\_\-plot\_\-pixel@{lcd\_\-plot\_\-pixel}!lc7981.h@{lc7981.h}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void lcd\_\-plot\_\-pixel (uint8\_\-t {\em x}, \/ uint8\_\-t {\em y}, \/ uint8\_\-t {\em set})}\label{lc7981_8h_735111507ed83172f58d5af2953e31c6} diff --git a/doc/latex/refman.tex b/doc/latex/refman.tex index 21494ff..3bbbe3d 100644 --- a/doc/latex/refman.tex +++ b/doc/latex/refman.tex @@ -21,7 +21,7 @@ \vspace*{1cm} {\large Generated by Doxygen 1.5.5}\\ \vspace*{0.5cm} -{\small Sat May 16 17:13:00 2009}\\ +{\small Sun May 17 17:59:55 2009}\\ \end{center} \end{titlepage} \clearemptydoublepage diff --git a/include/lc7981.c b/include/lc7981.c index 54972f9..f44dc10 100644 --- a/include/lc7981.c +++ b/include/lc7981.c @@ -3,8 +3,25 @@ * * Created on: 01.05.2009 * Author: sebastian + * + * This file is part of Sebastians AVR Library for lc7981. + * + * Sebastians AVR Library 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 3 of the License, or + * (at your option) any later version. + * + * Sebastians AVR Library 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 Sebastians AVR Library. If not, see . + * */ + #include "lc7981.h" uint8_t lcd_mode, //!< Currently used mode, can be text or graphic. @@ -251,20 +268,31 @@ uint8_t xr; } } /** - * This function will plot a bitmap with the upper left corner to the given coordinates. + * This function will plot a bitmap with the upper left corner to the given coordinates.\n + * If the bitmap doesn't fit on the display at this location, nothing is drawn at all.\n + * Unset pixels are treated as transparent \n + * This function is by far the most tricky piece of code in this project,\n + * don't worry if you don't understand it at first sight. \n + * And if you know a better way to do this, tell me.\n + * + * This function is dedicated to Greta, one of the most important persons in my life so far.\n + * Even though I can't remember her actual name.\n */ void lcd_plot_bitmap(uint8_t x_off, uint8_t y_off, const uint8_t *bitmap, uint8_t w, uint8_t h) { uint8_t x,y,cur,curs,sr,dr; uint16_t pos; + //check if the bitmap fits on the display if((x_off <= LCD_GRAPHIC_WIDTH - 1) && (y_off <= LCD_GRAPHIC_HEIGHT - 1) && (x_off + w <= LCD_GRAPHIC_WIDTH - 1) && (y_off + h <= LCD_GRAPHIC_HEIGHT - 1)) { + //loop linewise through the bitmap for(y = y_off; y < y_off + h; y++) { cur = 0; + //loop pixelwise through each line for(x = x_off - (x_off % 8); x_off + w > x; x++) { dr = x % 8; - if(dr == 0) { + if(dr == 0) { //load the next byte from display memory pos = y * (LCD_GRAPHIC_WIDTH / 8) + x / 8; lcd_write_command(0x0A,(uint8_t) pos ); lcd_write_command(0x0B,(uint8_t) (pos >> 8)); @@ -273,21 +301,21 @@ uint16_t pos; if((x - x_off) >= 0) { sr = (x - x_off) % 8; - if(sr == 0) { + if(sr == 0) { //load the next byte of the bitmap curs = pgm_read_byte(bitmap++); } - + //grep the pixel from the bitmap and put into the display byte cur = cur | ((( curs & (1 << sr)) >> sr) << dr); } - if(dr == 7) { + if(dr == 7) { //write the current byte to display memory pos = y * (LCD_GRAPHIC_WIDTH / 8) + x / 8; lcd_write_command(0x0A,(uint8_t) pos ); lcd_write_command(0x0B,(uint8_t) (pos >> 8)); lcd_write_command(0x0C,cur); } } - if(dr != 7) { + if(dr != 7) { //write the last byte to display memory if there's one left pos = y * (LCD_GRAPHIC_WIDTH / 8) + x / 8; lcd_write_command(0x0A,(uint8_t) pos ); lcd_write_command(0x0B,(uint8_t) (pos >> 8)); diff --git a/include/lc7981.h b/include/lc7981.h index 0560f2c..9adb916 100644 --- a/include/lc7981.h +++ b/include/lc7981.h @@ -3,6 +3,22 @@ * * Created on: 01.05.2009 * Author: sebastian + * + * This file is part of Sebastians AVR Library for lc7981. + * + * Sebastians AVR Library 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 3 of the License, or + * (at your option) any later version. + * + * Sebastians AVR Library 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 Sebastians AVR Library. If not, see . + * */ #ifndef LC7981_H_