Initial structure of ARM cap sense controller
This commit is contained in:
parent
bfaed8f58c
commit
39dbb85c1a
10 changed files with 494 additions and 0 deletions
11
Scan/CapSense/capabilities.kll
Normal file
11
Scan/CapSense/capabilities.kll
Normal file
|
@ -0,0 +1,11 @@
|
|||
Name = CapSenseCapabilities;
|
||||
Version = 0.1;
|
||||
Author = "HaaTa (Jacob Alexander) 2016";
|
||||
KLL = 0.3d;
|
||||
|
||||
# Modified Date
|
||||
Date = 2016-04-11;
|
||||
|
||||
# Defines available to the CapSense sub-module
|
||||
# TODO Add cap sense configuration here
|
||||
|
126
Scan/CapSense/matrix_scan.c
Normal file
126
Scan/CapSense/matrix_scan.c
Normal file
|
@ -0,0 +1,126 @@
|
|||
/* Copyright (C) 2016 by Jacob Alexander
|
||||
*
|
||||
* This file 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This file 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 file. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// ----- Includes -----
|
||||
|
||||
// Compiler Includes
|
||||
#include <Lib/ScanLib.h>
|
||||
|
||||
// Project Includes
|
||||
#include <cli.h>
|
||||
#include <kll_defs.h>
|
||||
#include <led.h>
|
||||
#include <print.h>
|
||||
#include <macro.h>
|
||||
#include <Lib/delay.h>
|
||||
|
||||
// Local Includes
|
||||
#include "matrix_scan.h"
|
||||
|
||||
// Matrix Configuration
|
||||
//#include <matrix.h>
|
||||
|
||||
|
||||
|
||||
// ----- Defines -----
|
||||
|
||||
// ----- Function Declarations -----
|
||||
|
||||
// CLI Functions
|
||||
void cliFunc_matrixDebug( char* args );
|
||||
void cliFunc_matrixInfo( char* args );
|
||||
void cliFunc_matrixState( char* args );
|
||||
|
||||
|
||||
|
||||
// ----- Variables -----
|
||||
|
||||
// Scan Module command dictionary
|
||||
CLIDict_Entry( matrixDebug, "Enables matrix debug mode, prints out each scan code." NL "\t\tIf argument \033[35mT\033[0m is given, prints out each scan code state transition." );
|
||||
CLIDict_Entry( matrixInfo, "Print info about the configured matrix." );
|
||||
CLIDict_Entry( matrixState, "Prints out the current scan table N times." NL "\t\t \033[1mO\033[0m - Off, \033[1;33mP\033[0m - Press, \033[1;32mH\033[0m - Hold, \033[1;35mR\033[0m - Release, \033[1;31mI\033[0m - Invalid" );
|
||||
|
||||
CLIDict_Def( matrixCLIDict, "Matrix Module Commands" ) = {
|
||||
CLIDict_Item( matrixDebug ),
|
||||
CLIDict_Item( matrixInfo ),
|
||||
CLIDict_Item( matrixState ),
|
||||
{ 0, 0, 0 } // Null entry for dictionary end
|
||||
};
|
||||
|
||||
|
||||
|
||||
// ----- Functions -----
|
||||
|
||||
void Matrix_setup()
|
||||
{
|
||||
// Register Matrix CLI dictionary
|
||||
CLI_registerDictionary( matrixCLIDict, matrixCLIDictName );
|
||||
}
|
||||
|
||||
// Scan the matrix for keypresses
|
||||
// NOTE: scanNum should be reset to 0 after a USB send (to reset all the counters)
|
||||
void Matrix_scan( uint16_t scanNum )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// Called by parent scan module whenever the available current changes
|
||||
// current - mA
|
||||
void Matrix_currentChange( unsigned int current )
|
||||
{
|
||||
// TODO - Any potential power savings?
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ----- CLI Command Functions -----
|
||||
|
||||
void cliFunc_matrixInfo( char* args )
|
||||
{
|
||||
}
|
||||
|
||||
void cliFunc_matrixDebug( char* args )
|
||||
{
|
||||
// Parse number from argument
|
||||
// NOTE: Only first argument is used
|
||||
char* arg1Ptr;
|
||||
char* arg2Ptr;
|
||||
CLI_argumentIsolation( args, &arg1Ptr, &arg2Ptr );
|
||||
|
||||
// Set the matrix debug flag depending on the argument
|
||||
// If no argument, set to scan code only
|
||||
// If set to T, set to state transition
|
||||
switch ( arg1Ptr[0] )
|
||||
{
|
||||
// T as argument
|
||||
case 'T':
|
||||
case 't':
|
||||
break;
|
||||
|
||||
// No argument
|
||||
case '\0':
|
||||
break;
|
||||
|
||||
// Invalid argument
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void cliFunc_matrixState( char* args )
|
||||
{
|
||||
}
|
||||
|
38
Scan/CapSense/matrix_scan.h
Normal file
38
Scan/CapSense/matrix_scan.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
/* Copyright (C) 2016 by Jacob Alexander
|
||||
*
|
||||
* This file 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This file 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 file. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
// ----- Includes -----
|
||||
|
||||
// KLL Generated Defines
|
||||
#include <kll_defs.h>
|
||||
|
||||
|
||||
|
||||
// ----- Defines -----
|
||||
|
||||
// ----- Enums -----
|
||||
|
||||
// ----- Structs -----
|
||||
|
||||
// ----- Functions -----
|
||||
|
||||
void Matrix_setup();
|
||||
void Matrix_scan( uint16_t scanNum );
|
||||
|
||||
void Matrix_currentChange( unsigned int current );
|
||||
|
20
Scan/CapSense/matrix_setup.h
Normal file
20
Scan/CapSense/matrix_setup.h
Normal file
|
@ -0,0 +1,20 @@
|
|||
/* Copyright (C) 2016 by Jacob Alexander
|
||||
*
|
||||
* This file 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This file 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 file. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
// TODO
|
||||
|
30
Scan/CapSense/setup.cmake
Normal file
30
Scan/CapSense/setup.cmake
Normal file
|
@ -0,0 +1,30 @@
|
|||
###| CMake Kiibohd Controller Scan Module |###
|
||||
#
|
||||
# Written by Jacob Alexander in 2016 for the Kiibohd Controller
|
||||
#
|
||||
# Released into the Public Domain
|
||||
#
|
||||
###
|
||||
|
||||
|
||||
###
|
||||
# Sub-module flag, cannot be included stand-alone
|
||||
#
|
||||
set ( SubModule 1 )
|
||||
|
||||
|
||||
###
|
||||
# Module C files
|
||||
#
|
||||
set ( Module_SRCS
|
||||
matrix_scan.c
|
||||
)
|
||||
|
||||
|
||||
###
|
||||
# Compiler Family Compatibility
|
||||
#
|
||||
set ( ModuleCompatibility
|
||||
arm
|
||||
)
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue