バード電子さんからHHKBオプション品としてキーボードブリッジが発売されていますが、CF-SZ5には適合しないので、自分で作ってみました。
KBBridge-LN_CF-SZ5.zipをEmerge+さんのレーザー加工サービスでカットして貰ってください。 (A3サイズなので、2つ分入ってます。)
滑り止めのゴム足はクリアで小さいのを探したところ、和気産業さんのソフトクッション CN-020が入手性も含め良い感じでした。
| /* | |
| ******************************************************************************* | |
| Serial MIDI to USB MIDI bridge | |
| Copyright (C) 2021 Yuuichi Akagawa | |
| for use with Arduino MIDI library | |
| https://github.com/FortySevenEffects/arduino_midi_library/ | |
| Note: | |
| - If you want use with Leonardo, you must choose Arduino MIDI library v4.0 or higher. |
| 10 AUTOGOTO N+110 | |
| 20 GOTO 110 | |
| 80 *ADD:Q=PEEK (P+&2)*&10000+PEEK (P+&1)*&100+PEEK P:RETURN | |
| 110 CLS :PRINT "****** マシンゴエリア ノ カクホ ******":N=100 | |
| 120 MA=&FC | |
| 130 POKE &BFE03,&1A,&FD,&B,&0,&0,&2:CALL &FFFD8 | |
| 210 CLS :PRINT "****** IOCSワ-ク ノ カクホ ******":N=&C8 | |
| 220 PRINT "キ-ボ-ド バッファ = &100" | |
| 230 SI=8 | |
| 240 P=&BFD1A:GOSUB *ADD:A1=Q |
| 5 '(c)1989 DEKO | |
| 10 '*** INIT *** | |
| 20 KEY 4, "POKE &BFC93,&80,&FA,&B"+CHR$ 13 | |
| 30 KEY 5, "POKE &BFC93,&58,&25,&F"+CHR$ 13 | |
| 40 POKE &BFE03,&1A,&FD,&0B,&80,&01,&00 :CALL &FFFD8 | |
| 50 '***MAIN*** | |
| 60 *A:CLS :LOCATE 12,0:PRINT "*** ヒラガナ ***":LOCATE 10,2:PRINT "シバラクオマチクダサイ・・・。":B=0 | |
| 70 FOR L=0 TO 63:FOR I=0 TO 5:IF I=5THEN A$="00":GOTO 90 | |
| 80 READ A$ | |
| 90 POKE (&BFA80+B),VAL ("&H"+A$):B=B+1 |
| /* USBMIDI_desc | |
| * modified from USB_desc.ino | |
| */ | |
| #include <usbhub.h> | |
| #define BUFFER_SIZE 512 | |
| #define CS_INTERFACE (0x24) | |
| #define CS_ENDPOINT (0x25) | |
| #define LOBYTE(x) ((char*)(&(x)))[0] | |
| #define HIBYTE(x) ((char*)(&(x)))[1] |
| Start | |
| 01 | |
| -- | |
| Device descriptor: | |
| Descriptor Length: 12 | |
| Descriptor type: 01 | |
| USB version: 0110 |
| /* | |
| * Copyright (c) 2010 by Cristian Maglie <[email protected]> | |
| * Copyright (c) 2014 by Paul Stoffregen <[email protected]> (Transaction API) | |
| * Copyright (c) 2014 by Matthijs Kooijman <[email protected]> (SPISettings AVR) | |
| * Copyright (c) 2014 by Andrew J. Kroll <[email protected]> (atomicity fixes) | |
| * SPI Master library for arduino. | |
| * | |
| * This file is free software; you can redistribute it and/or modify | |
| * it under the terms of either the GNU General Public License version 2 | |
| * or the GNU Lesser General Public License version 2.1, both as |
| Name | Qty | Parts# | Detail | where to buy |
|---|---|---|---|---|
| USB-mini connector | 1 | J1 | Hirose UX60SC-MB-5S8 | マルツ https://www.marutsu.co.jp/pc/i/30392282/ @135 |
| ATMega32U4-AU | 1 | U1 | TQFP44 | 秋月 I-09835 @640 |
| Xtal-16MHz | 1 | X1 | HC49 SMT | 秋月 P-01767@200(5pcs) |
| C22p | 2 | C5,C6 | 1608 | 秋月 P-11626 @100(40pcs) GRM1882C1H220JA01 |
| C1u | 1 | C4 | 1608 +-10% EMK107BJ105KA-T | 秋月 P-05731 @200(100pcs) |
| C0.1u | 5 | C3,C7,C8,C9,C10 | 1608 for decoupling | 秋月 P-13374 @100(40pcs) GRM188F11104ZA01 |
| #include <usbh_midi.h> | |
| #include <usbhub.h> | |
| USB Usb; | |
| //USBHub Hub(&Usb); | |
| USBH_MIDI Midi(&Usb); | |
| typedef enum { | |
| nonsysex = 0, | |
| ok = 1, |
| import utime | |
| from machine import I2C, Pin, info | |
| i2c = I2C(sda=Pin('P5'), scl=Pin('P4'), freq=100000) | |
| i2caddr = 0xf | |
| #set frequence(3921Hz) | |
| buf = bytearray([0x84, 0x02, 0x01]) | |
| i2c.writeto(i2caddr, buf) | |
| utime.sleep_ms(4) |