Initial support for the ICPad
- Basic support for up to 4 ISSI chips (and partial support for 16 chip configurations) - Initial USB mux support * Required USB re-init procedure - Initial interconnect mux support * Required some state reset commands
This commit is contained in:
parent
ea82a2762b
commit
ff0c45ec8f
@ -28,6 +28,7 @@ Projects
|
|||||||
--------
|
--------
|
||||||
|
|
||||||
* infinity.bash (Infinity Keyboard 2014/10/15)
|
* infinity.bash (Infinity Keyboard 2014/10/15)
|
||||||
|
* icpad.bash (Soon?)
|
||||||
* ergodox.bash (Infinity Ergodox 2015/08/15)
|
* ergodox.bash (Infinity Ergodox 2015/08/15)
|
||||||
* template.bash (Example template for new keyboards)
|
* template.bash (Example template for new keyboards)
|
||||||
* whitefox.bash (Soon?)
|
* whitefox.bash (Soon?)
|
||||||
|
72
Keyboards/icpad.bash
Executable file
72
Keyboards/icpad.bash
Executable file
@ -0,0 +1,72 @@
|
|||||||
|
#!/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="PartialMap"
|
||||||
|
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
|
||||||
|
|
@ -1176,6 +1176,9 @@ uint8_t usb_init()
|
|||||||
print("USB INIT"NL);
|
print("USB INIT"NL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Unset usb configuration
|
||||||
|
usb_configuration = 0;
|
||||||
|
|
||||||
// Clear out endpoints table
|
// Clear out endpoints table
|
||||||
for ( int i = 0; i <= NUM_ENDPOINTS * 4; i++ )
|
for ( int i = 0; i <= NUM_ENDPOINTS * 4; i++ )
|
||||||
{
|
{
|
||||||
|
@ -38,7 +38,7 @@ Supported Microcontrollers
|
|||||||
|
|
||||||
* Teensy 2.0 (Partial)
|
* Teensy 2.0 (Partial)
|
||||||
* Teensy 2.0++
|
* Teensy 2.0++
|
||||||
* Teensy 3.0
|
* Teesny 3.0
|
||||||
* Teensy 3.1
|
* Teensy 3.1
|
||||||
* mk20dx128vlf5
|
* mk20dx128vlf5
|
||||||
* mk20dx256vlh7
|
* mk20dx256vlh7
|
||||||
|
169
Scan/ICPad/defaultMap.kll
Normal file
169
Scan/ICPad/defaultMap.kll
Normal file
@ -0,0 +1,169 @@
|
|||||||
|
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 */
|
||||||
|
";
|
||||||
|
|
56
Scan/ICPad/matrix.h
Normal file
56
Scan/ICPad/matrix.h
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
/* Copyright (C) 2014-2015 by Jacob Alexander
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// ----- Includes -----
|
||||||
|
|
||||||
|
// Project Includes
|
||||||
|
#include <matrix_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;
|
||||||
|
|
114
Scan/ICPad/pinout
Normal file
114
Scan/ICPad/pinout
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
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
|
||||||
|
|
106
Scan/ICPad/scan_loop.c
Normal file
106
Scan/ICPad/scan_loop.c
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
/* Copyright (C) 2014-2015 by Jacob Alexander
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// ----- Includes -----
|
||||||
|
|
||||||
|
// Compiler Includes
|
||||||
|
#include <Lib/ScanLib.h>
|
||||||
|
|
||||||
|
// Project Includes
|
||||||
|
#include <cli.h>
|
||||||
|
#include <connect_scan.h>
|
||||||
|
#include <led.h>
|
||||||
|
#include <led_scan.h>
|
||||||
|
#include <print.h>
|
||||||
|
#include <matrix_scan.h>
|
||||||
|
#include <macro.h>
|
||||||
|
#include <output_com.h>
|
||||||
|
#include <port_scan.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();
|
||||||
|
|
||||||
|
// 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();
|
||||||
|
|
||||||
|
// Process any LED events
|
||||||
|
LED_scan();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Signal from Macro Module that all keys have been processed (that it knows about)
|
||||||
|
inline void Scan_finishedWithMacro( uint8_t sentKeys )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Signal from Output Module that all keys have been processed (that it knows about)
|
||||||
|
inline void Scan_finishedWithOutput( uint8_t sentKeys )
|
||||||
|
{
|
||||||
|
// Reset scan loop indicator (resets each key debounce state)
|
||||||
|
// TODO should this occur after USB send or Macro processing?
|
||||||
|
Scan_scanCount = 0;
|
||||||
|
}
|
||||||
|
|
40
Scan/ICPad/scan_loop.h
Normal file
40
Scan/ICPad/scan_loop.h
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
/* Copyright (C) 2014-2015 by Jacob Alexander
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// ----- Includes -----
|
||||||
|
|
||||||
|
// Compiler Includes
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ----- Functions -----
|
||||||
|
|
||||||
|
// Functions to be called by main.c
|
||||||
|
void Scan_setup( void );
|
||||||
|
uint8_t Scan_loop( void );
|
||||||
|
|
||||||
|
// Call-backs
|
||||||
|
void Scan_finishedWithMacro( uint8_t sentKeys ); // Called by Macro Module
|
||||||
|
void Scan_finishedWithOutput( uint8_t sentKeys ); // Called by Output Module
|
||||||
|
|
33
Scan/ICPad/setup.cmake
Normal file
33
Scan/ICPad/setup.cmake
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
###| 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
|
||||||
|
)
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
Name = ISSILedCapabilities;
|
Name = ISSILedCapabilities;
|
||||||
Version = 0.2;
|
Version = 0.2;
|
||||||
Author = "HaaTa (Jacob Alexander) 2015";
|
Author = "HaaTa (Jacob Alexander) 2015";
|
||||||
KLL = 0.3c;
|
KLL = 0.3d;
|
||||||
|
|
||||||
# Modified Date
|
# Modified Date
|
||||||
Date = 2015-10-09;
|
Date = 2015-10-09;
|
||||||
@ -24,6 +24,10 @@ ledControl => LED_control_capability( mode : 1, amount : 1, index : 2 );
|
|||||||
|
|
||||||
# Defines available to the ISSILed sub-module
|
# Defines available to the ISSILed sub-module
|
||||||
|
|
||||||
|
# Available ISSI Chips
|
||||||
|
ISSI_Chips => ISSI_Chips_define;
|
||||||
|
ISSI_Chips = 1; # 1 by default
|
||||||
|
|
||||||
# LED Default Enable Mask
|
# LED Default Enable Mask
|
||||||
#
|
#
|
||||||
# By default, all LEDs are enabled
|
# By default, all LEDs are enabled
|
||||||
@ -43,6 +47,19 @@ ISSILedMask1 = "
|
|||||||
0xFF, 0xFF, /* C9-1 -> C9-16 */
|
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 */
|
||||||
|
";
|
||||||
|
|
||||||
# LED Default Brightness
|
# LED Default Brightness
|
||||||
#
|
#
|
||||||
# By default, all LEDs are set to max brightness
|
# By default, all LEDs are set to max brightness
|
||||||
@ -60,6 +77,19 @@ ISSILedBrightness1 = "
|
|||||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* C9-1 -> C9-16 */
|
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, 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
|
# Example starting from 0 brightness to 0x8F
|
||||||
ISSILedBrightness_example = "
|
ISSILedBrightness_example = "
|
||||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, /* C1-1 -> C1-16 */
|
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, /* C1-1 -> C1-16 */
|
||||||
|
@ -27,5 +27,8 @@ printf "\r" > $SERIALPORT
|
|||||||
# Page 0x0A is used for configuration
|
# Page 0x0A is used for configuration
|
||||||
# See the datasheet for full details http://www.issi.com/WW/pdf/31FL3731C.pdf
|
# See the datasheet for full details http://www.issi.com/WW/pdf/31FL3731C.pdf
|
||||||
sleep 0.1
|
sleep 0.1
|
||||||
printf "ledWPage 0x00 0x24 0x10 0x20 0x30 0x40 0x50\r" > $SERIALPORT
|
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
|
||||||
|
|
||||||
|
@ -37,13 +37,53 @@
|
|||||||
|
|
||||||
// ----- Defines -----
|
// ----- Defines -----
|
||||||
|
|
||||||
|
// Increase buffer sizes for RGB
|
||||||
|
#ifdef ISSI_RGB_define
|
||||||
|
#define I2C_TxBufferLength 600
|
||||||
|
#define I2C_RxBufferLength 16
|
||||||
|
#else
|
||||||
#define I2C_TxBufferLength 300
|
#define I2C_TxBufferLength 300
|
||||||
#define I2C_RxBufferLength 8
|
#define I2C_RxBufferLength 8
|
||||||
|
#endif
|
||||||
|
|
||||||
#define LED_BufferLength 144
|
#define LED_BufferLength 144
|
||||||
|
#define LED_EnableBufferLength 18
|
||||||
|
|
||||||
// TODO Needs to be defined per keyboard
|
#define LED_TotalChannels (144 * ISSI_Chips_define)
|
||||||
#define LED_TotalChannels 144
|
|
||||||
|
// ISSI Addresses
|
||||||
|
// IS31FL3731 (max 4 channels per bus)
|
||||||
|
#if 1
|
||||||
|
#define ISSI_Ch1 0xE8
|
||||||
|
#define ISSI_Ch2 0xEA
|
||||||
|
#define ISSI_Ch3 0xEC
|
||||||
|
#define ISSI_Ch4 0xEE
|
||||||
|
|
||||||
|
// IS31FL3732 (max 16 channels per bus)
|
||||||
|
#else
|
||||||
|
#define ISSI_Ch1 0xB0
|
||||||
|
#define ISSI_Ch2 0xB2
|
||||||
|
#define ISSI_Ch3 0xB4
|
||||||
|
#define ISSI_Ch4 0xB6
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ----- Macros -----
|
||||||
|
|
||||||
|
#define LED_MaskDefine(ch) \
|
||||||
|
{ \
|
||||||
|
ISSI_Ch##ch, /* I2C address */ \
|
||||||
|
0x00, /* Starting register address */ \
|
||||||
|
{ ISSILedMask##ch##_define }, \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define LED_BrightnessDefine(ch) \
|
||||||
|
{ \
|
||||||
|
ISSI_Ch##ch, /* I2C address */ \
|
||||||
|
0x24, /* Starting register address */ \
|
||||||
|
{ ISSILedBrightness##ch##_define }, \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -63,6 +103,12 @@ typedef struct LED_Buffer {
|
|||||||
uint8_t buffer[LED_BufferLength];
|
uint8_t buffer[LED_BufferLength];
|
||||||
} LED_Buffer;
|
} LED_Buffer;
|
||||||
|
|
||||||
|
typedef struct LED_EnableBuffer {
|
||||||
|
uint8_t i2c_addr;
|
||||||
|
uint8_t reg_addr;
|
||||||
|
uint8_t buffer[LED_EnableBufferLength];
|
||||||
|
} LED_EnableBuffer;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ----- Function Declarations -----
|
// ----- Function Declarations -----
|
||||||
@ -93,7 +139,7 @@ CLIDict_Entry( ledCtrl, "Basic LED control. Args: <mode> <amount> [<index>]"
|
|||||||
CLIDict_Entry( ledRPage, "Read the given register page." );
|
CLIDict_Entry( ledRPage, "Read the given register page." );
|
||||||
CLIDict_Entry( ledStart, "Disable software shutdown." );
|
CLIDict_Entry( ledStart, "Disable software shutdown." );
|
||||||
CLIDict_Entry( ledTest, "Test out the led pages." );
|
CLIDict_Entry( ledTest, "Test out the led pages." );
|
||||||
CLIDict_Entry( ledWPage, "Write to given register page starting at address. i.e. 0x2 0x24 0xF0 0x12" );
|
CLIDict_Entry( ledWPage, "Write to given register page starting at address. i.e. 0xE8 0x2 0x24 0xF0 0x12" );
|
||||||
CLIDict_Entry( ledZero, "Zero out LED register pages (non-configuration)." );
|
CLIDict_Entry( ledZero, "Zero out LED register pages (non-configuration)." );
|
||||||
|
|
||||||
CLIDict_Def( ledCLIDict, "ISSI LED Module Commands" ) = {
|
CLIDict_Def( ledCLIDict, "ISSI LED Module Commands" ) = {
|
||||||
@ -118,23 +164,42 @@ volatile uint8_t I2C_RxBufferPtr[ I2C_TxBufferLength ];
|
|||||||
volatile I2C_Buffer I2C_TxBuffer = { 0, 0, 0, I2C_TxBufferLength, (uint8_t*)I2C_TxBufferPtr };
|
volatile I2C_Buffer I2C_TxBuffer = { 0, 0, 0, I2C_TxBufferLength, (uint8_t*)I2C_TxBufferPtr };
|
||||||
volatile I2C_Buffer I2C_RxBuffer = { 0, 0, 0, I2C_RxBufferLength, (uint8_t*)I2C_RxBufferPtr };
|
volatile I2C_Buffer I2C_RxBuffer = { 0, 0, 0, I2C_RxBufferLength, (uint8_t*)I2C_RxBufferPtr };
|
||||||
|
|
||||||
LED_Buffer LED_pageBuffer;
|
LED_Buffer LED_pageBuffer[ ISSI_Chips_define ];
|
||||||
|
|
||||||
// A bit mask determining which LEDs are enabled in the ISSI chip
|
// Enable mask and default brightness for ISSI chip channel
|
||||||
const uint8_t LED_ledEnableMask1[] = {
|
const LED_EnableBuffer LED_ledEnableMask[ISSI_Chips_define] = {
|
||||||
0xE8, // I2C address
|
LED_MaskDefine( 1 ),
|
||||||
0x00, // Starting register address
|
#if ISSI_Chips_define >= 2
|
||||||
ISSILedMask1_define
|
LED_MaskDefine( 2 ),
|
||||||
|
#endif
|
||||||
|
#if ISSI_Chips_define >= 3
|
||||||
|
LED_MaskDefine( 3 ),
|
||||||
|
#endif
|
||||||
|
#if ISSI_Chips_define >= 4
|
||||||
|
LED_MaskDefine( 4 ),
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
// Default LED brightness
|
// Default LED brightness
|
||||||
const uint8_t LED_defaultBrightness1[] = {
|
const LED_Buffer LED_defaultBrightness[ISSI_Chips_define] = {
|
||||||
0xE8, // I2C address
|
LED_BrightnessDefine( 1 ),
|
||||||
0x24, // Starting register address
|
#if ISSI_Chips_define >= 2
|
||||||
ISSILedBrightness1_define
|
LED_BrightnessDefine( 2 ),
|
||||||
|
#endif
|
||||||
|
#if ISSI_Chips_define >= 3
|
||||||
|
LED_BrightnessDefine( 3 ),
|
||||||
|
#endif
|
||||||
|
#if ISSI_Chips_define >= 4
|
||||||
|
LED_BrightnessDefine( 4 ),
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#if ISSI_Chips_define >= 5
|
||||||
|
#error "Invalid number of ISSI Chips"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ----- Interrupt Functions -----
|
// ----- Interrupt Functions -----
|
||||||
|
|
||||||
@ -274,7 +339,10 @@ inline void I2C_setup()
|
|||||||
PORTB_PCR1 = 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
|
// SCL Frequency Divider
|
||||||
// 400kHz -> 120 (0x85) @ 48 MHz F_BUS
|
// 1.8 MBaud (likely higher than spec)
|
||||||
|
// 0x85 -> 36 MHz / (4 * 5) = 1.8 MBaud
|
||||||
|
// 0x80 => mul(4)
|
||||||
|
// 0x05 => ICL(5)
|
||||||
I2C0_F = 0x85;
|
I2C0_F = 0x85;
|
||||||
I2C0_FLT = 4;
|
I2C0_FLT = 4;
|
||||||
I2C0_C1 = I2C_C1_IICEN;
|
I2C0_C1 = I2C_C1_IICEN;
|
||||||
@ -284,14 +352,14 @@ inline void I2C_setup()
|
|||||||
NVIC_ENABLE_IRQ( IRQ_I2C0 );
|
NVIC_ENABLE_IRQ( IRQ_I2C0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void LED_zeroPages( uint8_t startPage, uint8_t numPages, uint8_t startReg, uint8_t endReg )
|
void LED_zeroPages( uint8_t addr, uint8_t startPage, uint8_t numPages, uint8_t startReg, uint8_t endReg )
|
||||||
{
|
{
|
||||||
// Page Setup
|
// Page Setup
|
||||||
uint8_t pageSetup[] = { 0xE8, 0xFD, 0x00 };
|
uint8_t pageSetup[] = { addr, 0xFD, 0x00 };
|
||||||
|
|
||||||
// Max length of a page + chip id + reg start
|
// Max length of a page + chip id + reg start
|
||||||
uint8_t fullPage[ 0xB4 + 2 ] = { 0 }; // Max size of page
|
uint8_t fullPage[ 0xB4 + 2 ] = { 0 }; // Max size of page
|
||||||
fullPage[0] = 0xE8; // Set chip id
|
fullPage[0] = addr; // Set chip id
|
||||||
fullPage[1] = startReg; // Set start reg
|
fullPage[1] = startReg; // Set start reg
|
||||||
|
|
||||||
// Iterate through given pages, zero'ing out the given register regions
|
// Iterate through given pages, zero'ing out the given register regions
|
||||||
@ -310,10 +378,10 @@ void LED_zeroPages( uint8_t startPage, uint8_t numPages, uint8_t startReg, uint8
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LED_sendPage( uint8_t *buffer, uint8_t len, uint8_t page )
|
void LED_sendPage( uint8_t addr, uint8_t *buffer, uint8_t len, uint8_t page )
|
||||||
{
|
{
|
||||||
// Page Setup
|
// Page Setup
|
||||||
uint8_t pageSetup[] = { 0xE8, 0xFD, page };
|
uint8_t pageSetup[] = { addr, 0xFD, page };
|
||||||
|
|
||||||
// Setup page
|
// Setup page
|
||||||
while ( I2C_Send( pageSetup, sizeof( pageSetup ), 0 ) == 0 )
|
while ( I2C_Send( pageSetup, sizeof( pageSetup ), 0 ) == 0 )
|
||||||
@ -325,58 +393,55 @@ void LED_sendPage( uint8_t *buffer, uint8_t len, uint8_t page )
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LED_writeReg( uint8_t reg, uint8_t val, uint8_t page )
|
// Write address
|
||||||
|
void LED_writeReg( uint8_t addr, uint8_t reg, uint8_t val, uint8_t page )
|
||||||
{
|
{
|
||||||
// Page Setup
|
// Page Setup
|
||||||
uint8_t pageSetup[] = { 0xE8, 0xFD, page };
|
uint8_t pageSetup[] = { addr, 0xFD, page };
|
||||||
|
|
||||||
// Reg Write Setup
|
// Reg Write Setup
|
||||||
uint8_t writeData[] = { 0xE8, reg, val };
|
uint8_t writeData[] = { addr, reg, val };
|
||||||
|
|
||||||
// Setup page
|
// Setup page
|
||||||
while ( I2C_Send( pageSetup, sizeof( pageSetup ), 0 ) == 0 )
|
while ( I2C_Send( pageSetup, sizeof( pageSetup ), 0 ) == 0 )
|
||||||
delay(1);
|
delay(1);
|
||||||
|
|
||||||
|
// Write register
|
||||||
while ( I2C_Send( writeData, sizeof( writeData ), 0 ) == 0 )
|
while ( I2C_Send( writeData, sizeof( writeData ), 0 ) == 0 )
|
||||||
delay(1);
|
delay(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LED_readPage( uint8_t len, uint8_t page )
|
// Read address
|
||||||
|
void LED_readReg( uint8_t addr, uint8_t reg, uint8_t page )
|
||||||
{
|
{
|
||||||
// Software shutdown must be enabled to read registers
|
// Software shutdown must be enabled to read registers
|
||||||
LED_writeReg( 0x0A, 0x00, 0x0B );
|
LED_writeReg( addr, 0x0A, 0x00, 0x0B );
|
||||||
|
|
||||||
// Page Setup
|
// Page Setup
|
||||||
uint8_t pageSetup[] = { 0xE8, 0xFD, page };
|
uint8_t pageSetup[] = { addr, 0xFD, page };
|
||||||
|
|
||||||
// Setup page
|
// Setup page
|
||||||
while ( I2C_Send( pageSetup, sizeof( pageSetup ), 0 ) == 0 )
|
while ( I2C_Send( pageSetup, sizeof( pageSetup ), 0 ) == 0 )
|
||||||
delay(1);
|
delay(1);
|
||||||
|
|
||||||
// Register Setup
|
// Register Setup
|
||||||
uint8_t regSetup[] = { 0xE8, 0x00 };
|
uint8_t regSetup[] = { addr, reg };
|
||||||
|
|
||||||
// Read each register in the page
|
|
||||||
for ( uint8_t reg = 0; reg < len; reg++ )
|
|
||||||
{
|
|
||||||
// Update register to read
|
|
||||||
regSetup[1] = reg;
|
|
||||||
|
|
||||||
// Configure register
|
// Configure register
|
||||||
while ( I2C_Send( regSetup, sizeof( regSetup ), 0 ) == 0 )
|
while ( I2C_Send( regSetup, sizeof( regSetup ), 0 ) == 0 )
|
||||||
delay(1);
|
delay(1);
|
||||||
|
|
||||||
// Register Read Command
|
// Register Read Command
|
||||||
uint8_t regReadCmd[] = { 0xE9 };
|
uint8_t regReadCmd[] = { addr | 0x1 };
|
||||||
|
|
||||||
// Request single register byte
|
// Request single register byte
|
||||||
while ( I2C_Send( regReadCmd, sizeof( regReadCmd ), 1 ) == 0 )
|
while ( I2C_Send( regReadCmd, sizeof( regReadCmd ), 1 ) == 0 )
|
||||||
delay(1);
|
delay(1);
|
||||||
dbug_print("NEXT");
|
|
||||||
}
|
// TODO get byte from buffer
|
||||||
|
|
||||||
// Disable software shutdown
|
// Disable software shutdown
|
||||||
LED_writeReg( 0x0A, 0x01, 0x0B );
|
LED_writeReg( addr, 0x0A, 0x01, 0x0B );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup
|
// Setup
|
||||||
@ -388,9 +453,29 @@ inline void LED_setup()
|
|||||||
// Initialize I2C
|
// Initialize I2C
|
||||||
I2C_setup();
|
I2C_setup();
|
||||||
|
|
||||||
|
// Setup LED_pageBuffer addresses and brightness section
|
||||||
|
LED_pageBuffer[0].i2c_addr = ISSI_Ch1;
|
||||||
|
LED_pageBuffer[0].reg_addr = 0x24;
|
||||||
|
#if ISSI_Chips_define >= 2
|
||||||
|
LED_pageBuffer[1].i2c_addr = ISSI_Ch2;
|
||||||
|
LED_pageBuffer[1].reg_addr = 0x24;
|
||||||
|
#endif
|
||||||
|
#if ISSI_Chips_define >= 3
|
||||||
|
LED_pageBuffer[2].i2c_addr = ISSI_Ch3;
|
||||||
|
LED_pageBuffer[2].reg_addr = 0x24;
|
||||||
|
#endif
|
||||||
|
#if ISSI_Chips_define >= 4
|
||||||
|
LED_pageBuffer[3].i2c_addr = ISSI_Ch4;
|
||||||
|
LED_pageBuffer[3].reg_addr = 0x24;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Zero out Frame Registers
|
// Zero out Frame Registers
|
||||||
// This needs to be done before disabling the hardware shutdown (or the leds will do undefined things)
|
// This needs to be done before disabling the hardware shutdown (or the leds will do undefined things)
|
||||||
LED_zeroPages( 0x0B, 1, 0x00, 0x0C ); // Control Registers
|
for ( uint8_t ch = 0; ch < ISSI_Chips_define; ch++ )
|
||||||
|
{
|
||||||
|
uint8_t addr = LED_pageBuffer[ ch ].i2c_addr;
|
||||||
|
LED_zeroPages( addr, 0x0B, 1, 0x00, 0x0C ); // Control Registers
|
||||||
|
}
|
||||||
|
|
||||||
// Disable Hardware shutdown of ISSI chip (pull high)
|
// Disable Hardware shutdown of ISSI chip (pull high)
|
||||||
GPIOB_PDDR |= (1<<16);
|
GPIOB_PDDR |= (1<<16);
|
||||||
@ -398,16 +483,22 @@ inline void LED_setup()
|
|||||||
GPIOB_PSOR |= (1<<16);
|
GPIOB_PSOR |= (1<<16);
|
||||||
|
|
||||||
// Clear LED Pages
|
// Clear LED Pages
|
||||||
LED_zeroPages( 0x00, 8, 0x00, 0xB4 ); // LED Registers
|
|
||||||
|
|
||||||
// Enable LEDs based upon mask
|
// Enable LEDs based upon mask
|
||||||
LED_sendPage( (uint8_t*)LED_ledEnableMask1, sizeof( LED_ledEnableMask1 ), 0 );
|
|
||||||
|
|
||||||
// Set default brightness
|
// Set default brightness
|
||||||
LED_sendPage( (uint8_t*)LED_defaultBrightness1, sizeof( LED_defaultBrightness1 ), 0 );
|
for ( uint8_t ch = 0; ch < ISSI_Chips_define; ch++ )
|
||||||
|
{
|
||||||
|
uint8_t addr = LED_pageBuffer[ ch ].i2c_addr;
|
||||||
|
LED_zeroPages( addr, 0x00, 8, 0x00, 0xB4 ); // LED Registers
|
||||||
|
LED_sendPage( addr, (uint8_t*)&LED_ledEnableMask[ ch ], sizeof( LED_EnableBuffer ), 0 );
|
||||||
|
LED_sendPage( addr, (uint8_t*)&LED_defaultBrightness[ ch ], sizeof( LED_Buffer ), 0 );
|
||||||
|
}
|
||||||
|
|
||||||
// Disable Software shutdown of ISSI chip
|
// Disable Software shutdown of ISSI chip
|
||||||
LED_writeReg( 0x0A, 0x01, 0x0B );
|
for ( uint8_t ch = 0; ch < ISSI_Chips_define; ch++ )
|
||||||
|
{
|
||||||
|
uint8_t addr = LED_pageBuffer[ ch ].i2c_addr;
|
||||||
|
LED_writeReg( addr, 0x0A, 0x01, 0x0B );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -635,11 +726,6 @@ uint8_t I2C_Send( uint8_t *data, uint8_t sendLen, uint8_t recvLen )
|
|||||||
// LED State processing loop
|
// LED State processing loop
|
||||||
inline uint8_t LED_scan()
|
inline uint8_t LED_scan()
|
||||||
{
|
{
|
||||||
|
|
||||||
// I2C Busy
|
|
||||||
// S & I2C_S_BUSY
|
|
||||||
//I2C_S_BUSY
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -667,35 +753,31 @@ typedef struct LedControl {
|
|||||||
|
|
||||||
void LED_control( LedControl *control )
|
void LED_control( LedControl *control )
|
||||||
{
|
{
|
||||||
// Only send if we've completed all other transactions
|
|
||||||
/*
|
|
||||||
if ( I2C_TxBuffer.sequencePos > 0 )
|
|
||||||
return;
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Configure based upon the given mode
|
// Configure based upon the given mode
|
||||||
|
for ( uint8_t ch = 0; ch < ISSI_Chips_define; ch++ )
|
||||||
|
{
|
||||||
// TODO Perhaps do gamma adjustment?
|
// TODO Perhaps do gamma adjustment?
|
||||||
switch ( control->mode )
|
switch ( control->mode )
|
||||||
{
|
{
|
||||||
case LedControlMode_brightness_decrease:
|
case LedControlMode_brightness_decrease:
|
||||||
// Don't worry about rolling over, the cycle is quick
|
// Don't worry about rolling over, the cycle is quick
|
||||||
LED_pageBuffer.buffer[ control->index ] -= control->amount;
|
LED_pageBuffer[ ch ].buffer[ control->index ] -= control->amount;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LedControlMode_brightness_increase:
|
case LedControlMode_brightness_increase:
|
||||||
// Don't worry about rolling over, the cycle is quick
|
// Don't worry about rolling over, the cycle is quick
|
||||||
LED_pageBuffer.buffer[ control->index ] += control->amount;
|
LED_pageBuffer[ ch ].buffer[ control->index ] += control->amount;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LedControlMode_brightness_set:
|
case LedControlMode_brightness_set:
|
||||||
LED_pageBuffer.buffer[ control->index ] = control->amount;
|
LED_pageBuffer[ ch ].buffer[ control->index ] = control->amount;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LedControlMode_brightness_decrease_all:
|
case LedControlMode_brightness_decrease_all:
|
||||||
for ( uint8_t channel = 0; channel < LED_TotalChannels; channel++ )
|
for ( uint8_t channel = 0; channel < LED_TotalChannels; channel++ )
|
||||||
{
|
{
|
||||||
// Don't worry about rolling over, the cycle is quick
|
// Don't worry about rolling over, the cycle is quick
|
||||||
LED_pageBuffer.buffer[ channel ] -= control->amount;
|
LED_pageBuffer[ ch ].buffer[ channel ] -= control->amount;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -703,23 +785,25 @@ void LED_control( LedControl *control )
|
|||||||
for ( uint8_t channel = 0; channel < LED_TotalChannels; channel++ )
|
for ( uint8_t channel = 0; channel < LED_TotalChannels; channel++ )
|
||||||
{
|
{
|
||||||
// Don't worry about rolling over, the cycle is quick
|
// Don't worry about rolling over, the cycle is quick
|
||||||
LED_pageBuffer.buffer[ channel ] += control->amount;
|
LED_pageBuffer[ ch ].buffer[ channel ] += control->amount;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LedControlMode_brightness_set_all:
|
case LedControlMode_brightness_set_all:
|
||||||
for ( uint8_t channel = 0; channel < LED_TotalChannels; channel++ )
|
for ( uint8_t channel = 0; channel < LED_TotalChannels; channel++ )
|
||||||
{
|
{
|
||||||
LED_pageBuffer.buffer[ channel ] = control->amount;
|
LED_pageBuffer[ ch ].buffer[ channel ] = control->amount;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Sync LED buffer with ISSI chip buffer
|
// Sync LED buffer with ISSI chip buffer
|
||||||
// TODO Support multiple frames
|
// TODO Support multiple frames
|
||||||
LED_pageBuffer.i2c_addr = 0xE8; // Chip 1
|
for ( uint8_t ch = 0; ch < ISSI_Chips_define; ch++ )
|
||||||
LED_pageBuffer.reg_addr = 0x24; // Brightness section
|
{
|
||||||
LED_sendPage( (uint8_t*)&LED_pageBuffer, sizeof( LED_Buffer ), 0 );
|
LED_sendPage( LED_pageBuffer[ ch ].i2c_addr, (uint8_t*)&LED_pageBuffer[ ch ], sizeof( LED_Buffer ), 0 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t LED_control_timer = 0;
|
uint8_t LED_control_timer = 0;
|
||||||
@ -922,6 +1006,7 @@ void cliFunc_i2cRecv( char* args )
|
|||||||
// TODO Currently not working correctly
|
// TODO Currently not working correctly
|
||||||
void cliFunc_ledRPage( char* args )
|
void cliFunc_ledRPage( char* args )
|
||||||
{
|
{
|
||||||
|
/* TODO Use readReg command instead
|
||||||
// Parse number from argument
|
// Parse number from argument
|
||||||
// NOTE: Only first argument is used
|
// NOTE: Only first argument is used
|
||||||
char* arg1Ptr;
|
char* arg1Ptr;
|
||||||
@ -939,8 +1024,9 @@ void cliFunc_ledRPage( char* args )
|
|||||||
// No \r\n by default after the command is entered
|
// No \r\n by default after the command is entered
|
||||||
print( NL );
|
print( NL );
|
||||||
|
|
||||||
LED_readPage( 0x1, page );
|
// TODO, multi-channel
|
||||||
//LED_readPage( 0xB4, page );
|
LED_readPage( ISSI_Ch1, 0xB4, page );
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void cliFunc_ledWPage( char* args )
|
void cliFunc_ledWPage( char* args )
|
||||||
@ -949,14 +1035,23 @@ void cliFunc_ledWPage( char* args )
|
|||||||
char* arg1Ptr;
|
char* arg1Ptr;
|
||||||
char* arg2Ptr = args;
|
char* arg2Ptr = args;
|
||||||
|
|
||||||
// First process page and starting address
|
// First specify the write address
|
||||||
curArgs = arg2Ptr;
|
curArgs = arg2Ptr;
|
||||||
CLI_argumentIsolation( curArgs, &arg1Ptr, &arg2Ptr );
|
CLI_argumentIsolation( curArgs, &arg1Ptr, &arg2Ptr );
|
||||||
|
|
||||||
// Stop processing args if no more are found
|
// Stop processing args if no more are found
|
||||||
if ( *arg1Ptr == '\0' )
|
if ( *arg1Ptr == '\0' )
|
||||||
return;
|
return;
|
||||||
uint8_t page[] = { 0xE8, 0xFD, numToInt( arg1Ptr ) };
|
uint8_t addr = numToInt( arg1Ptr );
|
||||||
|
|
||||||
|
// Next process page and starting address
|
||||||
|
curArgs = arg2Ptr;
|
||||||
|
CLI_argumentIsolation( curArgs, &arg1Ptr, &arg2Ptr );
|
||||||
|
|
||||||
|
// Stop processing args if no more are found
|
||||||
|
if ( *arg1Ptr == '\0' )
|
||||||
|
return;
|
||||||
|
uint8_t page[] = { addr, 0xFD, numToInt( arg1Ptr ) };
|
||||||
|
|
||||||
curArgs = arg2Ptr;
|
curArgs = arg2Ptr;
|
||||||
CLI_argumentIsolation( curArgs, &arg1Ptr, &arg2Ptr );
|
CLI_argumentIsolation( curArgs, &arg1Ptr, &arg2Ptr );
|
||||||
@ -964,7 +1059,7 @@ void cliFunc_ledWPage( char* args )
|
|||||||
// Stop processing args if no more are found
|
// Stop processing args if no more are found
|
||||||
if ( *arg1Ptr == '\0' )
|
if ( *arg1Ptr == '\0' )
|
||||||
return;
|
return;
|
||||||
uint8_t data[] = { 0xE8, numToInt( arg1Ptr ), 0 };
|
uint8_t data[] = { addr, numToInt( arg1Ptr ), 0 };
|
||||||
|
|
||||||
// Set the register page
|
// Set the register page
|
||||||
while ( I2C_Send( page, sizeof( page ), 0 ) == 0 )
|
while ( I2C_Send( page, sizeof( page ), 0 ) == 0 )
|
||||||
@ -994,23 +1089,34 @@ void cliFunc_ledWPage( char* args )
|
|||||||
void cliFunc_ledStart( char* args )
|
void cliFunc_ledStart( char* args )
|
||||||
{
|
{
|
||||||
print( NL ); // No \r\n by default after the command is entered
|
print( NL ); // No \r\n by default after the command is entered
|
||||||
LED_zeroPages( 0x0B, 1, 0x00, 0x0C ); // Control Registers
|
|
||||||
//LED_zeroPages( 0x00, 8, 0x00, 0xB4 ); // LED Registers
|
|
||||||
LED_writeReg( 0x0A, 0x01, 0x0B );
|
|
||||||
LED_sendPage( (uint8_t*)LED_ledEnableMask1, sizeof( LED_ledEnableMask1 ), 0 );
|
|
||||||
|
|
||||||
|
for ( uint8_t ch = 0; ch < ISSI_Chips_define; ch++ )
|
||||||
|
{
|
||||||
|
LED_zeroPages( LED_ledEnableMask[ ch ].i2c_addr, 0x0B, 1, 0x00, 0x0C ); // Control Registers
|
||||||
|
//LED_zeroPages( 0x00, 8, 0x00, 0xB4 ); // LED Registers
|
||||||
|
LED_writeReg( LED_ledEnableMask[ ch ].i2c_addr, 0x0A, 0x01, 0x0B );
|
||||||
|
LED_sendPage( LED_ledEnableMask[ ch ].i2c_addr, (uint8_t*)&LED_ledEnableMask[ ch ], sizeof( LED_EnableBuffer ), 0 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cliFunc_ledTest( char* args )
|
void cliFunc_ledTest( char* args )
|
||||||
{
|
{
|
||||||
print( NL ); // No \r\n by default after the command is entered
|
print( NL ); // No \r\n by default after the command is entered
|
||||||
LED_sendPage( (uint8_t*)LED_defaultBrightness1, sizeof( LED_defaultBrightness1 ), 0 );
|
|
||||||
|
for ( uint8_t ch = 0; ch < ISSI_Chips_define; ch++ )
|
||||||
|
{
|
||||||
|
LED_sendPage( LED_defaultBrightness[ ch ].i2c_addr, (uint8_t*)&LED_defaultBrightness[ ch ], sizeof( LED_Buffer ), 0 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cliFunc_ledZero( char* args )
|
void cliFunc_ledZero( char* args )
|
||||||
{
|
{
|
||||||
print( NL ); // No \r\n by default after the command is entered
|
print( NL ); // No \r\n by default after the command is entered
|
||||||
LED_zeroPages( 0x00, 8, 0x24, 0xB4 ); // Only PWMs
|
|
||||||
|
for ( uint8_t ch = 0; ch < ISSI_Chips_define; ch++ )
|
||||||
|
{
|
||||||
|
LED_zeroPages( LED_defaultBrightness[ ch ].i2c_addr, 0x00, 8, 0x24, 0xB4 ); // Only PWMs
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cliFunc_ledCtrl( char* args )
|
void cliFunc_ledCtrl( char* args )
|
||||||
|
@ -196,7 +196,6 @@ void Matrix_setup()
|
|||||||
print( NL );
|
print( NL );
|
||||||
info_msg("Max Keys: ");
|
info_msg("Max Keys: ");
|
||||||
printHex( Matrix_maxKeys );
|
printHex( Matrix_maxKeys );
|
||||||
print( NL );
|
|
||||||
|
|
||||||
// Clear out Debounce Array
|
// Clear out Debounce Array
|
||||||
for ( uint8_t item = 0; item < Matrix_maxKeys; item++ )
|
for ( uint8_t item = 0; item < Matrix_maxKeys; item++ )
|
||||||
|
@ -26,7 +26,7 @@ UARTConnectBaudFine => UARTConnectBaudFine_define;
|
|||||||
# Thus baud setting = 26
|
# Thus baud setting = 26
|
||||||
# NOTE: If finer baud adjustment is needed see UARTx_C4 -> BRFA in the datasheet
|
# NOTE: If finer baud adjustment is needed see UARTx_C4 -> BRFA in the datasheet
|
||||||
# Baud fine setting = 0x02
|
# Baud fine setting = 0x02
|
||||||
UARTConnectBaud = 1; # 4.5 Mbpsa @ 72 MHz
|
UARTConnectBaud = 1; # 4.5 Mbps @ 72 MHz
|
||||||
UARTConnectBaudFine = 0x0;
|
UARTConnectBaudFine = 0x0;
|
||||||
|
|
||||||
#UARTConnectBaud = 39; # 115385 bps @ 72 MHz (close to 115200)
|
#UARTConnectBaud = 39; # 115385 bps @ 72 MHz (close to 115200)
|
||||||
|
@ -163,6 +163,7 @@ extern uint8_t Connect_master; // Set if master
|
|||||||
|
|
||||||
void Connect_setup( uint8_t master );
|
void Connect_setup( uint8_t master );
|
||||||
void Connect_scan();
|
void Connect_scan();
|
||||||
|
void Connect_reset();
|
||||||
|
|
||||||
void Connect_send_ScanCode( uint8_t id, TriggerGuide *scanCodeStateList, uint8_t numScanCodes );
|
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 );
|
void Connect_send_RemoteCapability( uint8_t id, uint8_t capabilityIndex, uint8_t state, uint8_t stateType, uint8_t numArgs, uint8_t *args );
|
||||||
|
Reference in New Issue
Block a user