Compare commits

..

3 commits

Author SHA1 Message Date
1585940b80 Add Layouts directory to the search path for BaseMap and PartialMap
Oh. And reformat part of the file because tabs are of the devil.
2016-04-30 13:22:39 -07:00
ccfe28a1d7 Use MDErgo1 for the Scan Module 2016-04-30 11:01:56 -07:00
0ffd873978 Change the target chip 2016-04-30 10:32:19 -07:00
38 changed files with 752 additions and 5550 deletions

View file

@ -1,5 +1,5 @@
/* Copyright (c) 2011,2012 Simon Schubert <2@0x2c.org>.
* Modifications by Jacob Alexander 2014-2016 <haata@kiibohd.com>
* Modifications by Jacob Alexander 2014-2015 <haata@kiibohd.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -17,17 +17,12 @@
// ----- Includes -----
// Project Includes
#include <delay.h>
// Local Includes
#include "mchck.h"
#include "dfu.desc.h"
#include "debug.h"
#include "usb-internal.h"
// ----- Variables -----
@ -178,9 +173,6 @@ static struct dfu_ctx dfu_ctx;
void init_usb_bootloader( int config )
{
dfu_init( setup_read, setup_write, finish_write, &dfu_ctx );
// Make sure SysTick counter is disabled
SYST_CSR = 0;
}
void main()
@ -232,47 +224,9 @@ void main()
flash_prepare_flashing();
usb_init( &dfu_device );
#if defined(_mk20dx256vlh7_) // Kiibohd-dfu
// PTA13 - USB Swap
// Start, disabled
GPIOA_PDDR |= (1<<13);
PORTA_PCR13 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1);
GPIOA_PCOR |= (1<<13);
#define USBPortSwapDelay_ms 1000
#define USBPortSwapIncrement_ms 100
// For keyboards with dual usb ports, doesn't do anything on keyboards without them
// If a USB connection is not detected in 1 second, switch to the other port to see if it's plugged in there
// Incremement the delay by 100 ms each attempt, just in case the device is slow
uint32_t attempt = 0;
uint32_t last_ms = systick_millis_count;
for (;;)
{
usb_poll();
// Only check for swapping after delay
uint32_t wait_ms = systick_millis_count - last_ms;
if ( wait_ms < USBPortSwapDelay_ms + attempt * USBPortSwapIncrement_ms )
{
continue;
}
last_ms = systick_millis_count;
// USB not initialized, attempt to swap
if ( usb.state != USBD_STATE_ADDRESS )
{
print("USB not initializing, port swapping (if supported)");
GPIOA_PTOR |= (1<<13);
attempt++;
}
}
#else
for (;;)
{
usb_poll();
}
#endif
}

View file

@ -22,9 +22,9 @@ set( CHIP
# "at90usb646" # Teensy++ 1.0 (avr)
# "at90usb1286" # Teensy++ 2.0 (avr)
# "mk20dx128" # Teensy 3.0 (arm)
"mk20dx128vlf5" # McHCK mk20dx128vlf5
# "mk20dx128vlf5" # McHCK mk20dx128vlf5
# "mk20dx256" # Teensy 3.1,3.2 (arm)
# "mk20dx256vlh7" # Kiibohd-dfu mk20dx256vlh7
"mk20dx256vlh7" # Kiibohd-dfu mk20dx256vlh7
CACHE STRING "Microcontroller Chip"
)
@ -65,7 +65,7 @@ include( initialize )
#| Please look at the {Scan,Macro,Output,Debug} for information on the modules and how to create new ones
##| Deals with acquiring the keypress information and turning it into a key index
set( ScanModule "MD1"
set( ScanModule "MDErgo1"
CACHE STRING "Scan Module" )
##| Provides the mapping functions for DefaultMap and handles any macro processing before sending to the OutputModule

View file

@ -28,7 +28,6 @@ Projects
--------
* infinity.bash (Infinity Keyboard 2014/10/15)
* icpad.bash (Soon?)
* ergodox.bash (Infinity Ergodox 2015/08/15)
* template.bash (Example template for new keyboards)
* whitefox.bash (Soon?)

View file

@ -1,72 +0,0 @@
#!/bin/bash
# This is a build script template
# These build scripts are just a convenience for configuring your keyboard (less daunting than CMake)
# Jacob Alexander 2015
#################
# Configuration #
#################
# Feel free to change the variables in this section to configure your keyboard
BuildPath="ICPad"
## KLL Configuration ##
# Generally shouldn't be changed, this will affect every layer
BaseMap="defaultMap"
# This is the default layer of the keyboard
# NOTE: To combine kll files into a single layout, separate them by spaces
# e.g. DefaultMap="mylayout mylayoutmod"
DefaultMap="stdFuncMap"
# This is where you set the additional layers
# NOTE: Indexing starts at 1
# NOTE: Each new layer is another array entry
# e.g. PartialMaps[1]="layer1 layer1mod"
# PartialMaps[2]="layer2"
# PartialMaps[3]="layer3"
PartialMaps[1]=""
##########################
# Advanced Configuration #
##########################
# Don't change the variables in this section unless you know what you're doing
# These are useful for completely custom keyboards
# NOTE: Changing any of these variables will require a force build to compile correctly
# Keyboard Module Configuration
ScanModule="ICPad"
MacroModule="PixelMap"
OutputModule="pjrcUSB"
DebugModule="full"
# Microcontroller
Chip="mk20dx256vlh7"
# Compiler Selection
Compiler="gcc"
########################
# Bash Library Include #
########################
# Shouldn't need to touch this section
# Check if the library can be found
if [ ! -f cmake.bash ]; then
echo "ERROR: Cannot find 'cmake.bash'"
exit 1
fi
# Load the library
source cmake.bash

View file

@ -1,72 +0,0 @@
#!/bin/bash
# This is a build script template
# These build scripts are just a convenience for configuring your keyboard (less daunting than CMake)
# Jacob Alexander 2015
#################
# Configuration #
#################
# Feel free to change the variables in this section to configure your keyboard
BuildPath="KType"
## KLL Configuration ##
# Generally shouldn't be changed, this will affect every layer
BaseMap="defaultMap"
# This is the default layer of the keyboard
# NOTE: To combine kll files into a single layout, separate them by spaces
# e.g. DefaultMap="mylayout mylayoutmod"
DefaultMap="stdFuncMap"
# This is where you set the additional layers
# NOTE: Indexing starts at 1
# NOTE: Each new layer is another array entry
# e.g. PartialMaps[1]="layer1 layer1mod"
# PartialMaps[2]="layer2"
# PartialMaps[3]="layer3"
PartialMaps[1]=""
##########################
# Advanced Configuration #
##########################
# Don't change the variables in this section unless you know what you're doing
# These are useful for completely custom keyboards
# NOTE: Changing any of these variables will require a force build to compile correctly
# Keyboard Module Configuration
ScanModule="KType"
MacroModule="PixelMap"
OutputModule="pjrcUSB"
DebugModule="full"
# Microcontroller
Chip="mk20dx256vlh7"
# Compiler Selection
Compiler="gcc"
########################
# Bash Library Include #
########################
# Shouldn't need to touch this section
# Check if the library can be found
if [ ! -f cmake.bash ]; then
echo "ERROR: Cannot find 'cmake.bash'"
exit 1
fi
# Load the library
source cmake.bash

View file

@ -24,7 +24,7 @@ endif ()
#| Create the .ELF file
set( TARGET_ELF ${TARGET}.elf )
add_executable( ${TARGET_ELF} ${SRCS} generatedKeymap.h kll_defs.h )
add_executable( ${TARGET_ELF} ${SRCS} generatedKeymap.h )
#| .ELF Properties

View file

@ -11,7 +11,7 @@
# Check if KLL compiler is needed
#
if ( "${MacroModule}" STREQUAL "PartialMap" OR "${MacroModule}" STREQUAL "PixelMap" )
if ( "${MacroModule}" STREQUAL "PartialMap" )
@ -20,22 +20,22 @@ if ( "${MacroModule}" STREQUAL "PartialMap" OR "${MacroModule}" STREQUAL "PixelM
#
if ( NOT EXISTS "${PROJECT_SOURCE_DIR}/kll/kll.py" )
message ( STATUS "Downloading latest kll version:" )
message ( STATUS "Downloading latest kll version:" )
# Make sure git is available
find_package ( Git REQUIRED )
# Make sure git is available
find_package ( Git REQUIRED )
# Clone kll git repo
execute_process ( COMMAND ${GIT_EXECUTABLE} clone https://github.com/kiibohd/kll.git
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
)
# Clone kll git repo
execute_process ( COMMAND ${GIT_EXECUTABLE} clone https://github.com/kiibohd/kll.git
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
)
elseif ( REFRESH_KLL ) # Otherwise attempt to update the repo
message ( STATUS "Checking for latest kll version:" )
message ( STATUS "Checking for latest kll version:" )
# Clone kll git repo
execute_process ( COMMAND ${GIT_EXECUTABLE} pull --rebase
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/kll
)
# Clone kll git repo
execute_process ( COMMAND ${GIT_EXECUTABLE} pull --rebase
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/kll
)
endif () # kll/kll.py exists
@ -48,8 +48,8 @@ endif () # kll/kll.py exists
#| Add each of the detected capabilities.kll
foreach ( filename ${ScanModule_KLL} ${MacroModule_KLL} ${OutputModule_KLL} ${DebugModule_KLL} )
set ( BaseMap_Args ${BaseMap_Args} ${filename} )
set ( KLL_DEPENDS ${KLL_DEPENDS} ${filename} )
set ( BaseMap_Args ${BaseMap_Args} ${filename} )
set ( KLL_DEPENDS ${KLL_DEPENDS} ${filename} )
endforeach ()
#| If set BaseMap cannot be found, use default map
@ -57,65 +57,71 @@ set ( pathname "${PROJECT_SOURCE_DIR}/${ScanModulePath}" )
string ( REPLACE " " ";" MAP_LIST ${BaseMap} ) # Change spaces to semicolons
foreach ( MAP ${MAP_LIST} )
# Only check the Scan Module for BaseMap .kll files, default to defaultMap.kll
if ( NOT EXISTS ${pathname}/${MAP}.kll )
set ( BaseMap_Args ${BaseMap_Args} ${pathname}/defaultMap.kll )
set ( KLL_DEPENDS ${KLL_DEPENDS} ${pathname}/defaultMap.kll )
elseif ( EXISTS "${pathname}/${MAP}.kll" )
set ( BaseMap_Args ${BaseMap_Args} ${pathname}/${MAP}.kll )
set ( KLL_DEPENDS ${KLL_DEPENDS} ${pathname}/${MAP}.kll )
else ()
message ( FATAL " Could not find '${MAP}.kll' BaseMap in Scan module directory" )
endif ()
# Only check the Scan Module for BaseMap .kll files, default to defaultMap.kll
if ( NOT EXISTS ${pathname}/${MAP}.kll )
set ( BaseMap_Args ${BaseMap_Args} ${pathname}/defaultMap.kll )
set ( KLL_DEPENDS ${KLL_DEPENDS} ${pathname}/defaultMap.kll )
elseif ( EXISTS "${pathname}/${MAP}.kll" )
set ( BaseMap_Args ${BaseMap_Args} ${pathname}/${MAP}.kll )
set ( KLL_DEPENDS ${KLL_DEPENDS} ${pathname}/${MAP}.kll )
else ()
message ( FATAL " Could not find '${MAP}.kll' BaseMap in Scan module directory" )
endif ()
endforeach ()
#| Configure DefaultMap if specified
if ( NOT "${DefaultMap}" STREQUAL "" )
set ( DefaultMap_Args -d )
set ( DefaultMap_Args -d )
string ( REPLACE " " ";" MAP_LIST ${DefaultMap} ) # Change spaces to semicolons
foreach ( MAP ${MAP_LIST} )
# Check if kll file is in build directory, otherwise default to layout directory
if ( EXISTS "${PROJECT_BINARY_DIR}/${MAP}.kll" )
set ( DefaultMap_Args ${DefaultMap_Args} ${MAP}.kll )
set ( KLL_DEPENDS ${KLL_DEPENDS} ${PROJECT_BINARY_DIR}/${MAP}.kll )
elseif ( EXISTS "${PROJECT_SOURCE_DIR}/kll/layouts/${MAP}.kll" )
set ( DefaultMap_Args ${DefaultMap_Args} ${PROJECT_SOURCE_DIR}/kll/layouts/${MAP}.kll )
set ( KLL_DEPENDS ${KLL_DEPENDS} ${PROJECT_SOURCE_DIR}/kll/layouts/${MAP}.kll )
else ()
message ( FATAL " Could not find '${MAP}.kll' DefaultMap" )
endif ()
endforeach ()
string ( REPLACE " " ";" MAP_LIST ${DefaultMap} ) # Change spaces to semicolons
foreach ( MAP ${MAP_LIST} )
# Check if kll file is in build directory, otherwise default to layout directory
if ( EXISTS "${PROJECT_BINARY_DIR}/${MAP}.kll" )
set ( DefaultMap_Args ${DefaultMap_Args} ${MAP}.kll )
set ( KLL_DEPENDS ${KLL_DEPENDS} ${PROJECT_BINARY_DIR}/${MAP}.kll )
elseif ( EXISTS "${PROJECT_SOURCE_DIR}/kll/layouts/${MAP}.kll" )
set ( DefaultMap_Args ${DefaultMap_Args} ${PROJECT_SOURCE_DIR}/kll/layouts/${MAP}.kll )
set ( KLL_DEPENDS ${KLL_DEPENDS} ${PROJECT_SOURCE_DIR}/kll/layouts/${MAP}.kll )
elseif ( EXISTS "${PROJECT_SOURCE_DIR}/Layouts/${MAP}.kll" )
set ( PartialMap_Args ${PartialMap_Args} ${PROJECT_SOURCE_DIR}/Layouts/${MAP}.kll )
set ( KLL_DEPENDS ${KLL_DEPENDS} ${PROJECT_SOURCE_DIR}/Layouts/${MAP}.kll )
else ()
message ( FATAL " Could not find '${MAP}.kll' DefaultMap" )
endif ()
endforeach ()
endif ()
#| Configure PartialMaps if specified
if ( NOT "${PartialMaps}" STREQUAL "" )
# For each partial layer
foreach ( MAP ${PartialMaps} )
set ( PartialMap_Args ${PartialMap_Args} -p )
# For each partial layer
foreach ( MAP ${PartialMaps} )
set ( PartialMap_Args ${PartialMap_Args} -p )
# Combine each layer
string ( REPLACE " " ";" MAP_LIST ${MAP} ) # Change spaces to semicolons
foreach ( MAP_PART ${MAP_LIST} )
# Check if kll file is in build directory, otherwise default to layout directory
if ( EXISTS "${PROJECT_BINARY_DIR}/${MAP_PART}.kll" )
set ( PartialMap_Args ${PartialMap_Args} ${MAP_PART}.kll )
set ( KLL_DEPENDS ${KLL_DEPENDS} ${PROJECT_BINARY_DIR}/${MAP_PART}.kll )
elseif ( EXISTS "${PROJECT_SOURCE_DIR}/kll/layouts/${MAP_PART}.kll" )
set ( PartialMap_Args ${PartialMap_Args} ${PROJECT_SOURCE_DIR}/kll/layouts/${MAP_PART}.kll )
set ( KLL_DEPENDS ${KLL_DEPENDS} ${PROJECT_SOURCE_DIR}/kll/layouts/${MAP_PART}.kll )
else ()
message ( FATAL " Could not find '${MAP_PART}.kll' PartialMap" )
endif ()
endforeach ()
endforeach ()
# Combine each layer
string ( REPLACE " " ";" MAP_LIST ${MAP} ) # Change spaces to semicolons
foreach ( MAP_PART ${MAP_LIST} )
# Check if kll file is in build directory, otherwise default to layout directory
if ( EXISTS "${PROJECT_BINARY_DIR}/${MAP_PART}.kll" )
set ( PartialMap_Args ${PartialMap_Args} ${MAP_PART}.kll )
set ( KLL_DEPENDS ${KLL_DEPENDS} ${PROJECT_BINARY_DIR}/${MAP_PART}.kll )
elseif ( EXISTS "${PROJECT_SOURCE_DIR}/kll/layouts/${MAP_PART}.kll" )
set ( PartialMap_Args ${PartialMap_Args} ${PROJECT_SOURCE_DIR}/kll/layouts/${MAP_PART}.kll )
set ( KLL_DEPENDS ${KLL_DEPENDS} ${PROJECT_SOURCE_DIR}/kll/layouts/${MAP_PART}.kll )
elseif ( EXISTS "${PROJECT_SOURCE_DIR}/Layouts/${MAP_PART}.kll" )
set ( PartialMap_Args ${PartialMap_Args} ${PROJECT_SOURCE_DIR}/Layouts/${MAP_PART}.kll )
set ( KLL_DEPENDS ${KLL_DEPENDS} ${PROJECT_SOURCE_DIR}/Layouts/${MAP_PART}.kll )
else ()
message ( FATAL " Could not find '${MAP_PART}.kll' PartialMap" )
endif ()
endforeach ()
endforeach ()
endif ()
#| Print list of layout sources used
message ( STATUS "Detected Layout Files:" )
foreach ( filename ${KLL_DEPENDS} )
message ( "${filename}" )
message ( "${filename}" )
endforeach ()
@ -133,22 +139,21 @@ set ( kll_output --outputs ${kll_outputname} )
#| KLL Cmd
set ( kll_cmd ${PROJECT_SOURCE_DIR}/kll/kll.py ${BaseMap_Args} ${DefaultMap_Args} ${PartialMap_Args} ${kll_backend} ${kll_template} ${kll_output} )
add_custom_command ( OUTPUT ${kll_outputname}
COMMAND ${kll_cmd}
DEPENDS ${KLL_DEPENDS}
COMMENT "Generating KLL Layout"
COMMAND ${kll_cmd}
DEPENDS ${KLL_DEPENDS}
COMMENT "Generating KLL Layout"
)
#| KLL Regen Convenience Target
add_custom_target ( kll_regen
COMMAND ${kll_cmd}
COMMENT "Re-generating KLL Layout"
COMMAND ${kll_cmd}
COMMENT "Re-generating KLL Layout"
)
#| Append generated file to required sources so it becomes a dependency in the main build
set ( SRCS ${SRCS} ${kll_outputname} )
else ()
message ( AUTHOR_WARNING "Unknown Macro module, ignoring kll generation" )
endif () # PartialMap

View file

@ -527,7 +527,7 @@ void ResetHandler()
// Also checking for ARM lock-up signal (invalid firmware image)
// RCM_SRS1 & 0x02
if ( // PIN (External Reset Pin/Switch)
RCM_SRS0 & 0x40
RCM_SRS0 & 0x40
// WDOG (Watchdog timeout)
|| RCM_SRS0 & 0x20
// LOCKUP (ARM Core LOCKUP event)
@ -690,11 +690,11 @@ void ResetHandler()
#endif
#if !defined(_bootloader_)
// Initialize the SysTick counter
SYST_RVR = (F_CPU / 1000) - 1;
SYST_CSR = SYST_CSR_CLKSOURCE | SYST_CSR_TICKINT | SYST_CSR_ENABLE;
#if !defined(_bootloader_)
__enable_irq();
#else
// Disable Watchdog for bootloader

View file

@ -1,9 +0,0 @@
Name = PartialMapCapabilities;
Version = 0.1;
Author = "HaaTa (Jacob Alexander) 2015";
KLL = 0.5;
# Modified Date
Date = 2015-12-19;

File diff suppressed because it is too large Load diff

View file

@ -1,127 +0,0 @@
/* Copyright (C) 2015-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 -----
// Compiler Includes
#include <stdint.h>
// ----- Enums -----
typedef enum FrameState {
FrameState_Ready, // Buffers have been updated and are ready to send
FrameState_Sending, // Buffers are currently being sent, do not change
FrameState_Update, // Buffers need to be updated to latest frame
} FrameState;
// Pixel Change Storage
// - Store only the change of the pixel
// - Change is a value (size of the pixel)
// - Contiguous sets of pixel changes can be stored for maximized packing (with the same width)
// - Each value has a corresponding operator
// * Add
// * Subtract
// * Left shift
// * Right shift
// * Set
// * Add no-rollover
// * Subtract no-rollover
typedef enum PixelChange {
PixelChange_Set = 0, // =
PixelChange_Add, // +
PixelChange_Subtract, // -
PixelChange_NoRoll_Add, // +:
PixelChange_NoRoll_Subtract, // -:
PixelChange_LeftShift, // <<
PixelChange_RightShift, // >>
} PixelChange;
// Animation modifiers
typedef enum AnimationModifier {
AnimationModifier_None = 0x00,
AnimationModifier_Fallthrough = 0x01, // Process lower animation first
} AnimationModifier;
// ----- Structs -----
// Element of array of buffers pointers
typedef struct PixelBuf {
uint8_t size; // Number of elements
uint8_t width; // Width of each element
uint16_t offset; // Subtraction offset from absolute channel
void *data; // Pointer to start of buffer
} PixelBuf;
#define PixelBufElem(len,width,offset,ptr) { len, width, offset, (void*)ptr }
#define PixelBuf8(pixbuf, ch) ( ((uint8_t*) (pixbuf->data))[ ch - pixbuf->offset ] )
#define PixelBuf16(pixbuf, ch) ( ((uint16_t*)(pixbuf->data))[ ch - pixbuf->offset ] )
// Individual Pixel element
#define Pixel_MaxChannelPerPixel 3 // TODO Generate
typedef struct PixelElement {
uint8_t width; // Number of bits in a channel
uint8_t channels; // Number of channels
// Hardware indices for each channel
uint16_t indices[Pixel_MaxChannelPerPixel];
} PixelElement;
#define Pixel_RGBChannel(r,g,b) { 8, 3, { r, g, b } }
// TODO generate macro based on max channels
//#define Pixel_8bitChannel(c) { 8, 1, { c } }
typedef struct PixelMod {
uint16_t pixel; // Pixel index
PixelChange change; // Change to apply to pixel
uint8_t contiguousPixels; // # of contiguous pixels to apply same changes too
uint8_t data[0]; // Data size depends on PixelElement definition
} PixelMod;
// Animation stack element
typedef struct AnimationElement {
uint16_t index; // Animation id
uint16_t pos; // Current frame
uint8_t loops; // # of loops to run animation, 0 indicates infinite
uint8_t divider; // # of times to repeat each frame
AnimationModifier modifier; // Modifier applied to the entire animation
} AnimationElement;
// Animation stack
#define Pixel_AnimationStackSize 16
typedef struct AnimationStack {
uint16_t size;
AnimationElement stack[Pixel_AnimationStackSize];
} AnimationStack;
// ----- Variables -----
extern FrameState Pixel_FrameState;
// ----- Functions -----
void Pixel_process();
void Pixel_setup();

View file

@ -1,31 +0,0 @@
###| CMake Kiibohd Controller Macro Module |###
#
# Written by Jacob Alexander in 2015 for the Kiibohd Controller
#
# Released into the Public Domain
#
###
###
# Required Sub-modules
#
AddModule ( Macro PartialMap )
###
# Module C files
#
set ( Module_SRCS
pixel.c
)
###
# Compiler Family Compatibility
#
set ( ModuleCompatibility
arm
)

View file

@ -1286,9 +1286,6 @@ uint8_t usb_init()
print("USB INIT"NL);
#endif
// Unset usb configuration
usb_configuration = 0;
// Clear out endpoints table
for ( int i = 0; i <= NUM_ENDPOINTS * 4; i++ )
{

View file

@ -1,169 +0,0 @@
Name = ICPad;
Version = 0.1;
Author = "HaaTa (Jacob Alexander) 2015";
KLL = 0.3d;
# Modified Date
Date = 2015-10-21;
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"Hash";
S0x0E : U"Backspace";
S0x0F : U"BackTick";
S0x10 : U"Tab";
S0x11 : U"Q";
S0x12 : U"W";
S0x13 : U"E";
S0x14 : U"R";
S0x15 : U"T";
S0x16 : U"Y";
S0x17 : U"U";
S0x18 : U"I";
S0x19 : U"O";
S0x1A : U"P";
S0x1B : U"LBrace";
S0x1C : U"RBrace";
S0x1D : U"Backslash";
S0x1E : U"Delete";
S0x1F : U"CapsLock";
S0x20 : U"A";
S0x21 : U"S";
S0x22 : U"D";
S0x23 : U"F";
S0x24 : U"G";
S0x25 : U"H";
S0x26 : U"J";
S0x27 : U"K";
S0x28 : U"L";
S0x29 : U"Semicolon";
S0x2A : U"Quote";
S0x2B : U"App";
S0x2C : U"Enter";
S0x2D : U"PageUp";
S0x2E : U"LShift";
S0x2F : U"ISO Slash";
S0x30 : U"Z";
S0x31 : U"X";
S0x32 : U"C";
S0x33 : U"V";
S0x34 : U"B";
S0x35 : U"N";
S0x36 : U"M";
S0x37 : U"Comma";
S0x38 : U"Period";
S0x39 : U"Slash";
S0x3A : U"RShift";
S0x3B : U"Up";
S0x3C : U"PageDown";
S0x3D : U"Ctrl";
S0x3E : U"Function1";
S0x3F : U"LAlt";
S0x40 : U"Space";
S0x41 : U"RAlt";
S0x42 : U"Gui";
S0x43 : U"Menu";
S0x44 : U"Left";
S0x45 : U"Down";
S0x46 : U"Right";
# Defines available to the ICPad Scan Module
# Available ISSI Chips
ISSI_Chips = 2;
# LED Default Enable Mask Override
#
# Each LED is represented by a single bit
# See (http://www.issi.com/WW/pdf/31FL3731C.pdf) for details
ISSILedMask1 = "
0xFF, 0xFF, /* C1-1 -> C1-16 */
0xFE, 0xFE, /* C2-1 -> C2-16 */
0xFE, 0xFE, /* C3-1 -> C3-16 */
0x06, 0x06, /* C4-1 -> C4-16 */
0x00, 0x00, /* C5-1 -> C5-16 */
0x60, 0x60, /* C6-1 -> C6-16 */
0x7F, 0x7F, /* C7-1 -> C7-16 */
0x7F, 0x7F, /* C8-1 -> C8-16 */
0xFF, 0xFF, /* C9-1 -> C9-16 */
";
ISSILedMask2 = "
0xFF, 0x00, /* C1-1 -> C1-16 */
0xFE, 0x00, /* C2-1 -> C2-16 */
0xFE, 0x00, /* C3-1 -> C3-16 */
0x06, 0x00, /* C4-1 -> C4-16 */
0x00, 0x00, /* C5-1 -> C5-16 */
0x00, 0x00, /* C6-1 -> C6-16 */
0x0F, 0x00, /* C7-1 -> C7-16 */
0x0F, 0x00, /* C8-1 -> C8-16 */
0x0F, 0x00, /* C9-1 -> C9-16 */
";
# LED Brightness Override
#
# Each LED channel supports 256 levels (8-bit control)
# By default, LEDs are set to 0 brightness
ISSILedBrightness1 = "
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* C1-1 -> C1-16 */
0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* C2-1 -> C2-16 */
0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* C3-1 -> C3-16 */
0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, /* C4-1 -> C4-16 */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C5-1 -> C5-16 */
0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, /* C6-1 -> C6-16 */
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, /* C7-1 -> C7-16 */
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, /* C8-1 -> C8-16 */
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* C9-1 -> C9-16 */
";
ISSILedBrightness2 = "
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C1-1 -> C1-16 */
0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C2-1 -> C2-16 */
0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C3-1 -> C3-16 */
0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C4-1 -> C4-16 */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C5-1 -> C5-16 */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C6-1 -> C6-16 */
0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C7-1 -> C7-16 */
0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C8-1 -> C8-16 */
0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C9-1 -> C9-16 */
";
# Misc
#ISSILedBrightness1 = "
#0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, /* C1-1 -> C1-16 */
#0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, /* C2-1 -> C2-16 */
#0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, /* C3-1 -> C3-16 */
#0x00, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, /* C4-1 -> C4-16 */
#0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C5-1 -> C5-16 */
#0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x00, /* C6-1 -> C6-16 */
#0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0x00, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0x00, /* C7-1 -> C7-16 */
#0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x00, /* C8-1 -> C8-16 */
#0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, /* C9-1 -> C9-16 */
#";
#ISSILedBrightness2 = "
#0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C1-1 -> C1-16 */
#0x00, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C2-1 -> C2-16 */
#0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C3-1 -> C3-16 */
#0x00, 0xA0, 0xA0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C4-1 -> C4-16 */
#0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C5-1 -> C5-16 */
#0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C6-1 -> C6-16 */
#0xC0, 0xC0, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C7-1 -> C7-16 */
#0x44, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C8-1 -> C8-16 */
#0x77, 0x77, 0x77, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C9-1 -> C9-16 */
#";

