From dd9c0183781b3352b039ae301da362e243d97c00 Mon Sep 17 00:00:00 2001 From: Jacob Alexander Date: Sun, 14 Sep 2014 19:27:22 -0700 Subject: [PATCH] Adding support to Macro support to DPH - Added layout files for 50 key and kishsaver - Not yet working (some USB issues on AVR to debug) - Fixed an OSX issue when building AVR - Cleanup --- Lib/CMake/avr.cmake | 4 + Lib/CMake/build.cmake | 10 ++ Lib/CMake/kll.cmake | 2 +- Macro/PartialMap/kll.h | 7 +- Scan/DPH/50Key.kll | 71 ++++++++++ Scan/DPH/defaultMap.h | 287 ---------------------------------------- Scan/DPH/kishsaver.kll | 74 +++++++++++ Scan/MD1/defaultMap.kll | 9 -- main.c | 2 +- 9 files changed, 166 insertions(+), 300 deletions(-) create mode 100644 Scan/DPH/50Key.kll delete mode 100644 Scan/DPH/defaultMap.h create mode 100644 Scan/DPH/kishsaver.kll diff --git a/Lib/CMake/avr.cmake b/Lib/CMake/avr.cmake index a698577..c4b778e 100644 --- a/Lib/CMake/avr.cmake +++ b/Lib/CMake/avr.cmake @@ -67,6 +67,10 @@ else () endif () +#| Only Teensy based AVRs supported +set ( TEENSY 1 ) + + #| Extra Compiler Sources #| Mostly for convenience functions like interrupt handlers set( COMPILER_SRCS diff --git a/Lib/CMake/build.cmake b/Lib/CMake/build.cmake index a58bc1f..54f2fd2 100644 --- a/Lib/CMake/build.cmake +++ b/Lib/CMake/build.cmake @@ -7,6 +7,16 @@ ### +### +# Disable -Wl,-search_paths_first for AVR on OSX (not supported by avr-gcc) +# + +if ( "${CPU}" STREQUAL "megaAVR" AND APPLE ) + string ( REPLACE "-Wl,-search_paths_first" "" CMAKE_C_LINK_FLAGS ${CMAKE_C_LINK_FLAGS} ) + string ( REPLACE "-Wl,-search_paths_first" "" CMAKE_CXX_LINK_FLAGS ${CMAKE_CXX_LINK_FLAGS} ) +endif () + + ### # Build Targets diff --git a/Lib/CMake/kll.cmake b/Lib/CMake/kll.cmake index ca88392..8693f06 100644 --- a/Lib/CMake/kll.cmake +++ b/Lib/CMake/kll.cmake @@ -54,7 +54,7 @@ endforeach () #| If set BaseMap cannot be found, use default map set ( pathname "${PROJECT_SOURCE_DIR}/${ScanModulePath}" ) -if ( NOT EXISTS "${filename}/${BaseMap}.kll" ) +if ( NOT EXISTS ${pathname}/${BaseMap}.kll ) set ( BaseMap_Args ${BaseMap_Args} ${pathname}/defaultMap.kll ) set ( KLL_DEPENDS ${KLL_DEPENDS} ${pathname}/defaultMap.kll ) else () diff --git a/Macro/PartialMap/kll.h b/Macro/PartialMap/kll.h index b3c8c61..d4cb95d 100644 --- a/Macro/PartialMap/kll.h +++ b/Macro/PartialMap/kll.h @@ -46,8 +46,11 @@ typedef uint8_t var_uint_t; // This needs to be defined per microcontroller // e.g. mk20s -> 32 bit // atmega -> 16 bit +#if defined(_mk20dx128_) || defined(_mk20dx128vlf5_) || defined(_mk20dx256_) // ARM typedef uint32_t nat_ptr_t; -//typedef uint16_t nat_ptr_t; +#elif defined(_at90usb162_) || defined(_atmega32u4_) || defined(_at90usb646_) || defined(_at90usb1286_) // AVR +typedef uint16_t nat_ptr_t; +#endif @@ -223,7 +226,7 @@ typedef struct Layer { // Layer_IN( map, name ); // * map - Trigger map // * name - Name of the trigger map -#define Layer_IN( map, name ) { map, name, sizeof( map ) / 4 - 1, 0 } +#define Layer_IN( map, name ) { map, name, sizeof( map ) / sizeof( nat_ptr_t ) - 1, 0 } // Total number of layers #define LayerNum sizeof( LayerIndex ) / sizeof( Layer ) diff --git a/Scan/DPH/50Key.kll b/Scan/DPH/50Key.kll new file mode 100644 index 0000000..e5062b6 --- /dev/null +++ b/Scan/DPH/50Key.kll @@ -0,0 +1,71 @@ +Name = 50Key; +Version = 0.1; +Author = "HaaTa (Jacob Alexander) 2014"; +KLL = 0.3; + +# Modified Date +Date = 2014-09-14; + + +# NOTE: Using IBM Model M 50 key as the base layout +# http://deskthority.net/wiki/File:IBM_Model_M_50-keys_06.jpg +# Using Red labels when there's an option +# When no key matches to USB HID, adding useful keys + +S0x40 : U"Alt"; # Lgoff +S0x41 : U"Pause"; +S0x42 : U"P"; +S0x43 : U"O"; +S0x44 : U"L"; +S0x45 : U","; +S0x46 : U"Slash"; +S0x47 : U"Enter"; + +S0x49 : U"PageUp"; +S0x4A : U"I"; +S0x4B : U"K"; +S0x4C : U"J"; +S0x4D : U"M"; +S0x4E : U"."; +S0x4F : U"Keypad Asterix"; # Asterix + +S0x51 : U"PageDown"; + +S0x53 : U"U"; +S0x54 : U"H"; + +S0x56 : U"N"; +S0x57 : U"Tab"; +S0x58 : U"Home"; # Calc +S0x59 : U"PrintScreen"; # Pay / PrtSc +S0x5A : U"Y"; +S0x5B : U"T"; +S0x5C : U"G"; +S0x5D : U"V"; +S0x5E : U"B"; +S0x5F : U"Space"; + +S0x61 : U"Equals"; # Next / List +S0x62 : U"R"; +S0x63 : U"F"; +S0x64 : U"D"; +S0x65 : U"C"; # C / Up +S0x66 : U"End"; # Reset / Right +S0x67 : U"Insert"; # Insert / Down +S0x68 : U"RAlt"; # Csh X / Rev +S0x69 : U"Gui"; # Rcpt +S0x6A : U"E"; +S0x6B : U"W"; +S0x6C : U"S"; +S0x6D : U"Z"; +S0x6E : U"X"; +S0x6F : U"Delete"; # Delete / Left + +S0x71 : U"Help"; +S0x72 : U"Q"; +S0x73 : U"A"; +S0x74 : U"Esc"; +S0x75 : U"CapsLock"; +S0x76 : U"Backspace"; +S0x77 : U"Shift"; + diff --git a/Scan/DPH/defaultMap.h b/Scan/DPH/defaultMap.h deleted file mode 100644 index de4e083..0000000 --- a/Scan/DPH/defaultMap.h +++ /dev/null @@ -1,287 +0,0 @@ -/* Copyright (C) 2011-2013 by Joseph Makuch - * Additions by Jacob Alexander (2013-2014) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3.0 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -#ifndef __KEYMAP_H -#define __KEYMAP_H - -// This file contains the a basic US ANSI-like layout for the Kishsaver using the AVR DPH Capsense Controller - - -// ----- Variables ----- - -// Default 1-indexed key mappings -static uint8_t DefaultMap_Lookup[] = { - 0, // 0x00 - 0, // 0x01 - 0, // 0x02 - 0, // 0x03 - 0, // 0x04 - 0, // 0x05 - 0, // 0x06 - 0, // 0x07 - 0, // 0x08 - 0, // 0x09 - 0, // 0x0A - 0, // 0x0B - 0, // 0x0C - 0, // 0x0D - 0, // 0x0E - 0, // 0x0F - 0, // 0x10 - 0, // 0x11 - 0, // 0x12 - 0, // 0x13 - 0, // 0x14 - 0, // 0x15 - 0, // 0x16 - 0, // 0x17 - 0, // 0x18 - 0, // 0x19 - 0, // 0x1A - 0, // 0x1B - 0, // 0x1C - 0, // 0x1D - 0, // 0x1E - 0, // 0x1F - 0, // 0x20 - 0, // 0x21 - 0, // 0x22 - 0, // 0x23 - 0, // 0x24 - 0, // 0x25 - 0, // 0x26 - 0, // 0x27 - 0, // 0x28 - 0, // 0x29 - 0, // 0x2A - 0, // 0x2B - 0, // 0x2C - 0, // 0x2D - 0, // 0x2E - 0, // 0x2F - 0, // 0x30 - 0, // 0x31 - 0, // 0x32 - 0, // 0x33 - 0, // 0x34 - 0, // 0x35 - 0, // 0x36 - 0, // 0x37 - 0, // 0x38 - 0, // 0x39 - 0, // 0x3A - 0, // 0x3B - 0, // 0x3C - 0, // 0x3D - 0, // 0x3E - 0, // 0x3F - KEY_BACKSPACE, // 0x40 - 0, // 0x41 - KEY_RIGHT_BRACE, // 0x42 - KEY_DELETE, // 0x43 - KEY_ENTER, // 0x44 - 0, // 0x45 - KEY_RSHIFT, // 0x46 - KEY_RCTRL, // 0x47 - KEY_EQUAL, // 0x48 - KEY_MINUS, // 0x49 - KEY_LEFT_BRACE, // 0x4A - KEY_BACKSLASH, // 0x4B - KEY_QUOTE, // 0x4C - KEY_SLASH, // 0x4D - KEY_RGUI, // 0x4E - KEY_RALT, // 0x4F - KEY_0, // 0x50 - KEY_9, // 0x51 - KEY_P, // 0x52 - KEY_O, // 0x53 - KEY_SEMICOLON, // 0x54 - KEY_L, // 0x55 - KEY_PERIOD, // 0x56 - KEY_COMMA, // 0x57 - KEY_8, // 0x58 - KEY_7, // 0x59 - KEY_I, // 0x5A - KEY_U, // 0x5B - KEY_J, // 0x5C - KEY_K, // 0x5D - KEY_N, // 0x5E - KEY_M, // 0x5F - KEY_6, // 0x60 - KEY_5, // 0x61 - KEY_Y, // 0x62 - KEY_T, // 0x63 - KEY_H, // 0x64 - KEY_G, // 0x65 - KEY_B, // 0x66 - KEY_SPACE, // 0x67 - KEY_4, // 0x68 - KEY_3, // 0x69 - KEY_R, // 0x6A - KEY_E, // 0x6B - KEY_F, // 0x6C - KEY_D, // 0x6D - KEY_C, // 0x6E - KEY_V, // 0x6F - KEY_2, // 0x70 - KEY_Q, // 0x71 - KEY_W, // 0x72 - KEY_A, // 0x73 - KEY_S, // 0x74 - KEY_X, // 0x75 - KEY_Z, // 0x76 - KEY_LALT, // 0x77 - KEY_1, // 0x78 - KEY_TILDE, // 0x79 - KEY_TAB, // 0x7A - KEY_CAPS_LOCK, // 0x7B - KEY_LSHIFT, // 0x7C - KEY_INTER1, // 0x7D - KEY_LGUI, // 0x7E - KEY_LCTRL, // 0x7F - 0, // 0x80 - 0, // 0x81 - 0, // 0x82 - 0, // 0x83 - 0, // 0x84 - 0, // 0x85 - 0, // 0x86 - 0, // 0x87 - 0, // 0x88 - 0, // 0x89 - 0, // 0x8A - 0, // 0x8B - 0, // 0x8C - 0, // 0x8D - 0, // 0x8E - 0, // 0x8F - 0, // 0x90 - 0, // 0x91 - 0, // 0x92 - 0, // 0x93 - 0, // 0x94 - 0, // 0x95 - 0, // 0x96 - 0, // 0x97 - 0, // 0x98 - 0, // 0x99 - 0, // 0x9A - 0, // 0x9B - 0, // 0x9C - 0, // 0x9D - 0, // 0x9E - 0, // 0x9F - 0, // 0xA0 - 0, // 0xA1 - 0, // 0xA2 - 0, // 0xA3 - 0, // 0xA4 - 0, // 0xA5 - 0, // 0xA6 - 0, // 0xA7 - 0, // 0xA8 - 0, // 0xA9 - 0, // 0xAA - 0, // 0xAB - 0, // 0xAC - 0, // 0xAD - 0, // 0xAE - 0, // 0xAF - 0, // 0xB0 - 0, // 0xB1 - 0, // 0xB2 - 0, // 0xB3 - 0, // 0xB4 - 0, // 0xB5 - 0, // 0xB6 - 0, // 0xB7 - 0, // 0xB8 - 0, // 0xB9 - 0, // 0xBA - 0, // 0xBB - 0, // 0xBC - 0, // 0xBD - 0, // 0xBE - 0, // 0xBF - 0, // 0xC0 - 0, // 0xC1 - 0, // 0xC2 - 0, // 0xC3 - 0, // 0xC4 - 0, // 0xC5 - 0, // 0xC6 - 0, // 0xC7 - 0, // 0xC8 - 0, // 0xC9 - 0, // 0xCA - 0, // 0xCB - 0, // 0xCC - 0, // 0xCD - 0, // 0xCE - 0, // 0xCF - 0, // 0xD0 - 0, // 0xD1 - 0, // 0xD2 - 0, // 0xD3 - 0, // 0xD4 - 0, // 0xD5 - 0, // 0xD6 - 0, // 0xD7 - 0, // 0xD8 - 0, // 0xD9 - 0, // 0xDA - 0, // 0xDB - 0, // 0xDC - 0, // 0xDD - 0, // 0xDE - 0, // 0xDF - 0, // 0xE0 - 0, // 0xE1 - 0, // 0xE2 - 0, // 0xE3 - 0, // 0xE4 - 0, // 0xE5 - 0, // 0xE6 - 0, // 0xE7 - 0, // 0xE8 - 0, // 0xE9 - 0, // 0xEA - 0, // 0xEB - 0, // 0xEC - 0, // 0xED - 0, // 0xEE - 0, // 0xEF - 0, // 0xF0 - 0, // 0xF1 - 0, // 0xF2 - 0, // 0xF3 - 0, // 0xF4 - 0, // 0xF5 - 0, // 0xF6 - 0, // 0xF7 - 0, // 0xF8 - 0, // 0xF9 - 0, // 0xFA - 0, // 0xFB - 0, // 0xFC - 0, // 0xFD - 0, // 0xFE - 0, // 0xFF -}; - -#endif - diff --git a/Scan/DPH/kishsaver.kll b/Scan/DPH/kishsaver.kll new file mode 100644 index 0000000..61d2dc9 --- /dev/null +++ b/Scan/DPH/kishsaver.kll @@ -0,0 +1,74 @@ +Name = kishsaver; +Version = 0.1; +Author = "HaaTa (Jacob Alexander) 2014"; +KLL = 0.3; + +# Modified Date +Date = 2014-09-14; + + +S0x40 : U"Backspace"; + +S0x42 : U"RBrace"; +S0x43 : U"Delete"; +S0x44 : U"Enter"; + +S0x46 : U"RShift"; +S0x47 : U"RCtrl"; +S0x48 : U"Equals"; +S0x49 : U"Minus"; +S0x4A : U"LBrace"; +S0x4B : U"Backslash"; +S0x4C : U"Quote"; +S0x4D : U"Slash"; +S0x4E : U"RGui"; +S0x4F : U"RAlt"; +S0x50 : U"0"; +S0x51 : U"9"; +S0x52 : U"P"; +S0x53 : U"O"; +S0x54 : U";"; +S0x55 : U"L"; +S0x56 : U"."; +S0x57 : U","; +S0x58 : U"8"; +S0x59 : U"7"; +S0x5A : U"I"; +S0x5B : U"U"; +S0x5C : U"J"; +S0x5D : U"K"; +S0x5E : U"N"; +S0x5F : U"M"; +S0x60 : U"6"; +S0x61 : U"5"; +S0x62 : U"Y"; +S0x63 : U"T"; +S0x64 : U"H"; +S0x65 : U"G"; +S0x66 : U"B"; +S0x67 : U"Space"; +S0x68 : U"4"; +S0x69 : U"3"; +S0x6A : U"R"; +S0x6B : U"E"; +S0x6C : U"F"; +S0x6D : U"D"; +S0x6E : U"C"; +S0x6F : U"V"; +S0x70 : U"2"; +S0x71 : U"Q"; +S0x72 : U"W"; +S0x73 : U"A"; +S0x74 : U"S"; +S0x75 : U"X"; +S0x76 : U"Z"; +S0x77 : U"LAlt"; +S0x78 : U"1"; +S0x79 : U"Backtick"; +S0x7A : U"Tab"; +S0x7B : U"CapsLock"; +S0x7C : U"LShift"; +S0x7D : U"Inter1"; +S0x7E : U"LGui"; +S0x7F : U"LCtrl"; + diff --git a/Scan/MD1/defaultMap.kll b/Scan/MD1/defaultMap.kll index aa99329..64fe862 100644 --- a/Scan/MD1/defaultMap.kll +++ b/Scan/MD1/defaultMap.kll @@ -7,15 +7,6 @@ KLL = 0.3; Date = 2014-09-14; -# MOVE THIS SECTION to another file -usbKeyOut => Output_usbCodeSend_capability( usbCode : 1 ); -layerState => Macro_layerState_capability( layer : 2, state : 1 ); -layerLatch => Macro_layerLatch_capability( layer : 2 ); -layerLock => Macro_layerLock_capability( layer : 2 ); -layerShift => Macro_layerShift_capability( layer : 2 ); -# END SECTION - - S0x00 : U"Esc"; S0x01 : U"1"; S0x02 : U"2"; diff --git a/main.c b/main.c index d6b7ee6..3a6096f 100644 --- a/main.c +++ b/main.c @@ -76,7 +76,7 @@ inline void usbTimerSetup() TIMSK0 = (1 << TOIE0); // ARM -#elif defined(_mk20dx128_) || defined(_mk20dx128vlf5_) || defined(_mk20dx256_) // ARM +#elif defined(_mk20dx128_) || defined(_mk20dx128vlf5_) || defined(_mk20dx256_) // 48 MHz clock by default // System Clock Gating Register Disable -- 2.39.2