sony: Add buzzer support

This commit is contained in:
tmk 2023-11-06 19:28:02 +09:00
parent 7daa4f1b8f
commit c37774d159
3 changed files with 37 additions and 9 deletions

View file

@ -10,6 +10,7 @@ TARGET_DIR = .
# keyboard dependent files
SRC = matrix.c \
led.c \
tone.c \
news.c
CONFIG_H = config.h

View file

@ -2,23 +2,32 @@ Sony NEWS keyboard converter
============================
Sony NEWS is a BSD workstation with 68K/MIPS released in 1987 in Japan.
- http://en.wikipedia.org/wiki/Sony_NEWS
- https://www.sony.net/SonyInfo/CorporateInfo/History/SonyHistory/2-12.html#block3
This converter allows NEWS keyboard to be connected to modern PC via USB. It works with NWP-5461 and NWP-411A.
How DIP switches work is unknown and you may need to turn all switches off with this converter.
Limitations:
- Speaker/Buzzer is not supported.
- LEDs on NWP-5461 is not supported.
Pics:
- http://imgur.com/a/JyMzw
- Mouse is not supported.
Discussion:
- https://geekhack.org/index.php?topic=25759
Resources:
- https://github.com/tmk/tmk_keyboard/wiki/Sony-NEWS
Wiring
------
Use PD2(USART RXD) for 'Keyboard Data' pin and give power with VCC and GND. Other pins are optional and not supported at this point.
AVR NEWS
------------------------
PD2 Keyboard Data
PD3 Keyboard Command
PD4 Mouse Data
PD0 BZ
Target microcontroller is Atmel ATMega32U2 by default but porting this project to other 8-bit AVR controllers would be easy.
Protocol
@ -42,6 +51,7 @@ For example 0x29 is sent when 'a' key is pressed and 0xA9 when released.
+---------------- break flag: sets when released
Scan Codes
----------
### NWP-5461
@ -118,3 +128,17 @@ I have three NWP-5461s and GND and FG is connected in one of them for some reaso
8 NC
9 FG
NOTE: These are just from my guess and not confirmed.
Buzzer
------
You can control buzzer using `tone()` and `noTone()`. BZ pin should be connected to PD0.
- `void tone(unsigned int frequency, unsigned long duration)`
- `void noTone(void)`
`tone()` sounds buzzer in frequency(in hertz) for duration(in milliseconds).
When giving -1 as duration to `tone()` buzzer makes a sound forever until `noTone()` is called.
Buzzer is not used by default firmware.

View file

@ -58,6 +58,8 @@ void matrix_init(void)
return;
}
void tone(unsigned int frequency, unsigned long duration);
void noTone(void);
uint8_t matrix_scan(void)
{
uint8_t code;
@ -76,6 +78,7 @@ uint8_t matrix_scan(void)
// make code
if (!matrix_is_on(ROW(code), COL(code))) {
matrix[ROW(code)] |= (1<<COL(code));
//tone(80, 100);
}
}
return code;