ini
[aversive.git] / modules / devices / ihm / lcd / test / main.c
1 /*  
2  *  Copyright Droids Corporation, Microb Technology, Eirbot (2005)
3  * 
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation; either version 2 of the License, or
7  *  (at your option) any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program; if not, write to the Free Software
16  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  *
18  *  Revision : $Id: main.c,v 1.4.4.2 2007-05-23 17:18:13 zer0 Exp $
19  *
20  */
21
22 #include <stdio.h>
23 #include <aversive/pgmspace.h>
24
25 #include <aversive.h>
26 #include <aversive/wait.h>
27 #include <lcd.h>
28
29
30 #define DELAY 100
31
32 int lcd_dev_putc_delay(char c, FILE* f)
33 {
34   lcd_putc(c);
35   wait_ms(DELAY);
36   return c;
37 }
38
39
40 int main(void)
41 {
42   FILE * slow;
43   uint8_t i;
44
45
46   wait_ms(100);
47
48
49   lcd_init(LCD_DISP_ON);
50
51
52   lcd_putc('j'); // ne doit pas etre visible
53
54
55   lcd_putc('\f'); // effacement
56
57
58
59
60   lcd_gotoxy(5,0);
61   lcd_putc('h'); wait_ms(DELAY);
62   lcd_putc('e'); wait_ms(DELAY);
63   lcd_putc('l'); wait_ms(DELAY);
64   lcd_putc('l'); wait_ms(DELAY);
65   lcd_putc('o'); wait_ms(DELAY);
66
67   lcd_putc('\n');
68
69
70   for(i=0;i<5;i++) lcd_putc(' ');
71
72   lcd_putc('w'); wait_ms(DELAY);
73   lcd_putc('o'); wait_ms(DELAY);
74   lcd_putc('r'); wait_ms(DELAY);
75   lcd_putc('l'); wait_ms(DELAY);
76   lcd_putc('d'); wait_ms(DELAY);
77
78
79
80
81   wait_ms(20*DELAY);
82
83   // with printf :)
84   fdevopen(lcd_dev_putc,NULL);
85  
86   lcd_putc('\f'); // effacement
87   printf_P(PSTR("big brother"));
88
89   wait_ms(20*DELAY);
90
91   slow = fdevopen(lcd_dev_putc_delay,NULL);
92
93   fprintf_P(slow, PSTR("\fl' AVR c'est top\nl' AVR c'est tof"));
94
95   while(1);
96   return 0;
97 }
98
99
100
101