Manage keyboard

This commit is contained in:
Laurent Vivier 2005-08-27 15:48:13 +00:00
parent 488ccb3a9b
commit 424482eb34
2 changed files with 36 additions and 0 deletions

View File

@ -10,6 +10,8 @@
#include "vga.h"
#include "serial.h"
#include "lowmem.h"
#include "keyboard.h"
static int vga_enabled = 0;
@ -39,3 +41,33 @@ void console_putstring(const char *s)
while(*s)
console_putchar(*(s++));
}
#ifdef USE_CLI
int console_keypressed(int timeout)
{
long time = Ticks + timeout;
while (Ticks < time)
{
if (vga_enabled && keyboard_keypressed())
return 1;
if (serial_keypressed())
return 1;
}
return 0;
}
int console_getchar()
{
int c;
if (vga_enabled)
{
c = keyboard_getchar();
if (c)
return c;
}
c = serial_getchar();
return c;
}
#endif

View File

@ -13,5 +13,9 @@
extern void console_init(emile_l2_header_t* info);
extern inline int console_putchar(int c);
extern void console_putstring(const char *s);
#ifdef USE_CLI
extern int console_keypressed(int timeout);
extern int console_getchar(void);
#endif
#endif