aboutsummaryrefslogtreecommitdiff
path: root/tmk_core/protocol/news.c
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core/protocol/news.c')
-rw-r--r--tmk_core/protocol/news.c161
1 files changed, 0 insertions, 161 deletions
diff --git a/tmk_core/protocol/news.c b/tmk_core/protocol/news.c
deleted file mode 100644
index 4463e8dd4..000000000
--- a/tmk_core/protocol/news.c
+++ /dev/null
@@ -1,161 +0,0 @@
1/*
2Copyright 2012 Jun WAKO <wakojun@gmail.com>
3
4This software is licensed with a Modified BSD License.
5All of this is supposed to be Free Software, Open Source, DFSG-free,
6GPL-compatible, and OK to use in both free and proprietary applications.
7Additions and corrections to this file are welcome.
8
9
10Redistribution and use in source and binary forms, with or without
11modification, are permitted provided that the following conditions are met:
12
13* Redistributions of source code must retain the above copyright
14 notice, this list of conditions and the following disclaimer.
15
16* Redistributions in binary form must reproduce the above copyright
17 notice, this list of conditions and the following disclaimer in
18 the documentation and/or other materials provided with the
19 distribution.
20
21* Neither the name of the copyright holders nor the names of
22 contributors may be used to endorse or promote products derived
23 from this software without specific prior written permission.
24
25THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
29LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35POSSIBILITY OF SUCH DAMAGE.
36*/
37
38#include <stdbool.h>
39#include <avr/io.h>
40#include <avr/interrupt.h>
41#include "news.h"
42
43void news_init(void) { NEWS_KBD_RX_INIT(); }
44
45// RX ring buffer
46#define RBUF_SIZE 8
47static uint8_t rbuf[RBUF_SIZE];
48static uint8_t rbuf_head = 0;
49static uint8_t rbuf_tail = 0;
50
51uint8_t news_recv(void) {
52 uint8_t data = 0;
53 if (rbuf_head == rbuf_tail) {
54 return 0;
55 }
56
57 data = rbuf[rbuf_tail];
58 rbuf_tail = (rbuf_tail + 1) % RBUF_SIZE;
59 return data;
60}
61
62// USART RX complete interrupt
63ISR(NEWS_KBD_RX_VECT) {
64 uint8_t next = (rbuf_head + 1) % RBUF_SIZE;
65 if (next != rbuf_tail) {
66 rbuf[rbuf_head] = NEWS_KBD_RX_DATA;
67 rbuf_head = next;
68 }
69}
70
71/*
72SONY NEWS Keyboard Protocol
73===========================
74
75Resources
76---------
77 Mouse protocol of NWA-5461(Japanese)
78 http://groups.google.com/group/fj.sys.news/browse_thread/thread/a01b3e3ac6ae5b2d
79
80 SONY NEWS Info(Japanese)
81 http://katsu.watanabe.name/doc/sonynews/
82
83
84Pinouts
85-------
86 EIA 232 male connector from NWP-5461
87 -------------
88 \ 1 2 3 4 5 /
89 \ 6 7 8 9 /
90 ---------
91 1 VCC
92 2 BZ(Speaker)
93 3 Keyboard Data(from keyboard MCU TxD)
94 4 NC
95 5 GND
96 6 Unknown Input(to keyboard MCU RxD via schmitt trigger)
97 7 Mouse Data(from Mouse Ext connector)
98 8 Unknown Input(to Keyboard MCU Input via diode and buffer)
99 9 FG
100 NOTE: Two LED on keyboard are controlled by pin 6,8?
101
102 EIA 232 male connector from NWP-411A
103 -------------
104 \ 1 2 3 4 5 /
105 \ 6 7 8 9 /
106 ---------
107 1 VCC
108 2 BZ(Speaker)
109 3 Keyboard Data(from keyboard MCU TxD)
110 4 NC
111 5 GND
112 6 NC
113 7 Mouse Data(from Mouse Ext connector)
114 8 NC
115 9 FG
116 NOTE: These are just from my guess and not confirmed.
117
118
119Signaling
120---------
121 ~~~~~~~~~~ ____XOO0X111X222X333X444X555X666X777~~~~ ~~~~~~~
122 Idle Start LSB MSB Stop Idle
123
124 Idle: High
125 Start bit: Low
126 Stop bit: High
127 Bit order: LSB first
128
129 Baud rate: 9600
130 Interface: TTL level(5V) UART
131
132 NOTE: This is observed on NWP-5461 with its DIP switch all OFF.
133
134
135Format
136------
137 MSB LSB
138 7 6 5 4 3 2 1 0 bit
139 | | | | | | | |
140 | +-+-+-+-+-+-+-- scan code(00-7F)
141 +---------------- break flag: sets when released
142
143
144Scan Codes
145----------
146 SONY NEWS NWP-5461
147 ,---. ,------------------------, ,------------------------. ,---------.
148 | 7A| | 01 | 02 | 03 | 04 | 05 | | 06 | 07 | 08 | 09 | 0A | | 68 | 69 | ,-----------.
149 `---' `------------------------' `------------------------' `---------' | 64| 65| 52|
150 ,-------------------------------------------------------------. ,---. ,---------------|
151 | 0B| 0C| 0D| 0E| 0F| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19 | | 6A| | 4B| 4C| 4D| 4E|
152 |-------------------------------------------------------------| |---| |---------------|
153 | 1A | 1B| 1C| 1D| 1E| 1F| 20| 21| 22| 23| 24| 25| 26| 27| | | 6B| | 4F| 50| 51| 56|
154 |---------------------------------------------------------' | |---| |---------------|
155 | 28 | 29| 2A| 2B| 2C| 2D| 2E| 2F| 30| 31| 32| 33| 34| 35 | | 6C| | 53| 54| 55| |
156 |-------------------------------------------------------------| |---| |-----------| 5A|
157 | 36 | 37| 38| 39| 3A| 3B| 3C| 3D| 3E| 3F| 40| 41| 42 | | 6D| | 57| 59| 58| |
158 |-------------------------------------------------------------| |---| |---------------|
159 | 43 | 44 | 45 | 46 | 47 | 48| 49| 4A | | 6E| | 66| 5B| 5C| 5D|
160 `-------------------------------------------------------------' `---' `---------------'
161*/