# HG changeset patch # User Jacob Alexander # Date 1454811814 28800 # Node ID 065959b4f7bd5b5828a2d87b6ed476f4c85a3940 # Parent 494cd4d2e4149a3a17d7be884495bb8c04739a34# Parent 8fa2619aa60ec73eb6e554a2c247a224b56408f4 Merge pull request #78 from kevinfrei/infiniteLoops Fix a handful of infinite loops that occur with more than 254 macros diff -r 8fa2619aa60e -r 065959b4f7bd Bootloader/Scripts/easyMode.bash --- a/Bootloader/Scripts/easyMode.bash Sat Jan 02 17:43:05 2016 -0800 +++ b/Bootloader/Scripts/easyMode.bash Sat Feb 06 18:23:34 2016 -0800 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Just in case there was an extra ledTest.bash (don't care if error) rm /dev/ttyACM0 diff -r 8fa2619aa60e -r 065959b4f7bd Bootloader/Scripts/generateManufacturingImage.bash --- a/Bootloader/Scripts/generateManufacturingImage.bash Sat Jan 02 17:43:05 2016 -0800 +++ b/Bootloader/Scripts/generateManufacturingImage.bash Sat Feb 06 18:23:34 2016 -0800 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Combines a given bootloader image and firmware image into a single firmware binary # Manufacturing deliverable diff -r 8fa2619aa60e -r 065959b4f7bd Bootloader/Scripts/ledTest.bash --- a/Bootloader/Scripts/ledTest.bash Sat Jan 02 17:43:05 2016 -0800 +++ b/Bootloader/Scripts/ledTest.bash Sat Feb 06 18:23:34 2016 -0800 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash printf "led\r" > /dev/ttyACM0 diff -r 8fa2619aa60e -r 065959b4f7bd Bootloader/Scripts/swdLoad.bash --- a/Bootloader/Scripts/swdLoad.bash Sat Jan 02 17:43:05 2016 -0800 +++ b/Bootloader/Scripts/swdLoad.bash Sat Feb 06 18:23:34 2016 -0800 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Loads firmware image using an SWD Flasher # Uses MCHCK ruby flasher toolchain # NOTE: Only tested with a buspirate on Linux diff -r 8fa2619aa60e -r 065959b4f7bd CMakeLists.txt --- a/CMakeLists.txt Sat Jan 02 17:43:05 2016 -0800 +++ b/CMakeLists.txt Sat Feb 06 18:23:34 2016 -0800 @@ -23,7 +23,7 @@ # "at90usb1286" # Teensy++ 2.0 (avr) # "mk20dx128" # Teensy 3.0 (arm) "mk20dx128vlf5" # McHCK mk20dx128vlf5 -# "mk20dx256" # Teensy 3.1 (arm) +# "mk20dx256" # Teensy 3.1,3.2 (arm) # "mk20dx256vlh7" # Kiibohd-dfu mk20dx256vlh7 CACHE STRING "Microcontroller Chip" ) diff -r 8fa2619aa60e -r 065959b4f7bd Keyboards/cmake.bash --- a/Keyboards/cmake.bash Sat Jan 02 17:43:05 2016 -0800 +++ b/Keyboards/cmake.bash Sat Feb 06 18:23:34 2016 -0800 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # This is bash lib file for the convenience build scripts # Don't call this script directly # Jacob Alexander 2015 diff -r 8fa2619aa60e -r 065959b4f7bd Keyboards/ergodox.bash --- a/Keyboards/ergodox.bash Sat Jan 02 17:43:05 2016 -0800 +++ b/Keyboards/ergodox.bash Sat Feb 06 18:23:34 2016 -0800 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env 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 diff -r 8fa2619aa60e -r 065959b4f7bd Keyboards/infinity.bash --- a/Keyboards/infinity.bash Sat Jan 02 17:43:05 2016 -0800 +++ b/Keyboards/infinity.bash Sat Feb 06 18:23:34 2016 -0800 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env 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 diff -r 8fa2619aa60e -r 065959b4f7bd Keyboards/template.bash --- a/Keyboards/template.bash Sat Jan 02 17:43:05 2016 -0800 +++ b/Keyboards/template.bash Sat Feb 06 18:23:34 2016 -0800 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env 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 diff -r 8fa2619aa60e -r 065959b4f7bd Keyboards/whitefox.bash --- a/Keyboards/whitefox.bash Sat Jan 02 17:43:05 2016 -0800 +++ b/Keyboards/whitefox.bash Sat Feb 06 18:23:34 2016 -0800 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env 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 diff -r 8fa2619aa60e -r 065959b4f7bd Lib/CMake/sizeCalculator --- a/Lib/CMake/sizeCalculator Sat Jan 02 17:43:05 2016 -0800 +++ b/Lib/CMake/sizeCalculator Sat Feb 06 18:23:34 2016 -0800 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash #| Jacob Alexander 2014 #| Arg List #| 1 - size binary (e.g. avr-size) diff -r 8fa2619aa60e -r 065959b4f7bd Lib/CMake/writer --- a/Lib/CMake/writer Sat Jan 02 17:43:05 2016 -0800 +++ b/Lib/CMake/writer Sat Feb 06 18:23:34 2016 -0800 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash #| Jacob Alexander 2014 #| Arg List #| 1 - File to write to (e.g. final_chip) diff -r 8fa2619aa60e -r 065959b4f7bd LoadFile/load.dfu --- a/LoadFile/load.dfu Sat Jan 02 17:43:05 2016 -0800 +++ b/LoadFile/load.dfu Sat Feb 06 18:23:34 2016 -0800 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Convenience script for loading firmware onto a dfu type device # By default, initiates dfu-util diff -r 8fa2619aa60e -r 065959b4f7bd LoadFile/load.teensy --- a/LoadFile/load.teensy Sat Jan 02 17:43:05 2016 -0800 +++ b/LoadFile/load.teensy Sat Feb 06 18:23:34 2016 -0800 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Convenience script for loading firmware onto a teensy type device # By default, initiates teensy-load-cli diff -r 8fa2619aa60e -r 065959b4f7bd LoadFile/winload.teensy --- a/LoadFile/winload.teensy Sat Jan 02 17:43:05 2016 -0800 +++ b/LoadFile/winload.teensy Sat Feb 06 18:23:34 2016 -0800 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Convenience script for loading firmware onto a teensy type device # By default, initiates teensy-load-cli diff -r 8fa2619aa60e -r 065959b4f7bd README.markdown --- a/README.markdown Sat Jan 02 17:43:05 2016 -0800 +++ b/README.markdown Sat Feb 06 18:23:34 2016 -0800 @@ -39,7 +39,7 @@ * Teensy 2.0 (Partial) * Teensy 2.0++ * Teensy 3.0 -* Teensy 3.1 +* Teensy 3.1/3.2 * mk20dx128vlf5 * mk20dx256vlh7 diff -r 8fa2619aa60e -r 065959b4f7bd Scan/ISSILed/exampleAPI.bash --- a/Scan/ISSILed/exampleAPI.bash Sat Jan 02 17:43:05 2016 -0800 +++ b/Scan/ISSILed/exampleAPI.bash Sat Feb 06 18:23:34 2016 -0800 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # ISSILed # Virtual Serial Port API Example # Jacob Alexander 2015 diff -r 8fa2619aa60e -r 065959b4f7bd Scan/MD1_1/defaultMap.kll --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Scan/MD1_1/defaultMap.kll Sat Feb 06 18:23:34 2016 -0800 @@ -0,0 +1,134 @@ +Name = MD1_1; +Version = 0.3d; +Author = "HaaTa (Jacob Alexander) 2014-2016"; +KLL = 0.3c; + +# Modified Date +Date = 2016-02-06; + + +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"Backtick"; +S0x0F : U"Tab"; +S0x10 : U"Q"; +S0x11 : U"W"; +S0x12 : U"E"; +S0x13 : U"R"; +S0x14 : U"T"; +S0x15 : U"Y"; +S0x16 : U"U"; +S0x17 : U"I"; +S0x18 : U"O"; +S0x19 : U"P"; +S0x1A : U"LBrace"; +S0x1B : U"RBrace"; +S0x1C : U"Backspace"; +S0x1D : U"Ctrl"; +S0x1E : U"A"; +S0x1F : U"S"; +S0x20 : U"D"; +S0x21 : U"F"; +S0x22 : U"G"; +S0x23 : U"H"; +S0x24 : U"J"; +S0x25 : U"K"; +S0x26 : U"L"; +S0x27 : U"Semicolon"; +S0x28 : U"Quote"; +S0x29 : U"Enter"; +S0x2A : U"LShift"; +S0x2B : U"Z"; +S0x2C : U"X"; +S0x2D : U"C"; +S0x2E : U"V"; +S0x2F : U"B"; +S0x30 : U"N"; +S0x31 : U"M"; +S0x32 : U"Comma"; +S0x33 : U"Period"; +S0x34 : U"Slash"; +S0x35 : U"RShift"; +S0x36 : U"Function1"; # Fun key +S0x37 : U"Function2"; # Left Blank Key +S0x38 : U"LAlt"; +S0x39 : U"LGui"; +S0x3A : U"Space"; +S0x3B : U"RGui"; +S0x3C : U"RAlt"; +S0x3D : U"Function3"; # Right Blank Key 1 +S0x3E : U"Function4"; # Right Blank Key 2 + + +# Custom Action Examples + +# Example capability, prints to cli +action1 => CustomAction_action1_capability(); # No arguments + +# Blocks given USB Code, must be used with blockLink +# Simple example, supports only blocking a single key at a time +# Keys must be specified using numbers see Macro/PartialMap/usb_hid.h +blockHold => CustomAction_blockHold_capability( usbCode : 1 ); # Single 8-bit argument +blockKey => CustomAction_blockKey_capability( usbCode : 1 ); + + + +# Defines available to the MD1_1 Scan Module + +# 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, 0x00, /* C1-1 -> C1-16 */ + 0xFF, 0x00, /* C2-1 -> C2-16 */ + 0xFF, 0x00, /* C3-1 -> C3-16 */ + 0xFF, 0x00, /* C4-1 -> C4-16 */ + 0xFF, 0x00, /* C5-1 -> C5-16 */ + 0xFF, 0x00, /* C6-1 -> C6-16 */ + 0xFF, 0x00, /* C7-1 -> C7-16 */ + 0x7F, 0x00, /* C8-1 -> C8-16 */ + 0x00, 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 = " +#0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C1-1 -> C1-16 */ +#0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C2-1 -> C2-16 */ +#0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C3-1 -> C3-16 */ +#0x00, 0x00, 0x00, 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 */ +#0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C7-1 -> C7-16 */ +#0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C8-1 -> C8-16 */ +#0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C9-1 -> C9-16 */ +#"; + +# Full brightness example +ISSILedBrightness1 = " +0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C1-1 -> C1-16 */ +0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C2-1 -> C2-16 */ +0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C3-1 -> C3-16 */ +0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C4-1 -> C4-16 */ +0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C5-1 -> C5-16 */ +0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C6-1 -> C6-16 */ +0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C7-1 -> C7-16 */ +0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C8-1 -> C8-16 */ +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C9-1 -> C9-16 */ +"; + diff -r 8fa2619aa60e -r 065959b4f7bd Scan/MD1_1/matrix.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Scan/MD1_1/matrix.h Sat Feb 06 18:23:34 2016 -0800 @@ -0,0 +1,56 @@ +/* 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 + * 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 + +// MD1 +// +// Columns (Strobe) +// PTB0..3,16,17 +// PTC4,5 +// PTD0 +// +// Rows (Sense) +// PTD1..7 + +// Define Rows (Sense) and Columns (Strobes) +GPIO_Pin Matrix_cols[] = { gpio(C,0), gpio(C,1), gpio(C,2), gpio(C,3), gpio(C,4), gpio(C,5), gpio(C,6), gpio(C,7), gpio(D,0) }; +GPIO_Pin Matrix_rows[] = { gpio(D,1), gpio(D,2), gpio(D,3), gpio(D,4), gpio(D,5), gpio(D,6), gpio(D,7) }; + +// Define type of scan matrix +Config Matrix_type = Config_Pulldown; + diff -r 8fa2619aa60e -r 065959b4f7bd Scan/MD1_1/pinout --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Scan/MD1_1/pinout Sat Feb 06 18:23:34 2016 -0800 @@ -0,0 +1,93 @@ +Pin Usage +========= + +mk20dx128vlf5 + + ---- +|Keys| + ---- + +* Strobe (Columns) + +TODO + + +* Sense (Rows) + +PTD1 +PTD2 +PTD3 +PTD4 +PTD5 +PTD6 +PTD7 + + + --- +|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) + + + ----- +|Debug| + ----- + +* SWD + +PTA0 (Pull-down) +PTA3 (Pull-up) + +* LEDs + +PTA19 (LED only for PCB, not McHCK) (XTAL) + +* UARTs + +PTA1 - RX0 +PTA2 - TX0 + +* Tag Connect + +1 - Vdd +5 +2 - PTA3 / SWD_IO +3 - Vss / Gnd +4 - PTA0 / SWD_CLK +5 - +5V +6 - PTA2 / TRACE_SWO +7 - N/C +8 - PTA1 / JTAG_TDI +9 - N/C +10 - Reset_b + + + ------ +|Unused| + ------ + +* GPIO + +PTA1 (Not broken out on PCB, available on McHCK) (Pull-up) +PTA2 (") +PTA4 (Pull-up) +PTA18 (EXTAL) + +PTC0 +PTC1 +PTC2 +PTC3 +PTC6 +PTC7 + +* Analog + +ADC0_DP0 +ADC0_DM0 + + diff -r 8fa2619aa60e -r 065959b4f7bd Scan/MD1_1/scan_loop.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Scan/MD1_1/scan_loop.c Sat Feb 06 18:23:34 2016 -0800 @@ -0,0 +1,168 @@ +/* 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 + * 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 + +// 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 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() +{ + Matrix_scan( Scan_scanCount++ ); + + // 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; +} + + + +// ----- Capabilities ----- + +// Custom capability examples +// Refer to kll.h in Macros/PartialMap for state and stateType information +void CustomAction_action1_capability( uint8_t state, uint8_t stateType, uint8_t *args ) +{ + // Display capability name + // XXX This is required for debug cli to give you a list of capabilities + if ( stateType == 0xFF && state == 0xFF ) + { + print("CustomAction_action1_capability()"); + return; + } + + // Prints Action1 info message to the debug cli + info_print("Action1"); +} + +uint8_t CustomAction_blockHold_storage = 0; +void CustomAction_blockHold_capability( uint8_t state, uint8_t stateType, uint8_t *args ) +{ + // Display capability name + if ( stateType == 0xFF && state == 0xFF ) + { + print("CustomAction_blockHold_capability(usbCode)"); + return; + } + + // Retrieve 8-bit argument + uint8_t key = args[0]; + + // We only care about normal keys + if ( stateType == 0x00 ) + { + // Block given key if we're in the "Press" or "Hold" state + if ( ( state == 0x01 || state == 0x02 ) + && CustomAction_blockHold_storage == 0 ) + { + CustomAction_blockHold_storage = key; + info_msg("Blocking Key: "); + printHex( key ); + print( NL ); + } + // Release if in the "Off" or "Release" state and we're blocking + else if ( ( state == 0x00 || state == 0x03 ) + && key == CustomAction_blockHold_storage ) + { + info_msg("Unblocking Key: "); + printHex( CustomAction_blockHold_storage ); + print( NL ); + CustomAction_blockHold_storage = 0; + } + } +} + +void CustomAction_blockKey_capability( uint8_t state, uint8_t stateType, uint8_t *args ) +{ + // Display capability name + if ( stateType == 0xFF && state == 0xFF ) + { + print("CustomAction_blockKey_capability(usbCode)"); + return; + } + + // Retrieve 8-bit argument + uint8_t key = args[0]; + + // If key is not blocked, process + if ( key != CustomAction_blockHold_storage ) + { + extern void Output_usbCodeSend_capability( uint8_t state, uint8_t stateType, uint8_t *args ); + Output_usbCodeSend_capability( state, stateType, &key ); + } +} + diff -r 8fa2619aa60e -r 065959b4f7bd Scan/MD1_1/scan_loop.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Scan/MD1_1/scan_loop.h Sat Feb 06 18:23:34 2016 -0800 @@ -0,0 +1,48 @@ +/* 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 + + +// ----- Capabilities ----- + +// Example capabilities +void CustomAction_action1_capability( uint8_t state, uint8_t stateType, uint8_t *args ); +void CustomAction_blockHold_capability( uint8_t state, uint8_t stateType, uint8_t *args ); +void CustomAction_blockKey_capability( uint8_t state, uint8_t stateType, uint8_t *args ); + diff -r 8fa2619aa60e -r 065959b4f7bd Scan/MD1_1/setup.cmake --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Scan/MD1_1/setup.cmake Sat Feb 06 18:23:34 2016 -0800 @@ -0,0 +1,33 @@ +###| CMake Kiibohd Controller Scan Module |### +# +# Written by Jacob Alexander in 2014,2016 for the Kiibohd Controller +# +# Released into the Public Domain +# +### + + +### +# Required Submodules +# + +AddModule ( Scan ISSILed ) +AddModule ( Scan MatrixARM ) + + +### +# Module C files +# + +set ( Module_SRCS + scan_loop.c +) + + +### +# Compiler Family Compatibility +# +set ( ModuleCompatibility + arm +) + diff -r 8fa2619aa60e -r 065959b4f7bd Scan/STLcd/exampleAPI.bash --- a/Scan/STLcd/exampleAPI.bash Sat Jan 02 17:43:05 2016 -0800 +++ b/Scan/STLcd/exampleAPI.bash Sat Feb 06 18:23:34 2016 -0800 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # STLcd # Virtual Serial Port API Example # Jacob Alexander 2015 diff -r 8fa2619aa60e -r 065959b4f7bd Scan/WhiteFox/defaultMap.kll --- a/Scan/WhiteFox/defaultMap.kll Sat Jan 02 17:43:05 2016 -0800 +++ b/Scan/WhiteFox/defaultMap.kll Sat Feb 06 18:23:34 2016 -0800 @@ -102,28 +102,28 @@ # # Each LED channel supports 256 levels (8-bit control) # By default, LEDs are set to 0 brightness -ISSILedBrightness1 = " -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C1-1 -> C1-16 */ -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C2-1 -> C2-16 */ -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C3-1 -> C3-16 */ -0x00, 0x00, 0x00, 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 */ -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C7-1 -> C7-16 */ -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C8-1 -> C8-16 */ -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C9-1 -> C9-16 */ -"; +#ISSILedBrightness1 = " +#0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C1-1 -> C1-16 */ +#0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C2-1 -> C2-16 */ +#0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C3-1 -> C3-16 */ +#0x00, 0x00, 0x00, 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 */ +#0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C7-1 -> C7-16 */ +#0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C8-1 -> C8-16 */ +#0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C9-1 -> C9-16 */ +#"; # Full brightness example -#ISSILedBrightness1 = " -#0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C1-1 -> C1-16 */ -#0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C2-1 -> C2-16 */ -#0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C3-1 -> C3-16 */ -#0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C4-1 -> C4-16 */ -#0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C5-1 -> C5-16 */ -#0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C6-1 -> C6-16 */ -#0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C7-1 -> C7-16 */ -#0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C8-1 -> C8-16 */ -#0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C9-1 -> C9-16 */ -#"; +ISSILedBrightness1 = " +0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C1-1 -> C1-16 */ +0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C2-1 -> C2-16 */ +0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C3-1 -> C3-16 */ +0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C4-1 -> C4-16 */ +0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C5-1 -> C5-16 */ +0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C6-1 -> C6-16 */ +0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C7-1 -> C7-16 */ +0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C8-1 -> C8-16 */ +0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C9-1 -> C9-16 */ +"; diff -r 8fa2619aa60e -r 065959b4f7bd buildall.bash --- a/buildall.bash Sat Jan 02 17:43:05 2016 -0800 +++ b/buildall.bash Sat Feb 06 18:23:34 2016 -0800 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash ###| Builder Script |### # # Builds all permutations of modules @@ -31,7 +31,8 @@ # Create permutation directories # Then run cmake, and run each build permutation # Keeping track of how many builds failed/passed - for module in $scanModules; do + for mod in $scanModules; do + module=$(tr -dc "[:print:]" <<< "$mod") # Create directory, but do not error if it exists already mkdir -p build/$module cd build/$module