View file

@ -1,56 +0,0 @@
/* 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)
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;

View file

@ -1,114 +0,0 @@
Pin Usage
=========
mk20dx256vlh7
----
|Keys|
----
* Strobe (Columns)
PTB2
PTB3
PTB18
PTB19
PTC0
PTC8
PTC9
PTC10
PTC11
* Sense (Rows)
PTD0
PTD1
PTD4
PTD5
PTD6
PTD7
PTC1
PTC2
-----
|Clock|
-----
PTA18 <-> PTA19
---
|I2C|
---
* IS31FL3731C
PTB0 - SCL0 (add header pin, label as SCL0)
PTB1 - SDA0 (add header pin, label as SDA0)
PTB17 - INTB Chip 1
PTB16 - SDB (tied to all Chips, hardware shutdown)
---
|DAC|
---
DAC0 (N/C)
----
|UART|
----
* Comm - For bi-directional communication between halves
PTA1 - RX0 (Master Side)
PTA2 - TX0 (Master Side)
PTE1 - RX1 (Slave Side)
PTE0 - TX1 (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
PTC3
PTC4
PTC5
PTC6
PTC7
* Analog
TODO

View file

@ -1,113 +0,0 @@
/* 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.
*/
// ----- 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>
#include <port_scan.h>
#include <pixel.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 Port Swap module
Port_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 Pixel Map
Pixel_setup();
// Reset scan count
Scan_scanCount = 0;
}
// Main Detection Loop
inline uint8_t Scan_loop()
{
// Port Swap detection
Port_scan();
// Scan Matrix
Matrix_scan( Scan_scanCount++ );
// Process any interconnect commands
Connect_scan();
// Prepare any LED events
Pixel_process();
// 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;
}

