]> git.donarmstrong.com Git - kiibohd-controller.git/blobdiff - main.c
Adding CLI and CDC Serial support for Teensy 2.0 and Teensy 2.0++
[kiibohd-controller.git] / main.c
diff --git a/main.c b/main.c
index 56487b6376c7c64a374f474fd08869d596d8b32b..7412fc6c99de56606dc9ebf8974e1a720bc37843 100644 (file)
--- a/main.c
+++ b/main.c
@@ -139,57 +139,43 @@ int main(void)
 {
        // Configuring Pins
        pinSetup();
-       init_errorLED();
-
-       // Setup Output Module
-       output_setup();
 
        // Enable CLI
        init_cli();
 
+       // Setup Output Module
+       output_setup();
+
        // Setup ISR Timer for flagging a kepress send to USB
        usbTimerSetup();
 
+       // Setup the scanning module
+       //scan_setup();
+
        // Main Detection Loop
-       uint8_t ledTimer = F_CPU / 1000000; // Enable LED for a short time
        while ( 1 )
        {
-               // Setup the scanning module
-               scan_setup();
-
-               while ( 1 )
-               {
-                       // Acquire Key Indices
-                       // Loop continuously until scan_loop returns 0
-                       cli();
-                       while ( scan_loop() );
-                       sei();
-
-                       // Run Macros over Key Indices and convert to USB Keys
-                       process_macros();
-
-                       // Send keypresses over USB if the ISR has signalled that it's time
-                       if ( !sendKeypresses )
-                               continue;
-
-                       // Send USB Data
-                       output_send();
+               // Process CLI
+               process_cli();
 
-                       // Clear sendKeypresses Flag
-                       sendKeypresses = 0;
+               // Acquire Key Indices
+               // Loop continuously until scan_loop returns 0
+               cli();
+               //while ( scan_loop() );
+               sei();
 
-                       // Indicate Error, if valid
-                       errorLED( ledTimer );
+               // Run Macros over Key Indices and convert to USB Keys
+               process_macros();
 
-                       if ( ledTimer > 0 )
-                               ledTimer--;
-               }
+               // Send keypresses over USB if the ISR has signalled that it's time
+               if ( !sendKeypresses )
+                       continue;
 
-               // Loop should never get here (indicate error)
-               ledTimer = 255;
+               // Send USB Data
+               output_send();
 
-               // HID Debug Error message
-               erro_print("Detection loop error, this is very bad...bug report!");
+               // Clear sendKeypresses Flag
+               sendKeypresses = 0;
        }
 }