|
|
|
@ -2,7 +2,7 @@
|
|
|
|
|
* \file firmware/main.c
|
|
|
|
|
* \brief Main functions for USB-keyboard
|
|
|
|
|
* \author Ronald Schaten <ronald@schatenseite.de>
|
|
|
|
|
* \version $Id: main.c,v 1.1 2008/07/09 20:47:12 rschaten Exp $
|
|
|
|
|
* \version $Id: main.c,v 1.5 2008/07/12 21:05:24 rschaten Exp $
|
|
|
|
|
*
|
|
|
|
|
* License: GNU GPL v2 (see License.txt)
|
|
|
|
|
*/
|
|
|
|
@ -86,7 +86,7 @@
|
|
|
|
|
* - include an USB-hub into the keyboard
|
|
|
|
|
*
|
|
|
|
|
* If you are just a little like me, it won't take you much brainstorming to
|
|
|
|
|
* come up with one useful -- or even better: useless -- ideas. ;-)
|
|
|
|
|
* come up with own useful -- or even better: useless -- ideas. ;-)
|
|
|
|
|
*
|
|
|
|
|
* \section sec_install Building and installing
|
|
|
|
|
*
|
|
|
|
@ -162,7 +162,8 @@
|
|
|
|
|
* I don't know if and how keyboard manufacturers face the problem of ghost
|
|
|
|
|
* keys, I didn't take special measurements for this. I hope that the engineers
|
|
|
|
|
* at IBM distributed the keys on the matrix in a way that minimizes this
|
|
|
|
|
* problem.
|
|
|
|
|
* problem. Don't misunderstand: I haven't experienced that on this keyboard,
|
|
|
|
|
* but I know that it's a common problem on key-matrixes.
|
|
|
|
|
*
|
|
|
|
|
* \section sec_files Files in the distribution
|
|
|
|
|
*
|
|
|
|
@ -189,6 +190,10 @@
|
|
|
|
|
* their driver for my project. In fact, this project wouldn't exist without
|
|
|
|
|
* the driver.
|
|
|
|
|
*
|
|
|
|
|
* And of course I'd like to thank that friend of mine -- I doubt that he'd
|
|
|
|
|
* like to read his name in this place, I'll put it in if he wants me to --
|
|
|
|
|
* that gave me the idea for this project.
|
|
|
|
|
*
|
|
|
|
|
* \section sec_license About the license
|
|
|
|
|
*
|
|
|
|
|
* My work - all contents except for the USB driver - is licensed under the GNU
|
|
|
|
@ -406,10 +411,12 @@ uint8_t usbFunctionWrite(uchar *data, uchar len) {
|
|
|
|
|
* \param key key-code
|
|
|
|
|
*/
|
|
|
|
|
void usbSendReport(uint8_t mode, uint8_t key) {
|
|
|
|
|
reportBuffer[0] = mode;
|
|
|
|
|
reportBuffer[1] = key;
|
|
|
|
|
// buffer for HID reports. we use a private one, so nobody gets disturbed
|
|
|
|
|
uint8_t repBuffer[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
|
|
|
|
|
repBuffer[0] = mode;
|
|
|
|
|
repBuffer[2] = key;
|
|
|
|
|
while (!usbInterruptIsReady()); // wait
|
|
|
|
|
usbSetInterrupt(reportBuffer, sizeof(reportBuffer)); // send
|
|
|
|
|
usbSetInterrupt(repBuffer, sizeof(repBuffer)); // send
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
@ -428,7 +435,7 @@ const uint8_t PROGMEM keymatrix[16][8] = {
|
|
|
|
|
{KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved }, // 0
|
|
|
|
|
{KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved, KEY_Reserved }, // 1
|
|
|
|
|
{KEY_ESCAPE, KEY_Tab, KEY_grave, KEY_1, KEY_Q, KEY_A, KEY_Z, KEY_Reserved }, // 2
|
|
|
|
|
{KEY_backslash, KEY_capslock, KEY_F1, KEY_2, KEY_W, KEY_S, KEY_X, KEY_Reserved }, // 3
|
|
|
|
|
{KEY_Euro, KEY_capslock, KEY_F1, KEY_2, KEY_W, KEY_S, KEY_X, KEY_Reserved }, // 3
|
|
|
|
|
{KEY_F4, KEY_F3, KEY_F2, KEY_3, KEY_E, KEY_D, KEY_C, KEY_Reserved }, // 4
|
|
|
|
|
{KEY_G, KEY_T, KEY_5, KEY_4, KEY_R, KEY_F, KEY_V, KEY_B }, // 5
|
|
|
|
|
{KEY_F5, KEY_DELETE, KEY_F9, KEY_F10, KEY_Reserved, KEY_Reserved, KEY_Return, KEY_Spacebar }, // 6
|
|
|
|
|