diff --git a/LICENSE.txt b/LICENSE.txt deleted file mode 100644 index de622df5..00000000 --- a/LICENSE.txt +++ /dev/null @@ -1,27 +0,0 @@ -Codes are released under each license. See heading of each file for details. - -Modified BSD license: - ps2.c - ps2.h - adb.c - adb.h - -GPLv2 or later: - other codes - -PJRC's license: - print.c - print.h - pjrc/ - -GPLv2 or GPLv3 or OBJECTIVE DEVELOPMENT's commercial license: - vusb/ - - - - -This software includes following codes from other parties. - - V-USB from OBJECTIVE DEVELOPMENT - http://www.obdev.at/products/vusb/index.html - - Teensy example codes from PJRC - http://www.pjrc.com/teensy/ diff --git a/README b/README deleted file mode 100644 index d85f512c..00000000 --- a/README +++ /dev/null @@ -1,151 +0,0 @@ -t.m.k. Keyboard Firmware -======================== -This is keyboard firmware for Teensy(AVR USB MCU) and V-USB board. - -source code repository: -http://github.com/tmk/tmk_keyboard - -This firmware is used in following projects: -HHKB mod: http://geekhack.org/showwiki.php?title=Island:12047 -Macway mod: http://geekhack.org/showwiki.php?title=Island:11930 -PS2 to USB: http://geekhack.org/showwiki.php?title=Island:14618 -ADB to USB: http://geekhack.org/showwiki.php?title=Island:14290 - -The project is heavily based on PJRC USB Keyboard/Mouse Example and -owes a debt to preceding keyboard firmware projects. -http://www.pjrc.com/teensy - - -Features --------- -Mouse key - control mouse cursor from keyboard. -System Control Key - Power Down, Sleep, Wake Up & USB Remote Wake up -Media Control Key - Volume Down/Up, Mute -USB NKRO - send 120 keys(+ 8 modifiers) at most simultaneously. -PS/2 mouse support - integrate PS/2 mouse(TrackPoint) into keyboard as composite device. - - -Limitations ------------ - - -Files & Directories -------------------- -Target: -hhkb/ keyboard controller for PFU HHKB pro -macway/ keyboard controller for Macway mod -ps2_usb/ PS2 to USB keyboard converter -adb_usb/ ADB to USB keyboard converter - -USB Protocol Stack: -pjrc/ PJRC USB stack -vusb/ V-USB USB stack -ps2.[ch] PS/2 protocol -adb.[ch] ADB protocol - - -Build ------ -To compile needs AVR GCC, AVR Libc and GNU make. -You can use WinAVR on Windows. http://winavr.sourceforge.net/ - -$ cd -$ make - -The firmware will be compiled as a file tmk_.hex. - - -Build your own firmware ------------------------ -Copying exsistent target(macway) is easy way. -1. Copy contens of macway/ to your own target directory. -2. Edit Makefile. See next section. -3. Edit config.h. See next section. -4. Edit matrix.c. You will need to fix followings at least. - matrix_init() - matrix_scan() - read_col() - unselect_rows() - select_row() -5. Edit keymap.c. NOTE: It is not final design and a bit messy. - You will need to fix followings at least. - KEYMAP - fn_layer[] - fn_keycode[] - keymaps[] -6. Build. - -If you have a build error like following, comment out "--relax" option in Makefile.common. - (.vectors+0x30): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_12' - - -Build Options -------------- -/Makefile: -1. Set target name for your firmware. - TARGET = tmk_ -2. Choose a MCU and its frequency. - MCU = atmega32u4 # Teensy 2.0 - #MCU = at90usb1286 # Teensy++ 2.0 - F_CPU = 16000000 -3. Choose optional modules as needed. Comment out to disable optional modules. - MOUSEKEY_ENABLE = yes # Mouse keys - PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support - EXTRAKEY_ENABLE = yes # Enhanced feature for Windows(Audio control and System control) - NKRO_ENABLE = yes # USB Nkey Rollover - -/config.h: -1. USB vendor/product ID and device description - #define VENDOR_ID 0xFEED - #define PRODUCT_ID 0xBEEF - /* device description */ - #define MANUFACTURER t.m.k. - #define PRODUCT Macway mod - #define DESCRIPTION t.m.k. keyboard firmware for Macway mod -2. Keyboard matrix configuration - #define MATRIX_ROWS 8 - #define MATRIX_COLS 8 - #define MATRIX_HAS_GHOST -3. Mouse keys configuration if needed. -4. PS/2 mouse configuration if needed. - - -Debuging & Rescue ------------------ -Use PJRC's hid_listen.exe to see debug messages. -Press + H to debug menu. -(see config.h for key combination.) - -Pressing any 3 keys when connected enables debug output. -Pressing any 4 keys when connected makes bootloader comes up. - - -Projects related ----------------- -PJRC USB Keyboard/Mouse Example - http://www.pjrc.com/teensy/usb_keyboard.html - http://www.pjrc.com/teensy/usb_mouse.html -kbupgrade - http://github.com/rhomann/kbupgrade - http://geekhack.org/showwiki.php?title=Island:8406 -c64key - http://symlink.dk/projects/c64key/ -rump - http://mg8.org/rump/ - http://github.com/clee/rump -dulcimer - http://www.schatenseite.de/dulcimer.html -humblehacker-keyboard - http://github.com/humblehacker - http://www.humblehacker.com/keyboard/ - http://geekhack.org/showwiki.php?title=Island:6292 -ps2avr - http://sourceforge.net/projects/ps2avr/ - - -EOF diff --git a/README.md b/README.md new file mode 100644 index 00000000..d6d8fb4e --- /dev/null +++ b/README.md @@ -0,0 +1,184 @@ +t.m.k. Keyboard Firmware Collection +==================================== +This is a keyboard firmware with some features for Atmel AVR controller. + +Source code is available here: + + +Features +-------- +* Mouse key - Mouse control by keyboard +* System Control Key - Power Down, Sleep, Wake Up and USB Remote Wake up +* Media Control Key - Volume Down/Up, Mute, Next/Prev track, Play, Stop and etc. +* USB NKRO - Can send 120 keys(+ 8 modifiers) simultaneously. +* PS/2 mouse support - integrate PS/2 mouse(TrackPoint) into keyboard as composite device. + + +Projects +-------- +### converter +* [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][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_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_hbkb]: http://geekhack.org/showwiki.php?title=Island:29483 + + + +Files & Directories +------------------- +### Top +* [common/](common/) - common codes +* [protocol/](protocol/) - keyboard protocol support +* [keyboard/](keyboard/) - keyboard projects +* [converter/](converter/) - protocol converter projects +* [doc/](doc/) - documents + +### Keyboard Protocols +* [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][winavr] on Windows and [CrossPack][crosspack] on Mac. + + $ cd + $ make + +The firmware will be compiled as a file `tmk_.hex`. + +[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. + + $ make program + +As for `Teensy` you can use `PJRC's loader` to program hex file. + + + +Build Options +------------- +### `Makefile` +#### 1. MCU and Frequency. + MCU = atmega32u4 # Teensy 2.0 + #MCU = at90usb1286 # Teensy++ 2.0 + F_CPU = 16000000 + +#### 2. Features +Note that ***comment out*** to disable them. + MOUSEKEY_ENABLE = yes # Mouse keys + PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support + EXTRAKEY_ENABLE = yes # Enhanced feature for Windows(Audio control and System control) + NKRO_ENABLE = yes # USB Nkey Rollover + +#### 3. Programmer +Set proper command for your controller, bootloader and programmer. + # for PJRC Teensy + PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex + + # for Atmel AT90USBKEY + PROGRAM_CMD = dfu-programmer $(MCU) flash $(TARGET).hex + + # avrdude + PROGRAM_CMD = avrdude -p $(MCU) -c avrispmkII -P USB -U flash:w:$(TARGET).hex + PROGRAM_CMD = avrdude -p $(MCU) -c usbasp -U flash:w:$(TARGET).hex + PROGRAM_CMD = avrdude -p $(MCU) -c arduino -P COM1 -b 57600 -U flash:w:$(TARGET).hex + +### `config.h` +#### 1. USB vendor/product ID and device description + #define VENDOR_ID 0xFEED + #define PRODUCT_ID 0xBEEF + /* device description */ + #define MANUFACTURER t.m.k. + #define PRODUCT Macway mod + #define DESCRIPTION t.m.k. keyboard firmware for Macway mod + +#### 2. Keyboard matrix configuration + #define MATRIX_ROWS 8 + #define MATRIX_COLS 8 + #define MATRIX_HAS_GHOST + +### 3. Mouse keys configuration + +### 4. PS/2 mouse configuration + + +Keymap +------ + + +Build your own firmware +----------------------- + + +Debuging +-------- +Use PJRC's `hid_listen` to see debug messages and press ` + H` to debug menu. +See `config.h` for definition of `` key combination. + + +Other Keyboard Projects +----------------------- +### PJRC USB Keyboard/Mouse Example +- +- + +### kbupgrade +- +- + +### c64key +- + +### rump +- +- + +### dulcimer +- + +### humblehacker-keyboard +- +- +- + +### ps2avr +- diff --git a/common.mk b/common.mk index 03cbc296..d0e04df8 100644 --- a/common.mk +++ b/common.mk @@ -33,7 +33,4 @@ ifdef $(or MOUSEKEY_ENABLE, PS2_MOUSE_ENABLE) endif # Search Path -VPATH += $(COMMON_DIR) - - -include $(COMMON_DIR)/rules.mk +VPATH += $(TOP_DIR)/common diff --git a/bootloader.c b/common/bootloader.c similarity index 100% rename from bootloader.c rename to common/bootloader.c diff --git a/bootloader.h b/common/bootloader.h similarity index 100% rename from bootloader.h rename to common/bootloader.h diff --git a/command.c b/common/command.c similarity index 100% rename from command.c rename to common/command.c diff --git a/command.h b/common/command.h similarity index 100% rename from command.h rename to common/command.h diff --git a/controller_teensy.h b/common/controller_teensy.h similarity index 100% rename from controller_teensy.h rename to common/controller_teensy.h diff --git a/debug.h b/common/debug.h similarity index 100% rename from debug.h rename to common/debug.h diff --git a/host.c b/common/host.c similarity index 100% rename from host.c rename to common/host.c diff --git a/host.h b/common/host.h similarity index 100% rename from host.h rename to common/host.h diff --git a/host_driver.h b/common/host_driver.h similarity index 100% rename from host_driver.h rename to common/host_driver.h diff --git a/keyboard.c b/common/keyboard.c similarity index 100% rename from keyboard.c rename to common/keyboard.c diff --git a/keyboard.h b/common/keyboard.h similarity index 100% rename from keyboard.h rename to common/keyboard.h diff --git a/keymap.h b/common/keymap.h similarity index 100% rename from keymap.h rename to common/keymap.h diff --git a/layer.c b/common/layer.c similarity index 100% rename from layer.c rename to common/layer.c diff --git a/layer.h b/common/layer.h similarity index 100% rename from layer.h rename to common/layer.h diff --git a/led.h b/common/led.h similarity index 100% rename from led.h rename to common/led.h diff --git a/matrix.h b/common/matrix.h similarity index 100% rename from matrix.h rename to common/matrix.h diff --git a/mousekey.c b/common/mousekey.c old mode 100755 new mode 100644 similarity index 100% rename from mousekey.c rename to common/mousekey.c diff --git a/mousekey.h b/common/mousekey.h similarity index 100% rename from mousekey.h rename to common/mousekey.h diff --git a/print.c b/common/print.c similarity index 100% rename from print.c rename to common/print.c diff --git a/print.h b/common/print.h similarity index 100% rename from print.h rename to common/print.h diff --git a/report.h b/common/report.h similarity index 100% rename from report.h rename to common/report.h diff --git a/sendchar.h b/common/sendchar.h similarity index 100% rename from sendchar.h rename to common/sendchar.h diff --git a/sendchar_null.c b/common/sendchar_null.c similarity index 100% rename from sendchar_null.c rename to common/sendchar_null.c diff --git a/sendchar_uart.c b/common/sendchar_uart.c similarity index 100% rename from sendchar_uart.c rename to common/sendchar_uart.c diff --git a/timer.c b/common/timer.c similarity index 100% rename from timer.c rename to common/timer.c diff --git a/timer.h b/common/timer.h similarity index 100% rename from timer.h rename to common/timer.h diff --git a/uart.c b/common/uart.c similarity index 100% rename from uart.c rename to common/uart.c diff --git a/uart.h b/common/uart.h similarity index 100% rename from uart.h rename to common/uart.h diff --git a/usb_keycodes.h b/common/usb_keycodes.h similarity index 100% rename from usb_keycodes.h rename to common/usb_keycodes.h diff --git a/util.c b/common/util.c similarity index 100% rename from util.c rename to common/util.c diff --git a/util.h b/common/util.h similarity index 100% rename from util.h rename to common/util.h diff --git a/adb_usb/Makefile b/converter/adb_usb/Makefile similarity index 90% rename from adb_usb/Makefile rename to converter/adb_usb/Makefile index f4c5031c..64a23d09 100644 --- a/adb_usb/Makefile +++ b/converter/adb_usb/Makefile @@ -2,7 +2,7 @@ TARGET = adb_usb # Directory common source filess exist -COMMON_DIR = .. +TOP_DIR = ../.. # Directory keyboard dependent files exist TARGET_DIR = . @@ -48,5 +48,7 @@ PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex -include $(COMMON_DIR)/pjrc.mk -include $(COMMON_DIR)/common.mk +include $(TOP_DIR)/protocol/pjrc.mk +include $(TOP_DIR)/protocol.mk +include $(TOP_DIR)/common.mk +include $(TOP_DIR)/rules.mk diff --git a/adb_usb/README b/converter/adb_usb/README similarity index 100% rename from adb_usb/README rename to converter/adb_usb/README diff --git a/adb_usb/config.h b/converter/adb_usb/config.h similarity index 100% rename from adb_usb/config.h rename to converter/adb_usb/config.h diff --git a/adb_usb/keymap.c b/converter/adb_usb/keymap.c similarity index 100% rename from adb_usb/keymap.c rename to converter/adb_usb/keymap.c diff --git a/adb_usb/led.c b/converter/adb_usb/led.c similarity index 100% rename from adb_usb/led.c rename to converter/adb_usb/led.c diff --git a/adb_usb/matrix.c b/converter/adb_usb/matrix.c similarity index 100% rename from adb_usb/matrix.c rename to converter/adb_usb/matrix.c diff --git a/m0110_usb/Makefile b/converter/m0110_usb/Makefile similarity index 90% rename from m0110_usb/Makefile rename to converter/m0110_usb/Makefile index fccfaa52..4a687b93 100644 --- a/m0110_usb/Makefile +++ b/converter/m0110_usb/Makefile @@ -2,7 +2,7 @@ TARGET = m0110 # Directory common source filess exist -COMMON_DIR = .. +TOP_DIR = ../.. # Directory keyboard dependent files exist TARGET_DIR = . @@ -48,8 +48,10 @@ PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex -include $(COMMON_DIR)/pjrc.mk -include $(COMMON_DIR)/common.mk +include $(TOP_DIR)/protocol/pjrc.mk +include $(TOP_DIR)/protocol.mk +include $(TOP_DIR)/common.mk +include $(TOP_DIR)/rules.mk hasu: EXTRAFLAGS += -DHASU hasu: all diff --git a/m0110_usb/README.md b/converter/m0110_usb/README.md similarity index 100% rename from m0110_usb/README.md rename to converter/m0110_usb/README.md diff --git a/m0110_usb/config.h b/converter/m0110_usb/config.h similarity index 100% rename from m0110_usb/config.h rename to converter/m0110_usb/config.h diff --git a/m0110_usb/doc/m0110.jpg b/converter/m0110_usb/doc/m0110.jpg similarity index 100% rename from m0110_usb/doc/m0110.jpg rename to converter/m0110_usb/doc/m0110.jpg diff --git a/m0110_usb/doc/teensy.jpg b/converter/m0110_usb/doc/teensy.jpg similarity index 100% rename from m0110_usb/doc/teensy.jpg rename to converter/m0110_usb/doc/teensy.jpg diff --git a/m0110_usb/keymap.c b/converter/m0110_usb/keymap.c similarity index 100% rename from m0110_usb/keymap.c rename to converter/m0110_usb/keymap.c diff --git a/m0110_usb/led.c b/converter/m0110_usb/led.c similarity index 100% rename from m0110_usb/led.c rename to converter/m0110_usb/led.c diff --git a/m0110_usb/matrix.c b/converter/m0110_usb/matrix.c similarity index 100% rename from m0110_usb/matrix.c rename to converter/m0110_usb/matrix.c diff --git a/sony_usb/Makefile.pjrc b/converter/news_usb/Makefile.pjrc similarity index 90% rename from sony_usb/Makefile.pjrc rename to converter/news_usb/Makefile.pjrc index 2a4eeff1..376133ad 100644 --- a/sony_usb/Makefile.pjrc +++ b/converter/news_usb/Makefile.pjrc @@ -7,7 +7,7 @@ TARGET = news_usb_pjrc # Directory common source filess exist -COMMON_DIR = .. +TOP_DIR = ../.. # Directory keyboard dependent files exist TARGET_DIR = . @@ -52,5 +52,7 @@ PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex -include $(COMMON_DIR)/pjrc.mk -include $(COMMON_DIR)/common.mk +include $(TOP_DIR)/protocol/pjrc.mk +include $(TOP_DIR)/protocol.mk +include $(TOP_DIR)/common.mk +include $(TOP_DIR)/rules.mk diff --git a/sony_usb/config_pjrc.h b/converter/news_usb/config_pjrc.h similarity index 100% rename from sony_usb/config_pjrc.h rename to converter/news_usb/config_pjrc.h diff --git a/sony_usb/keymap.c b/converter/news_usb/keymap.c similarity index 100% rename from sony_usb/keymap.c rename to converter/news_usb/keymap.c diff --git a/sony_usb/led.c b/converter/news_usb/led.c similarity index 100% rename from sony_usb/led.c rename to converter/news_usb/led.c diff --git a/sony_usb/matrix.c b/converter/news_usb/matrix.c similarity index 100% rename from sony_usb/matrix.c rename to converter/news_usb/matrix.c diff --git a/ps2_usb/Makefile b/converter/ps2_usb/Makefile similarity index 90% rename from ps2_usb/Makefile rename to converter/ps2_usb/Makefile index f003aea0..0bba191a 100644 --- a/ps2_usb/Makefile +++ b/converter/ps2_usb/Makefile @@ -7,7 +7,7 @@ TARGET = ps2_usb_pjrc # Directory common source filess exist -COMMON_DIR = .. +TOP_DIR = ../.. # Directory keyboard dependent files exist TARGET_DIR = . @@ -52,5 +52,7 @@ PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex -include $(COMMON_DIR)/pjrc.mk -include $(COMMON_DIR)/common.mk +include $(TOP_DIR)/protocol/pjrc.mk +include $(TOP_DIR)/protocol.mk +include $(TOP_DIR)/common.mk +include $(TOP_DIR)/rules.mk diff --git a/ps2_usb/Makefile.pjrc_usart b/converter/ps2_usb/Makefile.pjrc_usart similarity index 90% rename from ps2_usb/Makefile.pjrc_usart rename to converter/ps2_usb/Makefile.pjrc_usart index e620e66c..3dad7e2f 100644 --- a/ps2_usb/Makefile.pjrc_usart +++ b/converter/ps2_usb/Makefile.pjrc_usart @@ -7,7 +7,7 @@ TARGET = ps2_usb_pjrc_usart # Directory common source filess exist -COMMON_DIR = .. +TOP_DIR = ../.. # Directory keyboard dependent files exist TARGET_DIR = . @@ -52,5 +52,7 @@ PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex -include $(COMMON_DIR)/pjrc.mk -include $(COMMON_DIR)/common.mk +include $(TOP_DIR)/protocol/pjrc.mk +include $(TOP_DIR)/protocol.mk +include $(TOP_DIR)/common.mk +include $(TOP_DIR)/rules.mk diff --git a/ps2_usb/Makefile.vusb b/converter/ps2_usb/Makefile.vusb similarity index 94% rename from ps2_usb/Makefile.vusb rename to converter/ps2_usb/Makefile.vusb index 5b6978f0..4d5240c3 100644 --- a/ps2_usb/Makefile.vusb +++ b/converter/ps2_usb/Makefile.vusb @@ -7,7 +7,7 @@ TARGET = ps2_usb_vusb # Directory common source filess exist -COMMON_DIR = .. +TOP_DIR = ../.. # Directory keyboard dependent files exist TARGET_DIR = . @@ -86,5 +86,7 @@ PROGRAM_CMD = $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE -include $(COMMON_DIR)/vusb.mk -include $(COMMON_DIR)/common.mk +include $(TOP_DIR)/protocol/vusb.mk +include $(TOP_DIR)/protocol.mk +include $(TOP_DIR)/common.mk +include $(TOP_DIR)/rules.mk diff --git a/ps2_usb/README b/converter/ps2_usb/README similarity index 100% rename from ps2_usb/README rename to converter/ps2_usb/README diff --git a/ps2_usb/README.vusb b/converter/ps2_usb/README.vusb similarity index 100% rename from ps2_usb/README.vusb rename to converter/ps2_usb/README.vusb diff --git a/ps2_usb/config_pjrc.h b/converter/ps2_usb/config_pjrc.h similarity index 100% rename from ps2_usb/config_pjrc.h rename to converter/ps2_usb/config_pjrc.h diff --git a/ps2_usb/config_pjrc_usart.h b/converter/ps2_usb/config_pjrc_usart.h similarity index 100% rename from ps2_usb/config_pjrc_usart.h rename to converter/ps2_usb/config_pjrc_usart.h diff --git a/ps2_usb/config_vusb.h b/converter/ps2_usb/config_vusb.h similarity index 100% rename from ps2_usb/config_vusb.h rename to converter/ps2_usb/config_vusb.h diff --git a/ps2_usb/keymap.c b/converter/ps2_usb/keymap.c similarity index 100% rename from ps2_usb/keymap.c rename to converter/ps2_usb/keymap.c diff --git a/ps2_usb/led.c b/converter/ps2_usb/led.c similarity index 100% rename from ps2_usb/led.c rename to converter/ps2_usb/led.c diff --git a/ps2_usb/matrix.c b/converter/ps2_usb/matrix.c similarity index 100% rename from ps2_usb/matrix.c rename to converter/ps2_usb/matrix.c diff --git a/ps2_usb/usbconfig.h b/converter/ps2_usb/usbconfig.h similarity index 100% rename from ps2_usb/usbconfig.h rename to converter/ps2_usb/usbconfig.h diff --git a/terminal_usb/Makefile.102_pjrc b/converter/terminal_usb/Makefile.102_pjrc similarity index 90% rename from terminal_usb/Makefile.102_pjrc rename to converter/terminal_usb/Makefile.102_pjrc index c1fd397f..e9d14e7a 100644 --- a/terminal_usb/Makefile.102_pjrc +++ b/converter/terminal_usb/Makefile.102_pjrc @@ -7,7 +7,7 @@ TARGET = terminal_usb_102_pjrc # Directory common source filess exist -COMMON_DIR = .. +TOP_DIR = ../.. # Directory keyboard dependent files exist TARGET_DIR = . @@ -52,5 +52,7 @@ PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex -include $(COMMON_DIR)/pjrc.mk -include $(COMMON_DIR)/common.mk +include $(TOP_DIR)/protocol/pjrc.mk +include $(TOP_DIR)/protocol.mk +include $(TOP_DIR)/common.mk +include $(TOP_DIR)/rules.mk diff --git a/terminal_usb/Makefile.122_pjrc b/converter/terminal_usb/Makefile.122_pjrc similarity index 90% rename from terminal_usb/Makefile.122_pjrc rename to converter/terminal_usb/Makefile.122_pjrc index b91e484f..bec00510 100644 --- a/terminal_usb/Makefile.122_pjrc +++ b/converter/terminal_usb/Makefile.122_pjrc @@ -7,7 +7,7 @@ TARGET = terminal_usb_122_pjrc # Directory common source filess exist -COMMON_DIR = .. +TOP_DIR = ../.. # Directory keyboard dependent files exist TARGET_DIR = . @@ -52,5 +52,7 @@ PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex -include $(COMMON_DIR)/pjrc.mk -include $(COMMON_DIR)/common.mk +include $(TOP_DIR)/protocol/pjrc.mk +include $(TOP_DIR)/protocol.mk +include $(TOP_DIR)/common.mk +include $(TOP_DIR)/rules.mk diff --git a/terminal_usb/README b/converter/terminal_usb/README similarity index 100% rename from terminal_usb/README rename to converter/terminal_usb/README diff --git a/terminal_usb/config_102_pjrc.h b/converter/terminal_usb/config_102_pjrc.h similarity index 100% rename from terminal_usb/config_102_pjrc.h rename to converter/terminal_usb/config_102_pjrc.h diff --git a/terminal_usb/config_122_pjrc.h b/converter/terminal_usb/config_122_pjrc.h similarity index 100% rename from terminal_usb/config_122_pjrc.h rename to converter/terminal_usb/config_122_pjrc.h diff --git a/terminal_usb/keymap_102.c b/converter/terminal_usb/keymap_102.c similarity index 100% rename from terminal_usb/keymap_102.c rename to converter/terminal_usb/keymap_102.c diff --git a/terminal_usb/keymap_122.c b/converter/terminal_usb/keymap_122.c similarity index 100% rename from terminal_usb/keymap_122.c rename to converter/terminal_usb/keymap_122.c diff --git a/terminal_usb/led.c b/converter/terminal_usb/led.c similarity index 100% rename from terminal_usb/led.c rename to converter/terminal_usb/led.c diff --git a/terminal_usb/matrix.c b/converter/terminal_usb/matrix.c similarity index 100% rename from terminal_usb/matrix.c rename to converter/terminal_usb/matrix.c diff --git a/x68k_usb/Makefile b/converter/x68k_usb/Makefile similarity index 94% rename from x68k_usb/Makefile rename to converter/x68k_usb/Makefile index c4b9b221..c3b5fa29 100644 --- a/x68k_usb/Makefile +++ b/converter/x68k_usb/Makefile @@ -7,7 +7,7 @@ TARGET = x68k_usb_pjrc # Directory common source filess exist -COMMON_DIR = .. +TOP_DIR = ../.. # Directory keyboard dependent files exist TARGET_DIR = . @@ -81,5 +81,7 @@ PROGRAM_CMD = dfu-programmer atmega32u4 flash $(TARGET).hex -include $(COMMON_DIR)/pjrc.mk -include $(COMMON_DIR)/common.mk +include $(TOP_DIR)/protocol/pjrc.mk +include $(TOP_DIR)/protocol.mk +include $(TOP_DIR)/common.mk +include $(TOP_DIR)/rules.mk diff --git a/x68k_usb/README b/converter/x68k_usb/README similarity index 100% rename from x68k_usb/README rename to converter/x68k_usb/README diff --git a/x68k_usb/config_pjrc.h b/converter/x68k_usb/config_pjrc.h similarity index 100% rename from x68k_usb/config_pjrc.h rename to converter/x68k_usb/config_pjrc.h diff --git a/x68k_usb/keymap.c b/converter/x68k_usb/keymap.c similarity index 100% rename from x68k_usb/keymap.c rename to converter/x68k_usb/keymap.c diff --git a/x68k_usb/led.c b/converter/x68k_usb/led.c similarity index 100% rename from x68k_usb/led.c rename to converter/x68k_usb/led.c diff --git a/x68k_usb/matrix.c b/converter/x68k_usb/matrix.c similarity index 100% rename from x68k_usb/matrix.c rename to converter/x68k_usb/matrix.c diff --git a/COPYING.GPLv2 b/doc/COPYING.GPLv2 similarity index 100% rename from COPYING.GPLv2 rename to doc/COPYING.GPLv2 diff --git a/COPYING.GPLv3 b/doc/COPYING.GPLv3 similarity index 100% rename from COPYING.GPLv3 rename to doc/COPYING.GPLv3 diff --git a/hhkb/FUSE.txt b/doc/FUSE.txt similarity index 100% rename from hhkb/FUSE.txt rename to doc/FUSE.txt diff --git a/POWER.txt b/doc/POWER.txt similarity index 100% rename from POWER.txt rename to doc/POWER.txt diff --git a/USB_NKRO.txt b/doc/USB_NKRO.txt similarity index 100% rename from USB_NKRO.txt rename to doc/USB_NKRO.txt diff --git a/hbk/Makefile b/keyboard/hbkb/Makefile similarity index 91% rename from hbk/Makefile rename to keyboard/hbkb/Makefile index e03b45e3..26be322e 100644 --- a/hbk/Makefile +++ b/keyboard/hbkb/Makefile @@ -2,7 +2,7 @@ TARGET = hbk # Directory common source filess exist -COMMON_DIR = .. +TOP_DIR = ../.. # Directory keyboard dependent files exist TARGET_DIR = . @@ -50,5 +50,7 @@ PROGRAM_CMD = /opt/dfu-programmer-0.5.2/bin/dfu-programmer $(MCU) erase && \ -include $(COMMON_DIR)/pjrc.mk -include $(COMMON_DIR)/common.mk +include $(TOP_DIR)/protocol/pjrc.mk +include $(TOP_DIR)/protocol.mk +include $(TOP_DIR)/common.mk +include $(TOP_DIR)/rules.mk diff --git a/hbk/config.h b/keyboard/hbkb/config.h similarity index 100% rename from hbk/config.h rename to keyboard/hbkb/config.h diff --git a/hbk/controller_teensy.h b/keyboard/hbkb/controller_teensy.h similarity index 100% rename from hbk/controller_teensy.h rename to keyboard/hbkb/controller_teensy.h diff --git a/hbk/keymap.c b/keyboard/hbkb/keymap.c similarity index 100% rename from hbk/keymap.c rename to keyboard/hbkb/keymap.c diff --git a/hbk/led.c b/keyboard/hbkb/led.c similarity index 100% rename from hbk/led.c rename to keyboard/hbkb/led.c diff --git a/hbk/matrix.c b/keyboard/hbkb/matrix.c similarity index 100% rename from hbk/matrix.c rename to keyboard/hbkb/matrix.c diff --git a/hhkb/Makefile.iwrap b/keyboard/hhkb/Makefile.iwrap similarity index 93% rename from hhkb/Makefile.iwrap rename to keyboard/hhkb/Makefile.iwrap index cf020b94..ef7ad2ea 100644 --- a/hhkb/Makefile.iwrap +++ b/keyboard/hhkb/Makefile.iwrap @@ -7,7 +7,7 @@ TARGET = hhkb_iwrap # Directory common source filess exist -COMMON_DIR = .. +TOP_DIR = ../.. # Directory keyboard dependent files exist TARGET_DIR = . @@ -85,7 +85,9 @@ PROGRAM_CMD = $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE # Search Path VPATH = $(TARGET_DIR) -include $(COMMON_DIR)/iwrap.mk +include $(TOP_DIR)/protocol/iwrap.mk # To be swatchable btween Bluetooth and USB. Comment out if you don't need USB. -include $(COMMON_DIR)/vusb.mk -include $(COMMON_DIR)/common.mk +include $(TOP_DIR)/protocol/vusb.mk +include $(TOP_DIR)/protocol.mk +include $(TOP_DIR)/common.mk +include $(TOP_DIR)/rules.mk diff --git a/hhkb/Makefile.pjrc b/keyboard/hhkb/Makefile.pjrc similarity index 90% rename from hhkb/Makefile.pjrc rename to keyboard/hhkb/Makefile.pjrc index 17aa865d..f6d133ea 100644 --- a/hhkb/Makefile.pjrc +++ b/keyboard/hhkb/Makefile.pjrc @@ -7,7 +7,7 @@ TARGET = hhkb_pjrc # Directory common source filess exist -COMMON_DIR = .. +TOP_DIR = ../.. # Directory keyboard dependent files exist TARGET_DIR = . @@ -54,5 +54,7 @@ PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex # Search Path VPATH = $(TARGET_DIR) -include $(COMMON_DIR)/pjrc.mk -include $(COMMON_DIR)/common.mk +include $(TOP_DIR)/protocol/pjrc.mk +include $(TOP_DIR)/protocol.mk +include $(TOP_DIR)/common.mk +include $(TOP_DIR)/rules.mk diff --git a/hhkb/Makefile.vusb b/keyboard/hhkb/Makefile.vusb similarity index 94% rename from hhkb/Makefile.vusb rename to keyboard/hhkb/Makefile.vusb index 371b3669..6dd62880 100644 --- a/hhkb/Makefile.vusb +++ b/keyboard/hhkb/Makefile.vusb @@ -7,7 +7,7 @@ TARGET = hhkb_vusb # Directory common source filess exist -COMMON_DIR = .. +TOP_DIR = ../.. # Directory keyboard dependent files exist TARGET_DIR = . @@ -85,5 +85,7 @@ PROGRAM_CMD = $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE # Search Path VPATH = $(TARGET_DIR) -include $(COMMON_DIR)/vusb.mk -include $(COMMON_DIR)/common.mk +include $(TOP_DIR)/protocol/vusb.mk +include $(TOP_DIR)/protocol.mk +include $(TOP_DIR)/common.mk +include $(TOP_DIR)/rules.mk diff --git a/hhkb/README b/keyboard/hhkb/README similarity index 100% rename from hhkb/README rename to keyboard/hhkb/README diff --git a/hhkb/config_iwrap.h b/keyboard/hhkb/config_iwrap.h similarity index 100% rename from hhkb/config_iwrap.h rename to keyboard/hhkb/config_iwrap.h diff --git a/hhkb/config_pjrc.h b/keyboard/hhkb/config_pjrc.h similarity index 100% rename from hhkb/config_pjrc.h rename to keyboard/hhkb/config_pjrc.h diff --git a/hhkb/config_vusb.h b/keyboard/hhkb/config_vusb.h similarity index 100% rename from hhkb/config_vusb.h rename to keyboard/hhkb/config_vusb.h diff --git a/hhkb/doc/Bluetooth.txt b/keyboard/hhkb/doc/Bluetooth.txt similarity index 100% rename from hhkb/doc/Bluetooth.txt rename to keyboard/hhkb/doc/Bluetooth.txt diff --git a/hhkb/doc/Bluetooth_img/.picasa.ini b/keyboard/hhkb/doc/Bluetooth_img/.picasa.ini similarity index 100% rename from hhkb/doc/Bluetooth_img/.picasa.ini rename to keyboard/hhkb/doc/Bluetooth_img/.picasa.ini diff --git a/hhkb/doc/Bluetooth_img/BT_circuit.jpg b/keyboard/hhkb/doc/Bluetooth_img/BT_circuit.jpg old mode 100755 new mode 100644 similarity index 100% rename from hhkb/doc/Bluetooth_img/BT_circuit.jpg rename to keyboard/hhkb/doc/Bluetooth_img/BT_circuit.jpg diff --git a/hhkb/doc/HHKB.txt b/keyboard/hhkb/doc/HHKB.txt similarity index 100% rename from hhkb/doc/HHKB.txt rename to keyboard/hhkb/doc/HHKB.txt diff --git a/hhkb/doc/HHKB_img/HHKB_TP1684.jpg b/keyboard/hhkb/doc/HHKB_img/HHKB_TP1684.jpg similarity index 100% rename from hhkb/doc/HHKB_img/HHKB_TP1684.jpg rename to keyboard/hhkb/doc/HHKB_img/HHKB_TP1684.jpg diff --git a/hhkb/doc/HHKB_img/HHKB_chart1.jpg b/keyboard/hhkb/doc/HHKB_img/HHKB_chart1.jpg similarity index 100% rename from hhkb/doc/HHKB_img/HHKB_chart1.jpg rename to keyboard/hhkb/doc/HHKB_img/HHKB_chart1.jpg diff --git a/hhkb/doc/HHKB_img/HHKB_chart2.jpg b/keyboard/hhkb/doc/HHKB_img/HHKB_chart2.jpg similarity index 100% rename from hhkb/doc/HHKB_img/HHKB_chart2.jpg rename to keyboard/hhkb/doc/HHKB_img/HHKB_chart2.jpg diff --git a/hhkb/doc/HHKB_img/HHKB_connector.jpg b/keyboard/hhkb/doc/HHKB_img/HHKB_connector.jpg similarity index 100% rename from hhkb/doc/HHKB_img/HHKB_connector.jpg rename to keyboard/hhkb/doc/HHKB_img/HHKB_connector.jpg diff --git a/hhkb/doc/HHKB_img/HHKB_controller.jpg b/keyboard/hhkb/doc/HHKB_img/HHKB_controller.jpg similarity index 100% rename from hhkb/doc/HHKB_img/HHKB_controller.jpg rename to keyboard/hhkb/doc/HHKB_img/HHKB_controller.jpg diff --git a/hhkb/doc/HHKB_img/HHKB_keyswitch.jpg b/keyboard/hhkb/doc/HHKB_img/HHKB_keyswitch.jpg similarity index 100% rename from hhkb/doc/HHKB_img/HHKB_keyswitch.jpg rename to keyboard/hhkb/doc/HHKB_img/HHKB_keyswitch.jpg diff --git a/hhkb/doc/HHKB_img/connector_contact.jpg b/keyboard/hhkb/doc/HHKB_img/connector_contact.jpg similarity index 100% rename from hhkb/doc/HHKB_img/connector_contact.jpg rename to keyboard/hhkb/doc/HHKB_img/connector_contact.jpg diff --git a/hhkb/doc/HHKB_img/logic_analyzer.jpg b/keyboard/hhkb/doc/HHKB_img/logic_analyzer.jpg similarity index 100% rename from hhkb/doc/HHKB_img/logic_analyzer.jpg rename to keyboard/hhkb/doc/HHKB_img/logic_analyzer.jpg diff --git a/hhkb/doc/HHKB_img/probe_contact.jpg b/keyboard/hhkb/doc/HHKB_img/probe_contact.jpg similarity index 100% rename from hhkb/doc/HHKB_img/probe_contact.jpg rename to keyboard/hhkb/doc/HHKB_img/probe_contact.jpg diff --git a/hhkb/doc/HHKB_img/teensy_install.jpg b/keyboard/hhkb/doc/HHKB_img/teensy_install.jpg similarity index 100% rename from hhkb/doc/HHKB_img/teensy_install.jpg rename to keyboard/hhkb/doc/HHKB_img/teensy_install.jpg diff --git a/hhkb/doc/HHKB_img/teensy_wiring.jpg b/keyboard/hhkb/doc/HHKB_img/teensy_wiring.jpg similarity index 100% rename from hhkb/doc/HHKB_img/teensy_wiring.jpg rename to keyboard/hhkb/doc/HHKB_img/teensy_wiring.jpg diff --git a/hhkb/keymap.c b/keyboard/hhkb/keymap.c similarity index 100% rename from hhkb/keymap.c rename to keyboard/hhkb/keymap.c diff --git a/hhkb/led.c b/keyboard/hhkb/led.c similarity index 100% rename from hhkb/led.c rename to keyboard/hhkb/led.c diff --git a/hhkb/matrix.c b/keyboard/hhkb/matrix.c similarity index 100% rename from hhkb/matrix.c rename to keyboard/hhkb/matrix.c diff --git a/hhkb/usbconfig.h b/keyboard/hhkb/usbconfig.h similarity index 100% rename from hhkb/usbconfig.h rename to keyboard/hhkb/usbconfig.h diff --git a/macway/Makefile b/keyboard/macway/Makefile similarity index 90% rename from macway/Makefile rename to keyboard/macway/Makefile index b8b0a85e..afee38b1 100644 --- a/macway/Makefile +++ b/keyboard/macway/Makefile @@ -2,7 +2,7 @@ TARGET = macway # Directory common source filess exist -COMMON_DIR = .. +TOP_DIR = ../.. # Directory keyboard dependent files exist TARGET_DIR = . @@ -47,5 +47,7 @@ PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex -include $(COMMON_DIR)/pjrc.mk -include $(COMMON_DIR)/common.mk +include $(TOP_DIR)/protocol/pjrc.mk +include $(TOP_DIR)/protocol.mk +include $(TOP_DIR)/common.mk +include $(TOP_DIR)/rules.mk diff --git a/macway/config.h b/keyboard/macway/config.h similarity index 100% rename from macway/config.h rename to keyboard/macway/config.h diff --git a/macway/doc/back.jpg b/keyboard/macway/doc/back.jpg similarity index 100% rename from macway/doc/back.jpg rename to keyboard/macway/doc/back.jpg diff --git a/macway/doc/case.jpg b/keyboard/macway/doc/case.jpg similarity index 100% rename from macway/doc/case.jpg rename to keyboard/macway/doc/case.jpg diff --git a/macway/doc/keys.jpg b/keyboard/macway/doc/keys.jpg similarity index 100% rename from macway/doc/keys.jpg rename to keyboard/macway/doc/keys.jpg diff --git a/macway/doc/side.jpg b/keyboard/macway/doc/side.jpg similarity index 100% rename from macway/doc/side.jpg rename to keyboard/macway/doc/side.jpg diff --git a/macway/doc/switch.jpg b/keyboard/macway/doc/switch.jpg similarity index 100% rename from macway/doc/switch.jpg rename to keyboard/macway/doc/switch.jpg diff --git a/macway/doc/teensy.jpg b/keyboard/macway/doc/teensy.jpg similarity index 100% rename from macway/doc/teensy.jpg rename to keyboard/macway/doc/teensy.jpg diff --git a/macway/doc/wiring.jpg b/keyboard/macway/doc/wiring.jpg similarity index 100% rename from macway/doc/wiring.jpg rename to keyboard/macway/doc/wiring.jpg diff --git a/macway/doc/withHHKB.jpg b/keyboard/macway/doc/withHHKB.jpg similarity index 100% rename from macway/doc/withHHKB.jpg rename to keyboard/macway/doc/withHHKB.jpg diff --git a/macway/doc/withThinkPad.jpg b/keyboard/macway/doc/withThinkPad.jpg similarity index 100% rename from macway/doc/withThinkPad.jpg rename to keyboard/macway/doc/withThinkPad.jpg diff --git a/macway/keymap.c b/keyboard/macway/keymap.c similarity index 100% rename from macway/keymap.c rename to keyboard/macway/keymap.c diff --git a/macway/led.c b/keyboard/macway/led.c similarity index 100% rename from macway/led.c rename to keyboard/macway/led.c diff --git a/macway/matrix.c b/keyboard/macway/matrix.c similarity index 100% rename from macway/matrix.c rename to keyboard/macway/matrix.c diff --git a/pjrc/host.c b/pjrc/host.c deleted file mode 100644 index fcf71d57..00000000 --- a/pjrc/host.c +++ /dev/null @@ -1,183 +0,0 @@ -/* -Copyright 2011 Jun Wako - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#include -#include -#include "usb_keycodes.h" -#include "usb_keyboard.h" -#if defined(MOUSEKEY_ENABLE) || defined(PS2_MOUSE_ENABLE) -#include "usb_mouse.h" -#endif -#ifdef EXTRAKEY_ENABLE -#include "usb_extra.h" -#endif -#include "debug.h" -#include "host.h" -#include "util.h" - - -#ifdef NKRO_ENABLE -bool keyboard_nkro = false; -#endif - -static report_keyboard_t report0; -static report_keyboard_t report1; -report_keyboard_t *keyboard_report = &report0; -report_keyboard_t *keyboard_report_prev = &report1; - -static inline void add_key_byte(uint8_t code); -static inline void add_key_bit(uint8_t code); - - -uint8_t host_keyboard_leds(void) -{ - return usb_keyboard_leds; -} - -/* keyboard report operations */ -void host_add_key(uint8_t key) -{ -#ifdef NKRO_ENABLE - if (keyboard_nkro) { - add_key_bit(key); - return; - } -#endif - add_key_byte(key); -} - -void host_add_mod_bit(uint8_t mod) -{ - keyboard_report->mods |= mod; -} - -void host_set_mods(uint8_t mods) -{ - keyboard_report->mods = mods; -} - -void host_add_code(uint8_t code) -{ - if (IS_MOD(code)) { - host_add_mod_bit(MOD_BIT(code)); - } else { - host_add_key(code); - } -} - -void host_swap_keyboard_report(void) -{ - uint8_t sreg = SREG; - cli(); - report_keyboard_t *tmp = keyboard_report_prev; - keyboard_report_prev = keyboard_report; - keyboard_report = tmp; - SREG = sreg; -} - -void host_clear_keyboard_report(void) -{ - keyboard_report->mods = 0; - for (int8_t i = 0; i < REPORT_KEYS; i++) { - keyboard_report->keys[i] = 0; - } -} - -uint8_t host_has_anykey(void) -{ - uint8_t cnt = 0; - for (int i = 0; i < REPORT_KEYS; i++) { - if (keyboard_report->keys[i]) - cnt++; - } - return cnt; -} - -uint8_t host_get_first_key(void) -{ -#ifdef NKRO_ENABLE - if (keyboard_nkro) { - uint8_t i = 0; - for (; i < REPORT_KEYS && !keyboard_report->keys[i]; i++) - ; - return i<<3 | biton(keyboard_report->keys[i]); - } -#endif - return keyboard_report->keys[0]; -} - - -void host_send_keyboard_report(void) -{ - usb_keyboard_send_report(keyboard_report); -} - -#if defined(MOUSEKEY_ENABLE) || defined(PS2_MOUSE_ENABLE) -void host_mouse_send(report_mouse_t *report) -{ - usb_mouse_send(report->x, report->y, report->v, report->h, report->buttons); -} -#endif - -#ifdef EXTRAKEY_ENABLE -void host_system_send(uint16_t data) -{ - usb_extra_system_send(data); -} - -void host_consumer_send(uint16_t data) -{ - static uint16_t last_data = 0; - if (data == last_data) return; - last_data = data; - - usb_extra_consumer_send(data); -} -#endif - - -static inline void add_key_byte(uint8_t code) -{ - // TODO: fix ugly code - int8_t i = 0; - int8_t empty = -1; - for (; i < REPORT_KEYS; i++) { - if (keyboard_report_prev->keys[i] == code) { - keyboard_report->keys[i] = code; - break; - } - if (empty == -1 && - keyboard_report_prev->keys[i] == 0 && - keyboard_report->keys[i] == 0) { - empty = i; - } - } - if (i == REPORT_KEYS) { - if (empty != -1) { - keyboard_report->keys[empty] = code; - } - } -} - -static inline void add_key_bit(uint8_t code) -{ - if ((code>>3) < REPORT_KEYS) { - keyboard_report->keys[code>>3] |= 1<<(code&7); - } else { - debug("add_key_bit: can't add: "); phex(code); debug("\n"); - } -} diff --git a/protocol.mk b/protocol.mk new file mode 100644 index 00000000..1442c520 --- /dev/null +++ b/protocol.mk @@ -0,0 +1,2 @@ +# Search Path +VPATH += $(TOP_DIR)/protocol diff --git a/adb.c b/protocol/adb.c similarity index 100% rename from adb.c rename to protocol/adb.c diff --git a/adb.h b/protocol/adb.h similarity index 100% rename from adb.h rename to protocol/adb.h diff --git a/iwrap.mk b/protocol/iwrap.mk similarity index 73% rename from iwrap.mk rename to protocol/iwrap.mk index ea4a6e97..d9906fd1 100644 --- a/iwrap.mk +++ b/protocol/iwrap.mk @@ -7,4 +7,4 @@ SRC += iwrap.c \ # Search Path -VPATH += $(COMMON_DIR)/iwrap +VPATH += $(TOP_DIR)/protocol/iwrap diff --git a/iwrap/iWRAP.txt b/protocol/iwrap/iWRAP.txt similarity index 100% rename from iwrap/iWRAP.txt rename to protocol/iwrap/iWRAP.txt diff --git a/iwrap/iwrap.c b/protocol/iwrap/iwrap.c similarity index 100% rename from iwrap/iwrap.c rename to protocol/iwrap/iwrap.c diff --git a/iwrap/iwrap.h b/protocol/iwrap/iwrap.h similarity index 100% rename from iwrap/iwrap.h rename to protocol/iwrap/iwrap.h diff --git a/iwrap/main.c b/protocol/iwrap/main.c similarity index 100% rename from iwrap/main.c rename to protocol/iwrap/main.c diff --git a/iwrap/suart.S b/protocol/iwrap/suart.S similarity index 100% rename from iwrap/suart.S rename to protocol/iwrap/suart.S diff --git a/iwrap/suart.h b/protocol/iwrap/suart.h similarity index 100% rename from iwrap/suart.h rename to protocol/iwrap/suart.h diff --git a/iwrap/wd.h b/protocol/iwrap/wd.h similarity index 100% rename from iwrap/wd.h rename to protocol/iwrap/wd.h diff --git a/m0110.c b/protocol/m0110.c similarity index 100% rename from m0110.c rename to protocol/m0110.c diff --git a/m0110.h b/protocol/m0110.h similarity index 100% rename from m0110.h rename to protocol/m0110.h diff --git a/sony_usb/news.c b/protocol/news.c similarity index 100% rename from sony_usb/news.c rename to protocol/news.c diff --git a/sony_usb/news.h b/protocol/news.h similarity index 100% rename from sony_usb/news.h rename to protocol/news.h diff --git a/pjrc.mk b/protocol/pjrc.mk similarity index 86% rename from pjrc.mk rename to protocol/pjrc.mk index e13a809a..1ee45e9e 100644 --- a/pjrc.mk +++ b/protocol/pjrc.mk @@ -8,7 +8,7 @@ SRC += pjrc.c \ # Search Path -VPATH += $(COMMON_DIR):$(COMMON_DIR)/pjrc +VPATH += $(TOP_DIR)/protocol/pjrc # Option modules diff --git a/pjrc/bootloader_teensy.c b/protocol/pjrc/bootloader_teensy.c similarity index 100% rename from pjrc/bootloader_teensy.c rename to protocol/pjrc/bootloader_teensy.c diff --git a/pjrc/main.c b/protocol/pjrc/main.c similarity index 100% rename from pjrc/main.c rename to protocol/pjrc/main.c diff --git a/pjrc/pjrc.c b/protocol/pjrc/pjrc.c similarity index 100% rename from pjrc/pjrc.c rename to protocol/pjrc/pjrc.c diff --git a/pjrc/pjrc.h b/protocol/pjrc/pjrc.h similarity index 100% rename from pjrc/pjrc.h rename to protocol/pjrc/pjrc.h diff --git a/pjrc/usb.c b/protocol/pjrc/usb.c similarity index 100% rename from pjrc/usb.c rename to protocol/pjrc/usb.c diff --git a/pjrc/usb.h b/protocol/pjrc/usb.h similarity index 100% rename from pjrc/usb.h rename to protocol/pjrc/usb.h diff --git a/pjrc/usb_debug.c b/protocol/pjrc/usb_debug.c similarity index 100% rename from pjrc/usb_debug.c rename to protocol/pjrc/usb_debug.c diff --git a/pjrc/usb_debug.h b/protocol/pjrc/usb_debug.h similarity index 100% rename from pjrc/usb_debug.h rename to protocol/pjrc/usb_debug.h diff --git a/pjrc/usb_extra.c b/protocol/pjrc/usb_extra.c similarity index 100% rename from pjrc/usb_extra.c rename to protocol/pjrc/usb_extra.c diff --git a/pjrc/usb_extra.h b/protocol/pjrc/usb_extra.h similarity index 100% rename from pjrc/usb_extra.h rename to protocol/pjrc/usb_extra.h diff --git a/pjrc/usb_keyboard.c b/protocol/pjrc/usb_keyboard.c similarity index 100% rename from pjrc/usb_keyboard.c rename to protocol/pjrc/usb_keyboard.c diff --git a/pjrc/usb_keyboard.h b/protocol/pjrc/usb_keyboard.h similarity index 100% rename from pjrc/usb_keyboard.h rename to protocol/pjrc/usb_keyboard.h diff --git a/pjrc/usb_mouse.c b/protocol/pjrc/usb_mouse.c similarity index 100% rename from pjrc/usb_mouse.c rename to protocol/pjrc/usb_mouse.c diff --git a/pjrc/usb_mouse.h b/protocol/pjrc/usb_mouse.h similarity index 100% rename from pjrc/usb_mouse.h rename to protocol/pjrc/usb_mouse.h diff --git a/ps2.c b/protocol/ps2.c similarity index 100% rename from ps2.c rename to protocol/ps2.c diff --git a/ps2.h b/protocol/ps2.h similarity index 100% rename from ps2.h rename to protocol/ps2.h diff --git a/ps2_mouse.c b/protocol/ps2_mouse.c similarity index 100% rename from ps2_mouse.c rename to protocol/ps2_mouse.c diff --git a/ps2_mouse.h b/protocol/ps2_mouse.h similarity index 100% rename from ps2_mouse.h rename to protocol/ps2_mouse.h diff --git a/ps2_usart.c b/protocol/ps2_usart.c similarity index 100% rename from ps2_usart.c rename to protocol/ps2_usart.c diff --git a/vusb.mk b/protocol/vusb.mk similarity index 75% rename from vusb.mk rename to protocol/vusb.mk index 9426efb2..9e8e1fb3 100644 --- a/vusb.mk +++ b/protocol/vusb.mk @@ -16,4 +16,4 @@ endif # Search Path -VPATH += $(COMMON_DIR)/vusb:$(COMMON_DIR)/vusb/usbdrv +VPATH += $(TOP_DIR)/protocol/vusb:$(TOP_DIR)/protocol/vusb/usbdrv diff --git a/vusb/bootloader_usbasp.c b/protocol/vusb/bootloader_usbasp.c similarity index 100% rename from vusb/bootloader_usbasp.c rename to protocol/vusb/bootloader_usbasp.c diff --git a/vusb/main.c b/protocol/vusb/main.c similarity index 100% rename from vusb/main.c rename to protocol/vusb/main.c diff --git a/vusb/sendchar_usart.c b/protocol/vusb/sendchar_usart.c similarity index 100% rename from vusb/sendchar_usart.c rename to protocol/vusb/sendchar_usart.c diff --git a/vusb/usbdrv/Changelog.txt b/protocol/vusb/usbdrv/Changelog.txt similarity index 100% rename from vusb/usbdrv/Changelog.txt rename to protocol/vusb/usbdrv/Changelog.txt diff --git a/vusb/usbdrv/CommercialLicense.txt b/protocol/vusb/usbdrv/CommercialLicense.txt similarity index 100% rename from vusb/usbdrv/CommercialLicense.txt rename to protocol/vusb/usbdrv/CommercialLicense.txt diff --git a/vusb/usbdrv/License.txt b/protocol/vusb/usbdrv/License.txt similarity index 100% rename from vusb/usbdrv/License.txt rename to protocol/vusb/usbdrv/License.txt diff --git a/vusb/usbdrv/Readme.txt b/protocol/vusb/usbdrv/Readme.txt similarity index 100% rename from vusb/usbdrv/Readme.txt rename to protocol/vusb/usbdrv/Readme.txt diff --git a/vusb/usbdrv/USB-ID-FAQ.txt b/protocol/vusb/usbdrv/USB-ID-FAQ.txt similarity index 100% rename from vusb/usbdrv/USB-ID-FAQ.txt rename to protocol/vusb/usbdrv/USB-ID-FAQ.txt diff --git a/vusb/usbdrv/USB-IDs-for-free.txt b/protocol/vusb/usbdrv/USB-IDs-for-free.txt similarity index 100% rename from vusb/usbdrv/USB-IDs-for-free.txt rename to protocol/vusb/usbdrv/USB-IDs-for-free.txt diff --git a/vusb/usbdrv/asmcommon.inc b/protocol/vusb/usbdrv/asmcommon.inc similarity index 100% rename from vusb/usbdrv/asmcommon.inc rename to protocol/vusb/usbdrv/asmcommon.inc diff --git a/vusb/usbdrv/oddebug.c b/protocol/vusb/usbdrv/oddebug.c similarity index 100% rename from vusb/usbdrv/oddebug.c rename to protocol/vusb/usbdrv/oddebug.c diff --git a/vusb/usbdrv/oddebug.h b/protocol/vusb/usbdrv/oddebug.h similarity index 100% rename from vusb/usbdrv/oddebug.h rename to protocol/vusb/usbdrv/oddebug.h diff --git a/vusb/usbdrv/usbconfig-prototype.h b/protocol/vusb/usbdrv/usbconfig-prototype.h similarity index 100% rename from vusb/usbdrv/usbconfig-prototype.h rename to protocol/vusb/usbdrv/usbconfig-prototype.h diff --git a/vusb/usbdrv/usbdrv.c b/protocol/vusb/usbdrv/usbdrv.c similarity index 100% rename from vusb/usbdrv/usbdrv.c rename to protocol/vusb/usbdrv/usbdrv.c diff --git a/vusb/usbdrv/usbdrv.h b/protocol/vusb/usbdrv/usbdrv.h similarity index 100% rename from vusb/usbdrv/usbdrv.h rename to protocol/vusb/usbdrv/usbdrv.h diff --git a/vusb/usbdrv/usbdrvasm.S b/protocol/vusb/usbdrv/usbdrvasm.S similarity index 100% rename from vusb/usbdrv/usbdrvasm.S rename to protocol/vusb/usbdrv/usbdrvasm.S diff --git a/vusb/usbdrv/usbdrvasm.asm b/protocol/vusb/usbdrv/usbdrvasm.asm similarity index 100% rename from vusb/usbdrv/usbdrvasm.asm rename to protocol/vusb/usbdrv/usbdrvasm.asm diff --git a/vusb/usbdrv/usbdrvasm12.inc b/protocol/vusb/usbdrv/usbdrvasm12.inc similarity index 100% rename from vusb/usbdrv/usbdrvasm12.inc rename to protocol/vusb/usbdrv/usbdrvasm12.inc diff --git a/vusb/usbdrv/usbdrvasm128.inc b/protocol/vusb/usbdrv/usbdrvasm128.inc similarity index 100% rename from vusb/usbdrv/usbdrvasm128.inc rename to protocol/vusb/usbdrv/usbdrvasm128.inc diff --git a/vusb/usbdrv/usbdrvasm15.inc b/protocol/vusb/usbdrv/usbdrvasm15.inc similarity index 100% rename from vusb/usbdrv/usbdrvasm15.inc rename to protocol/vusb/usbdrv/usbdrvasm15.inc diff --git a/vusb/usbdrv/usbdrvasm16.inc b/protocol/vusb/usbdrv/usbdrvasm16.inc similarity index 100% rename from vusb/usbdrv/usbdrvasm16.inc rename to protocol/vusb/usbdrv/usbdrvasm16.inc diff --git a/vusb/usbdrv/usbdrvasm165.inc b/protocol/vusb/usbdrv/usbdrvasm165.inc similarity index 100% rename from vusb/usbdrv/usbdrvasm165.inc rename to protocol/vusb/usbdrv/usbdrvasm165.inc diff --git a/vusb/usbdrv/usbdrvasm18-crc.inc b/protocol/vusb/usbdrv/usbdrvasm18-crc.inc similarity index 100% rename from vusb/usbdrv/usbdrvasm18-crc.inc rename to protocol/vusb/usbdrv/usbdrvasm18-crc.inc diff --git a/vusb/usbdrv/usbdrvasm20.inc b/protocol/vusb/usbdrv/usbdrvasm20.inc similarity index 100% rename from vusb/usbdrv/usbdrvasm20.inc rename to protocol/vusb/usbdrv/usbdrvasm20.inc diff --git a/vusb/usbdrv/usbportability.h b/protocol/vusb/usbdrv/usbportability.h similarity index 100% rename from vusb/usbdrv/usbportability.h rename to protocol/vusb/usbdrv/usbportability.h diff --git a/vusb/vusb.c b/protocol/vusb/vusb.c similarity index 100% rename from vusb/vusb.c rename to protocol/vusb/vusb.c diff --git a/vusb/vusb.h b/protocol/vusb/vusb.h similarity index 100% rename from vusb/vusb.h rename to protocol/vusb/vusb.h diff --git a/x68k_usb/x68k.c b/protocol/x68k.c similarity index 100% rename from x68k_usb/x68k.c rename to protocol/x68k.c diff --git a/x68k_usb/x68k.h b/protocol/x68k.h similarity index 100% rename from x68k_usb/x68k.h rename to protocol/x68k.h diff --git a/rules.mk b/rules.mk index 9143f9bc..104031fb 100644 --- a/rules.mk +++ b/rules.mk @@ -121,7 +121,9 @@ CFLAGS += -Wstrict-prototypes CFLAGS += -Wa,-adhlns=$(@:%.o=%.lst) CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) CFLAGS += $(CSTANDARD) -CFLAGS += -include $(CONFIG_H) +ifdef CONFIG_H + CFLAGS += -include $(CONFIG_H) +endif #---------------- Compiler Options C++ ---------------- @@ -149,7 +151,9 @@ CPPFLAGS += -Wundef CPPFLAGS += -Wa,-adhlns=$(@:%.o=%.lst) CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) #CPPFLAGS += $(CSTANDARD) -CPPFLAGS += -include $(CONFIG_H) +ifdef CONFIG_H + CPPFLAGS += -include $(CONFIG_H) +endif #---------------- Assembler Options ---------------- @@ -162,7 +166,9 @@ CPPFLAGS += -include $(CONFIG_H) # -listing-cont-lines: Sets the maximum number of continuation lines of hex # dump that will be displayed for a given single line of source input. ASFLAGS = $(ADEFS) -Wa,-adhlns=$(@:%.o=%.lst),-gstabs,--listing-cont-lines=100 -ASFLAGS += -include $(CONFIG_H) +ifdef CONFIG_H + ASFLAGS += -include $(CONFIG_H) +endif #---------------- Library Options ----------------