1
0

Moved protocol files; news and x68k.

Renamed sony_usb to news_usb
Renamed hbk to hbkb
This commit is contained in:
tmk 2012-06-10 23:50:47 +09:00
parent e5fca3e0cf
commit 3393544e32
5 changed files with 378 additions and 28 deletions

View File

@ -17,64 +17,73 @@ Features
Projects
--------
### converter
* ps2_usb - PS/2 keyboard to USB
* adb_usb - ADB keyboard to USB
* m0110_usb - Machintosh 128K/512K/Plus keyboard to USB
* terminal_usb - IBM Model M terminal keyboard(PS/2 scancode set3) to USB
* sony_usb - Sony NEWS keyboard to USB
* x68k_usb - Sharp X68000 keyboard to USB
* [ps2_usb][c1] - [PS/2 keyboard to USB][GH_ps2]
* [adb_usb][c2] - [ADB keyboard to USB][GH_adb]
* [m0110_usb][c3] - [Machintosh 128K/512K/Plus keyboard to USB][GH_m0110]
* [terminal_usb][c4] - [IBM Model M terminal keyboard(PS/2 scancode set3) to USB][GH_terminal]
* [news_usb][c5] - [Sony NEWS keyboard to USB][GH_news]
* [x68k_usb][c6] - [Sharp X68000 keyboard to USB][GH_x68k]
### keyboard
* hhkb - Happy Hacking Keyboard professional
* macway - Compact keyboard mod
* hbk - Happy Buckling sprint keyboard(IBM Model M mod)
* [hhkb][k1] - [Happy Hacking Keyboard professional][GH_hhkb]
* [macway][k2] - [Compact keyboard mod][GH_macway]
* [hbkb][k3] - [Happy Buckling sprint keyboard(IBM Model M mod)][GH_hbkb]
[c1]: converter/ps2_usb/
[c2]: converter/adb_usb/
[c3]: converter/m0110_usb/
[c4]: converter/terminal_usb/
[c5]: converter/news_usb/
[c6]: converter/x68k_usb/
[k1]: keyboard/hhkb
[k2]: keyboard/macway
[k3]: keyboard/hbkb
[GH_macway]: http://geekhack.org/showwiki.php?title=Island:11930
[GH_hhkb]: http://geekhack.org/showwiki.php?title=Island:12047
[GH_ps2]: http://geekhack.org/showwiki.php?title=Island:14618
[GH_adb]: http://geekhack.org/showwiki.php?title=Island:14290
[GH_hhkb_bt]: http://geekhack.org/showwiki.php?title=Island:20851
[GH_m0110]: http://geekhack.org/showwiki.php?title=Island:24965
[GH_sony]: http://geekhack.org/showwiki.php?title=Island:25759
[GH_news]: http://geekhack.org/showwiki.php?title=Island:25759
[GH_terminal]: http://geekhack.org/showwiki.php?title=Island:27272
[GH_x68k]: http://geekhack.org/showwiki.php?title=Island:29060
[GH_hbk]: http://geekhack.org/showwiki.php?title=Island:29483
[GH_hbkb]: http://geekhack.org/showwiki.php?title=Island:29483
Files & Directories
-------------------
### Top
* common/ common codes
* protocol/ keyboard protocol support
* keyboard/ keyboard projects
* converter/ protocol converter projects
* doc/ documents
* [common/](common/) - common codes
* [protocol/](protocol/) - keyboard protocol support
* [keyboard/](keyboard/) - keyboard projects
* [converter/](converter/) - protocol converter projects
* [doc/](doc/) - documents
### Keyboard Protocols
* pjrc/ PJRC USB stack
* vusb/ Objective Development V-USB
* iwrap/ Bluetooth HID for Bluegiga iWRAP
* ps2 PS/2 protocol
* adb Apple Desktop Bus protocol
* m0110 Macintosh 128K/512K/Plus keyboard protocol
* news Sony NEWS keyboard protocol
* x68k Sharp X68000 keyboard protocol
* [pjrc/](protocol/pjrc/) - PJRC USB stack
* [vusb/](protocol/vusb/) - Objective Development V-USB
* [iwrap/](protocol/iwrap) - Bluetooth HID for Bluegiga iWRAP
* [ps2.c](protocol/ps2.c) - PS/2 protocol
* [adb.c](protocol/adb.c) - Apple Desktop Bus protocol
* [m0110.c](protocol/m0110.c) - Macintosh 128K/512K/Plus keyboard protocol
* [news.c](protocol/news.c) - Sony NEWS keyboard protocol
* [x68k.c](protocol/x68k.c) - Sharp X68000 keyboard protocol
Build & Program
---------------
### Build firmware
To compile you need `AVR GCC`, `AVR Libc` and `GNU make`.
You can use [WinAVR][1] on Windows and [CrossPack][2] on Mac.
You can use [WinAVR][winavr] on Windows and [CrossPack][crosspack] on Mac.
$ cd <project>
$ make
The firmware will be compiled as a file tmk_<project>.hex.
The firmware will be compiled as a file `tmk_<project>.hex`.
[1]: http://winavr.sourceforge.net/
[2]: http://www.obdev.at/products/crosspack/index.html
[winavr]: http://winavr.sourceforge.net/
[crosspack]: http://www.obdev.at/products/crosspack/index.html
### Program Controller
If you have proper program command in Makefile just type this.

