Browse Source

Change Makefile and port setting

- Makefile use LUFA now
- Change MCU ports PF{0,1} to PD{0,1}
- Add build option for keymap to Makefile: make keymap=hasu
tmk 12 years ago
parent
commit
60103a12b2

+ 33 - 4
converter/m0110_usb/Makefile

@@ -1,5 +1,5 @@
 # Target file name (without extension).
 # Target file name (without extension).
-TARGET = m0110
+TARGET = m0110_lufa
 
 
 # Directory common source filess exist
 # Directory common source filess exist
 TOP_DIR = ../..
 TOP_DIR = ../..
@@ -8,11 +8,17 @@ TOP_DIR = ../..
 TARGET_DIR = .
 TARGET_DIR = .
 
 
 # keyboard dependent files
 # keyboard dependent files
-SRC = 	keymap.c \
+SRC =	matrix.c \
-	matrix.c \
 	led.c \
 	led.c \
 	m0110.c
 	m0110.c
 
 
+# To use own keymap file run make like: make keymap=hasu
+ifdef keymap
+    SRC += keymap_$(keymap).c
+else
+    SRC += keymap.c
+endif
+
 CONFIG_H = config.h
 CONFIG_H = config.h
 
 
 
 
@@ -32,6 +38,29 @@ MCU = atmega32u4       # Teensy 2.0
 F_CPU = 16000000
 F_CPU = 16000000
 
 
 
 
+#
+# LUFA specific
+#
+# Target architecture (see library "Board Types" documentation).
+ARCH = AVR8
+
+# Input clock frequency.
+#     This will define a symbol, F_USB, in all source code files equal to the
+#     input clock frequency (before any prescaling is performed) in Hz. This value may
+#     differ from F_CPU if prescaling is used on the latter, and is required as the
+#     raw input clock is fed directly to the PLL sections of the AVR for high speed
+#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
+#     at the end, this will be done automatically to create a 32-bit value in your
+#     source code.
+#
+#     If no clock division is performed on the input clock inside the AVR (via the
+#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
+F_USB = $(F_CPU)
+
+# Interrupt driven control endpoint task
+OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
+
+
 # Boot Section Size in bytes
 # Boot Section Size in bytes
 #   Teensy halfKay   512
 #   Teensy halfKay   512
 #   Atmel DFU loader 4096
 #   Atmel DFU loader 4096
@@ -61,7 +90,7 @@ VPATH += $(TARGET_DIR)
 VPATH += $(TOP_DIR)
 VPATH += $(TOP_DIR)
 
 
 
 
-include $(TOP_DIR)/protocol/pjrc.mk
+include $(TOP_DIR)/protocol/lufa.mk
 include $(TOP_DIR)/protocol.mk
 include $(TOP_DIR)/protocol.mk
 include $(TOP_DIR)/common.mk
 include $(TOP_DIR)/common.mk
 include $(TOP_DIR)/rules.mk
 include $(TOP_DIR)/rules.mk

+ 0 - 90
converter/m0110_usb/Makefile.lufa

