Mercurial > louis > kiibohd-controller
diff main.c @ 123:0c5d1fe99302
Adding CLI and CDC Serial support for Teensy 2.0 and Teensy 2.0++
- Includes serial putchar and getchar cleanup (overall)
- Moved avr-capsense to DPH (renaming)
- Basic cleanup for including CLI on the avr architecture
author | Jacob Alexander <haata@kiibohd.com> |
---|---|
date | Mon, 31 Mar 2014 01:07:48 -0700 |
parents | 2bb16439e6ca |
children | 8dab4014c398 |
line wrap: on
line diff
--- a/main.c Sat Mar 22 14:32:06 2014 -0700 +++ b/main.c Mon Mar 31 01:07:48 2014 -0700 @@ -139,57 +139,43 @@ { // Configuring Pins pinSetup(); - init_errorLED(); + + // Enable CLI + init_cli(); // Setup Output Module output_setup(); - // Enable CLI - init_cli(); - // 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(); + // Process CLI + process_cli(); - 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; + // Acquire Key Indices + // Loop continuously until scan_loop returns 0 + cli(); + //while ( scan_loop() ); + sei(); - // Send USB Data - output_send(); - - // Clear sendKeypresses Flag - sendKeypresses = 0; - - // 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; } }