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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers mbedconsole.h Source File

mbedconsole.h

00001 /*
00002 <Copyright Header>
00003 Copyright (c) 2012 Jordan "Earlz" Earls  <http://lastyearswishes.com>
00004 All rights reserved.
00005 
00006 Redistribution and use in source and binary forms, with or without
00007 modification, are permitted provided that the following conditions
00008 are met:
00009 
00010 1. Redistributions of source code must retain the above copyright
00011    notice, this list of conditions and the following disclaimer.
00012 2. Redistributions in binary form must reproduce the above copyright
00013    notice, this list of conditions and the following disclaimer in the
00014    documentation and/or other materials provided with the distribution.
00015 3. The name of the author may not be used to endorse or promote products
00016    derived from this software without specific prior written permission.
00017    
00018 THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
00019 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
00020 AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
00021 THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00022 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00023 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
00024 OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
00025 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
00026 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
00027 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00028 
00029 This file is part of the MbedConsole project
00030 */
00031 
00032 #ifndef MBEDCONSOLE_H
00033 #define MBEDCONSOLE_H
00034 
00035 #include "mbed.h"
00036 #include "vga640x480g.h"
00037 #include "PS2Keyboard.h"
00038 #include "SDFileSystem.h"
00039 
00040 void vputc(char c);
00041 void vputs(char *s);
00042 char vgetc();
00043 int vgetsl(char *s, int len);
00044 void vsetcursor(int x, int y);
00045 
00046 int strlcmp(const char *s1,const char *s2,size_t count);
00047 
00048 void shell_begin();
00049 
00050 extern PS2Keyboard *ps2kb;
00051 
00052 extern SDFileSystem *sdcard;
00053 
00054 extern Serial serial;
00055 
00056 
00057 class ConsoleStream : public Stream //do this so we get printf and other goodies. Uses C functions for VGA and PS/2
00058 {
00059     public:
00060     ConsoleStream(const char* name):Stream(name){}
00061     protected:
00062  
00063     // Stream implementation functions
00064     virtual int _putc(int value)
00065     {
00066         vputc((char)value);
00067         return 1;
00068     }
00069     virtual int _getc()
00070     {
00071         return vgetc();
00072     }
00073 };
00074 
00075 extern ConsoleStream console;
00076 
00077 
00078 //Byte array of bitmap of 464 x 240 px:
00079 
00080 #define HACKADAY_WIDTH 464
00081 #define HACKADAY_HEIGHT 240
00082 
00083 extern "C" const uint8_t hackadaylogo[];
00084 
00085 
00086 #endif