Browse Source

Initial code for KType TKL

capsense
Jacob Alexander 8 years ago
parent
commit
0501e1dfd0
5 changed files with 325 additions and 0 deletions
  1. 97
    0
      Scan/KType/defaultMap.kll
  2. 57
    0
      Scan/KType/matrix.h
  3. 99
    0
      Scan/KType/scan_loop.c
  4. 40
    0
      Scan/KType/scan_loop.h
  5. 32
    0
      Scan/KType/setup.cmake

+ 97
- 0
Scan/KType/defaultMap.kll View File

@@ -0,0 +1,97 @@
Name = KType;
Version = 0.1;
Author = "HaaTa (Jacob Alexander) 2015";
KLL = 0.3c;

# Modified Date
Date = 2015-09-29;


S0x00 : U"Esc";
S0x01 : U"F1";
S0x02 : U"F2";
S0x03 : U"F3";
S0x04 : U"F4";
S0x05 : U"F5";
S0x06 : U"F6";
S0x07 : U"F7";
S0x08 : U"F8";
S0x09 : U"F9";
S0x0A : U"F10";
S0x0B : U"F11";
S0x0C : U"F12";
S0x0D : U"Print Screen";
S0x0E : U"ScrollLock";
S0x0F : U"Pause";
S0x10 : U"Backtick";
S0x11 : U"1";
S0x12 : U"2";
S0x13 : U"3";
S0x14 : U"4";
S0x15 : U"5";
S0x16 : U"6";
S0x17 : U"7";
S0x18 : U"8";
S0x19 : U"9";
S0x1A : U"0";
S0x1B : U"Minus";
S0x1C : U"Equals";
S0x1D : U"Backspace";
S0x1E : U"Insert";
S0x1F : U"Home";
S0x20 : U"PageUp";
S0x21 : U"Tab";
S0x22 : U"Q";
S0x23 : U"W";
S0x24 : U"E";
S0x25 : U"R";
S0x26 : U"T";
S0x27 : U"Y";
S0x28 : U"U";
S0x29 : U"I";
S0x2A : U"O";
S0x2B : U"P";
S0x2C : U"Left Brace";
S0x2D : U"Right Brace";
S0x2E : U"Backslash";
S0x2F : U"Delete";
S0x30 : U"End";
S0x31 : U"PageDown";
S0x32 : U"CapsLock";
S0x33 : U"A";
S0x34 : U"S";
S0x35 : U"D";
S0x36 : U"F";
S0x37 : U"G";
S0x38 : U"H";
S0x39 : U"J";
S0x3A : U"K";
S0x3B : U"L";
S0x3C : U"Semicolon";
S0x3D : U"Quote";
S0x3E : U"Enter";
S0x3F : U"LShift";
S0x40 : U"Z";
S0x41 : U"X";
S0x42 : U"C";
S0x43 : U"V";
S0x44 : U"B";
S0x45 : U"N";
S0x46 : U"M";
S0x47 : U"Comma";
S0x48 : U"Period";
S0x49 : U"Slash";
S0x4A : U"RShift";
S0x4B : U"Up";
S0x4C : U"LCtrl";
S0x4D : U"LGui";
S0x4E : U"LAlt";
S0x4F : U"Space";
S0x50 : U"RAlt";
S0x51 : U"RGui";
S0x52 : U"Menu";
S0x53 : U"RCtrl";
S0x54 : U"Left";
S0x55 : U"Down";
S0x56 : U"Right";


+ 57
- 0
Scan/KType/matrix.h View File

@@ -0,0 +1,57 @@
/* 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_setup.h>



// ----- 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)
// TODO
GPIO_Pin Matrix_cols[] = { gpio(B,2), gpio(B,3), gpio(B,18), gpio(B,19), gpio(C,0), gpio(C,8), gpio(C,9), gpio(C,10), gpio(C,11) };
GPIO_Pin Matrix_rows[] = { gpio(D,0), gpio(D,1), gpio(D,4), gpio(D,5), gpio(D,6), gpio(D,7), gpio(C,1), gpio(C,2) };

// Define type of scan matrix
Config Matrix_type = Config_Pulldown;


+ 99
- 0
Scan/KType/scan_loop.c View File

@@ -0,0 +1,99 @@
/* 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 <Lib/ScanLib.h>

// Project Includes
#include <cli.h>
#include <connect_scan.h>
#include <led.h>
#include <led_scan.h>
#include <print.h>
#include <matrix_scan.h>
#include <macro.h>
#include <output_com.h>

// Local Includes
#include "scan_loop.h"



// ----- Function Declarations -----

// ----- 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();

// 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();

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;
}


+ 40
- 0
Scan/KType/scan_loop.h View File

@@ -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 <stdint.h>



// ----- 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


+ 32
- 0
Scan/KType/setup.cmake View File

@@ -0,0 +1,32 @@
###| CMake Kiibohd Controller Scan Module |###
#
# Written by Jacob Alexander in 2015 for the Kiibohd Controller
#
# Released into the Public Domain
#
###


###
# Required Sub-modules
#
AddModule ( Scan ISSILed )
AddModule ( Scan MatrixARM )
AddModule ( Scan UARTConnect )


###
# Module C files
#
set ( Module_SRCS
scan_loop.c
)


###
# Compiler Family Compatibility
#
set ( ModuleCompatibility
arm
)