Author Topic: SHARP X68000 keyboard converter  (Read 30626 times)

0 Members and 1 Guest are viewing this topic.

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
SHARP X68000 keyboard converter
« on: Sat, 24 March 2012, 05:17:29 »
SHARP X68000 is a hobby computer released in Japan.(1987-93)
http://en.wikipedia.org/wiki/Sharp_X68000


X68000 keyboard
X68000 keyboard has basically ALPS linear switches, for example:
- DSETK0016CE01   (ALPS green linear switch)
- DSETK0022CE02   (ALPS yellow linear switch)
- DSETK0023CE03   (ALPS yellow linear switch)

 I have a DSETK0016CE01 with green one.

Album: http://imgur.com/a/N1yMX


Update
- 2013/06/22  Add LED support
- 2017/05/09  Online Keymap Editor is available for TMK x68k converter now


Hardware
Target MCU is ATMega32u4/u2 but other USB capable AVR also should work.
You can use a PJRC Teensy2.0 for this converter.

Connector
X68000 keyboard has a Mini DIN 7pin connector.
keyboard plug:

converter jack:



Wiring
Code: [Select]
    Mini-DIN            Teensy
    -----------------------------------------------------
    pin1   +5V          VCC
    pin2   MOUSE        -
    pin3   RXD          PD2(RXD)
    pin4   TXD          PD3(TXD)
    pin5   READY        -
    pin6   REMOTE       -
    pin7   GND          GND

Firmware
Source: https://github.com/tmk/tmk_keyboard

Build
Code: [Select]
    $ git clone git://github.com/tmk/tmk_keyboard.git
    $ cd tmk_keyboard/converter/x68k_usb
    $ make


Keymap Editor
You can download firmware binary from online editor without building source code yourself.

http://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?x68k_usb




Program
With TMK x68k converter press the button on PCB to start programming mode, then use flash tool with firmware binary. See wiki page.
https://github.com/tmk/tmk_keyboard/wiki#flash-firmware

If you use Teensy you can load with PJRC Teensy Loader tool.
    http://www.pjrc.com/teensy/loader.html

X68000 Keyboard Protocol
See README.
https://github.com/tmk/tmk_keyboard/tree/master/converter/x68k_usb


You can buy preassembled TMK x68k converter here

« Last Edit: Mon, 08 May 2017, 20:11:00 by hasu »

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: SHARP X68000 keyboard converter
« Reply #1 on: Sat, 22 June 2013, 03:05:43 »
Finally added LED support.

Offline Blaise170

  • * Esteemed Elder
  • Posts: 1332
  • Location: Boston, MA
  • ALPS キーボード
    • XYZ
Re: SHARP X68000 keyboard converter
« Reply #2 on: Thu, 28 April 2016, 11:24:16 »
Is there a way to turn on all of the LEDs using a single key? I tried looking at the code but I'm not very well versed in it. I think it would be cool to be able to press a key (break for example) and have the LEDs all turn on or off. I also tried using the scancode trick but none of them are high enough to trigger all of the LEDs.
I proxy anything including keyboards (キーボード / 鍵盤), from both Japan (日本) and China (中國). For more information, you may visit my dedicated webpage here: https://www.keyboards.es/proxying.html

View my current and past keyboards here: https://deskthority.net/wiki/User:Blaise170

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: SHARP X68000 keyboard converter
« Reply #3 on: Fri, 29 April 2016, 01:50:22 »
Is there a way to turn on all of the LEDs using a single key? I tried looking at the code but I'm not very well versed in it. I think it would be cool to be able to press a key (break for example) and have the LEDs all turn on or off. I also tried using the scancode trick but none of them are high enough to trigger all of the LEDs.

I added sample code in keymap.c, see the latest code on github repository. I converted x68k keymap from legacy format to current one and added an action_function to toggle LEDs.

https://github.com/tmk/tmk_keyboard/blob/3c109203c3d0451dd5009acbe3fc5452934b0449/converter/x68k_usb/keymap.c#L75-L92

You can toogle all LEDs with 'BREAK' key now.

To control seven LEDs just send 1-byte command like below. For example to turn only CAPS on you can send 0b11110111 and to turn INS and CAPS on send 0b11100111. Use 'serial_send()' to send the command.

Quote

- LED control ON/OFF(0/1)                                                                         
    bit 7   1(fixed)                                                                               
    bit 6   全角
    bit 5   ひらがな
    bit 4   INS
    bit 3   CAPS
    bit 2   コード入力
    bit 1   ローマ字
    bit 0   かな


Offline Blaise170

  • * Esteemed Elder
  • Posts: 1332
  • Location: Boston, MA
  • ALPS キーボード
    • XYZ
Re: SHARP X68000 keyboard converter
« Reply #4 on: Fri, 29 April 2016, 07:38:06 »
That's amazing Hasu! Thanks for that. I'll rebuild my converter later today when I get time.
I proxy anything including keyboards (キーボード / 鍵盤), from both Japan (日本) and China (中國). For more information, you may visit my dedicated webpage here: https://www.keyboards.es/proxying.html

View my current and past keyboards here: https://deskthority.net/wiki/User:Blaise170

Offline alh84001

  • Posts: 276
  • Location: EU-HR-ZG