View file

@ -1,40 +0,0 @@
/* 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

View file

@ -1,33 +0,0 @@
###| 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 PortSwap )
AddModule ( Scan UARTConnect )
###
# Module C files
#
set ( Module_SRCS
scan_loop.c
)
###
# Compiler Family Compatibility
#
set ( ModuleCompatibility
arm
)

View file

@ -1,7 +1,7 @@
Name = ISSILedCapabilities;
Version = 0.2;
Author = "HaaTa (Jacob Alexander) 2015";
KLL = 0.3d;
KLL = 0.3c;
# Modified Date
Date = 2015-10-09;
@ -24,26 +24,6 @@ ledControl => LED_control_capability( mode : 1, amount : 1, index : 2 );
# Defines available to the ISSILed sub-module
# Available ISSI Chips
ISSI_Chips => ISSI_Chips_define;
ISSI_Chips = 1; # 1 by default
# Default animation speed
# Can be set from 0 to 63 (A)
# Formula is TxA (T is approx 11ms)
# 0 - 1.4 fps (represents 64)
# 1 - 90 fps
# 2 - 45 fps
# 3 - 30 fps
# 4 - 22 fps
# etc.
# For a 400 kHz I2C, with a single chip, updating all 144 channels, generally 30 fps is the max for continuous animations
# Each additional chip consumes more bandwidth
# 20 - 4.5 fps - Slow, but should always work without glitches
# See (http://www.issi.com/WW/pdf/31FL3731C.pdf) for details
ISSI_AnimationSpeed => ISSI_AnimationSpeed_define;
ISSI_AnimationSpeed = 20; # 20 by default
# LED Default Enable Mask
#
# By default, all LEDs are enabled
@ -63,45 +43,6 @@ ISSILedMask1 = "
0xFF, 0xFF, /* C9-1 -> C9-16 */
";
ISSILedMask2 => ISSILedMask2_define;
ISSILedMask2 = "
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 */
";
ISSILedMask3 => ISSILedMask3_define;
ISSILedMask3 = "
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 */
";
ISSILedMask4 => ISSILedMask4_define;
ISSILedMask4 = "
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 */
";
# LED Default Brightness
#
# By default, all LEDs are set to max brightness
@ -119,45 +60,6 @@ ISSILedBrightness1 = "
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* C9-1 -> C9-16 */
";
ISSILedBrightness2 => ISSILedBrightness2_define;
ISSILedBrightness2 = "
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* C1-1 -> C1-16 */
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* C2-1 -> C2-16 */
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* C3-1 -> C3-16 */
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* C4-1 -> C4-16 */
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* C5-1 -> C5-16 */
0xFF, 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 0xFF, 0xFF, /* C5-1 -> C5-16 */
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* C6-1 -> C6-16 */
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* C7-1 -> C7-16 */
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* C8-1 -> C8-16 */
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* C9-1 -> C9-16 */
";
# Example starting from 0 brightness to 0x8F
ISSILedBrightness_example = "
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, /* C1-1 -> C1-16 */

View file

@ -33,8 +33,5 @@ printf "\r" > $SERIALPORT
# Page 0x0A is used for configuration
# See the datasheet for full details http://www.issi.com/WW/pdf/31FL3731C.pdf
sleep 0.1
printf "ledWPage 0xE8 0x00 0x24 0x10 0x20 0x30 0x40 0x50\r" > $SERIALPORT # Channel 1
printf "ledWPage 0xEA 0x00 0x24 0x10 0x20 0x30 0x40 0x50\r" > $SERIALPORT # Channel 2
printf "ledWPage 0xEC 0x00 0x24 0x10 0x20 0x30 0x40 0x50\r" > $SERIALPORT # Channel 3
printf "ledWPage 0xEE 0x00 0x24 0x10 0x20 0x30 0x40 0x50\r" > $SERIALPORT # Channel 4
printf "ledWPage 0x00 0x24 0x10 0x20 0x30 0x40 0x50\r" > $SERIALPORT

View file

@ -1,313 +0,0 @@
/*
* Copyright ( C ) 2014 Jan Rychter
* Modifications ( C ) 2015 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 <print.h>
// Local Includes
#include "i2c.h"
// ----- Variables -----
volatile I2C_Channel i2c_channels[1];
// ----- Functions -----
inline void i2c_setup( )
{
// Enable I2C internal clock
SIM_SCGC4 |= SIM_SCGC4_I2C0; // Bus 0
// External pull-up resistor
PORTB_PCR0 = PORT_PCR_ODE | PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(2);
PORTB_PCR1 = PORT_PCR_ODE | PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(2);
// SCL Frequency Divider
// 1.8 MBaud ( likely higher than spec )
// 0x82 -> 36 MHz / (4 * 3) = 2.25 MBaud
// 0x80 => mul(4)
// 0x05 => ICL(5)
I2C0_F = 0x84;
I2C0_FLT = 4;
I2C0_C1 = I2C_C1_IICEN;
I2C0_C2 = I2C_C2_HDRS; // High drive select
// Enable I2C Interrupt
NVIC_ENABLE_IRQ( IRQ_I2C0 );
}
uint8_t i2c_busy()
{
volatile I2C_Channel *channel = &( i2c_channels[0] );
if ( channel->status == I2C_BUSY )
{
return 1;
}
return 0;
}
// These are here for readability and correspond to bit 0 of the address byte.
#define I2C_WRITING 0
#define I2C_READING 1
int32_t i2c_send_sequence(
uint16_t *sequence,
uint32_t sequence_length,
uint8_t *received_data,
void ( *callback_fn )( void* ),
void *user_data
) {
volatile I2C_Channel *channel = &( i2c_channels[0] );
int32_t result = 0;
uint8_t status;
if ( channel->status == I2C_BUSY )
{
return -1;
}
// Debug
/*
for ( uint8_t c = 0; c < sequence_length; c++ )
{
printHex( sequence[c] );
print(" ");
}
print(NL);
*/
channel->sequence = sequence;
channel->sequence_end = sequence + sequence_length;
channel->received_data = received_data;
channel->status = I2C_BUSY;
channel->txrx = I2C_WRITING;
channel->callback_fn = callback_fn;
channel->user_data = user_data;
// reads_ahead does not need to be initialized
// Acknowledge the interrupt request, just in case
I2C0_S |= I2C_S_IICIF;
I2C0_C1 = ( I2C_C1_IICEN | I2C_C1_IICIE );
// Generate a start condition and prepare for transmitting.
I2C0_C1 |= ( I2C_C1_MST | I2C_C1_TX );
status = I2C0_S;
if ( status & I2C_S_ARBL )
{
warn_print("Arbitration lost");
result = -1;
goto i2c_send_sequence_cleanup;
}
// Write the first (address) byte.
I2C0_D = *channel->sequence++;
// Everything is OK.
return result;
i2c_send_sequence_cleanup:
I2C0_C1 &= ~( I2C_C1_IICIE | I2C_C1_MST | I2C_C1_TX );
channel->status = I2C_ERROR;
return result;
}
void i2c0_isr()
{
volatile I2C_Channel* channel = &i2c_channels[0];
uint8_t element;
uint8_t status;
status = I2C0_S;
// Acknowledge the interrupt request
I2C0_S |= I2C_S_IICIF;
// Arbitration problem
if ( status & I2C_S_ARBL )
{
warn_print("Arbitration error");
I2C0_S |= I2C_S_ARBL;
goto i2c_isr_error;
}
if ( channel->txrx == I2C_READING )
{
switch( channel->reads_ahead )
{
// All the reads in the sequence have been processed ( but note that the final data register read still needs to
// be done below! Now, the next thing is either a restart or the end of a sequence. In any case, we need to
// switch to TX mode, either to generate a repeated start condition, or to avoid triggering another I2C read
// when reading the contents of the data register.
case 0:
I2C0_C1 |= I2C_C1_TX;
// Perform the final data register read now that it's safe to do so.
*channel->received_data++ = I2C0_D;
// Do we have a repeated start?
if ( ( channel->sequence < channel->sequence_end ) && ( *channel->sequence == I2C_RESTART ) )
{
// Generate a repeated start condition.
I2C0_C1 |= I2C_C1_RSTA;
// A restart is processed immediately, so we need to get a new element from our sequence. This is safe, because
// a sequence cannot end with a RESTART: there has to be something after it. Note that the only thing that can
// come after a restart is an address write.
channel->txrx = I2C_WRITING;
channel->sequence++;
element = *channel->sequence;
I2C0_D = element;
}
else
{
goto i2c_isr_stop;
}
break;
case 1:
// do not ACK the final read
I2C0_C1 |= I2C_C1_TXAK;
*channel->received_data++ = I2C0_D;
break;
default:
*channel->received_data++ = I2C0_D;
break;
}
channel->reads_ahead--;
}
// channel->txrx == I2C_WRITING
else
{
// First, check if we are at the end of a sequence.
if ( channel->sequence == channel->sequence_end )
goto i2c_isr_stop;
// We received a NACK. Generate a STOP condition and abort.
if ( status & I2C_S_RXAK )
{
warn_print("NACK Received");
goto i2c_isr_error;
}
// check next thing in our sequence
element = *channel->sequence;
// Do we have a restart? If so, generate repeated start and make sure TX is on.
if ( element == I2C_RESTART )
{
I2C0_C1 |= I2C_C1_RSTA | I2C_C1_TX;
// A restart is processed immediately, so we need to get a new element from our sequence.
// This is safe, because a sequence cannot end with a RESTART: there has to be something after it.
channel->sequence++;
element = *channel->sequence;
// Note that the only thing that can come after a restart is a write.
I2C0_D = element;
}
else
{
if ( element == I2C_READ ) {
channel->txrx = I2C_READING;
// How many reads do we have ahead of us ( not including this one )?
// For reads we need to know the segment length to correctly plan NACK transmissions.
// We already know about one read
channel->reads_ahead = 1;
while (
( ( channel->sequence + channel->reads_ahead ) < channel->sequence_end ) &&
( *( channel->sequence + channel->reads_ahead ) == I2C_READ )
) {
channel->reads_ahead++;
}
// Switch to RX mode.
I2C0_C1 &= ~I2C_C1_TX;
// do not ACK the final read
if ( channel->reads_ahead == 1 )
{
I2C0_C1 |= I2C_C1_TXAK;
}
// ACK all but the final read
else
{
I2C0_C1 &= ~( I2C_C1_TXAK );
}
// Dummy read comes first, note that this is not valid data!
// This only triggers a read, actual data will come in the next interrupt call and overwrite this.
// This is why we do not increment the received_data pointer.
*channel->received_data = I2C0_D;
channel->reads_ahead--;
}
// Not a restart, not a read, must be a write.
else
{
I2C0_D = element;
}
}
}
channel->sequence++;
return;
i2c_isr_stop:
// Generate STOP ( set MST=0 ), switch to RX mode, and disable further interrupts.
I2C0_C1 &= ~( I2C_C1_MST | I2C_C1_IICIE | I2C_C1_TXAK );
channel->status = I2C_AVAILABLE;
// Call the user-supplied callback function upon successful completion (if it exists).
if ( channel->callback_fn )
{
// Delay 10 microseconds before starting linked function
delayMicroseconds(10);
( *channel->callback_fn )( channel->user_data );
}
return;
i2c_isr_error:
// Generate STOP and disable further interrupts.
I2C0_C1 &= ~( I2C_C1_MST | I2C_C1_IICIE );
channel->status = I2C_ERROR;
return;
}

