A project to implement a console using the Mbed using VGA for video output and a PS/2 keyboard for the input. The eventual goal is to also include tools for managing SD cards, and a semi-self-hosting programming environment.

Dependencies:   PS2_MbedConsole fastlib SDFileSystem vga640x480g_mbedconsole lightvm mbed

MbedConsole is a cool little project to have a self-contained computer all on an Mbed. So far it has VGA and PS/2 support and can stand alone without a computer powering it. Next planned features are SD card support and a lightweight programmable VM complete with a file editor and self-hosted assembler.

You can view additional details about it at http://earlz.net/tags/mbedconsole

Committer:
earlz
Date:
Mon Sep 17 04:41:37 2012 +0000
Revision:
1:eb209f0468de
Child:
2:e2a4c5d17d59
Getting more and more useful

Who changed what in which revision?

UserRevisionLine numberNew contents of line
earlz 1:eb209f0468de 1 #include "mbedconsole.h"
earlz 1:eb209f0468de 2 LocalFileSystem local("local");
earlz 1:eb209f0468de 3 void shell_begin(){
earlz 1:eb209f0468de 4 vputs(">>Micro eMBEDded Shell v0.1<<\n");
earlz 1:eb209f0468de 5 char *cmd=(char*)malloc(128);
earlz 1:eb209f0468de 6 bool valid=false;
earlz 1:eb209f0468de 7 while(1){
earlz 1:eb209f0468de 8 vputs("> ");
earlz 1:eb209f0468de 9 vgetsl(cmd, 128);
earlz 1:eb209f0468de 10 vputc('\n');
earlz 1:eb209f0468de 11 vputs(cmd);
earlz 1:eb209f0468de 12 valid=false;
earlz 1:eb209f0468de 13 if(strlcmp(cmd, "help", 5)==0){
earlz 1:eb209f0468de 14 valid=true;
earlz 1:eb209f0468de 15 vputs("Command list:\n");
earlz 1:eb209f0468de 16 vputs("help -- this text \n");
earlz 1:eb209f0468de 17 vputs("cls -- clear the screen\n");
earlz 1:eb209f0468de 18 }else if(strlcmp(cmd,"cls",4)==0){
earlz 1:eb209f0468de 19 valid=true;
earlz 1:eb209f0468de 20 vga_cls();
earlz 1:eb209f0468de 21 }else if(strlcmp(cmd,"test", 5)==0){
earlz 1:eb209f0468de 22
earlz 1:eb209f0468de 23 vputs("Opening File...\n"); // Drive should be marked as removed
earlz 1:eb209f0468de 24 FILE *fp = fopen("/local/test.txt", "w");
earlz 1:eb209f0468de 25 if(!fp) {
earlz 1:eb209f0468de 26 vputs("File /local/test.txt could not be opened!\n");
earlz 1:eb209f0468de 27 exit(1);
earlz 1:eb209f0468de 28 }
earlz 1:eb209f0468de 29
earlz 1:eb209f0468de 30 wait(5.0);
earlz 1:eb209f0468de 31
earlz 1:eb209f0468de 32 vputs("Writing Data...\n");
earlz 1:eb209f0468de 33 fprintf(fp, "Hello World!");
earlz 1:eb209f0468de 34
earlz 1:eb209f0468de 35 wait(5.0);
earlz 1:eb209f0468de 36
earlz 1:eb209f0468de 37 vputs("Closing File...\n");
earlz 1:eb209f0468de 38 fclose(fp);
earlz 1:eb209f0468de 39
earlz 1:eb209f0468de 40 // Drive should be restored. this is the same as just returning from main
earlz 1:eb209f0468de 41 wait(5);
earlz 1:eb209f0468de 42 }
earlz 1:eb209f0468de 43 if(!valid){
earlz 1:eb209f0468de 44 vputs("invalid command!\n");
earlz 1:eb209f0468de 45 }
earlz 1:eb209f0468de 46 }
earlz 1:eb209f0468de 47 }
earlz 1:eb209f0468de 48
earlz 1:eb209f0468de 49
earlz 1:eb209f0468de 50