changeset 426:64d1057661f3

Merge pull request #95 from cryham/master Fixes in CK3 (ghosting matrix), working version on full keyboard.
author Jacob Alexander <haata@kiibohd.com>
date Wed, 02 Mar 2016 11:07:10 -0800
parents cbcdb7a16b7c (diff) 971e88d4420a (current diff)
children f17857f4ca14
files
diffstat 4 files changed, 53 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/Scan/DPH/scan_loop.c	Tue Mar 01 21:00:23 2016 +0100
+++ b/Scan/DPH/scan_loop.c	Wed Mar 02 11:07:10 2016 -0800
@@ -1,18 +1,23 @@
-/* Copyright (C) 2011-2013 by Joseph Makuch
- * Additions by Jacob Alexander (2013-2014)
+/* Copyright (C) 2011-2013 by Joseph Makuch (jmakuch+f@gmail.com)
+ * Additions by Jacob Alexander (2013-2014) (haata@kiibohd.com)
  *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3.0 of the License, or (at your option) any later version.
+ * 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:
  *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
  *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
+ * 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 -----
--- a/Scan/DPH/scan_loop.h	Tue Mar 01 21:00:23 2016 +0100
+++ b/Scan/DPH/scan_loop.h	Wed Mar 02 11:07:10 2016 -0800
@@ -1,17 +1,22 @@
 /* Copyright (C) 2013-2015 by Jacob Alexander
  *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3.0 of the License, or (at your option) any later version.
+ * 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:
  *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
  *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
+ * 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
--- a/Scan/ISSILed/led_scan.c	Tue Mar 01 21:00:23 2016 +0100
+++ b/Scan/ISSILed/led_scan.c	Wed Mar 02 11:07:10 2016 -0800
@@ -639,12 +639,26 @@
 
 
 // LED State processing loop
+unsigned int LED_currentEvent = 0;
 inline uint8_t LED_scan()
 {
+	// Check for current change event
+	if ( LED_currentEvent )
+	{
+		// TODO dim LEDs in low power mode instead of shutting off
+		if ( LED_currentEvent < 150 )
+		{
+			// Enable Software shutdown of ISSI chip
+			LED_writeReg( 0x0A, 0x00, 0x0B );
+		}
+		else
+		{
+			// Disable Software shutdown of ISSI chip
+			LED_writeReg( 0x0A, 0x01, 0x0B );
+		}
 
-	// I2C Busy
-	// S & I2C_S_BUSY
-	//I2C_S_BUSY
+		LED_currentEvent = 0;
+	}
 
 	return 0;
 }
@@ -654,17 +668,8 @@
 // current - mA
 void LED_currentChange( unsigned int current )
 {
-	// TODO dim LEDs in low power mode instead of shutting off
-	if ( current < 150 )
-	{
-		// Enabled Software shutdown of ISSI chip
-		LED_writeReg( 0x0A, 0x00, 0x0B );
-	}
-	else
-	{
-		// Disable Software shutdown of ISSI chip
-		LED_writeReg( 0x0A, 0x01, 0x0B );
-	}
+	// Delay action till next LED scan loop (as this callback sometimes occurs during interrupt requests)
+	LED_currentEvent = current;
 }
 
 
--- a/Scan/WhiteFox/defaultMap.kll	Tue Mar 01 21:00:23 2016 +0100
+++ b/Scan/WhiteFox/defaultMap.kll	Wed Mar 02 11:07:10 2016 -0800
@@ -95,7 +95,7 @@
 	0xFF, 0x00, /* C6-1 -> C6-16 */
 	0xFF, 0x00, /* C7-1 -> C7-16 */
 	0xFF, 0x00, /* C8-1 -> C8-16 */
-	0xFE, 0x00, /* C9-1 -> C9-16 */
+	0xFF, 0x00, /* C9-1 -> C9-16 */
 ";
 
 # LED Brightness Override
@@ -124,6 +124,6 @@
 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 */
+0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* C9-1 -> C9-16 */
 ";