1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/boards/chronos/drivers/display_putchar.c

46 lines
991 B
C
Raw Normal View History

2010-12-14 16:40:47 +01:00
#include <stdio.h>
#include <display.h>
#include <string.h>
extern int toupper(int c);
extern void (*_putchar)(int c);
static char display_buf[11];
void putchar_to_display(int c);
2010-12-14 16:40:47 +01:00
void init_display_putchar(void)
{
memset(display_buf, '\0', 11);
_putchar = putchar_to_display;
2010-12-14 16:40:47 +01:00
}
void putchar_to_display(int c)
{
2010-12-14 16:40:47 +01:00
if (c == '\n') {
display_buf[4] = 1;
return;
}
if (display_buf[4]) {
memset(display_buf, '\0', 11);
}
else {
2010-12-14 16:40:47 +01:00
display_buf[0] = display_buf[1];
display_buf[1] = display_buf[2];
display_buf[2] = display_buf[3];
display_buf[3] = display_buf[5];
display_buf[5] = display_buf[6];
display_buf[6] = display_buf[7];
display_buf[7] = display_buf[8];
display_buf[8] = display_buf[9];
}
display_buf[9] = toupper(c);
clear_display_all();
display_chars(LCD_SEG_L1_3_0, display_buf, SEG_ON);
display_chars(LCD_SEG_L2_5_0, display_buf + 4, SEG_ON);
2010-12-14 16:40:47 +01:00
}