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
Diff: keyboard.h
- Revision:
- 12:3ee3062cc11c
- Parent:
- 11:fede136943a9
- Child:
- 16:370b9e559f92
diff -r fede136943a9 -r 3ee3062cc11c keyboard.h --- a/keyboard.h Fri Sep 28 04:03:54 2012 +0000 +++ b/keyboard.h Fri Sep 28 04:35:00 2012 +0000 @@ -0,0 +1,76 @@ +#ifndef KEYBOARD_H +#define KEYBOARD_H + +#include "stdint.h" +/**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**/ + + +#define KEYBOARD_DATAPIN p11 +#define KEYBOARD_CLOCKPIN p12 + +//how many keys the buffer can hold +#define KBD_BUFFER_SIZE 128 + +//key defines +#define LSHIFT_KEY 0x12 +#define RSHIFT_KEY 0x59 + +#define CTRL_KEY 0xF3 +#define ALT_KEY 0xF4 +#define CAPS_KEY 0x58 +#define NUM_KEY 0x77 +#define SCROLL_KEY 0xF7 +//#define F_BASE_KEY 0xFF //59 is F1, 60 is F2, and so on until F10 +#define HOME_KEY 0xFF +#define UP_KEY 0xFF +#define PAGE_UP_KEY 0xFF +#define LEFT_KEY 0xFF +#define RIGHT_KEY 0xFF +#define END_KEY 0xFF +#define DOWN_KEY 0xFF +#define PAGE_DOWN_KEY 0xFF +#define INSERT_KEY 0xFF +#define DEL_KEY 0xFF +#define F11_KEY 0xFF +#define F12_KEY 0xFF + +#define SCROLL_LED 1 +#define NUM_LED 2 +#define CAPS_LED 4 + + +extern const char kbdus[0x84]; +extern const char kbdus_caps[0x84]; + +typedef struct { + unsigned char caps; + unsigned char shift; + unsigned char scroll; + unsigned char num; + unsigned char ctrl; + unsigned char alt; +} +shift_locks; /*for simplicity and speed*/ + +extern volatile shift_locks kbd_shifts; + +typedef struct { + uint16_t scancode; + uint8_t asci; +}kbd_key; + +void keyboard_callback(PS2KB kb, uint8_t val); +void keyboard_init(); + +int kbd_PutBuffer(uint16_t scan,uint8_t asci); + +kbd_key kbd_PopBuffer(); +uint8_t kbd_GetKey(); +void kbd_update_leds(uint8_t status); +int kbd_DoShifts(uint8_t scan); +int kbd_DoUnshifts(uint8_t scan); +void keyboard_callback(PS2KB kb, uint8_t val); + + + +#endif \ No newline at end of file