@@ -1,90 +0,0 @@
-# Target file name (without extension).
-TARGET = m0110_lufa
-
-# Directory common source filess exist
-TOP_DIR = ../..
-
-# Directory keyboard dependent files exist
-TARGET_DIR = .
-
-# keyboard dependent files
-SRC = 	keymap.c \
-	matrix.c \
-	led.c \
-	m0110.c
-
-CONFIG_H = config.h
-
-
-# MCU name, you MUST set this to match the board you are using
-# type "make clean" after changing this, so all files will be rebuilt
-#MCU = at90usb162       # Teensy 1.0
-MCU = atmega32u4       # Teensy 2.0
-#MCU = at90usb646       # Teensy++ 1.0
-#MCU = at90usb1286      # Teensy++ 2.0
-
-
-# Processor frequency.
-#   Normally the first thing your program should do is set the clock prescaler,
-#   so your program will run at the correct speed.  You should also set this
-#   variable to same clock speed.  The _delay_ms() macro uses this, and many
-#   examples use this variable to calculate timings.  Do not add a "UL" here.
-F_CPU = 16000000
-
-
-#
-# LUFA specific
-#
-# Target architecture (see library "Board Types" documentation).
-ARCH = AVR8
-
-# Input clock frequency.
-#     This will define a symbol, F_USB, in all source code files equal to the
-#     input clock frequency (before any prescaling is performed) in Hz. This value may
-#     differ from F_CPU if prescaling is used on the latter, and is required as the
-#     raw input clock is fed directly to the PLL sections of the AVR for high speed
-#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
-#     at the end, this will be done automatically to create a 32-bit value in your
-#     source code.
-#
-#     If no clock division is performed on the input clock inside the AVR (via the
-#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
-F_USB = $(F_CPU)
-
-# Interrupt driven control endpoint task
-OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
-
-
-# Boot Section Size in bytes
-#   Teensy halfKay   512
-#   Atmel DFU loader 4096
-#   LUFA bootloader  4096
-OPT_DEFS += -DBOOTLOADER_SIZE=4096
-
-
-# Build Options
-#   comment out to disable the options.
-#
-#BOOTMAGIC_ENABLE = yes	# Virtual DIP switch configuration(+1000)
-MOUSEKEY_ENABLE = yes	# Mouse keys(+4700)
-EXTRAKEY_ENABLE = yes	# Audio control and System control(+450)
-CONSOLE_ENABLE = yes	# Console for debug(+400)
-COMMAND_ENABLE = yes    # Commands for debug and configuration
-#SLEEP_LED_ENABLE = yes  # Breathing sleep LED during USB suspend
-#NKRO_ENABLE = yes	# USB Nkey Rollover - not yet supported in LUFA
-
-
-
-#---------------- Programming Options --------------------------
-PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
-
-
-# Search Path
-VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
-
-
-include $(TOP_DIR)/protocol/lufa.mk
-include $(TOP_DIR)/protocol.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk

+ 23 - 7
converter/m0110_usb/Makefile.hasu → converter/m0110_usb/Makefile.pjrc

@@ -1,5 +1,5 @@
 # Target file name (without extension).
 # Target file name (without extension).
-TARGET = m0110
+TARGET = m0110_pjrc
 
 
 # Directory common source filess exist
 # Directory common source filess exist
 TOP_DIR = ../..
 TOP_DIR = ../..
@@ -8,11 +8,17 @@ TOP_DIR = ../..
 TARGET_DIR = .
 TARGET_DIR = .
 
 
 # keyboard dependent files
 # keyboard dependent files
-SRC = 	keymap_hasu.c \
+SRC =	matrix.c \
-	matrix.c \
 	led.c \
 	led.c \
 	m0110.c
 	m0110.c
 
 
+# To use own keymap file run make like: make keymap=hasu
+ifdef keymap
+    SRC += keymap_$(keymap).c
+else
+    SRC += keymap.c
+endif
+
 CONFIG_H = config.h
 CONFIG_H = config.h
 
 
 
 
@@ -32,13 +38,23 @@ MCU = atmega32u4       # Teensy 2.0
 F_CPU = 16000000
 F_CPU = 16000000
 
 
 
 
+# Boot Section Size in bytes
+#   Teensy halfKay   512
+#   Atmel DFU loader 4096
+#   LUFA bootloader  4096
+OPT_DEFS += -DBOOTLOADER_SIZE=4096
+
+
 # Build Options
 # Build Options
 #   *Comment out* to disable the options.
 #   *Comment out* to disable the options.
 #
 #
-MOUSEKEY_ENABLE = yes	# Mouse keys
+#BOOTMAGIC_ENABLE = yes	# Virtual DIP switch configuration(+1000)
-#PS2_MOUSE_ENABLE = yes	# PS/2 mouse(TrackPoint) support
+MOUSEKEY_ENABLE = yes	# Mouse keys(+4700)
-EXTRAKEY_ENABLE = yes	# Audio control and System control
+EXTRAKEY_ENABLE = yes	# Audio control and System control(+450)
-#NKRO_ENABLE = yes	# USB Nkey Rollover
+CONSOLE_ENABLE = yes	# Console for debug(+400)
+COMMAND_ENABLE = yes    # Commands for debug and configuration
+#SLEEP_LED_ENABLE = yes  # Breathing sleep LED during USB suspend
+#NKRO_ENABLE = yes	# USB Nkey Rollover - not yet supported in LUFA
 
 
 
 
 
 

+ 9 - 3
converter/m0110_usb/README.md

