mirror of
https://github.com/vivier/EMILE.git
synced 2025-01-03 12:31:57 +00:00
Manage keyboard
This commit is contained in:
parent
488ccb3a9b
commit
424482eb34
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user