# HG changeset patch # User Jacob Alexander # Date 1437861979 25200 # Node ID df78f3312db02eaf48f403d90e5855d0b635e08b # Parent 06225a619152627982d506c0fb315942b98d10b6 Initial commit of MDErgo1 diff -r 06225a619152 -r df78f3312db0 Scan/MDErgo1/defaultMap.kll --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Scan/MDErgo1/defaultMap.kll Sat Jul 25 15:06:19 2015 -0700 @@ -0,0 +1,73 @@ +Name = MDErgo1; +Version = 0.1; +Author = "HaaTa (Jacob Alexander) 2014"; +KLL = 0.3a; + +# Modified Date +Date = 2015-03-10; + + +S0x00 : U"Esc"; +S0x01 : U"1"; +S0x02 : U"2"; +S0x03 : U"3"; +S0x04 : U"4"; +S0x05 : U"5"; +S0x06 : U"6"; +S0x07 : U"7"; +S0x08 : U"8"; +S0x09 : U"9"; +S0x0A : U"0"; +S0x0B : U"Minus"; +S0x0C : U"Equal"; +S0x0D : U"Backslash"; +S0x0E : U"Tab"; +S0x0F : U"Q"; +S0x10 : U"W"; +S0x11 : U"E"; +S0x12 : U"R"; +S0x13 : U"T"; +S0x14 : U"Y"; +S0x15 : U"U"; +S0x16 : U"I"; +S0x17 : U"O"; +S0x18 : U"P"; +S0x19 : U"LBrace"; +S0x1A : U"RBrace"; +S0x1B : U"Backspace"; +S0x1C : U"Ctrl"; +S0x1D : U"A"; +S0x1E : U"S"; +S0x1F : U"D"; +S0x20 : U"F"; +S0x21 : U"G"; +S0x22 : U"H"; +S0x23 : U"J"; +S0x24 : U"K"; +S0x25 : U"L"; +S0x26 : U"Semicolon"; +S0x27 : U"Quote"; +S0x28 : U"Enter"; +S0x29 : U"LShift"; +S0x2A : U"Z"; +S0x2B : U"X"; +S0x2C : U"C"; +S0x2D : U"V"; +S0x2E : U"B"; +S0x2F : U"N"; +S0x30 : U"M"; +S0x31 : U"Comma"; +S0x32 : U"Period"; +S0x33 : U"Slash"; +S0x34 : U"RShift"; +S0x35 : U"F1"; # Fun key +S0x36 : U"F2"; # Left Blank Key +S0x37 : U"LAlt"; +S0x38 : U"LGui"; +S0x39 : U"Space"; +S0x3A : U"RGui"; +S0x3B : U"RAlt"; +S0x3C : U"F3"; # Right Blank Key 1 +S0x3D : U"F4"; # Right Blank Key 2 +S0x3E : U"BackTick"; + diff -r 06225a619152 -r df78f3312db0 Scan/MDErgo1/led_conf.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Scan/MDErgo1/led_conf.h Sat Jul 25 15:06:19 2015 -0700 @@ -0,0 +1,74 @@ +/* Copyright (C) 2015 by Jacob Alexander + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#pragma once + + +// ----- Variables ----- + +// A bit mask determining which LEDs are enabled in the ISSI chip +// Infinity ErgoDox full mask +// 0x00 -> 0x11 +/* +const uint8_t LED_ledEnableMask[] = { +0xE8, // I2C address +0x00, // Starting register address +0x37, 0x37, // C1-1 -> C1-16 +0xBF, 0xBF, // C2-1 -> C2-16 +0xFF, 0xFF, // C3-1 -> C3-16 +0xEF, 0xEF, // C4-1 -> C4-16 +0xF7, 0xF7, // C5-1 -> C5-16 +0xFF, 0xFF, // C6-1 -> C6-16 +0xF3, 0xF3, // C7-1 -> C7-16 +0x6C, 0x6C, // C8-1 -> C8-16 +0x24, 0x24, // C9-1 -> C9-16 +}; +*/ +/* +const uint8_t LED_ledEnableMask[] = { +0xE8, // I2C address +0x00, // Starting register address +0x00, 0x00, // C1-1 -> C1-16 +//0xEC, 0xEC, // C1-1 -> C1-16 +//0xFD, 0xFD, // C2-1 -> C2-16 +0x00, 0x00, // C3-1 -> C3-16 +0x00, 0x00, // C4-1 -> C4-16 +0x00, 0x00, // C5-1 -> C5-16 +0x00, 0x00, // C6-1 -> C6-16 +0x00, 0x00, // C7-1 -> C7-16 +0x00, 0x00, // C8-1 -> C8-16 +0x00, 0x00, // C9-1 -> C9-16 +}; +*/ +const uint8_t LED_ledEnableMask[] = { +0xE8, // I2C address +0x00, // Starting register address +0xFF, 0xFF, // C1-1 -> C1-16 +0xFF, 0xFF, // C2-1 -> C2-16 +0xFF, 0xFF, // C3-1 -> C3-16 +0xFF, 0xFF, // C4-1 -> C4-16 +0xFF, 0xFF, // C5-1 -> C5-16 +0xFF, 0xFF, // C6-1 -> C6-16 +0xFF, 0xFF, // C7-1 -> C7-16 +0xFF, 0xFF, // C8-1 -> C8-16 +0xFF, 0xFF, // C9-1 -> C9-16 +}; + diff -r 06225a619152 -r df78f3312db0 Scan/MDErgo1/matrix.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Scan/MDErgo1/matrix.h Sat Jul 25 15:06:19 2015 -0700 @@ -0,0 +1,56 @@ +/* Copyright (C) 2014-2015 by Jacob Alexander + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#pragma once + +// ----- Includes ----- + +// Project Includes +#include + + + +// ----- Matrix Definition ----- + +// Freescale ARM MK20's support GPIO PTA, PTB, PTC, PTD and PTE 0..31 +// Not all chips have access to all of these pins (most don't have 160 pins :P) +// +// NOTE: +// Before using a pin, make sure it supports being a GPIO *and* doesn't have a default pull-up/pull-down +// Checking this is completely on the ownness of the user + +// MDErgo1 +// +// Column (Strobe) - 9 Total +// PTB2,3,18,19 +// PTC0,9..11 +// PTD0 +// +// Rows (Sense) - 5 Total +// PTD1,4..7 + +// Define Rows (Sense) and Columns (Strobes) +GPIO_Pin Matrix_cols[] = { gpio(B,2), gpio(B,3), gpio(B,18), gpio(B,19), gpio(C,0), gpio(C,9), gpio(C,10), gpio(C,11), gpio(D,0) }; +GPIO_Pin Matrix_rows[] = { gpio(D,1), gpio(D,4), gpio(D,5), gpio(D,6), gpio(D,7) }; + +// Define type of scan matrix +Config Matrix_type = Config_Pulldown; + diff -r 06225a619152 -r df78f3312db0 Scan/MDErgo1/pinout --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Scan/MDErgo1/pinout Sat Jul 25 15:06:19 2015 -0700 @@ -0,0 +1,144 @@ +Pin Usage +========= + +mk20dx256vlh7 + + ---- +|Keys| + ---- + +* Strobe (Columns) + +TODO + +* Sense (Rows) + +TODO + + + ----- +|Clock| + ----- + +PTA18 <-> PTA19 + + + --- +|I2C| + --- + +* Main - Connect to all ISSI Chips - Also break out header for debugging + +PTB0 - SCL0 (add header pin, label as SCL0) +PTB1 - SDA0 (add header pin, label as SDA0) + +* Reserved for I2C usage + +PTC10 - SCL1 (Reserved, can use as GPIO) +PTC11 - SDA1 (Reserved, can use as GPIO) + +* ISSI Control (enough pins for 3 chips reserved) + +PTB17 - INTB Chip 1 +PTB18 - INTB Chip 2 (Reserved, can use as GPIO) +PTB19 - INTB Chip 3 (Reserved, can use as GPIO) + +PTB16 - SDB (tied to all Chips, hardware shutdown) + + + --- +|PWM| + --- + +NHD-C12832A1Z-FS(RGB)-FBW-3V + +PTC1 - K(R) +PTC2 - K(G) +PTC3 - K(B) + + + --- +|SPI| + --- + +NHD-C12832A1Z-FS(RGB)-FBW-3V + +PTC4 - CS1B - SS1 +PTC5 - SCL - SCLK +PTC6 - SDA(SI) - MOSI +PTC7 - A0 (Not SPI, used for display) +PTC8 - RST (Not SPI, used for display) + + + --- +|DAC| + --- + +DAC0 (N/C) + + + ---- +|UART| + ---- + +* Comm - For bi-directional communication between halves + +PTA1 - RX0 (Master Side) +PTA2 - TX0 (Master Side) + +PTE0 - TX1 (Slave Side) +PTE1 - RX1 (Slave Side) + +PTD2 - RX2 (UART Debug Header) +PTD3 - TX2 (UART Debug Header) + + + ----- +|Debug| + ----- + +* SWD - (Main reflash header) + +PTA0 (Pull-down) +PTA3 (Pull-up) + +* LEDs + +PTA5 (LED only for PCB, not Teensy) + +* UARTs + +PTD2 - RX2 (UART Debug Header, label as RX2) +PTD3 - TX2 (UART Debug Header, label as TX2) + + + ------ +|Unused| + ------ + +* GPIO + +PTA4 +PTA12 +PTA13 +PTB2 +PTB3 +PTB16 +PTB17 +PTB18 +PTB19 +PTC0 +PTC9 +PTC10 +PTC11 +PTD0 +PTD1 +PTD4 +PTD5 +PTD6 +PTD7 + +* Analog + +TODO + diff -r 06225a619152 -r df78f3312db0 Scan/MDErgo1/scan_loop.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Scan/MDErgo1/scan_loop.c Sat Jul 25 15:06:19 2015 -0700 @@ -0,0 +1,104 @@ +/* Copyright (C) 2014-2015 by Jacob Alexander + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +// ----- Includes ----- + +// Compiler Includes +#include + +// Project Includes +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Local Includes +#include "scan_loop.h" + + + +// ----- Variables ----- + +// Number of scans since the last USB send +uint16_t Scan_scanCount = 0; + + + +// ----- Functions ----- + +// Setup +inline void Scan_setup() +{ + // Setup UART Connect, if Output_Available, this is the master node + Connect_setup( Output_Available ); + + // Setup GPIO pins for matrix scanning + //Matrix_setup(); + + // Setup ISSI chip to control the leds + LED_setup(); + + // Setup the ST/NHD lcd display + LCD_setup(); + + // Reset scan count + Scan_scanCount = 0; +} + + +// Main Detection Loop +inline uint8_t Scan_loop() +{ + // Scan Matrix + //Matrix_scan( Scan_scanCount++ ); + + // Process any interconnect commands + Connect_scan(); + + // Process any LED events + LED_scan(); + + // Process any LCD events + LCD_scan(); + + return 0; +} + + +// Signal from Macro Module that all keys have been processed (that it knows about) +inline void Scan_finishedWithMacro( uint8_t sentKeys ) +{ +} + + +// Signal from Output Module that all keys have been processed (that it knows about) +inline void Scan_finishedWithOutput( uint8_t sentKeys ) +{ + // Reset scan loop indicator (resets each key debounce state) + // TODO should this occur after USB send or Macro processing? + Scan_scanCount = 0; +} + diff -r 06225a619152 -r df78f3312db0 Scan/MDErgo1/scan_loop.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Scan/MDErgo1/scan_loop.h Sat Jul 25 15:06:19 2015 -0700 @@ -0,0 +1,40 @@ +/* Copyright (C) 2014-2015 by Jacob Alexander + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#pragma once + +// ----- Includes ----- + +// Compiler Includes +#include + + + +// ----- Functions ----- + +// Functions to be called by main.c +void Scan_setup( void ); +uint8_t Scan_loop( void ); + +// Call-backs +void Scan_finishedWithMacro( uint8_t sentKeys ); // Called by Macro Module +void Scan_finishedWithOutput( uint8_t sentKeys ); // Called by Output Module + diff -r 06225a619152 -r df78f3312db0 Scan/MDErgo1/setup.cmake --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Scan/MDErgo1/setup.cmake Sat Jul 25 15:06:19 2015 -0700 @@ -0,0 +1,33 @@ +###| CMake Kiibohd Controller Scan Module |### +# +# Written by Jacob Alexander in 2014-2015 for the Kiibohd Controller +# +# Released into the Public Domain +# +### + + +### +# Required Sub-modules +# +AddModule ( Scan ISSILed ) +AddModule ( Scan MatrixARM ) +AddModule ( Scan STLcd ) +AddModule ( Scan UARTConnect ) + + +### +# Module C files +# +set ( Module_SRCS + scan_loop.c +) + + +### +# Compiler Family Compatibility +# +set ( ModuleCompatibility + arm +) +