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

* chronos display putchar included

This commit is contained in:
Kaspar Schleiser 2010-12-14 16:40:47 +01:00
parent 6ff96f0ab1
commit b473e44b56
6 changed files with 69 additions and 1 deletions

View File

@ -2,7 +2,7 @@ SubDir TOP board chronos ;
HDRS += $(TOP)/board/$(CPU)/include ;
Module board : debug_uart.c board_init.c ;
Module board : putchar.c board_init.c ;
UseModule board ;
SubInclude TOP board $(BOARD) drivers ;

View File

@ -5,3 +5,5 @@ HDRS += $(TOP)/board/$(CPU)/drivers/include ;
Module board_display : display.c display1.c ;
Module board_cc110x : cc430-cc110x.c : cc110x_cc430 ;
Module board_buzzer : buzzer.c : hwtimer ;
Module display_putchar : display_putchar.c : board_display ;

View File

@ -0,0 +1,42 @@
#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();
void init_display_putchar() {
memset(display_buf, '\0', 11);
_putchar = putchar_to_display;
}
void putchar_to_display(int c) {
if (c == '\n') {
display_buf[4] = 1;
return;
}
if (display_buf[4]) {
memset(display_buf, '\0', 11);
} else {
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);
}

View File

@ -0,0 +1,6 @@
#ifndef __DISPLAY_PUTCHAR_H
#define __DISPLAY_PUTCHAR_H
void init_display_putchar();
#endif /* __DISPLAY_PUTCHAR_H */

11
chronos/putchar.c Normal file
View File

@ -0,0 +1,11 @@
static void _dummy(int c) {
}
void (*_putchar)(int c) = _dummy;
int putchar(int c)
{
_putchar(c);
return c;
}

7
msb-430-common/putchar.c Normal file
View File

@ -0,0 +1,7 @@
#include <stdio.h>
void (_putchar(int)) = uart1_putchar;
void putchar(int c) {
_putchar(c);
}