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
mbedconsole.h@20:13556e5bac04, 2013-04-15 (annotated)
- Committer:
- earlz
- Date:
- Mon Apr 15 02:37:02 2013 +0000
- Revision:
- 20:13556e5bac04
- Parent:
- 16:370b9e559f92
Finally got SD card support working. WOW that was trickier than I expected
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
earlz | 16:370b9e559f92 | 1 | /* |
earlz | 16:370b9e559f92 | 2 | <Copyright Header> |
earlz | 16:370b9e559f92 | 3 | Copyright (c) 2012 Jordan "Earlz" Earls <http://lastyearswishes.com> |
earlz | 16:370b9e559f92 | 4 | All rights reserved. |
earlz | 16:370b9e559f92 | 5 | |
earlz | 16:370b9e559f92 | 6 | Redistribution and use in source and binary forms, with or without |
earlz | 16:370b9e559f92 | 7 | modification, are permitted provided that the following conditions |
earlz | 16:370b9e559f92 | 8 | are met: |
earlz | 16:370b9e559f92 | 9 | |
earlz | 16:370b9e559f92 | 10 | 1. Redistributions of source code must retain the above copyright |
earlz | 16:370b9e559f92 | 11 | notice, this list of conditions and the following disclaimer. |
earlz | 16:370b9e559f92 | 12 | 2. Redistributions in binary form must reproduce the above copyright |
earlz | 16:370b9e559f92 | 13 | notice, this list of conditions and the following disclaimer in the |
earlz | 16:370b9e559f92 | 14 | documentation and/or other materials provided with the distribution. |
earlz | 16:370b9e559f92 | 15 | 3. The name of the author may not be used to endorse or promote products |
earlz | 16:370b9e559f92 | 16 | derived from this software without specific prior written permission. |
earlz | 16:370b9e559f92 | 17 | |
earlz | 16:370b9e559f92 | 18 | THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, |
earlz | 16:370b9e559f92 | 19 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY |
earlz | 16:370b9e559f92 | 20 | AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL |
earlz | 16:370b9e559f92 | 21 | THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
earlz | 16:370b9e559f92 | 22 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
earlz | 16:370b9e559f92 | 23 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
earlz | 16:370b9e559f92 | 24 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
earlz | 16:370b9e559f92 | 25 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
earlz | 16:370b9e559f92 | 26 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
earlz | 16:370b9e559f92 | 27 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
earlz | 16:370b9e559f92 | 28 | |
earlz | 16:370b9e559f92 | 29 | This file is part of the MbedConsole project |
earlz | 16:370b9e559f92 | 30 | */ |
earlz | 16:370b9e559f92 | 31 | |
earlz | 2:e2a4c5d17d59 | 32 | #ifndef MBEDCONSOLE_H |
earlz | 2:e2a4c5d17d59 | 33 | #define MBEDCONSOLE_H |
earlz | 2:e2a4c5d17d59 | 34 | |
earlz | 2:e2a4c5d17d59 | 35 | #include "mbed.h" |
earlz | 2:e2a4c5d17d59 | 36 | #include "vga640x480g.h" |
earlz | 9:4211d638b2e9 | 37 | #include "PS2Keyboard.h" |
earlz | 20:13556e5bac04 | 38 | #include "SDFileSystem.h" |
earlz | 2:e2a4c5d17d59 | 39 | |
earlz | 2:e2a4c5d17d59 | 40 | void vputc(char c); |
earlz | 2:e2a4c5d17d59 | 41 | void vputs(char *s); |
earlz | 2:e2a4c5d17d59 | 42 | char vgetc(); |
earlz | 2:e2a4c5d17d59 | 43 | int vgetsl(char *s, int len); |
earlz | 2:e2a4c5d17d59 | 44 | void vsetcursor(int x, int y); |
earlz | 2:e2a4c5d17d59 | 45 | |
earlz | 2:e2a4c5d17d59 | 46 | int strlcmp(const char *s1,const char *s2,size_t count); |
earlz | 2:e2a4c5d17d59 | 47 | |
earlz | 2:e2a4c5d17d59 | 48 | void shell_begin(); |
earlz | 2:e2a4c5d17d59 | 49 | |
earlz | 9:4211d638b2e9 | 50 | extern PS2Keyboard *ps2kb; |
earlz | 3:2bc2b0dce10e | 51 | |
earlz | 20:13556e5bac04 | 52 | extern SDFileSystem *sdcard; |
earlz | 3:2bc2b0dce10e | 53 | |
earlz | 2:e2a4c5d17d59 | 54 | extern Serial serial; |
earlz | 2:e2a4c5d17d59 | 55 | |
earlz | 2:e2a4c5d17d59 | 56 | |
earlz | 9:4211d638b2e9 | 57 | class ConsoleStream : public Stream //do this so we get printf and other goodies. Uses C functions for VGA and PS/2 |
earlz | 9:4211d638b2e9 | 58 | { |
earlz | 9:4211d638b2e9 | 59 | public: |
earlz | 13:442bd2fb4ea0 | 60 | ConsoleStream(const char* name):Stream(name){} |
earlz | 9:4211d638b2e9 | 61 | protected: |
earlz | 9:4211d638b2e9 | 62 | |
earlz | 9:4211d638b2e9 | 63 | // Stream implementation functions |
earlz | 9:4211d638b2e9 | 64 | virtual int _putc(int value) |
earlz | 9:4211d638b2e9 | 65 | { |
earlz | 9:4211d638b2e9 | 66 | vputc((char)value); |
earlz | 9:4211d638b2e9 | 67 | return 1; |
earlz | 9:4211d638b2e9 | 68 | } |
earlz | 9:4211d638b2e9 | 69 | virtual int _getc() |
earlz | 9:4211d638b2e9 | 70 | { |
earlz | 11:fede136943a9 | 71 | return vgetc(); |
earlz | 9:4211d638b2e9 | 72 | } |
earlz | 9:4211d638b2e9 | 73 | }; |
earlz | 9:4211d638b2e9 | 74 | |
earlz | 9:4211d638b2e9 | 75 | extern ConsoleStream console; |
earlz | 9:4211d638b2e9 | 76 | |
earlz | 2:e2a4c5d17d59 | 77 | |
earlz | 13:442bd2fb4ea0 | 78 | //Byte array of bitmap of 464 x 240 px: |
earlz | 13:442bd2fb4ea0 | 79 | |
earlz | 13:442bd2fb4ea0 | 80 | #define HACKADAY_WIDTH 464 |
earlz | 13:442bd2fb4ea0 | 81 | #define HACKADAY_HEIGHT 240 |
earlz | 13:442bd2fb4ea0 | 82 | |
earlz | 13:442bd2fb4ea0 | 83 | extern "C" const uint8_t hackadaylogo[]; |
earlz | 13:442bd2fb4ea0 | 84 | |
earlz | 13:442bd2fb4ea0 | 85 | |
earlz | 1:eb209f0468de | 86 | #endif |