168
protocol/news.c Normal file
View File

@ -0,0 +1,168 @@
/*
Copyright 2012 Jun WAKO <wakojun@gmail.com>
This software is licensed with a Modified BSD License.
All of this is supposed to be Free Software, Open Source, DFSG-free,
GPL-compatible, and OK to use in both free and proprietary applications.
Additions and corrections to this file are welcome.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of the copyright holders nor the names of
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdbool.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include "news.h"
void news_init(void)
{
NEWS_KBD_RX_INIT();
}
// RX ring buffer
#define RBUF_SIZE 8
static uint8_t rbuf[RBUF_SIZE];
static uint8_t rbuf_head = 0;
static uint8_t rbuf_tail = 0;
uint8_t news_recv(void)
{
uint8_t data = 0;
if (rbuf_head == rbuf_tail) {
return 0;
}
data = rbuf[rbuf_tail];
rbuf_tail = (rbuf_tail + 1) % RBUF_SIZE;
return data;
}
// USART RX complete interrupt
ISR(NEWS_KBD_RX_VECT)
{
uint8_t next = (rbuf_head + 1) % RBUF_SIZE;
if (next != rbuf_tail) {
rbuf[rbuf_head] = NEWS_KBD_RX_DATA;
rbuf_head = next;
}
}
/*
SONY NEWS Keyboard Protocol
===========================
Resources
---------
Mouse protocol of NWA-5461(Japanese)
http://groups.google.com/group/fj.sys.news/browse_thread/thread/a01b3e3ac6ae5b2d
SONY NEWS Info(Japanese)
http://katsu.watanabe.name/doc/sonynews/
Pinouts
-------
EIA 232 male connector from NWP-5461
-------------
\ 1 2 3 4 5 /
\ 6 7 8 9 /
---------
1 VCC
2 BZ(Speaker)
3 Keyboard Data(from keyboard MCU TxD)
4 NC
5 FG
6 Unknown Input(to keyboard MCU RxD via schmitt trigger)
7 Mouse Data(from Mouse Ext connector)
8 Unknown Input(to Keyboard MCU Input via diode and buffer)
9 GND
NOTE: Two LED on keyboard are controlled by pin 6,8?
EIA 232 male connector from NWP-411A
-------------
\ 1 2 3 4 5 /
\ 6 7 8 9 /
---------
1 VCC
2 BZ(Speaker)
3 Keyboard Data(from keyboard MCU TxD)
4 NC
5 FG
6 NC
7 Mouse Data(from Mouse Ext connector)
8 NC
9 GND
NOTE: These are just from my guess and not confirmed.
Signaling
---------
~~~~~~~~~~ ____XOO0X111X222X333X444X555X666X777~~~~ ~~~~~~~
Idle Start LSB MSB Stop Idle
Idle: High
Start bit: Low
Stop bit: High
Bit order: LSB first
Baud rate: 9600
Interface: TTL level(5V) UART
NOTE: This is observed on NWP-5461 with its DIP switch all OFF.
Format
------
MSB LSB
7 6 5 4 3 2 1 0 bit
| | | | | | | |
| +-+-+-+-+-+-+-- scan code(00-7F)
+---------------- break flag: sets when released
Scan Codes
----------
SONY NEWS NWP-5461
,---. ,------------------------, ,------------------------. ,---------.
| 7A| | 01 | 02 | 03 | 04 | 05 | | 06 | 07 | 08 | 09 | 0A | | 68 | 69 | ,-----------.
`---' `------------------------' `------------------------' `---------' | 64| 65| 52|
,-------------------------------------------------------------. ,---. ,---------------|
| 0B| 0C| 0D| 0E| 0F| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19 | | 6A| | 4B| 4C| 4D| 4E|
|-------------------------------------------------------------| |---| |---------------|
| 1A | 1B| 1C| 1D| 1E| 1F| 20| 21| 22| 23| 24| 25| 26| 27| | | 6B| | 4F| 50| 51| 56|
|---------------------------------------------------------' | |---| |---------------|
| 28 | 29| 2A| 2B| 2C| 2D| 2E| 2F| 30| 31| 32| 33| 34| 35 | | 6C| | 53| 54| 55| |
|-------------------------------------------------------------| |---| |-----------| 5A|
| 36 | 37| 38| 39| 3A| 3B| 3C| 3D| 3E| 3F| 40| 41| 42 | | 6D| | 57| 59| 58| |
|-------------------------------------------------------------| |---| |---------------|
| 43 | 44 | 45 | 46 | 47 | 48| 49| 4A | | 6E| | 66| 5B| 5C| 5D|
`-------------------------------------------------------------' `---' `---------------'
*/