Re: SHARP X68000 keyboard converter
« Reply #5 on: Thu, 05 January 2017, 18:27:11 »
I just wired up a Pro Micro with a 7-pin mini-DIN port (I connected 5V, GND, RX and TX), and flashed the firmware which I got by issuing make in a pristine repo. Switches get registered with no issues, but I'm having trouble with LEDs. Only CAPS LED is working when the key is pressed (which i think is expected), and pressing BREAK does nothing (no LEDs light-up, including CAPS), which, looking at code, should work.

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: SHARP X68000 keyboard converter
« Reply #6 on: Thu, 05 January 2017, 19:22:44 »
glad you made your converter work.
Converter doesn't handle all LEDs at this time because I have no idea on how to use other LEDs. But I think you can control all LEDs as you want, see source code.

Do you have X68000 computer or know how it handles LEDs on those keys?

Offline alh84001

  • Posts: 276
  • Location: EU-HR-ZG
Re: SHARP X68000 keyboard converter
« Reply #7 on: Fri, 06 January 2017, 05:35:53 »
It turns out that I was stupid and I had a fork of the tmk cloned, which has not been rebased in quite a while, so I didn't have any of the changes related to LEDs. I cloned the original repo, built it, flashed it, and now all LEDs work when pressing BREAK key.

Thanks again, hasu, you're the man!

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: SHARP X68000 keyboard converter
« Reply #8 on: Mon, 08 May 2017, 20:08:23 »
Now Keymap Editor is available for TMK x68k converter(ATMega32u2).

You can download firmware binary from online editor without building source code yourself.

http://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?x68k_usb


Offline BeautyFool

  • Posts: 1
Re: SHARP X68000 keyboard converter
« Reply #9 on: Sat, 27 January 2018, 05:44:41 »
Awesome job! I have a question: with this converter, can be emulated the led patterns used by some games? (Like Cotton  https://youtu.be/lYhGQzCtSHk;)

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: SHARP X68000 keyboard converter
« Reply #10 on: Sat, 27 January 2018, 19:33:29 »
Awesome job! I have a question: with this converter, can be emulated the led patterns used by some games? (Like Cotton  https://youtu.be/lYhGQzCtSHk;)


you can control the LEDs by very simple one byte command, it won't be difficult at all.

Offline michaelbeaver1

  • Posts: 1
Re: SHARP X68000 keyboard converter
« Reply #11 on: Wed, 24 July 2019, 04:41:49 »
Quote
Awesome job! I have a question: with this converter, can be emulated the led patterns used by some games?


you can control the LEDs by very simple one byte command, it won't be difficult at all.

Can you please tell me where I can find more about the commands I can use? Thanks!

Mod Edit: Removed spam link, banned account - post left for posterity and below response
« Last Edit: Wed, 27 November 2019, 11:30:00 by HoffmanMyster »

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: SHARP X68000 keyboard converter
« Reply #12 on: Wed, 24 July 2019, 06:20:16 »
Quote
Awesome job! I have a question: with this converter, can be emulated the led patterns used by some games?


you can control the LEDs by very simple one byte command, it won't be difficult at all.

Can you please tell me where I can find more about the commands I can use? Thanks!


You can just send a byte to control LEDs on keyboard.

https://github.com/tmk/tmk_keyboard/blob/3ee5f565ae98cc68b6dff24225b6f8f069f6e20d/converter/x68k_usb/README#L86-L94

Code: [Select]
- LED control ON/OFF(0/1)
    bit 7   1(fixed)
    bit 6   全角
    bit 5   ひらがな
    bit 4   INS
    bit 3   CAPS
    bit 2   コード入力
    bit 1   ローマ字
    bit 0   かな


Also refer to this code about how to send the command. By default, the converter uses 'コード入力' LED as numlock indicator and 'CAPS' LED as capslock indicator, for example.

https://github.com/tmk/tmk_keyboard/blob/3ee5f565ae98cc68b6dff24225b6f8f069f6e20d/converter/x68k_usb/led.c#L24-L43

Code: [Select]
void led_set(uint8_t usb_led)
{
    /* X68000 LED bits 0: on, 1: off
     * bit 7   1(fixed)
     * bit 6   全角
     * bit 5   ひらがな
     * bit 4   INS
     * bit 3   CAPS
     * bit 2   コード入力
     * bit 1   ローマ字
     * bit 0   かな
     */
    uint8_t led = 0xFF;
    if (usb_led&(1<<USB_LED_NUM_LOCK))      led &= ~(1<<2);
    if (usb_led&(1<<USB_LED_CAPS_LOCK))     led &= ~(1<<3);
    if (usb_led&(1<<USB_LED_SCROLL_LOCK))   led &= ~(1<<1);
    if (usb_led&(1<<USB_LED_COMPOSE))       led &= ~(1<<4);
    if (usb_led&(1<<USB_LED_KANA))          led &= ~(1<<0);
    serial_send(led);
}

Mod Edit: See above; removed spam link in quoted post
« Last Edit: Wed, 27 November 2019, 11:30:38 by HoffmanMyster »

Offline HerbalNekoTea

  • Posts: 7
Re: SHARP X68000 keyboard converter
« Reply #13 on: Sat, 03 August 2019, 14:01:54 »
Hi, do those work with Sharp X1 keyboard or just X68000 ? Thank you.

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: SHARP X68000 keyboard converter
« Reply #14 on: Sun, 04 August 2019, 19:03:24 »
Hi, do those work with Sharp X1 keyboard or just X68000 ? Thank you.

I cannot say anything because I don't know about X1 keyboard.
Post pics of connector and internals of you keyboard.

Offline HerbalNekoTea

  • Posts: 7
Re: SHARP X68000 keyboard converter
« Reply #15 on: Sun, 04 August 2019, 20:52:34 »
Thank, will do that next month when it get here.