]> git.donarmstrong.com Git - kiibohd-controller.git/blobdiff - Macro/buffer/macro.c
Merge branch 'master' of github.com:kiibohd/controller
[kiibohd-controller.git] / Macro / buffer / macro.c
index df89b1a6f6b900a7d9e1bad27cec64c528e80b81..9654c90484ac7fb5f41ba3493332b6037d832646 100644 (file)
@@ -1,15 +1,15 @@
-/* Copyright (C) 2011 by Jacob Alexander
- * 
+/* Copyright (C) 2011-2014 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
 
 // ----- Includes -----
 
-// AVR Includes
-#include <util/delay.h>
-#include <avr/interrupt.h>
+// Compiler Includes
+#include <Lib/MacroLib.h>
 
 // Project Includes
 #include <led.h>
 #include <print.h>
 #include <scan_loop.h>
-#include <usb_com.h>
+#include <output_com.h>
 
 // Keymaps
 #include <keymap.h>
@@ -52,7 +51,7 @@ static uint8_t Bootloader_ConditionSequence[] = {1,16,6,11};
 
 // ----- Functions -----
 
-inline void macro_finishedWithBuffer(void)
+inline void macro_finishedWithBuffer( uint8_t sentKeys )
 {
        /* BudKeypad
        // Boot loader sequence state handler
@@ -78,6 +77,7 @@ inline void macro_finishedWithBuffer(void)
 
 void jumpToBootloader(void)
 {
+#if defined(_at90usb162_) || defined(_atmega32u4_) || defined(_at90usb646_) || defined(_at90usb1286_) // AVR
        cli();
        // disable watchdog, if enabled
        // disable all peripherals
@@ -111,6 +111,7 @@ void jumpToBootloader(void)
        PORTA = 0; PORTB = 0; PORTC = 0; PORTD = 0; PORTE = 0; PORTF = 0;
        asm volatile("jmp 0x1FC00");
 #endif
+#endif
 }
 
 // Given a sampling array, and the current number of detected keypress
@@ -252,6 +253,7 @@ uint8_t sendCode = 0;
 int usbcodeMacro( uint8_t usbCode )
 {
        // Keyboard Input Test Macro
+       /*
        switch ( usbCode )
        {
        case KEY_F1:
@@ -304,7 +306,8 @@ int usbcodeMacro( uint8_t usbCode )
        }
        
        return 1;
-       //return 0;
+       */
+       return 0;
 }
 
 
@@ -369,10 +372,10 @@ void keyPressBufferRead( uint8_t *modifiers, uint8_t numberOfModifiers, uint8_t
        }
 
        // Signal Macro processor that all of the buffered keys have been processed
-       macro_finishedWithBuffer();
+       macro_finishedWithBuffer( KeyIndex_BufferUsed );
 
        // Signal buffer that we've used it
-       scan_finishedWithBuffer();
+       scan_finishedWithBuffer( KeyIndex_BufferUsed );
 }
 
 inline void process_macros(void)