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:
Fri Sep 28 04:35:00 2012 +0000
Revision:
12:3ee3062cc11c
Parent:
11:fede136943a9
Child:
16:370b9e559f92
Converted to completely use PS/2 keyboard for console; Also added a couple of commands

Who changed what in which revision?

UserRevisionLine numberNew contents of line
earlz 12:3ee3062cc11c 1 #ifndef KEYBOARD_H
earlz 12:3ee3062cc11c 2 #define KEYBOARD_H
earlz 12:3ee3062cc11c 3
earlz 12:3ee3062cc11c 4 #include "stdint.h"
earlz 12:3ee3062cc11c 5 /**This is basically a straight rip off of my x86 OS project AlloyOS. I just ported the keyboard driver from it cause it always treated me well**/
earlz 12:3ee3062cc11c 6
earlz 12:3ee3062cc11c 7
earlz 12:3ee3062cc11c 8 #define KEYBOARD_DATAPIN p11
earlz 12:3ee3062cc11c 9 #define KEYBOARD_CLOCKPIN p12
earlz 12:3ee3062cc11c 10
earlz 12:3ee3062cc11c 11 //how many keys the buffer can hold
earlz 12:3ee3062cc11c 12 #define KBD_BUFFER_SIZE 128
earlz 12:3ee3062cc11c 13
earlz 12:3ee3062cc11c 14 //key defines
earlz 12:3ee3062cc11c 15 #define LSHIFT_KEY 0x12
earlz 12:3ee3062cc11c 16 #define RSHIFT_KEY 0x59
earlz 12:3ee3062cc11c 17
earlz 12:3ee3062cc11c 18 #define CTRL_KEY 0xF3
earlz 12:3ee3062cc11c 19 #define ALT_KEY 0xF4
earlz 12:3ee3062cc11c 20 #define CAPS_KEY 0x58
earlz 12:3ee3062cc11c 21 #define NUM_KEY 0x77
earlz 12:3ee3062cc11c 22 #define SCROLL_KEY 0xF7
earlz 12:3ee3062cc11c 23 //#define F_BASE_KEY 0xFF //59 is F1, 60 is F2, and so on until F10
earlz 12:3ee3062cc11c 24 #define HOME_KEY 0xFF
earlz 12:3ee3062cc11c 25 #define UP_KEY 0xFF
earlz 12:3ee3062cc11c 26 #define PAGE_UP_KEY 0xFF
earlz 12:3ee3062cc11c 27 #define LEFT_KEY 0xFF
earlz 12:3ee3062cc11c 28 #define RIGHT_KEY 0xFF
earlz 12:3ee3062cc11c 29 #define END_KEY 0xFF
earlz 12:3ee3062cc11c 30 #define DOWN_KEY 0xFF
earlz 12:3ee3062cc11c 31 #define PAGE_DOWN_KEY 0xFF
earlz 12:3ee3062cc11c 32 #define INSERT_KEY 0xFF
earlz 12:3ee3062cc11c 33 #define DEL_KEY 0xFF
earlz 12:3ee3062cc11c 34 #define F11_KEY 0xFF
earlz 12:3ee3062cc11c 35 #define F12_KEY 0xFF
earlz 12:3ee3062cc11c 36
earlz 12:3ee3062cc11c 37 #define SCROLL_LED 1
earlz 12:3ee3062cc11c 38 #define NUM_LED 2
earlz 12:3ee3062cc11c 39 #define CAPS_LED 4
earlz 12:3ee3062cc11c 40
earlz 12:3ee3062cc11c 41
earlz 12:3ee3062cc11c 42 extern const char kbdus[0x84];
earlz 12:3ee3062cc11c 43 extern const char kbdus_caps[0x84];
earlz 12:3ee3062cc11c 44
earlz 12:3ee3062cc11c 45 typedef struct {
earlz 12:3ee3062cc11c 46 unsigned char caps;
earlz 12:3ee3062cc11c 47 unsigned char shift;
earlz 12:3ee3062cc11c 48 unsigned char scroll;
earlz 12:3ee3062cc11c 49 unsigned char num;
earlz 12:3ee3062cc11c 50 unsigned char ctrl;
earlz 12:3ee3062cc11c 51 unsigned char alt;
earlz 12:3ee3062cc11c 52 }
earlz 12:3ee3062cc11c 53 shift_locks; /*for simplicity and speed*/
earlz 12:3ee3062cc11c 54
earlz 12:3ee3062cc11c 55 extern volatile shift_locks kbd_shifts;
earlz 12:3ee3062cc11c 56
earlz 12:3ee3062cc11c 57 typedef struct {
earlz 12:3ee3062cc11c 58 uint16_t scancode;
earlz 12:3ee3062cc11c 59 uint8_t asci;
earlz 12:3ee3062cc11c 60 }kbd_key;
earlz 12:3ee3062cc11c 61
earlz 12:3ee3062cc11c 62 void keyboard_callback(PS2KB kb, uint8_t val);
earlz 12:3ee3062cc11c 63 void keyboard_init();
earlz 12:3ee3062cc11c 64
earlz 12:3ee3062cc11c 65 int kbd_PutBuffer(uint16_t scan,uint8_t asci);
earlz 12:3ee3062cc11c 66
earlz 12:3ee3062cc11c 67 kbd_key kbd_PopBuffer();
earlz 12:3ee3062cc11c 68 uint8_t kbd_GetKey();
earlz 12:3ee3062cc11c 69 void kbd_update_leds(uint8_t status);
earlz 12:3ee3062cc11c 70 int kbd_DoShifts(uint8_t scan);
earlz 12:3ee3062cc11c 71 int kbd_DoUnshifts(uint8_t scan);
earlz 12:3ee3062cc11c 72 void keyboard_callback(PS2KB kb, uint8_t val);
earlz 12:3ee3062cc11c 73
earlz 12:3ee3062cc11c 74
earlz 12:3ee3062cc11c 75
earlz 12:3ee3062cc11c 76 #endif