瀏覽代碼

Main USB timer now working, basic Teensy 3 support working.

- No scan modules are functional yet, but all of the API code is now "hardware support" complete
simple
Jacob Alexander 11 年之前
父節點
當前提交
4c7a4d98d4
共有 1 個檔案被更改,包括 13 行新增9 行删除
  1. 13
    9
      main.c

+ 13
- 9
main.c 查看文件

@@ -90,7 +90,7 @@ inline void pinSetup(void)

// ARM
#elif defined(_mk20dx128_)
// TODO
// TODO - Should be cleared, but not that necessary due to the pin layout
#endif
}

@@ -113,15 +113,19 @@ inline void usbTimerSetup(void)
#elif defined(_mk20dx128_)
// 48 MHz clock by default

// System Clock Gating Register Disable
SIM_SCGC6 |= SIM_SCGC6_PIT;

// 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
*/

// Insert the required vector for Timer 0
NVIC_ENABLE_IRQ( IRQ_PIT_CH0 );
#endif
}

@@ -135,12 +139,11 @@ int main(void)
// Setup USB Module
usb_setup();

print("TEST");
// Setup ISR Timer for flagging a kepress send to USB
usbTimerSetup();

// Main Detection Loop
uint8_t ledTimer = 15; // Enable LED for a short time
uint8_t ledTimer = F_CPU / 1000000; // Enable LED for a short time
while ( 1 )
{
// Setup the scanning module
@@ -154,10 +157,6 @@ 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();

@@ -201,5 +200,10 @@ void pit0_isr(void)
sendKeypressCounter = 0;
sendKeypresses = 1;
}

#if defined(_mk20dx128_) // ARM
// Clear the interrupt flag
PIT_TFLG0 = 1;
#endif
}