View file

@ -1,115 +0,0 @@
/*
* Copyright (C) 2014 Jan Rychter
* Modifications (C) 2015 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 <Lib/ScanLib.h>
// ----- Defines -----
// Channel status definitions. These are not enumerated, as I want them to be uint8_t.
#define I2C_AVAILABLE 0
#define I2C_BUSY 1
#define I2C_ERROR 2
#define I2C_RESTART 1<<8
#define I2C_READ 2<<8
// ----- Structs -----
typedef struct {
uint16_t *sequence;
uint16_t *sequence_end;
uint8_t *received_data;
void (*callback_fn)(void*);
void *user_data;
uint8_t reads_ahead;
uint8_t status;
uint8_t txrx;
} I2C_Channel;
// ----- Variables -----
extern volatile I2C_Channel i2c_channels[1];
// ----- Functions -----
/*
* I2C Module Setup - Channel 0 only
*/
void i2c_setup();
/*
* Sends a command/data sequence that can include restarts, writes and reads. Every transmission begins with a START,
* and ends with a STOP so you do not have to specify that.
*
* sequence is the I2C operation sequence that should be performed. It can include any number of writes, restarts and
* reads. Note that the sequence is composed of uint16_t, not uint8_t. This is because we have to support out-of-band
* signalling of I2C_RESTART and I2C_READ operations, while still passing through 8-bit data.
*
* sequence_length is the number of sequence elements (not bytes). Sequences of arbitrary length are supported. The
* minimum sequence length is (rather obviously) 2.
*
* received_data should point to a buffer that can hold as many bytes as there are I2C_READ operations in the
* sequence. If there are no reads, 0 can be passed, as this parameter will not be used.
*
* callback_fn is a pointer to a function that will get called upon successful completion of the entire sequence. If 0 is
* supplied, no function will be called. Note that the function will be called fron an interrupt handler, so it should do
* the absolute minimum possible (such as enqueue an event to be processed later, set a flag, exit sleep mode, etc.)
*
* user_data is a pointer that will be passed to the callback_fn.
*/
int32_t i2c_send_sequence(
uint16_t *sequence,
uint32_t sequence_length,
uint8_t *received_data,
void (*callback_fn)(void*),
void *user_data
);
/*
* Convenience macros
*/
#define i2c_send(seq, seq_len) i2c_send_sequence( seq, seq_len, 0, 0, 0 )
#define i2c_read(seq, seq_len, rec) i2c_send_sequence( seq, seq_len, rec, 0, 0 )
/*
* Check if busy
*/
uint8_t i2c_busy();

