<h1>include/lc7981.h</h1><ahref="lc7981_8h.html">Go to the documentation of this file.</a><divclass="fragment"><preclass="fragment"><aname="l00001"></a>00001 <spanclass="comment">/*</span>
<aname="l00021"></a>00021 <spanclass="comment"> * The Initial Developer of the Original Code is Sebastian Schumb (webmaster@sebastians-site.de).</span>
<aname="l00041"></a><aclass="code"href="lc7981_8h.html#a8e945df7ca614325cafa08258e82a63c">00041</a><spanclass="preprocessor">#define LCD_CTRL PORTA </span>
<aname="l00050"></a><aclass="code"href="lc7981_8h.html#abd18e47e71697a28fd0ca765cefc7411">00050</a><spanclass="preprocessor">#define LCD_DATA_PIN PIND </span>
<aname="l00074"></a>00074 <spanclass="preprocessor"></span><spanclass="keywordtype">void</span><aclass="code"href="lc7981_8c.html#a9b18aca098d68e55bd7dd4b83f4f36e9"title="lcd_init set the to default values.">lcd_init</a>(uint8_t mode);
<aname="l00075"></a>00075 <spanclass="keywordtype">void</span><aclass="code"href="lc7981_8c.html#a35c08b1fa742e650f4873939707b893b"title="Clears the display by setting the whole memory to 0.">lcd_clear</a>(<spanclass="keywordtype">void</span>);
<aname="l00077"></a>00077 <spanclass="keywordtype">void</span><aclass="code"href="lc7981_8c.html#a30251238a49999658455fdb0233757fb"title="Outputs text in at the current cursor position.">lcd_write_text</a>(<spanclass="keywordtype">char</span> *txt);
<aname="l00078"></a>00078 <spanclass="keywordtype">void</span><aclass="code"href="lc7981_8c.html#adbf47a5efdf02367ded1ebf8f9edb5fe"title="Set the display cursor to a specific location.">lcd_gotoxy</a>(uint8_t x, uint8_t y);
<aname="l00080"></a>00080 <spanclass="keywordtype">void</span><aclass="code"href="lc7981_8c.html#a735111507ed83172f58d5af2953e31c6"title="set or unset a pixel at the specified location">lcd_plot_pixel</a>(uint8_t x, uint8_t y, uint8_t <spanclass="keyword">set</span>);
<aname="l00081"></a>00081 <spanclass="keywordtype">void</span><aclass="code"href="lc7981_8c.html#aa89be137ee35d3fd7e88782aafb0efdf"title="This function will plot a bitmap with the upper left corner to the given coordinates...">lcd_plot_bitmap</a>(uint8_t x, uint8_t y, PGM_P bitmap, uint8_t w, uint8_t h);
<aname="l00084"></a>00084 <spanclass="keywordtype">void</span><aclass="code"href="lc7981_8c.html#a2615737020b222e49a4d9c8d08a54f43"title="Plots a single character in graphicmode.">lcd_plot_char</a>(uint8_t x, uint8_t y_off, uint8_t c, uint8_t fw, uint8_t fh, PGM_P font);
<aname="l00085"></a>00085 <spanclass="keywordtype">void</span><aclass="code"href="lc7981_8c.html#a71a77094675e2850e8a4b442fb6a366e"title="Plots a text using lcd_plot_char.">lcd_plot_text</a>(uint8_t x, uint8_t y_off, <spanclass="keyword">const</span><spanclass="keywordtype">char</span> *text, uint8_t fw, uint8_t fh, PGM_P font);
<aname="l00086"></a>00086 <spanclass="keywordtype">void</span><aclass="code"href="lc7981_8c.html#a0af06316c8d3d3a57b1ddcf949d85a8c"title="Plots a text using lcd_plot_char.">lcd_plot_pgmtext</a>(uint8_t x, uint8_t y_off, PGM_P text, uint8_t fw, uint8_t fh, PGM_P font);
<aname="l00089"></a>00089 <spanclass="keyword">static</span><spanclass="keyword">inline</span><spanclass="keywordtype">void</span><aclass="code"href="lc7981_8h.html#ae6e048011d567dd2859901544ebf7051"title="Generates the strobe signal for writing data.">lcd_strobe</a>(<spanclass="keywordtype">void</span>);
<aname="l00090"></a>00090 <spanclass="keyword">static</span><spanclass="keyword">inline</span><spanclass="keywordtype">void</span><aclass="code"href="lc7981_8h.html#a31db85f1f48f4802c24218bc165ea4e1"title="Writes a command and a data byte to the lcd.">lcd_write_command</a>(uint8_t cmd, uint8_t data);
<aname="l00091"></a>00091 <spanclass="keyword">static</span><spanclass="keyword">inline</span> uint8_t <aclass="code"href="lc7981_8h.html#a2753ae63b5b2e212d5dc101749b76249"title="Reads a byte from the display memory.">lcd_read_byte</a>(uint16_t pos);
<aname="l00101"></a><aclass="code"href="lc7981_8h.html#ae6e048011d567dd2859901544ebf7051">00101</a><spanclass="keyword">static</span><spanclass="keyword">inline</span><spanclass="keywordtype">void</span><aclass="code"href="lc7981_8h.html#ae6e048011d567dd2859901544ebf7051"title="Generates the strobe signal for writing data.">lcd_strobe</a>(<spanclass="keywordtype">void</span>) {
<aname="l00102"></a>00102 <aclass="code"href="lc7981_8h.html#ae14be306d3620577abc8613d40401b04"title="Set the strobe pin high.">lcd_en_high</a>();
<aname="l00103"></a>00103 _delay_us(1);
<aname="l00104"></a>00104 <aclass="code"href="lc7981_8h.html#ad8dcdb36a9410fd96b2c936b7c9355dd"title="Set the strobe pin low.">lcd_en_low</a>();
<aname="l00115"></a><aclass="code"href="lc7981_8h.html#a31db85f1f48f4802c24218bc165ea4e1">00115</a><spanclass="keyword">static</span><spanclass="keyword">inline</span><spanclass="keywordtype">void</span><aclass="code"href="lc7981_8h.html#a31db85f1f48f4802c24218bc165ea4e1"title="Writes a command and a data byte to the lcd.">lcd_write_command</a>(uint8_t cmd, uint8_t data) {
<aname="l00116"></a>00116 _delay_us(30);
<aname="l00117"></a>00117 <aclass="code"href="lc7981_8h.html#a7f5ebe0ca71b1298a7d3423850cc82b1"title="Set the Register-Select pin low.">lcd_rw_low</a>();
<aname="l00118"></a>00118 <aclass="code"href="lc7981_8h.html#a795b48274d3f80bc744a707b67fd93e9"title="Set the Register-Select pin high.">lcd_rs_high</a>();
<aname="l00119"></a>00119 <aclass="code"href="lc7981_8h.html#a25e9d818788f36ed74d7c4579f87f2a6"title="Port used for data.">LCD_DATA</a> = cmd;
<aname="l00120"></a>00120 _delay_us(1);
<aname="l00121"></a>00121 <aclass="code"href="lc7981_8h.html#ae6e048011d567dd2859901544ebf7051"title="Generates the strobe signal for writing data.">lcd_strobe</a>();
<aname="l00122"></a>00122
<aname="l00123"></a>00123 <aclass="code"href="lc7981_8h.html#a6edb13d59460246fb4cc32ada1c9f4a8"title="Set the Register-Select pin low.">lcd_rs_low</a>();
<aname="l00124"></a>00124 <aclass="code"href="lc7981_8h.html#a25e9d818788f36ed74d7c4579f87f2a6"title="Port used for data.">LCD_DATA</a> = data;
<aname="l00125"></a>00125 _delay_us(1);
<aname="l00126"></a>00126 <aclass="code"href="lc7981_8h.html#ae6e048011d567dd2859901544ebf7051"title="Generates the strobe signal for writing data.">lcd_strobe</a>();
<aname="l00127"></a>00127
<aname="l00128"></a>00128 }
<aname="l00129"></a>00129
<aname="l00137"></a><aclass="code"href="lc7981_8h.html#a2753ae63b5b2e212d5dc101749b76249">00137</a><spanclass="keyword">static</span><spanclass="keyword">inline</span> uint8_t <aclass="code"href="lc7981_8h.html#a2753ae63b5b2e212d5dc101749b76249"title="Reads a byte from the display memory.">lcd_read_byte</a>(uint16_t pos) {
<aname="l00140"></a>00140 <aclass="code"href="lc7981_8h.html#a31db85f1f48f4802c24218bc165ea4e1"title="Writes a command and a data byte to the lcd.">lcd_write_command</a>(0x0A,(uint8_t) pos );
<aname="l00141"></a>00141 <aclass="code"href="lc7981_8h.html#a31db85f1f48f4802c24218bc165ea4e1"title="Writes a command and a data byte to the lcd.">lcd_write_command</a>(0x0B,(uint8_t) (pos >> 8));
<aname="l00142"></a>00142
<aname="l00143"></a>00143 <spanclass="keywordflow">for</span>(i = 0; i < 2; i++) {
<aname="l00144"></a>00144 _delay_us(30);
<aname="l00145"></a>00145 <aclass="code"href="lc7981_8h.html#a7f5ebe0ca71b1298a7d3423850cc82b1"title="Set the Register-Select pin low.">lcd_rw_low</a>();
<aname="l00146"></a>00146 <aclass="code"href="lc7981_8h.html#a795b48274d3f80bc744a707b67fd93e9"title="Set the Register-Select pin high.">lcd_rs_high</a>();
<aname="l00147"></a>00147 <aclass="code"href="lc7981_8h.html#a25e9d818788f36ed74d7c4579f87f2a6"title="Port used for data.">LCD_DATA</a> = 0x0D;
<aname="l00148"></a>00148 _delay_us(1);
<aname="l00149"></a>00149 <aclass="code"href="lc7981_8h.html#ae14be306d3620577abc8613d40401b04"title="Set the strobe pin high.">lcd_en_high</a>();
<aname="l00150"></a>00150
<aname="l00151"></a>00151 <aclass="code"href="lc7981_8h.html#a0c114e723aa4c162c415fb6d4d963dd7"title="Data-Direction-Register for data.">LCD_DATA_DDR</a> = 0x00;
<aname="l00152"></a>00152 <aclass="code"href="lc7981_8h.html#a6edb13d59460246fb4cc32ada1c9f4a8"title="Set the Register-Select pin low.">lcd_rs_low</a>();
<aname="l00153"></a>00153 <aclass="code"href="lc7981_8h.html#ad0ce3cd9b481370ad4de36eff08440c8"title="Set the Read-Write-Select pin high.">lcd_rw_high</a>();
<aname="l00154"></a>00154 _delay_us(1);
<aname="l00155"></a>00155 data = (uint8_t) <aclass="code"href="lc7981_8h.html#abd18e47e71697a28fd0ca765cefc7411"title="Port used for reading the data.">LCD_DATA_PIN</a>;
<aname="l00156"></a>00156 <aclass="code"href="lc7981_8h.html#ad8dcdb36a9410fd96b2c936b7c9355dd"title="Set the strobe pin low.">lcd_en_low</a>();
<aname="l00157"></a>00157 <aclass="code"href="lc7981_8h.html#a0c114e723aa4c162c415fb6d4d963dd7"title="Data-Direction-Register for data.">LCD_DATA_DDR</a> = 0xFF;
<aname="l00164"></a>00164 <aclass="code"href="lc7981_8h.html#a31db85f1f48f4802c24218bc165ea4e1"title="Writes a command and a data byte to the lcd.">lcd_write_command</a>(0x0A,(uint8_t) pos );
<aname="l00165"></a>00165 <aclass="code"href="lc7981_8h.html#a31db85f1f48f4802c24218bc165ea4e1"title="Writes a command and a data byte to the lcd.">lcd_write_command</a>(0x0B,(uint8_t) (pos >> 8));
<aname="l00166"></a>00166 <aclass="code"href="lc7981_8h.html#a31db85f1f48f4802c24218bc165ea4e1"title="Writes a command and a data byte to the lcd.">lcd_write_command</a>(0x0C,byte);