Skip to content

Commit

Permalink
Targets: RISCV: Main: Add native clearScreen
Browse files Browse the repository at this point in the history
Now we can clean terminal with the clear() command

Signed-off-by: Matheus Castello <matheus@castello.eng.br>
  • Loading branch information
microhobby committed Dec 13, 2018
1 parent 9f6393b commit 803e8ff
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion targets/riscv/main.c
Expand Up @@ -24,17 +24,33 @@
#include "irq.h"
#include "uart.h"

#include "platform_config.h"
#include "jslex.h"
#include "jsvar.h"
#include "jsparse.h"
#include "jswrap_json.h"

#include "jsinteractive.h"
#include "jshardware.h"
#include "jswrapper.h"

void addNativeFunction(const char *name, void (*callbackPtr)(void)) {
jsvObjectSetChildAndUnLock(execInfo.root, name, jsvNewNativeFunction(callbackPtr, JSWAT_VOID));
}

static void clearScreen()
{
jsiConsolePrint("\033[2J");
jsiConsolePrint("\033[H");
}

int main (void)
{
jshInit();
jsvInit(0);
jsiInit(true);

addNativeFunction("clear", clearScreen);

while(1)
jsiLoop();
}

0 comments on commit 803e8ff

Please sign in to comment.