File diff suppressed because it is too large Load diff

View file

@ -23,18 +23,10 @@
// ----- Variables -----
extern uint8_t LED_FrameBuffersReady;
// ----- Functions -----
void LED_setup();
void LED_scan();
void LED_currentChange( unsigned int current );
uint8_t LED_scan();
void LED_currentChange( unsigned int current );

View file

@ -17,7 +17,6 @@ set ( SubModule 1 )
# Module C files
#
set ( Module_SRCS
i2c.c
led_scan.c
)

View file

@ -4,10 +4,9 @@ Author = "HaaTa (Jacob Alexander) 2015";
KLL = 0.3c;
# Modified Date
Date = 2016-01-03;
Date = 2015-09-29;
# Function Row
S0x00 : U"Esc";
S0x01 : U"F1";
S0x02 : U"F2";
@ -24,8 +23,6 @@ S0x0C : U"F12";
S0x0D : U"PrintScreen";
S0x0E : U"ScrollLock";
S0x0F : U"Pause";
# Number Row
S0x10 : U"Backtick";
S0x11 : U"1";
S0x12 : U"2";
@ -39,248 +36,62 @@ S0x19 : U"9";
S0x1A : U"0";
S0x1B : U"Minus";
S0x1C : U"Equals";
S0x1D : U"Hash";
S0x1E : U"Backspace";
S0x1F : U"Backspace"; # ISO Backspace
S0x20 : U"Insert";
S0x21 : U"Home";
S0x22 : U"PageUp";
# Top Alphabet Row
S0x23 : U"Tab";
S0x24 : U"Q";
S0x25 : U"W";
S0x26 : U"E";
S0x27 : U"R";
S0x28 : U"T";
S0x29 : U"Y";
S0x2A : U"U";
S0x2B : U"I";
S0x2C : U"O";
S0x2D : U"P";
S0x2E : U"LBrace";
S0x2F : U"RBrace";
S0x30 : U"Backslash";
S0x31 : U"Enter"; # ISO Enter
S0x32 : U"Delete";
S0x33 : U"End";
S0x34 : U"End";
# Middle Alphabet Row
S0x35 : U"CapsLock";
S0x36 : U"A";
S0x37 : U"S";
S0x38 : U"D";
S0x39 : U"F";
S0x3A : U"G";
S0x3B : U"H";
S0x3C : U"J";
S0x3D : U"K";
S0x3E : U"L";
S0x3F : U"Semicolon";
S0x40 : U"Quote";
S0x41 : U"Backslash"; # ISO Backslash
S0x42 : U"Enter";
# Bottom Alphabet Row
S0x43 : U"LShift";
S0x44 : U"LShift";
S0x45 : U"ISO/";
S0x46 : U"Z";
S0x47 : U"X";
S0x48 : U"C";
S0x49 : U"V";
S0x4A : U"B";
S0x4B : U"N";
S0x4C : U"M";
S0x4D : U"Comma";
S0x4E : U"Period";
S0x4F : U"Slash";
S0x50 : U"RShift"; # HHKB RShift
S0x51 : U"RShift";
S0x52 : U"Function1";
S0x53 : U"Up";
# Modifier Row
S0x54 : U"LCtrl";
S0x55 : U"LGui";
S0x56 : U"LAlt";
S0x57 : U"Space";
S0x58 : U"RAlt";
S0x59 : U"RGui";
S0x5A : U"Menu";
S0x5B : U"RCtrl";
S0x5C : U"Left";
S0x5D : U"Down";
S0x5E : U"Right";
# Available ISSI Chips
ISSI_Chips = 4; # 1 by default
# Default animation speed
ISSI_AnimationSpeed = 14; # 20 by default
# LED Default Enable Mask
#
# By default, all LEDs are enabled
# However, this may cause issuse with some led matrices, so it is recommended to disable unused positions
# Each LED is represented by a single bit
# See (http://www.issi.com/WW/pdf/31FL3731C.pdf) for details
ISSILedMask1 = "
0xFF, 0xFF, /* C1-1 -> C1-16 */
0xFE, 0xFE, /* C2-1 -> C2-16 */
0xFE, 0xFE, /* C3-1 -> C3-16 */
0x06, 0x06, /* C4-1 -> C4-16 */
0x00, 0x00, /* C5-1 -> C5-16 */
0x60, 0x60, /* C6-1 -> C6-16 */
0x7F, 0x7F, /* C7-1 -> C7-16 */
0x7F, 0x7F, /* C8-1 -> C8-16 */
0xFF, 0xFF, /* C9-1 -> C9-16 */
";
ISSILedMask2 = "
0xFF, 0xFF, /* C1-1 -> C1-16 */
0xFE, 0xFE, /* C2-1 -> C2-16 */
0xFE, 0xFE, /* C3-1 -> C3-16 */
0x06, 0x06, /* C4-1 -> C4-16 */
0x00, 0x00, /* C5-1 -> C5-16 */
0x60, 0x60, /* C6-1 -> C6-16 */
0x7F, 0x7F, /* C7-1 -> C7-16 */
0x7F, 0x7F, /* C8-1 -> C8-16 */
0xFF, 0xFF, /* C9-1 -> C9-16 */
";
ISSILedMask3 = "
0xFF, 0xFF, /* C1-1 -> C1-16 */
0xFE, 0xFE, /* C2-1 -> C2-16 */
0xFE, 0xFE, /* C3-1 -> C3-16 */
0x06, 0x06, /* C4-1 -> C4-16 */
0x00, 0x00, /* C5-1 -> C5-16 */
0x60, 0x60, /* C6-1 -> C6-16 */
0x7F, 0x7F, /* C7-1 -> C7-16 */
0x7F, 0x7F, /* C8-1 -> C8-16 */
0xFF, 0xFF, /* C9-1 -> C9-16 */
";
ISSILedMask4 = "
0xFF, 0xFF, /* C1-1 -> C1-16 */
0xFE, 0xFE, /* C2-1 -> C2-16 */
0xFE, 0xFE, /* C3-1 -> C3-16 */
0x06, 0x06, /* C4-1 -> C4-16 */
0x00, 0x00, /* C5-1 -> C5-16 */
0x60, 0x60, /* C6-1 -> C6-16 */
0x7F, 0x7F, /* C7-1 -> C7-16 */
0x7F, 0x7F, /* C8-1 -> C8-16 */
0xFF, 0xFF, /* C9-1 -> C9-16 */
";
# Disabled for now
#ISSILedMask4 = "
# 0x00, 0x00, /* C1-1 -> C1-16 */
# 0x00, 0x00, /* 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 */
#";
ISSILedBrightness1 = "
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, /* C1-1 -> C1-16 */
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, /* C2-1 -> C2-16 */
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, /* C3-1 -> C3-16 */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, /* C4-1 -> C4-16 */
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, /* C5-1 -> C5-16 */
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, /* C6-1 -> C6-16 */
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, /* C7-1 -> C7-16 */
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, /* C8-1 -> C8-16 */
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, /* C9-1 -> C9-16 */
";
ISSILedBrightness2 = "
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, /* C1-1 -> C1-16 */
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, /* C2-1 -> C2-16 */
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, /* C3-1 -> C3-16 */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, /* C4-1 -> C4-16 */
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, /* C5-1 -> C5-16 */
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, /* C6-1 -> C6-16 */
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, /* C7-1 -> C7-16 */
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, /* C8-1 -> C8-16 */
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, /* C9-1 -> C9-16 */
";
ISSILedBrightness3 = "
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, /* C1-1 -> C1-16 */
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, /* C2-1 -> C2-16 */
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, /* C3-1 -> C3-16 */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, /* C4-1 -> C4-16 */
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, /* C5-1 -> C5-16 */
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, /* C6-1 -> C6-16 */
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, /* C7-1 -> C7-16 */
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, /* C8-1 -> C8-16 */
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, /* C9-1 -> C9-16 */
";
ISSILedBrightness4 = "
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, /* C1-1 -> C1-16 */
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, /* C2-1 -> C2-16 */
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, /* C3-1 -> C3-16 */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, /* C4-1 -> C4-16 */
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, /* C5-1 -> C5-16 */
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, /* C6-1 -> C6-16 */
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, /* C7-1 -> C7-16 */
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, /* C8-1 -> C8-16 */
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, /* C9-1 -> C9-16 */
";
ISSILedBrightness1 = "
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* C1-1 -> C1-16 */
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* C2-1 -> C2-16 */
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* C3-1 -> C3-16 */
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* C4-1 -> C4-16 */
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF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* C5-1 -> C5-16 */
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* C6-1 -> C6-16 */
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* C7-1 -> C7-16 */
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* C8-1 -> C8-16 */
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* C9-1 -> C9-16 */
";
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"LBrace";
S0x2D : U"RBrace";
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";