51
protocol/news.h Normal file
View File

@ -0,0 +1,51 @@
/*
Copyright 2012 Jun WAKO <wakojun@gmail.com>
This software is licensed with a Modified BSD License.
All of this is supposed to be Free Software, Open Source, DFSG-free,
GPL-compatible, and OK to use in both free and proprietary applications.
Additions and corrections to this file are welcome.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of the copyright holders nor the names of
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef NEWS_H
#define NEWS_H
/*
* Primitive PS/2 Library for AVR
*/
/* host role */
void news_init(void);
uint8_t news_recv(void);
/* device role */
#endif

75
protocol/x68k.c Normal file
View File

@ -0,0 +1,75 @@
/*
Copyright 2012 Jun WAKO <wakojun@gmail.com>
This software is licensed with a Modified BSD License.
All of this is supposed to be Free Software, Open Source, DFSG-free,
GPL-compatible, and OK to use in both free and proprietary applications.
Additions and corrections to this file are welcome.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of the copyright holders nor the names of
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdbool.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include "x68k.h"
void x68k_init(void)
{
KBD_RX_INIT();
}
// RX ring buffer
#define RBUF_SIZE 8
static uint8_t rbuf[RBUF_SIZE];
static uint8_t rbuf_head = 0;
static uint8_t rbuf_tail = 0;
uint8_t x68k_recv(void)
{
uint8_t data = 0;
if (rbuf_head == rbuf_tail) {
return 0;
}
data = rbuf[rbuf_tail];
rbuf_tail = (rbuf_tail + 1) % RBUF_SIZE;
return data;
}
// USART RX complete interrupt
ISR(KBD_RX_VECT)
{
uint8_t next = (rbuf_head + 1) % RBUF_SIZE;
if (next != rbuf_tail) {
rbuf[rbuf_head] = KBD_RX_DATA;
rbuf_head = next;
}
}

47
protocol/x68k.h Normal file
View File

@ -0,0 +1,47 @@
/*
Copyright 2012 Jun WAKO <wakojun@gmail.com>
This software is licensed with a Modified BSD License.
All of this is supposed to be Free Software, Open Source, DFSG-free,
GPL-compatible, and OK to use in both free and proprietary applications.
Additions and corrections to this file are welcome.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of the copyright holders nor the names of
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef X68K_H
#define X68K_H
/* host role */
void x68k_init(void);
uint8_t x68k_recv(void);
/* device role */
#endif