Archived
1
0

Initial LED Animiation Support

- Added port swapping to KType
- Added initial KType default keymappings
- Initial PixelMap animiation framework
- Swapped in new i2c library for ISSILed
This commit is contained in:
Jacob Alexander 2016-01-03 10:21:10 -08:00
parent f501a0e196
commit 1e47c7abc2
19 changed files with 1148 additions and 667 deletions

View File

@ -43,7 +43,7 @@ PartialMaps[1]=""
# Keyboard Module Configuration
ScanModule="ICPad"
MacroModule="PartialMap"
MacroModule="PixelMap"
OutputModule="pjrcUSB"
DebugModule="full"

72
Keyboards/ktype.bash Executable file
View 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="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 )
add_executable( ${TARGET_ELF} ${SRCS} generatedKeymap.h kll_defs.h )
#| .ELF Properties

View File

@ -11,7 +11,7 @@
# Check if KLL compiler is needed
#
if ( "${MacroModule}" STREQUAL "PartialMap" )
if ( "${MacroModule}" STREQUAL "PartialMap" OR "${MacroModule}" STREQUAL "PixelMap" )
@ -148,6 +148,7 @@ add_custom_target ( kll_regen
set ( SRCS ${SRCS} ${kll_outputname} )
else ()
message ( AUTHOR_WARNING "Unknown Macro module, ignoring kll generation" )
endif () # PartialMap

View File

@ -143,27 +143,27 @@ ISSILedBrightness2 = "
";
# 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 */
";
#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 */
";
#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,4 +1,4 @@
/* Copyright (C) 2014-2015 by Jacob Alexander
/* 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
@ -34,6 +34,7 @@
#include <macro.h>
#include <output_com.h>
#include <port_scan.h>
#include <pixel.h>
// Local Includes
#include "scan_loop.h"
@ -66,6 +67,9 @@ inline void Scan_setup()
// Setup ISSI chip to control the leds
LED_setup();
// Setup Pixel Map
Pixel_setup();
// Reset scan count
Scan_scanCount = 0;
}
@ -83,6 +87,9 @@ inline uint8_t Scan_loop()
// Process any interconnect commands
Connect_scan();
// Prepare any LED events
Pixel_process();
// Process any LED events
LED_scan();

View File

@ -28,6 +28,22 @@ ledControl => LED_control_capability( mode : 1, amount : 1, index : 2 );
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

313
Scan/ISSILed/i2c.c Normal file
View File

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

115
Scan/ISSILed/i2c.h Normal file
View File

@ -0,0 +1,115 @@
/*
* 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,8 +23,14 @@
// ----- Variables -----
extern uint8_t LED_FrameBuffersReady;
// ----- Functions -----
void LED_setup();
uint8_t LED_scan();
void LED_scan();

View File

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

View File

@ -4,9 +4,10 @@ Author = "HaaTa (Jacob Alexander) 2015";
KLL = 0.3c;
# Modified Date
Date = 2015-09-29;
Date = 2016-01-03;
# Function Row
S0x00 : U"Esc";
S0x01 : U"F1";
S0x02 : U"F2";
@ -23,6 +24,8 @@ S0x0C : U"F12";
S0x0D : U"PrintScreen";
S0x0E : U"ScrollLock";
S0x0F : U"Pause";
# Number Row
S0x10 : U"Backtick";
S0x11 : U"1";
S0x12 : U"2";
@ -36,67 +39,87 @@ S0x19 : U"9";
S0x1A : U"0";
S0x1B : U"Minus";
S0x1C : U"Equals";
S0x1D : U"Backspace";
S0x1E : U"Insert";
S0x1F : U"Home";
S0x20 : U"PageUp";
S0x21 : U"Tab";
S0x22 : U"Q";
S0x23 : U"W";
S0x24 : U"E";
S0x25 : U"R";
S0x26 : U"T";
S0x27 : U"Y";
S0x28 : U"U";
S0x29 : U"I";
S0x2A : U"O";
S0x2B : U"P";
S0x2C : U"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";
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
ISSI_Chips = 3; # 1 by default
# Default animation speed
ISSI_AnimationSpeed = 14; # 20 by default
# LED Default Enable Mask
#
@ -152,17 +175,18 @@ ISSILedMask4 = "
0xFF, 0xFF, /* C9-1 -> C9-16 */
";
#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 */
#";
# 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 */
@ -213,50 +237,50 @@ ISSILedBrightness4 = "
";
ISSILedBrightness1 = "
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /* C1-1 -> C1-16 */
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /* C2-1 -> C2-16 */
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /* C3-1 -> C3-16 */
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /* C4-1 -> C4-16 */
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /* C5-1 -> C5-16 */
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /* C6-1 -> C6-16 */
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /* C7-1 -> C7-16 */
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /* C8-1 -> C8-16 */
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /* C9-1 -> C9-16 */
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 */
";
ISSILedBrightness2 = "
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /* C1-1 -> C1-16 */
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /* C2-1 -> C2-16 */
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /* C3-1 -> C3-16 */
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /* C4-1 -> C4-16 */
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /* C5-1 -> C5-16 */
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /* C6-1 -> C6-16 */
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /* C7-1 -> C7-16 */
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /* C8-1 -> C8-16 */
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /* C9-1 -> C9-16 */
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 */
";
ISSILedBrightness3 = "
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /* C1-1 -> C1-16 */
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /* C2-1 -> C2-16 */
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /* C3-1 -> C3-16 */
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /* C4-1 -> C4-16 */
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /* C5-1 -> C5-16 */
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /* C6-1 -> C6-16 */
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /* C7-1 -> C7-16 */
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /* C8-1 -> C8-16 */
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /* C9-1 -> C9-16 */
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 */
";
ISSILedBrightness4 = "
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /* C1-1 -> C1-16 */
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /* C2-1 -> C2-16 */
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /* C3-1 -> C3-16 */
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /* C4-1 -> C4-16 */
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /* C5-1 -> C5-16 */
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /* C6-1 -> C6-16 */
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /* C7-1 -> C7-16 */
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /* C8-1 -> C8-16 */
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /* C9-1 -> C9-16 */
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 */
";

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
// MDErgo1
// KType
//
// Column (Strobe) - 9 Total
// Column (Strobe) - 10 Total
// PTB2,3,18,19
// PTC0,9..11
// PTC0,8..11
// PTD0
//
// Rows (Sense) - 5 Total
// Rows (Sense) - 10 Total
// PTD1,4..7
// PTC1..5
// Define Rows (Sense) and Columns (Strobes)
// TODO
GPIO_Pin Matrix_cols[] = { gpio(B,2), gpio(B,3), gpio(B,18), gpio(B,19), gpio(C,0), gpio(C,8), gpio(C,9), gpio(C,10), gpio(C,11) };
GPIO_Pin Matrix_rows[] = { gpio(D,0), gpio(D,1), gpio(D,4), gpio(D,5), gpio(D,6), gpio(D,7), gpio(C,1), gpio(C,2) };
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) };
// Define type of scan matrix
Config Matrix_type = Config_Pulldown;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2014-2015 by Jacob Alexander
/* 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
@ -33,6 +33,8 @@
#include <matrix_scan.h>
#include <macro.h>
#include <output_com.h>
#include <port_scan.h>
#include <pixel.h>
// Local Includes
#include "scan_loop.h"
@ -53,6 +55,9 @@ 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 );
@ -62,6 +67,9 @@ inline void Scan_setup()
// Setup ISSI chip to control the leds
LED_setup();
// Setup Pixel Map
Pixel_setup();
// Reset scan count
Scan_scanCount = 0;
}
@ -70,12 +78,18 @@ 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();

View File

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

View File

@ -196,7 +196,6 @@ void Matrix_setup()
print( NL );
info_msg("Max Keys: ");
printHex( Matrix_maxKeys );
print( NL );
// Clear out Debounce Array
for ( uint8_t item = 0; item < Matrix_maxKeys; item++ )

View File

@ -82,6 +82,9 @@ S0x46 : U"Right";
# Defines available to the WhiteFox Scan Module
# Default animation speed
ISSI_AnimationSpeed = 3; # 20 by default
# LED Default Enable Mask Override
#
# Each LED is represented by a single bit
@ -115,15 +118,15 @@ ISSILedBrightness1 = "
";
# 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 */
";

View File

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