Console input
This commit is contained in:
@@ -9,10 +9,12 @@
|
||||
#include "consolevar.h"
|
||||
#include "consolecmd.h"
|
||||
|
||||
#if DUSK_CONSOLE_TERMIOS
|
||||
#include <termios.h>
|
||||
#include <fcntl.h>
|
||||
#if DUSK_CONSOLE_POSIX
|
||||
#include "thread/thread.h"
|
||||
#include <poll.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define DUSK_CONSOLE_POSIX_POLL_RATE 75
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
@@ -46,10 +48,10 @@ typedef struct {
|
||||
|
||||
bool_t visible;
|
||||
|
||||
#if DUSK_CONSOLE_TERMIOS
|
||||
struct termios originalTermios;
|
||||
#if DUSK_CONSOLE_POSIX
|
||||
char_t inputBuffer[CONSOLE_LINE_MAX];
|
||||
int32_t inputBufferLength;
|
||||
thread_t thread;
|
||||
threadmutex_t execMutex;
|
||||
#endif
|
||||
} console_t;
|
||||
|
||||
@@ -95,7 +97,8 @@ void consolePrint(
|
||||
);
|
||||
|
||||
/**
|
||||
* Executes a console command.
|
||||
* Executes a console command. This method is thread safe and can be called from
|
||||
* any thread.
|
||||
*
|
||||
* @param line The line to execute.
|
||||
*/
|
||||
@@ -109,4 +112,13 @@ void consoleUpdate();
|
||||
/**
|
||||
* Disposes of the console.
|
||||
*/
|
||||
void consoleDispose(void);
|
||||
void consoleDispose(void);
|
||||
|
||||
#if DUSK_CONSOLE_POSIX
|
||||
/**
|
||||
* Input thread handler for posix input.
|
||||
*
|
||||
* @param thread The thread that is running.
|
||||
*/
|
||||
void consoleInputThread(thread_t *thread);
|
||||
#endif
|
Reference in New Issue
Block a user