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:
Wed Sep 26 05:22:44 2012 +0000
Revision:
10:bda85442b674
Parent:
9:4211d638b2e9
Child:
12:3ee3062cc11c
AlloyOS' keyboard driver port is mostly a success. Problem now is that apparently our translation set is for scancode set 1 and not scancode set 2

Who changed what in which revision?

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