@@ -11,10 +11,16 @@ you can use other board with USB AVR like `ATmega32U4` and `AT90USB`.
 
 
 
 
 
 
+Update
+------
+- 2013/08   Change port for signals PF to PD
+
+
+
 Connection
 Connection
 ----------
 ----------
 You need 4P4C plug and cable to connect Teensy or other AVR dev board into the keyboard.
 You need 4P4C plug and cable to connect Teensy or other AVR dev board into the keyboard.
-Teensy port `PF0` is assigned for `CLOCK` line and `PF1` for `DATA` by default,
+Teensy port `PD0` is assigned for `CLOCK` line and `PD1` for `DATA` by default,
 you can change pin configuration with editing *config.h*.
 you can change pin configuration with editing *config.h*.
 
 
 You can find 4P4C plugs on telephone handset cable. Note that it is *crossover* connection
 You can find 4P4C plugs on telephone handset cable. Note that it is *crossover* connection
@@ -53,8 +59,8 @@ You can edit *Makefile* and *config.h* to change compile options and pin configu
 
 
     $ git clone git://github.com/tmk/tmk_keyboard.git (or download source)
     $ git clone git://github.com/tmk/tmk_keyboard.git (or download source)
     $ cd m0110_usb
     $ cd m0110_usb
-    $ make -f Makefile.lufa clean
+    $ make -f Makefile clean
-    $ make -f Makefile.lufa
+    $ make -f Makefile
 
 
 and program your Teensy with [PJRC Teensy loader](http://www.pjrc.com/teensy/loader.html).
 and program your Teensy with [PJRC Teensy loader](http://www.pjrc.com/teensy/loader.html).
 
 

+ 7 - 7
converter/m0110_usb/config.h

@@ -21,7 +21,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
 #define VENDOR_ID       0xFEED
 #define VENDOR_ID       0xFEED
 #define PRODUCT_ID      0x0110
 #define PRODUCT_ID      0x0110
-#define DEVICE_VER      0x0100
+#define DEVICE_VER      0x0101
 #define MANUFACTURER    t.m.k.
 #define MANUFACTURER    t.m.k.
 #define PRODUCT         M0110 keyboard converter
 #define PRODUCT         M0110 keyboard converter
 #define DESCRIPTION     convert M0110 keyboard to USB
 #define DESCRIPTION     convert M0110 keyboard to USB
@@ -50,13 +50,13 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
 
 
 /* ports */
 /* ports */
-#define M0110_CLOCK_PORT        PORTF
+#define M0110_CLOCK_PORT        PORTD
-#define M0110_CLOCK_PIN         PINF
+#define M0110_CLOCK_PIN         PIND
-#define M0110_CLOCK_DDR         DDRF
+#define M0110_CLOCK_DDR         DDRD
 #define M0110_CLOCK_BIT         0
 #define M0110_CLOCK_BIT         0
-#define M0110_DATA_PORT         PORTF
+#define M0110_DATA_PORT         PORTD
-#define M0110_DATA_PIN          PINF
+#define M0110_DATA_PIN          PIND
-#define M0110_DATA_DDR          DDRF
+#define M0110_DATA_DDR          DDRD
 #define M0110_DATA_BIT          1
 #define M0110_DATA_BIT          1
 
 
 #endif
 #endif

+ 4 - 5
converter/m0110_usb/keymap_hasu.c

@@ -19,7 +19,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #include <stdint.h>
 #include <stdint.h>
 #include <stdbool.h>
 #include <stdbool.h>
 #include <avr/pgmspace.h>
 #include <avr/pgmspace.h>
-#include "usb_keyboard.h"
 #include "keycode.h"
 #include "keycode.h"
 #include "print.h"
 #include "print.h"
 #include "debug.h"
 #include "debug.h"
@@ -153,7 +152,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
      *      `-----------------------------------------------'      `---------------'
      *      `-----------------------------------------------'      `---------------'
      */
      */
     KEYMAP(
     KEYMAP(
-    GRV, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,    NLCK,EQL, PSLS,PAST,
+    ESC, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,    NLCK,EQL, PSLS,PAST,
     TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,         P7,  P8,  P9,  PMNS,
     TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,         P7,  P8,  P9,  PMNS,
     LCTL,A,   S,   D,   F,   G,   H,   J,   K,   L,   FN1, QUOT,     FN0,     P4,  P5,  P6,  PPLS,
     LCTL,A,   S,   D,   F,   G,   H,   J,   K,   L,   FN1, QUOT,     FN0,     P4,  P5,  P6,  PPLS,
     LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, FN2,           FN3,     P1,  P2,  P3,  PENT,
     LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, FN2,           FN3,     P1,  P2,  P3,  PENT,
@@ -161,7 +160,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
     ),
     ),
     // HHKB & WASD
     // HHKB & WASD
     KEYMAP(
     KEYMAP(
-    ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, DEL,     NLCK,EQL, PSLS,PAST,
+    GRV, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, DEL,     NLCK,EQL, PSLS,PAST,
     CAPS,NO,  NO,  NO,  NO,  NO,  NO,  NO,  PSCR,SLCK,PAUS,UP,  NO,           P7,  P8,  P9,  PMNS,
     CAPS,NO,  NO,  NO,  NO,  NO,  NO,  NO,  PSCR,SLCK,PAUS,UP,  NO,           P7,  P8,  P9,  PMNS,
     LCTL,VOLD,VOLU,MUTE,NO,  NO,  NO,  NO,  HOME,PGUP,LEFT,RGHT,     FN0,     P4,  P5,  P6,  PPLS,
     LCTL,VOLD,VOLU,MUTE,NO,  NO,  NO,  NO,  HOME,PGUP,LEFT,RGHT,     FN0,     P4,  P5,  P6,  PPLS,
     LSFT,NO,  NO,  NO,  NO,  NO,  NO,  NO,  END, PGDN,DOWN,          FN3,     P1,  P2,  P3,  PENT,
     LSFT,NO,  NO,  NO,  NO,  NO,  NO,  NO,  END, PGDN,DOWN,          FN3,     P1,  P2,  P3,  PENT,
@@ -169,7 +168,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
     ),
     ),
     // vi mousekeys
     // vi mousekeys
     KEYMAP(
     KEYMAP(
-    ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, DEL,     NLCK,EQL, PSLS,PAST,
+    GRV, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, DEL,     NLCK,EQL, PSLS,PAST,
     CAPS,NO,  NO,  NO,  NO,  NO,  WH_L,WH_D,WH_U,WH_R,PSCR,SLCK,PAUS,         P7,  P8,  P9,  PMNS,
     CAPS,NO,  NO,  NO,  NO,  NO,  WH_L,WH_D,WH_U,WH_R,PSCR,SLCK,PAUS,         P7,  P8,  P9,  PMNS,
     LCTL,VOLD,VOLU,MUTE,NO,  NO,  MS_L,MS_D,MS_U,MS_R,FN1, NO,       ENT,     P4,  P5,  P6,  PPLS,
     LCTL,VOLD,VOLU,MUTE,NO,  NO,  MS_L,MS_D,MS_U,MS_R,FN1, NO,       ENT,     P4,  P5,  P6,  PPLS,
     LSFT,NO,  NO,  NO,  NO,  BTN3,BTN2,BTN1,NO,  NO,  NO,            NO,      P1,  P2,  P3,  PENT,
     LSFT,NO,  NO,  NO,  NO,  BTN3,BTN2,BTN1,NO,  NO,  NO,            NO,      P1,  P2,  P3,  PENT,
@@ -177,7 +176,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
     ),
     ),
     // vi cusorkeys
     // vi cusorkeys
     KEYMAP(
     KEYMAP(
-    ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, DEL,     NLCK,EQL, PSLS,PAST,
+    GRV, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, DEL,     NLCK,EQL, PSLS,PAST,
     CAPS,NO,  NO,  NO,  NO,  NO,  HOME,PGDN,PGUP,END, PSCR,SLCK,PAUS,         P7,  P8,  P9,  PMNS,
     CAPS,NO,  NO,  NO,  NO,  NO,  HOME,PGDN,PGUP,END, PSCR,SLCK,PAUS,         P7,  P8,  P9,  PMNS,
     LCTL,NO,  NO,  NO,  NO,  NO,  LEFT,DOWN,UP,  RGHT,NO,  NO,       ENT,     P4,  P5,  P6,  PPLS,
     LCTL,NO,  NO,  NO,  NO,  NO,  LEFT,DOWN,UP,  RGHT,NO,  NO,       ENT,     P4,  P5,  P6,  PPLS,
     LSFT,NO,  NO,  NO,  NO,  NO,  HOME,PGDN,PGUP,END, FN2,           NO,      P1,  P2,  P3,  PENT,
     LSFT,NO,  NO,  NO,  NO,  NO,  HOME,PGDN,PGUP,END, FN2,           NO,      P1,  P2,  P3,  PENT,