summaryrefslogtreecommitdiff
path: root/n/lcd/src/lcd.c
diff options
context:
space:
mode:
authorburg2006-05-22 16:06:09 +0000
committerburg2006-05-22 16:06:09 +0000
commit89a55a3a208e389f255a0e34e8619fbc52c30ebb (patch)
tree02bd567ca5afd2ace23946ad03bf02e28ea5bd1b /n/lcd/src/lcd.c
parent0c97c0770bb3c6e4f9cdd526700f30029a714f49 (diff)
I2C -> LCD : OK
KEYBD -> ES : KO :-) Faut tuner la lecture clavier... pff
Diffstat (limited to 'n/lcd/src/lcd.c')
-rw-r--r--n/lcd/src/lcd.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/n/lcd/src/lcd.c b/n/lcd/src/lcd.c
index 91483b8..73ae4ca 100644
--- a/n/lcd/src/lcd.c
+++ b/n/lcd/src/lcd.c
@@ -23,6 +23,7 @@
*
* }}} */
#include "common.h"
+#include "modules/twi/twi.h"
#include "modules/utils/utils.h"
#include "modules/uart/uart.h"
#include "modules/proto/proto.h"
@@ -90,6 +91,23 @@ lcd_send_string_n (const char *s, u8 i)
}
}
+//lcd_send_line(const char *s,u8 i,u8 l)
+//{
+// u8 cpt ;
+// lcd_transit_command(0x01); // suffit d'envoyer les bits de gauche à droite : D7D6D5D4 en hexa
+// utils_delay_ms(2);
+// if ( l == 0 )
+// lcd_transit_command(0x02);
+// else
+// lcd_transit_command(0xc0);
+// utils_delay_ms(2);
+// for (cpt = 0 ; cpt < 16 && cpt < i ; cpt++)
+// {
+// lcd_send_character(s[cpt]);
+// }
+//
+//}
+
/* Envois une chaîne de caractère. */
void
lcd_send_string (const char *s)
@@ -152,7 +170,7 @@ key_get (char old_key)
char i = 0;
while ( key_read () == 0 && i < 3 )
{
- utils_delay_ms(100);
+ utils_delay_ms(250); // was 100ms
if ( i == 2 )
old_key = 0;
i++;
@@ -295,17 +313,26 @@ int
main (void)
{
char old_key = 0;
+ uint8_t data_rcpt[TWI_SL_RCPT_SIZE];
sei ();
uart0_init ();
- proto_send0 ('z');
lcd_init ();
- lcd_send_string (" LCD initialise Attend Grub ");
+ twi_init(0x02);
+ proto_send0 ('z');
+ lcd_send_string (" LCD initialise ");
while (1)
{
if (uart0_poll ())
proto_accept (uart0_getc ());
utils_delay_ms(3);
old_key = key_get (old_key);
+
+ if (twi_sl_poll (data_rcpt, TWI_SL_RCPT_SIZE))
+ {
+ lcd_send_string_n(data_rcpt,32);
+ }
+
+ twi_sl_update (&old_key, TWI_SL_SEND_SIZE);
}
return 0;