View file

@ -37,20 +37,20 @@
// 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
// KType
// MDErgo1
//
// Column (Strobe) - 10 Total
// Column (Strobe) - 9 Total
// PTB2,3,18,19
// PTC0,8..11
// PTC0,9..11
// PTD0
//
// Rows (Sense) - 10 Total
// Rows (Sense) - 5 Total
// PTD1,4..7
// PTC1..5
// 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,8), 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), gpio(C,1), gpio(C,2), gpio(C,3), gpio(C,4), gpio(C,5) };
// 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;

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2015-2016 by Jacob Alexander
/* Copyright (C) 2014-2016 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
@ -33,8 +33,6 @@
#include <matrix_scan.h>
#include <macro.h>
#include <output_com.h>
#include <port_scan.h>
#include <pixel.h>
// Local Includes
#include "scan_loop.h"
@ -55,9 +53,6 @@ uint16_t Scan_scanCount = 0;
// Setup
inline void Scan_setup()
{
// Setup Port Swap module
Port_setup();
// Setup UART Connect, if Output_Available, this is the master node
Connect_setup( Output_Available );
@ -67,9 +62,6 @@ inline void Scan_setup()
// Setup ISSI chip to control the leds
LED_setup();
// Setup Pixel Map
Pixel_setup();
// Reset scan count
Scan_scanCount = 0;
}
@ -78,18 +70,12 @@ inline void Scan_setup()
// Main Detection Loop
inline uint8_t Scan_loop()
{
// Port Swap detection
Port_scan();
// Scan Matrix
Matrix_scan( Scan_scanCount++ );
// Process any interconnect commands
Connect_scan();
// Prepare any LED events
Pixel_process();
// Process any LED events
LED_scan();
@ -118,7 +104,6 @@ void Scan_currentChange( unsigned int current )
{
// Indicate to all submodules current change
Connect_currentChange( current );
Port_currentChange( current );
Matrix_currentChange( current );
LED_currentChange( current );
}

View file

@ -12,7 +12,6 @@
#
AddModule ( Scan ISSILed )
AddModule ( Scan MatrixARM )
AddModule ( Scan PortSwap )
AddModule ( Scan UARTConnect )

View file

@ -139,10 +139,6 @@ uint8_t Matrix_pin( GPIO_Pin gpio, Type type )
*GPIO_PDDR &= ~(1 << gpio.pin); // input, high Z state
#endif
*GPIO_PCOR |= (1 << gpio.pin);
#ifdef GHOSTING_MATRIX
// Ghosting martix needs to put not used (off) strobes in high impedance state
*GPIO_PDDR &= ~(1 << gpio.pin); // input, high Z state
#endif
break;
case Type_StrobeSetup:
@ -529,10 +525,6 @@ void Matrix_scan( uint16_t scanNum )
KeyPosition k = !st->cur
? (!st->prev ? KeyState_Off : KeyState_Release)
: ( st->prev ? KeyState_Hold : KeyState_Press);
//if (!st->cur && !st->prev) k = KeyState_Off; else
//if ( st->cur && st->prev) k = KeyState_Hold; else
//if ( st->cur && !st->prev) k = KeyState_Press; else
//if (!st->cur && st->prev) k = KeyState_Release;
Macro_keyState( key, k );
}
}

View file

@ -1,14 +0,0 @@
Name = PortSwapCapabilities;
Version = 0.1;
Author = "HaaTa (Jacob Alexander) 2015";
KLL = 0.3d;
# Modified Date
Date = 2015-10-23;
# Cross interconnect pins, required for complex cabling arrangements
portCross => Port_cross_capability();
# Capability to swap the USB port mapping
portSwap => Port_swap_capability();

View file

@ -1,207 +0,0 @@
/* Copyright (C) 2015 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>
// USB Includes
#if defined(_at90usb162_) || defined(_atmega32u4_) || defined(_at90usb646_) || defined(_at90usb1286_)
#include <avr/usb_keyboard_serial.h>
#elif defined(_mk20dx128_) || defined(_mk20dx128vlf5_) || defined(_mk20dx256_) || defined(_mk20dx256vlh7_)
#include <arm/usb_dev.h>
#endif
// Interconnect Includes
#include <connect_scan.h>
// Local Includes
#include "port_scan.h"
// ----- Defines -----
// ----- Structs -----
// ----- Function Declarations -----
// CLI Functions
void cliFunc_portCross( char* args );
void cliFunc_portSwap ( char* args );
// ----- Variables -----
uint32_t Port_lastcheck_ms;
// Scan Module command dictionary
CLIDict_Entry( portCross, "Cross interconnect pins." );
CLIDict_Entry( portSwap, "Swap USB ports manually, forces usb and interconnect to re-negotiate if necessary." );
CLIDict_Def( portCLIDict, "Port Swap Module Commands" ) = {
CLIDict_Item( portCross ),
CLIDict_Item( portSwap ),
{ 0, 0, 0 } // Null entry for dictionary end
};
// ----- Functions -----
void Port_swap()
{
info_print("USB Port Swap");
// PTA13 - USB Swap
GPIOA_PTOR |= (1<<13);
// Re-initialize usb
// Call usb_configured() to check if usb is ready
usb_init();
}
void Port_cross()
{
info_print("Interconnect Line Cross");
// PTA12 - UART Tx/Rx cross-over
GPIOA_PTOR |= (1<<12);
// Reset interconnects
Connect_reset();
}
// Setup
inline void Port_setup()
{
// Register Scan CLI dictionary
CLI_registerDictionary( portCLIDict, portCLIDictName );
// PTA12 - UART Tx/Rx cross-over
// Start, disabled
GPIOA_PDDR |= (1<<12);
PORTA_PCR12 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1);
GPIOA_PCOR |= (1<<12);
// PTA13 - USB Swap
// Start, disabled
GPIOA_PDDR |= (1<<13);
PORTA_PCR13 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1);
GPIOA_PCOR |= (1<<13);
// Starting point for automatic port swapping
Port_lastcheck_ms = systick_millis_count;
}
// Port State processing loop
inline uint8_t Port_scan()
{
// TODO Add in interconnect line cross
#define USBPortSwapDelay_ms 1000
// Wait 1000 ms before checking
// Only check for swapping after delay
uint32_t wait_ms = systick_millis_count - Port_lastcheck_ms;
if ( wait_ms > USBPortSwapDelay_ms )
{
// Update timeout
Port_lastcheck_ms = systick_millis_count;
// USB not initialized, attempt to swap
if ( !usb_configured() )
{
Port_swap();
}
}
return 0;
}
// Signal from parent Scan Module that available current has changed
// current - mA
void Port_currentChange( unsigned int current )
{
// TODO - Power savings?
}
// ----- Capabilities -----
void Port_swap_capability( uint8_t state, uint8_t stateType, uint8_t *args )
{
// Display capability name
if ( stateType == 0xFF && state == 0xFF )
{
print("Port_swap_capability()");
return;
}
// Only only release
// TODO Analog
if ( state != 0x03 )
return;
Port_swap();
}
void Port_cross_capability( uint8_t state, uint8_t stateType, uint8_t *args )
{
// Display capability name
if ( stateType == 0xFF && state == 0xFF )
{
print("Port_cross_capability()");
return;
}
// Only only release
// TODO Analog
if ( state != 0x03 )
return;
Port_cross();
}
// ----- CLI Command Functions -----
void cliFunc_portSwap( char* args )
{
print( NL );
Port_swap();
}
void cliFunc_portCross( char* args )
{
print( NL );
Port_cross();
}

View file

@ -1,32 +0,0 @@
/* Copyright (C) 2015-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 -----
// Compiler Includes
#include <stdint.h>
// ----- Functions -----
void Port_setup();
uint8_t Port_scan();
void Port_currentChange( unsigned int current ); // Called by Output Module

View file

@ -1,30 +0,0 @@
###| CMake Kiibohd Controller Scan Module |###
#
# Written by Jacob Alexander in 2015 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
port_scan.c
)
###
# Compiler Family Compatibility
#
set ( ModuleCompatibility
arm
)

View file

@ -26,7 +26,7 @@ UARTConnectBaudFine => UARTConnectBaudFine_define;
# Thus baud setting = 26
# NOTE: If finer baud adjustment is needed see UARTx_C4 -> BRFA in the datasheet
# Baud fine setting = 0x02
UARTConnectBaud = 1; # 4.5 Mbps @ 72 MHz
UARTConnectBaud = 1; # 4.5 Mbpsa @ 72 MHz
UARTConnectBaudFine = 0x0;
#UARTConnectBaud = 39; # 115385 bps @ 72 MHz (close to 115200)

View file

@ -163,7 +163,6 @@ extern uint8_t Connect_master; // Set if master
void Connect_setup( uint8_t master );
void Connect_scan();
void Connect_reset();
void Connect_send_ScanCode( uint8_t id, TriggerGuide *scanCodeStateList, uint8_t numScanCodes );
void Connect_send_RemoteCapability( uint8_t id, uint8_t capabilityIndex, uint8_t state, uint8_t stateType, uint8_t numArgs, uint8_t *args );

View file

@ -32,7 +32,6 @@
#include <matrix_scan.h>
#include <macro.h>
#include <output_com.h>
#include <pixel.h>
// Local Includes
#include "scan_loop.h"
@ -59,9 +58,6 @@ inline void Scan_setup()
// Setup ISSI chip to control the leds
LED_setup();
// Setup Pixel Map
Pixel_setup();
// Reset scan count
Scan_scanCount = 0;
}
@ -73,9 +69,6 @@ inline uint8_t Scan_loop()
// Scan Matrix
Matrix_scan( Scan_scanCount++ );
// Prepare any LED events
Pixel_process();
// Process any LED events
LED_scan();