Adding initial Teensy 3 support, compiles, but not fully functional yet.

- CDC Output seems to be working
- USB Keyboard output has not been tested, but is "ready"
- UART and Timers have not been tested, or fully utilized
- Issues using Timer 0
- Initial template for MBC-55X Scan module (only module currently compatible with the arm build)
- Updated the interface to the AVR usb module for symmetry with the ARM usb module
- Much gutting was done to the Teensy 3 usb keyboard module, though not in an ideal state yet
This commit is contained in:
Jacob Alexander 2013-01-27 01:47:52 -05:00
parent 6da1558b78
commit c8b4baf652
29 changed files with 4501 additions and 34 deletions

30
main.c
View file

@ -111,7 +111,17 @@ inline void usbTimerSetup(void)
// ARM
#elif defined(_mk20dx128_)
// TODO
// 48 MHz clock by default
// Enable Timers
/* TODO Fixme!!
PIT_MCR = 0x00;
// Setup ISR Timer for flagging a kepress send to USB
// 1 ms / (1 / 48 MHz) - 1 = 47999 cycles -> 0xBB7F
PIT_LDVAL0 = 0x0000BB7F;
PIT_TCTRL0 = 0x3; // Enable Timer 0 interrupts, and Enable Timer 0
*/
#endif
}
@ -125,6 +135,7 @@ int main(void)
// Setup USB Module
usb_setup();
print("TEST");
// Setup ISR Timer for flagging a kepress send to USB
usbTimerSetup();
@ -143,6 +154,10 @@ int main(void)
while ( scan_loop() );
sei();
// XXX DEBUG
dPrint("AAAAAAA\r\n");
print("AAAAAAB\r\n");
// Run Macros over Key Indices and convert to USB Keys
process_macros();
@ -174,10 +189,12 @@ int main(void)
// ----- Interrupts -----
// AVR - USB Keyboard Data Send Counter Interrupt
#if defined(_at90usb162_) || defined(_atmega32u4_) || defined(_at90usb646_) || defined(_at90usb1286_)
// USB Keyboard Data Send Counter Interrupt
#if defined(_at90usb162_) || defined(_atmega32u4_) || defined(_at90usb646_) || defined(_at90usb1286_) // AVR
ISR( TIMER0_OVF_vect )
#elif defined(_mk20dx128_) // ARM
void pit0_isr(void)
#endif
{
sendKeypressCounter++;
if ( sendKeypressCounter > USB_TRANSFER_DIVIDER ) {
@ -186,8 +203,3 @@ ISR( TIMER0_OVF_vect )
}
}
// ARM - USB Keyboard Data Send Counter Interrupt
#elif defined(_mk20dx128_)
// TODO
#endif